Resolve native prompt asset and schema design

This commit is contained in:
2026-11-20 12:45:00 +00:00
parent 2eaea2b1fd
commit 0833450c71
3 changed files with 115 additions and 93 deletions

View File

@@ -240,8 +240,8 @@ content tree and module ownership of prompt meaning, response requirements, and
domain interpretation. Remove prompt/fallback-profile registration in
`AssetRegistry`, per-module `PromptAssetManifest` plumbing, `ModulePromptFS`,
shared-name maps, synthetic `sharedassets` mounts, and manual prompt enumeration
for checkpoint fingerprints. Schema-related registry responsibilities remain
subject to the explicit schema decision below.
for checkpoint fingerprints. The resolved schema design below also removes
schema registration and filesystem-flattening machinery.
Convert maintained resources, examples, and fixtures to native identified lists,
`config:` source controls, and sibling inheritance (`extends: {id: parent}`).
@@ -268,19 +268,61 @@ for accumulated conversation history; preserving every old byte or retry message
is not a migration requirement. Shared content should use native filesystem
contexts and imports rather than reconstructed virtual trees.
PromptKit owns private model-response validation and structural repair. Native
schemas resolve against the configured schema root, separately from message-file
contexts. The reviewed baseline requires self-contained schemas loaded during
preparation.
A request override replaces the complete output contract; it must retain the
intended schema, validation mode, and repair policy. A prompt hash alone does not
establish schema equality.
#### Prompt Assets And Response Schemas (U2 Resolved)
The custom read-only filesystem, schema root/path selection, module-supplied
request contracts versus prompt-declared contracts, wrapper removal, and useful
schema metadata remain open. An ordinary embedded schema filesystem, as used by
Audita, is a candidate rather than a selected requirement. Durable artifact
schemas and their validators remain distinct from private response schemas.
Use the existing root `assets` package's ordinary `embed.FS` directly for native
prompt sources and response schemas, with `fs.Sub` only where useful. Shared
message files use their actual paths within the native filesystem context.
Remove synthetic mounts, file copying, flattened schema namespaces, and module
asset manifests. Retire `readonlyfs` when its prompt-mounting and asset-flattening
consumers disappear; no replacement filesystem abstraction is needed.
Declare response format, validation mode, schema path, and structural-repair
budget in native prompt definitions by default. Modules select prompt IDs, supply
inputs, and interpret responses. Initial and correction prompts may reference
the same schema file. Execution, inspection, and prepared-request preview then
use the same declared contract without repeating schema selection in Go.
Role-specific prompt contents remain U4, and retry defaults remain U5.
Use a request-level native `OutputContract` only for a demonstrated runtime-
dependent contract. It replaces the whole configured contract, so supply the
intended format, validation mode, schema, and repair policy together. Do not
introduce a wrapper or per-call registry solely to reproduce Audita's approach.
Operator prompt replacements must still produce responses the selected module
can interpret; that module boundary does not require duplicating each prompt's
schema selection in Go.
Default to native `WithSchemaFS(assets.FS(), ".")`. Schema paths are relative to
that selected root, for example `dnd/spells/schemas/dnd_spells_llm.v1.json`.
They are separate from message-file source contexts: prompt underlays do not
implicitly overlay schema files. When an operator configures an external schema
directory, select PromptKit's native directory source instead of the embedded
root. It replaces the whole schema source and must supply the schemas used by
the selected prompts. Do not build an application filesystem overlay to mix
embedded and external schemas. Transparent layering would be a separate upstream
capability, not a requirement for this migration. Concrete configuration binding
is an implementation detail within this selected source policy.
Keep private response schemas as self-contained JSON documents. PromptKit owns
loading, compilation, structural validation, provider structured-output settings,
and structural repair. Remove Notarius's response-schema byte registry, copied
schema wrappers, defensive-copy layer, digest calculation, and duplicate
structural-validation machinery. Native prepared snapshots provide diagnostic
schema details; no schema fingerprint is added to the message-content cache key.
Keep typed decoding, source/reference checks, reconciliation safety, semantic
validators, artifact codecs, and durable artifact schemas in Notarius. Response
schemas describe model output; artifact schemas describe published and consumed
domain artifacts. Preserve identifiers and versions belonging to actual artifact
contracts. Retire private schema keys, registration records, hashes, and copied
identity/version/name metadata whose only consumers were adapters, checkpoints,
or reporting. No independent schema metadata system replaces them.
Implementation is pending. Verify native preparation of embedded and operator
prompt definitions, shared-file paths, schema selection from embedded and external
roots, and complete request-contract replacement where actually used. Missing or
invalid schemas should follow native preparation behavior. No new schema check
requiring synthetic requests is added to offline pipeline preflight.
### Native Production, Continuation, And Assessment
@@ -669,7 +711,6 @@ reopen the architecture. IDs retain continuity with the earlier roadmap.
| ID | Remaining choice or dependency | Resolve for |
| --- | --- | --- |
| U1 | Supplying PromptKit API/release for the requested message-content hash; verify the final compatible dependency set against the selected baseline. The upstream request is pending. | Track in Phase 1; required to finish cache integration in Phase 5. |
| U2 | Custom read-only filesystem responsibilities; schema root/path and assembly; prompt-declared versus per-request contracts; removable wrappers and useful artifact-compatibility/inspection metadata. Mandatory manifest metadata is retired. | Phase 2. |
| U3 | Concrete module/pipeline signatures and helper placement for request construction, interpretation, assessment, and native engine assembly. | Implementation detail in Phase 3, refined in Phase 4. |
| U4 | Role-specific initial/repair definitions, response contracts, and profile selection within complete replacement and fixed operation inputs. | Phases 3–4. |
| U5 | Producer/validator retry-setting migration to native controls and semantic budgets: field names/defaults, non-LLM failure handling, and any justified recovery beyond native exhaustion. | Phases 3–4 and configuration migration. |
@@ -678,6 +719,12 @@ reopen the architecture. IDs retain continuity with the earlier roadmap.
| U8 | Cache directory configuration and reuse/bypass/refresh controls (names, defaults, scope); old-checkpoint treatment and unusable-entry diagnostics. Hash inputs, lookup timing, accepted value, and ownership are settled. | Design with Phase 3; finish in Phase 5. |
| U9 | Observer/group enrollment and application scope; concrete conditional report fields and debug filenames/serialization within the agreed contracts; publication-layout/consumer migration details preserving intrinsic artifact schemas. | Implementation details in Phases 3–5; no new receipt/manifest inventory or capture-policy decision required. |
**U2 resolved:** Ordinary embedded assets, prompt-declared output contracts,
native schema-source selection, and removal of duplicate schema/filesystem
machinery are selected in [the schema design](#prompt-assets-and-response-schemas-u2-resolved).
Implementation remains in Phase 2; role-specific prompts and retry budgets remain
U4/U5.
**U10 resolved:** CommandKit versions, capabilities, commands, loaders/preflight,
output, debug policy, and coordinated cutover sequencing are selected above.
The former later CommandKit phase is retired. CLI compatibility is a non-goal;
@@ -698,8 +745,8 @@ major boundary changes in successor ADRs without rewriting accepted decisions.
Keep the cache dependency explicit without blocking independent work.
- Map affected ADRs, current callers, contracts, and removal inventory. Carry
forward Audita evidence without adopting its application wrappers.
- Preserve U2–U9 with their dependent phases; do not treat resolved CommandKit,
debug, cache, or output choices as requirements to redesign.
- Preserve U3–U9 with their dependent phases; do not treat resolved assets/schemas,
CommandKit, debug, cache, or output choices as requirements to redesign.
**Completion evidence:** reviewed dependency baseline, upstream dependency, scope,
and outstanding choices are explicit. This phase does not claim that the hash
@@ -707,15 +754,17 @@ already exists or that the migration is implemented.
### Phase 2: Build Native Composition, Sources, And Preflight
- Resolve U2, update available dependencies, introduce configuration version 6,
convert native embedded/companion resources, and establish schema loading.
- Implement the resolved U2 design, update available dependencies, introduce
configuration version 6, convert native embedded/companion resources, and use
native schema loading with embedded/default or operator-selected roots.
- Build the small CommandKit application, shared ConfigKit/engine loaders,
standard suites, pipeline declarations/native alias, and `internal/preflight`.
- Add maintained embedded-only and operator-override examples. Remove duplicated
loading and asset assembly as callers migrate.
**Completion evidence:** runtime/inspection/preflight share intended definitions;
source contexts, strict peer conflicts, and replacement work offline. Help,
source contexts, shared message paths, prompt-declared output contracts, selected
schema roots, strict peer conflicts, and replacement work offline. Help,
version, and completion need no configuration. Preflight checks known dependencies
without credentials or synthetic requests. `config diff` handles two selections.
@@ -784,7 +833,8 @@ Release preparation/publication is governed separately by release policy.
| Retire or replace | Retained application responsibility |
| --- | --- |
| `StructuredLLMClient`, private request/response types, adapter conversions | Native request construction and typed interpretation. |
| Prompt/profile `AssetRegistry`, `PromptAssetManifest`, `ModulePromptFS`, synthetic mounts, manual fingerprint enumeration | Embedded content and module meaning; schema choices under U2. |
| `AssetRegistry`, `PromptAssetManifest`, `ModulePromptFS`, synthetic mounts, flattened schema namespaces, `readonlyfs`, manual fingerprint enumeration | Ordinary embedded content, native source assembly, and module meaning. |
| Private response-schema registry/wrappers, byte copies, digest and reporting-only identity metadata, duplicate structural validation | Native prompt output contracts and schema loading; application interpretation and durable artifact contracts. |
| `single_response_v1`, raw `ModelCandidate`/`SemanticCorrection`, manual replay, correction capability checks | Typed candidates, actionable findings, native exchanges, assessment. |
| LLM retry loops in `runProducerAttempts`/`executeValidationChain`, module rerun directives | Ordered validators, domain acceptance/rejection/fallback. |
| `Scheduler`, `scheduledClient`, `concurrency.total_llm`, worker coupling | Bounded pipeline work and native backend admission. |
@@ -805,7 +855,7 @@ retry tests or freeze complete help text and native debug snapshots.
| Area | Required evidence |
| --- | --- |
| Configuration/assets | Version 6/new resources work; old formats intentionally rejected; companions/native imports retain main-source context; peer conflicts fail; same-ID replacement and selected schemas work. |
| Configuration/assets | Version 6/new resources work; old formats intentionally rejected; companions/native imports retain main-source context; peer conflicts fail; same-ID replacement, real shared-file paths, prompt-declared contracts, and embedded/external schema roots work; necessary request overrides replace the complete contract. |
| Commands/loaders | Required operands, native alias, supplied-value distinctions, references, and run-wide overrides reach intended handlers/roles; help/version/completion need no config; diff selections remain distinct. |
| Preflight/inspection | Same definitions across execution and inspection; missing statically selected resources fail with context; partial profiles alone pass; no provider calls, transcript, or credential requirement for offline preflight. |
| Domain workflow | Representative extraction and normalization preserve source/reference identity, fixed handles, safe plan application, ordered validators, artifact schemas, and stable output ordering. |