Governor for Claude Code
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Keep long AI coding sessions sharp under quota pressure.
Now also works with Cursor · Windsurf · Cline · Codex CLI · Gemini CLI · Hermes · DeepSeek
Quick Start ·
Multi-Agent ·
Why Governor ·
Benchmarks ·
Commands ·
Install
Governor started as a Claude Code plugin for context hygiene, tool-output
filtering, memory compression, telemetry, and drift guardrails.
**As of v0.2.4, Governor's core behavior — content-aware tool-output filtering
and context hygiene — works with any AI coding agent** via prompt-based skills.
No hooks or MCP required.
> Keep long coding sessions efficient without making the model dumber.
The Claude Code command namespace is /governor:*.
Quick Start
Claude Code (full plugin)
Restart Claude Code. Filtering, compact mode, and telemetry are already running —
there is nothing to turn on. When you want to look under the hood:
Other Agents (prompt-based skill)
This copies a Governor rules file into your project for each agent. The rules
teach the agent to self-filter noisy tool output, preserve unique data, and
maintain context hygiene — automatically, every session.
Multi-Agent Support
Governor works at two levels:
| Agent | Integration | What You Get |
|---|---|---|
| **Claude Code** | Plugin with hooks | Full: auto-filtering, telemetry, compression, drift guard, /governor:* commands |
| **Cursor** | .cursor/rules/governor.mdc | Self-filtering, compact mode, context hygiene |
| **Windsurf** | .windsurf/rules/governor.md | Self-filtering, compact mode, context hygiene |
| **Cline** | .clinerules/governor.md | Self-filtering, compact mode, context hygiene |
| **Codex CLI** | AGENTS.md | Self-filtering, compact mode, context hygiene |
| **Gemini CLI** | GEMINI.md | Self-filtering, compact mode, context hygiene |
| **Hermes** 🆕 | .hermes.md | Self-filtering, compact mode, context hygiene |
| **DeepSeek** 🆕 | .dsh/rules/governor.md | Self-filtering, compact mode, context hygiene |
**How it works for non-Claude agents:** Governor's rules file teaches the agent
to apply content-aware filtering itself. When tool output has >40% duplicate
lines (test failures, log spam, build warnings), the agent compresses it —
keeping the first error, file:line, and exit code. When output is unique (API
responses, JSON, code), it passes through intact. No external dependencies.
Claude Code gets the deepest integration because it supports plugin hooks.
Other agents get the core behavior via prompt engineering.
Why Governor
Long coding sessions usually do not fail because the AI writes one extra
paragraph.
They fail because context gets polluted:
- verbose test, build, and MCP output floods the transcript
- bloated recurring files like CLAUDE.md, notes, and rules tax every session
- broad prompts trigger repo-wide scans and retries
- scope drift compounds over time
Governor is designed for that failure mode — in Claude Code and beyond.
What It Does
| Capability | What it does | Where it works |
|---|---|---|
| Tool-output filtering | Compacts noisy output when content is repetitive; preserves unique data | All 8 agents |
| Compact mode | Keeps responses concise and professional | All 8 agents |
| Context hygiene | Avoids re-reads, broad scans, and context waste | All 8 agents |
| Memory compression | Rewrites bloated prompt files into denser, safer forms | Claude Code |
| Telemetry | Reports measured savings, failures, compactions, and waste heat | Claude Code |
| Drift guardrails | Adds planning and scope checks for broad tasks | Claude Code |
Why It Feels Different
Most token-saving tools optimize one layer:
- shorter replies
- shorter command output
Governor is built for the broader session problem:
- tool spam
- recurring context tax
- MCP-heavy workflows
- long-task drift
- wasted retries
That is why Governor's benchmark story starts with valid-context loss and
decision preservation, not only token counts.
Benchmarks
V2 Sonnet Fixture Run
Recent measured Sonnet run with Claude decision grading: