One control plane for token-efficient coding agents.
TypeScript
2
937 commits
updated Oct 4, 2026
Make your Claude Code and Codex allowance go further. Measure what actually helps.
Coding agents spend context on long command output, repeated information and tool definitions. Token Harness helps you reduce that overhead, connect compatible optimizers and see their measured impact in one local dashboard. Keep working in Claude Code or Codex as usual.
For subscription users, the goal is more accepted coding work within your included allowance. For API users, it is less avoidable token usage with costs reported only when billing evidence is available. Token reduction, subscription quota and billed cost are different measurements; Token Harness keeps them separate.
Overview · agents, routing and optimizers in one place |
Results · measured impact and the evidence behind it |
Click a screenshot to open it at full size.
You need Node.js 22.13+ and an installed, signed-in Claude Code or Codex. Run these commands in your terminal, including PowerShell on Windows:
npm install --global token-harness@latest
token-harness
A local browser dashboard opens. The browser app is the primary interface. No Token Harness account or API key is required. Your coding agent keeps its own authentication. Windows, macOS, Linux and WSL have explicit compatibility checks; individual integrations may support a narrower set of versions/platforms.
Prefer to try it before installing globally?
npx --yes token-harness@latest
Updates for an npx launch use a new npx launch; automatic application updates require a verified
global npm installation.
/hooks to enable and trust the installed hooks.
In Claude Code, ensure hooks are enabled and start a fresh session after changing them.You do not need to keep the dashboard open for installed native hooks to run. Evidence appears after qualifying activity; an idle installation cannot prove execution. Use the action beside an affected agent or optimizer when a version or prerequisite needs attention.
| Feature | How it helps |
|---|---|
| One optimization dashboard | Inspect agents, optimizers, health and updates together. |
| Less noisy tool output | Connect RTK and HarnessTrim on reviewed integration rows. |
| Automatic prompt guidance | Opt into native hooks that supply a bounded delegation policy on each prompt. |
| Allowance-aware advice | Inspect five-hour/weekly windows and native model/effort recommendations when evidence is available. |
| Measured results | Search and filter sources; expand each result for before/after values and attribution. |
| Safe maintenance | Preview changes, retain backups, verify updates and remove owned configuration. |
See automatic model routing for supported agents, setup and benefits.
Token Harness can add a short delegation policy to each submitted prompt through the agent's native hooks. Your main model stays in charge: it decides whether an independent unit of work fits a cheaper native subagent, starts that subagent, then reviews and integrates the result. One routed worker runs at a time. The hook runs locally without a model call; routing can be enabled independently of RTK, HarnessTrim or the optional Agent Skill.
Good candidates include repository exploration, test/log triage, mechanical edits and tests or documentation with a clear specification. Quick tasks, unclear debugging, architecture, security, releases and tightly coupled changes stay with the main model. If a requested model is unavailable, the work stays on the main model; if a child's result fails its check, the main model finishes it.
The current policy requests these models when the native harness makes them available:
| Harness | Delegation policy |
|---|---|
| Claude Code | Fable can use Opus for hard independent work, Sonnet for bounded implementation/tests and Haiku for read-only/mechanical work. Opus can use Sonnet or Haiku; Sonnet can use Haiku for read-only/mechanical work; Haiku keeps the work. The policy requests an explicit native model alias. |
| Codex | Astra can use gpt-6.1-sol for bounded implementation/tests and gpt-6-luna for read-only/mechanical work. Sol/workhorse roots can use Luna; Luna keeps the work. The policy requests an explicit model and reasoning effort with a self-contained brief. |
The practical benefits are:
After installing Token Harness, ensure token-harness is on the PATH used
by your coding agent. Open the dashboard, go to Overview → Coding agents, and select
Enable routing under the agent's Automatic prompt routing card. Review and apply the
preview. Setup merges user-scope hooks and preserves unrelated configuration.
| Harness | Reviewed routing configuration versions | Native activation after apply |
|---|---|---|
Claude Code (--harness claude) | 2.1.274–2.1.288 | Hooks are added to ~/.claude/settings.json. Ensure hooks are enabled in /hooks, then start a fresh Claude Code session. |
Codex (--harness codex) | 0.146.0, 0.159.0–0.159.1, 0.160.0 | Hooks are added to ~/.codex/hooks.json. Open /hooks in the Codex CLI; review, enable and trust the three Token Harness hooks: UserPromptSubmit, SubagentStart, SubagentStop. Start a fresh session and submit an ordinary prompt. |
| OpenCode, Hermes, Pi | Automatic prompt routing is not implemented | Other optimizer integrations have their own support; there is no routing installation for these agents. |
| Other harnesses | Automatic prompt routing is not implemented | Use the agent's own model/delegation controls. |
Codex is supported through its native hooks. Trust is a separate native step: new or changed definitions require review before they can run, as described in the official OpenAI hooks documentation. The versions above describe reviewed configuration schemas; other versions and prereleases are blocked pending compatibility evidence. Platform launch formats are fixture-tested for Windows, macOS, Linux and WSL; this does not establish live execution on every platform or Codex surface.
For terminal setup, choose the block for your agent. Each plan command is a dry run; replace
<plan-id> with its printed ID and inspect the changes before applying:
# Claude Code
token-harness plan --provider none --harness claude --agent-routing
token-harness apply --plan <plan-id> --yes
# Codex
token-harness plan --provider none --harness codex --agent-routing
token-harness apply --plan <plan-id> --yes
Complete the native activation step in the table even when installing through the CLI. The dashboard can be closed afterward; the agent invokes the installed hooks itself.
Submit an ordinary prompt in a fresh agent session, then inspect its routing card in Overview.
Configured / config-only means the definitions exist; Trust required means Codex still
needs authorization; Active · callback seen / runtime-observed means a real callback arrived.
Prompt callbacks prove the hook ran; child start/stop callbacks prove a native child lifecycle.
Neither proves the child used the requested model or saved allowance.
To disable, use Disable routing on the same card and review/apply the preview. The CLI
equivalent is below; replace <harness> with claude or codex:
token-harness plan --provider none --harness <harness> --disable-agent-routing
token-harness apply --plan <plan-id> --yes
Removal affects only owned hooks. Restart existing agent sessions so they reload the configuration. Backups and rollback use the normal transaction lifecycle. See the routing RFC for policy and evidence rules.
| Component | Purpose | Current role |
|---|---|---|
| RTK | Reduce shell/tool output | Baseline integration on reviewed rows. |
| HarnessTrim | Deterministic output/context reduction | Baseline integration on reviewed rows. |
| mcptoon | Compact MCP discovery/manifests | Optional; install through an existing pipx or uv. Missing prerequisites show installation options. |
| GitNexus | Repository graph and MCP context | Optional reviewed integration; package/index preparation and license review are user responsibilities. |
| Headroom | MCP context compression/retrieval | Optional configuration-only integration for an already-installed reviewed package. |
| cclimits / ccusage | Allowance / usage observations | Read-only evidence sources, rather than optimizers. Usage history is not remaining quota. |
Current source-reviewed package targets are RTK 0.51.0 and HarnessTrim 0.3.1. Package update policy and exact agent-configuration compatibility are separate: a newer installed package does not automatically admit new config writes or a combined-stack review. RTK + HarnessTrim still need real combined workload evidence before broader promotion. Optional integrations do not count as proven savings mechanisms merely because they are installed.
See version policy, compatibility and verification tiers, and candidate promotion gates.
The dashboard checks for updates on opening. When an update is available, review its exact version and choose Install updates to approve installation. It re-checks health automatically afterward. A supported application update offers Restart and re-check to load the new version; if replacement startup fails, the current dashboard stays available.
To update manually:
npm install --global token-harness@latest
token-harness
To disconnect an optimizer, use Remove managed setup beside that optimizer. It removes only entries Token Harness owns. The CLI equivalent for owned integrations is:
token-harness uninstall --yes
To restore the latest complete configuration snapshot:
token-harness rollback --yes
Rollback restores whole files and can revert later manual edits. Prefer owned removal when you only want to disconnect Token Harness integrations. Provider package management and uninstall scope are shown in the reviewed plan.
The dashboard binds to 127.0.0.1. Plans, receipts, metrics and backups stay in local state.
Token Harness does not send your source code, prompts, command contents or credentials to a Token
Harness service. Your coding agent and any explicitly enabled provider keep their own network
behaviour.
A configuration change requires an explicit review and approval; plans are checked again before apply. Managed writes retain backups, preserve unrelated configuration and support verification and rollback. Unknown hook formats or unsupported configuration rows require evidence instead of guessed writes.
node --version and npm list --global token-harness, then reopen
the terminal. Node must be at least 22.13./hooks, start
a new session and submit an ordinary prompt. You should never need to invoke the skill per prompt.token-harness doctor --verbose and
token-harness verify --verbose; the reported verification tier explains what was actually checked.Windows notes · CLI and evaluation guide · Agent Skill · Latest release
Current progress and next steps · Full plan · Accepted RFCs · Release readiness
To run a fresh source checkout:
git clone https://github.com/giuliastro/token-harness.git
cd token-harness
npx --yes pnpm@10.33.4 install --frozen-lockfile
npm start
For an existing clone with dependencies installed, npm start builds and opens the local source.
Source changes do not reach npm users until a release is published.
Development checks: pnpm typecheck, pnpm lint, pnpm test, pnpm build, pnpm smoke,
pnpm package, pnpm smoke:install. Use the pinned pnpm version above if Corepack is unavailable;
corepack enable is optional and can require administrator rights on Windows.
Read contributor instructions and accepted RFCs before changing public contracts.
Apache License 2.0. Referenced tools are independent projects with their own licenses.
TypeScript
96.3%
JavaScript
3.4%
One control plane for token-efficient coding agents.
TypeScript
2
937 commits
updated Oct 4, 2026
Make your Claude Code and Codex allowance go further. Measure what actually helps.
Coding agents spend context on long command output, repeated information and tool definitions. Token Harness helps you reduce that overhead, connect compatible optimizers and see their measured impact in one local dashboard. Keep working in Claude Code or Codex as usual.
For subscription users, the goal is more accepted coding work within your included allowance. For API users, it is less avoidable token usage with costs reported only when billing evidence is available. Token reduction, subscription quota and billed cost are different measurements; Token Harness keeps them separate.
Overview · agents, routing and optimizers in one place |
Results · measured impact and the evidence behind it |
Click a screenshot to open it at full size.
You need Node.js 22.13+ and an installed, signed-in Claude Code or Codex. Run these commands in your terminal, including PowerShell on Windows:
npm install --global token-harness@latest
token-harness
A local browser dashboard opens. The browser app is the primary interface. No Token Harness account or API key is required. Your coding agent keeps its own authentication. Windows, macOS, Linux and WSL have explicit compatibility checks; individual integrations may support a narrower set of versions/platforms.
Prefer to try it before installing globally?
npx --yes token-harness@latest
Updates for an npx launch use a new npx launch; automatic application updates require a verified
global npm installation.
/hooks to enable and trust the installed hooks.
In Claude Code, ensure hooks are enabled and start a fresh session after changing them.You do not need to keep the dashboard open for installed native hooks to run. Evidence appears after qualifying activity; an idle installation cannot prove execution. Use the action beside an affected agent or optimizer when a version or prerequisite needs attention.
| Feature | How it helps |
|---|---|
| One optimization dashboard | Inspect agents, optimizers, health and updates together. |
| Less noisy tool output | Connect RTK and HarnessTrim on reviewed integration rows. |
| Automatic prompt guidance | Opt into native hooks that supply a bounded delegation policy on each prompt. |
| Allowance-aware advice | Inspect five-hour/weekly windows and native model/effort recommendations when evidence is available. |
| Measured results | Search and filter sources; expand each result for before/after values and attribution. |
| Safe maintenance | Preview changes, retain backups, verify updates and remove owned configuration. |
See automatic model routing for supported agents, setup and benefits.
Token Harness can add a short delegation policy to each submitted prompt through the agent's native hooks. Your main model stays in charge: it decides whether an independent unit of work fits a cheaper native subagent, starts that subagent, then reviews and integrates the result. One routed worker runs at a time. The hook runs locally without a model call; routing can be enabled independently of RTK, HarnessTrim or the optional Agent Skill.
Good candidates include repository exploration, test/log triage, mechanical edits and tests or documentation with a clear specification. Quick tasks, unclear debugging, architecture, security, releases and tightly coupled changes stay with the main model. If a requested model is unavailable, the work stays on the main model; if a child's result fails its check, the main model finishes it.
The current policy requests these models when the native harness makes them available:
| Harness | Delegation policy |
|---|---|
| Claude Code | Fable can use Opus for hard independent work, Sonnet for bounded implementation/tests and Haiku for read-only/mechanical work. Opus can use Sonnet or Haiku; Sonnet can use Haiku for read-only/mechanical work; Haiku keeps the work. The policy requests an explicit native model alias. |
| Codex | Astra can use gpt-6.1-sol for bounded implementation/tests and gpt-6-luna for read-only/mechanical work. Sol/workhorse roots can use Luna; Luna keeps the work. The policy requests an explicit model and reasoning effort with a self-contained brief. |
The practical benefits are:
After installing Token Harness, ensure token-harness is on the PATH used
by your coding agent. Open the dashboard, go to Overview → Coding agents, and select
Enable routing under the agent's Automatic prompt routing card. Review and apply the
preview. Setup merges user-scope hooks and preserves unrelated configuration.
| Harness | Reviewed routing configuration versions | Native activation after apply |
|---|---|---|
Claude Code (--harness claude) | 2.1.274–2.1.288 | Hooks are added to ~/.claude/settings.json. Ensure hooks are enabled in /hooks, then start a fresh Claude Code session. |
Codex (--harness codex) | 0.146.0, 0.159.0–0.159.1, 0.160.0 | Hooks are added to ~/.codex/hooks.json. Open /hooks in the Codex CLI; review, enable and trust the three Token Harness hooks: UserPromptSubmit, SubagentStart, SubagentStop. Start a fresh session and submit an ordinary prompt. |
| OpenCode, Hermes, Pi | Automatic prompt routing is not implemented | Other optimizer integrations have their own support; there is no routing installation for these agents. |
| Other harnesses | Automatic prompt routing is not implemented | Use the agent's own model/delegation controls. |
Codex is supported through its native hooks. Trust is a separate native step: new or changed definitions require review before they can run, as described in the official OpenAI hooks documentation. The versions above describe reviewed configuration schemas; other versions and prereleases are blocked pending compatibility evidence. Platform launch formats are fixture-tested for Windows, macOS, Linux and WSL; this does not establish live execution on every platform or Codex surface.
For terminal setup, choose the block for your agent. Each plan command is a dry run; replace
<plan-id> with its printed ID and inspect the changes before applying:
# Claude Code
token-harness plan --provider none --harness claude --agent-routing
token-harness apply --plan <plan-id> --yes
# Codex
token-harness plan --provider none --harness codex --agent-routing
token-harness apply --plan <plan-id> --yes
Complete the native activation step in the table even when installing through the CLI. The dashboard can be closed afterward; the agent invokes the installed hooks itself.
Submit an ordinary prompt in a fresh agent session, then inspect its routing card in Overview.
Configured / config-only means the definitions exist; Trust required means Codex still
needs authorization; Active · callback seen / runtime-observed means a real callback arrived.
Prompt callbacks prove the hook ran; child start/stop callbacks prove a native child lifecycle.
Neither proves the child used the requested model or saved allowance.
To disable, use Disable routing on the same card and review/apply the preview. The CLI
equivalent is below; replace <harness> with claude or codex:
token-harness plan --provider none --harness <harness> --disable-agent-routing
token-harness apply --plan <plan-id> --yes
Removal affects only owned hooks. Restart existing agent sessions so they reload the configuration. Backups and rollback use the normal transaction lifecycle. See the routing RFC for policy and evidence rules.
| Component | Purpose | Current role |
|---|---|---|
| RTK | Reduce shell/tool output | Baseline integration on reviewed rows. |
| HarnessTrim | Deterministic output/context reduction | Baseline integration on reviewed rows. |
| mcptoon | Compact MCP discovery/manifests | Optional; install through an existing pipx or uv. Missing prerequisites show installation options. |
| GitNexus | Repository graph and MCP context | Optional reviewed integration; package/index preparation and license review are user responsibilities. |
| Headroom | MCP context compression/retrieval | Optional configuration-only integration for an already-installed reviewed package. |
| cclimits / ccusage | Allowance / usage observations | Read-only evidence sources, rather than optimizers. Usage history is not remaining quota. |
Current source-reviewed package targets are RTK 0.51.0 and HarnessTrim 0.3.1. Package update policy and exact agent-configuration compatibility are separate: a newer installed package does not automatically admit new config writes or a combined-stack review. RTK + HarnessTrim still need real combined workload evidence before broader promotion. Optional integrations do not count as proven savings mechanisms merely because they are installed.
See version policy, compatibility and verification tiers, and candidate promotion gates.
The dashboard checks for updates on opening. When an update is available, review its exact version and choose Install updates to approve installation. It re-checks health automatically afterward. A supported application update offers Restart and re-check to load the new version; if replacement startup fails, the current dashboard stays available.
To update manually:
npm install --global token-harness@latest
token-harness
To disconnect an optimizer, use Remove managed setup beside that optimizer. It removes only entries Token Harness owns. The CLI equivalent for owned integrations is:
token-harness uninstall --yes
To restore the latest complete configuration snapshot:
token-harness rollback --yes
Rollback restores whole files and can revert later manual edits. Prefer owned removal when you only want to disconnect Token Harness integrations. Provider package management and uninstall scope are shown in the reviewed plan.
The dashboard binds to 127.0.0.1. Plans, receipts, metrics and backups stay in local state.
Token Harness does not send your source code, prompts, command contents or credentials to a Token
Harness service. Your coding agent and any explicitly enabled provider keep their own network
behaviour.
A configuration change requires an explicit review and approval; plans are checked again before apply. Managed writes retain backups, preserve unrelated configuration and support verification and rollback. Unknown hook formats or unsupported configuration rows require evidence instead of guessed writes.
node --version and npm list --global token-harness, then reopen
the terminal. Node must be at least 22.13./hooks, start
a new session and submit an ordinary prompt. You should never need to invoke the skill per prompt.token-harness doctor --verbose and
token-harness verify --verbose; the reported verification tier explains what was actually checked.Windows notes · CLI and evaluation guide · Agent Skill · Latest release
Current progress and next steps · Full plan · Accepted RFCs · Release readiness
To run a fresh source checkout:
git clone https://github.com/giuliastro/token-harness.git
cd token-harness
npx --yes pnpm@10.33.4 install --frozen-lockfile
npm start
For an existing clone with dependencies installed, npm start builds and opens the local source.
Source changes do not reach npm users until a release is published.
Development checks: pnpm typecheck, pnpm lint, pnpm test, pnpm build, pnpm smoke,
pnpm package, pnpm smoke:install. Use the pinned pnpm version above if Corepack is unavailable;
corepack enable is optional and can require administrator rights on Windows.
Read contributor instructions and accepted RFCs before changing public contracts.
Apache License 2.0. Referenced tools are independent projects with their own licenses.
TypeScript
96.3%
JavaScript
3.4%