Docs / Agents
Cursor
Updated
Cursor is covered through its programmatic hooks: Tokenade rewrites the agent's shell commands and file reads before they run, and folds large MCP tool results after they return. tokenade install sets this up when it finds a ~/.cursor folder, and keeps any hooks you already have.
What install writes
~ is your home directory (%USERPROFILE% on Windows); the paths are the same on Linux, macOS and Windows.
| File | What Tokenade adds |
|---|---|
~/.cursor/hooks.json | One preToolUse entry and one postToolUse entry (below) |
~/.cursor/rules/tokenade.mdc | A short Tokenade rules section, loaded in every Cursor session |
.cursor/mcp.json (project), ~/.cursor/mcp.json (global) | Third-party MCP servers rewritten to start behind tokenade mcp-wrap |
The hooks
| Hook | What it does |
|---|---|
preToolUse | Rewrites a shell command to tokenade wrap <cmd> so its output comes back compacted; redirects a large file read to a folded copy |
postToolUse | Replaces a large MCP tool result with a folded one (Cursor only lets hooks replace MCP results) |
The merge is idempotent: an existing Tokenade entry is updated in place, never duplicated, and entries that are not Tokenade's are left alone. Upgrades refresh these hooks automatically.
Interactive programs (editors, pagers, top, ssh…) are never wrapped, because wrapping would pipe their output and they would never return.
What Cursor gets
From the compatibility matrix: command output, web search, MCP results, code search, re-read dedup, documents and media, and secret redaction are covered. Context-window optimisation is partial on Cursor.
Rules: the .mdc file in ~/.cursor/rules/ is what Cursor loads globally. Cursor also reads CLAUDE.md and AGENTS.md in a project, so Tokenade does not repeat its full rules there when a global copy exists.
After installing
Restart Cursor (or reload the window) so it picks up the new hooks.json and MCP configuration. Then ask the agent to run something noisy, such as your test suite.
Verify
tokenade hooks tail # recent hook fires, including Cursor's
tokenade gain # savings recorded in ~/.tokenade/gain.jsonl
You can also open ~/.cursor/hooks.json and look for the two tokenade commands. tokenade detect, run from a Cursor project, prints cursor and its channel.
Turn it off or remove it
| Goal | How |
|---|---|
| Run one command without compaction | tokenade raw <cmd> |
| Restore the original MCP entries only | tokenade unwrap-mcps |
| Install for Cursor only, on a machine with several agents | tokenade install --only cursor |
| Remove everything | tokenade uninstall |
tokenade uninstall drops every entry that references Tokenade from ~/.cursor/hooks.json, restores your MCP servers, and removes the rules file it wrote. Preview first with tokenade uninstall --dry-run. See Upgrade and uninstall.