The recommended way is to install the official extension from the Cursor extension marketplace.
Alternatively, you can build from source:
pnpm install
pnpm -C packages/extension run package:cursor:vsixThis produces sage-cursor.vsix in the repo root. Install it via Extensions > Install from VSIX.
The recommended way is to install the official extension from the VS Code extension marketplace.
Alternatively, you can build from source:
pnpm install
pnpm -C packages/extension run package:vscode:vsixThis produces sage-vscode.vsix in the repo root. Install it via Extensions > Install from VSIX.
Tip: To build both VSIX packages from source at once, use
pnpm -C packages/extension run package:vsix.
Open the command palette (Ctrl+Shift+P) and use:
Sage auto-enables protection (managed hooks) on every startup. Running Sage: Disable protection until restart removes hooks for the current session only — they are reinstalled automatically when Cursor or VS Code restarts.
- Cursor: Sage enables/disables the
sageMCP server automatically based on whether protection is enabled. - VS Code: you must start the
sageMCP server manually using the command palette:MCP: List Server→sage→Start server.
| Command | Description |
|---|---|
Sage: Enable Protection |
Install managed hooks (and enable the Sage MCP server automatically in Cursor) |
Sage: Disable protection until restart |
Remove managed hooks until the next restart (and disable the Sage MCP server automatically in Cursor) |
Sage: Open Config |
Open ~/.sage/config.json |
Sage: Open Audit Log |
Open the audit log file |
Sage: Show Hook Health |
Display hook status |
The extension installs managed hooks into the Cursor/VS Code agent system. When a tool call is intercepted, the hook spawns sage-hook.cjs as a subprocess, which runs the same detection pipeline as the Claude Code connector.
Hooks are installed at user scope:
- Cursor —
~/.cursor/hooks.json - VS Code (Copilot) —
~/.copilot/hooks/hooks.json— this path is shared with Copilot CLI, so protection extends to CLI agent sessions on the same machine automatically.
Extension E2E tests run inside installed IDE hosts (no IDE auto-download):
pnpm test:e2e:cursor
pnpm test:e2e:vscodeCursor headless agent coverage in pnpm test:e2e:cursor additionally requires:
agentCLI inPATH(orSAGE_AGENT_PATH)- Valid agent auth (
agent loginorCURSOR_API_KEY)
Optional executable overrides:
SAGE_CURSOR_PATH- absolute path to Cursor executableSAGE_AGENT_PATH- absolute path to theagentCLI used by Cursor headless E2ESAGE_VSCODE_PATH- absolute path to VS Code executableVSCODE_EXECUTABLE_PATH- alternate VS Code executable override
If the agent CLI is missing or unauthenticated, only the Cursor headless agent sub-suite is skipped; other extension host E2E tests continue.
Extension hooks always exit with code 0. The host reads the JSON response to determine whether to block the tool call.
The extension bundles threats/ and allowlists/ from the repo root into packages/extension/resources/ during build (via sync-assets.mjs). These are not checked into git.
See the Installation section above for VSIX packaging commands.