Root cause: statusline-generator.ts emitted a .cjs with fragile local file
readers that couldn't find AgentDB patterns (stored in .swarm/memory.db, not
.claude-flow/data/patterns.json), causing every display field to show
fallback zeros: DDD 0/5, intelligence 1%, ADR 87/87 (missed v3/docs/adr/).
Fix (Option C from issue):
- Delegate to 'npx @claude-flow/cli@latest hooks statusline --json' as the
single source of truth; that command queries AgentDB correctly
- Cache the JSON result for 10s in /tmp to stay fast on rapid re-renders
(cached run: ~195ms; uncached: ~1.3s; vs old: ~29ms but wrong data)
- Count ADRs from BOTH v3/implementation/adrs/ (87) AND v3/docs/adr/ (41)
= 128 total; old code only checked the first-matching directory
- buildLocalFallback() runs when CLI is unavailable (no npx, no network),
keeping the statusline functional but clearly showing zeroes rather than
silently returning wrong numbers
- Regenerated .claude/helpers/statusline.cjs from the new generator
CI guard (scripts/smoke-statusline-generator-delegation.mjs):
- [1/3] Static: assert generator contains delegation pattern, NOT the old
getLearningStats/getV3Progress local readers, and both ADR dirs present
- [2/3] Syntax: generate fresh .cjs, verify it passes node --check
- [3/3] Runtime: run .cjs --json, assert all fields in valid ranges and
adrs.count > 87 (proves both directories counted on full checkout)
Verification on macOS:
domainsCompleted: 5/5 (was 0/5)
intelligencePct: 100% (was 1%)
dddProgress: 100% (was 0%)
adrs.count: 128 (was 87)
patternsLearned: 26,972 (was 0)