Compaction Survival
How working state survives a context-window reset.
A shell's context window can be compacted mid-session, erasing working state. The compaction survival protocol preserves that state across the reset. It has three cooperating parts.
The sidecar
Throughout a session LISA maintains a small state sidecar file:
Every sidecar write piggybacks a heartbeat to the session registry, so other channels see live state. Update triggers: dispatch open/close, decision, directive, namespace change, state change.
The hooks
- PreCompact hook — reads the sidecar, composes a
thread_checkpointcache entry, and posts it to the gateway (fire-and-forget with a short timeout). - SessionStart(compact) hook — fetches the checkpoint back, composes a narrated recap, and injects it so the model resumes with its working state intact.
- Fallback chain — gateway, then a local temp file, then a minimal message.
The thread_checkpoint entry carries the session id, turn count, active dispatches, open decisions, pending directives, current namespaces, and a bounded prose snapshot of working state.
The survival sequence
If the gateway is unreachable at either end, the chain degrades: a local temp file backs the checkpoint, and a minimal message is the last resort.