EcoClaw is a runtime optimization layer for OpenClaw agents with one goal: improve token efficiency while keeping task quality stable.
- Embedded
openai-responsesproxy provider (ecoclaw/*explicit model keys) - Response root-link strategy for cache reuse (
previous_response_idinjection) - Policy-owned summary / compaction triggers with execution-side handoff artifacts
- Runtime decision dashboard (replaces the old cache-tree-only view)
- Expanded
/ecoclawcommand set (help/status/cache/sessioncontrols) - Full event tracing for Context / Decision / Execution / Orchestration analysis
EcoClaw is organized as semantic layers:
packages/kernel: runtime context, pipeline contracts, event buspackages/layers/context: context-state, retrieval, and future session-view builderspackages/layers/decision: policy, task-router, decision-ledgerpackages/layers/execution: stabilizer, compaction, summary, reductionpackages/layers/orchestration: OpenClaw connector and session topologypackages/providers/*: provider-specific usage normalization and prompt annotationpackages/storage/fs: filesystem persistence for traces, turns, branches, and messagespackages/openclaw-plugin: deployable OpenClaw plugin entryapps/lab-bench: benchmark harness and runtime dashboard
Detailed architecture: docs/architecture.md
Recommended release-mode install:
cd packages/openclaw-plugin
npm run install:releaseThis flow:
- builds a self-contained plugin archive
- removes any conflicting dev
plugins.load.pathsentry - installs the archive into
~/.openclaw/extensions/ecoclaw - restarts the gateway
If you are actively developing the plugin, use dev-mode instead and do not keep release-mode enabled at the same time. OpenClaw will treat both as the same plugin id and report duplicate-source conflicts.
- Install dependencies and build:
npm install
npm run build- Development-mode install into OpenClaw:
cd packages/openclaw-plugin
npm run build
openclaw config set plugins.load.paths "[\"/abs/path/to/EcoClaw/packages/openclaw-plugin\"]"
openclaw config set plugins.allow "[\"ecoclaw\"]"
openclaw config set plugins.entries.ecoclaw.enabled true
openclaw gateway restart- Use explicit EcoClaw provider model in OpenClaw:
ecoclaw/gpt-5.4
Plugin usage and command guide: packages/openclaw-plugin/README.md
cd apps/lab-bench
corepack pnpm --filter @ecoclaw/lab-bench dev
# open http://127.0.0.1:7777The dashboard focuses on:
- Per-turn token usage (input/output/cacheRead/net)
- Layer signals and module execution traces
- Compaction ROI windows (pre/post turn comparison)
- Initial vs final context segment inspection
- Stable-prefix / tail visualization for cache-oriented observation
Useful overrides:
ECOCLAW_LAB_PORT=7781 \
ECOCLAW_STATE_ROOTS="$HOME/.openclaw/ecoclaw-plugin-state/ecoclaw:/tmp/ecoclaw-lab-state/ecoclaw" \
corepack pnpm --filter @ecoclaw/lab-bench devCurrent scope of the dashboard:
- observation only
- reads trace + provider tap files from local state roots
- does not yet write policy overrides or mutate runtime context
The current production path is intentionally narrow:
- Active provider adapters:
openai,anthropic - Active plugin runtime path:
packages/openclaw-plugin - Active persistence path:
packages/storage/fs
Some higher-level modules such as retrieval and task-router are kept as
clean layer boundaries, but they are not yet deeply wired into the production
OpenClaw plugin path.
PinchBench examples:
# baseline
./experiments/scripts/run_pinchbench_baseline.sh --model gmn/gpt-5.4 --suite all --runs 1 --parallel 1
# with EcoClaw proxy provider
./experiments/scripts/run_pinchbench_baseline.sh --model ecoclaw/gpt-5.4 --suite all --runs 1 --parallel 1For lab-bench and other direct runtime hosts, module-summary now supports:
summaryPrompt: inline overridesummaryPromptPath: prompt file path overrideresumePrefixPrompt: inline overrideresumePrefixPromptPath: prompt file path override
lab-bench exposes these via environment variables:
ECOCLAW_SUMMARY_PROMPT_PATH=/abs/path/summary-prompt.txt
ECOCLAW_RESUME_PREFIX_PROMPT_PATH=/abs/path/resume-prefix.txtOr inline:
ECOCLAW_SUMMARY_PROMPT="Write a compact handoff with explicit pending steps."
ECOCLAW_RESUME_PREFIX_PROMPT="Use this prior summary as the starting point:"