Claude Code — plugin (recommended):
# New machine:
claude plugin marketplace add https://github.com/Digital-Threads/token-pilot
claude plugin install token-pilot@token-pilot
# Update:
claude plugin update token-pilotOther clients (Cursor, Codex, Cline, …):
# New machine:
npx -y token-pilot init
# Update — npx always pulls fresh, just restart your client.
# Or if installed globally:
npm i -g token-pilot@latest
npx token-pilot install-hook
npx token-pilot install-agents --scope=user --forcenpx -y token-pilot initWrites .mcp.json (or merges into an existing one), adds token-pilot + context-mode, then prompts to install tp-* subagents. Restart your AI assistant to activate.
Three paths — pick one, they're mutually exclusive.
claude plugin marketplace add https://github.com/Digital-Threads/token-pilot
claude plugin install token-pilot@token-pilotClaude Code clones the repo into ~/.claude/plugins/cache/token-pilot/, sets CLAUDE_PLUGIN_ROOT, and registers the MCP server + all hooks declared in .claude-plugin/hooks/hooks.json. No install-hook call needed. Run install-agents separately for the tp-* subagents.
claude mcp add token-pilot -- npx -y token-pilot
# or for a specific scope:
claude mcp add --scope user token-pilot -- npx -y token-pilot
claude mcp add --scope project token-pilot -- npx -y token-pilotOr edit .mcp.json (project-level) / ~/.mcp.json (user-level) directly:
{
"mcpServers": {
"token-pilot": { "command": "npx", "args": ["-y", "token-pilot"] },
"context-mode": { "command": "npx", "args": ["-y", "claude-context-mode"] }
}
}Then:
npx token-pilot install-hook # register PreToolUse hooks
npx token-pilot install-agents --scope=user # install tp-* subagentsnpx -y token-pilot initWrites path B config for you, then prompts about subagents.
Cursor reads .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):
{
"mcpServers": {
"token-pilot": { "command": "npx", "args": ["-y", "token-pilot"] }
}
}Codex reads ~/.codex/config.toml:
[mcp_servers.token-pilot]
command = "npx"
args = ["-y", "token-pilot"]Cline reads cline_mcp_settings.json (accessible via Cline panel → MCP Servers → Edit):
{
"mcpServers": {
"token-pilot": { "command": "npx", "args": ["-y", "token-pilot"] }
}
}Add to ~/.gemini/settings.json or follow Gemini CLI MCP documentation for your version.
The server is a plain stdio process:
command: npx
args: -y token-pilot
No env vars required. Common optional overrides:
| Env var | Default | Purpose |
|---|---|---|
TOKEN_PILOT_MODE |
deny |
advisory / deny / strict — enforcement level |
TOKEN_PILOT_PROFILE |
full |
nav / edit / full — trims tools/list payload |
TOKEN_PILOT_DENY_THRESHOLD |
300 |
Line count above which the Read hook intervenes |
TOKEN_PILOT_ADAPTIVE_THRESHOLD |
false |
Enable adaptive curve as session burns |
TOKEN_PILOT_BYPASS |
unset | Set to 1 to disable the Read hook for one session |
TOKEN_PILOT_SKIP_POSTINSTALL |
unset | Skip ast-index safety-net install at npm install time |
git clone https://github.com/Digital-Threads/token-pilot.git
cd token-pilot && npm install && npm run build
# Point your client's config at dist/index.js:
# "command": "node", "args": ["/abs/path/to/token-pilot/dist/index.js"]install-agents detects non-Claude clients via env vars + filesystem markers (CURSOR_TRACE_ID, ~/.codex/, ~/.gemini/, etc.) and skips installing subagents unless you pass --scope=user|project explicitly. Cursor, Codex, Gemini, and Cline users get all 22 MCP tools + PreToolUse hooks without the tp-* agents.