44 lines
864 B
Markdown
44 lines
864 B
Markdown
|
|
# TICKET-205: Build Session Persistence
|
||
|
|
|
||
|
|
**Epic:** EPIC-202
|
||
|
|
**Priority:** P0
|
||
|
|
**Status:** Ready
|
||
|
|
**Assignee:** Allegro
|
||
|
|
**Estimate:** 4 hours
|
||
|
|
|
||
|
|
## Description
|
||
|
|
|
||
|
|
Build JSON-based session persistence layer, more portable than SQLite.
|
||
|
|
|
||
|
|
## Acceptance Criteria
|
||
|
|
|
||
|
|
- [ ] `RuntimeSession` dataclass
|
||
|
|
- [ ] `SessionStore` class
|
||
|
|
- [ ] `save(session)` writes JSON
|
||
|
|
- [ ] `load(session_id)` reads JSON
|
||
|
|
- [ ] `HistoryLog` for turn tracking
|
||
|
|
- [ ] Sessions survive agent restart
|
||
|
|
- [ ] Tests pass
|
||
|
|
|
||
|
|
## Implementation Notes
|
||
|
|
|
||
|
|
Pattern from Claw `src/session_store.py`:
|
||
|
|
|
||
|
|
```python
|
||
|
|
@dataclass
|
||
|
|
class RuntimeSession:
|
||
|
|
session_id: str
|
||
|
|
prompt: str
|
||
|
|
context: dict
|
||
|
|
history: HistoryLog
|
||
|
|
persisted_path: Path
|
||
|
|
|
||
|
|
def save(self):
|
||
|
|
self.persisted_path.write_text(json.dumps(asdict(self)))
|
||
|
|
```
|
||
|
|
|
||
|
|
## References
|
||
|
|
|
||
|
|
- Claw: `src/session_store.py`
|
||
|
|
- Claw: `src/history.py`
|