[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-79931":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":13,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":35,"readmeContent":36,"aiSummary":37,"trendingCount":15,"starSnapshotCount":15,"syncStatus":14,"lastSyncTime":38,"discoverSource":39},79931,"governor","0xhimanshu\u002Fgovernor","0xhimanshu","Claude Code usage governor: compact professional output, context slimming, tool-output filtering, telemetry, and drift guardrails.","https:\u002F\u002Fgithub.com\u002F0xhimanshu\u002Fgovernor",null,"Python",96,1,2,0,5,11,3,0.9,"MIT License",false,"main",[24,25,26,27,28,29,30,31,32,33,34],"ai-tools","claude-ai","claude-code","claude-code-plugin","claude-skills","cli","context-window","developer-tools","llm","prompt-engineering","token-optimization","2026-06-12 02:03:55","\u003Cp align=\"center\">\n  \u003Cimg src=\"assets\u002Fgovernor-icon.png\" width=\"128\" alt=\"Governor icon\" \u002F>\n\u003C\u002Fp>\n\n\u003Ch1 align=\"center\">Governor for Claude Code\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>Keep long Claude Code sessions sharp under quota pressure.\u003C\u002Fstrong>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  Reduce noisy tool output, recurring context bloat, and drift without throwing away the clue.\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg alt=\"Claude Code\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FClaude%20Code-plugin-6D4AFF\" \u002F>\n  \u003Cimg alt=\"Version\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fversion-0.2.2-black\" \u002F>\n  \u003Cimg alt=\"License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-0F766E\" \u002F>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"#quick-start\">Quick Start\u003C\u002Fa> ·\n  \u003Ca href=\"#why-governor\">Why Governor\u003C\u002Fa> ·\n  \u003Ca href=\"#benchmarks\">Benchmarks\u003C\u002Fa> ·\n  \u003Ca href=\"#commands\">Commands\u003C\u002Fa> ·\n  \u003Ca href=\"#install\">Install\u003C\u002Fa>\n\u003C\u002Fp>\n\nGovernor is a Claude Code plugin for context hygiene, tool-output filtering,\nmemory compression, telemetry, and drift guardrails.\n\nIt is built for the harder problem than \"make the model talk less\":\n\n> keep long Claude Code sessions efficient without making the model dumber.\n\nThe installed Claude Code command namespace is still `\u002Fgovernor:*`.\n\n## Quick Start\n\n```bash\nbash install.sh --force\n```\n\nRestart Claude Code, then run:\n\n```text\n\u002Fgovernor:status\n\u002Fgovernor:audit\n\u002Fgovernor:compress CLAUDE.md\n```\n\nGovernor auto-starts in compact professional mode when the plugin is loaded.\nUse `\u002Fgovernor:off` to disable response compression and `\u002Fgovernor:on` to\nre-enable it.\n\n## Why Governor\n\nLong Claude Code sessions usually do not fail because Claude writes one extra\nparagraph.\n\nThey fail because context gets polluted:\n\n- verbose test, build, and MCP output floods the transcript\n- bloated recurring files like `CLAUDE.md`, notes, and rules tax every session\n- broad prompts trigger repo-wide scans and retries\n- scope drift compounds over time\n\nGovernor is designed for that failure mode.\n\n## What It Does\n\n| Capability | What it does | Why it matters |\n|---|---|---|\n| Tool-output filtering | Compacts noisy Bash, search, web, task, and MCP-style output when confidence is high | Keeps logs from dominating context |\n| Memory compression | Rewrites bloated recurring prompt files into denser, safer forms | Lowers recurring prompt tax |\n| Compact mode | Keeps Claude Code responses concise and professional | Reduces avoidable output bloat |\n| Telemetry | Reports measured savings, failures, compactions, and waste heat | Lets you see whether Governor is helping |\n| Drift guardrails | Adds planning and scope checks for broad tasks | Helps long sessions stay on track |\n\n## Why It Feels Different\n\nMost token-saving tools optimize one layer:\n\n- shorter replies\n- shorter command output\n\nGovernor is built for the broader session problem:\n\n- tool spam\n- recurring context tax\n- MCP-heavy workflows\n- long-task drift\n- wasted retries\n\nThat is why Governor's benchmark story starts with valid-context loss and\ndecision preservation, not only token counts.\n\n## Benchmarks\n\n### V2 Sonnet Fixture Run\n\nRecent measured Sonnet run with Claude decision grading:\n\n| Condition | Avg token savings | Avg VCLR | Decision preserved | Wrong decision |\n|---|---:|---:|---:|---:|\n| Caveman | 69.1% | 0.14 | 87.5% | 12.5% |\n| Governor | 45.5% | 0.00 | 100.0% | 0.0% |\n\nWhat this means:\n\n- Caveman still wins on raw compression.\n- Governor preserved more valid context in this run.\n- Governor won on decision quality in the latest Sonnet pass.\n\nArtifacts:\n\n- `benchmarks\u002Fv2-fixture-results.md`\n- `benchmarks\u002Fv2-fixture-results.json`\n- `benchmarks\u002Fsonnet-v2-report.md`\n\n### Early Multi-Turn Pilot\n\nSame machine, fresh Claude CLI Sonnet sessions, same multi-turn task, same\nstarting repo snapshot.\n\n| Condition | Output Tokens | Cost | Turns | Intent Preserved | Obvious Regression Found |\n|---|---:|---:|---:|---|---|\n| Control | 10,997 | $0.5169 | 21 | Yes | No |\n| Governor | 10,113 | $0.4933 | 22 | Yes | No |\n| Delta | -8.0% | -4.6% | +4.8% | Tie | Tie |\n\nThis was a narrow pilot, not a universal claim. It matters because Governor\nkept the implementation contract intact while shaving cost on a real multi-turn\ncoding task.\n\n### Tool Filter Signal Checks\n\nStructured\u002Flocal cases focused on the criticism that compaction can miss the\nreal clue.\n\n| Case | Filtered? | Blocked | Signal Preserved |\n|---|---:|---:|---:|\n| Noisy pytest failure buried in long log | Yes | 64.0% | Yes |\n| Burp-style MCP payload with large history + one critical finding | Yes | 90.9% | Yes |\n| Large `Read` output containing source code | No | 0.0% | Yes |\n\n## Compared To\n\n### RTK\n\nRTK is excellent at shrinking shell output.\n\nGovernor is aimed at the wider Claude Code session:\n\n- tool-output filtering\n- recurring prompt-file hygiene\n- MCP and structured payload handling\n- drift-sensitive long sessions\n- measured savings and waste heat inside Claude Code\n\n### Caveman\n\nCaveman is excellent when the main goal is making Claude talk in fewer tokens.\n\nGovernor is built for the broader session problem:\n\n- less tool spam\n- less recurring context tax\n- less drift\n- more decision preservation under pressure\n\nShort version:\n\n> RTK compresses commands. Caveman compresses style. Governor protects the session.\n\n## Best Fit\n\nGovernor is best for:\n\n- Claude Code Max users who hit long-session limits\n- MCP-heavy workflows\n- Burp \u002F Playwright \u002F structured tool output\n- prompt-heavy repos with large rules or command docs\n- teams who care about drift, reproducibility, and auditability\n\nGovernor is less useful for:\n\n- tiny chats\n- already-clean prompt files\n- users who only want meme-simple answer shortening\n\n## Features\n\n- **Always-on compact mode:** `SessionStart` and `UserPromptSubmit` hooks keep\n  responses concise in every Claude Code chat.\n- **Professional memory compression:** `\u002Fgovernor:compress CLAUDE.md` rewrites\n  verbose memory files into dense prose.\n- **Protected-span safety:** code blocks, inline code, paths, URLs, commands,\n  env vars, versions, headings, tables, and warnings are preserved.\n- **Quality guard:** low-savings compression is rejected and the backup is\n  restored instead of pretending success.\n- **Tool-output filtering:** large Bash, search, web, task, and MCP-style\n  outputs are compacted when confidence is high; risky source reads are left\n  alone.\n- **Telemetry ledger:** `\u002Fgovernor:status` reports blocked tokens,\n  failures, compactions, and statusline snapshots when available.\n- **Prompt guidance:** vague broad prompts get soft, non-blocking suggestions.\n- **Plan and drift guard:** explicit contracts for broad builds, then scope\n  checks with `\u002Fgovernor:guard`.\n- **Portable rule snippets:** compact-mode rules for Codex, Gemini, Cursor,\n  Windsurf, and Cline.\n\n## Commands\n\n| Command | Purpose |\n|---|---|\n| `\u002Fgovernor:on` | Enable compact professional response mode |\n| `\u002Fgovernor:off` | Disable response compression |\n| `\u002Fgovernor:status` | Show usage dashboard and waste heat map |\n| `\u002Fgovernor:audit` | Find bloated memory\u002Frule files and context waste |\n| `\u002Fgovernor:compress CLAUDE.md` | Compress memory files with protected-span validation |\n| `\u002Fgovernor:full` | Let the next diagnostic command return full output |\n| `\u002Fgovernor:plan \"task\"` | Produce an implementation contract before broad work |\n| `\u002Fgovernor:guard` | Check current changes against the approved plan |\n| `\u002Fgovernor:benchmark` | Run or explain the V2 benchmark suite; use `refresh-caveman` to refresh captured comparators |\n| `\u002Fgovernor:install-rules` | Copy compact-mode rules into other-agent projects |\n\n## Install\n\n### Local Development\n\n```bash\nclaude --plugin-dir .\n```\n\n### One-Line Local Install\n\n```bash\nbash install.sh --force\n```\n\n### Install From This Repository\n\n```bash\ngh repo clone 0xhimanshu\u002Fgovernor\ncd governor\nbash install.sh --force\n```\n\n### Install Rule Files For Other Agents\n\n```bash\nbash install.sh --project \u002Fpath\u002Fto\u002Fproject --agents all\n```\n\nSupported rule snippets:\n\n| Agent | Rule File |\n|---|---|\n| Codex | `AGENTS.md` |\n| Gemini CLI | `GEMINI.md` |\n| Cursor | `.cursor\u002Frules\u002Fgovernor.mdc` |\n| Windsurf | `.windsurf\u002Frules\u002Fgovernor.md` |\n| Cline | `.clinerules\u002Fgovernor.md` |\n\nOther agents get compact professional behavior only. Claude Code is the V1\ntarget for hooks, telemetry, statusline, and Bash output filtering.\n\n## How Compression Works\n\n`\u002Fgovernor:compress` is automatic from the user's point of view:\n\n1. Create a timestamped backup.\n2. Mark protected spans.\n3. Rewrite the file with dense professional prose.\n4. Strip markers.\n5. Validate protected content.\n6. Attempt protected-span recovery if needed.\n7. Reject low-savings output and restore the backup if the quality guard fails.\n8. Report exact before\u002Fafter token estimates and backup location.\n\nCompression levels:\n\n| Level | Target |\n|---|---|\n| `light` | Remove filler and repetition; preserve most rationale |\n| `medium` | Collapse narrative into decision bullets |\n| `aggressive` | Keep only rules, facts, commands, risks, and decisions |\n\nSet `GOVERNOR_ALLOW_LOW_SAVINGS=1` only if you intentionally want to keep a\nlow-savings compression result.\n\n## Telemetry\n\nGovernor stores a local JSONL ledger. The status command automatically discovers\nand merges ledger files from all known locations, including the plugin data\ndirectory set by Claude Code (`CLAUDE_PLUGIN_DATA`) and the manual fallback\npath. Deduplication uses resolved paths so symlinks and non-canonical paths\ndo not cause double-counting.\n\nIt tracks:\n\n- tool-output tokens blocked\n- full-output overrides\n- prompt-risk suggestions\n- Bash failures\n- compactions\n- statusline snapshots\n- memory compression savings\n\nPrompt caching can reduce usage and cost but does not necessarily reduce\ncontext window occupancy. Governor reports those separately when Claude Code\nexposes the data.\n\n## Benchmarking\n\nUse `benchmarks\u002F` for measured comparisons.\n\nRecommended conditions:\n\n- `control`: no token\u002Fstyle plugin\n- `caveman`: Caveman enabled as normal\n- `governor-hooks`: Governor hooks enabled, memory unchanged\n- `governor-compressed`: Governor after `\u002Fgovernor:compress CLAUDE.md`\n- `governor-strict`: optional strict-mode run for broad tasks\n\nPrimary metrics:\n\n- valid-context loss rate\n- decision preservation\n- wrong-decision rate\n- five-hour usage delta\n- assistant output tokens\n- tool-output tokens blocked\n- wall time\n- task success\n\nRun:\n\n```bash\npython3 scripts\u002Frun_benchmark.py \\\n  --write-json benchmarks\u002Fv2-fixture-results.json \\\n  --write-md benchmarks\u002Fv2-fixture-results.md\n```\n\nRefresh Caveman captures first when Claude CLI auth is available:\n\n```bash\npython3 scripts\u002Fcapture_fixture_conditions.py \\\n  --condition caveman \\\n  --model sonnet \\\n  --write-summary benchmarks\u002Fcaptured\u002Fcaveman\u002Flatest-summary.json\n```\n\nRefresh reference-style Governor captures too:\n\n```bash\npython3 scripts\u002Fcapture_fixture_conditions.py \\\n  --condition governor \\\n  --model sonnet \\\n  --write-summary benchmarks\u002Fcaptured\u002Fgovernor\u002Flatest-summary.json\n```\n\n## Design Principles\n\n- Helpful by default, strict only when invoked.\n- Professional dense prose, never novelty dialect.\n- Measure exact savings where possible.\n- Treat 1M context as a ceiling, not a target.\n- Keep broad planning and drift checks opt-in.\n- Restore backups instead of accepting unsafe or low-value compression.\n\n## Gotchas\n\n- If hooks do not fire, `\u002Fgovernor:status` will show little or no telemetry.\n- Existing custom statuslines are not overwritten by the installer.\n- Compression sends file content through the active Claude Code\u002Fmodel workflow.\n  Do not compress secrets or sensitive private files.\n- Use `\u002Fgovernor:full` before a diagnostic command when you need unfiltered\n  logs.\n- For installed-but-inactive behavior, launch Claude Code with\n  `GOVERNOR_DEFAULT_MODE=off`.\n\n## Contributing\n\nContributions are welcome when they make Governor more useful, safer, or easier\nto trust. Please read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull\nrequest, especially for compression, hook, telemetry, or benchmark changes.\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n","Governor 是一个针对 Claude Code 的插件，旨在通过优化上下文、过滤工具输出、压缩内存、提供遥测数据和防止范围漂移来保持长时间会话的高效性。其核心功能包括自动过滤冗长的工具输出、压缩重复出现的提示文件以减少上下文负担、以及在会话中启用紧凑的专业模式来确保响应简洁。此外，Governor 还提供了详细的性能指标报告，帮助用户了解优化效果。此项目特别适合需要处理大量代码或文档，并且希望在不牺牲模型智能的前提下提高工作效率的开发者使用。基于 Python 开发，采用 MIT 许可证开放源码。","2026-06-11 03:58:34","CREATED_QUERY"]