From a051f34bf6db92bef65871f7602f0d15ea12b27c Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Wed, 25 Nov 2026 14:26:07 +0000 Subject: [PATCH] Incorporate accepted integration API decisions into the roadmap --- docs/roadmap/audit/discussion.md | 4 +- docs/roadmap/core-integration-api.md | 178 +++++++++++++-------------- 2 files changed, 87 insertions(+), 95 deletions(-) diff --git a/docs/roadmap/audit/discussion.md b/docs/roadmap/audit/discussion.md index 1379120a..c5ccd80c 100644 --- a/docs/roadmap/audit/discussion.md +++ b/docs/roadmap/audit/discussion.md @@ -203,7 +203,7 @@ execution internals. Improving private producer state alone does not satisfy that target. Internal integration interfaces may change to achieve it. The [Core And Integration API Roadmap](../core-integration-api.md) now owns the -targeted end state, migration work, verification, and meaningful open API choices. +targeted end state, accepted API decisions, migration work, and verification. Execute that initiative before the remaining audit remediation, then reassess which findings remain against the resulting architecture. Items 1–4 remain accepted; later discussion items are not silently accepted by this change. @@ -212,7 +212,7 @@ CAT-007's native usability/error-detail correction is accepted and included in that roadmap. Producer disposition and validator unavailability remain distinct; no new structural repair loop or budget is selected. -**Decision:** Accepted direction; detailed API choices and implementation status +**Decision:** Accepted direction and API choices; implementation details and status are maintained in the linked roadmap. ## 6. Finalization, Completed Diagnostics, And Intermediate Lifetimes diff --git a/docs/roadmap/core-integration-api.md b/docs/roadmap/core-integration-api.md index ee8d8ca2..265f850e 100644 --- a/docs/roadmap/core-integration-api.md +++ b/docs/roadmap/core-integration-api.md @@ -2,7 +2,7 @@ ## Status And Purpose -**Status:** Direction accepted; detailed API choices open; implementation pending. +**Status:** Target design and API decisions accepted; implementation pending. This roadmap is the next implementation priority, before the remaining [audit catalog](audit/catalog.md) remediation. It develops @@ -116,36 +116,77 @@ 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. -### Integration Author Experience +### Core-Driven Typed Operations -An author describes one typed operation: prepare its domain material; provide a -deterministic candidate or the native request/interpretation behavior needed for -model work; supply supported correction and fallback behavior. Core runs the -appropriate lifecycle and assembles the resulting acceptance/fallback outcome. +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. -An ordinary integration no longer selects assessment/cache collaborators, decides -which terminal helper to invoke, tracks native capture finalization, or maintains -framework acceptance state. Required inputs and optional capabilities should be -clear from the author-facing types and documentation. The specific Go API is -selected under Open Decision 1, not prescribed by illustrative terminology here. +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. -Support the existing meaningful 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. +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. -Candidate-associated findings, guidance, and applicable proposal information -travel with the evaluation that produced them. Integrations should not need -parallel mutable variables to remember which findings belong to the final -candidate. Private fixed operation data and domain helpers remain legitimate; -this is not a requirement that all integration code be pure or stateless. +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. -Keep direct programmatic use straightforward through the selected core entry -point. Changing internal interfaces is allowed where it improves the target -boundary; retaining the present method signatures or lifecycle plumbing is not -the purpose of the migration. This does not promise a versioned public SDK, -dynamic plugin loading, or universal backwards compatibility. +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 @@ -215,13 +256,14 @@ producer correction lifecycle. - Inventory production and programmatic callers of the current producer/outcome helpers, typed operation requests/results, registration, and preparation. -- Resolve Open Decisions 1–3 with concrete API sketches for spell extraction, - registry normalization, and a no-model branch. Include scene-plan interpretation - that requests correction before a candidate can be materialized. -- Exercise those same choices with email and NWS Forecast Discussion processing +- Turn the accepted operation, evaluation-result, and correction-request designs + into concrete API sketches for spell extraction, registry normalization, and a + no-model branch. Include scene-plan interpretation that requests correction + before a candidate can be materialized. +- Exercise those same designs with email and NWS Forecast Discussion processing sketches. Check source/chunk inputs, domain metadata, result interpretation, correction guidance, and optional reconciliation for D&D assumptions before - settling the API. Keep format-specific decisions with the future integrations. + finalizing Go signatures. Keep format-specific decisions with the future integrations. - Specify which inputs are operation-owned or borrowed, which implementations are reused concurrently, and the lifetime of optional evidence hooks. Document actual behavior without promising arbitrary collaborator thread safety or @@ -235,8 +277,13 @@ requirement to create a large specification before trying representative callers ### 2. Establish Core-Owned Execution -- Implement the selected cohesive typed operation boundary and wire it through - registration/preparation and runner completion where necessary. +- Implement core invocation of integration preparation and consumption of the + returned typed operation. Adapt stage interfaces, registration/preparation, and + runner completion where necessary, retaining the same core entry point for + direct programmatic callers. +- Implement explicit candidate evaluation results and replace parallel mutable + candidate-associated state. Add the native correction convenience path and + custom request builder on one shared request/execution mechanism. - Make deterministic completion, native execution, correctable interpretation, assessment, preparation dispositions, and supported fallback explicit paths owned by core. Separate candidate state from pending native capture state. @@ -313,6 +360,11 @@ Cover the distinct risks introduced by moving ownership: 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. @@ -362,63 +414,3 @@ in [discussion Items 1–4](audit/discussion.md) remain selected future work. Th 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. - -## Open Decisions - -Evaluate each choice against both existing D&D callers and the anticipated email -and NWS scenarios above. Domain neutrality is selected direction, not an open -choice; the particular future formats, outputs, and chunking policies remain with -those integrations. - -### D1. How Integrations Hand An Operation To Core - -**Recommendation:** Prefer a small typed operation definition returned by the -integration and consumed by core. Use ordinary Go fields/functions for optional -behavior and keep lifecycle collaborators inside the executor. Preparation can -produce a deterministic candidate or model-backed behavior without the module -choosing execution helpers. This makes the ownership visible in control flow and -offers one understandable recipe; standalone callers can use the same executor. -Its cost is adapting current stage interfaces and representing the legitimate -preparation outcomes without an overly broad bag of optional fields. - -**Viable alternative:** Keep stage methods and supply an operation-scoped core -executor that the integration invokes once with its typed behavior. This reduces -registration changes and can fit existing custom preparation naturally. It still -centralizes mechanics, but leaves authors responsible for invoking the executor -on every relevant branch and risks recreating the current no-model/terminal -helper choreography. Select it only if representative callers are comparably -clear. Neither choice mandates a universal plugin interface or exported SDK. - -### D2. Carrying Candidate-Associated Domain Information - -**Recommendation:** Return candidate-associated guidance and diagnostics explicitly -from interpretation/application, with reconciliation-specific typed issue and -omission information retained by the reconciliation facility. Core replaces that -evaluation as one unit and invalidates the previous candidate when selecting a new -execution, so a subsequent failure cannot revive stale state. Keep domain translation in the -family adapter. This eliminates stale parallel closure state without teaching -generic execution about D&D; some result types and adapter signatures will change. - -**Viable alternative:** Permit a small per-operation typed domain session to retain -annotations, exposing explicit evaluate/finalize methods to core. This can handle -rich domain bookkeeping without propagating extra types through registration, -but invalidation and candidate/annotation correspondence are harder to inspect. -It should not become a session shared across concurrent operations. Compare both -shapes with item reconciliation's richer findings before fixing the API. - -### D3. The Convenient Correction-Request Authoring Path - -**Recommendation:** Offer a small convenience path for the existing common -pattern: a native correction prompt and ordered guidance, with core carrying the -resolved execution selections and PromptKit carrying history. Retain a native -request-builder option for domain-specific correction material. Existing prompt -declarations still own templates and schemas. This removes repeated request glue -while retaining flexibility, at the cost of two authoring forms that need a clear -relationship; the convenience form should reduce to the same native builder path. - -**Viable alternative:** Require every integration to provide a native correction -request builder, with one shared helper available for ordinary guidance binding. -This has a smaller formal API and maximum visible control, but repeats more setup -and places selection propagation details closer to authors. It is reasonable if -the helper makes ordinary examples just as direct. Neither choice fixes all -integrations to one prompt schema, guidance variable name, or correction policy.