/ Verzeichnis / Playground / Context Mode
● Community mksglu ⚡ Sofort

Context Mode

von mksglu · mksglu/context-mode

Sandbox tool output and persist session state in SQLite — 98% less token waste, no more compaction amnesia.

Context Mode solves the "LLM forgot what it was doing" problem two ways. First, sandbox tools capture raw data out of the context window (playwright snapshot: 56KB → indexed, agent searches what it needs). Second, a per-session SQLite event log survives context compaction — the model picks up exactly where it was. Ships as plugin + MCP for 12 platforms.

Warum nutzen

Hauptfunktionen

Live-Demo

In der Praxis

context-mode-mcp.replay ▶ bereit
0/0

Installieren

Wählen Sie Ihren Client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "context-mode-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "context-mode"
      ]
    }
  }
}

Öffne Claude Desktop → Settings → Developer → Edit Config. Nach dem Speichern neu starten.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "context-mode-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "context-mode"
      ]
    }
  }
}

Cursor nutzt das gleiche mcpServers-Schema wie Claude Desktop. Projektkonfiguration schlägt die globale.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "context-mode-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "context-mode"
      ]
    }
  }
}

Klicken Sie auf das MCP-Servers-Symbol in der Cline-Seitenleiste, dann "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "context-mode-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "context-mode"
      ]
    }
  }
}

Gleiche Struktur wie Claude Desktop. Windsurf neu starten zum Übernehmen.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "context-mode-mcp",
      "command": "npx",
      "args": [
        "-y",
        "context-mode"
      ]
    }
  ]
}

Continue nutzt ein Array von Serverobjekten statt einer Map.

~/.config/zed/settings.json
{
  "context_servers": {
    "context-mode-mcp": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "context-mode"
        ]
      }
    }
  }
}

In context_servers hinzufügen. Zed lädt beim Speichern neu.

claude mcp add context-mode-mcp -- npx -y context-mode

Einzeiler. Prüfen mit claude mcp list. Entfernen mit claude mcp remove.

Anwendungsfälle

Praxisnahe Nutzung: Context Mode

Stop wasting context on raw tool output

👤 Heavy Claude Code users who hit compaction mid-session ⏱ ~15 min intermediate

Wann einsetzen: You feel your agent "forget" after 30 minutes and burn $$ on re-reads.

Voraussetzungen
  • Claude Code v1.0.33+brew upgrade claude-code or npm update -g @anthropic-ai/claude-code
Ablauf
  1. Install
    /plugin marketplace add mksglu/context-mode
    /plugin install context-mode@context-mode✓ Kopiert
    → Plugin registers hooks + 6 sandbox tools
  2. Verify
    /context-mode:ctx-doctor✓ Kopiert
    → All checks [x]
  3. Use normally
    Now do a big task that would normally blow context — e.g. analyze all .log files under /var/log✓ Kopiert
    → ctx_execute used instead of raw Read; output indexed not dumped
  4. Check savings
    /context-mode:ctx-stats✓ Kopiert
    → Per-tool reduction ratio reported

Ergebnis: Same task, 10x longer before compaction, and the agent remembers.

Fallstricke
  • Other MCPs bypass the routing — Pass their tool calls through ctx_batch_execute for consistent accounting
Kombinieren mit: serena

Resume a long task seamlessly after the model compacts

👤 Devs on multi-hour agent sessions ⏱ ~5 min beginner

Wann einsetzen: Your task is too big to fit in one context window.

Ablauf
  1. Start with --continue
    [CLI flag] claude --continue✓ Kopiert
    → Prior session's SQLite loaded
  2. Observe
    What did I last ask you about? What tasks are in progress?✓ Kopiert
    → Accurate recap from FTS5 index, not hallucinated

Ergebnis: A genuinely resumable workflow.

Fallstricke
  • Forgetting --continue starts fresh — Persistence requires --continue; absence means deliberate fresh start

Kombinationen

Mit anderen MCPs für 10-fache Wirkung

context-mode-mcp + serena

Serena for semantic code nav, context-mode for keeping its output out of context

Use serena for the lookup, ctx_execute to post-process the results.✓ Kopiert
context-mode-mcp + playwright

Page snapshot output stays sandboxed

Snapshot the page via playwright, let context-mode hold it — search it instead of dumping.✓ Kopiert

Werkzeuge

Was dieses MCP bereitstellt

WerkzeugEingabenWann aufrufenKosten
ctx_execute code: str (js/python) Run a script to process data; output only what's needed free
ctx_batch_execute ops: [{tool, args}] Wrap multiple tool calls through the sandbox free
ctx_index content: str, tags?: [] Stash data for later retrieval free
ctx_search query: str Retrieve from session index free
ctx_fetch_and_index url: str Pull a URL, keep it out of context but searchable free
ctx_stats none See how much context was saved free

Kosten & Limits

Was der Betrieb kostet

API-Kontingent
Local
Tokens pro Aufruf
Dramatic reduction — quoted 98% on real sessions
Kosten in €
Free (ELv2 license)
Tipp
The bigger the session, the bigger the win — use on long tasks

Sicherheit

Rechte, Secrets, Reichweite

Credential-Speicherung: Session SQLite in ~/.context-mode/
Datenabfluss: None

Fehlerbehebung

Häufige Fehler und Lösungen

ctx-doctor shows missing hooks

Restart Claude Code fully after install; hooks register at startup

Prüfen: Re-run /context-mode:ctx-doctor
Sandbox won't execute code

Node/Python runtime missing. Doctor tells you which. Install with brew/asdf.

Search returns nothing

Verify FTS5 built: sqlite3 ~/.context-mode/session.db "SELECT name FROM sqlite_master". Reinstall if broken.

Alternativen

Context Mode vs. andere

AlternativeWann stattdessenKompromiss
Raw Claude Code (no plugin)Short sessions that never hit compactionNo context saving
claude-memYou want the memory layer without the sandbox-tool paradigmDifferent tradeoff — memory only, no tool output sandbox

Mehr

Ressourcen

📖 Offizielle README auf GitHub lesen

🐙 Offene Issues ansehen

🔍 Alle 400+ MCP-Server und Skills durchsuchen