Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .vbw-planning/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ Hook-based enforcement layer for codebase-memory-mcp + Claude Code, adapted from
| 63 - Refresh ctx/cmm Rule Files for Upstream Tool Versions | 1/1 | complete | 2026-06-17 |
| 64 - Gate-Frustration Advisory | 0/? | pending | — |
| 65 - Monorepo CMM Index Discipline | 0/? | pending | — |
| 67 - Statusline Value-Metric Integration | 0/? | pending | — |

### Phase 23: Enforce CMM Hooks Inside Subagents
**Goal:** Hooks registered in `settings.json` (session gate, stale advisory, CMM call tracker) do not fire inside VBW subagents (Dev, Scout, Lead, QA). These agents make CMM queries and file edits without the enforcement layer active — they can query a stale index silently, bypass the session gate, and skip call tracking. This is a correctness gap: the tooling is designed to guarantee all CMM usage is accurate and tracked, but that guarantee breaks down exactly when subagents are doing the most work. Fix this by using the mechanisms from Claude Code's subagent hooks API: inject the session gate check via `SubagentStart` context injection, and add the stale advisory and CMM call tracking hooks to VBW agent frontmatter files so they fire inside each agent's execution context.
Expand Down Expand Up @@ -805,3 +806,19 @@ Concretely:
- **Scope/QA:** touches `hooks/` + `setup.sh` (Stop-hook registration) + `tests/` → does **not** qualify for the CONTRIBUTING.md docs-only skip; the standard 2–4 QA rounds apply (use the global `/pr-qa`).

**Research deferred to Plan mode.** The originating session verified the referenced artifacts exist on `develop`: the source counter `hooks/project/track-hook-blocks.sh`, the report script `scripts/analyze-gate-blocks.py`, and the statusline `statusline-cmm.sh`. Open implementation questions for Plan mode: the exact threshold value and whether it should be configurable; the precise Stop-hook event wiring and `setup.sh` registration block; the statusline marker format; and confirming the final `--all --share` flag surface once PR #78 lands. A focused Scout pass on the Stop-hook registration path in `setup.sh` and the current statusline rendering is sufficient — no broad research needed.

### Phase 67: Statusline Value-Metric Integration (context-mode savings + CMM index health)
**Goal:** Replace the augmented statusline's self-estimated / activity metrics with authoritative upstream value, defaulting to a minimal rendering with richer detail behind toggles. Today `hooks/statusline-cmm.sh` wraps the user's global/VBW statusline and appends call-activity counts (`CMM:N (sg/cs/tr)`, `CTX:N (ex/bex/sr)`, `Blk:R/B`) read from per-project JSON counters in `~/.cache/codebase-memory-mcp/`. The `CTX:N` count is misleading (it double-counts the plugin-form and legacy-server-form context-mode registrations) and we estimate token savings ourselves. context-mode now ships its own authoritative statusline binary (`context-mode statusline` → `bin/statusline.mjs`) that reads its SessionDB and reports real bytes/percent kept out of context; CMM exposes cheap, MCP-free index-health signals (the `/tmp/cmm-session-ready-<hash>` sentinel and a direct `sqlite3` read of node/edge counts from `~/.cache/codebase-memory-mcp/<project>.db`). Default rendering (Style C): `…wrapped upstream segment… | <savings> | CMM <glyph>` e.g. `… | 170 KB kept out | CMM ✓`.
**Deps:** Phase 13 (Statusline Token Savings — establishes the savings display this supersedes), Phase 36/30 (block counter + per-project hash convention reused), Phase 11 (Statusline Setup Offer). Requires context-mode ≥ the version exposing `context-mode statusline` (verified present locally at v1.0.162).
**Reqs:** none (enforcement-transparency / statusline UX)
**Success:**
- Default rendering is Style C: upstream segment + context-mode savings segment + `CMM ✓/⟳` glyph; no call counts shown by default.
- **Savings segment** is sourced by shelling out to `context-mode statusline`, stripping the `context-mode ●` branding and taking the first ` · ` field, with stderr suppressed (the Node `ExperimentalWarning: SQLite` line) and the segment skipped when `context-mode` is absent/old/non-zero exit. No home-grown savings estimate remains.
- **CMM health glyph** is `✓` when the `/tmp/cmm-session-ready-<hash>` sentinel exists, else `⟳`; optional `Nn/Me` node/edge counts come from a direct `sqlite3` read of the project DB. **No `index_status` (or any) MCP call is made from the statusline.**
- Retire the `CTX:N` call-count display (double-counts registrations) and any self-estimated token-savings number.
- Each segment is independently toggleable via `_statusline-config-<hash>.json`: `ctx_savings` (default true), `cmm_health` (default true), `cmm_nodes_edges` (default false), `cmm_calls` (default false), `blocks_total` (default false). Existing block/CMM-call counters remain the source of truth for the opt-in segments — no tracking is removed.
- The statusline never errors or emits stderr noise when context-mode, CMM, or `sqlite3` are missing; width stays within budget when wrapping the upstream segment.
- Test coverage for: Style-C default render, each toggle on/off, context-mode-absent fail-open, sqlite/sentinel-absent fail-open, and stderr suppression.
- **Scope/QA:** touches `hooks/` (`statusline-cmm.sh`) + likely `setup.sh`/config + `tests/` → does **not** qualify for the CONTRIBUTING.md docs-only skip; the standard 2–4 QA rounds apply (use the global `/pr-qa`).

**Research captured this session (Plan mode can build directly).** First-hand investigation plus a live proof-of-concept this session verified: our statusline `hooks/statusline-cmm.sh` wraps the global statusLine command and appends counters from `~/.cache/codebase-memory-mcp/_{call,ctx-call,block}-counts-<hash>.json` (written by `track-cmm-calls.sh`, `track-ctx-calls.sh`, `track-hook-blocks.sh`); context-mode's `bin/statusline.mjs` renders `context-mode ● <KB> kept out · …` from its SessionDB and is composable once stderr is suppressed; CMM has no statusline but its sqlite DB (`nodes`/`edges` tables) and the readiness sentinel are cheap local reads; the PoC rendered `… | 170 KB kept out | CMM ✓ 1751n/2012e`. See `67-RESEARCH.md`. Open Plan-mode questions: exact toggle-flag plumbing into `_statusline-config-<hash>.json`, whether `setup.sh` should default-enable the savings segment, and the width/truncation budget when the wrapped upstream segment is long.
3 changes: 2 additions & 1 deletion CHECKSUMS.sha256
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ bba21d48d0bfdac41d1c1b99d65417b319eb7b5c452c2748a6b74219ff0782f0 hooks/project/
b618d1714978c299dc59f8ef2339df464a81a9bca5bcb70758c384353f7949ed rules/ctx-rules.md
e6ea05e8f270d654b7e8b9e7320713b455687c6d178f6a3a2434132a843efd16 rules/mcp-example.json
506c5683e0bc6d787c05d6276e8e7923efc1994d22d059628408ca1b8e5386ba rules/project-settings-example.json
e595639423216a78f07fbf825c66d6aaafbd0c73bdd0e58e594e4ef76630a1b5 setup.sh
a476d980f4845d05f8c161c490bad2e282fba8689a888039362ccb68c3dc7b08 setup.sh
349e14fa203f4d5b5a60442c0d2223a2feb67ec44bd82aaff6a2528541848056 tests/fixtures/skill-compliance/agent1.jsonl
94369a1454456bbb20875abadcc79fc28dc7da374f919cc6d8bf03b5dc0292cd tests/fixtures/skill-compliance/agent2.jsonl
8fd9ee0a7c7efe84a9c345a247ce021aeeb0468a185b5216203d82dc6a2600fd tests/setup-test-monorepo.sh
Expand Down Expand Up @@ -76,6 +76,7 @@ a6680dbe6fb00757c1dd10f0f427c06e7dd850301c66bf86782cfe7537b2136b tests/test-pha
3b698cedaeb488ea1638c3eb1cd805b7fb81089e5fc2b925ea79322ff199fec9 tests/test-phase-66-generate.sh
130ea307659a83cffbf057b8c98fdf3e0052514c5f5b0ab679fe5d2750727171 tests/test-phase-66-install-scope.sh
bc05991b2557b424d84c267fb94f9ada87a7be28e8e580624fadcc6661d1a237 tests/test-phase-66-resolver.sh
66de91563dfa5f21138e29b427f4d9327e891fe2d763f7e7fef92bb99e25e498 tests/test-phase-67-statusline.sh
72d1fe8acdb71b03de3999dcd4028072d5def64ca8bb6797358dc64a59d00587 tests/test-project-root-lib.sh
30ef04820573df7440e78a15f5ef4b0fe160222319095688c49397e369e37e1f tests/test-reindex-earlyexit.sh
04f9e626c10f964965d5de4845111d85bfc083e1abf0a3f543b91d26a0a2ad3a tests/test-scout-context-mode.sh
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ _(Run /vbw:skills to list)_

## Project Conventions

- **Never modify `.claude/` in this repo.** `.claude/` is this repo's own local working config — the install target of `setup.sh` plus a few deliberately git-tracked QA helpers (`.claude/agents/pr-qa-reviewer.md`, `.claude/skills/pr-qa/**`). It is maintained by whoever checks out the repo and runs the tools, **not** by our development. This project's job is generating plugins for *other* repos; the local `.claude/` is just our own install. All development changes go in the **source**: `hooks/` (incl. `hooks/project/`, `hooks/lib/`), `agents/`, `rules/`, and `setup.sh` (which emits much of `.claude/`). A plan or QA finding that lists a `.claude/` path as an *edit target* is a defect — point it at the source. Treat installed/generated `.claude/` copies as output only; do not read them for source-of-truth either (use the source dirs).
- Bash hooks: shebang `#!/bin/bash`, one-line purpose comment, install/register instructions at top
- Exit codes: `exit 2` = block tool call with message, `exit 0` = allow
- Sentinel pattern: `/tmp/cmm-session-ready-<project-root-md5hash>` for session gate
Expand Down
Loading