Skip to content

context-guard / rate-limit-guard: durable statusline wiring (version-independent shim) #1251

Description

@kyle-sexton

Problem

Both guard plugins tell the operator to wire bash "<plugin-root>/scripts/statusline-tee.sh" <their statusline> into settings.json. ${CLAUDE_PLUGIN_ROOT} is version-pinned (~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/) and the old version directory is pruned ~14 days after an update (plugins reference, "Plugin cache and file access", fetched 2026-07-24). So that wiring:

  1. stops teeing silently at the next version bump (the old tee still runs until pruned), and
  2. breaks the operator's whole statusline once the old directory is pruned — bash <missing-path> exits 127 and the wrapped statusline never runs.

setup check detects (1) only on demand, and an interim [ -f … ] existence guard fixes (2) but not (1).

Decision

Ship a version-independent shim in both plugins (scripts/statusline-shim.sh), installed by setup apply to ~/.claude/<plugin>/bin/statusline-shim.sh — inside each plugin's already-accepted operator-home carve-out. The operator wires the shim ONCE; it resolves the newest installed tee at run time, so version bumps need no re-wiring, and it degrades transparently when no tee is installed (including after uninstall).

Rejected alternatives: keep the interim guard (still stops teeing on every bump); inline the resolution glob in settings.json (untestable shell frozen in an operator file, unreadable once two tees chain); a ${CLAUDE_PLUGIN_DATA} home for the shim (deleted on uninstall — reintroduces the 127 failure — and hardcodes the marketplace name into operator settings).

Scope

  • scripts/statusline-shim.sh + statusline-shim.test.sh in context-guard and rate-limit-guard
  • setup apply installs the shim (widens context-guard's apply scope; gives rate-limit-guard an apply for the first time); setup check gains an installed-shim state and reclassifies cache-path wiring as LEGACY
  • Delta security review recorded in docs/MIGRATION-PLAYBOOK.md (new write surface: an inert, byte-identical copy of reviewed bundled code)
  • Sibling-composition wiring (both tees chained, each through its own shim) documented in both setup skills, with the measured per-tee refresh cost
  • Resolves the plugin-audit-port PLAN open question "stable-shim (stress-test ci: onboard to the CI platform (ci-workflows + standards) #4)"

Statusline wiring itself stays print-only — the plugin never edits settings.json.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: mediumReal value, no hard deadline; normal backlog flow.status: readyTriaged, unblocked, and fully specified; eligible to pick up.work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions