context-guard

A plugin that observes how much of each agent session's context window is being used and classifies that usage into smart, acceptable, or dumb zones. A context window is the amount of conversation and information the agent can consider at once.

In plain words
What is it for?
It is for recording per-session context usage, reporting worse zone changes, preserving evidence after compaction, and optionally blocking new changes when context is critically low.
Why use it?
It makes declining context capacity visible and can warn the operator when a session needs attention or a handoff.

Plugin for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Claude Code
/plugin marketplace add melodic-software/claude-code-plugins
agentmods
npx agentmods add plugins/melodic-software/claude-code-plugins/context-guard
Clone the repo
git clone --depth 1 https://github.com/melodic-software/claude-code-plugins

Made for: Claude Code.

Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Security

Grade A, and why

context-guard scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/context-guard/.claude-plugin/plugin.json · 41 lines

How it starts

The opening of the file, as written. The whole thing — 41 lines — stays where its author put it; the contents beside it link to each section on GitHub.

{
  "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
  "name": "context-guard",
  "version": "0.7.27",
  "description": "Per-session context-window observability plus the first shipped consumer: a statusline wrapper tees each session's context_window fields to a per-session snapshot file, a zone resolver classifies usage into smart/acceptable/dumb bands (percentage bands plus window-class token bands, conservative-min combination, zones.json SSOT with shipped defaults), a reader contract fixes how consuming sessions interpret the snapshots, and zone-crossing hooks report once per transition into a worse zone across two channels — the continuation menu to the operator, who owns that choice, and to the model only the zone determination plus the counter-steer that a zone word is not a decay signal (advisory by default; an optional blocking mode gates new mutating work on a fresh dumb-zone snapshot with handoff-writing exempt), with a PostCompact hook persisting an evidence-degraded marker.",
  "author": {
    "name": "Melodic Software",
    "email": "[email protected]"
  },
  "license": "MIT",
  "keywords": [
    "context-window",
    "statusline",
    "tee",
    "zones",
    "context-degradation",
    "session",
    "hooks"
  ],
  "userConfig": {
    "context_guard_hooks_enabled": {
      "type": "boolean",
      "title": "context-guard hooks kill switch",
      "description": "Master switch for the zone-crossing injection, blocking gate, and PostCompact marker hooks",
      "default": true
    },
    "zone_hook_mode": {
      "type": "string",
      "title": "Zone hook posture",
      "description": "advisory (default) injects guidance only; blocking additionally denies new Write/Edit/NotebookEdit/Agent/Workflow calls on a fresh dumb-zone snapshot past the grace budget (fail-open on unknown; handoff-path writes, reads, Bash, and Skill stay allowed)",
      "default": "advisory"
    },
    "zone_gate_grace_calls": {
      "type": "str

Read the full file on GitHub · 41 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 41 lines scan A f9cf2463ed1f

Subscribe to this mod's changes

context-guard is a plugin published in the GitHub repository melodic-software/claude-code-plugins (12 stars, last pushed yesterday), licensed MIT. Its token cost is not measured: this kind of file is read by the harness, not the model. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.