/token-master:token-masterfrom token-master
Configures graph navigation and token-efficiency tools for a selected host (Claude, Codex, or Copilot). Sets up MCP servers for symbol location, reading, and impact analysis with token-aware brief generation.
Ships in token-master. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use the smallest requested surface. An informational or explain-only request does not authorize repository edits or a host installation. Preserve requested depth, proofs, safety checks and justified reusable abstractions.
Run the script from this skill directory with the requested repository, explicit host and an already provisioned pinned runtime:
<runtime-python> setup.py <repo-root> --host claude|codex|copilot --python <runtime-python>
For Copilot, then run the second installer from the same directory. Copilot setup is
complete only when both commands succeed; this one installs the view output hook,
the launcher and /tokenomics:
<runtime-python> brainspace_setup.py --host copilot --python <runtime-python>
Both need an already provisioned runtime: an interpreter with the exact pins in the
plugin's requirements-runtime.txt and closure lock. Look first in
<COPILOT_HOME>/token-master-runtime (Scripts/python.exe on Windows, bin/python
elsewhere), then in an activated virtual environment. Do not substitute another
interpreter; setup rejects any pinned-version mismatch. setup.py also needs the
graph supplier, graphify, on PATH; it comes from the graphifyy PyPI package.
brainspace_setup.py reads OpenAI's cl100k_base vocabulary from tiktoken's cache
and verifies its SHA-256; it never downloads. When one of these is missing, stop and
give the user these one-time commands, with <plugin> (this skill directory's
grandparent, which holds requirements-runtime.txt) and <COPILOT_HOME> filled in.
Run them only if the user asks:
uv venv --python 3.12 <COPILOT_HOME>/token-master-runtime
<runtime-python> -m ensurepip
<runtime-python> -m pip install -r <plugin>/requirements-runtime.txt
<runtime-python> -c "import tiktoken; tiktoken.get_encoding('cl100k_base')"
uv tool install graphifyy
Do not install an unverified similarly named package or silently resolve dependencies at every launch.
setup.py installs one MCP server, tokenmaster-nav (navigation_mcp.py), with three
tools: locate (a symbol or a file's outline), read_symbol (one symbol, file or
line range; oversized classes render a signature + member-map skeleton via default
--class-skeleton r6, --class-skeleton v1 retains legacy linear truncation, and
contiguous @overload stubs + implementation resolve in one call) and impact (callers). It builds .token-master/graph.json with
graphify, prebuilds .token-master/symbols.sqlite, and writes .token-master/brief.md
(<= 320 tokens via the default --brief-algorithm r1 submodular graph-coverage solver;
--no-brief skips it, --brief-algorithm v1 writes the legacy fixed-slot brief, and
setup.py <repo> --refresh-brief refreshes it with verified symbol lookups recorded in
.token-master/recall.jsonl); all are gitignored.
It also gitignores graphify's own output folder, graphify-out/, so searches skip it. Graph
servers installed by earlier versions (graphify-nav, codegraph) are removed
when TokenMaster owns them.
Report the actual installer result, not a claim that a host accepted a tool. Claude/Copilot get a navigation agent; Codex gets native MCP configuration, not a translated Claude agent or output-replacement hook. Honor the restart guidance printed for the selected host; for Copilot, end with the launcher command given under Recoverable views. Never rewrite another host's profile by guessing.
Treat impact lines marked [inferred] or [name] as candidates and verify them
in source; dynamic calls, callbacks and string dispatch are invisible to it.
locate and read_symbol see edits immediately. The call graph is a build-time
snapshot; its edges from files edited since then are dropped.
When the user asks to remove TokenMaster, run from this skill directory with the
runtime interpreter, or any Python 3.11 or newer if the runtime is gone; uninstall
needs no pinned packages, repository or --python. The second command is for
Copilot only:
<runtime-python> setup.py --host claude|codex|copilot --uninstall
<runtime-python> brainspace_setup.py --host copilot --uninstall
Both remove only configuration TokenMaster owns. These scripts ship inside the
plugin, so they must run before copilot plugin uninstall token-master@token-master;
tell the user to run that next. The runtime, <COPILOT_HOME>/token-master/ and each
repository's .token-master/ and graphify-out/ stay until the user deletes them.
The model-invoked brainspace_compress tool defaults to conservative behavior.
Explicit navigation may expose code skeletons; explicit overview may sample
suitable structured content. Exact/edit/debug/aggregate/exhaustive/security tasks
must retain their answer-bearing material. Errors and mixed media pass through.
Use brainspace_retrieve(ref, offset, limit) repeatedly at next_offset until
complete=true. Verify digests when reconstructing originals. Exact search is
available via brainspace_search; a bounded snippet is not the full original.
Do not treat a stored original, a shorter view, or a Jev confidence as proof of
successful task completion.
MCP is model-invoked, not transparent interception. The Claude PostToolUse adapter has a separate versioned schema and runtime-acceptance gate. Unknown hosts/shapes are not assumed compatible. No model-visible savings footer is required.
For Copilot, brainspace_setup.py --host copilot also installs an output hook and a
new-session brief hook by default; --no-copilot-output-hook and
--no-copilot-repo-brief skip or remove them. The output hook applies request-policy-v6
to whole-file view results: oversized files become outline digests, and folder
listings are folded losslessly. A result that would not fit the hook's 9,000-byte
output cap passes through unchanged. The hooks.sessionStart brief hook injects
.token-master/brief.md once as additionalContext on new sessions (source == "new")
and emits {} on --resume (TOKENMASTER_REPO_BRIEF=0 disables it per launch). The
native Copilot route defaults to the same v6 policy. For Copilot, setup does not install
the brainspace MCP server unless --brainspace-mcp is given.
Setup also copies the launcher to <COPILOT_HOME>/token-master/. Start Copilot CLI
with <runtime-python> <COPILOT_HOME>/token-master/brainspace_copilot_bridge.py -- copilot;
in bring-your-own-model mode its v6 shaping needs the runtime's tiktoken.
By default the launcher sends every built-in tool. With --lean before --, it excludes 13
built-in tools: 11 that no session called in the October 18 runs, and two workflow tools that
none of the October 27 sessions called. A prompt given at launch with -p or -i that asks for
one of these tool families keeps it, and a prompt that starts a skill also keeps the workflow and
subagent tools. Prompts typed later in an interactive session keep nothing: before launching, set
TOKENMASTER_KEEP_TOOLS to the families to keep, for example agents,sql, or leave out --lean.
With TOKENMASTER_MD1_ENDPOINT set (or --router md1), --lean sends the launch prompt to the user's own
Microsoft-Decision-1 deployment to ask which families it needs; with --router r2 (or TOKENMASTER_ROUTER=r2),
--lean instead runs the offline 24.7 KB distilled local classifier (0.060 ms standalone, zero network calls),
and --resume-escalate r2 (TOKENMASTER_RESUME_ESCALATE=r2) enables warm-cache-aware mid-session capability
escalation on --resume / --continue. Both routers are off by default (--router auto, --resume-escalate off). The headline saving, about half the tokens, was measured with --lean. Without it,
with navigation and the view hook installed, a November 1 run used 19% fewer raw tokens than
stock Copilot CLI (95% CI 9 to 29%). In bring-your-own-model mode, the
launcher also runs a local bridge
that applies the cache-stable system prompt and v6 shaping. See
docs/COPILOT_BRIDGE.md and docs/COPILOT_CLI_RESULTS.md for the measured effect
and its limits.
Setup also installs a personal Copilot skill, /tokenomics. In an interactive
session it shows Copilot CLI's token usage, GitHub's charges and the estimated
TokenMaster savings by day, week, month or session (docs/TOKENOMICS.md). The
savings are estimates; report them as such.
For an explicitly requested task-local mode, state a compact contract:
brainspace_tools.py exposes task-local and explicit session-keyed modes. Never
infer that an enable flag from another session applies here. off removes only
this mode's owned state; it does not delete unrelated configuration or claim to
erase instructions already in a conversation. The review-only companion is
token-master-review and does not authorize edits.
Use the token-only reference metric: all observed model inputs and outputs across the whole task, including failures, retries, auxiliary decisions and recovery. Keep learning separate; reject partial or nonmaterialized traces rather than inventing totals. Native counters are diagnostics, not interchangeable units.
token_efficiency.py exposes the durable controller and an offline synthetic
fixture. The fixture verifies plumbing, not real language-model performance.
The installed session runtime can explicitly select actual pinned Ponytail
instructions and Headroom. initialize-runtime / learn-runtime connect a
bounded real read-only evaluator; initialization is safety admission only, and
learning compares an enabled local incumbent with a local neighbor, not an
optimizer-off baseline. See docs/PRODUCT_RUNTIME.md before using these paths.
For full compositions, initialize-profile / learn-profile use closed
RuntimePolicy data and explicit pinned resources, with a true-off default.
They reuse the registry/evaluator and do not promote automatically. The gate is
strict unless initialize-profile creates a new registry with a pre-registered
--quality-margin or --token-test max-bet-v1; existing registries stay strict.
See docs/PROFILE_LEARNING.md; Jev abstention is not an improvement judgment.
Opt-in V4 adds lexical JSON payload compaction with exact original recovery;
it is not sampling or a default change. See docs/LEXICAL_JSON_POLICY.md and
docs/LEXICAL_JSON_RESULTS.md for its presentation contract and limited evidence.
The optional --require-nonexpanding-input session guard includes composition
overhead and falls back to the exact original input; it is not a task-savings
or quality certificate and is not enabled globally.
It may omit newly inserted optional guidance while retaining a valid smaller
context; reports distinguish configured and applied instructions. Headroom's
optional --headroom-time-budget-seconds is explicit, bounded and profile-bound,
not a hard wall-time guarantee or permission to forward arbitrary environment.
Real candidates need an independent outcome evaluator, fresh confirmation data,
a fixed measurement/regime, valid whole-task bounds and the persisted promotion
gate. Jev is optional advisory screening, network-disabled unless explicitly
configured; never send repository data or secrets as an implicit side effect.
See the plugin's docs/TOKEN_EFFICIENCY.md and docs/IMPLEMENTATION_PLAN.md for
the proof assumptions, supported boundaries and remaining release qualification.
agent.template.claude.md (opens in a new tab)agent.template.copilot.md (opens in a new tab)brainspace/__init__.py (opens in a new tab)brainspace/benchmark.py (opens in a new tab)brainspace/ccr.py (opens in a new tab)brainspace/certification.py (opens in a new tab)brainspace/compressors/__init__.py (opens in a new tab)brainspace/compressors/code_compressor.py (opens in a new tab)brainspace/compressors/json_compressor.py (opens in a new tab)brainspace/compressors/logs_compressor.py (opens in a new tab)brainspace/compressors/prose_compressor.py (opens in a new tab)brainspace/document_structure.py (opens in a new tab)brainspace/exact_reuse.py (opens in a new tab)brainspace/headroom.py (opens in a new tab)brainspace/headroom_worker.py (opens in a new tab)brainspace/host_output.py (opens in a new tab)brainspace/jev.py (opens in a new tab)brainspace/learning_runtime.py (opens in a new tab)brainspace/local_router.py (opens in a new tab)brainspace/local_router_weights.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Claude Code refuses to install this plugin
.claude-plugin/plugin.json: skills.0: Invalid string: must start with "./"
Checked against Claude Code 2.1.332's install rules. The listing below is what the repository ships; Claude Code cannot install it as published.
2 skills in this plugin
Other plugins' skills for the same job