24 KiB
Core And Integration API Roadmap
Status And Purpose
Status: Target design and API decisions accepted; implementation pending.
This roadmap is the next implementation priority, before the remaining audit catalog remediation. It develops discussion Item 5 into an integration-author API initiative, rather than a private-helper cleanup. The document is a plan; this pass changes no application code.
Implementation Plan owns the ordered implementation stages and stage-specific validation. This document owns scope, target behavior, and the accepted design decisions.
The selected goals are:
- Make the boundary between Notarius core and integrations clear and well defined.
- Put as much demonstrated shared responsibility as practical in core, with a clean, flexible interface for integration-owned behavior.
- Make the API understandable and usable by future integration authors without requiring them to reconstruct the execution lifecycle from core internals.
Here, core means the framework contracts and orchestration, including shared producer and reconciliation facilities. Integrations means Notarius artifact families and their stage modules, validators, codecs, and domain behavior. It does not mean replacing the adopted kits' APIs with another abstraction.
The API is intended for multiple domains. The next anticipated integrations are an email processor and an NWS Forecast Discussion text processor. Existing D&D modules supply migration evidence, not the definition of what an integration or chunk must be.
Current Baseline
Reviewed baseline: f0ba5cce843182e0f5f3eaa6577110a087cf1422.
Production code is unchanged from the catalog's audited baseline
3887d89b763b7040efc866d4a57eb910d8778730; intervening changes are documentation.
go.mod selects Go 1.27.0, PromptKit v0.25.0, ConfigKit v1.4.0,
CommandKit v0.8.0, ckconfig v0.11.0, and ckprompt v0.12.0. No dependency upgrade is
required by this plan; assess any concrete upstream gap if implementation finds one.
The fixed typed pipeline and native-kit responsibilities are already implemented. Module Internals and Pipeline Internals describe current authoring and execution.
| Current surface | Responsibility and friction |
|---|---|
| Typed stage requests and producer contracts | Requests expose ProducerOperation[T], including assessor, controls, cache binding, execution options, and reuse eligibility. Authors carry framework plumbing through their module implementation. |
| RunProducer | Shares native execution, assessment, corrections, caching, and disposition, but its closures coordinate candidate, guidance, failure, acceptance, and capture state through mutable outer variables. |
| Producer outcome helpers | Integrations choose between RunProducer, AssessProducer, and FinishProducerFailure for model work, no-model answers, and preparation outcomes. Correct lifecycle composition remains part of the authoring recipe. |
| Spell extraction and scene planning | Modules prepare domain/native inputs, supply interpretation/correction/fallback closures, invoke the producer, and assemble typed outcomes. Scene planning also demonstrates correctable interpretation without a usable candidate. |
| NPC, item, and location reconciliation | Each repeats fixed-original preparation, proposal/evidence tracking, no-model and limit dispositions, correction construction, fallback bookkeeping, and result assembly around existing shared mechanisms. |
| Semantic reconciliation | Already provides neutral candidate preparation, proposal safety, request construction, and typed application. The missing sharing is primarily the lifecycle connecting those facilities to production. |
| Combat semantic validation | Executes one native assessment directly. It shares the native-usability classification defect with the producer, but is not a producer correction loop. |
The production migration inventory starts with ten D&D extractors (spells, combat turns, enemy events, scene descriptions, and NPC/item/location registries and occurrences), D&D scene planning, and the three registry normalizers. Combat/enemy extraction and registry reconciliation have no-model paths that must be exercised. Deterministic stage completion and typed registration/preparation also participate where they connect to the changed contracts. Confirm the caller inventory during implementation rather than treating these counts as invariants.
Targeted End State
Domain-Neutral Operations And Chunks
Core contracts describe sources, source units, chunks, typed artifacts, and operation outcomes. A scene is a D&D interpretation of a chunk, not a core chunk type that other integrations must imitate. Transcript speakers/timestamps, combat annotations, entity registries, and D&D identity rules belong to integrations where applicable; ordinary core operations do not require those concepts.
The existing source types already carry generic units, ranges, content, and metadata. Evaluate their fit through the new API rather than introducing a parallel source model preemptively. Source parsing, unit selection, chunk meaning, and domain metadata remain integration concerns; core owns generic plan materialization and orchestration. Neither a particular D&D chunk prompt nor scene-specific annotations define the authoring contract.
Use these anticipated scenarios alongside production D&D callers when evaluating the API shape:
| Scenario | Design question |
|---|---|
| Email processing | Can an integration prepare message content and its domain metadata, choose useful processing units/chunks, and produce typed results without transcript or scene conventions? |
| NWS Forecast Discussion text processing | Can an integration process document text using its own meaningful sections or other chunk boundaries and domain-specific findings, without entity-registry reconciliation being required? |
These are design scenarios, not settled input formats, extraction schemas, or chunking policies. A section/paragraph or whole-document chunk can illustrate an API walkthrough without prescribing either integration's final behavior. Support deterministic and model-assisted preparation where appropriate through the same core lifecycle; specialized reconciliation remains optional.
Develop small API sketches or synthetic fixtures to expose domain assumptions. Implementing the email and NWS processors, network ingestion, or their complete domain contracts is not part of this migration. If a walkthrough exposes a real source/chunk contract mismatch, identify and resolve that specific boundary rather than forcing the integration into scene terminology or promising arbitrary source topologies without evidence.
Ownership
| Responsibility | Target owner |
|---|---|
| Transport, credentials, native structural validation/repair, transient retries, exchanges, continuation iteration, and backend admission | PromptKit, through its native types and APIs |
| Configuration loading/composition and command parsing/rendering | ConfigKit, CommandKit, and their existing application integrations |
| Operation lifecycle, configured assessment, native continuation coordination, cache use, standard evidence, cancellation, and terminal mode application | Notarius core |
| Domain input preparation, prompt selection/native input construction, result interpretation, deterministic identity, and domain transformations | Integration |
| Validation meaning and actionable repair instructions | Detecting integration validator or interpretation rule; core collects and applies configured assessment |
| When supported fallback is selected and how it affects outcomes/reuse | Core, applying resolved policy |
| What constitutes a valid fallback and how to construct it | Integration, with existing intrinsic/downstream checks |
| Fixed-original and current-proposal reconciliation bookkeeping | Shared core reconciliation facility |
| Entity compatibility, typed proposal application, family diagnostics, and domain-specific reconciliation evidence | Integration, using family-shared helpers where appropriate |
| Physical publication, invocation debug allocation/finalization, and terminal reporting | Existing CLI/recorder boundary |
Core should own the complete shared lifecycle, not merely offer utilities that authors must arrange correctly. That does not require hiding native PromptKit requests/results or moving domain rules into the framework.
Core-Driven Typed Operations
Core calls the integration's preparation function and receives a small typed operation definition. It supplies either a deterministic candidate for assessment or a native initial request and the domain behavior needed to interpret results, construct corrections, and produce a supported fallback. Core consumes that operation and owns assessment, execution, continuation, caching, standard evidence, and terminal disposition.
Use ordinary Go data and functions or small interfaces for optional behavior. Distinguish meaningful preparation outcomes rather than building a large bag of unrelated optional fields. The operation definition is not a serializable workflow language or another configuration system. Exact type names and method signatures remain implementation choices within this accepted control flow.
An ordinary integration no longer selects assessment/cache collaborators, chooses terminal helpers, invokes an injected executor on each branch, tracks native capture finalization, or maintains framework acceptance state. Required inputs and optional capabilities should be clear from the author-facing types and examples. Standalone callers can use the same core executor.
Support the existing preparation outcomes: a deterministic answer, model work, an existing preparation-limit disposition, or an ordinary failure. Moving their handling into core must not turn arbitrary preparation errors into permissive recovery. A model-backed module may legitimately complete without a model call; deterministic work needs no manufactured prompt or cache key.
Changing internal stage interfaces and callers is part of the migration where needed. Retaining their current signatures or lifecycle plumbing is not the goal. This does not promise a versioned public SDK, dynamic plugin loading, or universal backwards compatibility.
Explicit Candidate Evaluation Results
Interpretation/application returns an explicit evaluation containing the usable candidate, if any, and its associated guidance, diagnostics, and applicable proposal-application information. Interpretation can return actionable correction guidance before it has a usable candidate. Core owns subsequent configured assessment and acceptance; supplying a candidate is not an approval claim.
Core replaces the evaluation as a unit and invalidates the previous candidate when selecting another execution, so a failed correction cannot revive stale candidate state. Candidate-associated findings must not survive accidentally in separate mutable integration variables. Earlier evaluations may remain in debug evidence without describing the final artifact.
Keep reconciliation-specific typed issues and omission information in the reconciliation facility or family adapter. Ordinary extraction does not acquire registry-specific fields. Families retain domain translation and diagnostic meaning. Fixed prepared inputs, lookup tables, and per-operation domain helpers remain legitimate; explicit evaluation results do not require all integration code to be pure or stateless. This decision does not expand cache payloads or the completion report.
Convenient Native Correction Requests
Provide a direct convenience path for the common case: the integration selects a native correction prompt and specifies how ordered guidance is supplied. Core collects applicable guidance and carries resolved execution selections; PromptKit carries conversation history. Existing native prompt declarations own message templates and schemas.
Also accept a native request builder for specialized domain correction material. The convenience path reduces to the same request-building mechanism as that custom path, with one execution/continuation lifecycle. It does not impose a universal guidance variable name, prompt schema, correction policy, D&D template, or scene-specific response shape.
Exercise both authoring forms with a simple extractor and a richer correction case. Exact field names and helper placement remain implementation details; the selected API supports the convenient default and native customization.
Reconciliation As A Focused Facility
Build a typed reconciliation facility on the same producer lifecycle. It owns fixed preparation, proposal decoding/safety bookkeeping, current-proposal replacement, standard evidence, and disposition handoff. Families supply records, candidate projections, prompts, application policies, fallback construction, and domain diagnostics. Reuse the existing neutral reconciliation mechanisms.
Preserve item currency compatibility, NPC naming/identity rules, and distinctions between same-named locations. Neutral proposal issues can be translated into family diagnostics by a D&D-local adapter; generic core need not import D&D. Ordinary extractors do not acquire reconciliation concepts they do not use.
The useful outcome is that family code reads primarily as domain preparation and policy. If a proposed common facility instead needs numerous family switches, revise the boundary rather than hiding three procedures in a configurable engine.
Native Result Handling
The CAT-007 correction is accepted. Share a small native usability check where
needed by producers and the LLM validator. Distinguish absent results, completed
failed validation, and actual native Go errors; retain useful validation details
without manufacturing promptkit.ErrValidation for completed content rejection.
Preserve producer disposition and validator unavailability as separate outcomes.
Correct the test that expects the wrong sentinel and the native fixture that
currently accepts an arbitrary error. This adds no repair loop or budget.
Behavioral Scope
This is an ownership/API migration. Existing selected behavior is the starting contract, as recorded in Architecture, Configuration, and the focused internal guides. In particular:
- Preserve complete configured assessment of each delivered usable candidate, including the last allowed revision; no duplicate outer assessment. An unusable interpretation may supply domain correction guidance without claiming a candidate.
- Keep native structural work upstream. Preserve growing native exchanges, explicit execution selections, and release of native admission before nested validation. A failed/result-less correction does not revive an earlier candidate.
- Apply reconciliation proposals afresh to fixed originals. Preserve final-only fallback behavior, ordinary deterministic error propagation, and cancellation precedence. Moving code must not widen fallback eligibility.
- Preserve accepted-result reuse under the original prepared message-content hash, current-source usability checks, and no semantic reassessment on hits. Store final accepted domain artifacts/plans, not exchanges or rejected proposals.
- Preserve fallback disclosure and dependency-specific reuse ineligibility, required-capture failure handling, and independent consumer-owned observation.
- Preserve typed artifact/codec compatibility, module selections, native prompt ownership, fixed stage boundaries, worker/admission separation, and domain output shapes.
These are references to existing behavior, not an invitation to freeze incidental callback order, private error prose, debug filenames, or implementation structures. Keep flexibility for concrete integration requirements. No new correction limits, input restrictions, shutdown guarantees, resource caps, or model-quality claims are selected here.
A redesign of input/output adapters, the CLI, registry discovery, or configuration composition is not needed merely to centralize producer behavior. Adapt their existing connections where necessary. Native LLM validators retain their one-shot assessment role; sharing usability/evidence support does not enroll them in the producer correction lifecycle.
Required Change Surface
- Author-facing typed stage contracts, registration, and core execution reflect preparation followed by core-owned production. The same executor serves registered and standalone callers. Deterministic work and preparation-limit dispositions have explicit paths without synthetic model requests.
- Candidate evaluation, correction request construction, assessment, cache use, and evidence have clear owners. Candidate-associated information is replaced as one evaluation; native capture state is independent. Existing internal helpers may remain where useful, without requiring integrations to compose them.
- Shared reconciliation connects existing neutral preparation, safety, and typed application mechanisms to the same lifecycle. The three registry families retain policy and diagnostics rather than duplicated coordination.
- Affected extraction, scene planning, normalization, deterministic completion, and programmatic callers use the selected boundary. One-shot validators share native usability handling without acquiring a producer correction loop.
- Module, pipeline, and D&D authoring guides describe the implemented API and its ownership and concurrency expectations. One minimal domain-neutral working example introduces the API; an existing registry provides the richer example. Architecture policy and significant ADR decisions reflect the resulting ownership while preserving accepted ADR bodies.
- Superseded authoring plumbing is removed, and overlapping audit findings have evidence-based statuses. Unrelated audit remediation remains separate work.
Verification And Completion Evidence
Use existing boundary tests and real native kits with offline provider fakes. Tests should protect behavior and author-facing contracts, not private callback sequences or exact struct layouts. Relevant starting points include producer, producer cache, operation completion, chunk-plan cache, and native capture tests.
Cover the distinct risks introduced by moving ownership:
- Registered typed extraction, scene planning, reconciliation, and no-model paths reach core execution without integration-owned assessment/disposition plumbing.
- A small non-D&D example exercises generic source/chunk handling and typed production without scene/combat fields or mandatory registry reconciliation. Email/NWS walkthroughs inform that example; complete processors are not required as verification dependencies.
- Replacing or invalidating a candidate also replaces or invalidates its associated findings; historical debug evidence remains distinguishable from final results.
- The convenient correction path and a specialized native builder preserve the selected prompt/input bindings, execution selections, and native history through the same core lifecycle, without requiring a universal guidance variable.
- Every usable revised candidate receives complete assessment; interpretation-only guidance can request correction; native failed checks retain details and do not become semantic approval or an extra structural-repair loop.
- Fixed-original reconciliation retains each family's expected output, fresh proposal application, and final-only fallback. Failed/undelivered corrections and caller cancellation retain their established behavior.
- Cache hits, accepted corrected writes, failed refresh, fallback-derived ineligibility, and cache/capture error distinctions survive the new boundary.
- Native evidence and supplied observers remain attached to actual executions; cache hits invent no model execution. Disabled evidence does not require expensive domain-only debug construction in the new API.
- Concurrent operations do not share candidate state; nested validation still works with limited native capacity. Reuse relevant worker/admission tests.
Place common lifecycle coverage in core and retain representative independent family tests. Simplify tests coupled to retired plumbing; do not derive expected domain outputs from the same helper under test. This is a coverage guide, not a new test for every row or an exhaustive cross-product requirement.
The Implementation Plan assigns focused and final checks under Testing Policy and Development. Completion evidence includes offline full tests, vet, build, and focused race checks for changed concurrency paths. No paid inference, benchmark target, coverage percentage, or new release gate is required. This planning pass has not run those implementation checks.
The roadmap is complete when affected production integrations use the selected
API, ordinary authors no longer compose the shared lifecycle, obsolete paths are
removed, behavior is verified, author guidance matches the implementation, and
the catalog is reassessed. The design has also been exercised against email and
NWS processing scenarios without making their domain behavior a core requirement.
A clearer private RunProducer alone is insufficient.
Relationship To The Audit
| Findings | Treatment in this roadmap |
|---|---|
| CAT-015 / CAT-016 | Central scope: replace coupled author-facing lifecycle responsibilities and duplicated registry reconciliation coordination. |
| CAT-007 | Accepted correction included at both producer and one-shot validator boundaries, including the misleading test oracle. |
| CAT-006 / CAT-008 / CAT-009 / CAT-022 / CAT-023 | Coordinate candidate/evidence/diagnostic lifetime changes where this migration touches them. Runner-wide finalization and CLI lifecycle issues remain outstanding unless separately demonstrated fixed. |
| CAT-003 / CAT-024 / CAT-025 / CAT-032 | Keep new optional evidence inexpensive and document actual concurrency. Apply the accepted whole-source capture direction if touched, but do not assume a package move or the entire capture inventory must be redesigned here. |
| CAT-014 / CAT-017 / CAT-018 | Accepted composition/copying direction remains valid. Make only changes required by the new registration/operation boundary; broader consolidation follows this initiative unless it becomes a concrete prerequisite. |
| Other entries | Reassess after migration; retain independent defects, optional cleanups, and CAT-034's resolved status. |
The accepted diagnostic retention, source-capture, signal, and composition choices in discussion Items 1–4 remain selected future work. This roadmap does not reverse them or silently incorporate all their implementation. If an overlapping fix is completed during this work, record its actual scope and tests. Catalog IDs are evidence references, not a mandate to close every entry.