Skip to content

API Reference parrot.knowledge.wiki.decisions.models

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

parrot.knowledge.wiki.decisions.models

View source

Typed contracts for the ADR decision plane (FEAT-578 Module 1).

Every model is Pydantic v2 with extra="forbid" and JSON-safe field types, so a record round-trips through the canonical JSON envelope in decisions/codec.py without custom encoders.

Attribute ADR_CATEGORY

Attribute ADR_EVIDENCE_CHANGED

Attribute ADR_GENERATION_LIMIT

Attribute ADR_INVALID_ARGUMENT

Attribute ADR_INVALID_ID

Attribute ADR_INVENTORY_LIMIT

Attribute ADR_MANAGED_PAGE

Attribute ADR_MODEL_FAILED

Attribute ADR_MODEL_TIMEOUT

Attribute ADR_MODEL_UNCONFIGURED

Attribute ADR_PARSE_FAILED

Attribute ADR_PATH_OUTSIDE_ROOT

Attribute ADR_READ_ONLY

Attribute ADR_RECORD_TOO_LARGE

Attribute ADR_REFERENCE_AMBIGUOUS

Attribute ADR_REFERENCE_MISSING

Attribute ADR_REVISION_CONFLICT

Attribute ADR_SCHEMA_UNSUPPORTED

Attribute ADR_SOURCE_UNAVAILABLE

Attribute ADR_STATUS_CONFLICT

Attribute ADR_SUPERSESSION_CYCLE

Attribute ADR_WRITE_UNSUPPORTED

Attribute APPROVAL_LOCAL_BASE

Attribute APPROVAL_MANIFEST_INVALID

Attribute APPROVAL_UNVERIFIED

Attribute AUDIT_NOT_CONFIGURED

Attribute BATCH_PARTIAL

Class CandidateBatch

The structured-output contract handed to AbstractClient.invoke.

Attributes:

Attribute Type Description
candidates list[CandidateDraft]

Class CandidateDraft

One model-authored candidate. The model supplies content only.

Attributes:

Attribute Type Description
title str
context str
decision str
consequences str
observations list[str]
hypotheses list[str]
evidence_indexes list[int]

Class CandidateEdit

The only fields a maintainer revision may change.

Attributes:

Attribute Type Description
title str | None
context str | None
decision str | None
consequences str | None
observations list[str] | None
hypotheses list[str] | None

Attribute DECISION_REF_HISTORICAL

Class DecisionConfig

Project-level ADR settings; generation is opt-in and off by default.

Attributes:

Attribute Type Description
enabled bool
adr_globs list[str]
max_records int
generation_enabled bool
max_input_tokens int
max_output_tokens int
max_files int
max_candidates int
timeout_seconds int
local_prefix str | None
known_prefixes list[str]

Method DecisionConfig.effective_prefixes

Return configured foreign prefixes plus the optional local prefix.

effective_prefixes() -> frozenset[str]

Returns: frozenset[str]

Class DecisionDiagnostic

A non-fatal condition reported alongside a typed result.

Attributes:

Attribute Type Description
code str
message str
path str | None
decision_id str | None

Class DecisionDossier

The retrieval result — documented and candidate groups stay separate.

Attributes:

Attribute Type Description
status Literal['ok', 'empty', 'ambiguous', 'partial', 'error']
documented list[DecisionHit]
candidates list[DecisionHit]
alternatives list[str]
diagnostics list[DecisionDiagnostic]
truncated bool

Class DecisionError

A typed ADR failure carrying one of the fixed codes above.

Parameter Type Default Description
code str
message str
decision_id str | None None

Class DecisionHit

One ranked decision with its labels, score, and citations.

Attributes:

Attribute Type Description
decision_id str
revision int
title str
origin Literal['documented', 'inferred']
source_status str
review_status Literal['unreviewed', 'accepted', 'rejected']
freshness Literal['current', 'stale', 'missing', 'unverified']
score float
decision str
applicability list[DecisionLink]
citations list[EvidenceRef]

Class DecisionLink

A typed, provenance-tagged association to another page or record.

Attributes:

Attribute Type Description
target_id str
relation Literal['explains', 'supported_by', 'supersedes', 'contradicts', 'about']
provenance Literal['extracted', 'inferred', 'asserted']
evidence_indexes list[int]

Class DecisionRecord

The single canonical, versioned record persisted per adr: page.

Attributes:

Attribute Type Description
schema_version Literal[1, 2]
decision_id str
revision int
title str
context str
decision str
consequences str
source_status Literal['unknown', 'proposed', 'accepted', 'rejected', 'deprecated', 'superseded']
source_status_raw str
origin Literal['documented', 'inferred']
review_status Literal['unreviewed', 'accepted', 'rejected']
source_path str | None
external_id str | None
evidence list[EvidenceRef]
links list[DecisionLink]
observations list[str]
hypotheses list[str]
review_history list[ReviewEvent]
generation GenerationInfo | None
content_fingerprint str
normative Literal['constrains', 'forbids', 'requires'] | None
about list[str]
targets list[DecisionTarget]
contradicts list[DecisionRef]
supersedes_refs list[DecisionRef]
document_id str | None
entry_id str | None
batch_id str | None
lifecycle Literal['active', 'retired']
rationale str
rejected_alternatives list[str]

Class DecisionRef

Exact (decision_id, revision) reference to another decision (FEAT-784).

Attributes:

Attribute Type Description
decision_id str
revision int

Class DecisionTarget

Typed structural target; kind must match the id prefix (FEAT-784).

Attributes:

Attribute Type Description
target_id str
kind Literal['symbol', 'file', 'dir']

Class EvidenceRef

One cited source span with the hash of the bytes it was read from.

Attributes:

Attribute Type Description
page_id str
rel_path str
start_line int
end_line int
source_sha1 str
excerpt str
kind Literal['adr', 'code', 'comment', 'document']

Class GenerationInfo

Provenance of one bounded model invocation that produced a candidate.

Attributes:

Attribute Type Description
model_spec str
prompt_version Literal[1]
scope_id str
input_sha1 str
max_input_tokens int
max_output_tokens int

Class GenerationResult

Ids written, ids reused for the same evidence, and per-candidate failures.

Attributes:

Attribute Type Description
decision_ids list[str]
reused list[str]
diagnostics list[DecisionDiagnostic]

Attribute MAX_RECORD_BYTES

Class ReviewEvent

One attributed review action, hashed before and after.

Attributes:

Attribute Type Description
revision int
action Literal['accept', 'reject', 'revise', 'link']
actor str
timestamp str
reason str
before_sha1 str
after_sha1 str

Class ReviewRequest

An attributed, revision-checked review action.

Attributes:

Attribute Type Description
decision_id str
expected_revision int
action Literal['accept', 'reject', 'revise', 'link']
actor str
reason str
replacement CandidateEdit | None
documented_decision_id str | None

Attribute SCOPE_INCOMPLETE

Attribute SNAPSHOT_UNSTABLE

Attribute SPEC_BLOCK_INVALID_YAML

Attribute SPEC_BLOCK_MISSING

Attribute SPEC_DANGLING_REF

Attribute SPEC_DUPLICATE_ENTRY_ID

Attribute SPEC_EMPTY_ABOUT

Attribute SPEC_EMPTY_TARGETS

Attribute SPEC_INVALID_ID

Attribute SPEC_UNKNOWN_FIELD

Attribute SUPERSESSION_INVALID

Class SyncResult

Counts and diagnostics from one ADR refresh pass.

Attributes:

Attribute Type Description
created int
updated int
unchanged int
missing int
unresolved int
diagnostics list[DecisionDiagnostic]

Attribute TARGET_FOREIGN

Attribute TARGET_UNRESOLVED

Attribute TAXONOMY_INVALID

Attribute WAIVER_INVALID

Function as_json_dict

Dump a model in JSON mode — the only shape the codec and CLI emit.

as_json_dict(model: BaseModel) -> dict[str, Any]

Parameter Type Default Description
model BaseModel

Returns: dict[str, Any]

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