context-mode
Installation

Claude Code

Install context-mode on Claude Code, the primary host, with one plugin marketplace command — no global npm install required.

Claude Code is the primary host for context-mode and exposes its full JSON-hook surface — PreToolUse, PostToolUse, PreCompact, SessionStart, UserPromptSubmit, and Stop — plus the complete set of slash commands. Together those hooks rewrite tool arguments, route data-heavy output into the sandbox, preserve context across compaction, and keep the bulk of raw payload bytes out of your window.

The marketplace command is the entire install. The plugin bundles the server, hooks, and slash commands, so there is no global npm package to install.

Install

Add the marketplace

Register the context-mode marketplace with a slash command inside Claude Code.

/plugin marketplace add mksglu/context-mode

Install the plugin

Install context-mode from the marketplace you just added. This pulls the MCP server, the hook dispatcher, and the slash commands in one step.

/plugin install context-mode@context-mode

Restart Claude Code

Restart so the hooks and slash commands register. There is nothing else to wire up by hand.

Configure

Configuration is optional. Permission rules live in your Claude settings.json. Deny and allow patterns are written as Tool(match) rules, where match accepts * wildcards and deny always wins over allow. context-mode enforces the same rules inside the sandbox, so a command blocked at the host is also blocked when an agent runs it through ctx_execute.

{
  "permissions": {
    "deny": ["Bash(curl *)", "Bash(rm -rf *)"],
    "allow": ["Bash(git *)", "Bash(npm *)"]
  }
}

By default context-mode stores its knowledge base and session stats under your Claude home directory. To relocate that storage — for a shared machine or per-project isolation — set CONTEXT_MODE_DIR to an absolute path. See /docs/configuration for the full list of variables.

export CONTEXT_MODE_DIR=/Users/you/.context-mode

Verify

Confirm the install with the doctor. It checks language runtimes, the FTS5 knowledge base, and hook registration, then reports anything that needs attention.

context-mode doctor

You can run the same check inside the chat with /context-mode:ctx-doctor. A clean run means context-mode is ready to route your next data-heavy command.

Slash commands

Every status command is available inside the chat, so you can check savings or run the doctor without leaving Claude Code:

  • /context-mode:ctx-stats
  • /context-mode:ctx-doctor
  • /context-mode:ctx-upgrade
  • /context-mode:ctx-purge
  • /context-mode:ctx-index
  • /context-mode:ctx-search
  • /context-mode:ctx-insight

On this page