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 node start: 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-mode

Check

/ctx-doctor
Update and remove

Update

claude plugin update context-mode@context-mode

Remove

context-mode setup --remove --agents claude-code

The 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-mode

Next, trust the hooks

npm i -g context-mode
context-mode setup --agents codex

Check

/ctx-doctor
Update and remove

Update

codex plugin marketplace upgrade context-mode

Remove

context-mode setup --remove --agents codex

The 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-mode

Check

/ctx-doctor
Update and remove

Update

gemini extensions update context-mode

Remove

context-mode setup --remove --agents gemini
gemini extensions uninstall context-mode

The 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-mode

Check

/ctx-doctor
Update and remove

Update

qwen extensions update context-mode

Remove

context-mode setup --remove --agents qwen
qwen extensions uninstall context-mode

The 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-mode

Check

pi list
Update and remove

Update

pi update --extensions

Remove

pi remove npm:context-mode

The 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-mode
opencode plugin context-mode --global

Check

/ctx-doctor
Update and remove

Update

opencode plugin update

Remove

opencode plugin remove context-mode
context-mode setup --remove --agents opencode

The 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-cli

Check

/ctx-doctor
Update and remove

Update

context-mode upgrade

Remove

context-mode setup --remove --agents copilot-cli

The 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 kiro

Check

/ctx-doctor
Update and remove

Update

context-mode upgrade

Remove

context-mode setup --remove --agents kiro

Checked 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 vscode

Check

/ctx-doctor
Update and remove

Update

context-mode upgrade

Remove

context-mode setup --remove --agents vscode

Checked 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 zcode

Check

/ctx-doctor
Update and remove

Update

context-mode upgrade

Remove

context-mode setup --remove --agents zcode

The 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.

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:

AgentEvent namesHow it connectsLarge tool output
Claude CodeSessionStart, UserPromptSubmit, PreToolUse, PostToolUsePlugin package: hooks/claude-code.jsonReplaces the large result
CodexSessionStart, UserPromptSubmit, PreToolUse, PostToolUseHook file: ~/.codex/hooks.jsonRoutes the call to a ctx tool
Gemini CLIBeforeAgent, BeforeTool, AfterTool, PreCompressPlugin package: extension hooks/hooks.jsonReplaces the large result
Qwen CodeSessionStart, UserPromptSubmit, PreToolUse, PostToolUsePlugin package: extension hooks/qwen.jsonRoutes the call to a ctx tool
Copilot CLIsessionStart, userPromptSubmitted, preToolUse, postToolUseHook file: ~/.copilot/hooks/context-mode.jsonReplaces the large result
VS CodeSessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompactHook file: ~/.copilot/hooks/context-mode-vscode.jsonRoutes the call to a ctx tool
KiroSessionStart, UserPromptSubmit, PreToolUse, PostToolUseHook file: ~/.kiro/hooks/context-mode.jsonRoutes the call to a ctx tool
ZCodeSessionStart, UserPromptSubmit, PreToolUse, PostToolUseHook file: hooks in ~/.zcode/cli/config.jsonRoutes the call to a ctx tool
Pisession_start, input, tool_call, tool_resultPlugin inside the agent: pi/index.jsReplaces the large result
OpenCodecontext, prompt, execute.before, execute.after, compaction, step-finishPlugin inside the agent: opencode/plugin.jsRoutes 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.

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

Prompt
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.

Get started free

Context Mode Gateway: your coding agent costs less and remembers your project. Context Mode Engine installs from your terminal.

After you sign in, the console gives you one command to connect your coding agent.

Read the docs