AI Object Model Reference
Consolidated reference for Libra Agent object model and boundaries
AI Object Model Reference
This document is the consolidated reference for the current Libra Agent design.
Core Boundary
git-internal: immutable facts
Libra: current state / scheduling state / index projectionsThe system is split into three layers:
git-internalsnapshot objects answer: "what was defined at this revision?"git-internalevent objects answer: "what happened later?"- Libra projections answer: "what is the current operational view?"
Mutable runtime coordination must not be implemented by rewriting snapshot objects.
Layer Model
+--------------------------------------------------------------------------------------+
| Libra [L] |
|--------------------------------------------------------------------------------------|
| Thread / Scheduler / UI / Query Index |
| |
| current_intent_id |
| latest_intent_id |
| selected_plan_id |
| current_plan_heads[] |
| active_task_id / active_run_id |
| live_context_window |
| reverse indexes: intent->plans, task->runs, run->events, run->patchsets, ... |
+--------------------------------------------+-----------------------------------------+
|
v
+--------------------------------------------------------------------------------------+
| git-internal : Event [E] |
|--------------------------------------------------------------------------------------|
| IntentEvent / TaskEvent / RunEvent / PlanStepEvent / RunUsage |
| ToolInvocation / Evidence / Decision / ContextFrame |
| |
| Rule: append-only execution facts and audit records |
+--------------------------------------------+-----------------------------------------+
|
v
+--------------------------------------------------------------------------------------+
| git-internal : Snapshot [S] |
|--------------------------------------------------------------------------------------|
| Intent / Plan / Task / Run / PatchSet / ContextSnapshot / Provenance |
| |
| Rule: immutable definitions and revisioned structure |
+--------------------------------------------------------------------------------------+Placement Rules
Snapshot objects in git-internal
IntentPlanTaskRunPatchSetContextSnapshotProvenance
Event objects in git-internal
IntentEventTaskEventRunEventPlanStepEventRunUsageToolInvocationEvidenceDecisionContextFrame
Projection and runtime state in Libra
ThreadScheduler- UI-facing current view
- query indexes and reverse indexes
- live context window
- ready queue / parallel groups / checkpoints / retry routing
Main Relationship Graph
Snapshot layer
==============
Intent[S] --parents------------------------> Intent[S]
Intent[S] --analysis_context_frames-------> ContextFrame[E]
Plan[S] --intent_id----------------------> Intent[S]
Plan[S] --parents------------------------> Plan[S]
Plan[S] --context_frames-----------------> ContextFrame[E]
Task[S] --intent_id?---------------------> Intent[S]
Task[S] --parent_task_id?----------------> Task[S]
Task[S] --origin_step_id?---------------> Plan[S].step_id
Task[S] --dependencies-------------------> Task[S]
Run[S] --task_id------------------------> Task[S]
Run[S] --plan_id?-----------------------> Plan[S]
Run[S] --context_snapshot_id?-----------> ContextSnapshot[S]
PatchSet[S] --run_id---------------------> Run[S]
Provenance[S] --run_id---------------------> Run[S]
Event layer
===========
IntentEvent[E] --intent_id---------------> Intent[S]
IntentEvent[E] --next_intent_id?---------> Intent[S]
TaskEvent[E] --task_id-----------------> Task[S]
RunEvent[E] --run_id------------------> Run[S]
RunUsage[E] --run_id------------------> Run[S]
PlanStepEvent[E] --plan_id-----------------> Plan[S]
PlanStepEvent[E] --step_id-----------------> Plan[S].step_id
PlanStepEvent[E] --run_id?-----------------> Run[S]
ToolInvocation[E] --run_id-----------------> Run[S]
Evidence[E] --run_id-----------------> Run[S]
Evidence[E] --patchset_id?----------> PatchSet[S]
Decision[E] --run_id-----------------> Run[S]
Decision[E] --chosen_patchset_id?---> PatchSet[S]
ContextFrame[E] --intent_id?-------------> Intent[S]
ContextFrame[E] --run_id?----------------> Run[S]
ContextFrame[E] --plan_id?---------------> Plan[S]
ContextFrame[E] --step_id?---------------> Plan[S].step_id
Libra layer
===========
Thread[L] --------current_intent_id-------> Intent[S]
Thread[L] --------latest_intent_id--------> Intent[S]
Thread[L] --------intents[].intent_id-----> Intent[S]
Thread[L] --------intents[].is_head-------> marks current branch heads
Scheduler[L] -----selected_plan_id--------> Plan[S]
Scheduler[L] -----current_plan_heads------> Plan[S]
Scheduler[L] -----active_task_id----------> Task[S]
Scheduler[L] -----active_run_id-----------> Run[S]
Scheduler[L] -----live_context_window-----> ContextFrame[E]Libra Runtime Terms
Thread
Thread is the conversation-level projection root over a related
Intent DAG.
It owns the current conversational view, not immutable history.
Current design fields:
| Field | Type | Meaning |
|---|---|---|
thread_id | Uuid | Libra-side primary key |
title | Option<String> | Human-readable title |
owner | ActorRef | Conversation creator |
participants | Vec<ThreadParticipant> | Human and agent participants with thread-local metadata |
current_intent_id | Option<Uuid> | Intent currently focused by UI / Scheduler |
latest_intent_id | Option<Uuid> | Most recently linked Intent; resume fallback |
intents | Vec<ThreadIntentRef> | Ordered membership with ordinal, is_head, linked_at, link_reason |
metadata | Option<serde_json::Value> | UI and routing hints |
archived | bool | Closed thread marker |
Notes:
participantsis not justVec<ActorRef>; it carries thread-local role and join time metadata.head_intent_idsis represented byThreadIntentRef.is_head, not by a duplicated standalone array.current_intent_idis the current focus.latest_intent_idis the latest linked revision and default resume fallback when no current focus is set.
Scheduler
Scheduler is the runtime scheduling projection.
It answers: what should run now, what is active, and which plan branch is currently selected.
Current design fields:
| Field | Type | Meaning |
|---|---|---|
selected_plan_id | Option<Uuid> | Current canonical plan head in UI / runtime |
current_plan_heads | Vec<Uuid> | Active plan leaves |
active_task_id | Option<Uuid> | Task currently emphasized by Scheduler / UI |
active_run_id | Option<Uuid> | Live run attempt |
live_context_window | Vec<Uuid> | Current visible ContextFrame ids |
Scheduler may also derive or cache:
- ready queue
- parallel groups
- checkpoints
- retry routing
- staging / integration state
- replanning decisions
Query Index
Query Index is a rebuildable denormalized lookup layer for fast reads.
Typical indexes:
intent -> plansintent -> context_framestask -> runsrun -> eventsrun -> patchsets
Indexes are not historical truth and must be safe to rebuild.
Object Notes
Intent
Immutable snapshot of the user request and analyzed specification.
- keeps
parents,prompt,spec,analysis_context_frames - does not keep mutable lifecycle, selected plan pointers, or final execution outcomes
- lifecycle belongs to
IntentEvent
Plan
Immutable snapshot of strategy and step structure.
- keeps
intent,parents,steps,context_frames PlanStep.step_idis the stable logical step identity across plan revisions- runtime step progress belongs to
PlanStepEvent
There is no mutable ExecutionPlan object in git-internal.
Task
Stable work-unit definition.
- keeps immutable provenance links:
intent,parent,origin_step_id,dependencies - runtime status, retries, and active run belong to events or Libra projection
Run
Immutable execution-attempt envelope.
- keeps
task, optionalplan,commit, optionalsnapshot,environment - status transitions and failure details belong to
RunEvent - usage and cost belong to
RunUsage
PatchSet
Immutable candidate diff snapshot.
- keeps
run,sequence,commit,format,artifact,touched,rationale - acceptance, rejection, and final selection belong to
Decisionor Libra projection
Provenance
Immutable model / provider / execution-parameter record for one run.
- keeps provider, model, and execution parameters
- usage accounting is tracked separately by
RunUsage
ContextSnapshot
Optional stable environment baseline.
- used when the system needs a frozen starting or ending context
- not required for every phase
- should not be used as a mutable runtime context container
ContextFrame
Immutable incremental context fact.
- replaces the old mutable
ContextPipelineruntime concept - may be attached to intent analysis, planning, execution, or step-level context
- Libra keeps only the current
live_context_window
Workflow Mapping
| Phase | Libra runtime / projection | Snapshot writes (git-internal) | Event writes (git-internal) |
|---|---|---|---|
| Phase 0 | Thread bootstrap, Scheduler bootstrap, live context bootstrap | Intent, optional ContextSnapshot | none |
| Phase 1 | selected plan head, ready queue, checkpoints | Plan, Task | none |
| Phase 2 | live context window, retry / replan loop, staging area | Run, PatchSet, Provenance | TaskEvent, RunEvent, PlanStepEvent, ToolInvocation, Evidence, ContextFrame, RunUsage |
| Phase 3 | audit indexing, release candidate view | optional final ContextSnapshot | Evidence, Decision, terminal TaskEvent / RunEvent / IntentEvent |
| Phase 4 | review UI, current thread pointers | none | Decision, optional terminal IntentEvent |
Rebuild and Read Contract
Projection loss must not block read access.
Rules:
Thread,Scheduler, andQuery Indexare rebuildable from immutable snapshots and events.- Missing projection rows mean "projection missing or stale", not necessarily "the logical object does not exist".
- Read paths should prefer Libra projection first, then fall back to rebuild or history traversal when projection data is missing.
Examples:
Threadcan be rebuilt fromIntent,Intent.parents, andIntentEvent.next_intent_idedges.Schedulercan be rebuilt fromPlan,Task,Run,PlanStepEvent, and related execution events.- query indexes can be regenerated by scanning snapshot and event history.
Deprecated or Removed Concepts
The current design intentionally removes several older patterns:
- no mutable
ContextPipeline; uselive_context_window + ContextFrame - no mutable in-object lifecycle fields on
Intent,Task, orRun - no mutable
ExecutionPlanobject ingit-internal - no "accepted" field written back to
PatchSet
Summary Rule
1. Snapshot stores "what it is"
2. Event stores "what happened"
3. Libra stores "what is current"