Repository navigation
[AI-3317] Serve Pi the team-memory index on every session start - #1214
Conversation
kcap.ts holds the fragment only in memory and drops it at every session_shutdown, so a once-per-file lease left every restart, resume and switch without the index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Summary by QodoRestore Pi team-memory index on every session start
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-3317 (no GitHub issue — filed in Linear only)
What & why
A Pi session got the team-memory index only on its first
session_start: every restart, resume or in-process session switch lost it for good. The hook spent a once-per-file lease, butkcap.tsholds the fragment only in memory and drops it at everysession_shutdown(Pi fires one on exit and before a switch), and Pi persists none of the injected text. Pi's lifecycle now declaresHostKeepsContext: false, the policy answers a newEligibleEveryStart, and the orchestrator fetches without a lease for it, so each start gets a fresh copy.Where to look
SessionStartMemoryOrchestrator's new arm: no lease is read or written, a failed fetch leaves the next start to try again, and the commit gate is still honoured. Re-delivery cannot duplicate: the extension replaces its cache and guards the per-turn append withincludes(). Every other harness keepsHostKeepsContextat its defaulttrue, so its behaviour is unchanged.Verification
kcap.ts+ this branch'skcap, with a stand-in provider logging each turn's system prompt. Memory index per turn, main → this PR: fresh 1 → 1; restart + resume 0 → 1; again 0 → 1; in-processswitch_session0 → 1 (three turns, all 1). Never 2, and the session file holds none of it.EligibleEveryStartarm fails four tests, including the lease-keeping control case.*SessionStartMemory*186/186 andPiSessionStartMemoryTests20/20 locally.🤖 Generated with Claude Code