npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@contextpilot-ai/contextpilot

v0.3.0

Published

ContextPilot plugin for OpenClaw — faster long-context inference via in-process context reuse. Zero external dependencies.

Readme

@contextpilot/contextpilot

OpenClaw plugin for ContextPilot — faster long-context inference via in-process context optimization. Zero external dependencies — no Python, no proxy server, just install and go.

What It Does

ContextPilot registers as an OpenClaw Context Engine and optimizes every LLM request by:

  1. Extracting documents from tool results
  2. Reordering documents for maximum prefix cache sharing across turns
  3. Deduplicating repeated content blocks with compact reference hints
  4. Injecting cache control markers (Anthropic cache_control: { type: "ephemeral" })

All processing happens in-process — no external services needed.

Installation

From npm (when published)

openclaw plugins install @contextpilot/contextpilot

From local path (development)

Add to ~/.openclaw/openclaw.json:

{
  "plugins": {
    "load": {
      "paths": [
        "/path/to/ContextPilot/openclaw-plugin"
      ]
    }
  }
}

Configuration

In ~/.openclaw/openclaw.json, enable the plugin and set it as the context engine:

{
  "plugins": {
    "slots": {
      "contextEngine": "contextpilot"
    },
    "entries": {
      "contextpilot": {
        "enabled": true,
        "config": {
          "scope": "all"
        }
      }
    }
  },
  "tools": {
    "allow": ["contextpilot"]
  }
}

Scope Options

| Scope | Tool Results | Description | |:------|:------------:|:------------| | all (default) | Optimized | Optimize all tool results | | tool_results | Optimized | Same as all |

Note: System prompt optimization is not currently available — OpenClaw's context engine API does not expose the system prompt to plugins.

How It Works

OpenClaw agent request
  ↓
ContextPilot Context Engine (assemble hook)
  ├─ Convert OpenClaw message format (toolResult → tool_result)
  ├─ Extract documents from tool results
  ├─ Reorder for prefix cache sharing
  ├─ Deduplicate repeated blocks
  ├─ Inject cache_control markers
  ↓
Optimized context → LLM Backend

The plugin registers as an OpenClaw Context Engine using api.registerContextEngine(). The assemble() hook intercepts context assembly before each LLM call.

Files

openclaw-plugin/
├── openclaw.plugin.json   # Plugin manifest (id: "contextpilot")
├── package.json           # npm package (@contextpilot/contextpilot)
├── src/
│   ├── index.ts           # Plugin entry point
│   └── engine/
│       ├── cache-control.ts   # Cache control injection
│       ├── dedup.ts           # Content deduplication
│       ├── extract.ts         # Document extraction
│       └── live-index.ts      # Reordering engine
└── tsconfig.json

Agent Tool

| Tool | Description | |------|-------------| | contextpilot_status | Check engine status, request count, and chars saved |

Note: The status tool is registered but may not be visible to agents due to OpenClaw plugin API limitations.

Verifying It Works

Check the gateway logs:

[ContextPilot] Stats: 5 requests, 28,356 chars saved (~7,089 tokens, ~$0.0213)

Expected Savings

Savings depend on conversation length and repeated content:

| Scenario | Chars Saved | Token Reduction | |:---------|------------:|----------------:| | Short session (few tool calls) | 0-5K | ~0-5% | | Medium session (10+ file reads) | 20-50K | ~10-20% | | Long session (repeated large files) | 100K+ | ~30-50% |

Run ./benchmark.sh to measure with/without comparison on your workload.

License

Apache-2.0