Audit (2026-06) of the Squad Context System (src/lib/run-context.ts)
Ran the real loader against a real .agents tree across roles. Mechanics are correct: SYSTEM.md (L0) loads separately; strategy.md is the L1 "Company" layer; injection order is action-first (founder-context → alignment → feedback → goals → state → agent → strategy → briefing → cross-squad); role gating matches ROLE_SECTIONS; budget is enforced with graceful skips.
Findings
This PR (F1 + tests)
- Shared
stalenessNote() helper; applied to feedback and state (DRY).
- 6 real fixture-based tests: order, L1=strategy, role gating, budget-eviction, stale + fresh feedback.
F2/F3/F4 remain as follow-ups.
Audit (2026-06) of the Squad Context System (
src/lib/run-context.ts)Ran the real loader against a real
.agentstree across roles. Mechanics are correct: SYSTEM.md (L0) loads separately;strategy.mdis the L1 "Company" layer; injection order is action-first (founder-context → alignment → feedback → goals → state → agent → strategy → briefing → cross-squad); role gating matchesROLE_SECTIONS; budget is enforced with graceful skips.Findings
gatherSquadContexthad no real behavioral assertions (expect(typeof ctx).toBe('string')/if (length>0)guards that silently skip). Layer order, role gating, L1=strategy, and budget behavior were unverified.feedback.mdwas injected under "act on this first" with no staleness caveat (onlystate.mdhad the feat: memory staleness caveats #721 note). Real runs showed 76-day-old feedback presented as current.daily-briefing.mdoverlaps heavily withfounder-context.md; the same blocks inject twice (~2k tokens wasted, attention diluted).founder-context.mdreaches all roles incl. scanner/worker. Confirm intended scope / PII posture.This PR (F1 + tests)
stalenessNote()helper; applied to feedback and state (DRY).F2/F3/F4 remain as follow-ups.