Skip to content

feat: split into three independently-installable plugins (context-guard, refine-gate, statusline)#9

Merged
cdeust merged 1 commit into
mainfrom
feat/three-plugin-split
Jul 22, 2026
Merged

feat: split into three independently-installable plugins (context-guard, refine-gate, statusline)#9
cdeust merged 1 commit into
mainfrom
feat/three-plugin-split

Conversation

@cdeust

@cdeust cdeust commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

The monolith becomes three plugins under one marketplace — users install exactly what they want:

  • context-guard — Stop-hook context guard + memory-writer agent + SubagentStop spend tracker
  • refine-gate — UserPromptSubmit hook + refine skill
  • statusline — the multiline statusline with a proper install skill (preflight → copy assets → wire settings.json → verify) and a SessionStart auto-update hook that reconciles code assets but never overwrites user config

Root plugin becomes a deprecation shim (SessionStart notice only — existing installs learn about the split instead of silently losing hooks; no double registration).

Ecosystem decoupling: context-guard now detects the Cortex memory layer at runtime per invocation — outside users get a generic stub-file checkpoint protocol referencing only vanilla Claude Code tools; the cortex-scoped wording appears only when the memory tool is present. Both variants verified end-to-end with synthetic transcripts.

Bonus fix: memory-writer agent frontmatter was broken YAML (unquoted : — loaded with empty metadata); now a block scalar.

Test plan

  • 18 pytest (refine-gate + subagent suites, retargeted) + 22 statusline tests + clean shellcheck
  • claude plugin validate --strict passes on all three plugins and the marketplace root
  • All 9 JSON manifests parse (also enforced in CI)
  • CI green

🤖 Generated with Claude Code

…lugins

One marketplace, three plugins a user can install in any subset:

- plugins/context-guard — Stop-hook context budget (stop-context-guard.py),
  the memory-writer checkpoint agent, and the SubagentStop spend tracker
  (subagent-tracker.py + tools/subagent_usage.py). Checkpoint protocol +
  spend context belong together.
- plugins/refine-gate — UserPromptSubmit prompt-binding gate
  (refine_gate.py) + the /refine skill and its overhead-measurement tool.
- plugins/statusline — renderer + cost/telemetry helpers + config under
  assets/, a proper install skill (preflight, asset placement with
  backup/preserve rules, settings.json statusLine wiring, verification),
  and a SessionStart auto-update hook, following the
  pictet-tech/claude-statusline pattern.

Root keeps a deprecated session-optimizer meta plugin as a migration shim:
no functional hooks (no double registration), only a SessionStart notice
telling existing installs to switch to the three plugins.

Decouple the checkpoint protocol from the private memory ecosystem:
- new hooks/checkpoint_protocol.py owns the Stop guard's instruction text;
  detect_memory_tool() probes tools/memory-tool.sh (project root or
  ~/.claude/tools/) per invocation and the hook emits the scoped-store
  wording (memory verbs, MEMORY_AGENT_ID, remember endpoint) ONLY when the
  layer is installed — the default variant references vanilla Claude Code
  tools only (stub-file protocol).
- memory-writer agent rewritten generic-first: stub file is the default
  path, the scoped store an explicitly runtime-detected extension; fixed
  frontmatter to a YAML block scalar (was silently unparseable).
- refine gate / skill wording now says "your memory layer's recall tool
  when one is installed" instead of naming cortex tools unconditionally.

The context-guard <-> statusline threshold coupling stays a shared-file
convention (~/.claude/ctxguard-thresholds.json, seeded by the statusline
install skill, embedded fallbacks in both consumers) and is documented in
both plugins' READMEs.

Tests stay at the repo root and now target the plugin paths; CI shellchecks
the moved renderer and validates every plugin/hook/marketplace manifest.
All suites pass (18 pytest + 22 shell) and `claude plugin validate --strict`
passes on each plugin and the marketplace root.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cdeust
cdeust merged commit a585b6c into main Jul 22, 2026
1 check passed
@cdeust
cdeust deleted the feat/three-plugin-split branch July 22, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant