Skip to content

Persistent checkpoint & session history #72

Description

@hellodk

Description

Implement persistent storage for checkpoints and session history to survive VS Code restarts. Currently, checkpoints (shadow-copy snapshots before each agent action) and chat session data are held in memory and lost when VS Code closes.

Business Value

  • Users can restore previous states even after restarting VS Code
  • Session history remains accessible across multiple work sessions
  • Enables audit trails and compliance use cases
  • Improves user experience by preventing loss of work context

Acceptance Criteria

  • Checkpoints are automatically serialized to disk in a directory
  • Each checkpoint file is versioned with timestamp and includes file paths, before/after diffs, and metadata
  • Chat session history is persisted to with one JSON file per session
  • Sessions are indexed and searchable by date, workspace, and content keywords
  • Restore Checkpoint command reads from disk and presents UI to select historical checkpoints
  • Cleanup Old Sessions command removes checkpoints and sessions older than N days (configurable, default 30)
  • Existing in-memory checkpoint API remains compatible — storage layer is transparent to calling code
  • Storage size is bounded — implement LRU eviction if checkpoint dir exceeds configured limit (default 500MB)
  • Sealed Secrets pattern: checkpoint paths are always workspace-scoped (reject path traversal)
  • New config settings: champ.storage.checkpointRetentionDays, champ.storage.maxCheckpointSizeMB, champ.storage.sessionsPath

Tests Required

  • Unit: checkpoint serialization (create, read, delete from disk)
  • Unit: session history JSON schema validation
  • Unit: checkpoint file naming and versioning
  • Unit: LRU eviction algorithm (size bounds)
  • Unit: path traversal protection in checkpoint paths
  • Integration: write checkpoint to disk, restart VS Code, verify restore works
  • Integration: session history persists across multiple chat sessions
  • Integration: cleanup command correctly removes old checkpoints based on age
  • E2E: user can see checkpoint history UI, select one, and restore state

Implementation Notes

  • Use VS Code's workspace storage API ( for sensitive data) and filesystem for large blobs
  • Store relative paths in checkpoint metadata — convert to absolute on restore to support moved workspaces
  • Checkpoint storage format: {timestamp}-{hash}.json with gzipped file diffs to save space
  • Session format: {sessionId}.json with streaming-friendly structure (append messages, not rewrite)
  • Consider using SQLite or LevelDB for efficient querying across old sessions (future optimization)

Related Issues

None yet — this is a foundational feature.

Environment

  • VS Code 1.95+
  • All platforms (Windows, macOS, Linux)

Metadata

Metadata

Assignees

Labels

P1High priority — next sprintfeatureNew feature

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions