You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Haven + SL bots run the Claude Agent SDK, which auto-compacts (emits compact_boundary, fires PreCompact, re-injects CLAUDE.md, no off-switch). Today the invoker sidesteps this with a manual 150k-token restart. Goal: stop fighting compaction — harden it, and let every bot surface (Haven, SL, future) lean on it the way terminal-Lyra already does.
Leg 2 GAP: the invoker builds ClaudeAgentOptions with setting_sources=Noneandhooks=None → the filesystem PreCompact hook (b9617e7) does not fire in bot SDK sessions.
SDK version drift: .venv = claude-agent-sdk 0.1.73; pps/venv = 0.1.58.
Build items (land in haven/brain/ → both surfaces inherit)
Wire PreCompact into the invoker programmatically via hooks= — NOT setting_sources=["project"] (that would drag in inject_context, PreToolUse, etc. and double-inject ambient).
Raise/remove the 150k restart; demote it from primary mechanism to fallback safety-net (only if a session wedges / compaction ever fails).
PreCompact actions = the hardening: (a) refresh the scene (what the far side re-orients from), (b) flush live working-thread state to PPS so the post-compaction self resumes the conversation, not just cold identity.
Add a "preserve on compaction" section to entity CLAUDE.md (re-injected every request → the right home for persistent preserve-instructions).
Align/refresh the SDK across venvs.
Verify
Force /compact on a test invoker with the hook wired → confirm: compaction fires, our PreCompact runs, scene + working-thread captured, post-compaction re-orient is clean, nothing lost.
Related
Unblocks the compacting float-text status in SL presence (it needs the PreCompact signal as its honest source).
Context
The Haven + SL bots run the Claude Agent SDK, which auto-compacts (emits
compact_boundary, firesPreCompact, re-injectsCLAUDE.md, no off-switch). Today the invoker sidesteps this with a manual 150k-token restart. Goal: stop fighting compaction — harden it, and let every bot surface (Haven, SL, future) lean on it the way terminal-Lyra already does.Design note:
work/sl-presence/context-handling.md.Findings (measured 2026-08-22)
autoCompactEnabledoff-switch is silently ignored.cwd = entity dir(Issue Concurrent-session entity bleed via shared .claude/CLAUDE.md symlink #226), soentities/<entity>/CLAUDE.mdre-reads on compaction, same as terminal. This is why bots "just come back clean."ClaudeAgentOptionswithsetting_sources=Noneandhooks=None→ the filesystemPreCompacthook (b9617e7) does not fire in bot SDK sessions..venv=claude-agent-sdk 0.1.73;pps/venv=0.1.58.Build items (land in
haven/brain/→ both surfaces inherit)hooks=— NOTsetting_sources=["project"](that would drag ininject_context, PreToolUse, etc. and double-inject ambient).CLAUDE.md(re-injected every request → the right home for persistent preserve-instructions).Verify
Force
/compacton a test invoker with the hook wired → confirm: compaction fires, our PreCompact runs, scene + working-thread captured, post-compaction re-orient is clean, nothing lost.Related
compactingfloat-text status in SL presence (it needs the PreCompact signal as its honest source).work/sl-presence/context-handling.md,work/sl-presence/write-back-and-status-design.md§5.