Files
notarius/docs/adr/0026-core-owned-operation-preparation-and-execution.md

58 lines
3.0 KiB
Markdown

# ADR-0026: Core-owned operation preparation and execution
**Status:** Accepted
**Date:** 2026-11-25
## Context
The native continuation and application assessment decisions in
[ADR-0022](0022-use-native-continuation-and-application-assessment.md) remain
valuable, but module-composed producer mechanics left engine selection, cache
binding, candidate state, and terminal handling coupled to integrations. Three
registry families also repeated a reconciliation lifecycle around shared
proposal-safety primitives. A smaller helper or private state cleanup alone
would not establish an understandable core/integration boundary.
## Decision
Core invokes typed stage preparation and executes the resulting deterministic,
native, or explicit preparation-limit operation. Domain integrations own input
projection, prompt selection, interpretation, identity, correction assignment,
and supported fallback construction. Core owns assessment, native coordination,
reuse, capture, evaluation lifetime, and terminal disposition. Direct callers
use that same executor with an explicitly supplied execution context.
Each interpretation returns one evaluation containing its optional candidate,
actionable guidance, diagnostics, and optional evidence. Core assesses usable
candidates through the configured chain and clears the current evaluation before
a selected correction. Historical capture may retain prior evaluations but a
failed continuation cannot recover one as current output.
The domain-neutral reconciliation facility prepares fixed candidates and source
windows, assesses proposals, and applies each safe plan afresh through typed family
policy. Its evaluation retains omissions and family findings together with the
candidate. Families retain identity, compatibility, warning semantics, and
fallback invariants. This facility returns an operation to the same executor;
it is not another execution service or a domain-specific framework.
This decision supersedes only ADR-0022's module-composed producer mechanics.
Its native continuation, full assessment, guidance, cancellation, fallback,
and acceptance decisions remain in force. The fixed pipeline, PromptKit's
execution and structural repair ownership, ordinary error behavior, and existing
reuse contracts are unchanged.
## Alternatives Considered
Keeping module-invoked producer helpers with smaller closures would reduce local
complexity but leave integrations selecting execution collaborators and repeating
reconciliation coordination. A generic workflow DSL or second reconciliation
executor would introduce machinery beyond the demonstrated fixed-stage needs.
## Consequences
Integrations can be understood and tested as operation preparation with explicit
domain policy; the core owns one lifecycle for registered and direct callers.
Internal interfaces and tests move together, and evaluation-specific state must
remain operation-local. This does not establish a public SDK, a new scheduler,
blanket concurrency guarantees, or new fallback eligibility.