Docs / Agents

Cursor

Updated

TL;DR — `tokenade install` merges two hooks into `~/.cursor/hooks.json`: a preToolUse hook that routes shell commands and file reads through Tokenade, and a postToolUse hook that folds MCP results. Restart Cursor afterwards.

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.

FileWhat Tokenade adds
~/.cursor/hooks.jsonOne preToolUse entry and one postToolUse entry (below)
~/.cursor/rules/tokenade.mdcA 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

HookWhat it does
preToolUseRewrites a shell command to tokenade wrap <cmd> so its output comes back compacted; redirects a large file read to a folded copy
postToolUseReplaces 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 healthcheck # checks every agent's hooks are installed and valid
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

GoalHow
Run one command without compactiontokenade raw <cmd>
Restore the original MCP entries onlytokenade unwrap-mcps
Install for Cursor only, on a machine with several agentstokenade install --only cursor
Remove everythingtokenade 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.