Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d5ea765
Update .gitignore
chteau Oct 10, 2026
b5a9958
feat: Implement core compression and deduplication features from Cont…
chteau Oct 10, 2026
b646b0d
docs: update CHANGELOG.md for 0.9.2 release
chteau Oct 10, 2026
bad8d70
chore: remove temporary fix scripts
chteau Oct 10, 2026
be6a5c1
Revert the 0.9.2 ContextForge port: dead hooks, unwired libraries, wr…
chteau Oct 10, 2026
c1910ef
Workers: sensitive checks run in a temporary git worktree; stricter v…
chteau Oct 10, 2026
cc8414f
Bench reports name the TokenForge version, build and Claude Code vers…
chteau Oct 10, 2026
d9a176d
Reload memory on resume and compaction, summarize subagents, keep han…
chteau Oct 10, 2026
1cf04da
tforge help: wrap the gc line
chteau Oct 10, 2026
083a0ae
Merge branch 'worktree-agent-aa8461c4b2f09c461' into 0.9.2
chteau Oct 10, 2026
7e2e9bd
docs: external-ideas audit (ContextForge, icm-graph-context-flow) wit…
chteau Oct 10, 2026
b22da91
Answer cache: replay only information questions, into the state they …
chteau Oct 10, 2026
af7eb70
Reloaded snapshots and checkpoints say they are a record of earlier t…
chteau Oct 10, 2026
bf6691e
README: reload on resume and compaction, state files, subagentSkip, l…
chteau Oct 10, 2026
d5271a5
Merge branch 'worktree-agent-ae36445e64bcbf5a3' into 0.9.2
chteau Oct 10, 2026
bed6419
README: answer cache rules for 0.9.2
chteau Oct 10, 2026
2eeffa5
0.9.2: version, changelog, roadmap status
chteau Oct 10, 2026
c81b6cc
Router: differential tests against the commands as typed; fixes for e…
chteau Oct 10, 2026
5b84913
Merge branch 'worktree-agent-a83ec32efbded21a4' into 0.9.2
chteau Oct 10, 2026
e9433a6
Changelog, README and roadmap for worker check isolation and the rout…
chteau Oct 10, 2026
a0fc97d
tforge proxy / tforge claude: local API proxy that logs request sizes…
chteau Oct 10, 2026
0067314
Proxy: cache-break detection with probable cause, folded-Read edit co…
chteau Oct 10, 2026
a63f0c9
Proxy: restart from tforge claude when it dies, LRU-capped memo, no f…
chteau Oct 10, 2026
c0ee767
Read router: narrow a whole Read of saved Bash output to its end inst…
chteau Oct 10, 2026
96db368
Read/Bash router: narrow instead of refusing dependency, lockfile and…
chteau Oct 10, 2026
602112b
Codex: plugin manifest and marketplace; hooks emit Codex-valid output
chteau Oct 10, 2026
95d7061
opencode plugin (API v1) over the same hook scripts; host detection f…
chteau Oct 10, 2026
2a75518
Proxy: OpenAI Responses codec for Codex (/v1/responses to TFORGE_PROX…
chteau Oct 10, 2026
0c55dd3
opencode: plugin API v2 (default { id, setup }) alongside v1
chteau Oct 10, 2026
6cf231b
opencode: put tokenforge's bin/ on PATH so tkit resolves in opencode …
chteau Oct 10, 2026
40c8c09
opencode: put bin/ on PATH in front of commands that run a kit tool
chteau Oct 10, 2026
185fd20
Codex and opencode: reach tkit without bin/ on PATH
chteau Oct 10, 2026
44efa6b
tview output budget, brace cats, opt-in 5m proxy cache TTL
chteau Oct 11, 2026
dc7aee2
Proxy on by default with stale-context pruning; repo map at session s…
chteau Oct 11, 2026
0ec7d7f
Prune written bodies and ran scripts by age; never cap shell reads
chteau Oct 11, 2026
cd57eb9
Proxy report: thinking sent back per request
chteau Oct 11, 2026
e21ceac
Proxy: compress again when a request ends with a system message
chteau Oct 11, 2026
c4219f8
Proxy: prune by cost by default; 5-minute cache for claude -p
chteau Oct 11, 2026
7cf37df
Prune by best suffix in cost mode; tkit edit takes unclosed new/appen…
chteau Oct 11, 2026
99d0846
Tests: skip the glob cat on Node 20 and the POSIX PATH lookup on Wind…
chteau Oct 11, 2026
5d3cf25
tview: the cut pass counts file headers and the summary line, so a du…
chteau Oct 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .agents/plugins/marketplace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "tokenforge",
"interface": { "displayName": "tokenforge" },
"plugins": [
{
"name": "tokenforge",
"source": { "source": "local", "path": "./" },
"policy": { "installation": "AVAILABLE", "authentication": "ON_INSTALL" },
"category": "Productivity"
}
]
}
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tokenforge",
"version": "0.9.1",
"version": "0.9.2",
"description": "Build big things with far fewer tokens: plan once, then run each task in a small, stateless Claude worker checked by your tests. Includes a token meter, context-growth warnings, and session handoffs.",
"author": { "name": "chteau" },
"homepage": "https://github.com/chteau/tokenforge",
Expand Down
18 changes: 18 additions & 0 deletions .codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "tokenforge",
"version": "0.9.2",
"description": "Fewer tokens per task: raw build/test output routed through a compact kit, large MCP results distilled, context-growth warnings, session handoffs and checkpoints.",
"author": { "name": "chteau" },
"homepage": "https://github.com/chteau/tokenforge",
"repository": "https://github.com/chteau/tokenforge",
"license": "MIT",
"keywords": ["tokens", "cost", "context", "hooks"],
"hooks": "./hooks/hooks.json",
"interface": {
"displayName": "tokenforge",
"shortDescription": "Spend fewer tokens per task",
"developerName": "chteau",
"category": "Productivity",
"websiteURL": "https://github.com/chteau/tokenforge"
}
}
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ jobs:
for i in $(seq 20); do node bin/tforge ui --status | grep -q "running at http://127.0.0.1" && break; sleep 1; done
node bin/tforge ui --status | grep "running at http://127.0.0.1"
node bin/tforge ui --stop
- name: Proxy and command resolution tests
run: node --test test/proxy.test.mjs test/portable.test.mjs
- name: Proxy daemon
shell: bash
run: |
node bin/tforge proxy --detach --port 7899
node bin/tforge proxy --status | grep "running on 127.0.0.1:7899"
node bin/tforge proxy --stop
- name: tforge claude through a .cmd shim
shell: bash
run: |
mkdir -p shim
printf '@echo off\r\nnode "%%~dp0check.js" %%*\r\n' > shim/fakeclaude.cmd
echo 'process.exit(process.env.ANTHROPIC_BASE_URL === "http://127.0.0.1:7898" && process.argv[2] === "a \"b\" & %x%" ? 0 : 5)' > shim/check.js
PATH="$PWD/shim:$PATH" TFORGE_CLAUDE=fakeclaude TFORGE_PROXY_PORT=7898 node bin/tforge claude 'a "b" & %x%'
node bin/tforge proxy --stop
- name: Full test suite (informational until it passes on Windows)
continue-on-error: true
run: node --test test/*.test.mjs
tmap:
strategy:
matrix:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ bench/runs-superseded/
bench/environments/*/template/
bench/results/raw/
__pycache__/
TODO-private.md
60 changes: 60 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

135 changes: 110 additions & 25 deletions README.md

Large diffs are not rendered by default.

32 changes: 20 additions & 12 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Updated 2026-10-09.

0.9.2 adds no features. It makes the savings safe and checkable: a cache reuses an answer only while it still holds, a rewritten command behaves like the original, and every published number names the version that produced it.
0.9.2 makes the savings safe and checkable: a cache reuses an answer only while it still holds, a rewritten command behaves like the original, and every published number names the version that produced it.

This plan follows an external review of the public repo. The review read the docs and the benchmark method, not the code or the test suite.

Expand All @@ -25,20 +25,20 @@ This plan follows an external review of the public repo. The review read the doc

Today every benchmark run records the TokenForge and Claude Code versions, and the environment a hash of the plugin files. But the site's headline figures come from 0.8.0 runs while its pages show the current version, 0.9.1. The benchmarked version is named only further down the benchmark page.

- [ ] Show the TokenForge version, build hash and Claude Code version next to every published figure: site, README, reports.
- [ ] Refuse to build a report from runs of different versions, unless it labels each one.
- [ ] Show the TokenForge version, build hash and Claude Code version next to every published figure: site, README, reports. README and reports done; the site is not.
- [x] Refuse to build a report from runs of different versions, unless it labels each one.

## P0: A safer answer cache

An unchanged project does not prove an answer still holds. "Do the tests pass?" asked again after a dependency or environment change is the same text, and may need a different answer.

Today an earlier answer is replayed only for the same question, from a turn that edited nothing, when no project file (tracked, or untracked and not ignored) has changed since. Prompts that ask to review, verify, check or audit (English and French) skip it. Sending the message again asks Claude; `TFORGE_ANSWER_CACHE=0` turns it off.

- [ ] Never replay an answer to a request to run, test, build or verify something, to a security question, or to a question about the current state ("is it up", "latest", "now").
- [ ] Tell questions that ask for information from requests that need an action or a fresh observation. When unsure, ask Claude.
- [ ] Include the repo's identity, the model, the configuration and the relevant dependencies in the cache's validity, where they affect the answer.
- [ ] An explicit, visible bypass that works before sending, not only by sending again.
- [ ] Adversarial tests for false positives: the same words with another intent, other languages, a changed environment with unchanged files.
- [x] Never replay an answer to a request to run, test, build or verify something, to a security question, or to a question about the current state ("is it up", "latest", "now").
- [x] Tell questions that ask for information from requests that need an action or a fresh observation. When unsure, ask Claude.
- [x] Include the repo's identity, the model, the configuration and the relevant dependencies in the cache's validity, where they affect the answer.
- [x] An explicit, visible bypass that works before sending, not only by sending again.
- [x] Adversarial tests for false positives: the same words with another intent, other languages, a changed environment with unchanged files.

## P0: Formal cache invalidation

Expand Down Expand Up @@ -70,7 +70,7 @@ The Bash router turns some commands into `tkit` calls or compacts their output.

Today the tests check the rewritten command line. Build and test commands are rewritten only when their flags are fully understood, heredocs are never touched, and a `TFORGE_RAW=1` prefix runs a command as typed.

- [ ] Differential tests: run the original and the rewritten command, compare exit codes and outputs.
- [x] Differential tests: run the original and the rewritten command, compare exit codes and outputs.
- [ ] Property tests over quoting, pipes, redirections, substitutions, paths with spaces, environment variables and exit codes.
- [ ] Check that output caps never hide an error at the end of a log.
- [ ] Compare `tkit test` with the native test command.
Expand All @@ -97,10 +97,10 @@ Workers can't run commands: the driver runs each task's `verify` command from th

Today checks run in your checkout with a time limit (`verifyTimeoutMin`, 10 minutes by default). The docs say to read a plan before running it and to build on a branch or a worktree.

- [ ] Stricter validation of `verify` commands.
- [x] Stricter validation of `verify` commands.
- [ ] Time limits and working directories enforced for every check.
- [ ] Side effects of checks isolated.
- [ ] For sensitive tasks, checks run in a git worktree or a sandbox, never in the current environment without inspection.
- [x] For sensitive tasks, checks run in a git worktree or a sandbox, never in the current environment without inspection.

## P2: Adaptive orchestration

Expand All @@ -114,12 +114,20 @@ The goal is the cheapest setup for the actual task, not workers by default.

## P2: Lean levels: measure the whole cost

`balanced`, `max` and `ultra` hide tools: `max` and `ultra` hide skills and subagents, `ultra` also the native Read, Edit and Write. If `ultra` saves tool definitions but causes more Bash calls, quoting errors or failed edits, the saving can vanish.
`balanced`, `max` and `ultra` hide tools: `max` and `ultra` hide skills and subagents, `ultra` also the native Read, Edit and Write, and asks for edits through `tkit edit`. If `ultra` saves tool definitions but causes more Bash calls, quoting errors or failed edits, the saving can vanish.

Today each level's fixed context per request is measured.

- [ ] A report per level: tokens, cost, quality, time, attempts and regressions, not only the starting context.

## P2: Smaller code reads

With lean `ultra` and the proxy, 6 benchmark tasks save a median 57% of tokens (9 runs per task against 4 native runs, quality unchanged). Most of what is left is code read through Bash: in 18 runs, `cat` returned 345k characters and `sed -n` 229k, read again on every later call until pruned. Architecture and banking-transfers sit at 55-59%; 3 more points on each would put the median past 60%.

- [ ] Replay the recorded commands (no API calls): which `cat` and `sed -n` outputs are long enough to fold, and how often the model reads the same lines again after a fold.
- [ ] Fold `sed -n` ranges only where the replay shows no re-read: a range is a deliberate read, and folding one can cost a second call.
- [ ] Prune a file's earlier reads once a later read or an edit of the same file supersedes them.

## Caching

Six layers with six sets of dependencies. They share one validity policy, with rules for each layer.
Expand Down
10 changes: 7 additions & 3 deletions bench/runner/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
bench.py run --smoke
bench.py run --task ID[,ID...] [--agent native|token-forge | --both] [--reps N]
bench.py run --all [--reps N] [--subset-reps ID,ID --subset-n N]
bench.py compare [--session DIR ...]
bench.py report [--session DIR ...]
bench.py compare [--session DIR ...] [--mixed-versions] refuses runs of different TokenForge builds
or Claude Code versions unless --mixed-versions
bench.py report [--session DIR ...] [--mixed-versions]
bench.py retelemetry [--session DIR ...] [--force] re-derive telemetry.json from saved transcripts

Common run options: --max-tokens N --warn-tokens N --max-budget-usd X --jobs N --seed N
Expand Down Expand Up @@ -581,7 +582,7 @@ def cmd_compare(args):
import report
sessions = [Path(s) for s in args.session] if args.session else \
[p for p in sorted(RUNS.iterdir()) if p.is_dir() and not p.name.endswith("-smoke")]
report.build(sessions, ROOT)
report.build(sessions, ROOT, mixed_versions=getattr(args, "mixed_versions", False))
return 0


Expand Down Expand Up @@ -655,6 +656,9 @@ def main():
help="authenticate with the local Claude Code login's current access token (read-only, never refreshed)")
for name in ("compare", "report", "retelemetry"):
c = sub.add_parser(name); c.add_argument("--session", nargs="*")
if name != "retelemetry":
c.add_argument("--mixed-versions", action="store_true",
help="build the report from runs of different TokenForge builds or Claude Code versions, each row labelled")
c.add_argument("--force", action="store_true", help="also rewrite runs whose re-derived values differ")
a = ap.parse_args()
if a.cmd == "run":
Expand Down
Loading
Loading