[01] BULK-READER
Question + explicit paths + root
The scripted reader defaults to claude-haiku-4.5. It answers a focused question about the supplied source, preserving useful file and line anchors. No inherited transcript.
Copilot-native / Experimental
Keep your selected coordinator. Give a separate worker the source-reading job. Return compact evidence, or pass --target to write generated code to disk without streaming its body into the parent's conversation.
# The coordinator keeps its selected model.
[parent] requests a large file read
[gate] actual window exceeds 350 lines
[gate] deny with delegation guidance
[skill] question + explicit paths + root
[worker] fresh CLI process; piped stdin JSON
[worker] full source processed in its own context
[check] reported model + bounded final output
[parent] compact answer; with --target: {written, bytes, model}
The gate nudges; the skill routes work. This is not an automatic hook-to-worker handoff.
01 / Interactive WebGL illustration
The parent's cyan core stays on the left. The source corpus sits off to the right, feeding a green worker. Only a compact result travels back. The shapes illustrate the mechanism, not a live trace, token count, or quality measurement.
Static illustration. 3D is not enabled; no CDN request has been made.
Your selected model. Receives a compact result and keeps the judgment.
Still read and processed in the worker. It is not eliminated by delegation.
A fresh CLI process, not an OS sandbox. The grid barrier represents the read gate.
An anchored answer or file confirmation. Review and follow-ups still cost context.
Static first: Three.js loads only when you enable 3D. A failed CDN load or WebGL renderer leaves an explicit error and this static illustration. All controls work from the keyboard; reduced-motion preferences keep the scene still. Dependency: Three.js 0.170.0 (r170), pinned on jsDelivr.
02 / Architecture & boundaries
The parent is your existing coordinator. A scripted worker is a new Copilot process with one explicit work order. Native named agents are also available, but their instruction-only path does not inherit the scripted guarantees or accounting below.
On narrow screens, scroll the diagram horizontally or use its written caption.
--target explicitly for disk output and a JSON receipt; without it, stdout returns code capped at 4,096 UTF-8 bytes. The script validates the result before publication. Existing targets need --overwrite; conflicts or concurrent changes are refused. The JSON receipt is not a diff summary or a substitute for inspecting the generated code.[01] BULK-READER
The scripted reader defaults to claude-haiku-4.5. It answers a focused question about the supplied source, preserving useful file and line anchors. No inherited transcript.
[02] CODE-WRITER
The scripted writer defaults to gpt-5.4-mini. Pass --target explicitly to write to disk and receive only {written, bytes, model}. Without --target, stdout returns code capped at 4,096 UTF-8 bytes. Stderr contains coarse metadata.
[03] MODEL CONTRACT
An unavailable model may retry gpt-5-mini within a shared 120-second deadline. Missing or wrong reported model identity is an error: no returned answer, no published file, no fallback.
03 / Verification & test battery
Original fixtures and a deterministic stub CLI test the contracts. These eight groups organize the walkthrough rather than report separate pass totals. Optional live checks are a separate, authentication-dependent path.
8 test groups shown.
-p, with a private temporary COPILOT_HOME. No inherited transcript, MCP, custom instructions, or remote export. tools: [] restricts actual tool availability; extra CLI denial kinds are exactly shell, write, and url. Reject tool attempts and invalid model evidence. Pass only environment-supported CLI authentication, never pasted secrets; clean transport and staging directories.--target, its parent must exist. Existing files require --overwrite; conflicts and concurrent changes are refused. No symlink target. Publish atomically from private staging, with private Unix permissions for new files. Include the published newline in the 1 MiB limit. Only with --target, return {written, bytes, model} instead of the generated body. Without it, stdout code is capped at 4,096 UTF-8 bytes.ceil(characters / 4); compute percentages from unrounded character totals.--overwrite. Refuse symlinked destinations. Personal hook paths are absolute and quoted. Exercise installed launchers as well as source templates.npm run eval:live was executed on using Copilot CLI 1.0.84-2, supported authentication, and available models. It exercised exact first/last-anchor requests and generation to disk.claude-haiku-4.5 and gpt-5.4-mini. LIVE verified: 2 exact first/last-anchor requests; 13,998-byte generated ES module written and syntax-checked.No matching test groups. Clear the filter to see all eight contracts.
04 / Reproducible accounting
Character-based estimates compare full-corpus parent ingestion with scripted delegation. They do not measure inference tokens, model pricing, answer quality, or total task cost. The native named-agent path is not represented.
npm run benchmark completed successfully. These current verified totals include the updated skill text, which increases counted overhead compared with earlier snapshots. Re-run against the exact version you use. Read the saved numeric results.
| Scripted scenario | Full material in parent | Delegated parent total | Worker input estimate | Lower parent-input proxy | Parent footprint |
|---|---|---|---|---|---|
| One large fileScripted bulk-reader | 30,915 | 858 | 31,586 | 97.23% | |
| Several source filesScripted bulk-reader | 62,455 | 893 | 64,460 | 98.57% | |
| Generate to diskScripted code-writer | 17,747 | 1,461 | 13,903 | 91.77% |
Displayed estimates use ceil(characters / 4). Percentages use unrounded character totals, not the rounded displayed estimates. This is not a tokenizer.
Both sides include invocation text, skill text, and the fixed 1,024-character delegation allowance. The scripted side also counts its compact reply and coarse metadata. Worker input is not eliminated.
The current generator fixture wrote 13,896 bytes to disk. Its parent total reserves 512 estimated parent tokens for review. Inspection is not free; live review-token consumption is not measured here.
Enter two explicit character totals. Include any delegation overhead yourself. This calculator does not predict answer length, choose a model, or estimate a bill. Its defaults are illustrative, not benchmark inputs.
Whole character counts, at most 1,000,000,000. Both inputs stay in this page's memory.
Token proxies use ceiling division by four. Bars share the larger input as their scale.
05 / Setup & reproduction
Use Node.js >=20 and an authenticated Copilot CLI for worker execution. Runtime and evals use only Node's standard library. No npm install is needed.
The installer copies only TokenReducer's skills, hooks, and agents. Replace the example workspace path; quote paths with spaces. Unrelated files remain intact. Conflicts require --overwrite.
Review the installed hooks before trusting the folder. Restart Copilot CLI, then check /skills list and /skills info bulk-reader. Project hooks need workspace trust.
Ask the skill to use its scripted worker with explicit inputs. Do not switch with /agent and call that delegation. Native named agents remain instruction-only alternatives, without the scripted guarantees or measured accounting.
git clone https://github.com/brianbaldock/TokenReducer.git
cd TokenReducer
node scripts/install.mjs --project /path/to/workspacenode scripts/install.mjs --personalRun from the TokenReducer source directory. Personal hook paths are absolute and quoted. Both Bash and PowerShell launchers are included.
npm testDeterministic regression checks.
npm run evalOffline fixture workflows.
npm run benchmarkReproducible parent-input proxies.
npm run eval:liveRequires supported authentication and available models.
06 / Research lineage
This experiment builds on others' research about model choice, context selection, and agent interfaces. These works motivate the questions; they do not prove TokenReducer's results.
TMLR, 2024 / Model cascades
Explores LLM cascades and cost-quality tradeoffs.
Distinction: Task-specific worker defaults are not FrugalGPT's learned cascade strategy.
arXiv:2406.18665 / Routing
Studies stronger/weaker model routing using preference data.
Distinction: This project does not train a router or reproduce its quality-cost curves.
arXiv:2310.12963 / Verification
Explores self-verification and model mixing.
Distinction: Deterministic transport checks are not AutoMix's answer-verification algorithm.
arXiv:2310.05736 / Compression
Compresses prompts to reduce inference overhead.
Distinction: TokenReducer routes full source and returns compact evidence; it does not implement token-level prompt compression.
arXiv:2310.06839 / Long context
Studies question-aware long-context compression.
Distinction: It informs a context-selection question, not this implementation's mechanics or accounting.
TACL, 2024 / Position effects
Shows that information position can affect long-context performance.
Distinction: It motivates care with context, not a claim of better reasoning here.
arXiv:2405.15793 / Agent interfaces
Examines agent-computer interfaces for software engineering.
Distinction: Tool boundaries are a design choice here; the project does not implement SWE-agent.
Aider documentation / Code context
Provides a compact repository representation to focus code context.
Distinction: Explicit files and worker answers are not Aider's repository map or symbol-graph algorithm.
Anthropic / Workflow patterns
Describes practical routing and orchestrator-worker arrangements.
Distinction: A useful design reference, not a certification of this runtime.
arXiv:2512.24601 / Decomposition
Explores programmatic access to large contexts and recursive model calls at inference time.
Distinction: TokenReducer uses bounded one-job workers, not that algorithm or recursive training.