42 lines
2.3 KiB
Markdown
42 lines
2.3 KiB
Markdown
# 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 DESC` instead.
|
|
- **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:
|
|
1. SessionKey plumbing in CLI hooks to extract and forward `session_id` from Claude Code
|
|
2. Migration 016 for session_checkpoints table and indexes
|
|
3. New continuity-state module for per-session accumulation tracking
|
|
4. New session-checkpoints module for checkpoint CRUD operations
|
|
5. Buffered flush queue (setTimeout-based)
|
|
6. Hook integration (session-start, user-prompt-submit, remember, session-end, pre-compaction)
|
|
7. CLI parsing updates
|
|
8. Redaction of agent-initiated digests before storage
|
|
9. 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 |