token-efficacy

Token posture hub — layer taxonomy, RTK/DCP/MCPHub ownership, decision gates, and one-tool-per-layer policy.

harness-config token posture

Maintainer hub for context-window efficiency across harnesses. Repo policy is in AGENTS.md §5 (Token Budget + Token efficacy) and openspec/changes/token-efficacy-program/. Do not add @RTK.md to shared instruction sources.

Agent sessions accumulate tokens from standing instructions, skill descriptions, tool schemas, shell output, and conversation history. This repo manages token efficacy through eight layers, each with a single primary owner. Stacking tools on the same layer (e.g. two session pruners) requires compare research, measurement, and an explicit decision gate.

LayerPrimary ownerConfig / command surface
Shell dedupRTKconfig/rtk-integration.json; wagents rtk doctor, wagents rtk sync, wagents rtk gain
Session prunersOpenCode DCPconfig/opencode-dcp.jsonc~/.config/opencode/dcp.jsonc; OpenCode /dcp stats
Cross-harness proxyNone (gated)Research compare: Headroom vs Sleev vs LeanCTX
MCP schema taxMCPHub harnessconfig/mcp-registry.json; MCPHub § control plane
Code readsPolicy-firstNarrow reads, ripgrep; symbol MCPs only if review shows pain
Standing contextinstructions/global.md + skill descsScoped rules (.claude/rules/), on-demand skill bodies
Docs / maintainer hubThis page + AGENTS.md/harness-config/token-efficacy/
Landscape trackingResearch journal/research track token-oss-landscape (quarterly)
  1. One primary tool owns each layer at a time.
  2. Measure before stacking: run uv run wagents rtk gain --graph and review OpenCode DCP logs/stats (~/.config/opencode/logs/dcp/).
  3. Overlap checks only where layers differ (e.g. RTK shell dedup vs LeanCTX — verify no double rewrite).
  4. Repo hooks first: fleet safety hooks from config/hook-registry.json run before RTK projections when both apply.

RTK (Rust Token Killer) deduplicates shell command output before it enters the model context. Repo integration is doctor-verified and dry-run by default.

Terminal window
# Readiness across harness tiers
uv run wagents rtk doctor --format json
# Preview init commands (default)
uv run wagents rtk sync --dry-run --platforms claude-code,cursor,opencode,codex,gemini-cli,github-copilot
# Live apply (explicit; disables RTK telemetry for child processes)
RTK_TELEMETRY_DISABLED=1 uv run wagents rtk sync --apply --platforms claude-code,cursor,opencode,codex,gemini-cli,github-copilot
# Savings baseline / history
uv run wagents rtk gain --graph
uv run wagents rtk gain --history

Ownership boundaries:

  • Policy SSOT: config/rtk-integration.json
  • RTK owns local hooks, local RTK.md, and ~/.config/opencode/plugins/rtk.ts
  • Not in opencode.json plugin array
  • Not @RTK.md in instructions/global.md, AGENTS.md bridges, or generated Copilot instructions

Supported harness modes (see policy map): full-hook (Claude, Cursor, Gemini), OpenCode plugin, Codex prompt-rules, Copilot deny-suggest, Grok shim (planned).

OpenCode Dynamic Context Pruning compacts in-session tool output and history. Repo canonical config:

  • Source: config/opencode-dcp.jsonc
  • Live: ~/.config/opencode/dcp.jsonc (synced via scripts/sync_agent_stack.py)

Model-neutral by default — do not add compress.modelMaxLimits or compress.modelMinLimits unless the maintainer explicitly requests per-model limits (AGENTS.md §2.3).

Tune thresholds only when log review (openspec/changes/token-efficacy-program/ Wave 4) shows compaction pain or threshold mismatch.

MCP tool schemas are a major context tax. Prefer connecting harnesses to the harness MCPHub group rather than projecting every server to every client.

config/mcp-registry.json
# Edit SSOT
# Regenerate MCPHub settings + sync projections
uv run python scripts/sync_agent_stack.py --apply --targets repo

See mcp-registry for group definitions and MCP overview for MCPHub endpoints. MCP compressor or registry-split strategies require /research + /host-panel before any pilot install.

Always-loaded budget (approximate):

ComponentTokensLoading
global.md~980Always
Skill descriptionsVariesAlways
Scoped rules~0 until path matchConditional
Skill bodies~12k eachOn-demand

Trim candidates come from /research + /review standing-context audits — not ad-hoc instruction bloat. Keep user-invocable skills in the / menu; hide auto-invoke convention skills (user-invocable: false).

Install or enable a new token tool only if the gate passes:

CategoryInstall only if
Session proxyCompare winner + no DCP regression + explicit approval
MCP compressorMCP strategy (R2) resolved + single-server pilot approved
Code MCPStanding-context review shows Read-heavy pain + compare winner
Claude-only prunerCompare winner for Claude layer + user sign-off
RTK fleet applywagents rtk doctor ok + maintainer runs --apply
DCP tuneDCP log/stats evidence + model-neutral guardrails preserved
  1. Baseline: wagents rtk doctor, wagents rtk gain --graph, OpenCode /dcp stats
  2. Research: category compare matrices (read-only; no installs in recommendations)
  3. Apply: RTK sync, instruction trims, or DCP tune — one layer at a time
  4. Validate: re-run gain + DCP stats; wagents validate; docs regenerate
Terminal window
uv run wagents rtk doctor --format json
uv run wagents validate
uv run wagents docs generate --no-installed
uv run python scripts/sync_agent_stack.py --apply --targets repo