feat(phase-67): statusline value-metric integration (context-mode savings + CMM index health)#83
feat(phase-67): statusline value-metric integration (context-mode savings + CMM index health)#83halindrome wants to merge 10 commits into
Conversation
- Replace CTX:N/CMM:N display with context-mode savings + CMM health glyph - New flags: ctx_savings(true), cmm_health(true), cmm_nodes_edges(false), cmm_calls(false), blocks_total(false), block_details(false) - Savings from `context-mode statusline 2>/dev/null`, brand prefix stripped - CMM glyph: ✓ sentinel present, ⟳ absent; sqlite3 node/edge counts opt-in - Style-C assembly: <savings> | CMM <glyph> [opt-in segments] - All fail-open: missing context-mode/sqlite3/sentinel never errors Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zYAGHej3Yon8Ycd2aGB3d
…nd sync config-writer - WRAPPER_SCRIPT: same Style-C rendering as global heredoc (savings + CMM glyph) - Wrapper prepends upstream global statusline with ' | ' separator (existing logic kept) - Config-writer block: new flags ctx_savings/cmm_health/cmm_nodes_edges/cmm_calls/ blocks_total/block_details with correct defaults (true/true/false/false/false/false) - Old flags cmm_total/cmm_details/ctx_total/ctx_details retired (keys removed from config) - python3 reader and interactive prompts updated to match new flag names - Atomic write (tmp+mv) preserved; 'this resolution MUST match' comment kept Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zYAGHej3Yon8Ycd2aGB3d
- 11 test cases covering Style-C default, each toggle on/off, fail-open, stderr suppression, cmm_calls opt-in, and full assembly integration - Uses PATH-stub pattern (same as test-phase-66-*.sh) - Generates global standalone script via setup.sh --global --force - Uses pwd -P for canonical path so hash matches git rev-parse output (macOS) - All 22 assertions pass (0 failures) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zYAGHej3Yon8Ycd2aGB3d
…redoc headers Comment blocks documenting all toggle flags and their defaults were included inline in Tasks 1 and 2 commits. Both STATUSLINE_SCRIPT and WRAPPER_SCRIPT heredocs contain the full table: ctx_savings(true), cmm_health(true), cmm_nodes_edges(false), cmm_calls(false), blocks_total(false), block_details(false) + retired entries: ctx_total, ctx_details, cmm_total, cmm_details Example default output: '… | 170 KB kept out | CMM ✓' Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zYAGHej3Yon8Ycd2aGB3d
… changes setup.sh and tests/test-phase-67-statusline.sh modified by phase-67. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zYAGHej3Yon8Ycd2aGB3d
Add a Project Conventions rule: .claude/ is this repo's local working config / setup.sh install output (with deliberately-tracked pr-qa exceptions), maintained by checkout activity, not by feature development. All changes go in source (hooks/, agents/, rules/, setup.sh). A plan or QA finding that targets a .claude/ path as an edit target is a defect. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zYAGHej3Yon8Ycd2aGB3d
Statusline value-metric integration (context-mode savings + CMM index health). Phase artifacts under .vbw-planning/phases/67-* remain local-only per the repo's .vbw-planning/ gitignore convention (as with phases 64-66). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zYAGHej3Yon8Ycd2aGB3d
- F1: fix CMM DB path to use path-slug (cbm_project_name_from_path algorithm) not md5 hash — slug = replace non-[A-Za-z0-9._-] with '-', collapse consecutive dashes/dots, trim leading/trailing dashes (pipeline/fqn.c:322) - F2: trim all leading/trailing whitespace from savings field after bullet split, tolerating one-or-more spaces around ● and · delimiters - F4: invoke 'NO_COLOR=1 context-mode statusline' to suppress ANSI; brand-strip is now no-op-safe (fallback when ● absent strips literal brand and ANSI escapes) - F5: add code comment noting nodes/edges table coupling to CMM internals is intentional - F3: update test stub to real double-space format; strengthen savings assertion to catch stray padding; fix T4/T7 to use slug-path DB (catches F1 regressions); add T9b asserting no brand text leaks when ● absent Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zYAGHej3Yon8Ycd2aGB3d
QA Round 1Reviewed via a 3-lens Claude panel (contract+security / regression+edges / schema+tests), each running the test suites live and reproducing findings against the real Fixes applied this round in [claude] Finding 1 —
|
| Criterion | Round-1 verdict | Note |
|---|---|---|
| Style-C default render | whitespace padding (F2) resolved | |
Savings from context-mode statusline (strip/first-field/stderr/fail-open) |
F2/F4 resolved; fail-open was always intact | |
| CMM health glyph from sentinel, same md5 PROJECT_HASH | ✅ pass | |
No MCP/index_status; sqlite direct read only |
✅ pass | |
CTX:N display retired |
✅ pass | |
Node/edge counts via sqlite behind cmm_nodes_edges |
❌ fail → fixed | F1 (md5→slug) resolved |
| New toggle flags reconciled; config-writer valid JSON | ✅ pass | 6 keys, no trailing comma |
| Self-wrap guard | ✅ pass | |
| Absent-config defaults | ✅ pass | |
No .claude/ path touched |
✅ pass | guardrail confirmed |
| CHECKSUMS no drift | ✅ pass | 89 OK |
| Tests cover default/toggles/fail-open/stderr | ✅ pass | strengthened to 27/0 |
Summary
| Severity | Count | Fixed |
|---|---|---|
| Critical | 0 | — |
| Major | 1 | 1 |
| Minor | 4 | 3 + 1 tracked |
| Total | 5 | 4 fixed, 1 tracked |
SAST review skipped
Code scanning is not available for halindrome/cmm-claude-code-setup (no enabled CodeQL/SARIF analysis, or the API returned no alert array for ref feature/phase-67-statusline-value-metrics). No SAST delta is computed. This is a graceful skip — enable GitHub code scanning to populate this section.
Dependabot (SCA) — advisory, repo-wide
Dependabot alerts unavailable (not enabled, or token lacks security_events scope). Skipped — non-blocking.
QA performed by Claude Code (claude-opus-4-8)
- R2-1: fix malformed dot-collapse BRE in both heredocs (s/\.\.\*/./g → s/\.\.*/-/g) so consecutive dots collapse correctly - R2-2: add empty-slug guard ([ -n "$CMM_SLUG" ] || CMM_SLUG="root") matching cbm_project_name_from_path fallback in both heredocs and test - R2-3: replace GNU-only \x1b ANSI escape with portable _ESC=$(printf '\033') interpolation for BSD/macOS sed compat in both heredocs - R2-4: add T12 PROJECT wrapper test block (Style-C render + fail-open when context-mode absent); fix CMM_SLUG bug in test Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zYAGHej3Yon8Ycd2aGB3d
… followup) The round-2 slug fix collapsed consecutive dots to '-' and trimmed only one leading/trailing char. cbm_project_name_from_path (fqn.c:350-373) collapses consecutive dots to a single '.', trims ALL leading dashes/dots, and trims TRAILING dashes only. Align the sed pipeline (and the test's slug helper) to match exactly: s/\.\.*/./g and s/^[-.]*//; s/-*$//. Verified: /a..b/c -> a.b-c. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zYAGHej3Yon8Ycd2aGB3d
QA Round 2Reviewed via a 3-lens Claude panel (contract+security / regression+edges / schema+tests), adversarially verifying the round-1 fixes (incl. cross-checking the Fixes applied this round: [claude] Finding R2-1 —
|
| Criterion | R2 verdict | Note |
|---|---|---|
F1 (R1 fix): DB path uses CMM path-slug, reads ${CMM_SLUG}.db |
slug now faithfully matches cbm_project_name_from_path |
|
F4 (R1 fix): NO_COLOR=1 + no-op-safe brand strip |
ANSI-strip fallback now BSD/GNU-portable | |
| Style-C default render | ✅ pass | |
| Savings parse (strip/first-field/stderr/fail-open) | ✅ pass | |
| CMM health glyph from sentinel | ✅ pass | |
No MCP/index_status; sqlite direct read |
✅ pass | |
CTX:N retired |
✅ pass | |
| Toggle flags reconciled; config-writer valid JSON | ✅ pass | |
| Self-wrap guard; absent-config defaults | ✅ pass | |
No .claude/ path touched |
✅ pass | guardrail confirmed |
| CHECKSUMS no drift; tests cover default/toggles/fail-open/stderr/wrapper | ✅ pass | 89 OK; suite 33/0 |
Summary
| Severity | Count | Fixed |
|---|---|---|
| Critical | 0 | — |
| Major | 0 | — |
| Minor | 5 | 4 fixed, 1 tracked |
| Total | 5 | 4 fixed, 1 tracked |
SAST review skipped
Code scanning is not available for halindrome/cmm-claude-code-setup (no enabled CodeQL/SARIF analysis). No SAST delta is computed. Graceful skip.
Dependabot (SCA) — advisory, repo-wide
Dependabot alerts unavailable (not enabled, or token lacks security_events scope). Skipped — non-blocking.
QA performed by Claude Code (claude-opus-4-8)
QA Round 3 — Verification (CLEAN ✅)Final verification round via a 3-lens Claude panel. All round-1 and round-2 fixes confirmed complete and correct. No critical/major/actionable findings — the PR is clean for merge from a QA standpoint. Verification highlights:
Contract verification: all criteria PASS (Style-C render, savings parse, faithful CMM slug, sentinel glyph, no-MCP, CTX:N retired, toggles+config-writer JSON, self-wrap guard, absent-config defaults, fail-open, backward-compat, heredoc parity, no- Pre-existing issues discovered (minor observations — non-blocking, no fix)
Summary
SAST review skippedCode scanning is not available for Dependabot (SCA) — advisory, repo-wideDependabot alerts unavailable. Skipped — non-blocking. QA performed by Claude Code (claude-opus-4-8) |
Summary
Phase 67 — statusline value-metric integration. Replaces the augmented statusline's self-estimated / activity metrics with authoritative upstream value, defaulting to a minimal Style-C rendering with richer detail behind opt-in toggles.
Default render:
…wrapped upstream segment… | <savings> | CMM <glyph>— e.g.… | 170 KB kept out | CMM ✓.What's here
setup.shheredocs (both the GLOBAL standalone and the PROJECT wrapper — the statusline script is generated bysetup.sh;.claude/hooks/statusline-cmm.shis output only and is never edited):context-mode statusline, strips thecontext-mode ●brand prefix, takes the first·field, suppresses stderr (2>/dev/null— the NodeExperimentalWarning: SQLite), and skips fail-open whencontext-modeis absent/old/non-zero exit.✓when the/tmp/cmm-session-ready-<hash>sentinel exists, else⟳; optionalNn/Menode/edge counts come from a directsqlite3read of~/.cache/codebase-memory-mcp/<project>.db— noindex_statusor any MCP call from the statusline.CTX:Ncall-count display (it double-counted the plugin-form + legacy-server-form context-mode registrations) and the home-grown token-savings estimate._statusline-config-<hash>.json:ctx_savings(true),cmm_health(true),cmm_nodes_edges(false),cmm_calls(false),blocks_total(false); existing block/CMM-call counters remain the source for the opt-in segments (no tracking removed). Config-writer synced.tests/test-phase-67-statusline.sh(22 assertions) — Style-C default render, each toggle on/off, context-mode/sqlite/sentinel fail-open, stderr-silence (phase-66 PATH-stub pattern).CHECKSUMS.sha256regenerated.CLAUDE.md— added a Project Conventions guardrail: never modify.claude/in this repo (local working config / install output, not feature-dev output); changes go in source (hooks/,agents/,rules/,setup.sh).Phase planning artifacts under
.vbw-planning/phases/67-*are intentionally local-only per the repo's.vbw-planning/gitignore convention (as with phases 64–66), so they are not part of this diff.Verification
tests/test-phase-67-statusline.sh: 22 passed, 0 failed.tests/test-statusline-path.shpass;tests/test-phase-48-statusline-reprompt.sh14/0.QA
Ready for the CONTRIBUTING.md QA cycle (2–4 rounds, fresh Opus-class session per round). Touches
setup.sh+tests/→ not docs-only; use the global/pr-qa.🤖 Generated with Claude Code