context-mode
Installation

Installation

Install context-mode on any of its 17 supported agent CLIs — most hosts need a single command.

The ctx_* tools and the context-protection engine are identical on every host. What differs is how a host wires context-mode in — and whether you need a global package at all. Pick your host below, or use the generic MCP guide for anything not yet officially supported.

Which install do I need?

  • No global install. A marketplace command bundles the server, hooks, and slash commands: Claude Code (/plugin install context-mode@context-mode) and Codex CLI.
  • Plugin from a local checkout. Cursor's Marketplace plugin is still awaiting Cursor team review, so today you clone the repo and symlink (macOS/Linux) or robocopy (Windows) it into ~/.cursor/plugins/local/context-mode. The plugin's hook commands run npx -y context-mode, so no global package is required.
  • Plugin + global binary. Copilot CLI installs as a plugin (copilot plugin install mksglu/context-mode:configs/copilot-cli), but its MCP server and hooks run the global context-mode binary, so npm install -g context-mode is a prerequisite. Antigravity CLI (agy) works the same way — npm install -g context-mode, then agy plugin install https://github.com/mksglu/context-mode/tree/main/configs/antigravity-cli.
  • Package + config. Hosts without a marketplace install the package, then add a config entry: Gemini CLI, VS Code Copilot, JetBrains Copilot, Qwen Code, Kimi Code, OpenCode, KiloCode, and Kiro (which adds native preToolUse/postToolUse hooks).
  • Dedicated installer. OpenClaw ships a native gateway plugin you install with npm run install:openclaw.
  • MCP-only. Register an MCP server (run it through npx -y context-mode for no global install) plus a routing file: Antigravity, Zed, OMP.

Package, installer, and npx-based hosts need Node.js 22.5+ or Bun (auto-detected and faster). Pure plugin hosts handle their own runtime.

How integration differs

A host connects through one of three paradigms, and the paradigm decides which context-protection features are available.

  • JSON stdin/stdout hooks — the richest model: context-mode can rewrite tool arguments, inject sandbox output, and block a call before it runs. Used by Claude Code, Codex CLI, Copilot CLI, Cursor, Gemini CLI, VS Code / JetBrains Copilot, Qwen Code, Kimi Code, Kiro, and Antigravity CLI (agy, with bounded hooks).
  • Native plugins / extensions — context-mode loads in-process and registers real hooks. Used by OpenCode, KiloCode, OpenClaw, and Pi (a package extension via pi.on(...)).
  • MCP-only with a routing file — the host speaks MCP but exposes no hook surface, so a routing instruction file steers the model toward the sandbox (advisory, ~60% adherence). Used by Antigravity, Zed, and OMP.

Capability matrix

HostSession continuityTool-arg modificationTool-output injectionPreToolUse blockingMCP tools
Claude Codeyesyesyesyesyes
Cursoryesyesyesyesyes
Gemini CLIyesyesyesyesyes
Codex CLIyesyesyesdeny-onlyyes
OpenCodeyesyesyesyes (plugin)yes
MCP-only hostspartial (file-driven)nononoyes (routing file, ~60% adherence)

Codex CLI supports PreToolUse blocking in deny-only form. MCP-only hosts have no hook surface, so the routing file carries the guidance instead.

Choose your platform

JSON hook hosts

Native plugin hosts

MCP-only hosts

Not listed?

Verify any install

context-mode doctor

This checks language runtimes, the knowledge base, and hook registration. In Claude Code and Cursor you can also run /context-mode:ctx-doctor, or type ctx doctor to your agent in chat.

On this page