Agents
Ten agents, one plugin: how each one connects
Context Mode Engine works in ten coding agents: Claude Code, Codex, Gemini CLI, Qwen Code, Copilot CLI, VS Code, Kiro, ZCode, OpenCode and Pi. Each agent gets the same three parts: hooks, the MCP server with nine tools, and the skills. This page shows how those parts reach your agent, and which event names your agent uses.
Free · Local · Private · Forever
Context Mode Engine is source-available under the Elastic License 2.0. Free to use, for all time. It runs on your machine and keeps your data in ~/.context-mode.
Key facts
- What it is
- A map of how Context Mode Engine connects to each of ten coding agents: through a plugin package, a hook file or a plugin inside the agent.
- Who it is for
- Anyone who wants to know how the Engine works with the agent they use.
- Agents
- Claude Code, Codex, Gemini CLI, Qwen Code, Copilot CLI, VS Code, Kiro, ZCode, OpenCode and Pi.
- Measured result
- Hook time over a bare
nodestart: 7.3 ms to 14.6 ms per agent. Benchmark of 2026-10-31, median of 5 runs (raw file). - Scope
- Coding agents in a terminal or an editor. Each agent keeps its own event names, and the Engine uses them.
Find your agent
Pick your agent. Run its install command, restart the agent, then run the check. The full steps are on Install Context Mode Engine in your agent.
Claude Code
Plugin. Context Mode installs with the agent's own plugin command.
Install
claude plugin marketplace add mksglu/context-mode
claude plugin install context-mode@context-modeCheck
/ctx-doctorUpdate and remove
Update
claude plugin update context-mode@context-modeRemove
context-mode setup --remove --agents claude-codeThe hook check passed on 2026-10-26 with Claude Code 2.1.309. Source: the install guide
Codex
Plugin. Context Mode installs with the agent's own plugin command.
Install
codex plugin marketplace add mksglu/context-mode
codex plugin add context-mode@context-modeNext, trust the hooks
npm i -g context-mode
context-mode setup --agents codexCheck
/ctx-doctorUpdate and remove
Update
codex plugin marketplace upgrade context-modeRemove
context-mode setup --remove --agents codexThe hook check passed on 2026-10-26 with Codex 0.164.0. Source: the install guide
Gemini CLI
Plugin. Context Mode installs with the agent's own plugin command.
Install
gemini extensions install https://github.com/mksglu/context-modeCheck
/ctx-doctorUpdate and remove
Update
gemini extensions update context-modeRemove
context-mode setup --remove --agents gemini
gemini extensions uninstall context-modeThe hook check passed on 2026-10-26 with Gemini CLI 0.65.0. Source: the install guide
Qwen Code
Plugin. Context Mode installs with the agent's own plugin command.
Install
qwen extensions install https://github.com/mksglu/context-mode:context-modeCheck
/ctx-doctorUpdate and remove
Update
qwen extensions update context-modeRemove
context-mode setup --remove --agents qwen
qwen extensions uninstall context-modeThe hook check passed on 2026-10-26 with Qwen Code 0.26.1. Source: the install guide
Pi
Plugin inside the agent. The agent loads Context Mode as a plugin in its own process. Its tools come from that plugin.
Install
pi install npm:context-modeCheck
pi listUpdate and remove
Update
pi update --extensionsRemove
pi remove npm:context-modeThe hook check passed on 2026-10-26 with Pi 0.73.1. Source: the install guide
OpenCode
Plugin inside the agent. The agent loads Context Mode as a plugin in its own process. Its tools come from that plugin.
Install
opencode plugin add context-modeopencode plugin context-mode --globalCheck
/ctx-doctorUpdate and remove
Update
opencode plugin updateRemove
opencode plugin remove context-mode
context-mode setup --remove --agents opencodeThe hook check passed on 2026-10-26. Install and hooks are checked. The plugin's tool name gets its check in a live OpenCode session next. Source: the install guide
Copilot CLI
npm and setup. Install Context Mode with npm. Then setup adds its hooks to the agent.
Install
npm i -g context-mode
context-mode setup --agents copilot-cliCheck
/ctx-doctorUpdate and remove
Update
context-mode upgradeRemove
context-mode setup --remove --agents copilot-cliThe hook check passed on 2026-10-26 with Copilot CLI 1.0.103. Source: the install guide
Kiro
npm and setup. Install Context Mode with npm. Then setup adds its hooks to the agent.
Install
npm i -g context-mode
context-mode setup --agents kiroCheck
/ctx-doctorUpdate and remove
Update
context-mode upgradeRemove
context-mode setup --remove --agents kiroChecked at hook setup on 2026-10-26. A live run in the host app comes next. Source: the install guide
VS Code
npm and setup. Install Context Mode with npm. Then setup adds its hooks to the agent.
Install
npm i -g context-mode
context-mode setup --agents vscodeCheck
/ctx-doctorUpdate and remove
Update
context-mode upgradeRemove
context-mode setup --remove --agents vscodeChecked at hook setup on 2026-10-26. A live run in the host app comes next. Source: the install guide
ZCode
npm and setup. Install Context Mode with npm. Then setup adds its hooks to the agent.
Install
npm i -g context-mode
context-mode setup --agents zcodeCheck
/ctx-doctorUpdate and remove
Update
context-mode upgradeRemove
context-mode setup --remove --agents zcodeThe hook check passed on 2026-10-26. Source: the install guide
Status comes from the plugin's install test of 2026-10-23: a clean temporary home folder on macOS arm64 with Node 26, where context-mode setup and context-mode doctor ran for each installed agent CLI. For Kiro, VS Code and ZCode, the test checked the config entry and the MCP handshake (install guide, Verified).
Does it work with the agent I use?
You use one coding agent, maybe two. Each one has its own plugin system, its own config files and its own names for events. So before you install a new tool, you want a clear answer for your agent.
The answer: Context Mode Engine works in ten agents. Every agent gets hooks, the MCP server and the skills, through the agent's own install command, or npm and context-mode setup for Copilot CLI, Kiro, VS Code and ZCode.
Three ways in
The hooks reach each agent in one of three ways. The way depends on what the agent offers.
- Plugin package: Claude Code, Gemini CLI and Qwen Code. The hooks ship inside the plugin or extension that the agent installs.
- Hook file: Codex, Copilot CLI, Kiro, VS Code and ZCode. Setup writes one hook file in the agent's own config folder.
- Plugin inside the agent: OpenCode and Pi. The agent loads the Engine as a plugin in its own process, and the Engine adds its tools there. The Engine listens to the agent's events directly.
Your agent's install command puts each part where that agent looks for it.
The ten agents and their events
The Engine listens to four events: session start, prompt, before a tool call and after a tool call. Some agents also send a compaction event. Each agent gives these events its own names:
| Agent | Event names | How it connects | Large tool output |
|---|---|---|---|
| Claude Code | SessionStart, UserPromptSubmit, PreToolUse, PostToolUse | Plugin package: hooks/claude-code.json | Replaces the large result |
| Codex | SessionStart, UserPromptSubmit, PreToolUse, PostToolUse | Hook file: ~/.codex/hooks.json | Routes the call to a ctx tool |
| Gemini CLI | BeforeAgent, BeforeTool, AfterTool, PreCompress | Plugin package: extension hooks/hooks.json | Replaces the large result |
| Qwen Code | SessionStart, UserPromptSubmit, PreToolUse, PostToolUse | Plugin package: extension hooks/qwen.json | Routes the call to a ctx tool |
| Copilot CLI | sessionStart, userPromptSubmitted, preToolUse, postToolUse | Hook file: ~/.copilot/hooks/context-mode.json | Replaces the large result |
| VS Code | SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact | Hook file: ~/.copilot/hooks/context-mode-vscode.json | Routes the call to a ctx tool |
| Kiro | SessionStart, UserPromptSubmit, PreToolUse, PostToolUse | Hook file: ~/.kiro/hooks/context-mode.json | Routes the call to a ctx tool |
| ZCode | SessionStart, UserPromptSubmit, PreToolUse, PostToolUse | Hook file: hooks in ~/.zcode/cli/config.json | Routes the call to a ctx tool |
| Pi | session_start, input, tool_call, tool_result | Plugin inside the agent: pi/index.js | Replaces the large result |
| OpenCode | context, prompt, execute.before, execute.after, compaction, step-finish | Plugin inside the agent: opencode/plugin.js | Routes the call to a ctx tool |
Source: the plugin's install guide and its adapter table, src/adapters/table.ts.
Two ways to keep output small
The last column shows what the Engine does with a large tool output. Both ways give the agent a short reply.
- Replaces the large result (Claude Code, Gemini CLI, Copilot CLI, Pi). The tool call runs. When its output is over 4,096 B, the Engine puts the whole output in the index. The agent gets the best-matching parts plus a
ctx_searchline. - Routes the call to a ctx tool (Codex, Qwen Code, VS Code, Kiro, ZCode, OpenCode). Before a large call runs, the hook names the
ctx_executecall to use. The agent runs that call, and only what the code prints comes back.
On Claude Code, the hook first reads your deny rules from the Claude Code settings files (src/core/policy/user-deny.ts:31). Claude Code is the agent with a deny-rules file for the hook to read. If a hook hits an internal error, it gives the agent's "allow" reply and writes one log line, so your agent keeps working.
What you get
Your agent keeps its own install flow, its own config and its own event names. The Engine fits into them. The hooks stay light: in the 2026-10-31 run, a hook added 7.3 ms to 14.6 ms per tool call, by agent. That is the median of 5 hook runs, minus the median of 5 bare node starts (raw file, source on GitHub).
Next, see the nine ctx tools your agent can call.
Prompts to give your agent
Install Context Mode Engine for this agent. Use the agent's own install command from https://github.com/mksglu/context-mode/blob/16a4bcc5170528db5bcf9924ceaac05e28db8588/docs/install/README.md, then run `context-mode doctor` and show me the result.