headroom/plugins/openclaw
JD Davis b88b9078d8
chore: release 0.36.0 (#3067)
🤖 I have created a release *beep* *boop*
---


##
[0.36.0](https://github.com/headroomlabs-ai/headroom/compare/v0.35.0...v0.36.0)
(2026-08-20)


### Features

* add deterministic runtime rollout controls
([#1490](https://github.com/headroomlabs-ai/headroom/issues/1490))
([3077ac8](3077ac81e8))
* **proxy:** let extensions report cost savings and their own latency
([#3051](https://github.com/headroomlabs-ai/headroom/issues/3051))
([f9807fd](f9807fd69e))
* **proxy:** unify savings attribution across stats, perf, metrics, and
dashboard
([1b0b0b8](1b0b0b89a4)),
closes [#2976](https://github.com/headroomlabs-ai/headroom/issues/2976)
* **wrap/claude:** make the --1m fallback model configurable via
HEADROOM_1M_MODEL
([#2983](https://github.com/headroomlabs-ai/headroom/issues/2983))
([2a84725](2a8472525d))


### Bug Fixes

* **anthropic:** honor the [1m] 1M-context tier, and price it correctly
([#3073](https://github.com/headroomlabs-ai/headroom/issues/3073))
([6d2254d](6d2254dfb5))
* **ccr:** make --no-ccr disable server-side response handling too
([#3101](https://github.com/headroomlabs-ai/headroom/issues/3101))
([131b119](131b119c05)),
closes [#3082](https://github.com/headroomlabs-ai/headroom/issues/3082)
* **ccr:** make StreamingCCRHandler work on OpenAI streams
([#3069](https://github.com/headroomlabs-ai/headroom/issues/3069))
([7ef736f](7ef736fb1a))
* **ccr:** only buffer a stream when a marker is actually redeemable
([#3092](https://github.com/headroomlabs-ai/headroom/issues/3092))
([c502087](c502087db7))
* **ccr:** re-inject headroom_retrieve when history references it on the
sessionless path
([942af56](942af56f11))
* **ccr:** relay a successful upstream turn when post-processing fails
([#3094](https://github.com/headroomlabs-ai/headroom/issues/3094))
([0ec73fa](0ec73faa28))
* **ccr:** send Accept: application/json on a buffered stream:false turn
([#3102](https://github.com/headroomlabs-ai/headroom/issues/3102))
([139c7cb](139c7cbdde)),
closes [#3078](https://github.com/headroomlabs-ai/headroom/issues/3078)
* **ccr:** verify a scanned marker's hash before advertising it
([#2908](https://github.com/headroomlabs-ai/headroom/issues/2908))
([41dab2d](41dab2d099))
* **ci:** prevent native detector from hanging test shards
([#2996](https://github.com/headroomlabs-ai/headroom/issues/2996))
([a708c05](a708c0571e))
* **ci:** scope the release credential and stop persisting it to disk
([#3062](https://github.com/headroomlabs-ai/headroom/issues/3062))
([ac8646a](ac8646aa3c))
* **ci:** unjam release and Docker publishing
([#2958](https://github.com/headroomlabs-ai/headroom/issues/2958))
([e269afb](e269afb935))
* **claude:** reject conflicting auth before proxy startup
([#2993](https://github.com/headroomlabs-ai/headroom/issues/2993))
([2d88e31](2d88e31a40))
* **cli/install:** resolve the deployment profile instead of dead-ending
on default
([#2832](https://github.com/headroomlabs-ai/headroom/issues/2832))
([8252619](82526191a1))
* **cli:** stop the macOS malloc re-exec replacing an embedder's process
([#3064](https://github.com/headroomlabs-ai/headroom/issues/3064))
([96c25f5](96c25f5181))
* **copilot:** route VS Code inline completions to Copilot, not OpenAI
([#3077](https://github.com/headroomlabs-ai/headroom/issues/3077))
([204e751](204e751d2f))
* **copilot:** send VS Code inline completions to the host that serves
them ([#3112](https://github.com/headroomlabs-ai/headroom/issues/3112))
([b77d612](b77d612913))
* **deps:** bump datasets past PYSEC-2026-3716
([#3136](https://github.com/headroomlabs-ai/headroom/issues/3136))
([df6ff6b](df6ff6bd5b))
* **deps:** clear the two Rust advisories and make cargo audit blocking
([#3121](https://github.com/headroomlabs-ai/headroom/issues/3121))
([93c474e](93c474e84b))
* **deps:** raise the GitPython floor to 3.1.58 to clear 9 open
advisories
([#3120](https://github.com/headroomlabs-ai/headroom/issues/3120))
([8156d4d](8156d4dc3a))
* **docker:** publish compose ports on loopback only
([#3061](https://github.com/headroomlabs-ai/headroom/issues/3061))
([481e0b8](481e0b83d5))
* **docker:** ship Bedrock auth and current registry
([#2982](https://github.com/headroomlabs-ai/headroom/issues/2982))
([eafdf11](eafdf11a2c))
* **doctor:** surface that Claude Desktop agent sessions bypass the
proxy ([#2987](https://github.com/headroomlabs-ai/headroom/issues/2987))
([be5b26d](be5b26d807))
* **install:** consolidate Windows fallback and cleanup safety
([#2980](https://github.com/headroomlabs-ai/headroom/issues/2980))
([ddd2a25](ddd2a259ec))
* **install:** honor HEADROOM_PORT in install apply and deploy
([#3085](https://github.com/headroomlabs-ai/headroom/issues/3085))
([58f28dc](58f28dc7a6))
* **install:** stop the PowerShell installer leaking temp dirs into the
real user PATH
([#2985](https://github.com/headroomlabs-ai/headroom/issues/2985))
([ddd9f76](ddd9f76729))
* **learn:** include stdout in CLI failure messages, not just stderr
([#3080](https://github.com/headroomlabs-ai/headroom/issues/3080))
([c5563d3](c5563d3a7d))
* **mcp:** restore SDK v1 compatibility cap
([#2978](https://github.com/headroomlabs-ai/headroom/issues/2978))
([6077e5a](6077e5a149))
* **memory:** sanitize entity_refs to prevent dict-shaped entries
crashing search
([#2951](https://github.com/headroomlabs-ai/headroom/issues/2951))
([2d1e96b](2d1e96b85c))
* **onnx:** enforce Rust API-24 runtime compatibility
([#2979](https://github.com/headroomlabs-ai/headroom/issues/2979))
([a3fe5cb](a3fe5cb65b))
* **openclaw-plugin:** circuit breaker + per-request timeout for proxy
resilience
([#639](https://github.com/headroomlabs-ai/headroom/issues/639))
([6576ef6](6576ef639c))
* **opencode:** send x-headroom-project header on all proxied requests
([#2868](https://github.com/headroomlabs-ai/headroom/issues/2868))
([eeb038b](eeb038bc0c))
* **policy:** price net-cost mutations with the 1h cache-write tier
([#2780](https://github.com/headroomlabs-ai/headroom/issues/2780))
([ef7e07e](ef7e07e0f5))
* **providers:** don't crash on a non-object HEADROOM_MODEL_LIMITS /
models.json
([#3089](https://github.com/headroomlabs-ai/headroom/issues/3089))
([3ed8f76](3ed8f76019))
* **proxy/anthropic:** don't buffer a CCR stream when passthrough
discards the stream flip
([#2953](https://github.com/headroomlabs-ai/headroom/issues/2953))
([f1c34d3](f1c34d336c))
* **proxy/anthropic:** don't replay recorded prefix over live history
([#3026](https://github.com/headroomlabs-ai/headroom/issues/3026))
([#3052](https://github.com/headroomlabs-ai/headroom/issues/3052))
([c16be9b](c16be9bbbe))
* **proxy/anthropic:** repair headroom_retrieve history references the
tools array cannot support
([#2876](https://github.com/headroomlabs-ai/headroom/issues/2876))
([7de3573](7de35739c6))
* **proxy/anthropic:** stop answering a non-streaming turn with an event
stream
([#3142](https://github.com/headroomlabs-ai/headroom/issues/3142))
([0e26fb8](0e26fb80de))
* **proxy/cache:** strip cache_control from messages in the semantic
cache key
([#3086](https://github.com/headroomlabs-ai/headroom/issues/3086))
([2cae0f8](2cae0f8eaf))
* **proxy/gemini:** guard CCR continuation usage against present-null
counts
([#3035](https://github.com/headroomlabs-ai/headroom/issues/3035))
([a01897c](a01897c791))
* **proxy/openai:** propagate provider usage on the Responses
WS->HTTP fallback
([#2988](https://github.com/headroomlabs-ai/headroom/issues/2988))
([536c949](536c949a69))
* **proxy:** adapt 200 SSE upstream replies on buffered /v1/responses
instead of 502
([#2622](https://github.com/headroomlabs-ai/headroom/issues/2622))
([d76fce0](d76fce04a3))
* **proxy:** align signed-thinking wire accounting
([#3015](https://github.com/headroomlabs-ai/headroom/issues/3015))
([b3f4436](b3f443636d))
* **proxy:** complete stateless Responses and buffered CCR lifecycle
([#2997](https://github.com/headroomlabs-ai/headroom/issues/2997))
([8a1d38b](8a1d38bc5d))
* **proxy:** guard feedback endpoints and add CSRF checks to loopback
writes
([#3060](https://github.com/headroomlabs-ai/headroom/issues/3060))
([a6ab359](a6ab359a5d))
* **proxy:** keep prefixed core tools resident
([#3046](https://github.com/headroomlabs-ai/headroom/issues/3046))
([2f4d001](2f4d001c9f))
* **proxy:** preserve Codex WebSocket model attribution
([#3029](https://github.com/headroomlabs-ai/headroom/issues/3029))
([a06a51e](a06a51eca6))
* **proxy:** relocate stray system-role messages to the top-level system
param ([#765](https://github.com/headroomlabs-ai/headroom/issues/765))
([#1357](https://github.com/headroomlabs-ai/headroom/issues/1357))
([9fde127](9fde127534))
* **proxy:** restore the buffered-CCR heartbeat behind a grace window
([#3091](https://github.com/headroomlabs-ai/headroom/issues/3091))
([a29d201](a29d2015e5))
* **proxy:** scope the signed-thinking lock to blocks that actually
changed
([#3124](https://github.com/headroomlabs-ai/headroom/issues/3124))
([17522fb](17522fb0a1))
* **proxy:** stop a lone surrogate turning a thinking body into a 500
([#3134](https://github.com/headroomlabs-ai/headroom/issues/3134))
([284ff31](284ff31947))
* **proxy:** stop cached responses replaying the producing turn's wire
framing
([#3024](https://github.com/headroomlabs-ai/headroom/issues/3024))
([9d37059](9d370592b0))
* **proxy:** stop operator secrets following a client-chosen upstream
([#3122](https://github.com/headroomlabs-ai/headroom/issues/3122))
([05f5ef4](05f5ef47cb))
* **proxy:** tune macOS libmalloc and trim allocator pages so long-lived
RSS stays bounded
([#2879](https://github.com/headroomlabs-ai/headroom/issues/2879))
([6d87825](6d87825f62))
* **reporting:** show net vs gross savings, real skip thresholds, and
the effective profile
([#3123](https://github.com/headroomlabs-ai/headroom/issues/3123))
([250ede2](250ede2f7f))
* tool_search_tool_regex deferred and falsely resolved on
direct-Anthropic path
([#2971](https://github.com/headroomlabs-ai/headroom/issues/2971))
([8ea87e7](8ea87e7804))
* **vscode:** persist compatible Claude modes and route Copilot CAPI
([#2986](https://github.com/headroomlabs-ai/headroom/issues/2986))
([1aa701a](1aa701adaa))
* **wrap:** set xAI upstream for grok-build proxy
([#2772](https://github.com/headroomlabs-ai/headroom/issues/2772))
([c831081](c8310819a4))
* **wrap:** stop the Serena pre-index stalling the launch path for 300s
([#2945](https://github.com/headroomlabs-ai/headroom/issues/2945))
([6147883](6147883d5e))
* **wrap:** verify proxy deps before mutating Codex config
([#1628](https://github.com/headroomlabs-ai/headroom/issues/1628))
([b7f342c](b7f342c153))


### Performance Improvements

* **perf:** skip rotated logs outside the requested window
([#3081](https://github.com/headroomlabs-ai/headroom/issues/3081))
([6c9f41e](6c9f41e08c))


### Dependencies

* bump axum from 0.7.9 to 0.8.9
([#2966](https://github.com/headroomlabs-ai/headroom/issues/2966))
([5731be7](5731be7e68))
* bump criterion from 0.5.1 to 0.8.2
([#2965](https://github.com/headroomlabs-ai/headroom/issues/2965))
([b30f339](b30f339d69))
* bump ruff from 0.15.22 to 0.16.2 in the pip-minor-patch group across 1
directory
([#2962](https://github.com/headroomlabs-ai/headroom/issues/2962))
([ff17961](ff17961cd7))
* bump sha2 from 0.10.9 to 0.11.0
([#2288](https://github.com/headroomlabs-ai/headroom/issues/2288))
([322425c](322425c43b))
* bump the cargo-minor-patch group across 1 directory with 4 updates
([#2964](https://github.com/headroomlabs-ai/headroom/issues/2964))
([888a9f4](888a9f4e14))
* bump tokio-tungstenite from 0.24.0 to 0.30.0
([#2967](https://github.com/headroomlabs-ai/headroom/issues/2967))
([bbe9013](bbe901319d))
* update mcp requirement from <2.0.0,>=1.28.1 to
>=1.28.1,<3.0.0
([#2963](https://github.com/headroomlabs-ai/headroom/issues/2963))
([d6fb536](d6fb5365f6))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-19 21:14:59 -07:00
..
hook-shim Add OpenClaw hook shim for local link installs 2026-04-06 21:28:59 -05:00
src fix(openclaw-plugin): circuit breaker + per-request timeout for proxy resilience (#639) 2026-08-13 11:52:01 -05:00
test fix(openclaw-plugin): circuit breaker + per-request timeout for proxy resilience (#639) 2026-08-13 11:52:01 -05:00
.gitignore feat: add OpenClaw ContextEngine plugin (@headroom-ai/openclaw) 2026-03-28 13:43:40 -07:00
.npmignore Harden openclaw plugin proxy handling and metadata 2026-04-02 21:27:12 -05:00
openclaw.plugin.json fix(openclaw-plugin): circuit breaker + per-request timeout for proxy resilience (#639) 2026-08-13 11:52:01 -05:00
package-lock.json deps: bump postcss from 8.5.19 to 8.5.25 in /plugins/openclaw (#2749) 2026-08-04 21:58:42 -05:00
package.json chore: release 0.36.0 (#3067) 2026-08-19 21:14:59 -07:00
prepare-dist.mjs Add OpenClaw hook shim for local link installs 2026-04-06 21:28:59 -05:00
README.md fix(openclaw-plugin): circuit breaker + per-request timeout for proxy resilience (#639) 2026-08-13 11:52:01 -05:00
tsconfig.json Add controlled proxy autostart and unsafe-install guidance 2026-04-02 21:47:27 -05:00
tsup.config.ts feat: add OpenClaw ContextEngine plugin (@headroom-ai/openclaw) 2026-03-28 13:43:40 -07:00
vitest.config.ts feat: add OpenClaw ContextEngine plugin (@headroom-ai/openclaw) 2026-03-28 13:43:40 -07:00

@headroom-ai/openclaw

Context compression plugin for OpenClaw. Compresses tool outputs, code, logs, and structured data — 70-90% token savings with zero LLM calls.

Install

Recommended one-command setup:

headroom wrap openclaw

Manual install:

pip install "headroom-ai[proxy]"
openclaw plugins install --dangerously-force-unsafe-install headroom-ai/openclaw

This plugin can auto-start a local headroom proxy when needed. OpenClaw treats process-launching plugins as unsafe by default, so --dangerously-force-unsafe-install is required even if you plan to use a remote proxy (the capability is declared at install time).

Local Development Install (Detection-Friendly)

If you are testing from this repo, run npm install/build from the plugin directory so local launcher detection aligns with runtime paths. These linked installs are supported:

cd plugins/openclaw
npm install
npm run build
openclaw plugins install --dangerously-force-unsafe-install --link .
openclaw plugins install --dangerously-force-unsafe-install --link dist

From the repo root, install the plugin directory explicitly:

openclaw plugins install --dangerously-force-unsafe-install --link ./plugins/openclaw

Or, from inside dist/:

cd plugins/openclaw/dist
openclaw plugins install --dangerously-force-unsafe-install --link .

Why this matters:

  • The plugin checks launchers in this order: PATH -> local npm bin -> global npm -> python.
  • "local npm bin" means plugins/openclaw/node_modules/.bin/headroom relative to the source checkout.
  • Using --link dist (or --link . from dist/) still keeps runtime code adjacent to the checkout, and launcher detection falls back to PATH/global/python if a local npm bin is not present under the installed root.
  • plugins/openclaw also carries a no-op hook shim so OpenClaw's hook-pack fallback treats the path as valid instead of emitting a misleading package.json missing openclaw.hooks warning.
  • If you install from a .tgz, local npm bin may not exist in the installed extension and detection will fall back to PATH/global/python.

Configure

Install automatically selects the contextEngine slot for headroom on current OpenClaw releases. If you need to switch back manually, set plugins.slots.contextEngine to "legacy" or another engine id.

{
  "plugins": {
    "entries": {
      "headroom": {
        "enabled": true,
        "config": {
          "proxyUrl": "http://127.0.0.1:8787"
        }
      }
    },
    "slots": {
      "contextEngine": "headroom"
    }
  }
}

proxyUrl is optional. If omitted, the plugin auto-detects on localhost:

  • http://127.0.0.1:<proxyPort>
  • http://localhost:<proxyPort>

Default proxyPort is 8787. Auto-start is opt-in; in production, prefer an externally managed proxy such as systemd with proxyUrl set and autoStart: false.

Upstream gateway routing

By default, the plugin also rewrites the built-in openai-codex provider base URL to a verified active Headroom proxy at runtime. That means Codex provider traffic flows through Headroom, so /stats can observe real upstream request and cache activity instead of only local context compression.

This does not replace Headroom's existing Codex routing rules. The proxy already decides between api.openai.com and chatgpt.com/backend-api/codex/responses based on ChatGPT auth. The plugin change only points OpenClaw's provider config at the active proxy in memory and preserves the rest of the provider config.

You can also route additional provider ids such as anthropic, github-copilot, google, or openrouter through the same proxy:

{
  "plugins": {
    "entries": {
      "headroom": {
        "enabled": true,
        "config": {
          "gatewayProviderIds": ["openai-codex", "anthropic", "github-copilot", "google", "openrouter"]
        }
      }
    }
  }
}

When gatewayProviderIds is set, it becomes the exact list the plugin rewrites in memory for the current gateway process.

For convenience, the plugin also accepts family aliases:

  • codex -> openai-codex
  • claude -> anthropic
  • copilot -> github-copilot
  • gemini -> google

When OpenClaw has already resolved a provider's upstream baseUrl, the plugin preserves protocol-specific path segments while swapping only the origin. That keeps provider families on the right proxy route:

  • Codex / ChatGPT backend: /backend-api
  • OpenAI-compatible providers: /v1 or /api/v1
  • GitHub Copilot Claude-family models: /anthropic
  • Gemini: /v1beta

GitHub Copilot is a special case because OpenClaw can route it through either OpenAI Responses or Anthropic Messages depending on the selected model. The plugin only rewrites Copilot when OpenClaw has already resolved the upstream baseUrl, so it can preserve the correct /v1 or /anthropic path instead of guessing.

The routing is intentionally lightweight and reversible:

  • the plugin does not persist provider baseUrl changes back to openclaw.json
  • disabling the plugin, clearing gatewayProviderIds, or restarting without Headroom restores OpenClaw's normal provider resolution
  • if you want durable provider rewrites, use headroom wrap openclaw instead of relying on plugin install side effects

If you need to disable that behavior:

{
  "plugins": {
    "entries": {
      "headroom": {
        "enabled": true,
        "config": {
          "routeCodexViaProxy": false
        }
      }
    }
  }
}

Local proxy (auto-start)

When proxyUrl points to localhost (or is omitted), the plugin will auto-start headroom proxy if no running proxy is detected. Launch order:

  1. headroom from PATH
  2. local npm bin (node_modules/.bin/headroom)
  3. global npm bin
  4. Python module (python -m headroom.cli proxy ...)

If pythonPath is set, it is tried first in the Python fallback step.

Docker-native Headroom installs intentionally leave pythonPath unset so this launcher order prefers the installed host headroom wrapper on PATH, which then runs Headroom in Docker.

Remote proxy (connect-only)

Point proxyUrl to any reachable Headroom instance:

{
  "config": {
    "proxyUrl": "https://headroom.example.com:8787"
  }
}

Remote URLs are connect-only — the plugin probes the URL at startup and fails fast if the proxy is not reachable. No subprocess is spawned for remote addresses.

Manual Proxy Setup

If you prefer to manage the proxy yourself (or are running a remote instance), start it before launching OpenClaw:

Python install:

pip install "headroom-ai[proxy]"
headroom proxy --host 127.0.0.1 --port 8787

NPM install:

npm install -g headroom-ai
headroom proxy --host 127.0.0.1 --port 8787

How It Works

Every time OpenClaw assembles context for the model, the plugin compresses tool outputs and large messages:

  • JSON arrays (tool outputs, search results) — statistical selection keeps anomalies, errors, boundaries
  • Code — AST-aware compression via tree-sitter
  • Logs — pattern deduplication, keeps errors and boundaries
  • Text — ML-based token compression

Compression is lossless via CCR (Compress-Cache-Retrieve): originals are stored and the agent gets a headroom_retrieve tool to access full details when needed.

Configuration Options

Option Default Description
proxyUrl auto-detected Optional URL of a Headroom proxy. Configured URLs are probe-gated before provider routing. Remote URLs (https://headroom.example.com) are connect-only.
proxyPort 8787 Port used for default auto-detect and optional local auto-start when proxyUrl is not set.
pythonPath auto-detected Optional Python executable override for Python fallback launcher.
autoStart false Opt-in auto-start for a local headroom proxy if not already running (local URLs only; ignored for remote proxies). Keep false when systemd owns the proxy.
startupTimeoutMs 20000 Time to wait for auto-started proxy to become healthy
requestTimeoutMs 30000 Maximum milliseconds to wait for a single compress() call. If the proxy hangs or is slow, the call is cancelled after this deadline and the original uncompressed messages are used as a fallback.
circuitBreakerThreshold 3 Number of consecutive assemble() errors before the circuit breaker opens and all requests bypass the proxy. Prevents cascading failures when the proxy is unhealthy.
circuitBreakerCooldownMs 60000 How long (ms) the circuit breaker stays open after the threshold is reached. After the cool-down the breaker resets automatically and the next request re-probes the proxy via /health.
routeCodexViaProxy true Rewrite OpenClaw's built-in openai-codex provider to use the active Headroom proxy in memory so upstream Codex requests pass through Headroom.
gatewayProviderIds [] Optional explicit list of OpenClaw provider ids to route through the active Headroom proxy in memory. Friendly aliases codex, claude, copilot, and gemini are also accepted. When set, this overrides the default openai-codex routing list.

Comparison with lossless-claw

lossless-claw headroom
Compaction method LLM summarization (DAG) Content-aware compression (zero LLM)
Cost of compaction Tokens (LLM calls) Zero
Best for Long conversations Tool-heavy agents with large outputs
Retrieval lcm_grep, lcm_expand headroom_retrieve (instant)

License

Apache-2.0