Mindket

Context Mode

Newversion 2 · updated
Star33.6k

Overview

mksglu’s free, local plugin that keeps tool output out of your coding agent’s context window. Raw output stays in a sandbox and a SQLite index, and only the answer comes back. The setup notes cover Claude Code, Codex, Gemini CLI, Cursor, Copilot and more.

Context Mode is an open-source project on GitHub in the Developer category, listed by Mindket. It is free. This is version 2, last updated on . Install it from GitHub as its README says. Get Mindket’s setup notes on your Mindket account, as a zip.

At a glance

Runs in
  • Claude Code: a plugin with slash commands, hooks and 11 MCP tools
  • Gemini CLI: the global package and one settings file that holds the MCP entry and the hooks
  • VS Code Copilot and JetBrains Copilot: the global package, an MCP server (a file in VS Code, the Settings UI in JetBrains) and a hooks file
  • GitHub Copilot CLI: the global package and a plugin that registers MCP, hooks and a skill, or an MCP entry and a hooks file by hand
Start with
/plugin marketplace add mksglu/context-mode
/plugin install context-mode@context-mode

Platform

Claude CodeCoding agent
Gemini CLICoding agent
VS CodeCode editor
CopilotAI chat
GitHub CopilotCoding agent
CursorCode editor

And 4 more in Where to use it

About

What it is

Context Mode is a free, local plugin that keeps tool output out of your coding agent’s context window. The README says every MCP tool call dumps raw data into that window, and compaction then makes the agent forget which files it was editing. Context Mode is an MCP server whose tools run code and read files in a sandbox on your machine. Only what the code prints reaches the model. A SQLite index with search lets the agent look up what it saved. Hooks track your edits, tasks and decisions, so a session can pick up after the conversation compacts.

  1. The agent calls a Context Mode tool instead of a raw read
  2. The code runs in a sandbox on your machine
  3. Only what the code prints enters the conversation
  4. Big output is indexed and searched for the part you need
  5. Hooks save your edits and tasks for after compaction

Who it suits

Developers who work in long coding-agent sessions and watch logs, test output, web pages and API responses fill the context window. Skip it if your sessions are short. It adds hooks and a local database to your setup, and on some agents a routing file you copy, and that is a lot for a quick job.

Who uses it, and how
IndustryWho uses itHow they use itExample
Software teamsDevelopers on large codebasesLet the agent run a script over many files and read only the resultA developer asks for a count of functions per file, and the agent prints one line per file instead of reading each file in.
Operations and supportEngineers who read logs and exportsAnalyze a long log or a CSV in the sandbox and search itAn engineer points the agent at an access log and asks which paths fail, and only the matching lines come back.
Web and QADevelopers who use browser toolsIndex a fetched page or a Playwright snapshot and search itA tester has the agent fetch a docs page, index it and search for one pattern, so the page never enters the chat.
Long projectsAnyone who hits compactionResume with files, tasks and decisions rebuilt from the local databaseAfter the conversation compacts, the agent still knows which files it was editing and what you last asked.

Where to use it

The README documents these agents, each with its own install route. Routing is enforced only where an agent has hooks.

  • Claude Code: a plugin with slash commands, hooks and 11 MCP tools
  • Gemini CLI: the global package and one settings file that holds the MCP entry and the hooks
  • VS Code Copilot and JetBrains Copilot: the global package, an MCP server (a file in VS Code, the Settings UI in JetBrains) and a hooks file
  • GitHub Copilot CLI: the global package and a plugin that registers MCP, hooks and a skill, or an MCP entry and a hooks file by hand
  • Cursor: a local plugin folder or a manual install, with hooks and a rules file
  • Codex CLI: a plugin from the maker’s marketplace, with hooks turned on by two feature flags in the config (or MCP and hooks set by hand on builds without plugin_hooks)
  • Kimi Code and Qwen Code: MCP plus hooks, set in each agent’s config
  • OpenCode and KiloCode: a plugin named in the agent’s config file
  • Pi Coding Agent and Oh My Pi: an extension or plugin with hook support
  • OpenClaw: a native gateway plugin for Pi Agent sessions
  • Kiro: hooks plus a steering file
  • Antigravity CLI: a plugin with MCP, a skill and hooks
  • Antigravity IDE and Zed: MCP only, with a routing file you copy by hand

How to set it up

Get it saves a zip of Mindket’s setup notes in your downloads folder, with a page for each agent from the maker’s README and docs. Claude Code installs a plugin. Most other agents take a global package and a config entry.

What you need first
NeedDetail
Node.js22.5 or newer, or Bun. The README says Linux with Node below 22.5 is unsupported
An agentOne from the list above, already installed. Claude Code needs v1.0.33 or newer. Antigravity CLI needs 1.0.7, Copilot Chat 0.32, the JetBrains Copilot plugin 1.5.57, and OpenClaw newer than 2026.1.29
Build toolsOnly on old Linux such as CentOS 7 and 8 and RHEL 8, where the SQLite addon builds from source
An account or keyNone. The README says no account is required
  1. Install Node.js 22.5 or newer, then your agent.
  2. In Claude Code, add the marketplace and install the plugin. Most other agents need the global package first. The README’s Codex plugin, OpenCode, KiloCode, OMP plugin and OpenClaw steps do not list it.
  3. Add the MCP entry and the hooks that your agent’s page lists, and copy the routing file where it says to.
  4. Restart the agent, then check the install.
/plugin marketplace add mksglu/context-mode
/plugin install context-mode@context-mode

Restart Claude Code, then run /context-mode:ctx-doctor. The README says every check should show [x]. For most other agents the first step is this line, and the rest is a config entry and a hooks file.

npm install -g context-mode

The MCP entry has the same shape in Cursor, Kiro, Antigravity, Pi and OMP, each in its own file. VS Code Copilot uses a servers key and Zed uses context_servers.

{
  "mcpServers": {
    "context-mode": {
      "command": "context-mode"
    }
  }
}

How to use it

Work as before. The hooks steer the agent toward the sandbox tools when a command or a file would flood the context, and you can ask for them by name. Two commands show what happened.

ctx stats
ctx doctor

Typing ctx stats shows context savings and call counts. ctx doctor checks runtimes, hooks, FTS5 and versions. In Claude Code the same commands are slash commands, such as /context-mode:ctx-stats. ctx index and ctx search add your own files to the index and query them.

Example

You want the Hacker News front page grouped by domain. The README says that without hooks one unrouted curl or Playwright snapshot can dump 56 KB into context. With the plugin, you send this prompt, which comes from the README’s Try It list:

Fetch the Hacker News front page, extract all posts with titles, scores,
and domains. Group by domain. Then run /context-mode:ctx-stats.

The README lists this prompt as one tool call, and says web pages are processed in the sandbox and never enter the context window. You get the posts grouped by domain, and ctx-stats then reports the savings.

For newcomers and experts

If you are new. A coding agent reads whatever its tools return, and all of it takes room in a window with a limit. When the window fills, the agent compacts the conversation and can lose the thread. Context Mode keeps the bulky part, such as a log, a web page or a test run, on your machine and hands the agent a short answer. It also keeps a local record of your edits and tasks. Start with the Claude Code plugin and run ctx doctor.

For experts. Search runs two strategies on SQLite FTS5, a Porter-stemmed match and a trigram substring match, and merges them with Reciprocal Rank Fusion. Results are reranked by how close the query terms sit, and a typo is corrected by Levenshtein distance before a second search. Fetched pages are cached for 24 hours by default, and a call can override that with ttl or force.

The SQLite backend is picked at runtime: bun:sqlite on Bun, node:sqlite on Linux with Node 22.5 or newer, and better-sqlite3 elsewhere. Hooks feed the session database. Before compaction a snapshot is built in priority tiers, and SessionStart restores it. Searches throttle: from the fourth call results shrink, and from the ninth they are blocked and sent to ctx_batch_execute.

Good to know

Most of it runs on your machine, and a few paths reach out.

  • Your permissions: ctx_execute and ctx_batch_execute run arbitrary code with your user’s file access. The README says the project boundary guards ctx_execute_file only, and tells you to keep host-level sandboxing on
  • Permission rules: the deny and allow rules in Claude Code’s settings (.claude/settings.json or ~/.claude/settings.json) also apply inside the sandbox on every platform, and on Codex CLI once its hooks are configured
  • Data kept: hooks save file edits, tasks, git operations, errors and your prompts in a per-project SQLite database, in your home folder for most agents. platform-support.md puts VS Code and JetBrains Copilot sessions in the project’s .github/context-mode/sessions/. If you do not use --continue, the previous session’s data is deleted at once
  • Network: ctx_fetch_and_index takes only http and https addresses and blocks cloud-metadata addresses. It allows private addresses unless CTX_FETCH_STRICT=1 is set
  • A hosted page: ctx insight opens the maker’s hosted Insight dashboard in your browser. The maker’s site describes Insight as how a team works with coding agents “from Engine events” (Engine is its name for this plugin) and does not say how those events get there. The README says nothing leaves your machine, with no telemetry
  • Upgrades: ctx upgrade pulls the latest version from GitHub and rebuilds
  • Where hooks are missing: routing is a request in a file, not enforcement. Cursor cannot restore a session after compaction, and Codex can block a call but not rewrite it
  • The maker’s other product: its site also offers a hosted gateway. This listing covers only the free plugin in the repository
  • Removal: the README gives no uninstall steps except agy plugin uninstall for the Antigravity CLI. The maker’s site lists a remove command per agent for its own install route, such as context-mode setup --remove --agents claude-code. Mindket’s notes list what to remove by hand
  • License: Elastic License 2.0, which the README calls source-available. You may use, fork, modify and distribute it, but not offer it as a hosted or managed service, get around its license key functionality, or remove its licensing notices. The LICENSE file names Mert Koseoglu, 2026

README and files

README

Context Mode: setup notes

This kit holds setup notes only. Mindket wrote them. Context Mode itself, its plugin files and its npm package come from its maker's repository: https://github.com/mksglu/context-mode

These notes are not made or endorsed by its maker. The GitHub description reads "Free, local plugin that keeps tool output out of your coding agent's context window." The README calls Context Mode "an MCP server". The maker's site is https://contextmode.ai/

License: Elastic License 2.0. The LICENSE file (https://github.com/mksglu/context-mode/blob/main/LICENSE) names "Copyright 2026 Mert Koseoglu" and the npm entry lists "Elastic-2.0". The README says this is source-available, not MIT: "You can use it, fork it, modify it, and distribute it. Two things you can't do: offer it as a hosted/managed service, or remove the licensing notices." Read the LICENSE for the full terms.

What installs

  • Claude Code: a plugin from the maker's marketplace. It registers the hooks and 11 MCP tools. Nothing is written into your project. Source: https://github.com/mksglu/context-mode/blob/main/README.md (Install, Claude Code)
  • Most other agents: the global context-mode npm package, an MCP server entry in the agent's config file, and, where the agent has hooks, a hooks file. Source: README.md (Install) and https://github.com/mksglu/context-mode/blob/main/docs/platform-support.md
  • A routing instructions file (AGENTS.md, GEMINI.md, KIRO.md, QWEN.md, a Cursor rules file, copilot-instructions.md or SYSTEM.md) that you copy by hand where the README says to. It tells the model where data should go.
  • Local SQLite databases. The README says the knowledge base is a per-project SQLite database at ~/.context-mode/content/ and that session data lives in your home directory. Its storage table lists adapter defaults such as ~/.claude/context-mode and ~/.codex/context-mode, and platform-support.md lists a context-mode/sessions/ folder for each agent. CONTEXT_MODE_DIR moves the root: see setup/codex.md.

What you need first

  • Node.js 22.5 or newer, or Bun. The README lists it for every platform except Claude Code (which lists Claude Code v1.0.33+) and OpenClaw (which lists Node.js 22+), and the npm entry's engines field reads >=22.5.0. Linux with Node below 22.5 is unsupported (README, Build Prerequisites).
  • One of the agents in the list below, already installed.
  • A global install on most platforms: npm install -g context-mode. platform-support.md (Prerequisites) says every platform except the Claude Code plugin needs it, but the README's steps for the Codex plugin, OpenCode, KiloCode, the OMP plugin and OpenClaw do not include it, and platform-support.md says the Cursor plugin's hooks run through npx -y with no global install. Follow the page for your agent.
  • Build tools only on older Linux systems such as CentOS 7 and 8, RHEL 8 and Alpine with an old pin. See setup/build-prerequisites.md.

The README's install steps ask for no account or key, and its Privacy section says none is required.

Setup notes for each agent

  • setup/claude-code.md
  • setup/codex.md
  • setup/gemini-cli.md
  • setup/github-copilot.md: VS Code Copilot, JetBrains Copilot and GitHub Copilot CLI
  • setup/cursor.md
  • setup/opencode-and-kilocode.md
  • setup/pi-and-omp.md: Pi Coding Agent and Oh My Pi
  • setup/openclaw.md
  • setup/kimi-code.md
  • setup/qwen-code.md
  • setup/antigravity.md: the Antigravity IDE and the agy command-line tool
  • setup/kiro.md
  • setup/zed.md
  • setup/commands-and-tools.md: the 11 tools, the ctx commands and the README's try-it prompts
  • setup/permissions-and-safety.md: permission rules, the project boundary and URL fetching
  • setup/build-prerequisites.md: old Linux systems, Bun, and the Windows self-heal

The README groups platforms by how much of the setup is automatic: where the agent has hooks, routing is enforced for you, and where it has none, you copy one routing file once. It says without hooks "~60% saved" against "~98% saved" with them, so turn hooks on wherever the agent allows it.

Update or remove

The README's utility commands include an upgrade. Inside an agent session, type this and the model calls the tool:

ctx upgrade

From a terminal, the README gives:

context-mode upgrade

The Copilot CLI note in the README gives npm install -g context-mode@latest for the global package. Claude Code also has /context-mode:ctx-upgrade. Source: README.md (Utility Commands, Install)

ctx purge permanently deletes all indexed content from the knowledge base. Source: README.md (Tools)

The README gives no general uninstall steps. For the Antigravity CLI it gives agy plugin uninstall context-mode. For the Copilot CLI MCP entry, platform-support.md names copilot mcp remove. The maker's site, https://contextmode.ai/, lists a remove command for each agent on its own install route (npm tag @next), such as context-mode setup --remove --agents claude-code; the README does not document it. The notes below are from Mindket, not the maker: to remove Context Mode by hand, undo what the steps for your agent wrote: the global package, the MCP entry, the hooks file, a copied routing file and the data folders above.

Privacy

The README says: "Nothing leaves your machine. No telemetry, no cloud sync, no usage tracking, no account required." Source: README.md, Privacy & Architecture. The GitHub description says "Zero telemetry".

One command goes to a hosted page: ctx insight (/context-mode:ctx-insight in Claude Code) opens the hosted Insight dashboard at https://context-mode.com/insight in your browser, which the README describes as "org analytics for AI-assisted engineering teams". The README says nothing more about what that page reads or stores. The maker's site describes Context Mode Insight as "How a team works with coding agents, from Engine events", where Engine is its name for this free plugin, and does not say how those events reach it.

ctx_fetch_and_index fetches the web addresses you or the agent give it. ctx_upgrade pulls the latest version from GitHub. See setup/permissions-and-safety.md.

Sources

Files
README.md  7 KB
setup/antigravity.md  3 KB
setup/build-prerequisites.md  3 KB
setup/claude-code.md  3 KB
setup/codex.md  5 KB
setup/commands-and-tools.md  4 KB
setup/cursor.md  3 KB
setup/gemini-cli.md  2 KB
setup/github-copilot.md  6 KB
setup/kimi-code.md  3 KB
setup/kiro.md  2 KB
setup/openclaw.md  3 KB
setup/opencode-and-kilocode.md  3 KB
setup/permissions-and-safety.md  5 KB
setup/pi-and-omp.md  3 KB
setup/qwen-code.md  2 KB
setup/zed.md  2 KB

17 files, 58 KB, downloaded as a zip.

What’s new

  • Version 2 · 2026-11-09

    Updated by Mindket to the current version of this kit.

  • Version 1 · 2026-11-03

Compare with similar

Listed GitHub projects in the same category that share the most topics with this one.

ProductStarsActivityLanguageLicenseLast change
Context Mode This page33,650—TypeScript——
UI UX Pro MaxShares kiro · copilot · antigravity146,944ActivePythonMIT
Cheap AgentShares claude-code-hooks · claude-code-skill · claude310ActiveTypeScriptMIT
Agentic Resource RegistryShares kiro · antigravity · codex4,320ActivePythonApache-2.0
GraphifyShares antigravity · codex · claude-code144,528ActivePythonApache-2.0
Agent SkillsShares antigravity · codex · claude-code116,705ActiveJavaScriptMIT
Numbers as Mindket last read them, from 2026-11-06 to 2026-11-13. Activity is read from each project’s last change on GitHub: Active within 30 days, Quiet within 180, Stale after that.

Reviews

No ratings yet

Write a review

No reviews yet.

What people say

Posts and comments that name this project on Hacker News, Bluesky, X, Reddit, Facebook and YouTube, found by a weekly search and on Trendshift. Mindket doesn’t write or check them. Open one to read it where it was posted.

mksgluShow HN: Context Mode – 315 KB of MCP output becomes 5.4 KB in Claude CodeEvery MCP tool call dumps raw data into Claude Code's 200K context window. A Playwright snapshot costs 56 KB, 20 GitHub issues cost 59 KB. After 30 minutes, 40% of your context is gone. I built an MCP server that sits between Claude Code and these outputs. It processes them in sandboxes and only…84 points · 23 repliesGitHub Trending JS/TS🎉 Celebrating! 🎉 (500+ new stars) 📦 mksglu / context-mode ⭐ 28,783 (+946) 🗒 TypeScript Context window optimization for AI coding agents. Sandboxes tool output (98% reduction), persists session memory, and enforces routing across 17 platforms via MCP + hooks.1 like · 2 repliesmksgluShow HN: Context Mode – 315 KB of MCP output becomes 5.4 KB in Claude CodeEvery MCP tool call dumps raw data into Claude Code's 200K context window. A Playwright snapshot costs 56 KB, 20 GitHub issues cost 59 KB. After 30 minutes, 40% of your context is gone. I built an MCP server that sits between Claude Code and these outputs. It processes them in sandboxes and only…1 pointGitHub Trending🎉 Celebrating! 🎉 (500+ new stars) 📦 mksglu / context-mode ⭐ 28,718 (+946) 🗒 TypeScript Context window optimization for AI coding agents. Sandboxes tool output (98% reduction), persists session memory, and enforces routing across 17 platforms via MCP + hooks.1 like · 2 replieskurtextremShow HN: Semble – Code search for agents that uses 98% fewer tokens than grepHave you tried https://github.com/mksglu/context-mode? I prefer it over rtk / headroom (at least in Cursor). The stop hooks seem to work well / prevent the agent from blowing up its context window.GitHub Trending JS/TS🔥 Hot Repo! 🔥 (100+ new stars) 📦 mksglu / context-mode ⭐ 33,221 (+145) 🗒 TypeScript Context window optimization for AI coding agents. Sandboxes tool output (98% reduction), persists session memory, and enforces routing across 17 platforms via MCP + hooks.2 likesesperentContext Mode v1.0.0Since this site seems to have an allergy to information density and usability, here's the GH: https://github.com/mksglu/context-mode Some discussion about this from a couple of months ago: https://news.ycombinator.com/item?id=47193064 Similar tools in this space: RTK:CLI proxy that reduces LLM…@prosperflowio.bsky.socialYour AI agent is drowning in tool output: this MCP server shrinks 315 KB of context to 5.4 KB and keeps sessions alive through compaction. 🔗 github.com/mksglu/context-mode #contextmode #typescript #mcp2 likestemplar_snowAnonymous request-token comparisons from Opus 4.6 and Opus 4.7You mean this? https://github.com/mksglu/context-mode Is it actually good or is this an ad?ネム削減率より気になるのは、最初の検索で見落とした行を後から探せるか。索引を引き直せる設計は好き。 短くして終わり、では困る。ネムは戻って確かめたい。 https://github.com/mksglu/context-mode #AIエージェント #MCP1 likevidarhOpus 4.7 to 4.6 Inflation is ~45%I assume they mean: https://github.com/mksglu/context-mode@k1imber.bsky.social💫 mksglu/context-mode: убирает данные из контекста ИИ-агента Local plugin сохраняет результаты работы инструментов вне окна контекста ИИ-агента, уменьшая объём данных на 98%. Совместим с Claude Code, Codex и другими. • Сохраняет результаты работы инструментов вне окна контекста • Уменьшает объём …

Searched

More from Mindket

See all from Mindket

Nanosaur2-670M

well9472 · Kit

Makes illustrations from text prompts with a small 670M-parameter diffusion model, run through ComfyUI. Built as a low-budget research model for people who wan…

New

Reads handwritten Arabic text from images and returns it as text. A fine-tuned PaddleOCR-VL model for people digitizing Arabic handwriting.

New

Makes video clips from a text prompt or an image plus text, at up to 720P and 24 frames per second, in the Diffusers format for a single consumer GPU.

New

Similar projects

See all in Developer

UI UX Pro Max

nextlevelbuilder · Skill

Generates tailored design systems, including color palettes, typography pairings, and layout patterns, based on specific project requirements and industry stan…

New147k

Agentic Resource Registry

AgenticResourceRegistry · Kit

Keeps a team's coding agent skills, hooks, prompts and agent files in one self-hosted registry, with review of new entries and usage insight. Suits engineering…

New4320

Cheap Agent

muaaz9329 · Kit

Moves routine coding in Claude Code or Codex to a low-cost model that must prove its work with a test, so your main model's usage lasts longer.

New310