Skip to content

API Reference parrot.flows.dev_loop.sdd_coder.optimization_models

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.flows.dev_loop.sdd_coder.optimization_models

View source

Versioned evidence, checkpoint, compaction and background contracts.

Spec sdd/specs/sdd-execution-optimization.spec.md (FEAT-584), modules M2 (evidence/events, R3), M4 (finalization/checkpoint, R4/R5), M5 (compaction receipt, R6) and M8 (background registry/status, R8). No logic, no I/O: these are pure Pydantic v2 data contracts (extra="forbid") consumed by later tasks' modules (evidence.py, checkpoint.py, phase_boundary.py, background.py). Identity fields are never inferred from free text -- they are validated against the same canonical shapes used elsewhere in sdd_coder (UUID execution_id, TASK-<digits> task ids, full git SHAs, sha256 hex digests, UTC timestamps).

Class BackgroundRegistration

Opaque launch identity bound to its true owner and worktree.

Attributes:

Attribute Type Description
handle str
execution_id str
task_id str | None
attempt_uid str | None
launch_id str
owner_instance_id str
kind Literal['mcp_job', 'validation', 'native_agent', 'host_bridge']
authority Literal['supervisor', 'engine', 'host_observation']
worktree str
backend str
started_at datetime | None
registered_log_ref EvidenceRef | None

Class BackgroundStatus

Known status is distinct from successful validation or task acceptance.

Attributes:

Attribute Type Description
state Literal['pending', 'running', 'finished', 'unknown']
outcome Literal['completed', 'failed', 'timed_out', 'cancelled'] | None
exit_code int | None
source str
authority Literal['supervisor', 'engine', 'host_observation']
verified_at datetime | None
stale bool
revision int
changed bool
log_tail str | None
log_ref EvidenceRef | None
log_truncated bool
elapsed_ms int
next_poll_after_ms int

Class CoderReviewReceipt

Ledger identity and optional durable artifact for a recorded review.

Attributes:

Attribute Type Description
feedback_id str
review_ref EvidenceRef | None

Class CompactionReceipt

Actual outcome, including unsupported or still-unsettled requests.

Attributes:

Attribute Type Description
checkpoint_id str
context_id str
status Literal['completed', 'skipped', 'unsupported', 'failed', 'in_progress']
reason str
backend Literal['jev', 'builtin', 'unknown']
before_bytes int | None
after_bytes int | None
before_tokens int | None
after_tokens int | None
elapsed_ms int

Class EvidenceRef

Resolve content-addressed references only under durable storage.

Attributes:

Attribute Type Description
artifact_id str
sha256 str
relative_path str
size_bytes int
media_type str

Class OptimizationModel

Reject extra keys; never manufacture unknown measurements.

Class ReviewArtifact

Durable semantic review recorded for one coder delivery.

Attributes:

Attribute Type Description
schema_version Literal[1]
kind Literal['task_review']
feature_slug str
task_id str
execution_id str
source Literal['coder_review', 'manual']
summary str
fix_commits list[str]
head_sha str
recorded_at datetime
attempt_uid str | None
backend str | None
model str | None

Class ReviewCheckpoint

Neutral continuation identity, criteria, constraints and evidence.

Attributes:

Attribute Type Description
schema_version Literal[1]
checkpoint_id str
feature str
execution_id str
worktree str
branch str
base_sha str
implementation_head str
spec_hash str
index_hash str
convention_hashes dict[str, str]
task_refs list[EvidenceRef]
criteria_refs list[EvidenceRef]
commits list[str]
validation_refs list[EvidenceRef]
evidence_refs list[EvidenceRef]
user_constraints list[str]
user_constraint_refs list[EvidenceRef]
pending_actions list[str]
settlement_ref EvidenceRef
neutral_brief str
context_id str | None

Method ReviewCheckpoint.compute_checkpoint_id

Compute the deterministic checkpoint_id for a field set excluding it.

Producers (spec M4 prepare_review_checkpoint) call this with every other field -- as raw values, EvidenceRef instances or their model_dump() form, either works -- to obtain the value to pass as checkpoint_id before constructing the model. Fields left out because they only carry their declared default (e.g. an empty user_constraint_refs) are filled in the same way the model itself would fill them, via an unvalidated model_construct, so the digest matches exactly what the model recomputes for itself on construction. The canonical JSON uses sorted keys and no insignificant whitespace so the digest is stable across processes and independent of field-construction order.

compute_checkpoint_id(**fields: object) -> str

Parameter Type Default Description
**fields object {}

Returns: str

Class TaskCompletionEvidence

Green checks and semantic review tied to one implementation revision.

Attributes:

Attribute Type Description
feature_slug str
task_id str
implementation_sha str
validation_refs list[EvidenceRef]
review_evidence EvidenceRef
fix_commits list[str]
completion_facts dict[str, object]

Class WorkflowEvent

One bounded event with explicit source and clock provenance.

Attributes:

Attribute Type Description
schema_version Literal[1]
event_id str
kind str
execution_id str
task_id str | None
attempt_uid str | None
job_id str | None
timestamp datetime
source Literal['engine', 'worker_observation', 'transcript_import']
payload dict[str, object]

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally