# context-mode

context-mode routes heavy tool outputs and web pages into an MCP sandbox so raw data does not clutter the agent context window.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 34370 repo stars
- Author: Mert Koseoğlu
- License: Elastic-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/mksglu/context-mode/tree/HEAD/configs/cursor/context-mode.mdc
- Updated: 2026-10-24
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/mert-koseoglu-context-mode

## What it does

The rule instructs the assistant to avoid dumping large text streams or terminal logs directly into the chat. When filtering or parsing data, the model runs JavaScript scripts through `ctx_execute` with Node.js standard libraries. Only the final printed lines reach the session.

Network lookups and web pages pass through `ctx_fetch_and_index` into an FTS5 index. For external API calls, parallel execution stays between 4 and 8 workers, while GitHub CLI commands are capped at 4. The rule strictly forbids using execution sandboxes to alter files; source code changes must happen through native file-writing tools.

Past decisions and constraints persist across session compaction. Upon reconnecting, the agent runs `ctx_search` against the timeline instead of asking the developer what was done before.

## Install

### Cursor (native platform)

**Manually: put the files in place**
- File: `.cursor/rules/context-mode.mdc` — Frontmatter: description, globs, alwaysApply

### Claude Code

1. **Plugin marketplace**
In the agent chat (not a shell):
```text
/plugin marketplace add mksglu/context-mode
```
In the agent chat (not a shell):
```text
/plugin install context-mode@context-mode
```

2. **Manually: put the files in place**
- File: `.claude/rules/context-mode.md` — The paths frontmatter field limits the files: move globs from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/context-mode.instructions.md` — The applyTo field sets which files it applies to: move globs from the source into applyTo

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/context-mode.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/context-mode.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/mksglu/context-mode/tree/HEAD/configs/cursor/context-mode.mdc

## When to use it
- keep raw terminal logs out of the model context
- filter large files using sandbox scripts
- retrieve previous decisions from an indexed timeline
- throttle concurrent network calls and GitHub API requests

## Example prompts
- Inspect the test log with a sandbox script and return only failing assertions.
- Run `ctx_search` to check our previous decisions on database schema.
- Fetch the documentation page with `ctx_fetch_and_index` and extract auth headers.

## Similar
- [context-surfing](https://affpapa.org/en/nevibecode/skills/context-surfing.md) — skill · 272 installs
- [context-optimizer](https://affpapa.org/en/nevibecode/commands/context-optimizer.md) — command · ★ 2966 repo stars
- [context-engineer](https://affpapa.org/en/nevibecode/agents/context-engineer.md) — subagent · ★ 2966 repo stars
- [context-budget](https://affpapa.org/en/nevibecode/skills/context-budget.md) — skill · 7000 installs
- [context-compression](https://affpapa.org/en/nevibecode/skills/muratcankoylan-context-compression.md) — skill · 669 installs
- [codex-1m-context-window-setup](https://affpapa.org/en/nevibecode/skills/codex-1m-context-window-setup.md) — skill · 211 installs

## Other versions with the same name
- [context-mode · mksglu](https://affpapa.org/en/nevibecode/rules/context-mode.md) — ★ 34370 repo stars

From the same set: [mksglu/context-mode](https://affpapa.org/en/nevibecode/by/mksglu/context-mode.md) — 14 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
