session_store
session_store
¶
SQLite-backed storage for distillation LearningSession records.
Mirrors the style of openjarvis.learning.optimize.store.OptimizationStore:
- stdlib
sqlite3in WAL mode - inline DDL as module-level constants
- persistent connection stored as
self._conn _migrate()runs additive ALTER TABLEs that swallowOperationalError
The store does NOT share its database file with OptimizationStore (see
spec §8.1 / brainstorming Q8). The two SQLite files live side-by-side in
~/.openjarvis/learning/ but are independent.
Classes¶
SessionStore
¶
SQLite-backed storage for LearningSession and EditOutcome records.
The full LearningSession is also serialized to disk as
<session_dir>/session.json — that file is the authoritative source
if SQLite is ever lost. This store is the index used for fast queries.
Source code in src/openjarvis/learning/distillation/storage/session_store.py
Functions¶
close
¶
save_session
¶
save_session(session: LearningSession) -> None
Insert or update a LearningSession (idempotent on session.id).
Source code in src/openjarvis/learning/distillation/storage/session_store.py
get_session
¶
get_session(session_id: str) -> Optional[LearningSession]
Return the LearningSession with the given id, or None if missing.
Source code in src/openjarvis/learning/distillation/storage/session_store.py
list_sessions
¶
list_sessions(status: SessionStatus | None = None, limit: int | None = None) -> list[LearningSession]
List sessions ordered by started_at DESC.
Source code in src/openjarvis/learning/distillation/storage/session_store.py
save_outcome
¶
save_outcome(session_id: str, outcome: EditOutcome, *, pillar: str, op: str, target: str, risk_tier: str, rationale: str = '') -> None
Insert an EditOutcome row.
pillar, op, target, risk_tier, and rationale come
from the parent Edit (which is not stored on the EditOutcome
model). They are kept as columns to make WHERE op = ? queries
possible without joining against the on-disk plan.json.
Source code in src/openjarvis/learning/distillation/storage/session_store.py
list_outcomes
¶
list_outcomes(session_id: str) -> list[EditOutcome]
Return all EditOutcomes for a session, ordered by insertion id.