models
models
¶
Pydantic models and enums for the distillation subsystem.
This module defines the typed vocabulary used by the diagnose, plan, execute, and record phases. Three model families:
- Enums: pillar / risk tier / op / trigger kind / autonomy mode / session status
- Edit + LearningPlan + FailureCluster: the teacher's frozen output
- LearningSession + EditOutcome + BenchmarkSnapshot: the durable session record
See spec §4 for the data model rationale.
Classes¶
EditPillar
¶
Bases: str, Enum
Which OpenJarvis pillar an edit targets.
EditRiskTier
¶
Bases: str, Enum
How an edit gets applied: auto, review queue, or manual-only.
EditOp
¶
Bases: str, Enum
The set of typed operations a teacher can propose.
Each op corresponds to one EditApplier in v1 (or a refusing stub for deferred ops). The teacher cannot invent new ops — only choose from this set.
TriggerKind
¶
Bases: str, Enum
What kicked off a learning session.
AutonomyMode
¶
Bases: str, Enum
How aggressively the orchestrator applies edits without review.
SessionStatus
¶
Bases: str, Enum
Lifecycle states for a LearningSession.
See spec §7.7 for the transition rules.
Edit
¶
Bases: BaseModel
One atomic edit to the OpenJarvis harness.
Emitted by the LearningPlanner, consumed by an EditApplier. The teacher
proposes the op, target, payload, rationale, and references; the planner
overwrites risk_tier deterministically from the (pillar, op) lookup
table — the teacher cannot pick its own tier.
See spec §4.1.
FailureCluster
¶
Bases: BaseModel
A group of failing traces that share a hypothesised root cause.
Populated by the teacher in the diagnose phase. The student/teacher rates
must come from real run_student_on_task and run_self_on_task calls
against benchmark tasks (see spec §5.3); clusters where both rates are
missing or zero are dropped by the planner.
See spec §4.2.
LearningPlan
¶
Bases: BaseModel
The teacher's frozen plan of edits for a learning session.
Once written to <session_dir>/plan.json this is immutable. The
execution layer reads this file and does not re-prompt the teacher.
See spec §4.2 and §6.
BenchmarkSnapshot
¶
Bases: BaseModel
A point-in-time score from running the personal benchmark.
Two of these live on every LearningSession: one captured before any edits apply, one captured after. The version is locked at session start so the delta is interpretable even if the benchmark is refreshed mid-session.
See spec §4.3 and §9.
EditOutcome
¶
Bases: BaseModel
Result of attempting to apply one Edit.
Persisted both in the SessionStore SQLite table and as part of the session.json artifact. The status literal is the canonical lifecycle for each edit.
See spec §4.3.
LearningSession
¶
Bases: BaseModel
The durable record of one distillation session.
Persisted in two places: <session_dir>/session.json (authoritative) and
the SQLite SessionStore (queryable index). When in doubt, prefer the JSON
file — SQLite can be rebuilt from the JSON files.
See spec §4.3, §7.7 (status transitions), §8.