2.3 KiB
2.3 KiB
2026-03-01 Session Notes
Session Continuity Protocol Feature Planning
Nicholai designed a comprehensive feature to help Signet agents survive context window limits by capturing session state checkpoints before compaction. The system uses two data channels: passive accumulation (automatic observation of queries and /remember calls) and agent-initiated digests (via MCP tool, Phase 2).
Architecture Overview
The implementation spans three phases:
- Phase 1: schema, sessionKey plumbing, passive checkpoints, recovery injection, API endpoints
- Phase 2: MCP session_digest tool and agent instruction updates
- Phase 3: pre-compaction enrichment, pruning tuning, scorer integration
Checkpoints are stored in a new session_checkpoints table with normalized project paths (via realpath) for reliable matching across symlinks. The table uses UUIDs instead of sequences to avoid race conditions on concurrent writes.
Key Decisions
- Separate table from memories: checkpoints have different lifecycle (hours vs weeks), query patterns, and retention. Mixing would pollute the scoring/decay pipeline.
- Dropped sequence column: avoids race conditions; ordering by
created_at DESCinstead. - Added project_normalized: resolves symlink aliases for reliable cross-session matching.
- Buffered checkpoint writes: 2-3 second debounce to avoid blocking hot paths on user-prompt-submit.
- Pre-reserved budget for recovery: 2000-char section injected at session-start before memory injection to guarantee space.
Implementation Scope
Nine implementation steps identified:
- SessionKey plumbing in CLI hooks to extract and forward
session_idfrom Claude Code - Migration 016 for session_checkpoints table and indexes
- New continuity-state module for per-session accumulation tracking
- New session-checkpoints module for checkpoint CRUD operations
- Buffered flush queue (setTimeout-based)
- Hook integration (session-start, user-prompt-submit, remember, session-end, pre-compaction)
- CLI parsing updates
- Redaction of agent-initiated digests before storage
- Configuration schema under PipelineV2Config
Open Threads
- Phase 2 and 3 implementation deferred
- MCP session_digest tool design pending
- Pruning policy and retention day thresholds TBD
- Scorer integration with checkpoint relevance ranking pending