Context Guard
Measures where your context window goes and warns before you run out.
Status, in the repository's words: Published
What it is
A plugin that watches your context window during a session and escalates through four warning tiers.
Its MCP server breaks current context usage into compartments, such as the system prompt.
Measurement is its main job; the README notes that Claude Code now handles the warning case natively.
The numbers are meant as a relative instrument, for seeing what changed after you adjust your setup.
What it does today
- The context_budget tool returns current context-window usage with a 5-compartment breakdown.
- Measures prompt-cache behaviour: the cache hit ratio and how often the cache was re-primed mid-session.
- Warns the model in 4 tiers before auto-compaction.
- Warnings are advisory: every tier tells the model to keep working into compaction.
- Nothing in the plugin refuses a tool call.
- Warnings are injected into the model's context, and the tier can fall again when usage drops.
- The compaction threshold is averaged from recent auto-compaction samples.
- Tracks the burn rate over the last 3 readings and can bump the warning tier by one when context is being used quickly.
- Supports recovery around compaction: it verifies that state was saved and resumes afterwards.
- The audit measures what every session loads before the first prompt, including CLAUDE.md and the skill and agent listings.
What it ships
- An MCP server with a single tool, context_budget.
- Hooks for the SessionStart, PreToolUse and PreCompact events.
- A status-line script that acts as the sensor: it computes the tier, velocity and dynamic threshold.
- An optional static audit, run with the /context-guard:audit command.
- Two standalone Python helpers, velocity.py and thresholds.py, which are not wired into the hooks.
- Bundled test suites; the expected last line of a run is 9/9 test files passed.
What it needs
- bash, jq and Python 3.10 or newer (standard library only).
- Claude Code, which hosts the plugin's hooks and MCP server.
- A plugin cannot set your status line, so wiring the sensor is a one-time manual edit of your settings.
- There is no build step, package registry artifact or Docker image.
Install
Copied from the repository's README. This site has not run these commands.
/plugin marketplace add BulletproofSoftwareAI/bulletproof-context-guard /plugin install context-guard@context-guard
Limits and known issues, as the repository lists them
As listed on branch main of BulletproofSoftwareAI/bulletproof-context-guard on 2026-11-30, commit 27526f8: newer than the version described above.
- No tier warnings fire unless the status-line sensor is wired.
- The status-line command path has to be updated after a plugin update.
- Per-category numbers are estimates, because Claude Code does not expose per-category token counts.
- Known gap: tool definitions are not a separate compartment in the breakdown.
- The audit's probe weighs MCP tool names only; full input schemas are not measured.
- Threshold edits live in plugin.json inside the installed plugin, so a plugin update replaces them.
Documents in the repository
Where each statement on this page comes from
Read from BulletproofSoftwareAI/bulletproof-context-guard, branch main, commit fa35b39; the limits and known issues from BulletproofSoftwareAI/bulletproof-context-guard, branch main, commit 27526f8, read on 2026-11-30. File and line for each statement:
- Measures where your context window goes and warns before you run out.
README.md:3 - Published
CHANGELOG.md:4 - 3.8.3
.claude-plugin/plugin.json:3 - 2026-11-14
CHANGELOG.md:7 - Apache-2.0
README.md:113 - A plugin that watches your context window during a session and escalates through four warning tiers.
docs/OVERVIEW.md:4 - Its MCP server breaks current context usage into compartments, such as the system prompt.
README.md:12 - Measurement is its main job; the README notes that Claude Code now handles the warning case natively.
README.md:18 - The numbers are meant as a relative instrument, for seeing what changed after you adjust your setup.
README.md:57 - The context_budget tool returns current context-window usage with a 5-compartment breakdown.
docs/HOW-TO-USE.md:87 - Measures prompt-cache behaviour: the cache hit ratio and how often the cache was re-primed mid-session.
README.md:30 - Warns the model in 4 tiers before auto-compaction.
.claude-plugin/plugin.json:4 - Warnings are advisory: every tier tells the model to keep working into compaction.
.claude-plugin/plugin.json:4 - Nothing in the plugin refuses a tool call.
CHANGELOG.md:146 - Warnings are injected into the model's context, and the tier can fall again when usage drops.
README.md:35 - The compaction threshold is averaged from recent auto-compaction samples.
docs/CONFIGURATION.md:56 - Tracks the burn rate over the last 3 readings and can bump the warning tier by one when context is being used quickly.
docs/CONFIGURATION.md:55 - Supports recovery around compaction: it verifies that state was saved and resumes afterwards.
README.md:41 - The audit measures what every session loads before the first prompt, including CLAUDE.md and the skill and agent listings.
CHANGELOG.md:119 - An MCP server with a single tool, context_budget.
docs/OVERVIEW.md:104 - Hooks for the SessionStart, PreToolUse and PreCompact events.
README.md:82 - A status-line script that acts as the sensor: it computes the tier, velocity and dynamic threshold.
docs/OVERVIEW.md:88 - An optional static audit, run with the /context-guard:audit command.
docs/OVERVIEW.md:25 - Two standalone Python helpers, velocity.py and thresholds.py, which are not wired into the hooks.
docs/ADMINISTRATOR.md:87 - Bundled test suites; the expected last line of a run is 9/9 test files passed.
docs/INSTALL.md:109 - bash, jq and Python 3.10 or newer (standard library only).
README.md:90 - Claude Code, which hosts the plugin's hooks and MCP server.
docs/INSTALL.md:11 - A plugin cannot set your status line, so wiring the sensor is a one-time manual edit of your settings.
docs/INSTALL.md:49 - There is no build step, package registry artifact or Docker image.
docs/OVERVIEW.md:102 - No tier warnings fire unless the status-line sensor is wired.
docs/ADMINISTRATOR.md:162 at 27526f8 - The status-line command path has to be updated after a plugin update.
docs/INSTALL.md:67 at 27526f8 - Per-category numbers are estimates, because Claude Code does not expose per-category token counts.
README.md:50 at 27526f8 - Known gap: tool definitions are not a separate compartment in the breakdown.
README.md:60 at 27526f8 - The audit's probe weighs MCP tool names only; full input schemas are not measured.
README.md:69 at 27526f8 - Threshold edits live in plugin.json inside the installed plugin, so a plugin update replaces them.
docs/CONFIGURATION.md:64 at 27526f8 - Install section of the README
README.md:73
Bulletproof suite v1.0.0 pins tag context-guard--v3.8.3, commit fa35b39, tagged 2026-11-14.