Add session persistence with multipath exploration #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements MVP of session persistence system with ETS-based hot storage, file persistence, and session forking for multipath exploration.
Closes #5
Features Implemented
🔥 ETS Hot Storage
sessions
- Main session storageindexes
- Tag and metadata indexingforks
- Parent-child relationshipsaccess_tracker
- Access pattern monitoringread_concurrency: true
💾 File Persistence
save_session_to_disk/1
- Save to~/.multi_agent_coder/sessions/
load_session_from_disk/1
- Load from disk into ETSexport_session/2
- Export to JSON (portable format)import_session/1
- Import from JSON🌲 Session Forking (Multipath Exploration)
fork_session/2
- Branch conversation at any messageget_session_forks/1
- List all child sessionsget_session_parent/1
- Navigate up the session tree🔍 Search & Discovery
find_sessions_by_tag/1
- Tag-based searchfind_sessions_by_date_range/2
- Time-based querieslist_sessions/0
- List all sessions📊 Usage Tracking
Architecture
Implementation Details
Session Data Structure
Multipath Example
Testing
Comprehensive test coverage with 13 tests:
✅ Session management (create, retrieve, list, find by tag, delete)
✅ Message management (add messages, track providers, token counting)
✅ Session forking (fork creation, relationships, parent tracking)
✅ Persistence (save/load from disk, export/import JSON)
✅ Statistics (storage stats and memory usage)
All tests passing:
mix test test/multi_agent_coder/session/storage_test.exs
Future Compatibility
The implementation is designed to be compatible with Grapple integration:
This allows for future enhancements:
Documentation
Added comprehensive documentation to README including:
Files Changed
lib/multi_agent_coder/session/storage.ex
- Main storage module (414 lines)lib/multi_agent_coder/session/storage/session.ex
- Session data structurelib/multi_agent_coder/session/storage/message.ex
- Message data structurelib/multi_agent_coder/application.ex
- Added Storage to supervision treetest/multi_agent_coder/session/storage_test.exs
- Comprehensive tests (217 lines)README.md
- Added "Session Persistence and Multipath Exploration" section.gitignore
- Fixed to not block lib/multi_agent_coder directoryTest Plan
🤖 Generated with Claude Code