|
Add session message archive table + global sequence_number tracking
Schema: - session_messages_archive — identical structure, stores old messages. - sessions.next_sequence — monotonic seq counter per session. - sessions.archive_threshold — split point between hot and archive. Behaviour: - get() / _build_sessions() load only seq >= archive_threshold (hot). - save() UPDATEs existing rows (seq >= 0) and INSERTs new ones (seq = -1) with auto-assigned sequence_number = next_sequence, next_sequence+1, ... - archive_old_messages() moves a batch to archive and bumps the threshold. This keeps the hot table bounded so list/get RAM stays flat regardless of total session history size. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
|---|
|
|
| navi/core/pg_session_store.py |
|---|
| navi/core/session.py |
|---|
| navi/llm/base.py |
|---|