359 Commits

Author SHA1 Message Date
752c9b44d2 Draft release notes for v0.10.0 2026-11-29 18:47:48 +00:00
822e050010 Remove completed shared schema plans 2026-11-29 18:46:09 +00:00
41a5c43561 Complete shared domain contract verification 2026-11-29 18:28:59 +00:00
9dc976afaf Migrate examples and guidance to shared domain inputs 2026-11-29 18:22:32 +00:00
f05d2e593e Verify shared references in run and preflight 2026-11-29 18:18:25 +00:00
03e4c0d64d Prepare shared context for all D&D extractors 2026-11-29 18:13:45 +00:00
e0554209f0 Prepare structured D&D reference context 2026-11-29 18:09:09 +00:00
f84e737b2a Recognize spells from shared glossary documents 2026-11-29 18:04:00 +00:00
d406aa6cd2 Preserve selected collections in materialized references 2026-11-29 17:59:01 +00:00
10221b0624 Carry collection selections through configuration 2026-11-29 17:53:36 +00:00
a0c5ca8761 Validate shared domain documents offline 2026-11-29 17:50:18 +00:00
95e5402efc Load shared references with ConfigKit 2026-11-29 17:48:37 +00:00
0361b199c4 Bundle pinned shared domain contracts 2026-11-29 17:47:34 +00:00
30bc424343 Pin the released shared schemas for implementation 2026-11-29 17:44:05 +00:00
bfd9556a9e Use native ConfigKit loading for shared references 2026-11-29 16:33:35 +00:00
ea163dd5dd Keep shared YAML support within native parser capabilities 2026-11-29 15:44:05 +00:00
8e0f155464 Plan the shared schema implementation sprint 2026-11-29 15:27:50 +00:00
3ba68e6461 Adopt a direct cutover for shared reference inputs 2026-11-29 15:24:02 +00:00
deaf5ab924 Choose reference bindings for collection selection 2026-11-29 15:21:23 +00:00
9783b79731 Plan shared domain schema adoption 2026-11-29 15:11:45 +00:00
bff0fb44e8 Request shared schema adoption for Narratio inputs 2026-11-29 14:59:10 +00:00
2be1716520 Retire completed preflight planning documents 2026-11-28 16:23:29 +00:00
460d368d8e Retain cancellation at the final readiness handoff 2026-11-28 16:15:57 +00:00
4801d0aac1 Skip preflight evidence setup when capture is disabled 2026-11-28 16:14:43 +00:00
00112f6fc2 Build preflight target associations in linear time 2026-11-28 16:14:09 +00:00
95d46c7da3 Keep raw runtime parameters out of early capture 2026-11-28 16:12:52 +00:00
63cdd7a7c5 Clarify run and preflight documentation boundaries 2026-11-28 16:11:07 +00:00
f4951b9bde Preserve smoke observer failures independently of readiness 2026-11-28 16:10:49 +00:00
33e8309322 Record preflight scalability improvements 2026-11-28 16:04:11 +00:00
3df1a53b5a Record preflight integration audit findings 2026-11-28 15:52:56 +00:00
ab445439cc Record preflight review findings 2026-11-28 15:43:27 +00:00
c08e5ab670 Complete pipeline preflight verification 2026-11-28 04:45:29 +00:00
d5056d77b6 Align internal guidance with pipeline preflight 2026-11-28 04:35:07 +00:00
5382058b28 Document pipeline preflight for consumers and operators 2026-11-28 04:34:14 +00:00
71cefdd154 Verify assembled pipeline preflight workflow 2026-11-28 04:32:40 +00:00
71239b6fbb Capture pipeline readiness diagnostics and failures 2026-11-28 04:26:30 +00:00
97642c491f Add pipeline readiness command and report 2026-11-28 04:20:29 +00:00
e64325b64e Probe pipeline output and cache destinations 2026-11-28 04:14:35 +00:00
62929fc766 Run native readiness diagnostics for selected targets 2026-11-28 04:13:18 +00:00
2ca73aa3ee Discover selected pipeline model targets 2026-11-28 04:11:33 +00:00
8617f936a4 Share prepared pipeline source validation 2026-11-28 04:07:44 +00:00
9e82b5f6b8 Share pipeline invocation preparation 2026-11-28 04:05:54 +00:00
8c09077def Plan pipeline preflight implementation 2026-11-28 04:00:34 +00:00
714d4456d9 Consolidate accepted preflight design into implementation roadmap 2026-11-28 03:49:33 +00:00
c8d273281a Accept preflight reporting and consumer contract 2026-11-28 03:46:20 +00:00
bc0f798020 Accept shared preflight preparation and side effects 2026-11-28 03:44:29 +00:00
1a2917272d Accept backend and profile preflight check grouping 2026-11-28 03:34:12 +00:00
68fb35cd72 Accept native preflight checks and simplify readiness semantics 2026-11-28 03:24:23 +00:00
7f79955912 Record pipeline preflight direction and discussion choices 2026-11-28 03:14:22 +00:00
96dfda1241 Request pipeline-aware preflight for Narratio 2026-11-28 02:32:45 +00:00
f01df93d35 Write Notarius v0.9.0 release notes 2026-11-26 13:56:29 +00:00
78ad79d64d Remove completed audit history from the roadmap 2026-11-26 13:53:00 +00:00
d064d25db9 Retire the completed audit remediation plans 2026-11-26 13:52:17 +00:00
f31b0f30a2 Size chunk range storage to the emitted windows 2026-11-26 05:16:56 +00:00
b0210db974 Use keyed lookups for reference collisions 2026-11-26 05:14:00 +00:00
d66cfe3986 Share the source index with validators 2026-11-26 05:12:19 +00:00
60e732bbe8 Record algorithmic follow-up audit findings 2026-11-26 04:59:14 +00:00
5ffe22f5ac Preserve capture failures when a run is canceled 2026-11-26 04:16:32 +00:00
cc3628e231 Record the audit remediation review finding 2026-11-26 03:27:00 +00:00
c5d8697d9f Record completion of audit remediation verification 2026-11-26 03:13:38 +00:00
9074f96b6e Remove unused policy metadata and helpers 2026-11-26 03:11:54 +00:00
753cd2081c Document extension concurrency and ownership 2026-11-26 03:09:32 +00:00
fed376351f Separate example contracts and relax run ID format test 2026-11-26 03:07:43 +00:00
fef0530533 Make prompt tests resilient to wording changes 2026-11-26 03:04:54 +00:00
97e9d51db0 Prepare item and enemy event sort keys once 2026-11-26 03:00:08 +00:00
7077cee35e Prepare occurrence chronology keys before sorting 2026-11-26 02:56:43 +00:00
26da344f27 Reuse duplicate grouping for combat turns and spells 2026-11-26 02:54:33 +00:00
f9dd53f4c2 Share occurrence duplicate grouping bookkeeping 2026-11-26 02:53:03 +00:00
6275c62d25 Move scene shape facts into the scene family 2026-11-26 02:50:41 +00:00
3e9eeee9e0 Separate pipeline reference and binding resolution 2026-11-26 02:46:33 +00:00
654965d75a Use shared target inventory for CLI references 2026-11-26 02:41:42 +00:00
510a079976 Share pipeline module and reference target selection 2026-11-26 02:39:10 +00:00
39e578dc60 Share catalog-independent pipeline layout 2026-11-26 02:33:25 +00:00
ad357db22d Centralize pure pipeline profile and binding copies 2026-11-26 02:29:52 +00:00
383b43ab08 Handle process signals through cooperative cancellation 2026-11-26 02:23:48 +00:00
add2811a64 Give each CLI run its own invocation lifecycle 2026-11-26 02:19:32 +00:00
b85467cc3c Separate runner source chunk and output responsibilities 2026-11-26 02:17:09 +00:00
dbe1dfbe60 Release extraction intermediates after their last consumers 2026-11-26 02:13:11 +00:00
2d4a2c9c7a Preserve diagnostic aggregation failures during finalization 2026-11-26 02:11:41 +00:00
de2f4d9fde Preserve completed diagnostics when pipeline lanes fail 2026-11-26 02:09:18 +00:00
d1421a710f Separate runner working state from returned results 2026-11-26 02:04:05 +00:00
b0dc84a479 Retain all diagnostic groups without capacity caps 2026-11-26 01:59:34 +00:00
6133902b9b Share source evidence through the selected capture sink 2026-11-26 01:55:37 +00:00
f49238c787 Skip debug projections when capture is disabled 2026-11-26 01:49:29 +00:00
d0cc20c539 Move native request capture into a shared framework package 2026-11-26 01:46:29 +00:00
73023f6397 Make worker concurrency tests deterministic 2026-11-26 01:43:32 +00:00
a27c2cd89c Complete source index reuse across extractors 2026-11-26 01:41:33 +00:00
553276c0a0 Reuse source indexes in occurrence extraction 2026-11-26 01:37:56 +00:00
f789e41faf Reuse source indexes in registry extraction 2026-11-26 01:36:25 +00:00
6345727601 Share a source index across each pipeline run 2026-11-26 01:34:51 +00:00
4b03a439cb Resolve citations using coalesced source ranges 2026-11-26 01:32:35 +00:00
97bcf8cae6 Distinguish metadata slice views from cycles 2026-11-26 01:30:49 +00:00
b6f04297d4 Use structured keys for generated artifact producers 2026-11-26 01:29:32 +00:00
08a9bea23b Reject exactly negative transcript timestamps 2026-11-26 01:27:39 +00:00
4026e26e76 Fix overflow in chunk and reconciliation ranges 2026-11-26 01:26:46 +00:00
cecd68f161 Plan the remaining audit remediation work 2026-11-26 01:24:00 +00:00
57fce85c82 Define the remaining audit remediation roadmap 2026-11-25 17:46:07 +00:00
f1b62bdf53 Accept audit cleanup scope and native capture extraction 2026-11-25 17:38:58 +00:00
2da5fdc5f0 Accept extension and capture concurrency documentation scope 2026-11-25 17:31:28 +00:00
05c0acb1b0 Accept domain sharing and normalization cleanup decisions 2026-11-25 17:27:42 +00:00
09729159cd Accept runner finalization and diagnostic lifetime decisions 2026-11-25 17:25:00 +00:00
6caefe9447 Honor cancellation after recording native evaluation evidence 2026-11-25 17:18:32 +00:00
feb83b29b3 Record the core API review cancellation finding 2026-11-25 17:00:25 +00:00
ab3a1f742d Record final core integration acceptance 2026-11-25 16:28:24 +00:00
b127e9427e Record core operation ownership and audit resolutions 2026-11-25 16:27:10 +00:00
3826dce93b Document core operation authoring with a working example 2026-11-25 16:24:26 +00:00
514f5a9692 Verify concurrent core operation isolation 2026-11-25 16:19:51 +00:00
7d96c69a32 Complete the core operation execution cutover 2026-11-25 16:17:59 +00:00
b6a3638d70 Move location registry reconciliation into shared operations 2026-11-25 15:59:25 +00:00
dc198cfc0c Move item registry reconciliation into shared operations 2026-11-25 15:57:33 +00:00
bbb667b9b2 Move NPC registry reconciliation into shared operations 2026-11-25 15:55:49 +00:00
987b9cb60f Keep reconciliation findings with the current evaluation 2026-11-25 15:54:15 +00:00
5f28be1619 Prepare shared reconciliation operations before evaluation migration 2026-11-25 15:51:42 +00:00
99f00c808c Prepare deterministic D&D normalization in core 2026-11-25 15:49:34 +00:00
e3ddc177ab Prepare scene extraction and deterministic normalization in core 2026-11-25 15:48:32 +00:00
9d2674481b Migrate occurrence extraction to core operations 2026-11-25 15:45:01 +00:00
16a0dfba40 Prepare NPC item and location registry extraction in core 2026-11-25 15:40:30 +00:00
1c047074f1 Prepare combat-gated extraction without module-owned execution 2026-11-25 15:38:38 +00:00
a7b03834f0 Move chunk planning into core operation execution 2026-11-25 15:34:34 +00:00
8240566281 Route merge and normalization through core with domain migrations pending 2026-11-25 15:30:04 +00:00
ccecf13a4c Route spell extraction through core preparation with remaining extractors pending 2026-11-25 15:24:50 +00:00
bab7b2305f Capture evidence for core-owned operations 2026-11-25 15:15:29 +00:00
4b5f574ee7 Reuse accepted results in core operations 2026-11-25 15:10:50 +00:00
2cb64be0d8 Execute native operations and corrections in core 2026-11-25 15:08:28 +00:00
f3b66278ca Execute deterministic prepared operations in core 2026-11-25 15:05:13 +00:00
3650049c33 Preserve native validation failure details 2026-11-25 15:03:16 +00:00
adb198e19f Define typed operation preparation and evaluation contracts 2026-11-25 15:01:06 +00:00
c9624c40e4 Plan the core and integration API migration 2026-11-25 14:45:17 +00:00
a051f34bf6 Incorporate accepted integration API decisions into the roadmap 2026-11-25 14:26:07 +00:00
345067b81e Design the integration API for email and forecast processing 2026-11-25 13:56:30 +00:00
a7dd841219 Plan the core and integration API migration 2026-11-25 13:45:13 +00:00
f0ba5cce84 Accept shared pipeline interpretation and pure copying 2026-11-25 05:31:29 +00:00
eb97632e06 Accept cooperative signal cancellation and operator termination 2026-11-25 05:26:58 +00:00
2ff009c24a Accept shared source capture and convenient operation evidence 2026-11-25 05:24:25 +00:00
003c6d7c61 Accept diagnostic retention and pipeline success decisions 2026-11-25 05:20:32 +00:00
73883ef780 Organize audit recommendations and open decisions for discussion 2026-11-24 20:07:46 +00:00
5a06502506 Consolidate audit findings into a prioritized catalog 2026-11-24 17:07:04 +00:00
6e98a4e36e Record dead code and obsolete functionality audit findings 2026-11-24 16:51:17 +00:00
17a73ca762 Record package cohesion and boundary audit findings 2026-11-24 16:38:43 +00:00
7a14a43677 Record shared behavior and abstraction audit findings 2026-11-24 16:26:36 +00:00
ee94d79025 Record test coverage and effectiveness audit findings 2026-11-24 16:01:14 +00:00
7569dd78e4 Record error handling audit findings 2026-11-24 15:47:38 +00:00
67116c42e2 Record resource management audit findings 2026-11-24 15:32:37 +00:00
65ce8f7fe5 Align release scope and record concurrency audit 2026-11-24 15:24:37 +00:00
ef09060b58 Record complexity and maintainability audit findings 2026-11-24 14:50:43 +00:00
83352f78ae Record algorithmic efficiency audit findings 2026-11-24 14:37:39 +00:00
e42031f2f6 Record functional correctness audit findings 2026-11-24 14:24:17 +00:00
3887d89b76 Clarify release scope and remove completed ReleaseKit plans 2026-11-24 13:35:29 +00:00
f73bb83803 Record the ReleaseKit policy scope finding 2026-11-24 13:06:53 +00:00
be65c52be9 Record native release migration verification 2026-11-23 19:23:40 +00:00
d574ad77e4 Refresh installation and contributor release guidance 2026-11-23 19:21:56 +00:00
dc9f429bb8 Align release policy and maintainer workflow with ReleaseKit 2026-11-23 19:21:22 +00:00
5a3db96588 Deliver tagged releases through native ReleaseKit CI 2026-11-23 19:20:03 +00:00
dbcf9ee2b2 Remove replaced release scripts and attribute ReleaseKit 2026-11-23 19:19:35 +00:00
de4bd1c450 Add the native release profile and launcher 2026-11-23 19:19:12 +00:00
40eba90f47 Adopt ReleaseKit runtime version and register its tool 2026-11-23 19:18:48 +00:00
7e6cbd9d7a Plan the native ReleaseKit implementation 2026-11-23 18:11:36 +00:00
2a45f6d3ae Plan Linux binary releases and prepare credential storage 2026-11-23 18:03:03 +00:00
f74b58f41a Plan native ReleaseKit adoption 2026-11-23 17:50:37 +00:00
e8d3ad35af Remove completed kit upgrade plans 2026-11-23 03:58:08 +00:00
06f8fcb66f Record completed observability upgrade and final verification 2026-11-23 02:59:05 +00:00
aace4e98e9 Refresh operator guidance and selected native kit links 2026-11-23 02:52:11 +00:00
9825ee75fd Document consumer-owned execution observation and its architecture decision 2026-11-23 02:48:37 +00:00
00fc11360e Verify native provider accounting and smoke reports with local HTTP 2026-11-23 02:46:25 +00:00
63beae814b Verify native usage reporting across recovery and delivery boundaries 2026-11-23 02:43:43 +00:00
7aa4f2ec4d Use native contexts for execution observation 2026-11-23 02:38:21 +00:00
88ebdbd819 Move native debug accounting into the CLI capture lifecycle 2026-11-23 02:35:19 +00:00
051a91e397 Upgrade native kits and refresh their source notices 2026-11-23 02:33:40 +00:00
176052a244 Plan the native kit observability upgrade 2026-11-23 02:29:37 +00:00
1483e8e0d1 Plan architecture alignment for native observation 2026-11-23 02:21:58 +00:00
5d3a3b5956 Simplify observability upgrade ownership and implementation plan 2026-11-23 02:16:57 +00:00
447110a939 Adopt upstream documentation ownership guidance 2026-11-23 02:05:15 +00:00
5f03a6f469 Link upstream documentation for adopted kit features 2026-11-23 00:54:35 +00:00
6fbfee8bdf Plan native kit observability upgrades 2026-11-23 00:48:41 +00:00
7faa4a0506 Remove completed planning documents 2026-11-22 09:51:45 +00:00
f069a10c78 Assemble lane results in chunk order without sorting 2026-11-22 09:49:08 +00:00
c8250089b1 Index debug sensitivity paths once per capture 2026-11-22 09:43:22 +00:00
80148ef7e4 Share a lazy source index across cache hits 2026-11-22 09:42:06 +00:00
2429f0ae6a Index source positions during chunk plan validation 2026-11-22 09:40:42 +00:00
7ee7b997f0 Remove unused legacy LLM error definitions 2026-11-22 09:39:50 +00:00
dd25838589 Keep long fallback reasons from invalidating warnings 2026-11-22 09:38:24 +00:00
9074547e33 Keep cached scene identities aligned with the current plan 2026-11-22 09:37:16 +00:00
8ea96dc7a4 Clarify validation behavior when chains are replaced 2026-11-22 09:32:32 +00:00
581229cd1f Preserve operational timeouts when selecting run failures 2026-11-22 09:32:16 +00:00
e823baf3af Record algorithmic scaling opportunities 2026-11-22 09:28:59 +00:00
fdaf39162b Record native migration integration gaps 2026-11-22 09:00:55 +00:00
fd134e85e5 Record the native migration review findings 2026-11-22 08:15:09 +00:00
75444b8ef3 Verify the native cutover and complete the implementation roadmap 2026-11-22 07:11:50 +00:00
633ebd282f Refresh native workflow orientation and planning status 2026-11-22 06:57:27 +00:00
b76d511571 Document native kit integration contracts and ownership 2026-11-22 06:52:56 +00:00
aa4ce04683 Refresh typed module and D&D contributor recipes 2026-11-22 06:48:55 +00:00
41f6079040 Refresh pipeline execution and run state internal guides 2026-11-22 06:45:28 +00:00
5db09d0203 Refresh native configuration, CLI, and LLM internal guides 2026-11-22 06:41:22 +00:00
2c27695df9 Update native operations, consumer migration, and version checks 2026-11-22 06:32:22 +00:00
5e58327032 Rewrite configuration and CLI references for native commands 2026-11-22 06:20:54 +00:00
3cf389db78 Record native architecture decisions and align ownership policy 2026-11-22 06:11:57 +00:00
5b6854e975 Verify native recovery, fallback reuse boundaries, and operator schemas 2026-11-22 06:00:52 +00:00
854d23b91e Migrate maintained D&D examples to native configuration 2026-11-22 05:45:31 +00:00
3ef55f4668 Finish native migration cleanup and restore whole-tree compilation 2026-11-22 05:37:15 +00:00
4fa437aee8 Migrate ordered enemy event contracts to native providers 2026-11-22 05:29:48 +00:00
936fc1e72a Migrate run state and reference contracts to native execution 2026-11-22 05:24:30 +00:00
5cfcf10a8b Migrate configuration and command tests to native inspection 2026-11-22 05:16:24 +00:00
21bcb4eb3b Migrate assembled spell and catalog contracts to native correction 2026-11-22 05:07:00 +00:00
5e68b74469 Exercise production CLI contracts through native loaders and providers 2026-11-22 05:01:09 +00:00
572b267c5d Migrate combat and grounded pipeline integration tests to native execution 2026-11-22 04:54:27 +00:00
562dfad5cd Migrate ordered NPC and location handoff tests to native execution 2026-11-22 04:45:39 +00:00
0ad73ff575 Exercise spell and NPC integration through native providers and published artifacts 2026-11-22 04:39:55 +00:00
20c0975d9d Move cross-family runner contracts into module integration tests 2026-11-22 04:33:28 +00:00
93d94fdd0a Migrate framework tests to native producer and artifact contracts 2026-11-22 04:28:48 +00:00
0b46f2d37c Remove retired runtime wrappers and persistent cache machinery 2026-11-22 04:19:23 +00:00
a8d256f676 Report completed runs through native presentation and preserve failure outcomes 2026-11-22 04:05:44 +00:00
0cbc2b39cb Wire native pipeline run commands and invocation-wide overrides 2026-11-22 03:51:08 +00:00
2a9c5a6075 Add offline pipeline inspection and shared native resource preflight 2026-11-22 03:32:31 +00:00
9f66421f4f Capture native execution facts and complete scoped debug evidence 2026-11-22 03:19:43 +00:00
8680060400 Record debug evidence in one run-scoped capture session 2026-11-22 02:49:48 +00:00
584b041e57 Publish domain artifacts without reporting sidecars 2026-11-22 02:34:40 +00:00
3b1b4c9bcf Unify chunk-plan caching and remove checkpoint execution paths 2026-11-22 02:24:45 +00:00
36906cb3d1 Cache final typed producer artifacts under the initial native request hash 2026-11-22 02:10:05 +00:00
3ef55b1cf0 Add a best-effort accepted-artifact filesystem cache 2026-11-22 01:52:21 +00:00
37e0753472 Format migrated worker fields in integration fixtures 2026-11-22 01:45:48 +00:00
9a527b77c4 Unify ready pipeline jobs under one worker pool and remove the global LLM scheduler 2026-11-22 01:45:31 +00:00
b47208bd57 Make production registration asset-free and verify direct deterministic execution 2026-11-22 01:35:23 +00:00
433ed420f8 Migrate scene descriptions to native correction with invariant-preserving final fallbacks 2026-11-22 01:26:49 +00:00
3fa593362d Migrate enemy events to native correction with fixed multi-artifact grounding 2026-11-22 01:20:46 +00:00
bb3153c1ad Migrate combat turns to native correction and retain deterministic scene gating 2026-11-22 01:13:57 +00:00
1fe231b6fb Migrate item occurrences to native correction while preserving holder semantics 2026-11-22 01:08:02 +00:00
2c1d727232 Migrate NPC and location occurrences to native correction and explicit empty fallbacks 2026-11-22 01:03:06 +00:00
303d6589c5 Migrate registry extraction to native correction and explicit empty fallbacks 2026-11-22 00:50:54 +00:00
5d3696d4a0 Migrate combat semantics validation to native execution and unavailable assessments 2026-11-22 00:42:20 +00:00
52a1c96327 Migrate scene planning to native continuation and whole-source fallback 2026-11-22 00:34:33 +00:00
4f82d01534 Migrate NPC and location normalization to native correction and explicit fallback handling 2026-11-22 00:27:34 +00:00
772b8619c1 Migrate item normalization to native correction and explicit fallback handling 2026-11-22 00:17:58 +00:00
2348730820 Separate reconciliation preparation and proposal assessment from native execution 2026-11-22 00:07:05 +00:00
92c2382806 Migrate spell extraction to native execution and semantic continuation 2026-11-22 00:02:13 +00:00
923cbe594f Bind runner assessment and propagate fallback reuse eligibility 2026-11-21 23:48:51 +00:00
44e4fb92c2 Run typed producers through native continuation and assessment 2026-11-21 23:30:45 +00:00
c56c7d7ee9 Centralize candidate assessment and explicit producer fallback handling 2026-11-21 23:20:17 +00:00
797320b4da Define typed producer assessment and native execution dependencies 2026-11-21 23:12:01 +00:00
b899ee32a6 Install native PromptKit diagnostics and reusable execution overrides 2026-11-21 23:02:57 +00:00
91869ba191 Compose native application commands and shared configuration scopes 2026-11-21 22:59:46 +00:00
a1c888d2cd Share one native application configuration load and captured engine 2026-11-21 22:56:14 +00:00
a0274e154b Declare embedded prompts profiles and schemas with native kit resources 2026-11-21 22:52:46 +00:00
87d362e2d7 Validate pipeline controls in the typed validation callback 2026-11-21 22:49:53 +00:00
40fbcc61b1 Resolve producer modes turn allowances cache controls and shared workers 2026-11-21 22:49:41 +00:00
cc14a7a5cc Load native PromptKit settings through application configuration version six 2026-11-21 22:42:35 +00:00
bd30e86c0d Select native kit releases and update dependency attribution 2026-11-21 22:39:39 +00:00
c480ad68a1 Plan the native PromptKit and CommandKit migration 2026-11-21 22:24:16 +00:00
b3664d5879 Clarify roadmap consistency before native implementation 2026-11-21 21:58:06 +00:00
3f51764f1e Update native migration roadmap for reviewed upstream releases 2026-11-21 21:51:23 +00:00
5359cba98d Resolve completion reporting and publication contracts 2026-11-21 02:36:14 +00:00
058703abe5 Resolve unified cache configuration and legacy migration 2026-11-20 18:59:02 +00:00
254401e5f6 Resolve shared worker pool and native admission policy 2026-11-20 17:32:50 +00:00
1292ed8c4b Resolve mode precedence and whole-transcript fallback 2026-11-20 16:19:23 +00:00
baec913ef5 Select strict mode as the universal pipeline default 2026-11-20 16:13:27 +00:00
89a5398771 Define strict and permissive outcomes with module fallbacks 2026-11-20 16:07:55 +00:00
498f468f4f Resolve removal of generic non-LLM retries 2026-11-20 15:38:21 +00:00
e737167730 Set semantic turn defaults and delegate structural repair upstream 2026-11-20 15:34:05 +00:00
b904021138 Resolve native correction prompts and validator guidance ownership 2026-11-20 14:42:26 +00:00
2d69c26813 Consolidate migration planning into the master roadmap 2026-11-20 13:06:52 +00:00
f883316d7a Resolve native module execution and pipeline assessment design 2026-11-20 12:57:33 +00:00
0833450c71 Resolve native prompt asset and schema design 2026-11-20 12:45:00 +00:00
2eaea2b1fd Consolidate the native migration roadmap and simplified cache design 2026-11-20 03:42:51 +00:00
c03d0bb987 Simplify the planned artifact output and completion report 2026-11-20 03:28:14 +00:00
305a88e8f4 Replace checkpoint proposals with accepted-artifact caching 2026-11-20 03:10:16 +00:00
98ba7e1f55 Define empty debug directory as disabling capture 2026-11-20 01:10:58 +00:00
1601b535ff Settle debug capture inventory and depth 2026-11-20 00:56:29 +00:00
cbf3d1acc2 Clarify settled CommandKit decisions and remaining choices 2026-11-20 00:51:58 +00:00
3c73ccfad0 Record CommandKit verification and migration plan 2026-11-20 00:48:29 +00:00
d9e1d1e4a7 Prioritize convenient debug representations 2026-11-19 19:07:57 +00:00
5618adea8e Record debug bundle organization and latest symlink 2026-11-19 18:55:24 +00:00
9c4c2fc88d Select temporary debug directory default 2026-11-19 18:47:12 +00:00
d11d379bd4 Clarify debug defaults and operator data handling 2026-11-19 18:38:43 +00:00
a299869fcc Record conditional debug capture and diagnostic design 2026-11-19 18:27:51 +00:00
27081bc0af Record native reporting machine output and outcomes 2026-11-19 18:13:08 +00:00
6fa520f8f3 Record native composition loaders and preflight design 2026-11-19 18:05:41 +00:00
5cdbc5400f Record native run alias for pipeline execution 2026-11-19 17:47:40 +00:00
b038cc1a59 Record native pipeline commands and input conventions 2026-11-19 16:19:48 +00:00
93dd406459 Record CommandKit versions and standard capability scope 2026-11-19 16:04:23 +00:00
b04fe98c9e Record full CommandKit-native CLI cutover direction 2026-11-19 15:55:46 +00:00
8feece01db Start CommandKit migration discussion notepad 2026-11-19 15:51:31 +00:00
d17d261d62 Rewrite roadmap for PromptKit-native architecture 2026-11-19 15:27:08 +00:00
12eeb6369e Record simpler PromptKit-native application design 2026-11-19 15:17:38 +00:00
3fb8cb7392 Record inspection and execution bookkeeping ownership 2026-11-19 14:59:56 +00:00
3e1abc7fbb Record simpler checkpoint reuse policy 2026-11-19 14:49:36 +00:00
40cd4fe97d Record agreement to retire the global LLM scheduler 2026-11-18 20:04:48 +00:00
ae8e3ec698 Record agreement on native continuation and retry ownership 2026-11-18 19:54:55 +00:00
8fb21b7dae Record native continuation direction and retry simplifications 2026-11-18 19:48:00 +00:00
5a527c789d Record Audita PromptKit workflow review and architectural implications 2026-11-18 19:10:53 +00:00
abecb349e4 Record agreement on native prompt assembly and deferred schema decisions 2026-11-18 19:04:45 +00:00
defe123955 Outline native PromptKit asset assembly for discussion 2026-11-18 19:00:55 +00:00
69c4054eea Record the PromptKit-native architectural direction 2026-11-18 18:58:21 +00:00
af250eb72f Add PromptKit architecture discussion notepad 2026-11-18 18:52:49 +00:00
0ef079610e Defer operator diagnostics to CommandKit 2026-11-18 18:38:34 +00:00
d1d2394729 Define the offline preflight boundary 2026-11-18 15:28:38 +00:00
63e26dc203 Use PromptKit companion files and namespaced defaults 2026-11-18 15:21:56 +00:00
fe44b12073 Draft the PromptKit upgrade roadmap 2026-11-18 15:09:05 +00:00
65b8e8f0a2 Retire the completed ConfigKit upgrade plans 2026-11-18 14:31:30 +00:00
76364a7b7e Cache source directories during configuration normalization 2026-11-18 00:36:26 +00:00
1c93aa0947 Verify record inheritance through pipeline resolution 2026-11-18 00:32:13 +00:00
1febd2edfa Clarify native imported step ordering 2026-11-18 00:31:11 +00:00
5e269f9760 Distinguish mapping and record inheritance syntax 2026-11-18 00:30:57 +00:00
fb58aef8c2 Restore the accepted workload profile decision text 2026-11-18 00:30:41 +00:00
3f9727d5e8 Clarify PromptKit capture and preparation behavior 2026-11-18 00:30:24 +00:00
0663fe566a Validate explanation pointers before loading configuration 2026-11-18 00:29:56 +00:00
347ef05b41 Compose application assets in one strict group 2026-11-18 00:28:45 +00:00
068a4b1b5a Record ConfigKit source lookup scaling opportunity 2026-11-18 00:25:26 +00:00
b396581d21 Record ConfigKit inheritance integration findings 2026-11-17 23:52:27 +00:00
6f0a75e7cf Record ConfigKit upgrade review findings 2026-11-17 22:05:49 +00:00
d88a01cec0 Clarify native ConfigKit discovery in the roadmap 2026-11-17 21:59:54 +00:00
c9744ad2e6 Complete ConfigKit upgrade verification 2026-11-17 21:00:27 +00:00
74e0f454e9 Document ConfigKit integration and dependency attribution 2026-11-17 20:58:22 +00:00
244f258413 Document native configuration and toolchain requirements 2026-11-17 20:56:06 +00:00
5bab35f096 Compose the complete example from native step fragments 2026-11-17 20:54:47 +00:00
8136b4814f Verify configuration discovery and provenance 2026-11-17 20:53:07 +00:00
349ace0528 Delegate configuration discovery to ConfigKit 2026-11-17 20:51:06 +00:00
716bc62991 Update configuration fixtures for native composition 2026-11-17 20:50:07 +00:00
61ceab786c Compose pipeline steps using native identities 2026-11-17 20:48:05 +00:00
2d1fa57d9b Preserve source paths during field normalization 2026-11-17 20:44:07 +00:00
6da4d070e5 Migrate application configuration to the new ConfigKit API 2026-11-17 20:42:25 +00:00
ae0e410875 Select the ConfigKit upgrade toolchain and dependencies 2026-11-17 20:39:48 +00:00
79088a3546 Plan the ConfigKit native configuration upgrade 2026-11-17 20:35:04 +00:00
2c8b63187c Adopt native configuration search precedence in the roadmap 2026-11-17 20:27:56 +00:00
2b278c4074 Settle the ConfigKit upgrade scope and decisions 2026-11-17 20:25:26 +00:00
db32d31708 Plan adoption of current ConfigKit configuration semantics 2026-11-17 20:19:32 +00:00
b9899ea3cc Update adopted policies to the current upstream standard 2026-11-17 20:09:48 +00:00
66fa5585c1 Clarify ConfigKit configuration ownership 2026-10-04 18:58:10 +00:00
e690cae24f Record PromptKit migration review findings 2026-10-04 15:24:35 +00:00
6700ed2188 Complete PromptKit migration verification 2026-10-04 14:17:30 +00:00
4aba4f5672 Document PromptKit configuration ownership and capture 2026-10-04 14:12:11 +00:00
169a94f7ea Document PromptKit source composition and deployment 2026-10-04 14:04:32 +00:00
db8acbea43 Add resolved PromptKit profile inspection 2026-10-04 13:54:17 +00:00
79154882b8 Add scoped PromptKit configuration reports 2026-10-04 13:47:00 +00:00
c848befb53 Expose provider-neutral PromptKit inspection 2026-10-04 13:26:54 +00:00
a904e4d841 Verify PromptKit content origins and capture lifetime 2026-10-04 13:15:40 +00:00
7ea9fe12b9 Protect captured PromptKit checkpoint identity 2026-10-04 13:08:56 +00:00
deaa3560bc Capture immutable PromptKit configuration identity 2026-10-04 12:59:29 +00:00
ef504eabb2 Test native PromptKit source composition and credential policy 2026-10-04 12:46:23 +00:00
ec2ac3369b Migrate CLI and module tests to keyed PromptKit sources 2026-10-04 12:29:55 +00:00
8a8ca6d83c Migrate LLM fixtures to keyed PromptKit sources 2026-10-04 12:15:26 +00:00
30509f9d33 Use unified PromptKit sources for execution and preflight 2026-10-04 12:00:15 +00:00
28aab5e9a4 Upgrade PromptKit and assemble native configuration sources 2026-10-04 11:57:31 +00:00
ea403c8094 Migrate PromptKit definition assets to keyed format 2026-10-04 11:48:45 +00:00
f5b066beee Plan the PromptKit upgrade and configuration inspection 2026-10-04 11:38:01 +00:00
aae01a59ce Add operator-facing PromptKit inspection to the roadmap 2026-10-04 11:13:33 +00:00
71cf084e8b Adopt native PromptKit configuration capabilities in the roadmap 2026-10-04 11:11:40 +00:00
e327a5eef7 Plan the PromptKit configuration upgrade 2026-10-04 00:34:43 +00:00
af62b3bacc Include transcript input in the development command example 2026-10-04 00:24:04 +00:00
e1097cc7a5 Make inherited path tests distinguish source directories 2026-10-04 00:22:13 +00:00
3f226c91d0 Record ConfigKit inheritance review findings 2026-10-04 00:18:32 +00:00
64509947df Complete ConfigKit inheritance implementation 2026-10-03 18:17:28 +00:00
29c7c165a5 Add development pipeline inheritance example 2026-10-03 18:15:12 +00:00
4ef69314e1 Exercise inherited pipeline CLI behavior 2026-10-03 18:08:07 +00:00
1d1434b118 Retain inherited configuration inspection provenance 2026-10-03 18:03:40 +00:00
f4779fede9 Preserve inherited reference path origins 2026-10-03 17:58:48 +00:00
01c08ec8e4 Preserve inherited presence and validation 2026-10-03 17:55:58 +00:00
d7ea0fd32d Add pipeline inheritance coverage and guidance 2026-10-03 17:49:28 +00:00
ec99d48619 Upgrade ConfigKit to v0.5.0 2026-10-03 17:44:58 +00:00
9e74df0b6e Plan the ConfigKit inheritance upgrade 2026-10-03 17:33:13 +00:00
6e5e277426 Plan ConfigKit inheritance support 2026-10-03 17:16:41 +00:00
778 changed files with 42867 additions and 53804 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@ notarius
notarius-output notarius-output
workspace/ workspace/
.codebase-memory/ .codebase-memory/
/.releasekit/
# ---> Go # ---> Go
# If you prefer the allow list template instead of the deny list, see community template: # If you prefer the allow list template instead of the deny list, see community template:

View File

@@ -1,9 +1,55 @@
# Advisory validation after source publication, never a release-completion gate. matrix:
include:
- GO_IMAGE: golang:1.27.0
when: when:
- event: tag - event: tag
ref: refs/tags/v*
steps: steps:
- name: validate-release - name: deliver
image: golang:1.25.5 image: ${GO_IMAGE}
environment:
RELEASEKIT_GITEA_TOKEN:
from_secret: releasekit_gitea_token
commands: commands:
- ./scripts/check-release-source.sh "$CI_COMMIT_TAG" - |
set -eu
test -n "$${CI_COMMIT_TAG}"
test -n "$${CI_COMMIT_SHA}"
git check-ref-format "refs/tags/$${CI_COMMIT_TAG}"
git fetch origin "refs/tags/$${CI_COMMIT_TAG}:refs/tags/$${CI_COMMIT_TAG}"
tag_commit=$(git rev-parse --verify "refs/tags/$${CI_COMMIT_TAG}^{commit}")
expected_commit=$(git rev-parse --verify "$${CI_COMMIT_SHA}^{commit}")
if [ "$${tag_commit}" != "$${expected_commit}" ]; then
printf 'Tag %s resolves to commit %s; event %s resolves to commit %s\n' \
"$${CI_COMMIT_TAG}" "$${tag_commit}" "$${CI_COMMIT_SHA}" "$${expected_commit}" >&2
exit 1
fi
git checkout --detach "$${tag_commit}"
test "$(git rev-parse HEAD | tr '[:upper:]' '[:lower:]')" = "$${expected_commit}"
test -z "$(git status --porcelain --untracked-files=all)"
bootstrap_dir=$(mktemp -d "$${CI_WORKSPACE%/*}/.releasekit-bootstrap.XXXXXX")
trap 'rm -rf "$${bootstrap_dir}"' EXIT
cp go.mod "$${bootstrap_dir}/releasekit.mod"
if [ -f go.sum ]; then
cp go.sum "$${bootstrap_dir}/releasekit.sum"
else
: > "$${bootstrap_dir}/releasekit.sum"
fi
export GOWORK=off
export GOTOOLCHAIN=local
releasekit_host_os=$(go env GOHOSTOS) || exit $?
releasekit_host_arch=$(go env GOHOSTARCH) || exit $?
export GOOS="$${releasekit_host_os}" GOARCH="$${releasekit_host_arch}"
releasekit_module=go.maximumdirect.net/releasekit
go list -mod=mod -modfile="$${bootstrap_dir}/releasekit.mod" -m "$${releasekit_module}"
go mod edit -modfile="$${bootstrap_dir}/releasekit.mod" -tool="$${releasekit_module}/cmd/releasekit"
go list -mod=mod -modfile="$${bootstrap_dir}/releasekit.mod" -deps "$${releasekit_module}/cmd/releasekit" > /dev/null
go tool -modfile="$${bootstrap_dir}/releasekit.mod" "$${releasekit_module}/cmd/releasekit" ci-deliver \
--repo "$${CI_WORKSPACE}" \
--prepared \
--commit "$${expected_commit}" \
"$${CI_COMMIT_TAG}"

View File

@@ -8,27 +8,41 @@ and spell casts.
## Quickstart ## Quickstart
Provide an OpenRouter API key through the environment, then run the maintained Set `OPENROUTER_API_KEY` in your environment, then run the maintained
minimal example: [minimal example](examples/dnd-minimal/config.yml) with its synthetic transcript:
~~~ ~~~
OPENROUTER_API_KEY=your-api-key \ go run ./cmd/notarius run dnd-session \
go run ./cmd/notarius run dnd-session \ --config examples/dnd-minimal/config.yml \
--config examples/dnd-minimal.config.yml \ --input-file examples/dnd-minimal/transcript.json
--input examples/seriatim-minimal-transcript.json
~~~ ~~~
The command publishes a JSON output bundle. Its command syntax and exit This makes model calls and publishes domain JSON artifacts. Command syntax and exit
behavior are documented in the [CLI reference](docs/cli.md); configuration, behavior are documented in the [CLI reference](docs/cli.md); configuration,
credentials, and module selection are owned by the credentials, and module selection are owned by the
[configuration reference](docs/config.md). [configuration reference](docs/config.md).
For the complete ordered D&D workflow, use For the complete ordered D&D workflow, use
[the complete configuration](examples/dnd-complete.config.yml) with [the complete configuration](examples/dnd-complete/config.yml) with
[its synthetic transcript](examples/dnd-complete-transcript.json). It [its synthetic transcript](examples/dnd-complete/transcript.json). It
demonstrates all implemented D&D lanes and the supporting campaign references. demonstrates all implemented D&D lanes, ordered generated references, native
resource customization, and optional source auxiliaries. See the
[complete workflow](docs/consumers/dnd-pipeline.md) for invocation and discovery.
## Install A Source Release ## Install
For releases that include binary assets, download
`notarius-<version>-linux-amd64` and `SHA256SUMS` from the corresponding
[hosted release](https://forge.maximumdirect.net/eric/notarius/releases), verify
the binary against the checksum manifest, and install it on your `PATH`.
Replace `<version>` with the chosen stable tag (for example,
`vMAJOR.MINOR.PATCH`). Historical releases may not include binary assets.
### Build From Source
Source builds require Go at or above the consumer minimum declared in
[`go.mod`](go.mod). Go 1.27.0 is required by the selected ConfigKit
dependency.
Install a pinned source release with Go: Install a pinned source release with Go:
@@ -39,8 +53,8 @@ GOWORK=off go install \
Replace `<tag>` with a stable release tag such as `vMAJOR.MINOR.PATCH`. The Replace `<tag>` with a stable release tag such as `vMAJOR.MINOR.PATCH`. The
installed command's diagnostic version is described in the [CLI installed command's diagnostic version is described in the [CLI
reference](docs/cli.md); maintainers preparing a release should follow [Source reference](docs/cli.md); maintainers preparing a release should follow the
Releases](docs/release.md). [release runbook](docs/release.md).
## Documentation ## Documentation
@@ -49,8 +63,10 @@ Releases](docs/release.md).
validation, and module selection. validation, and module selection.
- [Operations](docs/operations.md) — output, state, recovery, and debug - [Operations](docs/operations.md) — output, state, recovery, and debug
handling. handling.
- [Integration contracts](docs/integrations/) — Seriatim input and published - [Integration contracts](docs/integrations/) — Seriatim input, domain artifacts,
artifact formats. and native [ConfigKit](docs/integrations/pkg-configkit.md),
[PromptKit](docs/integrations/pkg-promptkit.md), and
[CommandKit](docs/integrations/pkg-commandkit.md) boundaries.
- [Subprocess consumer guide](docs/consumers/subprocess.md) — invoke Notarius - [Subprocess consumer guide](docs/consumers/subprocess.md) — invoke Notarius
from an orchestrator and consume a published result. from an orchestrator and consume a published result.
- [Complete D&D consumer guide](docs/consumers/dnd-pipeline.md) — run the full - [Complete D&D consumer guide](docs/consumers/dnd-pipeline.md) — run the full
@@ -59,7 +75,9 @@ Releases](docs/release.md).
for maintainers. for maintainers.
- [Developer guide](docs/development.md) — contributor orientation and - [Developer guide](docs/development.md) — contributor orientation and
validation guidance. validation guidance.
- [Future work](docs/roadmap/future.md) — unimplemented ideas and priorities. - [Native migration guide](docs/consumers/native-migration.md) — move existing
configurations, invocations, and consumers to the native surface.
- [Future work](docs/roadmap/future.md) — separate backlog of ideas and priorities.
Notarius is licensed under the [GPL v3.0 or later](COPYRIGHT). Notarius is licensed under the [GPL v3.0 or later](COPYRIGHT).

View File

@@ -1,24 +1,58 @@
package combat_semantics package assets_test
import ( import (
"bytes" "bytes"
"context"
"encoding/json" "encoding/json"
"gitea.maximumdirect.net/eric/notarius/assets"
"io/fs"
"strings" "strings"
"testing" "testing"
"go.maximumdirect.net/promptkit"
"github.com/santhosh-tekuri/jsonschema/v6" "github.com/santhosh-tekuri/jsonschema/v6"
) )
func TestLoadResponseSchemaUsesStrictCombatSemanticsContract(t *testing.T) { func TestCombatSemanticsPromptKeepsItsSceneLocalPolicyAndInput(t *testing.T) {
schema, err := loadResponseSchema() _, engine := loadNativeAssets(t)
const transcript = `{"sentinel":"combat-semantics-transcript"}`
handle, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: "notarius/dnd.scene_descriptions.validate_combat", APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{"transcript": promptkit.Inline(transcript)},
})
if err != nil {
t.Fatal(err)
}
defer handle.Discard()
details := handle.Details()
if details.SelectedProfileID != "notarius/dnd-extraction" || details.StructuredOutput == nil {
t.Fatal("native validator defaults/output contract lost")
}
var all string
for _, message := range details.Messages {
all += message.Content
if strings.Contains(message.Content, transcript) && (message.CacheControl == nil || message.CacheControl.Type != promptkit.CacheControlEphemeral) {
t.Fatal("chunk transcript native cache hint lost")
}
}
for _, content := range []string{"substantive active combat materially organizes the", "Do not judge the scene title", transcript} {
if strings.Count(all, content) != 1 {
t.Fatalf("scene-local context not rendered once: %q", content)
}
}
if _, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{PromptID: "notarius/dnd.scene_descriptions.validate_combat", APIKey: "test-only"}); err == nil {
t.Fatal("native validator accepted missing transcript")
}
}
func TestCombatSemanticsResponseSchemaRetainsClassificationAndExplanationRules(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/scene-descriptions/validate/combat-semantics/schemas/dnd_scene_combat_semantics_llm.v1.json")
if err != nil { if err != nil {
t.Fatalf("loadResponseSchema() error = %v, want nil", err) t.Fatalf("loadResponseSchema() error = %v, want nil", err)
} }
if schema.Key != ResponseSchemaKey || schema.ID != ResponseSchemaID || schema.Version != SchemaVersion || schema.Name != ResponseSchemaName || !strings.HasPrefix(schema.SHA256, "sha256:") || !json.Valid(schema.JSONSchema) {
t.Fatalf("schema = %#v, want private combat-semantics schema identity", schema)
}
for _, classification := range []string{"combat", "non_combat"} { for _, classification := range []string{"combat", "non_combat"} {
if err := validateCombatSemanticsSchema(map[string]any{"classification": classification, "explanation": "The chunk contains sustained attack exchanges."}, schema.JSONSchema); err != nil { if err := validateCombatSemanticsSchema(map[string]any{"classification": classification, "explanation": "The chunk contains sustained attack exchanges."}, schema); err != nil {
t.Fatalf("valid %q classification rejected: %v", classification, err) t.Fatalf("valid %q classification rejected: %v", classification, err)
} }
} }
@@ -36,29 +70,11 @@ func TestLoadResponseSchemaUsesStrictCombatSemanticsContract(t *testing.T) {
{name: "oversized explanation", response: map[string]any{"classification": "combat", "explanation": strings.Repeat("a", 513)}}, {name: "oversized explanation", response: map[string]any{"classification": "combat", "explanation": strings.Repeat("a", 513)}},
} { } {
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
if err := validateCombatSemanticsSchema(test.response, schema.JSONSchema); err == nil { if err := validateCombatSemanticsSchema(test.response, schema); err == nil {
t.Fatal("invalid private response accepted") t.Fatal("invalid private response accepted")
} }
}) })
} }
if bytes.Contains(schema.JSONSchema, []byte("uniqueItems")) {
t.Fatalf("schema included unsupported uniqueItems constraint: %s", schema.JSONSchema)
}
}
func TestResponseSchemaIsMutationSafeAndDiagnosticsRedactContent(t *testing.T) {
first, err := loadResponseSchema()
if err != nil {
t.Fatal(err)
}
first.JSONSchema[0] = '['
second, err := loadResponseSchema()
if err != nil || !strings.HasPrefix(second.SHA256, "sha256:") || !json.Valid(second.JSONSchema) || bytes.Equal(first.JSONSchema, second.JSONSchema) {
t.Fatalf("second schema = %s, %v; want defensive copy", second.JSONSchema, err)
}
if diagnostics := second.DiagnosticsMap(); diagnostics["json_schema"] != nil {
t.Fatalf("schema diagnostics included raw content: %#v", diagnostics)
}
} }
func validateCombatSemanticsSchema(instance map[string]any, schemaContent []byte) error { func validateCombatSemanticsSchema(instance map[string]any, schemaContent []byte) error {

168
assets/combat_turns_test.go Normal file
View File

@@ -0,0 +1,168 @@
package assets_test
import (
"context"
"encoding/json"
"io/fs"
"reflect"
"strings"
"testing"
"gitea.maximumdirect.net/eric/notarius/assets"
"go.maximumdirect.net/promptkit"
)
func TestCombatPromptPairPreservesNativeContractAndFixedGrounding(t *testing.T) {
_, engine := loadNativeAssets(t)
initial, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: "notarius/dnd.combat_turns", APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{
"transcript": promptkit.Inline(`{"units":[{"text":"combat-transcript-marker"}]}`),
"npc_registry": promptkit.Inline(`{"npcs":[{"name":"combat-npc-marker"}]}`),
"party": promptkit.Inline("combat-party-marker"),
"players": promptkit.Inline(" "),
"glossary": promptkit.Inline(" "),
},
})
if err != nil {
t.Fatal(err)
}
defer initial.Discard()
correction, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: "notarius/dnd.combat_turns.repair", APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{"guidance": promptkit.Inline("Fix the actor citation.")},
})
if err != nil {
t.Fatal(err)
}
defer correction.Discard()
first, next := initial.Details(), correction.Details()
if first.SelectedProfileID != "notarius/dnd-extraction" || first.SelectedProfileID != next.SelectedProfileID || first.StructuredOutput == nil || !reflect.DeepEqual(first.OutputContract, next.OutputContract) {
t.Fatal("combat native pair lost its schema/default profile")
}
var all string
for _, message := range first.Messages {
all += message.Content
}
for _, marker := range []string{"combat-transcript-marker", "combat-npc-marker", "combat-party-marker"} {
if strings.Count(all, marker) != 1 {
t.Fatalf("fixed input repeated: %q", marker)
}
}
if len(next.Messages) != 1 || next.Messages[0].Role != "user" || !strings.Contains(next.Messages[0].Content, "Fix the actor citation.") || strings.Contains(next.Messages[0].Content, "combat-transcript-marker") {
t.Fatal("correction did not contain only findings and a replacement assignment")
}
}
func TestCombatResponseSchemaUsesPrivateShape(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/combat-turns/schemas/dnd_combat_turns_llm.v1.json")
if err != nil {
t.Fatal(err)
}
valid := validCombatResponse()
content, err := json.Marshal(valid)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err != nil {
t.Fatalf("valid combat response rejected: %v", err)
}
withSourceID := validCombatResponse()
withSourceID["combat_turns"].([]any)[0].(map[string]any)["source_refs"].([]any)[0].(map[string]any)["source_id"] = "session-alpha"
content, err = json.Marshal(withSourceID)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err == nil {
t.Fatal("response schema accepted source_id, want private source-reference shape")
}
}
func TestCombatResponseSchemaLeavesNonCategoricalSemanticsToValidators(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/combat-turns/schemas/dnd_combat_turns_llm.v1.json")
if err != nil {
t.Fatal(err)
}
semanticCandidate := validCombatResponse()
turn := semanticCandidate["combat_turns"].([]any)[0].(map[string]any)
turn["actor"] = ""
ref := turn["source_refs"].([]any)[0].(map[string]any)
ref["start_unit_id"] = 0
ref["end_unit_id"] = -1
content, err := json.Marshal(semanticCandidate)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err != nil {
t.Fatalf("private schema rejected non-categorical validator-owned semantics: %v", err)
}
turn["source_refs"] = []any{}
content, err = json.Marshal(semanticCandidate)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err != nil {
t.Fatalf("private schema rejected empty validator-owned collections: %v", err)
}
}
func TestCombatResponseSchemaRetainsStructuralBoundary(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/combat-turns/schemas/dnd_combat_turns_llm.v1.json")
if err != nil {
t.Fatal(err)
}
for _, test := range []struct {
name string
mutate func(map[string]any)
}{
{name: "missing actor", mutate: func(turn map[string]any) { delete(turn, "actor") }},
{name: "wrong actor type", mutate: func(turn map[string]any) { turn["actor"] = 1 }},
{name: "unknown field", mutate: func(turn map[string]any) { turn["unexpected"] = true }},
{name: "missing source refs", mutate: func(turn map[string]any) { delete(turn, "source_refs") }},
{name: "unsupported turn kind", mutate: func(turn map[string]any) { turn["turn_kind"] = "unsupported" }},
} {
t.Run(test.name, func(t *testing.T) {
candidate := validCombatResponse()
test.mutate(candidate["combat_turns"].([]any)[0].(map[string]any))
content, err := json.Marshal(candidate)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err == nil {
t.Fatal("private schema accepted structurally invalid response")
}
})
}
}
func TestCombatResponseSchemaAcceptsEverySupportedTurnKind(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/combat-turns/schemas/dnd_combat_turns_llm.v1.json")
if err != nil {
t.Fatal(err)
}
for _, kind := range []string{"turn", "reaction", "legendary_action", "lair_action", "other"} {
candidate := validCombatResponse()
candidate["combat_turns"].([]any)[0].(map[string]any)["turn_kind"] = kind
content, err := json.Marshal(candidate)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err != nil {
t.Fatalf("supported turn kind %q was rejected: %v", kind, err)
}
}
}
func validCombatResponse() map[string]any {
return map[string]any{
"combat_turns": []any{
map[string]any{
"actor": "Aria",
"turn_kind": "reaction",
"source_refs": []any{map[string]any{"start_unit_id": 1, "end_unit_id": 2}},
},
},
}
}

View File

@@ -0,0 +1,7 @@
Revise the previous combat-turn list using these findings:
{{ input "guidance" }}
Return the complete replacement list using the original transcript and actor
grounding. Preserve transcript chronology and include only established combat
events. Return only JSON matching the original response contract.

View File

@@ -1,45 +1,58 @@
id: dnd.combat_turns prompts:
version: "v1" - id: dnd.combat_turns
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
- name: npc_registry - name: npc_registry
required: false required: false
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-identity.md content_file: ../../shared/prompts/common-dnd-identity.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-references.md content_file: ../../shared/prompts/common-dnd-references.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-chunk.md content_file: ../../shared/prompts/common-dnd-transcript-chunk.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: system
content_file: ./sharedassets/common-dnd-extraction-evidence.md content_file: ../../shared/prompts/common-dnd-extraction-evidence.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-npc-registry.md content_file: ../../shared/prompts/common-dnd-npc-registry.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_combat_turns_llm.v1.json schema_path: dnd/combat-turns/schemas/dnd_combat_turns_llm.v1.json
repair_attempts: 1
- id: dnd.combat_turns.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/combat-turns/schemas/dnd_combat_turns_llm.v1.json

View File

@@ -0,0 +1,8 @@
Revise the previous enemy-event list using these findings:
{{ input "guidance" }}
Return the complete replacement event list using the original combat transcript
and fixed contextual grounding. Include only directly established engagements and
outcomes, retaining their source evidence and chronology. Return only JSON
matching the original response contract.

View File

@@ -1,53 +1,66 @@
id: dnd.enemy_events prompts:
version: "v1" - id: dnd.enemy_events
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
- name: npc_registry - name: npc_registry
required: true required: true
content_type: application/json content_type: application/json
- name: combat_turns - name: combat_turns
required: true required: true
content_type: application/json content_type: application/json
- name: npc_occurrences - name: npc_occurrences
required: true required: true
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-identity.md content_file: ../../shared/prompts/common-dnd-identity.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-references.md content_file: ../../shared/prompts/common-dnd-references.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-chunk.md content_file: ../../shared/prompts/common-dnd-transcript-chunk.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: system
content_file: ./sharedassets/common-dnd-extraction-evidence.md content_file: ../../shared/prompts/common-dnd-extraction-evidence.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-npc-registry.md content_file: ../../shared/prompts/common-dnd-npc-registry.md
- role: user - role: user
content_file: ./combat-grounding.md content_file: ./combat-grounding.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_enemy_events_llm.v1.json schema_path: dnd/enemy-events/schemas/dnd_enemy_events_llm.v1.json
repair_attempts: 1
- id: dnd.enemy_events.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/enemy-events/schemas/dnd_enemy_events_llm.v1.json

View File

@@ -0,0 +1,7 @@
Revise the previous item occurrence list using these findings:
{{ input "guidance" }}
Return the complete replacement list using the original transcript and registry
context. Preserve stated quantities and possession changes without inventing an
item or holder. Return only JSON matching the original response contract.

View File

@@ -1,45 +1,58 @@
id: dnd.item_occurrences prompts:
version: "v1" - id: dnd.item_occurrences
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
- name: item_registry - name: item_registry
required: true required: true
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-identity.md content_file: ../../shared/prompts/common-dnd-identity.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-references.md content_file: ../../shared/prompts/common-dnd-references.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-chunk.md content_file: ../../shared/prompts/common-dnd-transcript-chunk.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: system
content_file: ./sharedassets/common-dnd-extraction-evidence.md content_file: ../../shared/prompts/common-dnd-extraction-evidence.md
- role: user - role: user
content_file: ./item-registry.md content_file: ./item-registry.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_item_occurrences_llm.v1.json schema_path: dnd/item-occurrences/schemas/dnd_item_occurrences_llm.v1.json
repair_attempts: 1
- id: dnd.item_occurrences.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/item-occurrences/schemas/dnd_item_occurrences_llm.v1.json

View File

@@ -0,0 +1,7 @@
Revise the previous item registry using these findings:
{{ input "guidance" }}
Return the complete replacement registry, not only the changed records. Keep the
original transcript and reference context and return only JSON matching the
original response contract.

View File

@@ -1,40 +1,53 @@
id: dnd.item_registry prompts:
version: "v1" - id: dnd.item_registry
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-identity.md content_file: ../../../shared/prompts/common-dnd-identity.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-references.md content_file: ../../../shared/prompts/common-dnd-references.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-chunk.md content_file: ../../../shared/prompts/common-dnd-transcript-chunk.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: system
content_file: ./sharedassets/common-dnd-extraction-evidence.md content_file: ../../../shared/prompts/common-dnd-extraction-evidence.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_item_registry_llm.v1.json schema_path: dnd/item-registry/extract/schemas/dnd_item_registry_llm.v1.json
repair_attempts: 1
- id: dnd.item_registry.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/item-registry/extract/schemas/dnd_item_registry_llm.v1.json

View File

@@ -1,30 +1,43 @@
id: dnd.item_registry.normalize prompts:
version: "v1" - id: dnd.item_registry.normalize
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: candidates - name: candidates
required: true required: true
content_type: application/json content_type: application/json
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/protocol.md content_file: ../../../../generic/normalize/deduplication/prompts/protocol.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/candidates.md content_file: ../../../../generic/normalize/deduplication/prompts/candidates.md
- role: user - role: user
content_file: ./sharedassets/transcript-windows.md content_file: ../../../../generic/normalize/deduplication/prompts/transcript-windows.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: semantic_reconciliation_llm.v1.json schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json
repair_attempts: 1
- id: dnd.item_registry.normalize.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ../../../../generic/normalize/deduplication/prompts/correction.md
output:
format: json
validation_mode: json_schema
schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json

View File

@@ -0,0 +1,7 @@
Revise the previous location occurrence list using these findings:
{{ input "guidance" }}
Return a complete replacement occurrence list using the original transcript and
registry context. Keep identity-grounding context separate from current-transcript
evidence, and return only JSON matching the original response contract.

View File

@@ -1,45 +1,58 @@
id: dnd.location_occurrences prompts:
version: "v1" - id: dnd.location_occurrences
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
- name: location_registry - name: location_registry
required: true required: true
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-identity.md content_file: ../../shared/prompts/common-dnd-identity.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-references.md content_file: ../../shared/prompts/common-dnd-references.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-chunk.md content_file: ../../shared/prompts/common-dnd-transcript-chunk.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: system
content_file: ./sharedassets/common-dnd-extraction-evidence.md content_file: ../../shared/prompts/common-dnd-extraction-evidence.md
- role: user - role: user
content_file: ./location-registry.md content_file: ./location-registry.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_location_occurrences_llm.v1.json schema_path: dnd/location-occurrences/schemas/dnd_location_occurrences_llm.v1.json
repair_attempts: 1
- id: dnd.location_occurrences.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/location-occurrences/schemas/dnd_location_occurrences_llm.v1.json

View File

@@ -0,0 +1,7 @@
Revise the previous location registry using these findings:
{{ input "guidance" }}
Return the complete replacement registry, not only the changed records. Keep the
original transcript and reference context and return only JSON matching the
original response contract.

View File

@@ -1,40 +1,53 @@
id: dnd.location_registry prompts:
version: "v1" - id: dnd.location_registry
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-identity.md content_file: ../../../shared/prompts/common-dnd-identity.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-references.md content_file: ../../../shared/prompts/common-dnd-references.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-chunk.md content_file: ../../../shared/prompts/common-dnd-transcript-chunk.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: system
content_file: ./sharedassets/common-dnd-extraction-evidence.md content_file: ../../../shared/prompts/common-dnd-extraction-evidence.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_location_registry_llm.v1.json schema_path: dnd/location-registry/extract/schemas/dnd_location_registry_llm.v1.json
repair_attempts: 1
- id: dnd.location_registry.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/location-registry/extract/schemas/dnd_location_registry_llm.v1.json

View File

@@ -1,30 +1,43 @@
id: dnd.location_registry.normalize prompts:
version: "v1" - id: dnd.location_registry.normalize
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: candidates - name: candidates
required: true required: true
content_type: application/json content_type: application/json
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/protocol.md content_file: ../../../../generic/normalize/deduplication/prompts/protocol.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/candidates.md content_file: ../../../../generic/normalize/deduplication/prompts/candidates.md
- role: user - role: user
content_file: ./sharedassets/transcript-windows.md content_file: ../../../../generic/normalize/deduplication/prompts/transcript-windows.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: semantic_reconciliation_llm.v1.json schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json
repair_attempts: 1
- id: dnd.location_registry.normalize.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ../../../../generic/normalize/deduplication/prompts/correction.md
output:
format: json
validation_mode: json_schema
schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json

View File

@@ -0,0 +1,7 @@
Revise the previous NPC occurrence list using these findings:
{{ input "guidance" }}
Return a complete replacement occurrence list using the original transcript and
registry context. Keep identity-grounding context separate from current-transcript
evidence, and return only JSON matching the original response contract.

View File

@@ -1,45 +1,58 @@
id: dnd.npc_occurrences prompts:
version: "v1" - id: dnd.npc_occurrences
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
- name: npc_registry - name: npc_registry
required: true required: true
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-identity.md content_file: ../../shared/prompts/common-dnd-identity.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-references.md content_file: ../../shared/prompts/common-dnd-references.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-chunk.md content_file: ../../shared/prompts/common-dnd-transcript-chunk.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: system
content_file: ./sharedassets/common-dnd-extraction-evidence.md content_file: ../../shared/prompts/common-dnd-extraction-evidence.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-npc-registry.md content_file: ../../shared/prompts/common-dnd-npc-registry.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_npc_occurrences_llm.v1.json schema_path: dnd/npc-occurrences/schemas/dnd_npc_occurrences_llm.v1.json
repair_attempts: 1
- id: dnd.npc_occurrences.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/npc-occurrences/schemas/dnd_npc_occurrences_llm.v1.json

View File

@@ -0,0 +1,7 @@
Revise the previous NPC registry using these findings:
{{ input "guidance" }}
Return the complete replacement registry, not only the changed records. Keep the
original transcript and reference context and return only JSON matching the
original response contract.

View File

@@ -1,40 +1,53 @@
id: dnd.npc_registry prompts:
version: "v1" - id: dnd.npc_registry
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-identity.md content_file: ../../../shared/prompts/common-dnd-identity.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-references.md content_file: ../../../shared/prompts/common-dnd-references.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-chunk.md content_file: ../../../shared/prompts/common-dnd-transcript-chunk.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: system
content_file: ./sharedassets/common-dnd-extraction-evidence.md content_file: ../../../shared/prompts/common-dnd-extraction-evidence.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_npc_registry_llm.v1.json schema_path: dnd/npc-registry/extract/schemas/dnd_npc_registry_llm.v1.json
repair_attempts: 1
- id: dnd.npc_registry.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/npc-registry/extract/schemas/dnd_npc_registry_llm.v1.json

View File

@@ -1,30 +1,43 @@
id: dnd.npc_registry.normalize prompts:
version: "v1" - id: dnd.npc_registry.normalize
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: candidates - name: candidates
required: true required: true
content_type: application/json content_type: application/json
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/protocol.md content_file: ../../../../generic/normalize/deduplication/prompts/protocol.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/candidates.md content_file: ../../../../generic/normalize/deduplication/prompts/candidates.md
- role: user - role: user
content_file: ./sharedassets/transcript-windows.md content_file: ../../../../generic/normalize/deduplication/prompts/transcript-windows.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: semantic_reconciliation_llm.v1.json schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json
repair_attempts: 1
- id: dnd.npc_registry.normalize.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ../../../../generic/normalize/deduplication/prompts/correction.md
output:
format: json
validation_mode: json_schema
schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json

View File

@@ -1,5 +1,6 @@
id: dnd-extraction profiles:
backend: openrouter - id: dnd-extraction
model: openai/gpt-5.6-luna backend: openrouter
timeout_seconds: 240 model: openai/gpt-5.6-luna
service_tier: flex timeout_seconds: 240
service_tier: flex

View File

@@ -0,0 +1,7 @@
Revise the previous scene description using these findings:
{{ input "guidance" }}
Return one complete replacement kind, title, and summary for the original
transcript chunk. Do not change its boundary or invent details to justify a
classification. Return only JSON matching the original response contract.

View File

@@ -1,40 +1,53 @@
id: dnd.scene_descriptions prompts:
version: "v1" - id: dnd.scene_descriptions
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-identity.md content_file: ../../shared/prompts/common-dnd-identity.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-references.md content_file: ../../shared/prompts/common-dnd-references.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-chunk.md content_file: ../../shared/prompts/common-dnd-transcript-chunk.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: system
content_file: ./sharedassets/common-dnd-scene-combat-policy.md content_file: ../../shared/prompts/common-dnd-scene-combat-policy.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_scene_descriptions_llm.v1.json schema_path: dnd/scene-descriptions/schemas/dnd_scene_descriptions_llm.v1.json
repair_attempts: 1
- id: dnd.scene_descriptions.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/scene-descriptions/schemas/dnd_scene_descriptions_llm.v1.json

View File

@@ -1,23 +1,22 @@
id: dnd.scene_descriptions.validate_combat prompts:
version: "v1" - id: dnd.scene_descriptions.validate_combat
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../../../shared/prompts/common-dnd-system.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-scene-combat-policy.md content_file: ../../../../shared/prompts/common-dnd-scene-combat-policy.md
- role: user - role: user
content_file: ./instructions.md content_file: ./instructions.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-chunk.md content_file: ../../../../shared/prompts/common-dnd-transcript-chunk.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_scene_combat_semantics_llm.v1.json schema_path: dnd/scene-descriptions/validate/combat-semantics/schemas/dnd_scene_combat_semantics_llm.v1.json
repair_attempts: 1

View File

@@ -0,0 +1,8 @@
Revise the previous scene-boundary plan using these findings:
{{ input "guidance" }}
Return a complete replacement scene plan for the original full transcript, not
only the changed ranges. Keep the original source-unit IDs and cover every unit
in document order without gaps or overlaps. Return only JSON matching the original
response contract.

View File

@@ -1,34 +1,47 @@
id: dnd.scenes prompts:
version: "v1" - id: dnd.scenes
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../shared/prompts/common-dnd-system.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-references.md content_file: ../../shared/prompts/common-dnd-references.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
- role: user - role: user
content_file: ./sharedassets/common-dnd-transcript-full.md content_file: ../../shared/prompts/common-dnd-transcript-full.md
cache_control: cache_control:
type: ephemeral type: ephemeral
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: dnd_scenes_llm.v1.json schema_path: dnd/scenes/schemas/dnd_scenes_llm.v1.json
repair_attempts: 1
- id: dnd.scenes.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/scenes/schemas/dnd_scenes_llm.v1.json

View File

@@ -0,0 +1,5 @@
Revise the previous spell-cast list using these findings:
{{ input "guidance" }}
Return the complete replacement spell-cast list under the same output contract.

View File

@@ -1,14 +1 @@
Extract Dungeons & Dragons spell-cast artifacts from the provided transcript. Extract the spell casts established by the provided transcript chunk. Return the complete spell-cast list, or an empty list when no casting event is supported.
Include an actual casting event or an unambiguous declared casting attempt.
Exclude spell mentions, hypothetical plans, rules discussion, and catalog
matches that do not establish a casting event in the transcript.
For every extracted cast, the transcript evidence must collectively support the
in-world caster, the spell, and the fact that the cast or declared attempt
occurred.
Attribute every cast to its in-world caster. Map first-person player speech to
the associated player character, and attribute a spell narrated by the GM to
the in-world creature that casts it. If the caster cannot be resolved, use only
the most specific in-world identity supported by the transcript; do not invent
a name.

View File

@@ -0,0 +1,18 @@
Extract Dungeons & Dragons spell-cast artifacts from transcript evidence.
Include an actual casting event or an unambiguous declared casting attempt.
Exclude spell mentions, hypothetical plans, rules discussion, and catalog
matches that do not establish a casting event in the transcript.
For every extracted cast, the transcript evidence must collectively support the
in-world caster, the spell, and the fact that the cast or declared attempt
occurred.
Attribute every cast to its in-world caster. Map first-person player speech to
the associated player character, and attribute a spell narrated by the GM to
the in-world creature that casts it. If the caster cannot be resolved, use only
the most specific in-world identity supported by the transcript; do not invent
a name.
The spell catalog lists each spell's canonical_name and recognized aliases.
If the transcript uses an alias, select that entry's canonical_name. Return the
canonical spelling exactly; never return an alias as a spell name.

View File

@@ -1,50 +1,65 @@
id: dnd.spells prompts:
version: "v1" - id: dnd.spells
default_profile: dnd-extraction default_profile: notarius/dnd-extraction
inputs: inputs:
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
- name: spell_catalog - name: spell_catalog
required: true required: true
content_type: application/json content_type: application/json
- name: players - name: players
required: false required: false
content_type: text/plain content_type: text/plain
- name: party - name: party
required: false required: false
content_type: text/plain content_type: text/plain
- name: glossary - name: glossary
required: false required: false
content_type: text/plain content_type: text/plain
- name: npc_registry - name: npc_registry
required: false required: false
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./sharedassets/common-dnd-system.md content_file: ../../shared/prompts/common-dnd-system.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-identity.md content_file: ../../shared/prompts/common-dnd-identity.md
- role: user - role: system
content_file: ./sharedassets/common-dnd-references.md content_file: ./principles.md
cache_control: - role: user
type: ephemeral content_file: ../../shared/prompts/common-dnd-references.md
- role: user cache_control:
content_file: ./sharedassets/common-dnd-transcript-chunk.md type: ephemeral
cache_control: - role: user
type: ephemeral content_file: ../../shared/prompts/common-dnd-transcript-chunk.md
- role: user cache_control:
content_file: ./sharedassets/common-dnd-extraction-evidence.md type: ephemeral
- role: user - role: system
content_file: ./sharedassets/common-dnd-npc-registry.md content_file: ../../shared/prompts/common-dnd-extraction-evidence.md
- role: user - role: user
content_file: ./spell-catalog.md content_file: ../../shared/prompts/common-dnd-npc-registry.md
- role: user - role: user
content_file: ./instructions.md content_file: ./spell-catalog.md
cache_control: - role: user
type: ephemeral content_file: ./instructions.md
output: cache_control:
format: json type: ephemeral
validation_mode: json_schema output:
schema_path: dnd_spells_llm.v1.json format: json
repair_attempts: 1 validation_mode: json_schema
schema_path: dnd/spells/schemas/dnd_spells_llm.v1.json
- id: dnd.spells.repair
default_profile: notarius/dnd-extraction
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: dnd/spells/schemas/dnd_spells_llm.v1.json

View File

@@ -1,6 +1,3 @@
The spell catalog for this extraction is provided below as JSON. Each entry The spell recognition catalog for this operation:
lists a `canonical_name` and its recognized `aliases`. If the transcript uses
an alias, select that entry's `canonical_name`. Return spell names using the
canonical spelling exactly; never return an alias as a spell name.
{{ input "spell_catalog" }} {{ input "spell_catalog" }}

151
assets/enemy_events_test.go Normal file
View File

@@ -0,0 +1,151 @@
package assets_test
import (
"context"
"encoding/json"
"io/fs"
"reflect"
"strings"
"testing"
"gitea.maximumdirect.net/eric/notarius/assets"
"go.maximumdirect.net/promptkit"
)
func TestEnemyResponseSchemaDefinesPrivateStructuralBoundary(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/enemy-events/schemas/dnd_enemy_events_llm.v1.json")
if err != nil {
t.Fatal(err)
}
valid := validEnemyResponse()
content, err := json.Marshal(valid)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err != nil {
t.Fatalf("valid response rejected: %v", err)
}
semantic := validEnemyResponse()
event := semantic["events"].([]any)[0].(map[string]any)
event["name"] = ""
ref := event["source_refs"].([]any)[0].(map[string]any)
ref["start_unit_id"] = 0
ref["end_unit_id"] = -1
content, err = json.Marshal(semantic)
if err != nil || validateJSONSchema(content, schema) != nil {
t.Fatalf("non-categorical validator-owned semantics were rejected: %v", err)
}
}
func TestEnemyResponseSchemaRejectsInvalidStructure(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/enemy-events/schemas/dnd_enemy_events_llm.v1.json")
if err != nil {
t.Fatal(err)
}
for _, mutate := range []func(map[string]any){
func(event map[string]any) { delete(event, "name") },
func(event map[string]any) { event["kind"] = 1 },
func(event map[string]any) { event["kind"] = "unsupported" },
func(event map[string]any) { event["unexpected"] = true },
func(event map[string]any) { event["source_refs"].([]any)[0].(map[string]any)["source_id"] = "session" },
} {
candidate := validEnemyResponse()
mutate(candidate["events"].([]any)[0].(map[string]any))
content, err := json.Marshal(candidate)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err == nil {
t.Fatal("private schema accepted structurally invalid response")
}
}
}
func TestEnemyResponseSchemaAcceptsEverySupportedKind(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/enemy-events/schemas/dnd_enemy_events_llm.v1.json")
if err != nil {
t.Fatal(err)
}
for _, kind := range []string{"engaged", "killed", "fled", "captured", "incapacitated"} {
candidate := validEnemyResponse()
candidate["events"].([]any)[0].(map[string]any)["kind"] = kind
content, err := json.Marshal(candidate)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err != nil {
t.Fatalf("supported enemy-event kind %q was rejected: %v", kind, err)
}
}
}
func validEnemyResponse() map[string]any {
return map[string]any{"events": []any{map[string]any{
"name": "Ashfang", "kind": "engaged", "source_refs": []any{map[string]any{"start_unit_id": 1, "end_unit_id": 1}},
}}}
}
func TestEnemyPromptPairRetainsRequiredGroundingAndNativeDefaults(t *testing.T) {
_, engine := loadNativeAssets(t)
initial, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{PromptID: "notarius/dnd.enemy_events", APIKey: "test-only", Inputs: enemyEventPromptInputs()})
if err != nil {
t.Fatal(err)
}
defer initial.Discard()
correction, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: "notarius/dnd.enemy_events.repair", APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{"guidance": promptkit.Inline("Combine the duplicate engagement evidence.")},
})
if err != nil {
t.Fatal(err)
}
defer correction.Discard()
first, next := initial.Details(), correction.Details()
if first.SelectedProfileID != "notarius/dnd-extraction" || first.SelectedProfileID != next.SelectedProfileID || first.StructuredOutput == nil || !reflect.DeepEqual(first.OutputContract, next.OutputContract) {
t.Fatal("enemy-event prompt pair lost schema/defaults")
}
var system, all string
for _, message := range first.Messages {
all += message.Content
if message.Role == "system" {
system += message.Content
}
}
for _, rule := range []string{"Emit at most one", "A hostile creature without a registry entry is allowed.", "Do not infer an engagement or outcome", "Transcript units are the only evidence"} {
if !strings.Contains(strings.Join(strings.Fields(system), " "), rule) {
t.Fatalf("missing enduring rule %q", rule)
}
}
for _, marker := range []string{"enemy-transcript", "enemy-player", "enemy-party", "enemy-glossary", "enemy-npc", "enemy-turn", "enemy-opponent"} {
if strings.Count(all, marker) != 1 {
t.Fatalf("fixed grounding repeated: %q", marker)
}
}
if len(next.Messages) != 1 || next.Messages[0].Role != "user" || !strings.Contains(next.Messages[0].Content, "Combine the duplicate engagement evidence.") || strings.Contains(next.Messages[0].Content, "enemy-transcript") {
t.Fatal("correction repeated fixed inputs or omitted findings")
}
for _, name := range []string{"npc_registry", "combat_turns", "npc_occurrences"} {
missing := enemyEventPromptInputs()
delete(missing, name)
handle, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{PromptID: "notarius/dnd.enemy_events", APIKey: "test-only", Inputs: missing})
if handle != nil {
handle.Discard()
}
if err == nil || !strings.Contains(err.Error(), name) {
t.Fatalf("missing %s input=%v", name, err)
}
}
}
func enemyEventPromptInputs() map[string]promptkit.ArtifactRef {
return map[string]promptkit.ArtifactRef{
"transcript": promptkit.Inline(`{"value":"enemy-transcript"}`),
"players": promptkit.Inline("enemy-player"),
"party": promptkit.Inline("enemy-party"),
"glossary": promptkit.Inline("enemy-glossary"),
"npc_registry": promptkit.Inline(`{"npcs":[{"name":"enemy-npc"}]}`),
"combat_turns": promptkit.Inline(`{"combat_turns":[{"actor":"enemy-turn","turn_kind":"turn"}]}`),
"npc_occurrences": promptkit.Inline(`{"npc_occurrences":[{"name":"enemy-opponent","kind":"combat_opponent"}]}`),
}
}

View File

@@ -0,0 +1,6 @@
Revise the previous duplicate-entity proposal using these findings:
{{ input "guidance" }}
Return one complete replacement proposal under the original output contract.
Do not return a patch or commentary.

View File

@@ -1,27 +1,39 @@
id: generic.semantic_reconciliation prompts:
version: "v1" - id: generic.semantic_reconciliation
inputs: inputs:
- name: candidates - name: candidates
required: true required: true
content_type: application/json content_type: application/json
- name: transcript - name: transcript
required: true required: true
content_type: application/json content_type: application/json
messages: messages:
- role: system - role: system
content_file: ./system.md content_file: ./system.md
- role: user - role: system
content_file: ./protocol.md content_file: ./protocol.md
- role: user - role: system
content_file: ./instructions.md content_file: ./instructions.md
cache_control: cache_control:
type: ephemeral type: ephemeral
- role: user - role: user
content_file: ./candidates.md content_file: ./candidates.md
- role: user - role: user
content_file: ./transcript-windows.md content_file: ./transcript-windows.md
output: output:
format: json format: json
validation_mode: json_schema validation_mode: json_schema
schema_path: semantic_reconciliation_llm.v1.json schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json
repair_attempts: 1
- id: generic.semantic_reconciliation.repair
inputs:
- name: guidance
required: true
content_type: text/plain
messages:
- role: user
content_file: ./correction.md
output:
format: json
validation_mode: json_schema
schema_path: generic/normalize/deduplication/schemas/semantic_reconciliation_llm.v1.json

View File

@@ -0,0 +1,79 @@
package assets_test
import (
"encoding/json"
"io/fs"
"testing"
"gitea.maximumdirect.net/eric/notarius/assets"
)
func TestItemOccurrenceSchemaIsStrictlyStructuralAndPrivate(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/item-occurrences/schemas/dnd_item_occurrences_llm.v1.json")
if err != nil {
t.Fatal(err)
}
valid := map[string]any{"occurrences": []any{
map[string]any{
"name": "", "kind": "transferred", "quantity": 0, "from": "party", "to": "Party",
"source_refs": []any{map[string]any{"start_unit_id": 0, "end_unit_id": -1}},
},
map[string]any{
"name": "Hidden Cache", "kind": "discovered", "quantity": nil, "from": nil, "to": nil,
"source_refs": []any{map[string]any{"start_unit_id": 1, "end_unit_id": 1}},
},
}}
content, err := json.Marshal(valid)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err != nil {
t.Fatalf("private schema rejected validator-owned values: %v", err)
}
for _, test := range []struct {
name string
value map[string]any
}{
{"missing occurrences", map[string]any{}},
{"missing occurrence name", map[string]any{"occurrences": []any{itemOccurrenceWithoutField(itemOccurrenceRecord(), "name")}}},
{"missing nullable field", map[string]any{"occurrences": []any{itemOccurrenceWithoutField(itemOccurrenceRecord(), "quantity")}}},
{"missing from", map[string]any{"occurrences": []any{itemOccurrenceWithoutField(itemOccurrenceRecord(), "from")}}},
{"missing to", map[string]any{"occurrences": []any{itemOccurrenceWithoutField(itemOccurrenceRecord(), "to")}}},
{"noninteger quantity", map[string]any{"occurrences": []any{itemOccurrenceWithField(itemOccurrenceRecord(), "quantity", 1.5)}}},
{"unsupported kind", map[string]any{"occurrences": []any{itemOccurrenceWithField(itemOccurrenceRecord(), "kind", "unsupported")}}},
{"opaque item identifier", map[string]any{"occurrences": []any{itemOccurrenceWithField(itemOccurrenceRecord(), "item_id", "item:sha256:opaque")}}},
{"unknown occurrence field", map[string]any{"occurrences": []any{itemOccurrenceWithField(itemOccurrenceRecord(), "extra", true)}}},
{"segment-named range", map[string]any{"occurrences": []any{itemOccurrenceWithField(itemOccurrenceRecord(), "source_refs", []any{map[string]any{"start_segment": 1, "end_segment": 1}})}}},
{"opaque source identifier", map[string]any{"occurrences": []any{itemOccurrenceWithField(itemOccurrenceRecord(), "source_refs", []any{map[string]any{"start_unit_id": 1, "end_unit_id": 1, "source_id": "session-alpha"}})}}},
{"unknown reference field", map[string]any{"occurrences": []any{itemOccurrenceWithField(itemOccurrenceRecord(), "source_refs", []any{map[string]any{"start_unit_id": 1, "end_unit_id": 1, "extra": true}})}}},
{"noninteger range", map[string]any{"occurrences": []any{itemOccurrenceWithField(itemOccurrenceRecord(), "source_refs", []any{map[string]any{"start_unit_id": 1.5, "end_unit_id": 1}})}}},
} {
t.Run(test.name, func(t *testing.T) {
content, err := json.Marshal(test.value)
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); err == nil {
t.Fatal("private schema accepted invalid structure")
}
})
}
}
func itemOccurrenceRecord() map[string]any {
return map[string]any{
"name": "Ring", "kind": "acquired", "quantity": nil, "from": nil, "to": "party", "source_refs": []any{},
}
}
func itemOccurrenceWithoutField(value map[string]any, name string) map[string]any {
delete(value, name)
return value
}
func itemOccurrenceWithField(value map[string]any, name string, fieldValue any) map[string]any {
value[name] = fieldValue
return value
}

57
assets/notarius.yml Normal file
View File

@@ -0,0 +1,57 @@
config:
imports:
- path: dnd/combat-turns/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/enemy-events/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/item-occurrences/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/item-registry/extract/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/item-registry/normalize/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/location-occurrences/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/location-registry/extract/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/location-registry/normalize/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/npc-occurrences/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/npc-registry/extract/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/npc-registry/normalize/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/scene-descriptions/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/scene-descriptions/validate/combat-semantics/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/scenes/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/spells/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: generic/normalize/deduplication/prompts/prompt.yaml
destination: [promptkit, collections, notarius]
required: true
- path: dnd/profiles/dnd-extraction.yaml
destination: [promptkit, collections, notarius]
required: true
promptkit:
collections:
notarius:
schema_root: .

View File

@@ -0,0 +1,149 @@
package assets_test
import (
"context"
"encoding/json"
"io/fs"
"reflect"
"strings"
"testing"
"gitea.maximumdirect.net/eric/notarius/assets"
"go.maximumdirect.net/promptkit"
)
func TestOccurrencePromptPairsPreserveRegistryAndTranscriptBoundaries(t *testing.T) {
_, engine := loadNativeAssets(t)
for _, test := range []struct {
family, registry string
rules []string
}{
{"item", `{"items":[{"name":"occurrence-registry-name"}]}`, []string{
"Return both `from` and `to` for every occurrence.",
"| `discovered` | `null` | `null` |",
"| `acquired` | `null` | `party` or the named party member gaining possession |",
"| `lost` | `party` or the named party member losing possession | `null` |",
"| `consumed` | `party` or the named party member consuming the item | `null` |",
"| `transferred` | one named party member | a different named party member |",
"payments are always `lost`, not `consumed`.",
}},
{"npc", `{"npcs":[{"name":"occurrence-registry-name"}]}`, []string{"Use the supplied canonical NPC", "noncombat_presence", "combat_opponent"}},
{"location", `{"locations":[{"name":"occurrence-registry-name","registry_refs":[{"start_unit_id":7,"end_unit_id":7}],"context":[{"unit_id":7,"text":"registry-context"}]}]}`,
[]string{"context supports that coreference", "must not create a registry location", "provenance must never replace current-chunk evidence", "complete ordered"}},
} {
t.Run(test.family, func(t *testing.T) {
id := "notarius/dnd." + test.family + "_occurrences"
initial, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: id, APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{
"transcript": promptkit.Inline(`{"units":[{"sentinel":"occurrence-transcript"}]}`),
test.family + "_registry": promptkit.Inline(test.registry),
"players": promptkit.Inline("occurrence-players"), "party": promptkit.Inline("occurrence-party"), "glossary": promptkit.Inline("occurrence-glossary"),
},
})
if err != nil {
t.Fatal(err)
}
defer initial.Discard()
correction, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: id + ".repair", APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{"guidance": promptkit.Inline("Correct the unsupported occurrence.")},
})
if err != nil {
t.Fatal(err)
}
defer correction.Discard()
first, next := initial.Details(), correction.Details()
if first.SelectedProfileID != "notarius/dnd-extraction" || first.SelectedProfileID != next.SelectedProfileID ||
first.StructuredOutput == nil || next.StructuredOutput == nil || !reflect.DeepEqual(first.OutputContract, next.OutputContract) {
t.Fatal("occurrence native pair lost schema/defaults")
}
var system, all string
for _, message := range first.Messages {
all += message.Content
if message.Role == "system" {
system += message.Content
}
}
for _, rule := range append(test.rules, "Transcript units are the only evidence") {
if !strings.Contains(strings.Join(strings.Fields(system), " "), rule) {
t.Fatalf("missing enduring rule %q", rule)
}
}
for _, content := range []string{"occurrence-registry-name", "occurrence-transcript", "occurrence-players", "occurrence-party", "occurrence-glossary"} {
if strings.Count(all, content) != 1 {
t.Fatalf("input not rendered once: %q", content)
}
}
if len(next.Messages) != 1 || next.Messages[0].Role != "user" || !strings.Contains(next.Messages[0].Content, "Correct the unsupported occurrence.") ||
strings.Contains(next.Messages[0].Content, "occurrence-registry-name") {
t.Fatal("correction repeated fixed inputs")
}
})
}
}
func TestOccurrenceSchemasRetainSupportedKindsAndPrivateSelectors(t *testing.T) {
for _, test := range []struct {
family string
kinds []string
}{
{"npc", []string{"mentioned", "noncombat_presence", "dialogue", "combat_ally", "combat_opponent", "other"}},
{"location", []string{"visited", "planned", "recalled", "mentioned"}},
} {
t.Run(test.family, func(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/"+test.family+"-occurrences/schemas/dnd_"+test.family+"_occurrences_llm.v1.json")
if err != nil {
t.Fatal(err)
}
record := func() map[string]any {
value := map[string]any{"name": "Canonical Name", "kind": test.kinds[0], "source_refs": []any{map[string]any{"start_unit_id": 1, "end_unit_id": 2}}}
if test.family == "location" {
value["registry_refs"] = []any{map[string]any{"start_unit_id": 1, "end_unit_id": 2}}
}
return value
}
check := func(value map[string]any, valid bool) {
t.Helper()
content, err := json.Marshal(map[string]any{"occurrences": []any{value}})
if err != nil {
t.Fatal(err)
}
if err := validateJSONSchema(content, schema); (err == nil) != valid {
t.Fatalf("valid=%t response=%s error=%v", valid, content, err)
}
}
for _, kind := range test.kinds {
value := record()
value["kind"] = kind
check(value, true)
}
semantic := record()
semantic["name"] = ""
semantic["source_refs"] = []any{map[string]any{"start_unit_id": 0, "end_unit_id": -1}}
check(semantic, true)
for _, mutate := range []func(map[string]any){
func(value map[string]any) { delete(value, "name") },
func(value map[string]any) { value["kind"] = 1 },
func(value map[string]any) { value["kind"] = "unsupported" },
func(value map[string]any) { value[test.family+"_id"] = "assigned-later" },
func(value map[string]any) { value["unexpected"] = true },
func(value map[string]any) {
value["source_refs"].([]any)[0].(map[string]any)["source_id"] = "assigned-later"
},
} {
value := record()
mutate(value)
check(value, false)
}
if test.family == "location" {
value := record()
delete(value, "registry_refs")
check(value, false)
value = record()
value["registry_refs"].([]any)[0].(map[string]any)["start_unit_id"] = 0
check(value, false)
}
})
}
}

View File

@@ -1,4 +1,4 @@
// Package assets exposes embedded LLM-facing content. // Package assets exposes embedded LLM-facing content and shared input contracts.
package assets package assets
import ( import (
@@ -6,7 +6,7 @@ import (
"io/fs" "io/fs"
) )
//go:embed dnd generic //go:embed notarius.yml dnd generic shared-domain
var embedded embed.FS var embedded embed.FS
// FS returns the embedded read-only asset filesystem. // FS returns the embedded read-only asset filesystem.

208
assets/package_test.go Normal file
View File

@@ -0,0 +1,208 @@
package assets_test
import (
"context"
"encoding/json"
"errors"
"fmt"
"io/fs"
"path"
"reflect"
"strings"
"testing"
"gitea.maximumdirect.net/eric/notarius/assets"
"go.maximumdirect.net/configkit"
"go.maximumdirect.net/promptkit"
"go.yaml.in/yaml/v4"
)
type assetSettings struct {
PromptKit promptkit.Settings `yaml:"promptkit"`
}
type noGeneration struct{ t *testing.T }
func (client noGeneration) Generate(context.Context, promptkit.GenerateRequest) (*promptkit.GenerateResponse, error) {
client.t.Error("resource preparation unexpectedly invoked generation")
return nil, fmt.Errorf("unexpected generation")
}
func loadNativeAssets(t *testing.T) (*configkit.Result[assetSettings], *promptkit.Engine) {
t.Helper()
filesystem := configkit.NewFilesystem("Notarius assets", assets.FS())
definition := promptkit.Configure(configkit.Definition[assetSettings]{}, func(value *assetSettings) *promptkit.Settings { return &value.PromptKit })
result, err := configkit.LoadLayered(configkit.Input{Source: configkit.NoSource()}, configkit.LayeredOptions[assetSettings]{
Definition: definition,
Underlays: []configkit.Underlay{
promptkit.BundledOpenRouterUnderlay(),
{Inputs: []configkit.Input{{
Source: filesystem.File("notarius.yml"), Imports: true,
Filesystem: &configkit.FilesystemContext{FS: &filesystem, Root: "."},
}}},
},
})
if err != nil {
var loadError *configkit.LoadError
if errors.As(err, &loadError) {
for _, diagnostic := range loadError.Diagnostics() {
t.Logf("%+v", diagnostic)
}
}
t.Fatal(err)
}
engine, err := promptkit.NewFromConfig(result, promptkit.RuntimeConfig{}, promptkit.WithLLMClient(noGeneration{t}))
if err != nil {
t.Fatal(err)
}
return result, engine
}
func TestEmbeddedPromptsPrepareWithNativeContracts(t *testing.T) {
t.Parallel()
_, engine := loadNativeAssets(t)
// Discover the actual declarations as well as the composed inventory, so an
// accidentally omitted import cannot silently remove a module's coverage.
err := fs.WalkDir(assets.FS(), ".", func(file string, entry fs.DirEntry, err error) error {
if err != nil {
return err
}
if entry.IsDir() || path.Base(file) != "prompt.yaml" {
return nil
}
data, err := fs.ReadFile(assets.FS(), file)
if err != nil {
return err
}
var declared struct {
Prompts []promptkit.PromptSettings `yaml:"prompts"`
}
if err := yaml.Unmarshal(data, &declared); err != nil {
return err
}
if len(declared.Prompts) == 0 {
return fmt.Errorf("%s has no native prompts", file)
}
for _, prompt := range declared.Prompts {
t.Run(prompt.ID, func(t *testing.T) {
inputs := make(map[string]promptkit.ArtifactRef)
for _, input := range prompt.Inputs {
inputs[input.Name] = promptkit.Inline(input.Name + "-fixture")
}
request := promptkit.RunRequest{PromptID: "notarius/" + prompt.ID, Inputs: inputs, APIKey: "fixture-key"}
if prompt.DefaultProfile == nil {
request.ProfileID = "notarius/dnd-extraction"
}
prepared, err := engine.PrepareExecution(context.Background(), request)
if err != nil {
t.Fatal(err)
}
defer prepared.Discard()
details := prepared.Details()
if details.OutputContract.Format != promptkit.FormatJSON || details.OutputContract.ValidationMode != promptkit.ValidationJSONSchema || details.StructuredOutput == nil || details.StructuredOutput.JSONSchema == nil {
t.Fatalf("missing native schema contract: %#v", details.OutputContract)
}
// Preparation must load the real self-contained schema, not merely retain
// a filename or use a separate application schema registry.
schemaBytes, err := fs.ReadFile(assets.FS(), details.OutputContract.SchemaPath)
if err != nil {
t.Fatal(err)
}
var expected any
if err := json.Unmarshal(schemaBytes, &expected); err != nil {
t.Fatal(err)
}
actualBytes, err := json.Marshal(details.StructuredOutput.JSONSchema.Schema)
if err != nil {
t.Fatal(err)
}
var actual any
if err := json.Unmarshal(actualBytes, &actual); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(actual, expected) {
t.Fatal("prepared schema differs from the owned asset")
}
first := prompt.Messages[0]
if first.ContentFile == nil {
t.Fatal("expected a source-relative initial message")
}
content, err := fs.ReadFile(assets.FS(), path.Join(path.Dir(file), *first.ContentFile))
if err != nil {
t.Fatal(err)
}
if first.Role == nil || len(details.Messages) == 0 || details.Messages[0].Role != *first.Role {
t.Fatal("declared message role was not preserved")
}
if !strings.Contains(string(content), "{{") && strings.TrimSpace(details.Messages[0].Content) != strings.TrimSpace(string(content)) {
t.Fatal("source-relative message content was not preserved")
}
})
}
return nil
})
if err != nil {
t.Fatal(err)
}
}
func TestRegistryNormalizationPromptPairsRetainTheirNativeContracts(t *testing.T) {
_, engine := loadNativeAssets(t)
for _, test := range []struct {
id string
guidance string
}{
{"notarius/dnd.npc_registry.normalize", "Preserve distinct individuals."},
{"notarius/dnd.location_registry.normalize", "Keep parent and child places separate."},
} {
t.Run(test.id, func(t *testing.T) {
initial, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: test.id, APIKey: "test-only", Inputs: map[string]promptkit.ArtifactRef{
"candidates": promptkit.Inline(`{"sentinel":"normalization-candidates-sentinel"}`),
"transcript": promptkit.Inline(`{"sentinel":"normalization-transcript-sentinel"}`),
},
})
if err != nil {
t.Fatal(err)
}
defer initial.Discard()
correction, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: test.id + ".repair", APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{"guidance": promptkit.Inline(test.guidance)},
})
if err != nil {
t.Fatal(err)
}
defer correction.Discard()
first, next := initial.Details(), correction.Details()
if first.SelectedProfileID != "notarius/dnd-extraction" || next.SelectedProfileID != first.SelectedProfileID ||
first.StructuredOutput == nil || next.StructuredOutput == nil || !reflect.DeepEqual(first.OutputContract, next.OutputContract) {
t.Fatal("normalization pair lost its shared native defaults/output contract")
}
if len(next.Messages) != 1 || next.Messages[0].Role != "user" || !strings.Contains(next.Messages[0].Content, test.guidance) {
t.Fatal("correction did not supply only the findings and replacement assignment")
}
for _, sentinel := range []string{"normalization-candidates-sentinel", "normalization-transcript-sentinel"} {
renderedInputMessageIndex(t, first.Messages, sentinel)
if strings.Contains(next.Messages[0].Content, sentinel) {
t.Fatalf("correction repeated input %q", sentinel)
}
}
})
}
}
func TestEmbeddedProfileRetainsSelectedExecutionDefaults(t *testing.T) {
t.Parallel()
_, engine := loadNativeAssets(t)
profile, err := engine.InspectProfile(context.Background(), "notarius/dnd-extraction")
if err != nil {
t.Fatal(err)
}
if profile.Backend == nil || *profile.Backend != "openrouter" ||
profile.Model == nil || *profile.Model != "openai/gpt-5.6-luna" ||
profile.TimeoutSeconds == nil || *profile.TimeoutSeconds != 240 ||
profile.ServiceTier == nil || *profile.ServiceTier != "flex" || profile.ReasoningEffort != nil {
t.Fatalf("changed extraction defaults: %#v", profile)
}
}

View File

@@ -0,0 +1,189 @@
package assets_test
import (
"context"
"io/fs"
"strings"
"testing"
"gitea.maximumdirect.net/eric/notarius/assets"
"go.maximumdirect.net/promptkit"
)
func TestExtractionPromptComposition(t *testing.T) {
const (
transcriptSentinel = "shared-transcript-sentinel"
playersSentinel = "shared-players-sentinel"
partySentinel = "shared-party-sentinel"
glossarySentinel = "shared-glossary-sentinel"
npcSentinel = "npc-registry-sentinel"
catalogSentinel = "spell-catalog-sentinel"
)
_, engine := loadNativeAssets(t)
evidence, err := fs.ReadFile(assets.FS(), "dnd/shared/prompts/common-dnd-extraction-evidence.md")
if err != nil {
t.Fatal(err)
}
combatPolicy, err := fs.ReadFile(assets.FS(), "dnd/shared/prompts/common-dnd-scene-combat-policy.md")
if err != nil {
t.Fatal(err)
}
commonInputs := map[string]promptkit.ArtifactRef{
"transcript": promptkit.InlineWithURI("file:///session.json", `{"sentinel":"`+transcriptSentinel+`"}`),
"players": promptkit.Inline(playersSentinel),
"party": promptkit.Inline(partySentinel),
"glossary": promptkit.Inline(glossarySentinel),
}
cases := []struct {
name string
promptID string
inputs map[string]promptkit.ArtifactRef
suffixGroups [][]string
scenePolicy bool
}{
{name: "npcs", promptID: "notarius/dnd.npc_registry", inputs: commonInputs},
{name: "locations", promptID: "notarius/dnd.location_registry", inputs: commonInputs},
{name: "item occurrences", promptID: "notarius/dnd.item_occurrences", inputs: withPromptInputs(commonInputs, map[string]promptkit.ArtifactRef{
"item_registry": promptkit.Inline(`{"items":[{"id":"item-registry-sentinel","name":"Torch"}]}`),
}), suffixGroups: [][]string{{"item-registry-sentinel"}}},
{name: "item registry", promptID: "notarius/dnd.item_registry", inputs: commonInputs},
{name: "scene descriptions", promptID: "notarius/dnd.scene_descriptions", inputs: commonInputs, scenePolicy: true},
{
name: "combat turns",
promptID: "notarius/dnd.combat_turns",
inputs: withPromptInputs(commonInputs, map[string]promptkit.ArtifactRef{
"npc_registry": promptkit.Inline(`{"sentinel":"` + npcSentinel + `"}`),
}),
suffixGroups: [][]string{{npcSentinel}},
},
{
name: "enemy events",
promptID: "notarius/dnd.enemy_events",
inputs: withPromptInputs(commonInputs, map[string]promptkit.ArtifactRef{
"npc_registry": promptkit.Inline(`{"sentinel":"` + npcSentinel + `"}`),
"combat_turns": promptkit.Inline(`{"sentinel":"combat-turns-sentinel"}`),
"npc_occurrences": promptkit.Inline(`{"sentinel":"npc-occurrences-sentinel"}`),
}),
suffixGroups: [][]string{
{npcSentinel},
{"combat-turns-sentinel", "npc-occurrences-sentinel"},
},
},
{
name: "npc occurrences",
promptID: "notarius/dnd.npc_occurrences",
inputs: withPromptInputs(commonInputs, map[string]promptkit.ArtifactRef{
"npc_registry": promptkit.Inline(`{"sentinel":"` + npcSentinel + `"}`),
}),
suffixGroups: [][]string{{npcSentinel}},
},
{
name: "location occurrences",
promptID: "notarius/dnd.location_occurrences",
inputs: withPromptInputs(commonInputs, map[string]promptkit.ArtifactRef{
"location_registry": promptkit.Inline(`{"sentinel":"location-registry-sentinel"}`),
}),
suffixGroups: [][]string{{"location-registry-sentinel"}},
},
{
name: "spells",
promptID: "notarius/dnd.spells",
inputs: withPromptInputs(commonInputs, map[string]promptkit.ArtifactRef{
"npc_registry": promptkit.Inline(`{"sentinel":"` + npcSentinel + `"}`),
"spell_catalog": promptkit.Inline(`{"sentinel":"` + catalogSentinel + `"}`),
}),
suffixGroups: [][]string{{npcSentinel}, {catalogSentinel}},
},
}
for _, testCase := range cases {
t.Run(testCase.name, func(t *testing.T) {
handle, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: testCase.promptID,
APIKey: "test-only",
ProfileID: "notarius/dnd-extraction",
Inputs: testCase.inputs,
})
if err != nil {
t.Fatalf("PrepareExecution() error = %v", err)
}
defer handle.Discard()
prepared := handle.Details()
transcriptIndex := renderedInputMessageIndex(t, prepared.Messages, transcriptSentinel)
referenceIndex := renderedInputMessageIndex(t, prepared.Messages, playersSentinel)
for _, sentinel := range []string{partySentinel, glossarySentinel} {
if index := renderedInputMessageIndex(t, prepared.Messages, sentinel); index != referenceIndex {
t.Fatalf("reference %q rendered at message %d, want %d", sentinel, index, referenceIndex)
}
}
if referenceIndex >= transcriptIndex {
t.Fatalf("campaign references rendered at message %d, want before transcript message %d", referenceIndex, transcriptIndex)
}
assertEphemeralCache(t, prepared.Messages, referenceIndex)
assertEphemeralCache(t, prepared.Messages, transcriptIndex)
shared := evidence
if testCase.scenePolicy {
shared = combatPolicy
}
previousIndex := renderedInputMessageIndex(t, prepared.Messages, strings.TrimSpace(string(shared)))
if previousIndex <= transcriptIndex || prepared.Messages[previousIndex].Role != "system" {
t.Fatal("shared system message must follow the transcript")
}
for _, group := range testCase.suffixGroups {
groupIndex := -1
for _, sentinel := range group {
inputIndex := renderedInputMessageIndex(t, prepared.Messages, sentinel)
if groupIndex < 0 {
groupIndex = inputIndex
} else if inputIndex != groupIndex {
t.Fatalf("input sentinel %q rendered at message %d, want grouped at message %d", sentinel, inputIndex, groupIndex)
}
}
if groupIndex <= previousIndex {
t.Fatalf("prompt suffix group rendered at message %d, want after message %d", groupIndex, previousIndex)
}
previousIndex = groupIndex
}
instructionIndex := len(prepared.Messages) - 1
if instructionIndex <= previousIndex {
t.Fatalf("instructions rendered at message %d, want after lane input message %d", instructionIndex, previousIndex)
}
assertEphemeralCache(t, prepared.Messages, instructionIndex)
})
}
}
func withPromptInputs(inputs, extras map[string]promptkit.ArtifactRef) map[string]promptkit.ArtifactRef {
merged := make(map[string]promptkit.ArtifactRef, len(inputs)+len(extras))
for name, input := range inputs {
merged[name] = input
}
for name, input := range extras {
merged[name] = input
}
return merged
}
func assertEphemeralCache(t *testing.T, messages []promptkit.RenderedMessage, index int) {
t.Helper()
if cache := messages[index].CacheControl; cache == nil || cache.Type != promptkit.CacheControlEphemeral {
t.Fatalf("message %d cache control = %#v, want ephemeral", index, cache)
}
}
func renderedInputMessageIndex(t *testing.T, messages []promptkit.RenderedMessage, sentinel string) int {
t.Helper()
index := -1
occurrences := 0
for messageIndex, message := range messages {
count := strings.Count(message.Content, sentinel)
if count > 0 {
index = messageIndex
occurrences += count
}
}
if occurrences != 1 {
t.Fatalf("input sentinel %q rendered %d times, want exactly once", sentinel, occurrences)
}
return index
}

View File

@@ -0,0 +1,111 @@
package assets_test
import (
"context"
"encoding/json"
"io/fs"
"reflect"
"strings"
"testing"
"gitea.maximumdirect.net/eric/notarius/assets"
"go.maximumdirect.net/promptkit"
)
func TestRegistryExtractionPromptPairsRetainInputsAndContracts(t *testing.T) {
_, engine := loadNativeAssets(t)
for _, test := range []struct {
family, instruction string
}{
{"npc", "Revise the NPC citations."},
{"item", "Revise the item citations."},
{"location", "Revise the location citations."},
} {
t.Run(test.family, func(t *testing.T) {
id := "notarius/dnd." + test.family + "_registry"
initial, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: id, APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{
"transcript": promptkit.Inline(`{"units":[{"sentinel":"registry-transcript"}]}`),
"players": promptkit.Inline("registry-players"), "party": promptkit.Inline("registry-party"), "glossary": promptkit.Inline("registry-glossary"),
},
})
if err != nil {
t.Fatal(err)
}
defer initial.Discard()
next, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: id + ".repair", APIKey: "test-only", Inputs: map[string]promptkit.ArtifactRef{"guidance": promptkit.Inline(test.instruction)},
})
if err != nil {
t.Fatal(err)
}
defer next.Discard()
first, correction := initial.Details(), next.Details()
if first.SelectedProfileID != "notarius/dnd-extraction" || correction.SelectedProfileID != first.SelectedProfileID ||
first.StructuredOutput == nil || correction.StructuredOutput == nil || !reflect.DeepEqual(first.OutputContract, correction.OutputContract) {
t.Fatal("registry prompt pair lost native schema/defaults")
}
var all string
for _, message := range first.Messages {
all += message.Content
if strings.Contains(message.Content, "registry-transcript") || strings.Contains(message.Content, "registry-players") {
if message.CacheControl == nil || message.CacheControl.Type != promptkit.CacheControlEphemeral {
t.Fatal("fixed input cache hint lost")
}
}
}
for _, input := range []string{"registry-transcript", "registry-players", "registry-party", "registry-glossary"} {
if strings.Count(all, input) != 1 {
t.Fatalf("fixed input not rendered once: %q", input)
}
}
if len(correction.Messages) != 1 || correction.Messages[0].Role != "user" || !strings.Contains(correction.Messages[0].Content, test.instruction) ||
strings.Contains(correction.Messages[0].Content, "registry-transcript") {
t.Fatal("correction repeated fixed inputs instead of supplying findings/assignment")
}
})
}
}
func TestRegistryResponseSchemasSeparateStructureFromSemanticValidity(t *testing.T) {
for _, test := range []struct{ family, field string }{
{"npc", "npcs"}, {"item", "items"}, {"location", "locations"},
} {
t.Run(test.family, func(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/"+test.family+"-registry/extract/schemas/dnd_"+test.family+"_registry_llm.v1.json")
if err != nil {
t.Fatal(err)
}
for _, value := range []struct {
name, record string
valid bool
}{
{"grounded record", `{"name":"Canonical Name","source_refs":[{"start_unit_id":1,"end_unit_id":2}]}`, true},
{"blank name and empty evidence", `{"name":"","source_refs":[]}`, true},
{"nonpositive source candidate", `{"name":"Canonical Name","source_refs":[{"start_unit_id":0,"end_unit_id":-1}]}`, true},
{"missing name", `{"source_refs":[]}`, false},
{"opaque ID", `{"name":"Canonical Name","source_refs":[],"id":"assigned-later"}`, false},
{"wrong name type", `{"name":7,"source_refs":[]}`, false},
{"noninteger source identifier", `{"name":"Canonical Name","source_refs":[{"start_unit_id":1.5,"end_unit_id":2}]}`, false},
} {
t.Run(value.name, func(t *testing.T) {
content := []byte(`{"` + test.field + `":[` + value.record + `]}`)
if err := validateJSONSchema(content, schema); (err == nil) != value.valid {
t.Fatalf("schema validity=%t, error=%v", value.valid, err)
}
})
}
for _, content := range []string{`{"` + test.field + `":[]}`, `{"` + test.field + `":null}`, `{}`} {
var value map[string]any
if err := json.Unmarshal([]byte(content), &value); err != nil {
t.Fatal(err)
}
_, isArray := value[test.field].([]any)
if err := validateJSONSchema([]byte(content), schema); (err == nil) != isArray {
t.Fatalf("collection shape %s: %v", content, err)
}
}
})
}
}

View File

@@ -0,0 +1,112 @@
package assets_test
import (
"context"
"encoding/json"
"io/fs"
"reflect"
"strings"
"testing"
"gitea.maximumdirect.net/eric/notarius/assets"
"go.maximumdirect.net/promptkit"
)
func TestSceneResponseSchemaUsesStrictPrivateContract(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/scene-descriptions/schemas/dnd_scene_descriptions_llm.v1.json")
if err != nil {
t.Fatal(err)
}
valid := map[string]any{"kind": "narrative", "title": "Arrival", "summary": "The party enters the tower."}
if err := validateSceneResponse(t, valid, schema); err != nil {
t.Fatalf("valid private response rejected: %v", err)
}
for _, test := range []struct {
name string
response map[string]any
valid bool
}{
{name: "missing required field", response: map[string]any{"kind": "combat", "title": "Ambush"}},
{name: "unknown framework field", response: map[string]any{"kind": "combat", "title": "Ambush", "summary": "Bandits strike.", "id": "assigned-later"}},
{name: "unknown application field", response: map[string]any{"kind": "combat", "title": "Ambush", "summary": "Bandits strike.", "source_ref": map[string]any{}}},
{name: "collection is not allowed", response: map[string]any{"kind": "combat", "title": "Ambush", "summary": "Bandits strike.", "scenes": []any{}}},
{name: "unsupported kind", response: map[string]any{"kind": "interlude", "title": "Ambush", "summary": "Bandits strike."}},
{name: "empty title", response: map[string]any{"kind": "combat", "title": "", "summary": "Bandits strike."}, valid: true},
{name: "empty summary", response: map[string]any{"kind": "combat", "title": "Ambush", "summary": ""}, valid: true},
{name: "wrong kind type", response: map[string]any{"kind": 7, "title": "Ambush", "summary": "Bandits strike."}},
{name: "wrong title type", response: map[string]any{"kind": "combat", "title": 7, "summary": "Bandits strike."}},
{name: "wrong summary type", response: map[string]any{"kind": "combat", "title": "Ambush", "summary": 7}},
} {
t.Run(test.name, func(t *testing.T) {
err := validateSceneResponse(t, test.response, schema)
if (err == nil) != test.valid {
t.Fatalf("validateJSONSchema() error = %v, want valid=%t", err, test.valid)
}
})
}
if err := validateJSONSchema([]byte(`{"kind":`), schema); err == nil {
t.Fatal("validateJSONSchema() error = nil, want malformed JSON rejected")
}
}
func TestSceneResponseSchemaAcceptsEverySupportedKind(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/scene-descriptions/schemas/dnd_scene_descriptions_llm.v1.json")
if err != nil {
t.Fatal(err)
}
for _, kind := range []string{"combat", "narrative", "recap", "meta"} {
response := map[string]any{"kind": kind, "title": "Title", "summary": "Summary"}
if err := validateSceneResponse(t, response, schema); err != nil {
t.Fatalf("supported scene kind %q was rejected: %v", kind, err)
}
}
}
func validateSceneResponse(t *testing.T, instance map[string]any, schemaContent []byte) error {
t.Helper()
content, err := json.Marshal(instance)
if err != nil {
t.Fatal(err)
}
return validateJSONSchema(content, schemaContent)
}
func TestSceneDescriptionPromptPairRetainsPolicyAndFixedInputs(t *testing.T) {
_, engine := loadNativeAssets(t)
initial, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: "notarius/dnd.scene_descriptions", APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{
"transcript": promptkit.Inline(`{"units":[{"text":"scene-description-transcript"}]}`),
"players": promptkit.Inline("scene-description-player"), "party": promptkit.Inline(" "), "glossary": promptkit.Inline(" "),
},
})
if err != nil {
t.Fatal(err)
}
defer initial.Discard()
correction, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: "notarius/dnd.scene_descriptions.repair", APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{"guidance": promptkit.Inline("Return kind: combat for this scene.")},
})
if err != nil {
t.Fatal(err)
}
defer correction.Discard()
first, next := initial.Details(), correction.Details()
if first.SelectedProfileID != "notarius/dnd-extraction" || first.SelectedProfileID != next.SelectedProfileID || first.StructuredOutput == nil || !reflect.DeepEqual(first.OutputContract, next.OutputContract) {
t.Fatal("scene pair lost schema/defaults")
}
var all string
for _, message := range first.Messages {
all += message.Content
}
for _, material := range []string{"scene-description-transcript", "scene-description-player"} {
if strings.Count(all, material) != 1 {
t.Fatalf("fixed input/policy repeated: %q", material)
}
}
if len(next.Messages) != 1 || next.Messages[0].Role != "user" || !strings.Contains(next.Messages[0].Content, "Return kind: combat for this scene.") || strings.Contains(next.Messages[0].Content, "scene-description-transcript") {
t.Fatal("correction assignment lost findings or repeated source")
}
}

184
assets/scenes_test.go Normal file
View File

@@ -0,0 +1,184 @@
package assets_test
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io/fs"
"reflect"
"strings"
"testing"
"gitea.maximumdirect.net/eric/notarius/assets"
"github.com/santhosh-tekuri/jsonschema/v6"
"go.maximumdirect.net/promptkit"
)
func TestScenePromptPairPreservesFullTranscriptAndContext(t *testing.T) {
_, engine := loadNativeAssets(t)
const transcript = `{"sentinel":"scene-transcript"}`
initial, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: "notarius/dnd.scenes", APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{
"transcript": promptkit.Inline(transcript),
"players": promptkit.Inline("scene-players"),
"party": promptkit.Inline("scene-party"),
"glossary": promptkit.Inline("scene-glossary"),
},
})
if err != nil {
t.Fatal(err)
}
defer initial.Discard()
correction, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
PromptID: "notarius/dnd.scenes.repair", APIKey: "test-only",
Inputs: map[string]promptkit.ArtifactRef{"guidance": promptkit.Inline("Keep the encounter together.")},
})
if err != nil {
t.Fatal(err)
}
defer correction.Discard()
first, next := initial.Details(), correction.Details()
if first.SelectedProfileID != "notarius/dnd-extraction" || next.SelectedProfileID != first.SelectedProfileID ||
first.StructuredOutput == nil || next.StructuredOutput == nil || !reflect.DeepEqual(first.OutputContract, next.OutputContract) {
t.Fatal("scene correction pair lost its shared native defaults/output contract")
}
var system, all string
transcriptIndex := -1
for i, message := range first.Messages {
all += message.Content
if message.Role == "system" {
system += message.Content
}
if strings.Contains(message.Content, transcript) {
transcriptIndex = i
}
if strings.Contains(message.Content, transcript) || strings.Contains(message.Content, "scene-players") {
if message.CacheControl == nil || message.CacheControl.Type != promptkit.CacheControlEphemeral {
t.Fatal("reference/full-transcript native cache hint lost")
}
}
}
if transcriptIndex != len(first.Messages)-1 || !strings.Contains(system, "no gaps or overlaps") || !strings.Contains(system, "coherent unit of play") {
t.Fatal("scene principles or complete final transcript lost")
}
for _, content := range []string{transcript, "scene-players", "scene-party", "scene-glossary"} {
if strings.Count(all, content) != 1 {
t.Fatalf("fixed context not rendered once: %q", content)
}
}
if len(next.Messages) != 1 || next.Messages[0].Role != "user" || !strings.Contains(next.Messages[0].Content, "Keep the encounter together.") ||
strings.Contains(next.Messages[0].Content, "scene-transcript") {
t.Fatal("correction should supply findings and a replacement assignment only")
}
}
func TestResponseSchemaValidatesMinimalSceneResponses(t *testing.T) {
schema, err := fs.ReadFile(assets.FS(), "dnd/scenes/schemas/dnd_scenes_llm.v1.json")
if err != nil {
t.Fatalf("loadResponseSchema() error = %v, want nil", err)
}
valid := validSceneSchemaResponse()
validJSON, err := json.Marshal(valid)
if err != nil {
t.Fatalf("Marshal(validSceneSchemaResponse()) error = %v, want nil", err)
}
if err := validateJSONSchema(validJSON, schema); err != nil {
t.Fatalf("valid scene response rejected: %v", err)
}
tests := []struct {
name string
mutate func(map[string]any)
}{
{
name: "missing scenes",
mutate: func(response map[string]any) {
delete(response, "scenes")
},
},
{
name: "empty scenes",
mutate: func(response map[string]any) {
response["scenes"] = []any{}
},
},
{
name: "non-positive start unit",
mutate: func(response map[string]any) {
response["scenes"].([]any)[0].(map[string]any)["start_unit_id"] = 0
},
},
{
name: "non-positive end unit",
mutate: func(response map[string]any) {
response["scenes"].([]any)[0].(map[string]any)["end_unit_id"] = 0
},
},
{
name: "non-integer endpoint",
mutate: func(response map[string]any) {
response["scenes"].([]any)[0].(map[string]any)["start_unit_id"] = 1.5
},
},
{
name: "unknown top-level field",
mutate: func(response map[string]any) {
response["boundary_caveats"] = []any{}
},
},
{
name: "unknown scene field",
mutate: func(response map[string]any) {
response["scenes"].([]any)[0].(map[string]any)["short_title"] = "Old contract"
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
response := validSceneSchemaResponse()
tt.mutate(response)
content, err := json.Marshal(response)
if err != nil {
t.Fatalf("Marshal() error = %v, want nil", err)
}
if err := validateJSONSchema(content, schema); err == nil {
t.Fatal("validateJSONSchema() error = nil, want rejected response")
}
})
}
}
func validSceneSchemaResponse() map[string]any {
return map[string]any{
"scenes": []any{
map[string]any{
"start_unit_id": 1,
"end_unit_id": 3,
},
},
}
}
func validateJSONSchema(instanceContent, schemaContent []byte) error {
instance, err := jsonschema.UnmarshalJSON(bytes.NewReader(instanceContent))
if err != nil {
return fmt.Errorf("parse instance: %w", err)
}
schemaDocument, err := jsonschema.UnmarshalJSON(bytes.NewReader(schemaContent))
if err != nil {
return fmt.Errorf("parse schema: %w", err)
}
compiler := jsonschema.NewCompiler()
if err := compiler.AddResource("schema.json", schemaDocument); err != nil {
return fmt.Errorf("load schema: %w", err)
}
schema, err := compiler.Compile("schema.json")
if err != nil {
return fmt.Errorf("compile schema: %w", err)
}
return schema.Validate(instance)
}

View File

@@ -1,4 +1,4 @@
package register package assets_test
import ( import (
"encoding/json" "encoding/json"
@@ -8,25 +8,18 @@ import (
"strings" "strings"
"testing" "testing"
"gitea.maximumdirect.net/eric/notarius/internal/framework/llm" "gitea.maximumdirect.net/eric/notarius/assets"
) )
func TestRegisteredResponseSchemasRequireEveryObjectProperty(t *testing.T) { func TestModelResponseSchemasRequireEveryObjectProperty(t *testing.T) {
assets := llm.NewAssetRegistry() schemaFS := assets.FS()
if err := Register(completeRegistries(), assets); err != nil {
t.Fatal(err)
}
schemaFS, err := assets.SchemaFS()
if err != nil {
t.Fatal(err)
}
count := 0 count := 0
err = fs.WalkDir(schemaFS, ".", func(path string, entry fs.DirEntry, walkErr error) error { err := fs.WalkDir(schemaFS, ".", func(path string, entry fs.DirEntry, walkErr error) error {
if walkErr != nil { if walkErr != nil {
return walkErr return walkErr
} }
if entry.IsDir() || !strings.HasSuffix(path, ".json") { if entry.IsDir() || !strings.HasSuffix(path, "_llm.v1.json") {
return nil return nil
} }
content, err := fs.ReadFile(schemaFS, path) content, err := fs.ReadFile(schemaFS, path)
@@ -46,7 +39,7 @@ func TestRegisteredResponseSchemasRequireEveryObjectProperty(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if count == 0 { if count == 0 {
t.Fatal("no registered response schemas found") t.Fatal("no model response schemas found")
} }
} }

View File

@@ -0,0 +1,11 @@
# Shared domain contract sources
Source distribution: `2026.11.1`, commit `f7e3cedeca11ed903311cdf29ca4d81fb1f216b7` of [Maximum Direct shared schemas](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7).
| Contract | Version | Document marker | Canonical schema ID |
| --- | --- | --- | --- |
| Glossary | `0.2.0` | `maximumdirect.glossary.v1` | https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json |
| RPG party | `0.2.0` | `maximumdirect.rpg.party.v1` | https://schemas.maximumdirect.net/rpg/party/v0.2.0/schema.json |
The schemas are unchanged. Adjacent semantics are copied with links to unbundled
upstream documentation and examples redirected to the pinned source revision.

View File

@@ -0,0 +1,51 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json",
"title": "MAXIMUMDIRECT Glossary v1",
"type": "object",
"required": ["schema_version", "collections"],
"properties": {
"schema_version": {"const": "maximumdirect.glossary.v1"},
"collections": {
"type": "object",
"propertyNames": {"minLength": 1},
"additionalProperties": {"$ref": "#/$defs/collection"}
}
},
"$defs": {
"text": {"type": "string", "minLength": 1},
"aliases": {"type": ["array", "null"], "items": {"$ref": "#/$defs/text"}},
"entry": {
"type": "object",
"required": ["id", "name", "category"],
"properties": {
"id": {"$ref": "#/$defs/text"},
"name": {"$ref": "#/$defs/text"},
"category": {"$ref": "#/$defs/text"},
"description": {"type": "string"},
"aliases": {"$ref": "#/$defs/aliases"},
"plural": {"type": ["string", "null"], "minLength": 1}
}
},
"provenance": {
"type": "object",
"properties": {
"id": {"$ref": "#/$defs/text"},
"title": {"$ref": "#/$defs/text"},
"version": {"type": "string"},
"url": {"type": "string"},
"license": {"type": "string"}
}
},
"partialCollection": {
"type": "object",
"properties": {
"entries": {"type": "array", "items": {"$ref": "#/$defs/entry"}},
"provenance": {"$ref": "#/$defs/provenance"}
}
},
"collection": {
"allOf": [{"$ref": "#/$defs/partialCollection"}, {"required": ["entries"]}]
}
}
}

View File

@@ -0,0 +1,83 @@
# Glossary contract
## Native loading boundary
Full conformance includes acquisition through the public mapping-root handoff of
[ConfigKit v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md),
followed by this schema and its semantic checks. ConfigKit owns syntax, structural
controls, numeric binding, and resource limits, including its 8 MiB source limit.
Dynamic integers bind as int64 and fractional/exponent values as finite float64;
authored decimal precision is not guaranteed. Preserve supported resolved values.
`extends` is structural input and source-root `config` is a control namespace;
nested ordinary `config` follows upstream rules. Other supported domain extensions
remain permitted. Schema validation adds no trimming, case folding, or defaults.
Structural validation alone does not prove native loading compatibility. The
pinned upstream contract defines this version's boundary independently of later
changes to the repository's general guidance.
Contract: `maximumdirect.glossary.v1`. [Schema](schema.json).
The [validation profile](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/docs/validation.md) and [compatibility rules](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/docs/compatibility.md)
apply. Start with [campaign vocabulary](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/glossary/v0.2.0/examples/glossary.yml),
[weather](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/glossary/v0.2.0/examples/weather.yml), or [sports](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/glossary/v0.2.0/examples/sports.yml).
| Field | Required | Meaning |
| --- | --- | --- |
| `schema_version` | Yes | Exactly `maximumdirect.glossary.v1`. |
| `collections` | Yes | Mapping of nonempty collection names to collections; may be empty. |
| `collections.<name>.entries` | Yes | List of entries; may be empty. |
| `entries[].id` | Yes | Stable, nonempty identity unique within this collection. |
| `entries[].name` | Yes | Nonempty canonical display name. |
| `entries[].category` | Yes | Nonempty domain-defined category. |
| `entries[].description` | No | Description; an empty string is valid. |
| `entries[].aliases` | No | Alternative names for the same entity. May be null, empty, or a list of nonempty strings. |
| `entries[].plural` | No | Nonempty plural display form, or null. |
| `collections.<name>.provenance` | No | Source metadata object, possibly empty. Optional `id` and `title` are nonempty strings; optional `version`, `url`, and `license` are strings that may be empty. |
All objects permit extensions. Optional fields accept omission; only `aliases`
and `plural` additionally accept null. Supported resolved values are preserved; schema validation adds no trimming,
case folding, coercion, or defaults. IDs and names compare exactly. Distinct
collections can reuse an ID. Display names, aliases, and categories need not be
unique. Lists retain their authored order but establish no precedence or execution
order. Collection names and categories are strings chosen by the domain, not a
fixed set of D&D labels.
For example, `spells` entries contain names, aliases, and optionally extended
domain information such as `casting_time`. Their collection's provenance can
identify a source catalog. Domain-specific metadata can use extension fields.
Provenance describes origin and applicability;
it is not transcript evidence or a spell rule. If different source contexts
matter, use separately named collections with their own provenance. A consumer
can derive its recognition input from these entries instead of requiring a second
operator-maintained spell list. Embedded vocabulary, source precedence,
normalization, inference, and conflicts remain consumer policy.
Entry-ID uniqueness is a semantic rule checked separately from JSON Schema.
The [validator](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/docs/validation.md) performs both checks. No cross-document identity or
reference-resolution check is part of this initial contract.
## Extensions and task instructions
Extensions describe domain information. Consumers forwarding a shared document
should retain them; task-specific projections may intentionally omit them.
Acceptance and preservation do not claim interpretation. Defined fields retain
their schema constraints in an extended document.
Task instructions belong to consumer configuration. `instruction` is not a
defined field in this contract. Like other unknown fields, it can be retained
without acquiring instruction semantics. Maintained examples contain domain
data only.
## Authoring contributions
`#/$defs/partialCollection` is an editor-assistance definition with optional
`entries`. `#/$defs/entry` and `#/$defs/collection` assist entry and complete
collection editing. A partial contribution is not a standalone valid domain
document. ConfigKit owns imports, inheritance, and composition before validation
of the complete envelope.
## Differences from the reference catalog and Audita v4.2
The old format maps collection names directly at the root. The shared format
requires `schema_version` and `collections`. It removes defined collection
instructions, permits structural extensions, and adds defined provenance.
Existing consumers must explicitly adopt this envelope and its semantics.

View File

@@ -0,0 +1,51 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.maximumdirect.net/rpg/party/v0.2.0/schema.json",
"title": "MAXIMUMDIRECT RPG Party v1",
"type": "object",
"required": ["schema_version", "characters"],
"properties": {
"schema_version": {"const": "maximumdirect.rpg.party.v1"},
"characters": {
"type": "object",
"propertyNames": {"minLength": 1},
"additionalProperties": {"$ref": "#/$defs/rosterEntry"}
}
},
"$defs": {
"text": {"type": "string", "minLength": 1},
"rosterEntry": {
"type": "object",
"required": ["character"],
"properties": {
"player": {
"type": "object",
"required": ["name"],
"properties": {"name": {"$ref": "#/$defs/text"}}
},
"character": {
"type": "object",
"required": ["name"],
"properties": {
"name": {"$ref": "#/$defs/text"},
"aliases": {
"type": ["array", "null"],
"items": {"$ref": "#/$defs/text"}
},
"classes": {
"type": "array",
"items": {
"type": "object",
"required": ["name"],
"properties": {
"name": {"$ref": "#/$defs/text"},
"level": {"type": "integer", "minimum": 1, "maximum": 9223372036854775807}
}
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,54 @@
# Party contract
## Native loading boundary
Full conformance includes acquisition through the public mapping-root handoff of
[ConfigKit v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md),
followed by this schema and its semantic checks. ConfigKit owns syntax, structural
controls, numeric binding, and resource limits, including its 8 MiB source limit.
Dynamic integers bind as int64 and fractional/exponent values as finite float64;
authored decimal precision is not guaranteed. Preserve supported resolved values.
`extends` is structural input and source-root `config` is a control namespace;
nested ordinary `config` follows upstream rules. Other supported domain extensions
remain permitted. Schema validation adds no trimming, case folding, or defaults.
Structural validation alone does not prove native loading compatibility. The
pinned upstream contract defines this version's boundary independently of later
changes to the repository's general guidance.
Contract: `maximumdirect.rpg.party.v1`. [Schema](schema.json).
The [validation profile](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/docs/validation.md) and [compatibility rules](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/docs/compatibility.md)
apply. See the [example](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/rpg/party/v0.2.0/examples/party.yml).
| Field | Required | Meaning |
| --- | --- | --- |
| `schema_version` | Yes | Exactly `maximumdirect.rpg.party.v1`. |
| `characters` | Yes | Mapping from stable character IDs to roster entries; an empty mapping is valid. |
| `characters.<id>.character` | Yes | Character information. |
| `character.name` | Yes | Nonempty canonical display name. |
| `character.aliases` | No | Alternative names for the same character; omission, null, an empty list, or a list of nonempty strings. |
| `character.classes` | No | List of class objects, possibly empty. Each has a nonempty `name` and optional integer `level` from 1 through 9223372036854775807 after native binding. |
| `characters.<id>.player` | No | Player relationship. When present, an object with a required nonempty `name`. Multiple characters may have the same player. |
IDs are nonempty strings scoped to this party, independent of display names and
application artifact names. They remain stable when a display name changes.
Player names are display labels, not globally unique player identifiers.
Equal character names and aliases do not establish identity; consumers decide
how to handle ambiguity in a particular task. Supported strings are preserved in the resolved handoff.
Every object permits additional fields. Classes are optional domain information
for campaigns that use them. Other character attributes may be extensions.
Known fields have the documented type even when other fields are present.
Optional objects and `classes` accept omission, not null. List order carries no
additional contract meaning; mapping order never establishes character order.
A consumer can derive a party glossary from this roster. It uses character IDs
as entry IDs, canonical names and aliases, and its selected domain category.
Operators need not maintain a duplicate party vocabulary document.
## Differences from Narratio's existing party input
This contract uses a shared marker and `aliases` rather than `alias`. Player and
class information is optional. IDs follow domain identity rather than artifact
key syntax. Name uniqueness, class requirements, and mapping iteration order are
consumer decisions. Narratio's existing `narratio.party.v1` format remains a
separate released interface until adoption is implemented.

View File

@@ -0,0 +1,20 @@
package assets
import (
"io/fs"
"testing"
)
func TestSharedDomainContractsAreEmbedded(t *testing.T) {
for _, path := range []string{
"shared-domain/SOURCE.md",
"shared-domain/glossary/v0.2.0/schema.json",
"shared-domain/glossary/v0.2.0/semantics.md",
"shared-domain/rpg/party/v0.2.0/schema.json",
"shared-domain/rpg/party/v0.2.0/semantics.md",
} {
if _, err := fs.ReadFile(FS(), path); err != nil {
t.Errorf("read embedded %s: %v", path, err)
}
}
}

View File

@@ -1,11 +1,44 @@
package main package main
import ( import (
"context"
"fmt"
"os" "os"
"os/signal"
"syscall"
"gitea.maximumdirect.net/eric/notarius/internal/cli" "gitea.maximumdirect.net/eric/notarius/internal/cli"
"go.maximumdirect.net/commandkit"
"go.maximumdirect.net/releasekit/buildinfo"
) )
func main() { func main() {
os.Exit(cli.Run(os.Args[1:], os.Stdout, os.Stderr)) os.Exit(run())
}
func run() int {
app, err := cli.NewApplication(buildinfo.Version(), cli.Options{})
if err != nil {
fmt.Fprintln(os.Stderr, err)
return 1
}
ctx, stop := interruptContext()
defer stop()
outcome := app.Execute(ctx, os.Args[1:], commandkit.Streams{Out: os.Stdout, Err: os.Stderr})
return outcome.Status
}
func interruptContext() (context.Context, func()) {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
done := make(chan struct{})
go func() {
<-ctx.Done()
// Restore ordinary signal handling while cooperative cleanup runs.
stop()
close(done)
}()
return ctx, func() {
stop()
<-done
}
} }

View File

@@ -1,6 +1,10 @@
# ADR-0004: Package modules by domain, not by stage # ADR-0004: Package modules by domain, not by stage
**Status:** Accepted — its asset-co-location rule is superseded by [ADR-0011](0011-centralize-llm-assets.md); its domain-first module packaging decision remains accepted. **Status:** Accepted in part. Asset co-location is superseded by
[ADR-0011](0011-centralize-llm-assets.md), and prompt/schema registration by
[ADR-0021](0021-compose-native-kits-and-prompt-declared-resources.md).
Domain-first packaging, typed domain ownership, and registrar dependency direction
remain accepted.
**Date:** 2026-07-13 **Date:** 2026-07-13
## Context ## Context

View File

@@ -1,6 +1,9 @@
# ADR-0005: Cache one canonical chunk plan per source # ADR-0005: Cache one canonical chunk plan per source
**Status:** Accepted **Status:** Superseded by
[ADR-0023](0023-unify-accepted-artifact-and-plan-caching.md). Source-addressed plan
semantics and deterministic materialization remain; source-only canonical reuse
and its separate store do not.
**Date:** 2026-07-17 **Date:** 2026-07-17
## Context ## Context

View File

@@ -1,6 +1,12 @@
# ADR-0006: Separate output, cache, and debug state # ADR-0006: Separate output, cache, and debug state
**Status:** Superseded by [ADR-0007](0007-separate-checkpoint-recording-from-reuse.md) **Status:** Accepted in part. The checkpoint invocation policy was superseded by
[ADR-0007](0007-separate-checkpoint-recording-from-reuse.md); the two-cache model
is now superseded by [ADR-0023](0023-unify-accepted-artifact-and-plan-caching.md),
and required output records and the debug summary/trace split by
[ADR-0024](0024-publish-artifacts-with-native-reports-and-debug-evidence.md).
Independent output/cache/debug surfaces, explicit debug selection, and
operator-owned retention remain accepted.
**Date:** 2026-07-17 **Date:** 2026-07-17
## Context ## Context

View File

@@ -1,6 +1,8 @@
# ADR-0007: Separate checkpoint recording from reuse # ADR-0007: Separate checkpoint recording from reuse
**Status:** Accepted **Status:** Superseded by
[ADR-0023](0023-unify-accepted-artifact-and-plan-caching.md), which replaces
checkpoint recording/resume with unified accepted-result reuse.
**Date:** 2026-07-19 **Date:** 2026-07-19
## Context ## Context

View File

@@ -1,6 +1,13 @@
# ADR-0010: Use workload-oriented LLM profile defaults # ADR-0010: Use workload-oriented LLM profile defaults
**Status:** Accepted **Status:** Accepted in part. Profile source replacement was superseded by
[ADR-0019](0019-adopt-native-promptkit-configuration.md), whose native source
boundary is now superseded by
[ADR-0021](0021-compose-native-kits-and-prompt-declared-resources.md).
Checkpoint identity is superseded by
[ADR-0023](0023-unify-accepted-artifact-and-plan-caching.md).
Workload-oriented defaults, D&D-owned profile policy, binding exceptions, and
run-wide profile precedence remain accepted.
**Date:** 2026-08-03 **Date:** 2026-08-03
## Context ## Context

View File

@@ -1,6 +1,11 @@
# ADR-0011: Centralize LLM-facing assets in a content-only package # ADR-0011: Centralize LLM-facing assets in a content-only package
**Status:** Accepted **Status:** Accepted in part. Asset manifests, module schema registration, and
scoped source assembly are superseded by
[ADR-0021](0021-compose-native-kits-and-prompt-declared-resources.md);
checkpoint fingerprints are superseded by
[ADR-0023](0023-unify-accepted-artifact-and-plan-caching.md).
The content-only root assets leaf and domain semantic ownership remain accepted.
**Date:** 2026-08-05 **Date:** 2026-08-05
## Context ## Context

View File

@@ -1,6 +1,9 @@
# ADR-0013: Use request-local candidate handles for semantic reconciliation # ADR-0013: Use request-local candidate handles for semantic reconciliation
**Status:** Accepted **Status:** Accepted; only the checkpoint-fingerprint requirement is superseded by
[ADR-0023](0023-unify-accepted-artifact-and-plan-caching.md).
Request-local handles, fixed mapping, domain ownership, and safe typed application
remain accepted.
**Date:** 2026-08-09 **Date:** 2026-08-09
## Context ## Context

View File

@@ -1,6 +1,10 @@
# ADR-0014: Use feedback-aware validation retries # ADR-0014: Use feedback-aware validation retries
**Status:** Accepted **Status:** Superseded by
[ADR-0022](0022-use-native-continuation-and-application-assessment.md) for execution,
assessment, and disposition, and
[ADR-0024](0024-publish-artifacts-with-native-reports-and-debug-evidence.md) for
diagnostic persistence. Guidance remains separate from operator diagnostics.
**Date:** 2026-08-26 **Date:** 2026-08-26
## Context ## Context

View File

@@ -1,6 +1,11 @@
# ADR-0015: Separate process warnings from quality diagnostics # ADR-0015: Separate process warnings from quality diagnostics
**Status:** Accepted **Status:** Accepted in part. Durable warning/diagnostic files and receipt
presentation are superseded by
[ADR-0024](0024-publish-artifacts-with-native-reports-and-debug-evidence.md).
Diagnostic group caps are superseded by
[ADR-0028](0028-retain-all-diagnostic-groups.md). Process-warning classification,
module-owned meaning, origin-aware aggregation, and sample limits remain accepted.
**Date:** 2026-08-27 **Date:** 2026-08-27
## Context ## Context

View File

@@ -1,6 +1,10 @@
# ADR-0016: Use feedback-aware module-requested retries # ADR-0016: Use feedback-aware module-requested retries
**Status:** Accepted **Status:** Superseded by
[ADR-0022](0022-use-native-continuation-and-application-assessment.md) for execution,
assessment, and fallback, and
[ADR-0024](0024-publish-artifacts-with-native-reports-and-debug-evidence.md) for
diagnostic persistence. Module-authored guidance remains distinct from diagnostics.
**Date:** 2026-08-28 **Date:** 2026-08-28
## Context ## Context

View File

@@ -1,6 +1,10 @@
# ADR-0018: Adopt ConfigKit for configuration loading # ADR-0018: Adopt ConfigKit for configuration loading
**Status:** Accepted **Status:** Accepted in part. The version 5 and dependency API selection is
superseded by [ADR-0021](0021-compose-native-kits-and-prompt-declared-resources.md).
ConfigKit adoption, application semantic ownership, and discovery-only environment
selection remain, as clarified by
[ADR-0020](0020-delegate-configuration-mechanics-to-configkit.md).
**Date:** 2026-09-13 **Date:** 2026-09-13
## Context ## Context

View File

@@ -0,0 +1,96 @@
# ADR-0019: Adopt native PromptKit configuration sources
**Status:** Superseded by
[ADR-0021](0021-compose-native-kits-and-prompt-declared-resources.md) for native
composition, resource ownership, and execution types, and
[ADR-0023](0023-unify-accepted-artifact-and-plan-caching.md) for cache identity.
ConfigKit-owned mechanics and captured source contexts remain in force.
**Date:** 2026-10-04
## Context
PromptKit v0.12 replaces its former source options with ConfigKit-backed
configuration sources, keyed documents, recursive overlays, and native
inheritance. Notarius must choose how application-owned prompt and fallback
assets, operator configuration, and the optional local backend reach PromptKit
without recreating source parsing or inheritance in the adapter. Runtime,
preflight, and operator inspection must agree about the effective definitions.
Notarius also captures checkpoint identity for the PromptKit configuration
used by an execution engine. That identity must follow the engine's captured
definition state rather than re-reading mutable source files, and must not
publish credentials, prompt bodies, provider parameters, or source paths.
## Decision
Use PromptKit's public v0.12 native source APIs as the only PromptKit
configuration boundary. Assemble PromptKit catalogs, registered application
prompt and fallback inputs, the optional operator file or recursively selected
directory, and the optional Notarius local backend registration in that order.
Use native ConfigKit imports and PromptKit/ConfigKit composition behavior;
retain each filesystem input's resource context. Inputs within a group compose
strictly, and later groups recursively overlay earlier ones. PromptKit owns
definition parsing, exact-key `extends` inheritance, and final effective-value
validation. Notarius does not provide a legacy parser, compatibility alias,
filename-priority merger, whole-profile replacement shim, or alternate
inheritance engine.
Execution, explicit-profile preflight, and configuration inspection use the
same source construction. Each constructed engine captures its effective
definitions. Edits to source files take effect for a newly constructed engine,
not an existing one. Derive the private versioned
`promptkit_configuration` checkpoint identity from public captured inspection
and definition APIs, including effective configuration, profile targets and
credential-policy metadata, captured prompt hashes, and the PromptKit and
selected catalog identities. Retain only the digest as checkpoint metadata;
keep all digest inputs private. Exclude local-backend concurrency settings
because they affect scheduling rather than execution semantics.
Keep PromptKit types and source assembly inside the LLM integration boundary.
The CLI may project copied profile fields into a Notarius-owned neutral JSON
contract. PromptKit's effective and explanation reports remain upstream
redacted configuration and source-history views. Neither inspection path reads
credential values or contacts a provider.
## Compatibility
The migration to v0.12 keyed configuration is an intentional external file
format change. Operators must migrate `id`/`version` embedded fields and
`base_profile` to native keyed documents and `extends`. Notarius does not
silently accept the former option-based API or file format. Notarius's own
version 5 configuration contract and loader decision in
[ADR-0018](0018-adopt-configkit.md) remain in force; this decision concerns
PromptKit definitions and source composition.
The workload-oriented profile identity and D&D fallback ownership in
[ADR-0010](0010-workload-oriented-llm-profile-defaults.md) remain in force.
Only that ADR's former claim that a matching operator profile completely
replaces the fallback has been superseded: native recursive overlays retain
unspecified inherited fields.
## Alternatives considered
- Keep the removed PromptKit option-based configuration API or add a
compatibility parser. This would fork the supported upstream contract and
preserve legacy format machinery.
- Merge profile documents inside Notarius or restore whole-profile
replacement. This would duplicate upstream composition behavior and make
inspection, preflight, and runtime easier to diverge.
- Re-read and hash source files for checkpoint identity. This could describe
mutable files rather than the definitions captured by the engine and would
duplicate upstream discovery and composition.
- Expose upstream inspection structs directly as CLI output. This would bind
the public Notarius contract to dependency-owned Go types.
## Consequences
PromptKit remains the owner of its native configuration semantics, while
Notarius owns which registered and operator sources are assembled and when an
engine is reconstructed. A valid later overlay can supersede an earlier
definition; validation applies to the final effective definitions rather than
as a separate audit of every superseded value. Configuration reports can
contain ordinary prompt and provider parameters, so operators own the
destination and retention of explicitly requested reports even though
credential-shaped fields are redacted. PromptKit upgrades require review of
the source adapter, captured identity, reports, and the pinned upstream
contracts.

View File

@@ -0,0 +1,49 @@
# ADR-0020: Delegate configuration mechanics to ConfigKit
**Status:** Accepted
**Date:** 2026-10-04
## Context
[ADR-0018](0018-adopt-configkit.md) establishes ConfigKit as Notarius's
configuration loader. This decision clarifies the continuing ownership boundary
as ConfigKit's capabilities evolve.
## Decision
ConfigKit owns configuration mechanics: source loading, parsing, imports,
composition, overlays, inheritance, presence tracking, provenance, and
inspection. Notarius adopts those semantics through ConfigKit's public APIs.
Notarius owns application meaning: its configuration schema, version, defaults,
field normalization, validity checks, and pipeline/module compatibility. It
supplies application-specific defaults, normalization, and validation through
ConfigKit's supported extension points. Source-origin metadata supports
application rules such as declaration-relative filesystem paths.
Notarius selects configuration inputs and options through the public API.
ConfigKit resolves those inputs and delivers the final application document
with source composition and application-field normalization complete. Notarius
converts that document into its runtime configuration and performs
catalog-dependent pipeline resolution and runtime preparation afterward.
Operator-requested effective configuration and setting explanations use
ConfigKit's inspection APIs. Application validation evaluates the resolved
configuration. Changes to general configuration mechanics are pursued upstream
in ConfigKit and adopted through its supported API.
## Alternatives considered
- Application-owned configuration loading provides direct control over source
semantics and assigns parsing, composition, and provenance maintenance to
Notarius.
- Shared ownership of configuration mechanics allows local adaptations and
requires maintaining coordinated semantics across ConfigKit and Notarius.
## Consequences
ConfigKit provides a coherent configuration-resolution and inspection contract.
Notarius's configuration work concentrates on application semantics and operator
integration. Upstream upgrades are evaluated against this ownership boundary
and the application's deliberately selected requirements. This decision
clarifies ADR-0018 while retaining its adoption and application-format decisions.

View File

@@ -0,0 +1,75 @@
# ADR-0021: Compose native kits and prompt-declared resources
**Status:** Accepted
**Date:** 2026-11-22
## Context
Notarius duplicated configuration assembly, resource registration, completion
types, inspection, CLI parsing, and provider scheduling that the adopted kits
now supply. Keeping those wrappers would preserve competing ownership rather
than protect the application's typed artifact boundary.
## Decision
Use ConfigKit, PromptKit, CommandKit, ckconfig, and ckprompt directly at their
respective application boundaries. The composition root owns one application
load per selected configuration and constructs one shared native engine for
all selected model roles from that original result. Runtime and whole-app or
focused inspection share captured sources and native provenance, not a settings
reserialization or a second loader. ConfigKit retains ownership of composition
mechanics under [ADR-0020](0020-delegate-configuration-mechanics-to-configkit.md).
Version 6 replaces version 5 without a compatibility parser.
Assemble bundled provider resources, embedded application resources, and optional
operator companions beside the selected main source through native contexts and
precedence. Native declarations own qualified resources, inheritance, default
output contracts, and schema selections. PromptKit prepares schemas and owns
structural validation and repair. Application modules retain prompt meaning,
interpretation, and static resource-ID dependencies, not manifests, response-schema
registries, asset fingerprints, virtual mounts, or fallback-profile registration.
The root assets package remains an ordinary content-only embedded leaf.
Model-executing code uses native requests, results, exchanges, errors, and
observations. Pure domain models, codecs, source resolution, and deterministic
helpers remain independent. CommandKit and its integrations own standard command
declarations, parsing, inspection, and presentation; Notarius supplies loaders,
pipeline commands, request inputs, and report content. Shared loaders and offline
preflight do not allocate run storage or perform implicit provider probes.
One ready-job worker pool bounds extraction and merge/normalize continuations
together. Prerequisite waits occupy no worker; nested validation and correction
stay inside the current job. Native engine/backend admission is independent.
Inject no backend concurrency/queue defaults, cross-backend ceiling, extra queue,
or application capacity retries. Preserve stable scope ordering and cancellation
draining. A completed turn releases admission before nested assessment.
This supersedes [ADR-0019](0019-adopt-native-promptkit-configuration.md)'s old
source adapter and private-type boundary; its fingerprint policy is replaced by
[ADR-0023](0023-unify-accepted-artifact-and-plan-caching.md). It replaces the asset
registration portions of [ADR-0004](0004-package-modules-by-domain.md) and
[ADR-0011](0011-centralize-llm-assets.md), retaining domain-first packaging,
semantic ownership, and the content-only leaf. It replaces ADR-0018's version 5
selection, not [ConfigKit adoption](0018-adopt-configkit.md) or ADR-0020's ownership.
[ADR-0010](0010-workload-oriented-llm-profile-defaults.md)'s workload-oriented
profile intent remains; native qualified resources replace its older source form.
## Alternatives considered
- Keep private completion, loader, and inspection adapters. This duplicates kit
behavior and obscures the actual execution contract.
- Adopt only PromptKit and defer CommandKit. Temporary command/report wrappers
would need another cutover and could select different configuration.
- Retain a global LLM scheduler above native admission. This adds a second queue
and couples independent backends without a selected product requirement.
## Consequences
The kits are deliberate dependencies at execution and composition boundaries;
typed application assessment and durable domain artifacts remain distinct.
Upstream changes require review of the public APIs actually consumed, rather
than preservation of old wrappers. Workers do not promise a global provider-call
ceiling or backend saturation. CLI and configuration compatibility is intentionally
broken; artifact schemas are not redesigned. Exact public syntax and dependency
integration details belong in the canonical configuration, CLI, and integration
references, not copied library manuals here.

View File

@@ -0,0 +1,83 @@
# ADR-0022: Use native continuation and application assessment
**Status:** Accepted; module-composed producer mechanics narrowly superseded by
[ADR-0026](0026-core-owned-operation-preparation-and-execution.md). Other decisions remain in force.
**Date:** 2026-11-22
## Context
Private retry machinery conflated transient failures, structural repair,
semantic defects, and validator availability. Latest-response replacement also
discarded conversation history while requiring an application replay protocol.
Native execution can own those mechanics without owning domain acceptance.
## Decision
One small typed producer helper connects native execution to module functions
for fixed input preparation, interpretation, correction requests, and supported
fallback construction. The pipeline supplies the operation's typed assessor.
PromptKit owns transient retries, structural repair, growing conversation history,
and semantic turn iteration. Notarius selects the semantic-turn allowance but
does not pin omitted native repair/retry counts or extend exhausted native work
with an outer retry loop. Deterministic operations have no generic retry budget.
Each correctable producer has initial and correction prompts using the same
response schema and bundled default profile. Preserve explicit request selections
and run overrides. Enduring principles and source/reference material are supplied
initially; the correction template adds current findings and a new assignment.
Native coordination carries the exchange, without manual assistant replay or
rerendering original inputs. Each response is a complete replacement, not a patch.
Normalization applies each proposal afresh to fixed originals and candidate
handles; never union groups across turns.
Check native errors and structural validation status before interpretation,
including failed validation returned with nil Go error. A usable typed candidate
receives the complete applicable validator chain once, in configured order.
Earlier rejection does not suppress later guidance. Revisions, unchanged
candidates, and the final permitted response receive the whole chain; there is
no duplicate assessment after the helper returns.
The detecting validator or module authors actionable guidance separately from
reason codes and operator messages. Unavailable assessment is not a semantic
defect; provider failures do not become instructions. LLM validators execute
once per assessment, without their own semantic continuation loop. Native
success, stopped, and exhausted statuses do not imply application acceptance.
Strict is the application default. Explicit permissive mode may construct a
module-supported fallback after terminal nonacceptance. A fallback satisfies
intrinsic artifact and downstream invariants without ordinary semantic approval
or rerunning the normal validator chain. Failure to construct it fails normally.
Caller cancellation and undelivered responses never initiate fallback. A
result-less failed continuation cannot recover an earlier candidate. Reuse
exclusions and disclosure follow ADRs 0023 and 0024. Exact configuration precedence
and defaults belong in [Configuration](../config.md).
This supersedes [ADR-0014](0014-feedback-aware-validation-retries.md) and
[ADR-0016](0016-feedback-aware-module-requested-retries.md)'s budgets, private
candidate transport, latest-only replay, and terminal policies. It retains their
useful separation of actionable guidance from diagnostic prose and of execution
failure from detected defects. Diagnostic persistence is governed by
[ADR-0024](0024-publish-artifacts-with-native-reports-and-debug-evidence.md).
Contextual identity and request-local reconciliation safety under ADRs
[0012](0012-resolve-opaque-entity-identifiers-deterministically.md) and
[0013](0013-use-request-local-candidate-handles-for-semantic-reconciliation.md)
remain in force.
## Alternatives considered
- Retain blanket producer/validator retries. These can extend native budgets
and repeat deterministic work without information capable of fixing it.
- Keep latest-only manual replay. This duplicates conversation mechanics and
discards earlier application-visible turns.
- Let validators decide terminal disposition or revalidate every fallback.
That distributes acceptance policy and confuses qualified recovery with
ordinary validation.
## Consequences
Native execution and application acceptance are separate facts. Accumulated
history uses more context, bounded by the selected allowance. Not every failure
has a supported fallback: an empty scene description, for example, cannot meet
its required artifact shape. Permissive output is explicitly qualified and
reuse-ineligible rather than silently accepted. Paid-model quality and exact
provider-attempt parity with the retired loops are not promised.

View File

@@ -0,0 +1,82 @@
# ADR-0023: Unify accepted artifact and plan caching
**Status:** Accepted
**Date:** 2026-11-22
## Context
Source-keyed plans and fingerprinted checkpoints imposed two recovery models
and substantial identity/provenance machinery. The selected need is narrower:
reuse successful model-backed predecessors after downstream failure without
repeating their complete production and assessment.
## Decision
Use one best-effort filesystem cache for final accepted typed artifacts and
LLM-generated chunk plans. Prepare the initial native request once and use its
opaque MessageContentHash unchanged, with no additional identity dimensions.
Execute that same prepared handle on a miss and discard it on a hit. Corrections
do not change the key. Store the final accepted codec artifact, including applied
normalization, rather than a native response, exchange, or reconciliation proposal.
Message roles, exact text, boundaries, and order select reuse. Model/settings,
session, schema metadata, policy, library versions, and implementation changes
add no key dimensions. Text rendered into the messages participates as content.
Changed policy may therefore reuse old acceptance; operators deliberately choose
bypass or refresh when they want re-execution.
Hits receive ordinary codec and current-source usability checks, not renewed
semantic assessment, replayed exchanges, fabricated execution, or historical
usage. Cached plans are rematerialized against the current source. Unusable
entries miss. Deterministic operations remain uncached without synthetic requests.
Store only final ordinary acceptance. Failed, rejected, incomplete, canceled,
and fallback results cannot be stored. Fallback and actually affected dependent
work skip lookup as well as storage; unrelated accepted predecessors remain
reusable. Eligibility is a small handoff fact, not a dependency fingerprint graph.
Auto reads and stores acceptance; bypass does neither; refresh skips lookup and
replaces only after new acceptance. Failed refresh preserves earlier accepted
bytes. Cache I/O failures produce diagnostics without failing otherwise successful
work or repeating model calls. Records are plain accepted JSON, not envelopes,
manifests, acceptance ledgers, or copied source/execution histories. Exact root,
layout, and control precedence belong in configuration and operations references.
Ignore legacy checkpoint and source-plan records without importing, rewriting,
or deleting them. Remove explicit resume, recomputation barriers, and the separate
canonical-partition guarantee. Matching initial messages may reuse a plan; changed
prompt/reference/input content may select another partition. Retain plan range,
annotation, source-order, and deterministic materialization correctness.
This supersedes [ADR-0005](0005-cache-canonical-chunk-plans-by-source.md) and
[ADR-0007](0007-separate-checkpoint-recording-from-reuse.md), and the two-cache
model in [ADR-0006](0006-separate-output-cache-and-debug-state.md). It replaces
checkpoint/fingerprint clauses in ADRs
[0010](0010-workload-oriented-llm-profile-defaults.md),
[0011](0011-centralize-llm-assets.md),
[0013](0013-use-request-local-candidate-handles-for-semantic-reconciliation.md), and
[0019](0019-adopt-native-promptkit-configuration.md), not their retained domain,
content, or identity boundaries.
Apply [ADR-0017](0017-defer-cache-access-policy-to-deployment.md)'s permission
ownership to this unified cache: deployment umask, setgid, and default ACLs govern
effective access. Retain confined paths, symlink rejection, validation, atomic
publication, and recovery without permission convergence or automatic migration.
Output and debug retain independent roots and lifecycles.
## Alternatives considered
- Keep one canonical partition per source. This ignores changed initial task
content and retains a second lookup/publication mechanism.
- Use comprehensive execution or policy fingerprints. That changes the selected
reuse semantics and restores the removed compatibility bookkeeping.
- Cache native responses or restore conversations. Neither is the accepted typed
application result, and each requires replay or renewed interpretation.
## Consequences
Ordinary reruns recover reusable accepted predecessors without a resume request.
Acceptance under changed model or validation policy is not implied by a hit.
Cache is reconstructible and best effort, not an execution history or a storage
durability guarantee. Legacy data stays available for operator-managed cleanup;
no automatic conversion, expiry service, or garbage collector is introduced.

View File

@@ -0,0 +1,94 @@
# ADR-0024: Publish artifacts with native reports and debug evidence
**Status:** Accepted; the requirement for one native invocation ExecutionGroup is
partially superseded by [ADR-0025](0025-use-consumer-owned-execution-observation.md),
whole-source evidence representation by [ADR-0027](0027-share-whole-source-capture-evidence.md),
and diagnostic group caps by [ADR-0028](0028-retain-all-diagnostic-groups.md).
All other decisions remain accepted.
**Date:** 2026-11-22
## Context
Required manifests, receipts, indexes, reporting sidecars, and copied execution
ledgers made consumers depend on accounting rather than the domain artifacts.
Split sanitized-summary/detailed-trace machinery also duplicated native evidence
and conflated useful inspection with a stable reporting protocol.
## Decision
Domain artifacts are the primary deliverables, including supported qualified
fallbacks. Preserve intrinsic schemas and existing run-specific logical paths,
including selected chunk-map/evidence auxiliaries. Consumers need no index,
manifest, persisted receipt, warnings/diagnostics sidecars, or execution ledger.
Publish artifacts, finalize requested capture, then submit one small native
completion value and human template through CommandKit. Native formats render
that same value; no separate encoder or universal envelope is introduced.
The completion report identifies the pipeline, deliverable count, publication
directory, available debug directory, and positive fallback count. Count each
operation that emits fallback once, not its affected artifacts or attempts.
Disclose fallback independently of diagnostic verbosity. Standard commands keep
their native values. [CLI Reference](../cli.md) owns exact report fields,
stdout/stderr behavior, and outcome codes.
Preserve native operation causes separately from rendering and delivery failures.
Post-publication capture/report failure returns nonzero with available locations
while retaining valid artifacts and evidence. Failed stdout can be partial;
consumers check status before decoding a successful report. Do not rerun model
work, rewrite history, or remove published files to compensate for delivery failure.
Use one native invocation ExecutionGroup, enrolling actual initial, continuation,
and nested validator executions once. Preserve native IDs, terminal coverage,
and unknown usage without parallel totals, synthetic IDs, or a profile ledger.
Cache hits contribute no execution or historical usage.
Explicit debug selection and a nonempty effective destination enable one run
recorder. A directory alone does not enable it; explicit empty disables capture.
Allocate after configuration/run identity but before engine construction/preflight.
Update the relative latest link at start, never completion. Persist convenient
run/operation evidence incrementally and finalize once before successful reporting.
Requested allocation, recording, or finalization failures fail the invocation,
retaining primary causes and whatever evidence/publication is available.
Capture fixed inputs, configuration/composition, prepared contracts, native events,
available results and full application-visible exchanges, typed candidates,
findings/guidance, correction/normalization material, fallbacks, deterministic
results, and cache decisions. Reuse prepared evidence without another preparation
or provider call. Label undelivered responses unassessed and result-less failures
with available evidence; do not fabricate missing provider bodies. Exact filenames
and serialization remain private diagnostic choices, not a public format.
Use ConfigKit secret-aware inspection and native credential omissions. Do not
directly serialize marked secrets or collect unrelated environment/filesystem
content. Do not heuristically scrub or rewrite selected source, prompts, responses,
or arbitrary strings. A debug bundle may retain sensitive application data; it
is not promised sanitized. Operators own access and retention. Do not automatically
delete output or requested bundles. Output, cache, and debug remain independent.
This replaces [ADR-0006](0006-separate-output-cache-and-debug-state.md)'s required
output records and summary/trace split while retaining its three surfaces and
explicit debug selection. It supersedes durable reporting in
[ADR-0015](0015-separate-process-warnings-from-quality-diagnostics.md), retaining
module-owned diagnostic classification and bounded framework aggregation. It
also replaces the private attempt-record restrictions of ADRs
[0014](0014-feedback-aware-validation-retries.md) and
[0016](0016-feedback-aware-module-requested-retries.md) without moving conversation
state into ordinary artifacts or cache entries.
## Alternatives considered
- Rebuild manifests and receipts with native execution data. This preserves an
unnecessary consumer dependency and another reporting model.
- Retain sanitized summaries beside sensitive traces. Heuristic content rewriting
can alter evidence without establishing a selected sanitized-bundle guarantee.
- Treat capture failures as harmless warnings or retry model work. Requested
capture is required work, but its failure cannot repair model output.
## Consequences
Consumers use configured lane/auxiliary paths and optional native reports rather
than receipt traversal. Diagnostic files can change independently of artifacts.
Debug may duplicate evidence for convenient inspection without a complete provider
transcript guarantee. Quiet presentation does not erase fallback qualification
from the report value or turn delivery failure into success. No new access policy,
automatic retention service, release gate, or release authorization is created.

View File

@@ -0,0 +1,49 @@
# ADR-0025: Use consumer-owned execution observation
**Status:** Accepted
**Date:** 2026-11-22
## Context
Native contextual observation now reaches initial, prepared, coordinated, nested,
and concurrent execution without application request-option forwarding.
ckprompt supplies optional invocation reporting; requested debug capture needs
its own native snapshot. The runner is not a consumer of invocation accounting.
## Decision
Each interested consumer attaches native observation through its execution
context. ckprompt owns optional reporting. The CLI owns a debug group only when
capture is enabled, writes its snapshot before capture finalization after joined
work, and preserves publication-aware capture failures. Other callers own their
observers and inspect them when their work finishes.
The runner propagates the supplied context without a group input, unconditional
group allocation, or general observer forwarding through execution options.
Per-request capture observers and preparation hooks retain operation evidence
independently of invocation accounting.
Independent native groups may observe the same work. Do not add their overlapping
totals or introduce shared-group discovery or an application accounting service.
Preserve native IDs, terminal coverage, and unknown-versus-zero facts; cache hits
contribute no historical executions or usage.
This supersedes only [ADR-0024](0024-publish-artifacts-with-native-reports-and-debug-evidence.md)'s
requirement for one invocation ExecutionGroup. Its artifact, report, capture,
failure, sensitive-data, and remaining native-accounting decisions remain in force.
There is no required count of consumers or groups.
## Alternatives considered
- Keep runner-owned accounting and forward observers through requests. Native
context already supplies the mechanism; the runner does not use the totals.
- Discover and share one group between consumers. This adds ownership machinery
without a demonstrated need; independent native groups are sufficient.
## Consequences
Optional reporting and requested debug evidence coexist without a second
application ledger. No-flag execution needs no application accounting group.
CLI publication/finalization and primary causes remain application-owned.
No configuration version, prompt/model choice, artifact, cache, assessment,
worker/admission, budget, or completion-report contract changes.

View File

@@ -0,0 +1,57 @@
# 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.

View File

@@ -0,0 +1,39 @@
# ADR-0027: Share whole-source capture evidence
**Status:** Accepted
**Date:** 2026-11-25
## Context
Requested evidence repeated the original input and complete parsed source in
many operation records. This made larger bundles harder to navigate without
improving the availability of chunk-level context or native request history.
## Decision
Record original input and validated parsed source once at logical bundle-root
paths in the selected evidence sink. Operation and run records identify those
records with explicitly labeled bundle-root references. An explicit execution
writer takes precedence over an enabled debug recorder; shared records and their
consumers use the same selected sink. Available evidence remains on failure.
Chunks, selections, references, incoming artifacts, and native prepared
messages, responses, and exchanges remain directly readable. No symlinks,
filesystem-root assumptions, or reconstruction tool are required. Requested
capture remains required work; no sanitization, retention, or access-policy
guarantee is added. This narrowly supersedes the whole-source duplication choice
in [ADR-0024](0024-publish-artifacts-with-native-reports-and-debug-evidence.md).
## Alternatives considered
- Repeat the entire source in every operation: convenient in isolation, but
needlessly duplicates run-wide context.
- Replace all repeated content with references: makes ordinary operation and
native request inspection less convenient than selected.
## Consequences
A complete bundle provides source context without each operation directory
being self-contained. Logical references are private evidence representation,
not a new durable reporting protocol. Operators continue to own access and
retention of potentially sensitive evidence.

View File

@@ -0,0 +1,35 @@
# ADR-0028: Retain all diagnostic groups
**Status:** Accepted
**Date:** 2026-11-25
## Context
Fixed local and final diagnostic group caps could fail otherwise valid work or
discard non-warning groups. The caps did not represent selected input limits,
and truncated collections could not preserve every completed finding.
## Decision
Retain all valid diagnostic groups in stable origin-aware order, without local
or final group-count caps. Preserve exact checked occurrence totals, at most
three distinct samples per group, and the per-group omitted-sample count.
Invalid diagnostics and arithmetic overflow still fail. No replacement limit,
exhaustive occurrence ledger, or durable report sidecar is introduced.
This supersedes only the group-cap and collection-truncation portions of
[ADR-0015](0015-separate-process-warnings-from-quality-diagnostics.md) and
[ADR-0024](0024-publish-artifacts-with-native-reports-and-debug-evidence.md).
Their diagnostic classifications and other accepted decisions remain in force.
## Alternatives considered
- Increase or configure the caps: this retains the arbitrary failure or loss
boundary without establishing a selected resource policy.
- Record every occurrence: this adds an exhaustive ledger that is not needed
for grouped diagnostic presentation.
## Consequences
Group memory grows with distinct findings. Samples remain bounded per group,
but the application makes no global group-count or diagnostic-memory guarantee.

View File

@@ -1,243 +1,420 @@
# CLI Reference # CLI Reference
This is the canonical reference for the implemented Notarius command-line This is the canonical reference for Notarius invocation, command inputs, reports,
interface. For the shortest successful run, see the [README](../README.md). and outcome codes. [Configuration](config.md) owns fields, defaults, resource
Configuration fields, discovery rules, and selectable module keys are defined selection, and module keys; [Operations](operations.md) owns runtime state;
in [Configuration](config.md); runtime state and recovery procedures are integration contracts own domain payloads.
defined in [Operations](operations.md).
Notarius imports native [CommandKit, ckconfig, and ckprompt](integrations/pkg-commandkit.md)
interfaces. The [upstream CLI reference][native-cli] owns their general parser, report, inspection,
and smoke semantics. The examples below show Notarius-specific selections.
Use help for every installed command's current options.
For retired command/configuration mappings and receipt-consumer changes, see
[native migration guidance](consumers/native-migration.md).
## Command Summary ## Command Summary
~~~ ~~~text
notarius help notarius --help
notarius --version notarius help pipeline run
notarius run <pipeline-id> --input path/to/source.json [--json] [flags] notarius version
notarius config validate [--config path/to/config.yml] [--config-overlay name] [--pipeline pipeline-id] [--only lane-a,lane-b] notarius completion bash
notarius pipelines list [--config path/to/config.yml] [--config-overlay name] [--json] notarius pipeline list
notarius pipeline show PIPELINE_ID
notarius pipeline validate PIPELINE_ID
notarius pipeline preflight PIPELINE_ID --input-file PATH
notarius preflight PIPELINE_ID --input-file PATH
notarius pipeline run PIPELINE_ID --input-file PATH
notarius run PIPELINE_ID --input-file PATH
notarius config scopes
notarius config validate
notarius config show
notarius config sources
notarius config explain
notarius config diff
notarius promptkit list prompts
notarius promptkit show profile PROFILE_ID
notarius promptkit requirements show PROMPT_ID
notarius promptkit requirements validate PROMPT_ID
notarius promptkit show prepared PROMPT_ID
notarius promptkit test KIND
~~~ ~~~
Running Notarius without arguments, or with **help**, **--help**, or **-h**, Bare invocation, `help`, `--help`, and `-h` display native help. Help also works
writes the command summary to standard output and exits with status 0. on subcommands without their execution-only required inputs. Help, version, and
Bash/Zsh/Fish completion need no configuration, credentials, or run storage.
`notarius --version` is valid only as the sole root argument. It writes exactly `version` reports the application identity; `version --scope commandkit` selects
`notarius <version>` followed by a newline to standard output and exits with the library identity. Source-tagged installation and release-linked build identity
status 0. A tagged `go install` build can report its main-module stable tag, remain available; an unversioned checkout reports `dev`. Version output
and controlled builds can inject a stable tag at link time through uses native report formats, not a custom root flag.
`gitea.maximumdirect.net/eric/notarius/internal/buildinfo.Override`; an ordinary
unversioned checkout reports `development`. Invalid injected version content is
a runtime error with exit status 1, while extra `--version` arguments are a
syntax error with exit status 2. This diagnostic does not replace the
[run-result](integrations/run-result.md) or artifact contracts for downstream
compatibility decisions.
## run ## Syntax And Supplied Values
~~~ Put flags after the **complete command path**, optionally interspersed with its
notarius run <pipeline-id> --input path/to/source.json [--json] [flags] operands. Value flags accept `--name value` or `--name=value`. Boolean flags
accept presence and explicit values such as `--debug=false`. `--` ends option
parsing; later tokens are operands.
Singleton flags may repeat; the last successfully parsed occurrence supplies
the value. Every occurrence is parsed, so a malformed earlier value remains an
error. Repeatable flags retain occurrence order and do not split commas.
Omission differs from supplied empty, false, and zero. Semantic validity still
depends on the selected command and native request. See
[registered syntax][syntax] for the shared rules.
## Configuration Selection
`--config PATH` fixes the main source; explicit empty fails instead of discovering
another file. Omission uses [configuration discovery](config.md#configuration-discovery-and-precedence).
Commands that support `--overlay NAME` select the native application overlay.
Configuration and pipeline commands also expose repeated `--set POINTER=JSON`:
~~~sh
notarius config show --config examples/dnd-minimal/config.yml \
--set /concurrency/workers=1 --path /concurrency/workers --format json
~~~ ~~~
The **run** command executes the named pipeline for one input file. The The value is JSON, so strings require JSON quoting. Preserve shell quoting:
pipeline ID and **--input** are required.
| Flag | Meaning | ~~~sh
notarius pipeline validate dnd-session \
--config examples/dnd-minimal/config.yml \
--set '/pipelines/dnd-session/mode="permissive"' \
--set /pipelines/dnd-session/max_additional_turns=0
~~~
Assignments use non-root mapping paths, not sequence indexes. To change a record
inside a steps/resource list, use an appropriate source/overlay or replace the
complete list. Duplicate or overlapping assignments fail. Version and inheritance
controls are not assignment targets. Overrides follow native loading and recorded
resolution; they are not an alternate YAML parser. PromptKit commands expose
their own native selection/request flags; use help rather than assuming every
configuration flag applies to them.
## Pipeline Commands
`pipeline list` lists configured IDs in sorted order without module resolution
or engine construction. `pipeline show PIPELINE_ID` resolves modules, controls,
validator chains, static prompt dependencies, steps/lanes, and reference bindings,
without expanding every LLM profile or reading input/reference content.
`pipeline validate PIPELINE_ID` performs offline domain resolution and known
prompt/profile dependency checks using the shared load and engine when needed.
It requires no input transcript, reference file bytes, credential values,
provider call, or output/cache/debug directories. Partial profiles remain valid.
This is distinct from native configuration validation: request preparation and
dynamic selections are checked when used.
Show and validate accept configuration selection and native report controls.
They inspect the complete configured pipeline; lane selection belongs to run
and preflight:
~~~sh
notarius pipeline list --config examples/dnd-complete/config.yml --format json
notarius pipeline show dnd-session --config examples/dnd-complete/config.yml
notarius pipeline validate dnd-session --config examples/dnd-complete/config.yml
~~~
### Preflight
`preflight PIPELINE_ID` is the native alias for `pipeline preflight PIPELINE_ID`.
Both accept the same required input, selection, reference, destination, debug,
and native override flags as [run](#run). Preflight constructs selected modules,
checks the supplied input and external references, checks output and applicable
cache access, and invokes available native reachability, authentication, and
structured-generation checks for selected model targets. Checks sharing a profile
or backend share the corresponding probe. It does not execute the pipeline or
publish domain artifacts. Unlike offline validation it can contact providers and
incur inference costs; see [Operations](operations.md#preflight-lifecycle).
The assessment contains `pipeline`, `ready`, `checks`, and an optional
`debug_directory`. Each check has a stable class `id`, a structured `scope`, a
`result` (`passed`, `failed`, or `warning`), a `message`, and sometimes a `code`.
Scopes may identify a path, reference, profile, backend, pipeline, or associated bindings.
Cache access problems warn without making readiness false. A failed or incomplete
required check makes readiness false. Default text shows the summary, failures,
and warnings; verbose visibility adds successful details. JSON and YAML serialize
the same assessment. For example, a portion of a successful JSON assessment is:
~~~json
{
"checks": [
{"id":"input","message":"Source input is valid.","result":"passed","scope":{"path":"/data/source.json"}}
],
"pipeline": "campaign",
"ready": true
}
~~~
The checks shown are illustrative, not an exhaustive list. When an assessment is
available it is delivered even for unsuccessful readiness; early argument or
loading errors can have no assessment. Always use process status as well: capture
or report delivery can fail independently of a ready assessment. Quiet mode can
suppress stdout and failed delivery can leave partial output. Readiness applies
to the supplied input, not a later transcript; run validates its own input.
### Run
~~~text
notarius run PIPELINE_ID --input-file PATH [flags]
notarius pipeline run PIPELINE_ID --input-file PATH [flags]
~~~
`run` is a native alias for `pipeline run`: both resolve to the same declaration
and handler. One pipeline ID and a nonempty `--input-file` are required.
| Run flag | Meaning |
| --- | --- | | --- | --- |
| **--config path** | Use this configuration file. When omitted, configuration discovery applies; see [Configuration](config.md). | | `--config PATH`, `--overlay NAME`, `--set POINTER=JSON` | Configuration selection above. |
| **--config-overlay name** | Select a ConfigKit configuration overlay. Empty and **default** select the composed base configuration. | | `--input-file PATH` | Required source input file. |
| **--input path** | Source input file to process. Required. | | `--lane ID` | Repeat to select literal artifact lane IDs; commas are part of an ID, not separators. |
| **--output-dir path** | Override the configured output root for this run. | | `--output-dir PATH` | Nonempty invocation-relative override of the output root. |
| **--json** | Write the successful run-result receipt as JSON to standard output. | | `--cache auto\|bypass\|refresh` | Invocation-wide selection over binding and pipeline cache controls. |
| **--chunk_cache auto\|bypass\|refresh** | Override chunk-plan cache handling for this run. | | `--reference SELECTOR=PATH` | Repeatable external reference bind. |
| **--resume** | Reuse compatible recorded checkpoints when checkpoint recording is enabled. | | `--without-reference SELECTOR` | Repeatable external reference unbind. |
| **--recompute-step step-id** | With **--resume**, recompute the selected ordered step and its dependent lanes. It cannot be combined with **--only**. | | `--debug[=true\|false]` | Native debug verbosity and independent run capture selection. |
| **--debug** | Retain a debug bundle for this run. | | `--debug-dir PATH` | Capture destination override; explicit empty disables capture. |
| **--debug-dir path** | Override the debug-bundle root. Requires **--debug**. | | `--llm-profile ID`, `--llm-session-id ID` | Native resource/session selections below. |
| **--only lane-a,lane-b** | Run only the selected comma-separated artifact lanes when that selection is valid for the configured pipeline. | | `--llm-*` execution controls | Run-wide request overrides below. |
| **--llm-profile id** | Highest-precedence configured profile for selected LLM-backed bindings and validators; it replaces binding and [pipeline](config.md#pipelines) defaults. | | `--format`, `--quiet`, `--verbose`, `--progress` | Native presentation controls below. |
| **--session-id id** | Override the generated prompt session identifier with a non-empty value for LLM-backed module calls. |
| **--reasoning-effort value** | Replace the selected PromptKit profile's reasoning effort for every LLM-backed call in this run. The value must be non-empty and the flag may be specified only once. |
| **--clear-reasoning-effort** | Clear reasoning effort inherited from the selected PromptKit profile for every LLM-backed call in this run. |
| **--reference selector=path** | Add or replace external file reference bindings at pipeline, lane, chunk, or binding scope. Repeatable. |
| **--without-reference selector** | Remove matching configured external reference bindings. Repeatable. |
**--chunk_cache** accepts only **auto**, **bypass**, or **refresh**. A directory alone does not enable capture. A nonempty debug-directory override
**--debug-dir**, **--output-dir**, **--session-id**, and can re-enable capture over an empty configured root, but still needs debug
**--reasoning-effort**, and **--recompute-step** reject explicit empty values. selection. `--debug --quiet` captures while suppressing stdout; `--quiet --debug`
**--reasoning-effort** and **--clear-reasoning-effort** are mutually exclusive. selects debug visibility and capture. `--debug=false` disables capture. Debug
When neither is present, reasoning effort comes from the selected PromptKit on inspection commands changes native visibility without allocating a pipeline
profile. These controls apply to the shared run client, including retries and bundle. [Configuration](config.md#concurrency-output-cache-and-debug) defines
LLM-backed validators, and do not modify configuration or profile files. directory defaults; [Operations](operations.md) owns capture lifecycle.
Persistent reasoning settings remain a PromptKit profile concern.
**--recompute-step** requires **--resume**; checkpoint requirements and reuse
behavior are documented in [Operations](operations.md).
Every run uses one effective prompt session. Without **--session-id**, Notarius Example using the maintained minimal configuration and input:
generates a stable `notarius:v1:` identifier from the trimmed resolved input
module key and the input file's exact raw bytes. The same module and bytes
therefore produce the same identifier, regardless of pipeline, references,
profile, retries, or run settings. An explicit non-empty value replaces that
default. Session identifiers are visible to providers; they are non-secret
correlation identifiers, not credential storage. See
[Operations](operations.md#operational-limits) for privacy and workflow
guidance.
### Reference selectors ~~~sh
notarius run dnd-session --config examples/dnd-minimal/config.yml \
--input-file examples/dnd-minimal/transcript.json --format json --show-tokens
~~~
Use **--reference** only for reference slots declared by the selected This run uses a configured provider and needs its credentials when required.
configured targets. Qualification narrows the scope of an override: Offline validation does not. ckprompt supplies opt-in [usage diagnostics][usage];
these do not change the Notarius completion value or domain artifacts.
Accepted-artifact hits perform no current model work; see
[reuse and recovery](operations.md#accepted-result-cache-and-recovery).
| Form | Target | ### Run-wide LLM Overrides
These canonical ckprompt flags reach initial producers, semantic corrections,
and LLM validators on the shared native engine without mutating configuration:
| Flag | Value |
| --- | --- | | --- | --- |
| slot=path | Every selected target that declares slot. | | `--llm-profile` | Exact profile ID; qualified for collection resources. |
| chunk.slot=path | The chunker. | | `--llm-session-id` | Session selection. |
| lane.slot=path | Every extractor, merger, or normalizer in lane that declares slot. | | `--llm-endpoint` | Native endpoint override. |
| lane.extract.slot=path | The extractor in lane. | | `--llm-model` | Model override. |
| lane.merge.slot=path | The merger in lane. | | `--llm-temperature` | Numeric temperature. |
| lane.normalize.slot=path | The normalizer in lane. | | `--llm-max-tokens` | Integer token limit. |
| `--llm-top-p` | Numeric top-p. |
| `--llm-timeout-seconds` | Integer native request timeout. |
| `--llm-service-tier` | Service tier selection. |
| `--llm-reasoning-effort` | Reasoning selection; explicit empty suppresses inherited reasoning. |
| `--llm-api-key-env` | Credential environment-variable name, not its value. |
| `--llm-transient-retries` | Integer native transient-failure retry selection; explicit zero disables these retries. |
| `--llm-extra-params` | JSON provider-parameter object, preserving false/zero/null values. |
Pipeline- and lane-scoped selectors are expected to match multiple targets and Omitted values remain unspecified, not the display defaults in help.
fail if they match none. A stage-specific selector fails when its lane is not `--llm-temperature=0` and `--llm-reasoning-effort=` retain their supplied meaning.
selected or its target does not declare the slot. There is no stage-wide Native target validation and provider-map rules apply; this interface does not
`merge.slot` shorthand; name the lane when targeting a merger. add a repair-model selection, structural-repair count, or generic stage retry.
Use application configuration for semantic turns and native prompt configuration
for structural contracts.
CLI bindings override configured external paths. For overlapping CLI Omitted profile selection preserves binding/pipeline/prompt precedence.
selectors, a binding-specific or chunk selector overrides a lane selector, and Explicit `--llm-profile=` clears the application profile selection so native
a lane selector overrides a pipeline selector. The last occurrence wins at prompt default selection applies. Without an explicit session flag, Notarius
equal scope. Binding and unbinding the same concrete target at equal scope is generates a stable `notarius:v1:` session from the trimmed resolved input module
an error; a narrower bind or unbind may create an intentional exception to a key and exact raw input bytes, independent of references and pipeline/profile
broader action. settings. An explicit value replaces it; explicit empty clears that generated
selection and leaves native prompt/session behavior in control. Sessions are
provider-visible correlation identifiers, not secret storage.
**--without-reference** uses the same selector forms without `=path` and PromptKit convenience spellings are scoped to `promptkit` commands; run uses
removes external bindings only. Neither flag replaces or removes a generated the canonical `--llm-*` names above. [Native request validation][requests]
artifact handoff; an external/generated collision is a resolution error. documents execution controls in detail.
Required slots are checked after all effective changes. CLI reference paths
are resolved relative to the process working directory, so subprocess and
service callers should use absolute paths. Slot names, accepted media types,
size limits, requiredness, and configured generated bindings are part of the
[configuration contract](config.md).
For example, one shared campaign reference can reach every compatible target, ### Reference Selectors
with an optional lane-specific exception:
~~~ Bind declared slots using `--reference SELECTOR=PATH`:
notarius run dnd-session \
--input /data/transcript.json \ | Selector | Target |
--reference party=/data/references/party.txt \ | --- | --- |
--reference npc-registry.party=/data/references/npc-party-context.txt | `slot` | Every selected compatible target declaring the slot. |
| `chunk.slot` | Chunker. |
| `lane.slot` | Compatible extract/merge/normalize bindings in that lane. |
| `lane.extract.slot` | That lane's extractor. |
| `lane.merge.slot` | That lane's merger. |
| `lane.normalize.slot` | That lane's normalizer. |
Pipeline/lane selectors may match several targets and fail if they match none.
A binding-specific selector requires its selected target to declare the slot.
There is no stage-wide merger shorthand. CLI paths override configured external
paths while retaining each target's configured collection selection; CLI-only
bindings use slot defaults. Narrower selectors beat broader ones, with last occurrence winning at
equal scope. Binding and unbinding the same concrete target at equal scope fails;
narrower actions can make intentional exceptions to broader actions.
`--without-reference` uses the selector without `=PATH`. It removes external
bindings only. Neither action replaces/removes generated handoffs; collisions
fail resolution and required slots must remain bound. CLI paths use the invocation
working directory. Configuration defines slot compatibility and path origins in
[References And Ordered Handoffs](config.md#references-and-ordered-handoffs).
For a complete D&D workflow, pipeline-level references are first-class inputs:
~~~sh
notarius run dnd-session --config examples/dnd-complete/config.yml \
--input-file examples/dnd-complete/transcript.json \
--reference party=/data/references/party.yml \
--reference glossary=/data/references/glossary.yml \
--reference spell_catalog=/data/references/glossary.yml \
--output-dir /data/results --format json
~~~ ~~~
### Run output ### Completion Report
Without **--json**, standard output contains the completed pipeline ID, counts Successful runs publish domain files and finalize requested capture before
of normalized and rejected outputs, and the output directory. A debug-enabled reporting one small value:
run also prints its debug-bundle path to standard output. A successful run with
actionable process warnings reports their group and occurrence counts to
standard error. When the selected output module publishes `warnings.json`, the
summary also reports that durable file's path. Advisory and observation findings
do not produce a warning line. The published JSON bundle
is defined by the [JSON output contract](integrations/json-output.md).
With **--json**, successful standard output is exactly one | Field | Meaning |
`notarius.run-result.v2` JSON document followed by a newline, with no | --- | --- |
human-oriented status or debug-path line. Its fields and compatibility policy | `pipeline` | Selected pipeline ID. |
are defined by the [run-result contract](integrations/run-result.md). A caller | `artifact_count` | Published deliverable files, including reused artifacts and enabled auxiliaries; excludes intermediates/cache/debug. |
must check for exit status 0 before decoding this output; a failed write can | `output_directory` | Absolute run-specific publication directory, not the configured root. |
leave incomplete standard-output bytes that are not a result document. | `debug_directory` | Optional absolute run capture directory; omitted when disabled. |
| `fallback_count` | Producer operations that emitted fallback, present only when positive. |
Example: Text summarizes pipeline, count, and path, appending capture location when
available. Fallback success is explicitly qualified, even when warnings are
hidden. Affected downstream artifacts, attempts, and validators are not extra
fallbacks. JSON/YAML serialize the same value; report format does not change
domain artifact encoding. There is no persisted receipt, execution ledger,
universal envelope, or automatic duplicate report file.
~~~ Consumers check status, optionally decode the report, and read configured
OPENROUTER_API_KEY=your-api-key \ lane/auxiliary paths. A failed stdout write may leave partial bytes. A failure
go run ./cmd/notarius run dnd-session \ after publication can leave valid artifacts; the failure explanation identifies
--config examples/dnd-minimal.config.yml \ available paths. [JSON output](integrations/json-output.md) owns logical artifact
--input examples/seriatim-minimal-transcript.json paths and payload contracts, not this report.
## Configuration Commands
The native scopes are `app` (default) and `promptkit`. Both inspect the same
application-owned load; the latter focuses native PromptKit settings. Use
`config scopes` for supported operations. No inspection command implicitly runs
a pipeline or provider.
~~~sh
notarius config validate --config examples/dnd-minimal/config.yml
notarius config show --scope app --config examples/dnd-minimal/config.yml
notarius config sources --config examples/dnd-complete/config.yml
notarius config explain --config examples/dnd-minimal/config.yml \
--path /concurrency/workers --format json
notarius config show --scope promptkit --config examples/dnd-minimal/config.yml
notarius config diff --config examples/dnd-minimal/config.yml \
--against-config examples/dnd-complete/config.yml --check
~~~ ~~~
## config validate Show supports `--path`; explain supports `--list`, `--path`, and native history/
filter options. Focused PromptKit paths retain the `/promptkit` prefix, for
example `/promptkit/collections/notarius/profiles`. Diff accepts separate
right-side configuration, overlay, and assignment inputs; differences with
`--check` yield status 3. These commands
report native values and secret-aware source evidence, not copied Notarius
inspection objects. Consult [native configuration commands][configuration]
for complete report and comparison semantics. Use `pipeline validate`, not
configuration validation, for production module/reference/resource preflight.
~~~ ## PromptKit Commands
notarius config validate [--config path/to/config.yml] [--config-overlay name] [--pipeline pipeline-id] [--only lane-a,lane-b]
The installed native suite includes:
- listings of prompts, profiles, backends, namespaces, and collections;
- inspection of a named prompt, profile, or backend;
- requirements discovery, concrete request validation, and prepared preview;
- explicit smoke tests: `reachability`, `authentication`, `text_inference`,
`structured_output`, or `all`.
~~~sh
notarius promptkit list prompts --config examples/dnd-minimal/config.yml \
--namespace notarius
notarius promptkit show profile notarius/dnd-extraction \
--config examples/dnd-minimal/config.yml --format json
notarius promptkit requirements show notarius/dnd.spells \
--config examples/dnd-minimal/config.yml
~~~ ~~~
This command loads and validates the selected composed configuration. With **--pipeline**, it also Resource/requirements inspection needs no transcript, credential values, or
resolves that pipeline against the production module catalog. **--only** selects provider call. Profile reports describe the stored profile before backend
lanes during that resolution and requires **--pipeline**. completion and request overrides; partial profiles are valid. Request validation
and `show prepared` actually prepare native requests and may read supplied
resources or require credentials according to the target, but do not call a
model. Prepared reports can contain rendered application data.
Success is written to standard output as either config "<path>" is valid or Use `--llm-var KEY=VALUE`, `--llm-input-text NAME=TEXT`, or
config "<path>" is valid for pipeline "<pipeline-id>". `--llm-input-file NAME=PATH` for concrete prompt inputs. These are not the
pipeline's source input. Namespace flags choose namespaces for short IDs;
already-qualified IDs remain unchanged. Native convenience aliases are installed
only on their applicable PromptKit commands; use help to see them.
Examples: Smoke tests are explicit and may contact providers or perform inference.
The [native smoke contract][smoke] owns their target selection, observations,
~~~ and default presentation; choose `--format json` or `--format yaml` when parsing
go run ./cmd/notarius config validate \ their reports. Neither debug nor inspection silently launches a smoke test.
--config examples/dnd-minimal.config.yml \ Full native mechanics are documented under
--pipeline dnd-session [inspection][inspection], [preview][preview], [requirements][requirements],
[resource listings][catalogs], and [smoke tests][smoke].
OPENROUTER_API_KEY=validation-placeholder \
go run ./cmd/notarius config validate \
--config examples/dnd-complete.config.yml \
--pipeline dnd-session
~~~
The placeholder in the second command is sufficient only for offline
validation; it cannot run a provider-backed pipeline.
## config effective
~~~
notarius config effective [--config path/to/config.yml] [--config-overlay name]
~~~
This command writes the selected composed configuration as deterministic,
redacted YAML. Standard output contains only that YAML: it does not validate a
pipeline, prepare modules, materialize references, or contact a provider.
## config explain
~~~
notarius config explain [--config path/to/config.yml] [--config-overlay name] <json-pointer>
~~~
This command writes ConfigKit's redacted, human-readable explanation for one
canonical JSON Pointer. Supply `""` explicitly to explain the root. A malformed
pointer is a syntax error; a well-formed unknown path is a command failure.
The explanation can describe a value displaced by a selected overlay. Standard
output contains only the explanation.
## pipelines list
~~~
notarius pipelines list [--config path/to/config.yml] [--config-overlay name] [--json]
~~~
This command lists configured pipeline IDs in sorted order. By default, it
writes one ID per line to standard output. **--json** writes an object shaped as
{"pipelines":[...]} instead.
~~~
go run ./cmd/notarius pipelines list \
--config examples/dnd-minimal.config.yml
~~~
## Output Streams And Exit Statuses ## Output Streams And Exit Statuses
Successful commands write their primary result to standard output. Warnings and Results go to stdout; failures, native diagnostics, and progress go to stderr.
errors are written to standard error. `--format text|json|yaml` selects report presentation. Default run presentation
uses its human template; native command defaults belong in the
[upstream reference][native-cli].
`--format` does not reformat help, completion scripts, diagnostics, or domain
payloads.
Configuration load errors include ConfigKit's field diagnostics and source Only one visibility mode is active; the last enabled `--quiet`, `--verbose`,
coordinates, followed by a source-ID legend identifying the acquired files or or `--debug` wins. Ordinary mode hides optional warning/info/debug messages;
source labels. This includes imported files and the selected configuration overlay. verbose shows warning/info; debug adds debug and default progress. Explicit
`--progress=false` disables progress, and quiet suppresses it. Quiet suppresses
stdout but retains failure explanations; formatting errors can still fail a
quiet command. Run capture selection remains independent of that final mode.
For **run --json**, actionable process warnings remain on standard error and standard output is a `--format json --verbose` keeps successful stdout report-only JSON while useful
machine-readable success result only. Syntax and runtime diagnostics remain on diagnostics go to stderr. No application-wide structured error envelope is
standard error. Parse the result only after the process exits with status 0. introduced. A failed preflight may nevertheless deliver its readiness assessment;
run completion reports remain success-only.
| Status | Meaning | | Status | Meaning |
| --- | --- | | --- | --- |
| 0 | The command completed successfully, including root help. | | `0` | Command completed, including supported permissive fallback with report qualification. |
| 1 | Command syntax was valid but configuration loading or validation, pipeline resolution or execution, provider use, output, or requested debug handling failed. | | `1` | Operational failure, cancellation, publication/capture/presentation failure, or an unclassified/mixed failure. |
| 2 | The command or flag syntax was invalid, including unknown commands, missing required arguments, invalid flag values, or invalid flag combinations. | | `2` | Invalid invocation or identifiable invalid configuration. |
| `3` | Native configuration differences with diff check mode. |
The root help spellings are the supported help path. Invoking **--help** on Native causes and classification remain intact. Not every resource/preflight
**run**, a **config** subcommand, or **pipelines list** is handled by the flag failure is identifiable invalid configuration. Rendering or diagnostic delivery
parser as a usage error: it writes an error to standard error and exits with failure can change an otherwise successful result to failure; callers check the
status 2. actual process status. See [native outcomes][outcomes] for library conventions.
[native-cli]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md
[syntax]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#registered-command-syntax
[configuration]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#configuration-scopes
[requests]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#concrete-request-validation
[inspection]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-definition-inspection
[preview]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-prepared-request-preview
[requirements]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-requirements
[catalogs]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-catalogs
[smoke]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-smoke-testing
[usage]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-usage-reporting
[outcomes]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#outcome-status

View File

@@ -1,408 +1,382 @@
# Configuration # Configuration
This is the canonical reference for Notarius configuration. Configuration files This is the canonical reference for Notarius configuration fields, defaults,
are YAML and must declare version 5. They select pipelines and their modules; source selection, and selectable modules. The sole application version is
the [CLI reference](cli.md) owns invocation syntax, and `6` (also accepted as `"6"`). [CLI Reference](cli.md) owns invocation syntax;
[Operations](operations.md) owns run-state procedures. [Operations](operations.md) owns physical state and recovery; integration
contracts own artifact payloads.
Upgrading an older deployment or caller? Use the
[native migration guide](consumers/native-migration.md).
## Configuration Discovery And Precedence ## Configuration Discovery And Precedence
Commands that load configuration choose a file in this order: Configuration-consuming commands select one main file:
1. a non-empty **--config** CLI value; 1. Explicit `--config`, which must not be empty.
2. a non-empty **NOTARIUS_CONFIG** environment value; 2. Nonblank `NOTARIUS_CONFIG`.
3. the installed default file at **/usr/local/etc/notarius/config.yml**, when 3. `notarius.yml`, then `notarius.yaml`, in the working directory.
it exists. 4. Go's user configuration directory: first its `notarius/` subdirectory,
trying `notarius.yml`, `notarius.yaml`, `config.yml`, `config.yaml`,
`main.yml`, `main.yaml`; then the two `notarius.*` names directly beneath it.
5. `/usr/local/etc/notarius/`, then `/etc/notarius/`, with those six names;
finally `/etc/notarius.yml` and `/etc/notarius.yaml`.
The command fails if none of these paths provides a configuration file. Generic working-directory filenames and home-directory searches are not enabled.
Missing discovery candidates advance the search; a selected missing, unreadable,
or invalid explicit source fails without fallback. Exhausted discovery fails.
Discovery selects a main file rather than layering every candidate.
Use explicit selection for services and subprocesses.
For configuration values, precedence is: One ConfigKit result contains the application and native PromptKit settings.
Its source layers, from lower to higher priority, are:
1. built-in defaults; 1. The bundled OpenRouter resource underlay.
2. composed YAML sources, including imports; 2. Embedded Notarius prompts/profiles and their filesystem-backed schema root.
3. the selected ConfigKit overlay; and 3. Optional operator companions beside the **actual selected main file**:
4. explicitly supplied configuration-valued run flags. `prompts.yml` and recursively selected `*.yml`/`*.yaml` files in `prompts/`.
These form one strict peer group: filenames do not confer priority and
conflicting contributions fail.
4. The selected application main source and its native import graph.
5. The selected ConfigKit overlay.
`--config-overlay` selects a ConfigKit overlay from `overlays/<name>.yml` Companions are wrapperless native PromptKit settings mounted at `/promptkit`.
beneath the selected configuration root. Empty and `default` select no overlay. They are optional only when absent; malformed or unreadable selected content
`profiles/<name>.yml` is not a fallback location, and `--config-profile` is no fails. The loader does not search the invocation directory for substitute
longer accepted. Configuration overlays are distinct from PromptKit LLM profiles selected by companions. A companion's imports and content-file paths retain its native
`llm_profile` or `--llm-profile`. The retired operational environment variables source context. Main imports use their declared destinations; main-file native
have no effect; `NOTARIUS_CONFIG` remains a source-discovery input. settings belong beneath `promptkit`.
Source assembly, inheritance, typed defaults/decoding, explicit configuration
overrides, application normalization, and validation use ConfigKit's native
processing order. Overrides cannot repair earlier parse, composition, version,
inheritance, or decoding errors. The same captured result serves inspection and
engine construction, not a separate profile loader.
The overlay selector is a name: `development` selects
`overlays/development.yml` under the selected main source's configuration root.
Empty and exact lowercase `default` select the base. A missing selected overlay
fails; there is no overlay stack or extension fallback. Application overlays are
distinct from PromptKit profiles. See [ConfigKit's selected-overlay contract][overlays].
Only `NOTARIUS_CONFIG` participates in application environment selection.
Credential environment names are native PromptKit settings, not field-level
application environment overlays.
## Maintained Examples ## Maintained Examples
- [Minimal D&D configuration](../examples/dnd-minimal.config.yml) is a - [Minimal](../examples/dnd-minimal/config.yml): embedded resources only, Seriatim
single-lane Seriatim-to-spell pipeline. input, generic chunking, and one spell lane.
- [Complete D&D configuration](../examples/dnd-complete.config.yml) uses - [Complete](../examples/dnd-complete/config.yml): ordered steps and all D&D
ordered steps, all implemented D&D lanes, generated references, state families, generated references, independent state roots, workers, cache/mode/
settings, bounded LLM concurrency, and the maintained turn controls, and selected domain auxiliaries. Its
[LLM profile](../examples/llm-profiles/dnd-extraction.yml) and imports its [companion](../examples/dnd-complete/prompts.yml) demonstrates native profile
pipeline from [a fragment](../examples/pipelines/dnd-session.yml). and backend inheritance without replacing native queue defaults.
- The complete [pipeline fragment](../examples/dnd-complete/pipelines/dnd-session.yml)
and [first-step fragment](../examples/dnd-complete/pipelines/dnd-session.describe-session.yml)
retain declaration-relative imports and references. Its development pipeline
selects a derived profile and zero semantic correction turns. The
[development overlay](../examples/dnd-complete/overlays/development.yml)
demonstrates serial workers and cache bypass.
Use these complete files as starting points rather than combining the The examples use separate directories so complete-example companions do not
illustrative fragments in this reference. alter minimal-example selection. Use these full files as starting points;
the fragments below illustrate individual settings.
## File Shape And Defaults ## File Shape And Defaults
Unknown fields, duplicate mapping keys, empty identifiers, and identifiers that Application fields are strict. Unknown application fields, duplicate mapping
become duplicates after trimming whitespace are rejected. Every top-level field keys, blank identifiers, and identifiers duplicated after trimming are rejected.
other than **version** is optional. PromptKit-owned resource records use the [native format][formats], including its
extension-field and strict nested-object rules; arbitrary extension fields are
not automatically secret.
| Field | Type | Default | Rules | | Root field | Type | Default / meaning |
| --- | --- | --- | --- | | --- | --- | --- |
| **version** | integer or quoted string | none | Required; must be 5. Maintained files use `version: 5`. | | `version` | integer or quoted string | Required; `6` only, without translation of older versions. |
| **promptkit** | object | none | Profile source and optional local-backend configuration. | | `promptkit` | native settings | Embedded and bundled resources, overlaid by selected sources. |
| **pipelines** | map | empty | Maps pipeline IDs to pipeline definitions. | | `pipelines` | map | Empty; maps IDs to pipeline definitions. |
| **concurrency** | object | see below | Global LLM and extraction limits. | | `concurrency.workers` | positive integer | `64`; one shared ready-job pool. |
| **output** | object | see below | Published output settings. | | `output.directory` | nonempty path | `./notarius-output`. |
| **cache** | object | see below | Chunk-plan and checkpoint settings. | | `cache_directory` | path | Omitted or empty selects `os.UserCacheDir()/notarius`. |
| **debug** | object | see below | Debug-bundle root only; it does not enable capture. | | `debug.directory` | path | Omitted selects `/tmp/notarius-debug`; explicit empty disables capture. |
Built-in defaults are: Nonempty relative application destinations and reference paths resolve from the
file contributing the surviving declaration, including imported, overlaid, or
inherited values. A child replacement keeps the child's origin. Built-in relative
destinations use the selected main file's directory; invocation path overrides
use the working directory. Absolute paths remain absolute.
| Field | Default | An empty output directory is invalid. Empty cache selection deliberately chooses
| --- | --- | the per-user default; on Linux this normally follows `XDG_CACHE_HOME` or
| **concurrency.total_llm** | 16 | `~/.cache`. Null is not a universal substitute for omission or empty: effective
| **concurrency.stage_workers.extract** | Effective **total_llm** | types and application validation still apply. Directory selection does not
| **output.directory** | **./notarius-output** | configure filesystem access policy or enable debug. See
| **cache.chunk_plans.mode** | **auto** | [Operations](operations.md) for lifecycle, permissions, and provisioning.
| **cache.chunk_plans.directory** | Empty, selecting the per-user chunk-plan root |
| **cache.checkpoints.enabled** | false |
| **cache.checkpoints.directory** | Empty, selecting the per-user checkpoint root |
| **debug.directory** | **./notarius-debug** |
An empty cache directory in YAML deliberately selects the corresponding ## Imports And Sibling Inheritance
per-user root. An explicit empty output or debug directory is invalid.
Selecting a chunk-plan or checkpoint directory does not configure filesystem
access policy. Cache permissions come from deployment provisioning, process
umask, setgid inheritance, and default ACLs; see [Operations](operations.md#cache-provisioning).
Every nonempty relative configured destination or reference path resolves from Root `config` contains native controls such as imports and sequence declarations.
the canonical directory of the file that supplies its surviving declaration. For example:
This includes imported fragments and selected configuration overlays. Built-in
relative destinations use the selected main configuration file's directory;
explicit `--output-dir` and `--debug-dir` values use the invocation working
directory. Absolute values remain unchanged.
The root file can use ConfigKit imports to compose disjoint definitions. Imports ~~~yaml
and selected overlays remain under the configuration root; they do not merge or config:
append a pipeline's `steps` sequence. An overlay replaces sequences as defined imports:
by ConfigKit, so changing an individual ordered binding requires supplying the - path: pipelines/dnd-session.yml
whole replacement sequence. required: true
~~~
Imports are optional by default. Paths, directory selection, destinations,
sequence-item placement, source containment, and dependency-ready assembly order
follow [ConfigKit's import contract][imports]. Imported fragments need not repeat
the application version. A nested application field named `config` is ordinary
data, not another source-control block.
Mapping inheritance names a sibling, such as `extends: production` inside
`pipelines`. Identified-list inheritance uses an identity mapping such as
`extends: {id: parent}`. Parents must survive in the same sibling collection;
these are not paths or cross-namespace references.
Child mappings recursively overlay parents. Scalars and null replace inherited
values; an empty mapping does not clear existing fields. Lists follow their
native registered/declared composition policy. Pipeline steps are identified by
`id`: native upsert replaces a matching **whole record** in place and appends
new IDs. It does not patch fields of a matching step. Unidentified lists replace
as whole values across layers. Explicit replace with `[]` clears a list; empty
append/upsert does not. Validator lists are not automatically identified.
An identified record's `extends` can retain a distinct sibling's fields before
applying child changes. All surviving records remain real validated records,
not template-only definitions. Every final pipeline step executes and lane IDs
must be unique across the pipeline; inheriting a step's lanes does not remove
them. Pipeline-level inheritance with step upsert is suitable for full variants.
Omitted fields inherit; explicit zero, false, and empty collections retain their
presence. Null can clear an inherited value but remains subject to that field's
type and fallback semantics. Omitting `extends` retains a lower relationship;
`extends: null` cancels that relationship rather than independently deleting
other composed fields. `extends` is a reserved native configuration key, not
ordinary module-option data. See [native inheritance][inheritance] and
[sequence composition][sequences] for full rules.
Explicit configuration assignments use native mapping paths. They cannot walk
sequence indexes, assign the version, or introduce inheritance controls. Mapping
values overlay; list values replace the whole decoded list. Inheritance/defaulting
does not run again afterward. [CLI Reference](cli.md#configuration-selection)
owns assignment syntax.
## PromptKit Profiles ## PromptKit Profiles
The optional **promptkit** object selects one source of profile definitions and Native `promptkit` settings contain identified `backends`, `profiles`, and
may register one conventional local OpenAI-compatible backend: `prompts` lists, plus a `collections` mapping. Notarius embeds its resources
in `collections.notarius`. Runtime IDs are qualified, for example
`notarius/dnd-extraction` and `notarius/dnd.spells`; the bundled root backend
is `openrouter`. Resource IDs are literal, not resource-version paths.
A collection's local record ID omits its namespace; references to resources in
that collection use the qualified runtime ID.
A wrapperless companion can add a profile variant:
~~~yaml ~~~yaml
version: 5 collections:
notarius:
promptkit: profiles:
profile_dir: ./profiles - id: campaign
# profile_file: ./profiles.yml extends: {id: dnd-extraction}
transient_retries: 2 model: example-model
local_backend:
endpoint: http://localhost:8000/v1
concurrency_limit: 2
~~~ ~~~
| Field | Type | Rules | The pipeline can then select `llm_profile: notarius/campaign`. In the main
| --- | --- | --- | application file, place that same mapping beneath `promptkit`. The parent
| **profile_dir** | string | Non-empty directory containing profile files. | reference is local to the same profile list; profile/backend references otherwise
| **profile_file** | string | Non-empty profile file. | name their intended exact ID. The [complete companion](../examples/dnd-complete/prompts.yml)
| **transient_retries** | integer | Non-negative additional built-in HTTP attempts for eligible transient provider failures; defaults to 2. Set 0 to disable these retries. | shows a runnable inherited backend/profile combination.
| **local_backend** | object | Optional registration for the conventional PromptKit backend ID **local**. |
| **local_backend.endpoint** | string | Required when **local_backend** is present; absolute HTTP or HTTPS URL with a host. |
| **local_backend.concurrency_limit** | integer | Optional non-negative limit; defaults to 0. |
Set at most one of **profile_dir** and **profile_file**. Every nonempty relative Later same-ID resources replace complete lower records, not selected fields.
configured filesystem path is resolved from the canonical directory of the Use a distinct inherited sibling to retain a parent's fields; replacing a record
file that supplies it. The complete example's with only one changed field does not implicitly keep the old definition.
`./llm-profiles/dnd-extraction.yml` value therefore resolves beside that example. Native `extends`, explicit null, list policy, and source contexts apply to
Use absolute paths for services and containers when their deployment layout is resources just as to other configuration. See [resource inheritance][resource-inheritance].
not configuration-relative.
An operator source is optional. For a requested ID, PromptKit checks the The embedded D&D profile selects `openrouter`, model `openai/gpt-5.6-luna`,
configured operator source first, then Notarius's embedded fallback profiles, a `240` second timeout, and `flex` service tier, leaving reasoning unset.
then its own built-in catalog. A matching profile is complete: it replaces a Initial/correction pairs share their bundled default profile. Explicit application
lower-precedence definition rather than merging with it. The maintained profile selections and run overrides reach producers, validators, and correction
[`dnd-extraction` LLM profile](../examples/llm-profiles/dnd-extraction.yml) requests; validators can otherwise select their own profile.
is a secret-free deployment artifact; production, development, and local
deployments can each provide a complete definition with that same workload ID.
Use workload-oriented IDs for new profiles instead of model names.
[Operations](operations.md#promptkit-profile-deployment) owns the deployment
workflow and credential-handling guidance.
When **local_backend** is present, its endpoint is trimmed and must use HTTP or The complete example's `limited-openrouter` inherits the bundled OpenRouter
HTTPS case-insensitively, be absolute, and have a non-empty host. URL paths are provider selection. Changing an inherited endpoint to another provider also
allowed. User information, queries, and fragments are rejected. A zero requires a deliberate provider override. The [native backend definitions][backends]
**concurrency_limit** leaves the local backend unrestricted inside PromptKit; own provider, `zero_cost`, and authentication semantics; Notarius adds no cost
a positive value limits simultaneous local generations. The application-wide default or automatic probe. Partial profiles remain valid, with concrete readiness
**concurrency.total_llm** limit still applies in both cases. Neither local checked at preparation rather than inferred from resource inspection.
backend field has an environment override. Omitting **local_backend** registers
nothing and preserves existing built-in and endpoint-only profile behavior.
A file-backed PromptKit profile selects the registration by its case-sensitive Notarius injects **no backend concurrency or queue defaults**. Native admission
backend ID: is shared by backend ID within the engine, independently of workers; distinct
IDs do not automatically share capacity even if their endpoints match. An
endpoint-only profile has no backend identity. Configure native backend limits
when desired; the [upstream backend contract][backends] owns defaults and queue
semantics.
~~~yaml Profile omission, explicit values, and null differ. For example, native null
id: local-summary `endpoint` or `api_key_env` permits backend fallback, while an explicitly empty
backend: local string clears those sources; zero sampling values remain intentional. Blank/null
model: example-model reasoning suppresses the outbound control. Changing backend/model does not
~~~ automatically clear unrelated explicit inherited settings. Use the
[native defaults table][profile-defaults], not inferred old-wrapper behavior.
Keep credentials out of the local-backend object. A PromptKit profile may name Only credential environment **names** belong in files, never values. Native
its credential environment variable through `api_key_env`; set that variable secret-aware inspection preserves marked secret omissions; arbitrary prompt,
only in the run environment. PromptKit owns the source, or extension data is not promised safe to disclose.
[pinned profile-file format](https://gitea.maximumdirect.net/eric/promptkit/src/tag/v0.9.0/docs/formats.md),
including `base_profile` inheritance. Notarius passes profiles through without
merging them. Filesystem profiles cannot express PromptKit's in-memory
`APIKeyRequired` setting; an unset `api_key_env` is optional and may reach the
provider without authorization.
The [PromptKit upstream boundary](integrations/pkg-promptkit.md) identifies the
supported package API, and [Operations](operations.md#operational-limits)
describes the effective concurrency layers.
`notarius config validate --pipeline <id>` resolves the selected pipeline and ### Prompt Output Contracts And Schemas
inspects every explicit effective profile without contacting a provider or
requiring credential values. It rejects absent, malformed, or incompatible
profiles before a run prepares modules. Credential availability is checked only
when a generation is prepared.
## Version 5 Migration Prompt declarations select response format, validation mode, and schema. Bundled
initial, correction, and validator prompts omit structural-repair counts:
Notarius inherits the upstream default, not an independent application-pinned
count. Native prompt customization can explicitly change that budget. Transient
provider retries are also native, distinct from application semantic turns.
See [native output contracts][output-contract].
Version 3 and version 4 files are rejected and are not rewritten at load time. Schemas may be inline, `schema_file` relative to its contributing source, or
Use `version: 5`, rename the former `scriptorium` section to `promptkit`, and `schema_path` within an explicit applicable `schema_root`. Exactly one schema
convert every module binding to an object containing `module`. Convert every selection is used for JSON Schema mode. Null clears an alternative; switching
external reference to `{path: ...}` and move any lane-level references to the forms can require clearing the inherited selection. Native preparation reads
corresponding extraction binding. Put durable operational values in YAML or and compiles schemas; configuration/preflight does not read them.
use the documented explicit run flags; the former field-level environment
variables are not read. Embedded Notarius prompts use their collection's filesystem-rooted schemas.
A nonnull collection root takes precedence over the root `promptkit.schema_root`;
absent/null collection roots fall back to that application root. A nonnull blank
root is invalid. Replacing `collections.notarius.schema_root` selects the new
context for its remaining path-based schemas. A missing file does not fall back
to embedded or working-directory roots. Other collections are unaffected.
Schema resources must be self-contained; native schema rules are in
[PromptKit's schema reference][schemas].
## Concurrency, Output, Cache, And Debug ## Concurrency, Output, Cache, And Debug
~~~yaml `concurrency.workers` bounds active ready extraction and lane-completion jobs
concurrency: together, including their validation/correction. It must be positive, has no
total_llm: 2 application maximum, and is independent of CPU count and native backend limits.
stage_workers: Explicit `1` gives serial jobs. Waiting for prerequisites occupies no worker;
extract: 2 nested validators do not request another worker. It is not a cross-backend
output: provider-call ceiling.
directory: ./notarius-output
cache:
chunk_plans:
mode: auto
directory: ./notarius-cache/chunk-plans
checkpoints:
enabled: true
directory: ./notarius-cache/checkpoints
debug:
directory: ./notarius-debug
~~~
**concurrency.total_llm** must be greater than zero. The only supported `output.directory`, `cache_directory`, and `debug.directory` select independent
**concurrency.stage_workers** key is **extract**; its value must be from 1 roots. `/var/cache/notarius` is the convention for an explicitly provisioned
through **total_llm**. When omitted, it is recalculated from the effective system-wide cache, not the per-user default. No directory setting creates a
**total_llm** after imports, overlay selection, and explicit ConfigKit permission policy or retention service.
overrides.
**cache.chunk_plans.mode** accepts **auto**, **bypass**, or **refresh**. A configured debug destination alone does not enable capture. Explicit empty
**cache.checkpoints.enabled** is a boolean. The CLI can override the output disables it; a nonempty invocation override can re-enable it. Native debug
directory and chunk-plan mode for one run; see [CLI reference](cli.md#run). selection and presentation modes are independent. See [CLI Reference](cli.md#run)
Cache directory fields select only locations; Notarius has no cache permission for invocation controls and [Operations](operations.md) for state handling.
field or operational environment override.
## Pipelines ## Pipelines
Each **pipelines** entry has a unique, non-empty ID and the following shape: Each nonblank `pipelines` key defines a configured pipeline.
~~~yaml | Field | Type | Default / rules |
pipelines:
dnd-session:
llm_profile: dnd-extraction
input:
module: seriatim
chunk:
module: generic
output:
module: json
artifacts:
spells:
extract:
module: dnd/spells
merge:
module: appendorder
normalize:
module: dnd/spells
~~~
| Field | Type | Default | Rules |
| --- | --- | --- | --- |
| **llm_profile** | string | none | Optional non-empty default PromptKit profile ID for selected LLM-backed bindings and validators. An explicitly present blank value is invalid. |
| **structured_output_repair_attempts** | integer | prompt-owned (1 in maintained production prompts) | Optional structural-repair limit from 0 through 3 for selected LLM-backed bindings and validators. Omission leaves the prompt's declared policy in control; explicit 0 disables structural repair at that scope. |
| **validation_policy** | object | see below | Optional terminal policy defaults for producer validation. Its fields inherit independently into chunk, extract, merge, and normalize bindings. |
| **input** | module binding | none | Required. |
| **chunk** | module binding | **generic** | Optional. |
| **output** | module binding | **json** | Optional. |
| **artifacts** | map | none | Compact single-step lane map. |
| **steps** | list | none | Ordered lane definitions. Mutually exclusive with **artifacts**. |
| **references** | map | none | External reference defaults for eligible targets. |
Use either **artifacts** or **steps**. The compact **artifacts** form is an
implicit single step. An explicit **steps** list must be non-empty; every step
needs a unique non-empty **id**, an **artifacts** map, and may have
**references**. A lane ID must not appear more than once in a pipeline,
including across explicit steps.
For each selected LLM-backed binding or validator, profile selection occurs
after module, validator, and `--only` lane selection. It uses the
run-level **--llm-profile** value first, then the binding's **llm_profile**,
then the pipeline's **llm_profile**, and finally the PromptKit default.
Deterministic bindings do not receive these defaults or run overrides.
Structural output repair is resolved after module, validator, and `--only` lane
selection. An object's **structured_output_repair_attempts** value takes
precedence over the pipeline value; otherwise, an LLM-backed binding or
validator inherits the pipeline value. If both are omitted, PromptKit uses the
prompt's declared repair policy. The value must be an integer from 0 through 3;
explicit `null` and non-integer values are invalid. An explicit value on a
deterministic binding or validator is invalid, while a pipeline value simply
does not apply to deterministic selections.
`validation_policy` controls terminal disposition for one complete producer
attempt and validator chain. It may appear on a pipeline or a **chunk**,
**extract**, **merge**, or **normalize** module binding; input, output, and
validator bindings reject it. Every field is optional and resolves in binding,
pipeline, then application-default order:
| Field | Values | Default |
| --- | --- | --- | | --- | --- | --- |
| **producer_structural_failure** | **fail_run**, **reject_output** | **fail_run** | | `llm_profile` | string | Optional qualified profile selection; explicit blank/null is invalid. |
| **semantic_rejection** | **fail_run**, **reject_output** | **fail_run** | | `mode` | `strict\|permissive` | Producer terminal mode; see below. |
| **validator_failure** | **warn_continue**, **fail_run** | **warn_continue** | | `max_additional_turns` | nonnegative integer | Semantic correction allowance excluding the initial response. |
| `cache` | `auto\|bypass\|refresh` | Eligible model-result reuse policy. |
| `input` | binding | Required. |
| `chunk` | binding | Defaults to `generic`. |
| `output` | binding | Defaults to `json`. |
| `artifacts` | lane map | Compact single-step form, mutually exclusive with `steps`. |
| `steps` | ordered list | Nonempty when selected; each record has a unique nonblank `id`, `artifacts`, and optional `references`. |
| `references` | map | External reference defaults for compatible targets. |
The policy object and its fields must be non-null, and unknown fields are A lane ID is unique across all steps. Each lane requires `extract`, defaults
rejected. A deterministic producer may not explicitly set `merge` to `appendorder`, and defaults `normalize` to `noop`. References and
**producer_structural_failure** on its binding, although a pipeline-level validator overrides belong on eligible bindings, not lane-wide fields.
default remains valid for pipelines that include LLM-backed producers. Ordered steps finish before their generated artifacts feed later steps.
After the producer binding's retry budget is exhausted, an invalid structured For each selected LLM role, profile precedence is explicit invocation override,
response uses **producer_structural_failure**. One or more semantic validator binding `llm_profile`, pipeline `llm_profile`, then native prompt default.
rejections use **semantic_rejection**; rejection takes precedence over an Deterministic roles do not receive LLM defaults/overrides and reject explicit
exhausted validator failure or skip. With no rejection, an exhausted validator profile assignments. A supplied empty invocation profile clears the application
failure or skip uses **validator_failure**. `reject_output` records the selection and lets the prompt default apply; configured blank profiles are invalid.
terminal rejection without advancing that candidate. `warn_continue` is valid
only for validator execution failure: it advances a structurally valid,
otherwise unrejected result with incomplete-validation provenance and without
making it reusable checkpoint state.
A lane has these fields: ### Producer Controls
| Field | Type | Default | Rules | Chunk, extract, merge, and normalize bindings resolve controls before execution:
| --- | --- | --- | --- |
| **extract** | module binding | none | Required. |
| **merge** | module binding | **appendorder** | Optional. |
| **normalize** | module binding | **noop** | Optional. |
| **references** | map | none | Not supported at lane scope; place references on the eligible binding. |
| **validators** | list | none | Non-empty lane-level lists are rejected. Set validator overrides on a binding instead. |
Lane-level **references** are not supported. Put a lane extraction reference | Control | Precedence, highest first | Default |
under **extract.references**. | --- | --- | --- |
| `mode` | Binding, pipeline, application | `strict` |
| `max_additional_turns` | Binding, pipeline, application | `2` |
| `cache` | Explicit invocation cache, binding, pipeline, application | `auto` |
Omission inherits. Zero turns disables semantic correction; a positive allowance
is not a requirement to use every turn. The complete applicable validator chain
assesses each usable initial/revised candidate, including the final permitted
response. Native coordination owns conversation/iteration; the allowance does
not count transport retries or structural repair. Deterministic work does not
acquire conversations or generic retries.
Strict requires an accepted result. Permissive explicitly permits only the
module's supported fallback, with intrinsic shape/source/downstream checks,
without claiming ordinary semantic approval or rerunning the normal chain.
A whole-source D&D scene plan, empty extraction collection where valid, or safe
final normalization groups/merged input are supported directions. Scene
descriptions cannot use an invalid empty collection or fabricated description.
Unsupported fallback construction fails; cancellation stops without fallback.
Eligible cacheable work uses `auto` to read/store accepted results, `bypass`
for neither, and `refresh` to skip reads and replace only after new acceptance.
Failures preserve earlier acceptance. Fallback and actually affected dependent
work skip both lookup and storage; unrelated predecessors remain reusable.
Settings/policy changes may still reuse old accepted content; select bypass/
refresh when deliberately applying changed policy. Best-effort cache I/O does
not fail otherwise successful work. [Operations](operations.md) owns recovery
and physical storage, not a checkpoint/resume contract.
## Module Bindings And Validators ## Module Bindings And Validators
Every module and validator binding uses an object, even when it has no fields Every module binding is an object containing `module`, even without options.
beyond its module key:
~~~yaml | Binding field | Meaning |
input: | --- | --- |
module: seriatim | `module` | Registered compatible key; required. |
~~~ | `llm_profile` | Optional nonblank qualified profile for an LLM-backed role. |
| `mode`, `max_additional_turns`, `cache` | Resolved producer controls above. |
| `options` | Selected module's strict option object. |
| `references` | Declared slots on chunk/extract/merge/normalize bindings. |
| `validators` | Ordered replacement chain on those producer bindings. |
Use an object for fields: Omitted validators use the production default. `validators: []` replaces it
with an empty chain; a nonempty list replaces it in listed order. Null is not an
empty list. Validator bindings accept only `module`, optional LLM-backed
`llm_profile`, and `options`; they have no separate producer mode, semantic-turn
allowance, references, or nested validators. Each validator executes once per
candidate assessment. Intrinsic codec/schema checks remain with an empty chain,
as do source parsing, plan materialization, and necessary module/fallback/cache
construction checks. Ordinary artifact citation existence/containment checks
are supplied by configured validators and can be omitted by chain replacement.
See [default chains](#production-validator-keys-and-default-chains).
~~~yaml The `json` output options are:
extract:
module: dnd/spells
llm_profile: dnd-extraction
retries: 2
references:
spell_catalog:
path: ./dnd-spell-catalog.json
~~~
| Binding field | Type | Default | Rules | | Option | Default / rules |
| --- | --- | --- | --- | | --- | --- |
| **module** | string | none | Required for an object binding. Must be a registered compatible key. | | `include_chunk_map` | Boolean, default false; publish when enabled and available. |
| **llm_profile** | string | none | Optional non-empty PromptKit profile ID for an LLM-backed binding. It overrides the pipeline default unless the run supplies **--llm-profile**. | | `evidence_context` | Omitted disables publication; otherwise a strict object. |
| **structured_output_repair_attempts** | integer | pipeline or prompt-owned (1 in maintained production prompts) | Optional structural-repair limit from 0 through 3 for an LLM-backed binding. It overrides the pipeline value; explicit 0 disables structural repair. | | `evidence_context.enabled` | Required boolean; false permits no other evidence fields. |
| **validation_policy** | object | pipeline or application defaults | Optional field-by-field terminal-policy override for a chunk, extract, merge, or normalize binding. | | `evidence_context.lanes` | When enabled, required nonempty list of unique trimmed configured lane IDs. |
| **retries** | integer | 0 | Non-negative additional complete producer attempts for chunk, extract, merge, and normalize bindings. This single budget covers operational errors, invalid structured output, module-requested normalization retry, and semantic correction. | | `evidence_context.window_units` | When enabled, nonnegative integer, default `3`; zero keeps only directly cited units. |
| **options** | object | none | Must satisfy the selected module. |
| **references** | map | none | Valid only on chunk, extract, merge, and normalize bindings. |
| **validators** | list | production chain | Valid only on chunk, extract, merge, and normalize bindings. |
Omitting **validators** uses the registered chain. **validators: []** selects Filtered-out configured lanes contribute no evidence. Unknown or incompatible
an empty chain; a non-empty list replaces the chain in the listed order. options fail. Evidence is opt-in because it can persist source text and metadata.
Validator bindings accept only **module**, **llm_profile**, Logical formats belong to [chunk-map](integrations/chunk-map.md) and
**structured_output_repair_attempts**, **retries**, and **options**. Their [evidence-context](integrations/evidence-context.md) contracts.
**retries** value is a non-negative additional validator-execution budget and
is valid only when the selected validator is LLM-backed. A validator retry
rechecks the same immutable candidate; it never regenerates the producer.
They reject
**validation_policy**, **references**, and nested **validators**. Deterministic
validators reject explicit **llm_profile** and
**structured_output_repair_attempts**.
Deterministic module bindings also reject those explicit fields.
An LLM-backed chunk, extract, merge, or normalize producer with both a
non-empty validator chain and positive **retries** must declare the supported
single-response correction capability. Preparation rejects a configuration
that could require semantic correction from a producer that cannot provide an
exact prior response. A deterministic producer, or an LLM attempt that did
not make a model call, cannot consume a semantic retry after rejection.
The **json** output module accepts optional **include_chunk_map** and
**evidence_context** settings:
~~~yaml
output:
module: json
options:
include_chunk_map: true
evidence_context:
enabled: true
window_units: 3
lanes:
- npc-registry
- spells
~~~
**include_chunk_map** is a boolean and defaults to false. It adds the accepted
chunk map when one exists; its wire format is defined in the
[chunk-map contract](integrations/chunk-map.md).
Omitting **evidence_context** disables evidence publication. When present, it
is an object with these strict fields:
| Field | Type | Rules |
| --- | --- | --- |
| **enabled** | boolean | Required. `false` permits no other evidence fields. |
| **lanes** | array of strings | Required and non-empty when enabled. Each value is trimmed and must be unique; every value must name a configured pipeline lane. |
| **window_units** | non-negative integer | Optional when enabled; defaults to 3. Zero retains only directly cited units. |
Unknown outer or nested option fields are rejected, as are incompatible YAML
types. The allowlist remains valid when a run uses lane filtering: a configured
lane that is not active for that invocation simply contributes no evidence.
Evidence publication is opt-in because it can persist source text and metadata.
When enabled, it publishes the selected source-unit excerpt defined by the
[Published Evidence Context contract](integrations/evidence-context.md).
## References And Ordered Handoffs ## References And Ordered Handoffs
Reference maps bind named slots that the selected target declares. An external Reference maps bind named slots that the selected target declares. An external
reference is an object with `path`. Pipeline-level maps accept only external reference is an object with `path` and optional `collections`. Pipeline-level maps accept only external
paths; step-local and binding-local maps may also select a normalized artifact paths; step-local and binding-local maps may also select a normalized artifact
from an earlier step: from an earlier step:
@@ -431,9 +405,15 @@ steps:
An artifact selector contains only **step** and **lane**. The producer must be An artifact selector contains only **step** and **lane**. The producer must be
an earlier step and the selected artifact must be compatible with the consumer an earlier step and the selected artifact must be compatible with the consumer
slot. A generated binding supplies one accepted normalized artifact; it does slot. A generated binding supplies one normalized artifact in memory, including a
not name a file. A configured generated dependency remains required even when supported qualified fallback; it does not name a file. A configured generated
that consumer slot is otherwise optional. dependency remains required even when that consumer slot is otherwise optional.
`collections` is an external-file selection, not an artifact selector. Omitted
or null uses the consuming slot's defaults; `[]` selects none. Names compare
exactly, empty names are invalid, and repeated names have no additional effect.
Explicit names must exist. See [shared domain inputs](integrations/shared-domain-inputs.md)
for the D&D collection roles and defaults.
Pipeline references are configuration defaults. A matching step-local or Pipeline references are configuration defaults. A matching step-local or
binding-local external path overrides a pipeline default. CLI reference binding-local external path overrides a pipeline default. CLI reference
@@ -445,6 +425,9 @@ after configuration and CLI reference actions are applied. A YAML reference
path resolves from the file that supplies its surviving declaration, including path resolves from the file that supplies its surviving declaration, including
an imported fragment or selected overlay. CLI reference paths resolve relative an imported fragment or selected overlay. CLI reference paths resolve relative
to the process working directory. to the process working directory.
Replacing an external reference object in a more local configuration scope
replaces its selection too. A CLI path override retains the surviving configured
selection for each target; a CLI-only binding uses slot defaults.
### D&D Reference Slots ### D&D Reference Slots
@@ -453,11 +436,11 @@ selected target declares them:
| Slot | Source and use | | Slot | Source and use |
| --- | --- | | --- | --- |
| **party** | Optional text campaign context. This is the canonical party-roster spelling. | | **party** | Optional shared party document; canonical party-roster spelling. |
| **roster** | Accepted compatibility alias for **party**. | | **roster** | Accepted compatibility alias for **party**. |
| **players** | Optional text player context. | | **players** | Optional text player context. |
| **glossary** | Optional text campaign glossary. | | **glossary** | Optional shared glossary document for general campaign vocabulary. |
| **spell_catalog** | Optional JSON spell-catalog overlay for spell extraction and normalization. See [spell-catalog overlays](integrations/dnd-spell-catalog-overlays.md). | | **spell_catalog** | Optional shared glossary document for spell recognition and normalization. |
| **location_registry** | Required normalized location registry for location-occurrence extraction and normalization. | | **location_registry** | Required normalized location registry for location-occurrence extraction and normalization. |
| **item_registry** | Required normalized item registry for item-occurrence extraction and normalization. | | **item_registry** | Required normalized item registry for item-occurrence extraction and normalization. |
| **npc_registry** | Normalized NPC registry. Optional for spells and combat turns; required for NPC occurrences and enemy-event extraction and normalization. | | **npc_registry** | Normalized NPC registry. Optional for spells and combat turns; required for NPC occurrences and enemy-event extraction and normalization. |
@@ -488,7 +471,7 @@ normalized combat-turn module may use optional **npc_registry**. Location occurr
require **location_registry** for extraction and normalization. Item occurrences require require **location_registry** for extraction and normalization. Item occurrences require
**item_registry** for extraction and normalization. Enemy-event extraction requires all **item_registry** for extraction and normalization. Enemy-event extraction requires all
four of its JSON artifact slots; its normalizer requires **npc_registry**. four of its JSON artifact slots; its normalizer requires **npc_registry**.
The [complete example](../examples/dnd-complete.config.yml) shows the ordered The [complete example](../examples/dnd-complete/config.yml) shows the ordered
generated bindings. generated bindings.
## Production Module Keys ## Production Module Keys
@@ -539,12 +522,12 @@ Available validator keys are:
| Location registry | **extract/dnd/location-registry/shape**, **extract/dnd/location-registry/source_refs**, **extract/dnd/location-registry/source_relatedness**, **normalize/dnd/location-registry/identity** | | Location registry | **extract/dnd/location-registry/shape**, **extract/dnd/location-registry/source_refs**, **extract/dnd/location-registry/source_relatedness**, **normalize/dnd/location-registry/identity** |
| Location occurrences | **extract/dnd/location-occurrences/shape**, **extract/dnd/location-occurrences/registry**, **extract/dnd/location-occurrences/source_refs**, **extract/dnd/location-occurrences/source_relatedness**, **normalize/dnd/location-occurrences/invariants** | | Location occurrences | **extract/dnd/location-occurrences/shape**, **extract/dnd/location-occurrences/registry**, **extract/dnd/location-occurrences/source_refs**, **extract/dnd/location-occurrences/source_relatedness**, **normalize/dnd/location-occurrences/invariants** |
`extract/dnd/scene-descriptions/combat_semantics` is not in a production default chain. To opt in, replace the scene extractor validator chain with the current ordered chain plus the semantic validator last, and set a positive producer retry budget if a rejection should request a corrected scene: `extract/dnd/scene-descriptions/combat_semantics` is not in a production default chain. To opt in, replace the scene extractor validator chain with the current ordered chain plus the semantic validator last, and retain a positive semantic-turn allowance if a rejection should request a corrected scene:
~~~yaml ~~~yaml
extract: extract:
module: dnd/scene-descriptions module: dnd/scene-descriptions
retries: 1 max_additional_turns: 1
validators: validators:
- module: generic/valid_json - module: generic/valid_json
- module: extract/dnd/scene-descriptions/shape - module: extract/dnd/scene-descriptions/shape
@@ -552,14 +535,13 @@ extract:
- module: generic/valid_json_schema - module: generic/valid_json_schema
- module: extract/dnd/scene-descriptions/source_relatedness - module: extract/dnd/scene-descriptions/source_relatedness
- module: extract/dnd/scene-descriptions/combat_semantics - module: extract/dnd/scene-descriptions/combat_semantics
retries: 1
~~~ ~~~
An override replaces, rather than extends, the default chain. See [Module Bindings And Validators](#module-bindings-and-validators) for binding, profile, repair, retry, and failure-policy rules. An override replaces, rather than extends, the default chain. See [Module Bindings And Validators](#module-bindings-and-validators) for binding and profile rules, and [producer controls](#producer-controls) for semantic correction and terminal mode.
The validator retry shown above permits one additional execution against the The validator runs once per candidate assessment. Native transient retries and
same scene candidate when the LLM-backed validator itself fails; it is separate structural repair remain internal to that execution; there is no separate
from both the extractor's producer retry and PromptKit structural repair. validator semantic-turn allowance.
When no override is configured, production D&D bindings use the following When no override is configured, production D&D bindings use the following
ordered chains. Each row lists extract then normalize; spell chains are the ordered chains. Each row lists extract then normalize; spell chains are the
@@ -582,27 +564,29 @@ Chains are only registered for the D&D extract and normalize modules shown
above; select an explicit override when a different compatible chain is above; select an explicit override when a different compatible chain is
required. required.
## Validation ## Validation And Inspection
Validate a file and one pipeline before running it: Configuration validation checks the selected native application document.
Pipeline validation additionally resolves production modules/options, validator
targets, references, generated handoffs, and statically known prompt/profile
dependencies. It needs no transcript, reference bytes, credential values,
provider calls, or state directories. Partial profiles pass; request-time data
and dynamic selections remain runtime checks. [CLI Reference](cli.md#pipeline-commands)
owns commands for both boundaries.
~~~sh Native whole-app and focused PromptKit inspection use the same selected result
go run ./cmd/notarius config validate \ and secret-aware provenance. Profile inspection describes stored fields, not a
--config examples/dnd-minimal.config.yml \ prediction of a completed request; prepared preview is the native request boundary.
--pipeline dnd-session See [configuration commands](cli.md#configuration-commands) and
~~~ [PromptKit commands](cli.md#promptkit-commands).
Configuration validation rejects invalid YAML, unsupported fields, invalid [formats]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md
defaults or explicit CLI overrides, incompatible module keys, unknown options, [backends]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md#backend-definitions
invalid reference bindings, missing required reference slots, invalid validator [profile-defaults]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md#defaults-and-overrides
overrides, and incompatible generated artifact handoffs. Use [resource-inheritance]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md#resource-inheritance
[pipelines list](cli.md#pipelines-list) to inspect configured IDs. [output-contract]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md#output-contract
[schemas]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md#schemas
## Inspection [imports]: https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md#explicit-imports
[overlays]: https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md#selected-overlays
Use [config effective](cli.md#config-effective) to write the selected composed [inheritance]: https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md#sibling-inheritance
configuration as deterministic, redacted YAML. Use [sequences]: https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md#strict-document-composition
[config explain](cli.md#config-explain) with a canonical JSON Pointer to inspect
the effective or historical provenance for one path, including a value displaced
by a selected overlay. Neither command resolves a pipeline, prepares modules,
materializes references, or requires provider credentials.

View File

@@ -1,142 +1,93 @@
# Consuming The Complete D&D Pipeline # Consuming The Complete D&D Pipeline
Use this workflow when an orchestrator runs the maintained complete D&D This guide applies the [subprocess workflow](subprocess.md) to the maintained
pipeline and consumes its structured JSON artifacts. The generic complete D&D configuration. [CLI Reference](../cli.md) owns invocation and the
[subprocess consumer guide](subprocess.md) owns process-level responsibilities; native report; [Configuration](../config.md) owns composition;
this guide connects that workflow to the complete D&D configuration, its [Published JSON Output](../integrations/json-output.md) owns logical paths.
Seriatim input, and its artifact inventory. [Migration guidance](native-migration.md) covers older orchestrators.
The [CLI reference](../cli.md), [configuration reference](../config.md), ## Prepare The Deployment
[run-result receipt](../integrations/run-result.md), and
[published JSON output contract](../integrations/json-output.md) remain the
canonical definitions of those public interfaces.
## Prepare And Validate The Deployment Start from [examples/dnd-complete/config.yml](../../examples/dnd-complete/config.yml).
Preserve its imported pipeline fragments, native companion, and reference files,
or update the paths deliberately. It uses every implemented D&D family, ordered
generated handoffs, and selected chunk-map/evidence output.
Start from the maintained Native embedded defaults and the maintained companion already provide profile/
[complete D&D configuration](../../examples/dnd-complete.config.yml). It uses backend definitions. A deployment can supply variants rather than being required
the `dnd-session` pipeline and demonstrates every implemented D&D lane, ordered to recreate them. YAML paths retain the contributing declaration's origin;
artifact handoffs, campaign references, chunk-map publication, and evidence CLI reference paths use the process working directory. Absolute caller paths
context. are useful for services. Keep credentials in the intended environment, not
files, arguments, sessions, or logs.
A deployment must provide its own PromptKit profile and campaign reference Validate without credentials or inference:
files. Use absolute paths for service and subprocess deployments. In
particular, observe these different resolution rules:
- reference and PromptKit profile paths in YAML are resolved relative to the ~~~sh
file that supplies their surviving declaration; notarius config validate --config /absolute/path/to/notarius.yml
- reference paths passed with `--reference` are resolved relative to the notarius pipeline validate dnd-session --config /absolute/path/to/notarius.yml
Notarius process working directory. ~~~
Do not copy the repository example's relative profile path into a deployment ## Supply The Transcript And References
without preserving its configuration-relative layout. The complete path and
profile rules are defined in [Configuration](../config.md).
Preflight the deployed configuration before processing sessions and whenever Use the [Seriatim JSON contract](../integrations/seriatim.md). Preserve segment
it changes: IDs because artifact citations use those source-unit ranges. If the caller
maintains a final trimmed transcript tier, select that same session content
consistently for later consumers.
```sh Run with explicit input/output and pipeline-level references:
notarius config validate \
--config /absolute/path/to/notarius.yml \
--pipeline dnd-session
```
Provide credentials through the environment or the documented configuration ~~~sh
mechanism. Do not put credentials in command arguments, generated
configuration, or logs.
## Supply The Transcript
The complete pipeline consumes a Seriatim JSON document. The
[Seriatim input contract](../integrations/seriatim.md) defines its required
metadata, segments, and validation rules. Preserve segment IDs: D&D artifact
citations use those segment IDs as source-unit ranges.
When the caller maintains several transcript tiers, use the final trimmed JSON
transcript so extraction operates on the same session content presented to
later consumers. For example, Narratio identifies this implemented artifact as
`narratio.transcript.final_trimmed` and normally stores it at
`transcripts/final.trimmed.json`.
Notarius generates a stable prompt session from the resolved input module and
the exact input bytes. An ordinary orchestrator should not pass `--session-id`.
Use that override only when intentionally changing the routing relationship
between invocations; it is not a credential or output identity.
## Run Notarius
Invoke the pipeline with explicit absolute paths and request its
machine-readable receipt:
```sh
notarius run dnd-session \ notarius run dnd-session \
--config /absolute/path/to/notarius.yml \ --config /absolute/path/to/notarius.yml \
--input /absolute/path/to/transcripts/final.trimmed.json \ --input-file /absolute/path/to/transcripts/final.trimmed.json \
--output-dir /absolute/path/to/notarius-output \ --output-dir /absolute/path/to/notarius-output \
--reference party=/absolute/path/to/references/party.txt \ --reference party=/absolute/path/to/references/party.yml \
--reference players=/absolute/path/to/references/players.txt \ --reference glossary=/absolute/path/to/references/glossary.yml \
--reference glossary=/absolute/path/to/references/glossary.txt \ --reference spell_catalog=/absolute/path/to/references/glossary.yml \
--reference spell_catalog=/absolute/path/to/references/spells.json \ --format json
--json ~~~
```
Each unqualified reference is pipeline-scoped: Notarius supplies it to every Only supply optional references the deployment maintains. Unqualified selectors
selected D&D target that declares the slot. A deployment may omit an optional reach every selected target declaring the slot; narrower overrides follow the
reference it does not maintain, and may use the lane- or binding-qualified [selector contract](../cli.md#reference-selectors). Generated registry, scene,
forms from the [CLI reference](../cli.md#reference-selectors) for an exceptional combat, and NPC-occurrence handoffs stay in pipeline configuration, not CLI file
override. The registry, scene-description, combat-turn, and NPC-occurrence bindings.
references declared between ordered steps in the complete configuration are The [shared input contract](../integrations/shared-domain-inputs.md) explains
generated artifacts. Do not pass those handoffs on the CLI. the party and glossary envelopes, selection defaults, and migration. Roster
player relationships do not require a separate player file; supplemental
`players` text remains optional.
The caller should: For an optional online readiness check, use `notarius preflight dnd-session`
with the same configuration, transcript, output root, and reference arguments as
the run above. Check process status and any available assessment as described in
the [subprocess workflow](subprocess.md#prepare-and-run); the
[CLI reference](../cli.md#preflight) owns report semantics. A synthetic input
checks that input only, not a subsequent final transcript.
- capture stdout and stderr separately; The ordinary input-based session is suitable without an override. Use
- propagate cancellation and impose an operator-appropriate timeout; `--llm-session-id` only to intentionally change its native selection.
- wait for process completion before interpreting stdout; and Sessions correlate provider routing; they are not credential or output identities.
- retain stderr for diagnosis without copying secrets or transcript content
into other logs.
Only exit status 0 permits decoding stdout as a receipt. Ignore stdout after a Capture stdout/stderr separately, propagate cancellation, impose an appropriate
nonzero exit because a failed receipt write can leave partial bytes. The caller deadline, and wait for completion. Parse a successful report only after
[CLI reference](../cli.md#output-streams-and-exit-statuses) defines the complete status zero; failed writes can leave partial stdout. Nonzero status after
stream and exit-status contract. publication can still leave valid artifacts for deliberate recovery.
## Discover The Published Bundle ## Locate And Read Artifacts
Decode the successful stdout document as a supported run-result schema. For Use the report's absolute `output_directory`, not a newest-directory scan.
the current contract, `schema_version` is `notarius.run-result.v2`. Tolerate The report's exact fields and fallback qualification belong in
unknown fields allowed by that version, but reject an unsupported schema [CLI Reference](../cli.md#completion-report). There is no receipt schema,
version. index/manifest traversal, or descriptor inventory to load.
Use the receipt's absolute `output_directory` as the exact run-specific bundle The complete configuration uses safe literal lane IDs: each table entry below
root. Do not scan the output root for its newest directory, guess a run ID, or is at `lanes/<lane-id>.json` beneath that run directory. Decode the configured
construct a bundle path. Resolve `index_file` beneath `output_directory` and domain contract directly. All ten lane artifacts plus the two enabled/available
reject an absolute logical path or any result that escapes the bundle root. auxiliaries give twelve deliverables; a count is not a substitute for checking
the files required by the caller.
The complete configuration uses the application validation defaults. A caller
that requires fully validated D&D artifacts must also require receipt
`validation_status: approved`; a successful `incomplete` result reflects the
configured validator-failure continuation policy and carries its bounded
validator provenance in `validation_summaries`.
Read `index.json` and locate each requested lane in `output_files` by its exact
`lane_id`. Do not guess a lane filename. Before decoding a payload:
1. resolve its descriptor's relative `file` beneath the bundle root with the
same confinement check;
2. verify the descriptor's media type and schema identity against the linked
artifact contract; and
3. decode the payload according to that contract.
The [published JSON output contract](../integrations/json-output.md) defines
the index and bundle layout. Treat all paths obtained from a decoded external
document as untrusted until confined to their documented root.
## Complete Artifact Inventory ## Complete Artifact Inventory
When every configured lane is accepted, the complete example publishes these
lane artifacts:
| Lane ID | Purpose | Canonical contract | | Lane ID | Purpose | Canonical contract |
| --- | --- | --- | | --- | --- | --- |
| `item-registry` | Canonical registry of encountered items and currency. | [Item registry](../integrations/dnd-item-registry-artifacts.md) | | `item-registry` | Canonical registry of encountered items and currency. | [Item registry](../integrations/dnd-item-registry-artifacts.md) |
@@ -150,72 +101,55 @@ lane artifacts:
| `location-occurrences` | Source-grounded location occurrences. | [Location occurrences](../integrations/dnd-location-occurrence-artifacts.md) | | `location-occurrences` | Source-grounded location occurrences. | [Location occurrences](../integrations/dnd-location-occurrence-artifacts.md) |
| `enemy-events` | Source-grounded enemy combat events. | [Enemy events](../integrations/dnd-enemy-event-artifacts.md) | | `enemy-events` | Source-grounded enemy combat events. | [Enemy events](../integrations/dnd-enemy-event-artifacts.md) |
The JSON encoder always publishes these bundle-management files: The complete configuration also selects two pipeline-wide files:
| File | Purpose | - [`chunk-map.json`](../integrations/chunk-map.md), the materialized plan/chunks.
| --- | --- | - [`evidence-context.json`](../integrations/evidence-context.md), the union of
| `index.json` | Discovery document for lane and pipeline-wide artifacts. | selected cited units and their configured surrounding window.
| `manifest.json` | Run provenance and result summaries. |
| `rejected.json` | Rejected pipeline outputs. |
| `warnings.json` | Actionable process-degradation warnings. |
| `diagnostics.json` | Advisory and observation findings for accepted artifacts. |
The complete configuration also requests two pipeline-wide artifacts: They are not lanes and need no discovery descriptor. Their intrinsic payload
schemas are unchanged. Evidence is reading context, not authoritative lane
attribution; surrounding units do not widen citations in lane artifacts.
No index, manifest, rejection/warning/diagnostic sidecars are required.
- [`chunk-map.json`](../integrations/chunk-map.md), the accepted chunk plan and ## Decide Consumer Acceptance
chunk metadata; and
- [`evidence-context.json`](../integrations/evidence-context.md), a reading
excerpt containing the union of selected cited source units and the
configured surrounding window.
Discover both from their top-level `index.json` descriptors rather than Process completion does not establish the caller's required artifact set,
treating them as lanes. Evidence context is convenient reading material, not semantic quality, or fresh validation under changed policy. A complete-workflow
authoritative provenance; citations in the normalized lane payloads remain the caller should check all ten required lane files against their contracts. A
evidence contract. subset consumer can choose a narrower set deliberately. Empty valid domain
collections remain distinguishable from missing/incompatible files.
Every optional or lane file is published only when its corresponding artifact Explicit permissive execution can complete with qualified fallback. Decide
is available. A successful process does not guarantee that all configured whether to accept that and inspect positive `fallback_count` when relevant.
lanes were accepted. The count identifies emitting operations, not individual affected lanes.
Fallbacks satisfy intrinsic/downstream invariants but not ordinary semantic
approval; valid downstream results affected by them also avoid cache reuse.
## Decide What Counts As Consumer Success Default cache reuse does not repeat semantic assessment. For a deliberate model/
policy experiment requiring fresh inference, select bypass/refresh under
[configuration controls](../config.md#producer-controls). Do not look for retired
validation ledgers or treat optional debug serialization as an API.
[Native usage diagnostics](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-usage-reporting)
are optional and separate from the completion report and artifact retrieval;
accepted-result hits add no current model work.
Exit status 0 means Notarius completed the pipeline and published its result Retain useful domain files and caller-owned invocation/report evidence. Capture
bundle. The receipt or bundle may still report warnings, rejected outputs, or failure after publication does not invalidate completed artifact writes, but
missing lane descriptors. A downstream consumer must define its own required requires deliberate caller recovery rather than parsing partial success output.
artifact set explicitly. A failed publication can leave an incomplete directory. Transcript-derived
artifacts, evidence, cache, debug, and streams can contain private campaign data;
A caller that claims to consume the complete D&D workflow should normally apply the caller's sharing and retention choices.
require all ten lane IDs in the table and verify each descriptor's expected
contract. If any required lane is missing, rejected, or incompatible, fail the
caller's extraction step while retaining the Notarius bundle for diagnosis. A
consumer that needs only a subset may define and document a narrower policy.
Keep the successful receipt with the complete published bundle. Retain
`manifest.json`, `rejected.json`, `warnings.json`, and captured process logs as
required by the caller's provenance, diagnosis, and retention policies. Avoid
selectively copying payload files without also preserving enough index and
manifest information to identify their originating run and contracts.
The transcript, lane artifacts, evidence context, manifest, debug data, and
logs can all contain private campaign information. Apply the same access,
publication, and retention controls used for the source transcript.
## Consumer Checklist ## Consumer Checklist
- Validate the deployed Notarius configuration and `dnd-session` pipeline. - Validate application configuration and the selected pipeline offline.
- Pass the final trimmed Seriatim JSON transcript with stable segment IDs. - Preserve Seriatim source-unit IDs.
- Use absolute configuration, input, output-root, profile, and reference paths - Pass source, output root, and optional campaign references as first-class inputs.
in service deployments. - Keep generated handoffs configured; avoid external/generated collisions.
- Capture stdout and stderr separately and enforce cancellation and timeout. - Separate streams, propagate cancellation, and check status before parsing.
- Parse stdout only after exit status 0. - Use the native report directory and configured domain/auxiliary paths.
- Accept only supported receipt, index, and artifact schema versions while - Decode supported payload contracts and check the caller's explicit required set.
tolerating permitted unknown fields. - Decide whether qualified fallback and cached acceptance meet caller needs.
- Use the receipt's `output_directory`; never guess the run directory. - Retain only the artifact/report/evidence records useful to the caller.
- Confine `index_file` and every descriptor path to the published bundle root. - Treat source-derived data as sensitive; do not rely on a sanitized debug bundle.
- Discover lanes by `lane_id` and verify descriptor compatibility before
decoding payloads.
- Enforce an explicit required-lane policy and inspect rejections and warnings.
- Preserve the receipt and sufficient bundle provenance for every retained
artifact.
- Protect all transcript-derived files and diagnostic streams as sensitive
campaign data.

View File

@@ -0,0 +1,143 @@
# Migrating To Native Configuration And Commands
This guide maps retired Notarius interfaces to the implemented native workflow.
It is migration material: the old spellings below are not accepted aliases.
[Configuration](../config.md), [CLI Reference](../cli.md), and
[Operations](../operations.md) own the current contracts. Domain artifact schemas
and lane filename mapping are unchanged.
## Update Caller Arguments
| Former interface | Current equivalent / intent |
| --- | --- |
| `notarius --version` | `notarius version`. |
| `pipelines list` | `pipeline list`. |
| `config validate --pipeline ID` | `pipeline validate ID`; native `config validate` checks the application document. |
| `config effective` | `config show`; scopes are `app` and `promptkit`. |
| Positional `config explain POINTER` | `config explain --path POINTER`; use native list/history options for discovery. |
| `config profile ID` | `promptkit show profile QUALIFIED_ID`; this reports stored fields, not a copied completed target. |
| `--config-overlay NAME` | `--overlay NAME`. |
| Run `--input PATH` | `--input-file PATH`. |
| `--only a,b` | Repeat literal `--lane a --lane b`; commas are no longer separators. |
| `--json` | `--format json`; YAML/text are also native report formats. |
| `--session-id ID` | `--llm-session-id ID`. |
| `--reasoning-effort VALUE` | `--llm-reasoning-effort VALUE`. |
| `--clear-reasoning-effort` | Explicit `--llm-reasoning-effort=`; omission retains native inheritance. |
| `--resume`, `--recompute-step`, separate `--chunk_cache`/`--chunk-cache` | Ordinary accepted-result reuse, with invocation-wide `--cache auto\|bypass\|refresh`. No explicit resume or selective checkpoint barrier. |
`run` and `pipeline run` are two native routes to the same command. Put flags
after the complete command path. Singleton occurrences are all parsed, with the
last successfully parsed value retained. False/zero/empty supplied values are not
omission. Canonical `--llm-*` execution overrides reach producers, correction,
and validators; shorter ckprompt aliases apply only to their installed PromptKit
commands. Help works offline on subcommands.
## Migrate Configuration And Resources
Version 6 is the sole application version; bumping the header alone does not
translate old fields. Use the maintained
[minimal](../../examples/dnd-minimal/config.yml) or
[complete](../../examples/dnd-complete/config.yml) configuration as a starting point.
- Replace `promptkit.profile_file`, `profile_dir`, and `local_backend` wrappers
with native settings beneath the main file's `promptkit`, or wrapperless
`prompts.yml` / recursive `prompts/` companions beside that selected main file.
Companion files form strict peers, not filename-priority layers.
- Use identified `backends`, `profiles`, and `prompts` lists with literal `id`
values and collections. The embedded profile is
`notarius/dnd-extraction`; initial/correction prompt IDs are also qualified,
for example `notarius/dnd.spells` and `notarius/dnd.spells.repair`.
- The root bundled backend is `openrouter`. Retired external provider catalogs
are not loaded as parallel sources; declare needed backends/profiles through
native resources. Do not infer backend identity from an endpoint or model.
- Use native root `config` imports and preserve declaration-relative paths.
Remove old per-prompt resource-version wrappers such as `v1`; resource IDs no
longer select those versions.
- A later same-ID resource replaces the whole earlier record. Use a distinct
sibling with `extends: {id: parent}` to retain fields, not a partial same-ID
replacement or self-inheritance. Profile/backend references to collection
resources use qualified IDs; sibling inheritance is local to its list.
- Preserve deliberate null/empty/zero choices under native semantics. Null
endpoint/key-environment values can allow backend fallback; empty strings can
clear those sources. Inspect native effective values/history rather than
assuming old wrapper null behavior.
- Keep prompt-declared schemas. Inline schemas, source-relative `schema_file`,
and explicit-root `schema_path` are native alternatives. Replacing a collection
schema root does not retain missing-file fallback to embedded resources.
Review [native resource and schema rules](../config.md#promptkit-profiles) before
reusing an old profile file. The complete example's
[companion](../../examples/dnd-complete/prompts.yml) demonstrates current inheritance.
## Separate Retry Intent, Mode, And Capacity
Producer `retries` intended for semantic correction becomes
`max_additional_turns`, excluding the initial response. Binding overrides pipeline;
omission inherits and explicit zero disables semantic correction. Native growing
continuation replaces latest-only manual replay, and each revised candidate gets
the full applicable assessment chain, including its final permitted turn.
Remove validator `retries`, generic deterministic retries,
`structured_output_repair_attempts`, and the application `promptkit.transient_retries`
wrapper. PromptKit owns transient failures and structural repair. Run-wide
transient customization uses `--llm-transient-retries`; structural customization
belongs in native prompt output contracts. Bundled prompts leave repair counts
unspecified. Former total provider-attempt parity is not promised.
Replace failure-category `validation_policy` and its `fail_run`, `reject_output`,
and `warn_continue` choices with producer `mode: strict|permissive`. Strict is
the default, including normalization. Permissive explicitly requests a supported
module fallback, not incomplete ordinary acceptance. Cancellation does not fall
back; unsupported fallback construction fails. Completion discloses actual
fallback emitters independently of warning visibility.
Replace `concurrency.total_llm` and `concurrency.stage_workers.extract` with
`concurrency.workers`, covering ready extraction and lane completion together.
Choose native backend capacity independently. There is no cross-backend global
LLM ceiling, inferred per-backend translation, or extra capacity queue/retry.
The [configuration reference](../config.md#concurrency-output-cache-and-debug)
owns current defaults and controls.
## Replace Both Legacy Caches
Replace nested `cache.chunk_plans` / `cache.checkpoints` directories and recording
switches with root `cache_directory` and pipeline/binding `cache`. An explicit
invocation `--cache` overrides every binding. Auto reads/stores acceptance;
bypass does neither; refresh skips reads and replaces only after new acceptance.
The initial prepared native message-content hash selects final accepted artifacts
and LLM plans. A hit is decoded/usability-checked, not semantically revalidated.
Model/settings/policy changes can still hit; use refresh/bypass for experiments
requiring fresh work. Source identity alone no longer fixes chunk boundaries.
Fallback and actually affected consumers skip reuse; unaffected predecessors
remain reusable after downstream failure. Failed refresh preserves old acceptance.
Do not copy, convert, or delete legacy records as an upgrade prerequisite. They
remain ignored and untouched, and the new cache populates through ordinary work.
[Operations](../operations.md#accepted-result-cache-and-recovery) owns recovery
and deployment-permission guidance.
## Replace Receipt And Sidecar Traversal
Stop expecting `notarius.run-result.v2`, `index_file`, validation histories,
warning counts, `index.json`, `manifest.json`, or reporting-only rejection/
warning/diagnostic files. Check process status, optionally decode the
[native completion report](../cli.md#completion-report), then read configured
lane/auxiliary [domain paths](../integrations/json-output.md).
Use the report's absolute run directory, not a guessed run ID or newest-folder
scan. Count actual deliverables rather than old normalized-output totals.
The report does not establish fresh validation or model quality; decide whether
positive fallback qualification is acceptable. Failed stdout can be partial,
and post-publication failure can leave valid artifacts with a nonzero status.
Debug remains explicitly selected and independent of native visibility modes.
Directory-only configuration does not enable it; explicit empty disables it.
The relative `latest` link updates at start, not completion. Full selected
evidence replaces the old summary/trace hierarchy; filenames/JSON shapes remain
private and arbitrary application content is not heuristically sanitized.
Do not replace receipt traversal with a debug-layout dependency or a new manifest.
Update callers using the [subprocess guide](subprocess.md) or
[complete D&D workflow](dnd-pipeline.md). These changes do not publish a new release
or rewrite historical release notes.

View File

@@ -1,115 +1,121 @@
# Using Notarius As A Subprocess # Using Notarius As A Subprocess
Use this workflow when an orchestrator runs Notarius and consumes its published Use this workflow to run Notarius and consume domain files. [CLI Reference](../cli.md)
artifacts. The [CLI reference](../cli.md) owns invocation syntax and exit owns commands, reports, and statuses; [Published JSON Output](../integrations/json-output.md)
statuses, while the [run-result receipt](../integrations/run-result.md) and owns logical paths and payload links; [Operations](../operations.md) owns state
[Published JSON Output contract](../integrations/json-output.md) own the and recovery. See the [complete D&D workflow](dnd-pipeline.md) for its inventory
durable result formats. or [migration guidance](native-migration.md) for older callers.
For the maintained complete D&D workflow, including its transcript input, ## Prepare And Run
configured lane inventory, and downstream acceptance checklist, see
[Consuming The Complete D&D Pipeline](dnd-pipeline.md).
## Run And Check The Process Use an argument vector with explicit paths appropriate to the deployment.
Absolute paths avoid dependence on a service's working directory. Keep stdout
and stderr separate, and choose caller cancellation/deadline behavior.
On the executable, the first SIGINT or SIGTERM requests cooperative cancellation;
started work can drain and available capture can be finalized. A subsequent signal
uses ordinary process handling and may interrupt cleanup. No shutdown deadline is
implied, and callers should not assume non-cooperative extensions will stop.
Optionally preflight a selected configuration and pipeline before work starts: Validate the application and pipeline offline:
```sh ~~~sh
notarius config validate --config /path/to/notarius.yml --config-overlay production --pipeline pipeline-id notarius config validate --config /absolute/path/to/notarius.yml
``` notarius pipeline validate pipeline-id \
--config /absolute/path/to/notarius.yml --overlay production
~~~
Omit `--config-overlay` when the composed base configuration is the intended Omit the overlay for the composed base. Pipeline validation needs no transcript,
selection; it is independent from any `--llm-profile` run override. reference bytes, credentials, provider call, or state directory.
Invoke the run with explicit paths and machine-readable output. Capture Optionally perform online readiness checks with the same selection and references
standard output and standard error separately; do not combine them before that will be used for execution:
processing the result.
```sh ~~~sh
notarius preflight pipeline-id \
--config /absolute/path/to/notarius.yml --overlay production \
--input-file /absolute/path/to/source.json \
--reference party=/absolute/path/to/party.yml \
--output-dir /absolute/path/to/output-root --format json
~~~
Check process status even when a report is present. On nonzero status, decode an
available complete assessment for details when useful; early errors may produce
none and failed delivery may leave partial bytes. `ready: true` alone does not
override a failing status. A synthetic transcript is ordinary supplied input:
its successful assessment does not establish readiness of a future transcript.
Preflight can contact providers and incur costs; see
[preflight operation](../operations.md#preflight-lifecycle).
Then run with the same selection and reference:
~~~sh
notarius run pipeline-id \ notarius run pipeline-id \
--config /path/to/notarius.yml \ --config /absolute/path/to/notarius.yml --overlay production \
--config-overlay production \ --input-file /absolute/path/to/source.json \
--input /path/to/source.json \ --reference party=/absolute/path/to/party.yml \
--output-dir /path/to/output-root \ --output-dir /absolute/path/to/output-root --format json
--json ~~~
```
Use absolute paths for supplied input, configuration, output-root, and Pass external references as separate arguments. Unqualified selectors reach
reference files. Pass each external reference as its own argument-vector pair; compatible selected targets; narrower selectors are exceptional overrides.
do not construct and invoke a shell command. An unqualified reference selector Generated same-run handoffs stay configured, not CLI files. The
supplies that file to every compatible selected target. Lane and stage [reference selector contract](../cli.md#reference-selectors) owns matching and
qualification are available for exceptional overrides, while generated precedence.
same-run references remain part of configured pipeline composition. The
[CLI reference](../cli.md#reference-selectors) owns the exact selector and
precedence contract.
The maintained D&D subprocess workflow uses this facility for campaign context: Supply credentials through the intended process environment, not arguments,
session IDs, generated files, or logs. Omitted session selection uses the
input-based default; use the [native override](../cli.md#run-wide-llm-overrides)
only when intentionally changing it.
```sh ## Check Completion Before Parsing
notarius run dnd-session \
--config /absolute/path/to/notarius.yml \
--input /absolute/path/to/transcripts/final.trimmed.json \
--output-dir /absolute/path/to/notarius-output \
--reference party=/absolute/path/to/references/party.txt \
--reference players=/absolute/path/to/references/players.txt \
--reference glossary=/absolute/path/to/references/glossary.txt \
--reference spell_catalog=/absolute/path/to/references/spells.json \
--json
```
Only pass the external references available to and desired by the deployment. Wait for completion. Only successful status permits interpreting stdout as a
Notarius generates a stable prompt session for the resolved input module and successful native report. Optional [native usage diagnostics](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-usage-reporting)
exact input bytes; reference changes do not change it. Pass **--session-id** do not change this stdout/artifact contract and are not a durable usage API.
only when intentionally grouping different invocations under a different Failed delivery can leave partial bytes; retain stderr
session. Supply credentials through Notarius's documented configuration and and available locations rather than parsing a structured error envelope.
environment mechanisms, never as command-line arguments or generated
secret-bearing configuration. In particular, a session identifier is
provider-visible and is not a credential mechanism.
Wait for the process before interpreting standard output. Only an exit status Optionally decode the [small completion report](../cli.md#completion-report).
of 0 permits decoding the receipt. On a nonzero exit, retain standard error for Its `output_directory` is the exact run root; do not scan for the newest folder
diagnosis and ignore all standard-output bytes: a failed receipt write may have or guess a run ID. The report is not a persisted receipt, schema-version envelope,
left a partial document. index, or validation/execution ledger.
## Discover Required Artifacts A completed run may contain supported fallback. The caller decides whether that
is acceptable; inspect positive `fallback_count` when relevant. It counts
emitting operations, not affected files. Reuse performs ordinary usability checks,
not fresh semantic assessment. Callers needing new inference/assessment after
policy changes deliberately select bypass/refresh under the
[cache controls](../config.md#producer-controls).
Decode the successful receipt and accept the schema versions supported by the ## Read Required Domain Files
caller. Use its `output_directory` as the bundle root. For the production JSON
output, resolve `index_file` under that root with a confinement check and reject
an absolute path or a result that escapes the root.
Read the resulting `index.json` and locate each artifact by `lane_id`, not by a Define required/optional lanes from the selected pipeline. Read their
guessed filename. Before decoding a selected payload, verify its descriptor's [documented paths](../integrations/json-output.md#bundle-layout) beneath the
media type and schema identity against the relevant published artifact report directory and decode using the configured artifact contracts. For custom
contract. The JSON bundle contract links to the available lane contracts. lane IDs, apply the unchanged filename mapping; collisions are command failures.
No receipt/index traversal, manifest descriptors, or reporting sidecars are needed.
If `index.json` has an `evidence_context` descriptor, treat it as a Optional chunk-map/evidence files use their documented paths when enabled and
pipeline-wide artifact rather than a lane entry. Verify its six descriptor available. Decode supported payload schemas. Evidence is a reading excerpt, not
fields before decoding the linked file according to the [Published Evidence authoritative lane attribution or a widened citation; normalized lane payloads
Context contract](../integrations/evidence-context.md). Decode its top-level retain those contracts.
source-unit array as a reading excerpt. Obtain authoritative citations and lane
provenance from the normalized lane artifacts; the excerpt has neither and its
nearby units do not widen a lane artifact's cited source reference.
A zero exit status may still report rejected outputs, warnings, or absent Process completion, required artifact availability/compatibility, and caller
lanes. The caller decides which lane IDs are required for its own work and acceptance requirements are separate checks. A count alone cannot identify
which are optional; it should make that decision explicitly rather than infer which files were produced.
failure from the receipt counts alone.
When complete validation is required, also require receipt ## Preserve Useful Evidence
`validation_status: approved` and inspect `validation_summaries`. A successful
run with `validation_status: incomplete` contains a structurally valid result
that advanced after validator execution could not complete under the configured
`warn_continue` policy. It is not reusable checkpoint state and should not be
silently treated as fully reviewed by the caller.
## Preserve Provenance And Handle Data Carefully Keep domain files and caller-owned invocation/report records useful for provenance.
Reports can be explicitly redirected; Notarius does not automatically persist a
second report or require a metadata bundle. Debug is optional private evidence,
not a consumer protocol.
Keep the receipt with the published `manifest.json`, and retain Post-publication capture/report failure can return nonzero while leaving valid
`rejected.json`, `warnings.json`, and `diagnostics.json` when review or later provenance requires artifacts. Preserve available files for deliberate recovery, but do not promote
them. Treat the input, output bundle, cache, debug bundle, and captured process partial stdout or incomplete publication to ordinary consumer success.
logs as potentially sensitive data. Apply the caller's access controls and [Operations](../operations.md#output-bundles) explains those boundaries.
retention policy, and avoid copying secrets into arguments, logs, or
provenance records. An evidence-context artifact contains source-unit text and Inputs, artifacts, evidence, cache, debug, and streams may contain sensitive data.
metadata and can cover most of an input; preserve and share it only when that Apply intended access, sharing, and retention controls. Evidence can cover the
source content is authorized for the recipient. whole source and is not inherently less sensitive.

View File

@@ -40,15 +40,16 @@ implementing changes. It owns implementation discipline and local commit rules.
| --- | --- | --- | | --- | --- | --- |
| Finding the package or component that owns current behavior | [Internal Overview](internal/overview.md) | It is the implemented component inventory and routes to focused internals. | | Finding the package or component that owns current behavior | [Internal Overview](internal/overview.md) | It is the implemented component inventory and routes to focused internals. |
| CLI composition or command behavior | [CLI Internals](internal/cli.md) and [CLI Reference](cli.md) | The internal guide owns composition and command flow; the reference owns public syntax. | | CLI composition or command behavior | [CLI Internals](internal/cli.md) and [CLI Reference](cli.md) | The internal guide owns composition and command flow; the reference owns public syntax. |
| Building a subprocess caller or changing its result protocol | [Subprocess Consumer Guide](consumers/subprocess.md), [Complete D&D Consumer Guide](consumers/dnd-pipeline.md), [Run Result Receipt](integrations/run-result.md), and [CLI Internals](internal/cli.md) | These separate generic caller workflow, the complete D&D workflow, the durable receipt contract, and CLI implementation behavior. | | Building a subprocess caller or changing its result protocol | [Subprocess Consumer Guide](consumers/subprocess.md), [Complete D&D Consumer Guide](consumers/dnd-pipeline.md), [Native Completion Report](cli.md#completion-report), and [CLI Internals](internal/cli.md) | These separate generic caller workflow, the complete D&D workflow, the native completion report, and CLI implementation behavior. |
| Configuration loading, resolution, or user-visible configuration behavior | [Configuration Internals](internal/configuration.md) and [Configuration](config.md) | The internal guide owns loading and resolution mechanics; the reference owns the configuration contract. | | Configuration loading, resolution, or user-visible configuration behavior | [Configuration Internals](internal/configuration.md) and [Configuration](config.md) | The internal guide owns loading and resolution mechanics; the reference owns the configuration contract. |
| Pipeline resolution or execution | [Pipeline Internals](internal/pipeline.md) | It documents profiles, references, validation, retries, checkpoints, and runner behavior. | | Pipeline resolution or execution | [Pipeline Internals](internal/pipeline.md) | It documents typed preparation, complete assessment, native continuation, workers, and handoff eligibility. |
| Production modules or validators | [Module Internals](internal/modules.md), [D&D Module Internals](internal/dnd.md), and [D&D integration contracts](integrations/) | The generic guide owns extension mechanics, the D&D guide owns shared family conventions, and the contracts own durable output shapes. | | Production modules or validators | [Module Internals](internal/modules.md), [D&D Module Internals](internal/dnd.md), [shared domain inputs](integrations/shared-domain-inputs.md), and [D&D integration contracts](integrations/) | The generic guide owns extension mechanics, the D&D guide owns shared family conventions, and the contracts own input and durable output shapes. |
| LLM clients, prompts, schemas, profiles, or scheduling | [LLM Runtime](internal/llm.md) | It documents the transport boundary and PromptKit integration. | | Native execution, prompts, schemas, profiles, or admission | [LLM Integration](internal/llm.md) | It locates shared engine construction, native request/continuation calls, and evidence hooks. |
| Output, cache, resume, or debug artifacts | [Run State Internals](internal/state.md), [Operations](operations.md), and [Configuration](config.md) | These separate implementation details, operator behavior, and configuration contracts. | | Kit API, source handoff, or standard-suite integration | [ConfigKit](integrations/pkg-configkit.md), [PromptKit](integrations/pkg-promptkit.md), and [CommandKit](integrations/pkg-commandkit.md) | These define the selected upstream integration boundaries and link pinned native contracts. |
| Output, accepted-result reuse, or debug artifacts | [Run State Internals](internal/state.md), [Operations](operations.md), and [Configuration](config.md) | These separate implementation details, operator behavior, and configuration contracts. |
| External input formats, artifact schemas, or durable output files | [Integration Contracts](integrations/) | Integration documents define external and durable data contracts. | | External input formats, artifact schemas, or durable output files | [Integration Contracts](integrations/) | Integration documents define external and durable data contracts. |
| Repository-specific release commands or diagnostics | [Source Releases](release.md) | The runbook supplies publication commands and recovery procedures. | | Repository-specific release commands or diagnostics | [Releases](release.md) | The runbook supplies publication, delivery, and recovery procedures. |
| Proposed or unimplemented behavior | [Roadmap](roadmap/) | Future work belongs only in roadmap documentation until implemented. | | Future scope and planning | [Future work](roadmap/future.md) | The backlog records proposed work; active feature and implementation plans live alongside it when present. Implemented behavior belongs in canonical documentation. |
For an existing subsystem, also inspect its focused tests and the package-local For an existing subsystem, also inspect its focused tests and the package-local
types and contracts before changing behavior. types and contracts before changing behavior.

View File

@@ -1,9 +1,9 @@
# Accepted Chunk Map # Accepted Chunk Map
This document defines the optional durable `chunk-map.json` artifact in a This document defines the optional durable `chunk-map.json` artifact in a
[published JSON bundle](json-output.md). It describes the accepted, [published JSON bundle](json-output.md). It describes the materialized chunk
materialized chunk plan used by one run. It is not a lane payload and is never plan used by one run, including a supported qualified fallback. It is not a lane
an input to a later pipeline step. payload and is never an input to a later pipeline step.
## Contract Identity ## Contract Identity
@@ -16,8 +16,8 @@ an input to a later pipeline step.
| Schema name | `notarius_source_chunk_map_v1` | | Schema name | `notarius_source_chunk_map_v1` |
| Schema version | `v1` | | Schema version | `v1` |
The optional `chunk_map` descriptor in `index.json` identifies this artifact. Read this logical path directly when enabled and available; no discovery
Export is controlled by the JSON output binding described in descriptor is required. Export is controlled by the JSON output binding in
[Configuration](../config.md#module-bindings-and-validators). [Configuration](../config.md#module-bindings-and-validators).
## Wire Shape ## Wire Shape
@@ -30,7 +30,7 @@ Every payload has these required fields:
| `source_digest` | Lower-case `sha256:` digest of that source document. | | `source_digest` | Lower-case `sha256:` digest of that source document. |
| `plan_digest` | Lower-case `sha256:` digest of the logical chunk plan. | | `plan_digest` | Lower-case `sha256:` digest of the logical chunk plan. |
| `requested_chunker` | Chunk module selected by the resolved pipeline. | | `requested_chunker` | Chunk module selected by the resolved pipeline. |
| `producer` | Original accepted-plan producer. `input_module` and `chunk_module` are required; `llm_profile` is optional. | | `producer` | Current run's plan component selections. `input_module` and `chunk_module` are required; `llm_profile` is optional and applies only to an LLM-backed chunker. Not historical cache execution provenance. |
| `plan_annotations` | Plan-level annotation namespace map; `{}` when none are present. | | `plan_annotations` | Plan-level annotation namespace map; `{}` when none are present. |
| `chunks` | Non-empty execution-order chunk collection. | | `chunks` | Non-empty execution-order chunk collection. |
@@ -47,9 +47,11 @@ valid JSON and are retained without interpreting a module-specific namespace.
`chunks` are in execution order. Their indexes are contiguous, start at zero, `chunks` are in execution order. Their indexes are contiguous, start at zero,
and equal their array positions; chunk IDs are unique. The emitted map is built and equal their array positions; chunk IDs are unique. The emitted map is built
only after the selected plan has been accepted and materialized against the after the selected plan has been materialized against the source document,
source document, so its ranges, unit counts, annotations, and digests describe so its ranges, unit counts, annotations, and digests describe that exact plan.
that exact plan. Supported fallback still satisfies those invariants without asserting ordinary
semantic approval; run-level qualification belongs to the
[CLI report](../cli.md#completion-report).
The codec rejects malformed JSON, trailing content, unknown fixed-object The codec rejects malformed JSON, trailing content, unknown fixed-object
fields, invalid identities or digests, invalid annotations, duplicate chunk fields, invalid identities or digests, invalid annotations, duplicate chunk
@@ -67,12 +69,13 @@ annotations, producer identity, and ordered chunks.
## Publication And Compatibility ## Publication And Compatibility
The map is present only when a chunk plan was accepted and its export is The map is published when export is enabled, a materialized plan is available,
enabled. It remains publishable if a later lane is rejected, but is absent when and the run reaches publication. Payload fields and schema are unchanged.
chunk-plan validation rejects the plan. `requested_chunker` identifies the `requested_chunker` and `producer` describe the current composition; unified
current pipeline selection, while `producer` identifies the component that cache entries retain the logical plan, not an earlier run's producer/profile
originally produced the accepted plan; they may differ when an accepted plan is ledger. Reuse rematerializes against the current source without semantic
reused. reassessment or claims of historical model execution. A strict failure does not
publish a successful bundle merely to expose this auxiliary.
The map contains structure rather than source content: it excludes transcript The map contains structure rather than source content: it excludes transcript
bytes, source-unit metadata, chunk text, private model output, reference bytes, source-unit metadata, chunk text, private model output, reference

View File

@@ -65,7 +65,7 @@ are unchanged: discovered has no holder; acquired requires `to`; lost and
consumed require `from`; transferred requires distinct non-`party` holders. consumed require `from`; transferred requires distinct non-`party` holders.
The only current downstream compatibility requirement is its registry handoff; The only current downstream compatibility requirement is its registry handoff;
the normalized occurrence list is otherwise published for callers. See the normalized occurrence list is otherwise published for callers. See
[Configuration](../config.md#d-d-reference-slots) for the binding and [Configuration](../config.md#dd-reference-slots) for the binding and
[JSON output](json-output.md) for publication. [JSON output](json-output.md) for publication.
See [item registry](dnd-item-registry-artifacts.md) for the grounding artifact See [item registry](dnd-item-registry-artifacts.md) for the grounding artifact

View File

@@ -90,6 +90,6 @@ into the unchanged exact durable ID/name pair. The registry’s source reference
are never occurrence evidence. Unknown or ambiguous selections are rejected by are never occurrence evidence. Unknown or ambiguous selections are rejected by
the occurrence contract. See the the occurrence contract. See the
[item-occurrence artifact](dnd-item-occurrence-artifacts.md) for that strict [item-occurrence artifact](dnd-item-occurrence-artifacts.md) for that strict
wire contract, [Configuration](../config.md#d-d-reference-slots) for binding wire contract, [Configuration](../config.md#dd-reference-slots) for binding
rules and validator selection, and the [JSON output contract](json-output.md) rules and validator selection, and the [JSON output contract](json-output.md)
for publication. for publication.

View File

@@ -80,7 +80,7 @@ are rejected rather than guessed or reassigned. The current transcript is the
only evidence source for an occurrence; registry evidence and provenance never only evidence source for an occurrence; registry evidence and provenance never
become occurrence evidence. become occurrence evidence.
See [Configuration](../config.md#d-d-reference-slots) for the selectable slot See [Configuration](../config.md#dd-reference-slots) for the selectable slot
and generated-handoff compatibility, [D&D module internals](../internal/dnd.md) and generated-handoff compatibility, [D&D module internals](../internal/dnd.md)
for implementation behavior, and the [JSON output contract](json-output.md) for implementation behavior, and the [JSON output contract](json-output.md)
for publication. for publication.

View File

@@ -86,7 +86,7 @@ Occurrence consumers receive names-only grounding; Notarius resolves the
selected canonical name and writes the unchanged exact durable ID/name pair. selected canonical name and writes the unchanged exact durable ID/name pair.
Spells, combat turns, and the [enemy-event artifact](dnd-enemy-event-artifacts.md) Spells, combat turns, and the [enemy-event artifact](dnd-enemy-event-artifacts.md)
also receive names-only grounding for actor or subject display. None of these also receive names-only grounding for actor or subject display. None of these
projections supply later-artifact evidence. [Configuration](../config.md#d-d-reference-slots) projections supply later-artifact evidence. [Configuration](../config.md#dd-reference-slots)
owns the `npc_registry` binding rules. owns the `npc_registry` binding rules.
The [JSON output contract](json-output.md) defines publication, and The [JSON output contract](json-output.md) defines publication, and
[D&D module internals](../internal/dnd.md) owns pipeline mechanics. [D&D module internals](../internal/dnd.md) owns pipeline mechanics.

View File

@@ -67,7 +67,7 @@ into `source_refs`.
## Related contracts ## Related contracts
The [spell-catalog overlay contract](dnd-spell-catalog-overlays.md) defines The [shared domain input contract](shared-domain-inputs.md) defines
the configured catalog additions. The [JSON output contract](json-output.md) the configured catalog additions. The [JSON output contract](json-output.md)
defines where this logical artifact is published; [D&D module internals](../internal/dnd.md) defines where this logical artifact is published; [D&D module internals](../internal/dnd.md)
describes extraction and validation mechanics. describes extraction and validation mechanics.

View File

@@ -1,78 +0,0 @@
# D&D Spell-Catalog Overlays
This document defines the optional JSON overlay consumed by the D&D spell
extractor. An overlay contributes campaign spell names and aliases for
recognition. It does not define spell rules, effects, levels, classes, or
transcript evidence. Bind the optional `spell_catalog` reference as described
in [Configuration](../config.md#references-and-ordered-handoffs).
## Contract Identity
| Property | Value |
| --- | --- |
| Consumer | D&D spell extraction and normalization |
| Reference slot | `spell_catalog` |
| Media type | `application/json` |
| Required schema version | `notarius.dnd.spell-catalog-overlay.v1` |
| Base catalog | Embedded D&D 5e 2014 SRD catalog |
At most one overlay document may be bound. The maintained example is
[dnd-spell-catalog.json](../../examples/dnd-spell-catalog.json).
## Wire Shape
This is a minimal valid overlay:
```json
{
"schema_version": "notarius.dnd.spell-catalog-overlay.v1",
"catalogs": [
{
"id": "campaign.example",
"ruleset": "dnd-5e-2014",
"source": {"title": "Example campaign spells"},
"spells": [{"name": "Aegis of Emberfall"}]
}
]
}
```
| Field | Required | Meaning and constraints |
| --- | --- | --- |
| `schema_version` | Yes | Exactly `notarius.dnd.spell-catalog-overlay.v1`. |
| `catalogs` | Yes | Non-empty array of catalog objects with unique IDs. |
| `catalogs[].id` | Yes | Non-empty trimmed string. |
| `catalogs[].ruleset` | Yes | Exactly `dnd-5e-2014`. |
| `catalogs[].source.title` | Yes | Non-empty trimmed string. |
| `catalogs[].source.version` | No | String when present. |
| `catalogs[].source.url` | No | String when present. |
| `catalogs[].source.license` | No | String when present. |
| `catalogs[].spells` | Yes | Non-empty array of spell objects. |
| `catalogs[].spells[].name` | Yes | Non-empty trimmed string. |
| `catalogs[].spells[].aliases` | No | Array of non-empty trimmed strings when present. |
Unknown fields are rejected at every object level. The document must contain
one JSON value; `null` is not accepted for optional strings or aliases.
## Composition And Compatibility
Notarius starts with the embedded base catalog, then applies overlay catalogs
in ascending catalog-ID order. A new canonical spell name adds a recognition
entry. If an overlay names an existing canonical spell, it augments that spell
with aliases while retaining the established display spelling.
Repeated aliases for the same spell are accepted. A canonical-name, canonical-
to-alias, or alias-to-alias collision between different spells is rejected,
including a collision with the embedded catalog. Matching uses the catalog’s
case, whitespace, and apostrophe normalization, so authors should avoid names
or aliases that normalize to another spell.
Spell extraction receives the effective catalog as deterministic canonical-name
and alias pairs. An alias in the transcript selects its associated canonical
name; the extractor is instructed to return that canonical spelling. The
projection contains no catalog source metadata or provenance, and aliases
remain recognition context rather than transcript evidence.
The overlay is a recognition aid only. The durable spell-artifact schema and
source-evidence rules are defined by the
[D&D spell artifact contract](dnd-spell-artifacts.md).

View File

@@ -9,9 +9,8 @@ logical-file discovery is owned by [Published JSON Output](json-output.md).
## Identity And Discovery ## Identity And Discovery
When enabled, the JSON bundle contains `evidence-context.json` and an When enabled and available, the JSON bundle contains `evidence-context.json`
`index.json` `evidence_context` descriptor with the same six fields as other at that documented logical path; no index descriptor is required.
pipeline-wide artifact descriptors.
| Property | Value | | Property | Value |
| --- | --- | | --- | --- |
@@ -22,16 +21,16 @@ pipeline-wide artifact descriptors.
| Schema version | `v1` | | Schema version | `v1` |
| Logical file | `evidence-context.json` | | Logical file | `evidence-context.json` |
Consumers must discover the file from the descriptor, verify all six descriptor Consumers select this path from the configured output policy and decode the
fields, and decode only a supported schema version. The descriptor is optional: supported payload contract below. Disabled or unavailable evidence is not
its absence means evidence publication was not enabled for that bundle. published. The identity and JSON shape above remain unchanged.
## Payload ## Payload
The v1 payload is a top-level JSON array of generic source units. There is no The v1 payload is a top-level JSON array of generic source units. There is no
wrapper, source-level metadata, context grouping, lane identifier, or evidence wrapper, source-level metadata, context grouping, lane identifier, or evidence
reference in the payload. An enabled configuration with no contributing reference in the payload. An enabled configuration with no contributing
accepted evidence publishes `[]`. evidence publishes `[]`.
```json ```json
[ [
@@ -73,14 +72,16 @@ annotations or reshape source-owned metadata.
## Selection And Citations ## Selection And Citations
The framework obtains direct source references only through typed evidence The framework obtains direct source references only through typed evidence
projections of accepted normalized artifacts in the configured lane allowlist. projections of published normalized artifacts in the configured lane allowlist,
including supported fallbacks and reused results.
It validates each reference against the current source document, expands its It validates each reference against the current source document, expands its
range by `window_units` source-unit positions on each side, clamps at document range by `window_units` source-unit positions on each side, clamps at document
boundaries, and takes the union of all expanded ranges. The output contains boundaries, and takes the union of all expanded ranges. The output contains
each selected source unit once in source-document position order, regardless each selected source unit once in source-document position order, regardless
of numeric unit IDs. Repeated references, overlapping windows, and citations of numeric unit IDs. Repeated references, overlapping windows, and citations
from multiple lanes do not duplicate a unit. Rejected, failed, absent, from multiple lanes do not duplicate a unit. Failed, absent, inactive, and
inactive, and unselected lanes contribute nothing. unselected lane results contribute nothing. Evidence from a supported fallback
does not imply ordinary semantic approval; the completion report qualifies the run.
Normalized lane artifacts remain authoritative for citations and for which lane Normalized lane artifacts remain authoritative for citations and for which lane
cited a range. The excerpt has no lane attribution and must not be used to cited a range. The excerpt has no lane attribution and must not be used to
@@ -94,10 +95,10 @@ the framework does not truncate the excerpt to meet an arbitrary size limit.
## Consumer Responsibilities And Data Handling ## Consumer Responsibilities And Data Handling
The artifact is additive to the JSON bundle and is not a lane payload, The artifact is additive to the JSON bundle and is not a lane payload or
normalized-output count, checkpoint, or generated reference. Consumers that generated reference. It counts as a deliverable when published, not as a lane.
do not need it must tolerate an absent descriptor. Consumers that do use it Consumers that do not need it can ignore it. Consumers that do use it should
should validate the descriptor and payload before use, retain the artifact with validate the payload before use, retain the artifact with
its schema identity when needed for a run record, and read citations from the its schema identity when needed for a run record, and read citations from the
corresponding normalized lane artifacts. corresponding normalized lane artifacts.

View File

@@ -1,196 +1,79 @@
# Published JSON Output # Published JSON Output
This document defines the logical JSON bundle emitted by the production JSON This contract defines logical files emitted by the production JSON output
output encoder. The bundle’s physical destination, atomic publication, and encoder. [Operations](../operations.md#output-bundles) owns physical placement,
retention are operational concerns; see [Operations](../operations.md#output-bundles). publication failures, permissions, and retention. [Configuration](../config.md#module-bindings-and-validators)
Output configuration, including chunk-map and evidence-context publication, belongs in owns output options; the [CLI completion report](../cli.md#completion-report)
[Configuration](../config.md#module-bindings-and-validators). identifies a successful run's directory.
## Bundle Layout ## Bundle Layout
All paths below are logical, relative, slash-separated bundle paths. The Paths are relative, slash-separated paths beneath the run-specific directory:
encoder always emits the first five JSON files below and adds lane or
pipeline-wide artifact files when their corresponding artifacts are available:
A subprocess caller first obtains the physical bundle root from the
[run-result receipt](run-result.md), then resolves `index.json` beneath that
root for the logical discovery described here.
| Path | Purpose | | Path | Purpose |
| --- | --- | | --- | --- |
| `index.json` | Entry point that names the other published files and lane payloads. | | `lanes/<safe-lane-id>.json` | One normalized domain artifact per available selected lane, including supported qualified fallback. |
| `manifest.json` | Run provenance and result summaries. | | `chunk-map.json` | Optional materialized chunk map, when enabled and available. |
| `rejected.json` | Rejected pipeline outputs. | | `evidence-context.json` | Optional selected source-unit excerpt, when enabled and available. |
| `warnings.json` | Actionable process-degradation warnings. |
| `diagnostics.json` | Accepted-artifact quality advisories and normalization observations. |
| `lanes/<safe-lane-id>.json` | One normalized artifact payload for each lane. |
| `chunk-map.json` | Optional accepted chunk map, when its export is enabled and available. |
| `evidence-context.json` | Optional selected source-unit excerpt, when evidence publication is enabled. |
JSON files are pretty-printed with a trailing newline. Lane payloads are There is no required index, manifest, persisted receipt, rejection file, warning
accepted only when their media type is `application/json`. file, or diagnostic sidecar. Expected lanes come from pipeline configuration;
optional auxiliaries use the paths above. Consumers need no metadata bundle or
debug data to decode artifacts.
## `index.json` The lane filename mapping is unchanged: trim the ID, replace characters outside
ASCII letters, digits, periods, underscores, and hyphens with underscores,
neutralize `..` sequences, and trim leading/trailing periods and underscores.
An empty resulting name or colliding paths fails encoding. Maintained D&D lane
IDs already map directly to their filenames.
`index.json` is the bundle’s discovery document. An approved run with no Files are pretty-printed JSON with a trailing newline. Lane payloads require
normalized lanes has this valid minimal index: `application/json`; the encoder validates the artifact boundary without
wrapping payloads in reporting metadata. Report presentation format does not
```json change artifact encoding.
{
"manifest_file": "manifest.json",
"output_files": [],
"rejected_file": "rejected.json",
"warnings_file": "warnings.json",
"diagnostics_file": "diagnostics.json"
}
```
| Field | Required | Meaning |
| --- | --- | --- |
| `manifest_file` | Yes | Always `manifest.json`. |
| `output_files` | Yes | Lane descriptors sorted by `lane_id`. |
| `rejected_file` | Yes | Always `rejected.json`. |
| `warnings_file` | Yes | Always `warnings.json`. |
| `diagnostics_file` | Yes | Always `diagnostics.json`. |
| `chunk_map` | No | Descriptor for the pipeline-wide `chunk-map.json`; never a lane descriptor. |
| `evidence_context` | No | Descriptor for the pipeline-wide `evidence-context.json`; never a lane descriptor. |
Each lane descriptor has required `lane_id` and `file`. It may also include
`media_type`, `module_key`, `schema_id`, `schema_name`, and `schema_version`
when supplied by the normalized artifact. Each pipeline-wide artifact
descriptor (`chunk_map` or `evidence_context`) contains `artifact_kind`,
`file`, `media_type`, `schema_id`, `schema_name`, and `schema_version`. Their
payloads are defined by the [Accepted Chunk Map contract](chunk-map.md) and
[Published Evidence Context](evidence-context.md), respectively.
The lane path is derived from its lane ID. Characters outside letters, digits,
periods, underscores, and hyphens become underscores; `..` sequences are
neutralized; leading and trailing periods and underscores are removed. A lane
that produces an empty name, or two lanes that produce the same path, makes
output encoding fail.
## Lane Payloads ## Lane Payloads
Each `lanes/<safe-lane-id>.json` file is the codec-owned normalized JSON for Each lane file is its codec-owned normalized JSON value. Select the contract
that lane. Consumers should use the index descriptor’s schema identity rather from the configured lane/module, not an absent discovery descriptor. Existing
than infer a lane schema from its name. The current D&D payload contracts are D&D payload contracts remain unchanged:
[spells](dnd-spell-artifacts.md), [NPC registry](dnd-npc-registry-artifacts.md),
[NPC occurrences](dnd-npc-occurrence-artifacts.md),
[combat turns](dnd-combat-turn-artifacts.md),
[item registry](dnd-item-registry-artifacts.md),
[item occurrences](dnd-item-occurrence-artifacts.md),
[scene descriptions](dnd-scene-description-artifacts.md),
[enemy events](dnd-enemy-event-artifacts.md),
[location registry](dnd-location-registry-artifacts.md), and
[location occurrences](dnd-location-occurrence-artifacts.md).
## `manifest.json` - [Spells](dnd-spell-artifacts.md).
- [NPC registry](dnd-npc-registry-artifacts.md) and
[NPC occurrences](dnd-npc-occurrence-artifacts.md).
- [Combat turns](dnd-combat-turn-artifacts.md).
- [Item registry](dnd-item-registry-artifacts.md) and
[item occurrences](dnd-item-occurrence-artifacts.md).
- [Scene descriptions](dnd-scene-description-artifacts.md).
- [Enemy events](dnd-enemy-event-artifacts.md).
- [Location registry](dnd-location-registry-artifacts.md) and
[location occurrences](dnd-location-occurrence-artifacts.md).
`manifest.json` is published provenance, not a copy of lane payloads or a Intrinsic fields, identities, source references, and schemas are preserved.
checkpoint store. Fields without a value may be omitted. Its top-level fields Supported fallback meets intrinsic/downstream invariants without asserting
group into the following externally observable summaries: ordinary semantic approval. Run qualification belongs in the native completion
report, not new payload fields or sidecars.
| Group | Fields | ## Auxiliary Artifacts
| --- | --- |
| Run identity and result | `run_id`, `pipeline_id`, `pipeline_digest`, `schema_version`, `validation_status`, `started_at`, `completed_at` |
| Resolved components | `input_module`, `chunker`, `extractors`, `merger`, `normalizer`, `output_encoder`, `artifact_lanes`, `validator_chains`, `module_metadata` |
| Source and references | `source_digests`, `references` |
| Published result summaries | `normalized_outputs`, `rejected_outputs`, `validation_summaries` |
| Execution summaries | `chunk_plan`, `checkpoint_decisions`, `llm_profiles`, `metadata` |
`references` records provenance such as the target, slot, origin, digest, [Chunk map](chunk-map.md) and [evidence context](evidence-context.md) are
media type, size, and generated-artifact identity. It does not contain pipeline-wide artifacts, not lanes. Their existing payload schemas and logical
reference content. `normalized_outputs` and `rejected_outputs` likewise paths remain; no index descriptor is required.
summarize results without embedding lane payload bytes. A chunk-plan summary is
provenance for the plan used by this run; cache records, debug artifacts, and
other operational state are not published as bundle files.
Each `validation_summaries` entry is a bounded outcome for one producer result. Enabled, available auxiliaries count as deliverables, including when built
It has required `status`, `producer_attempt_count`, and `terminal_action`; from reused results or supported fallback. Disabled/unavailable auxiliaries are
the stage and affected step, lane, module, or chunk identity are present when not published. Evidence can cover the complete source; authoritative citations
applicable. `status` is `complete`, `rejected`, or `incomplete`. remain in normalized lane payloads.
`rejecting_validators`, `reason_codes`, and `incomplete_validators` preserve
configured validator order and omit later duplicates. Entries contain no raw
candidate response, correction guidance, validator diagnostic message, or
artifact payload. The same shape may appear as `validation` on an affected
rejection entry.
When present, `metadata.session_id` is the effective non-secret routing ## Consumer Use And Compatibility
correlation identifier used for the run. It can be visible to providers and is
not a substitute for a cache or checkpoint identity. Its generation and
override behavior are defined by the [CLI reference](../cli.md#run).
Each `llm_profiles` entry identifies effective, non-secret LLM execution Check process status before decoding a successful native report. Use its absolute
provenance: run directory, then the configured lane and selected auxiliary paths. Decode
each file against its domain contract. The [subprocess guide](../consumers/subprocess.md)
and [complete D&D workflow](../consumers/dnd-pipeline.md) explain caller tasks.
| Field | Required | Meaning | Removing reporting/discovery files is intentional, not a domain schema or
| --- | --- | --- | filename-mapping change. [Migration guidance](../consumers/native-migration.md)
| `id` | Yes | Selected PromptKit profile identifier. | replaces receipt/index traversal. Debug and cache are not public output contracts.
| `provider` | No | Notarius adapter provider identifier. | Post-publication failure can leave valid files; failed publication can leave a
| `model` | No | Effective provider model identifier. | partial directory. Neither supplies a successful completion report.
| `backend_id` | No | Effective PromptKit backend registration identifier. Endpoint-only profiles omit it. |
| `reasoning_effort` | No | Effective opaque provider reasoning setting. An empty or explicitly cleared setting is omitted. |
These values describe observed execution; they are not a backend-registration
interface. Entries that differ by backend or effective reasoning remain
distinct even when their profile, provider, and model are otherwise equal.
## Rejections, Warnings, And Diagnostics
`rejected.json` is always an object with a `rejected` array. Each entry has
required `stage` and `message`; `step_id`, `lane_id`, `module_key`, `chunk_id`,
`chunk_index`, `validator_name`, `reason_code`, `attempt_count`, and
`diagnostic_artifact_path` are present only when applicable. An entry may also
contain the bounded `validation` summary described above; the existing singular
validator and reason fields remain the first configured rejection for
compatibility.
`warnings.json` is always the `notarius.warnings.v2` envelope:
```json
{
"schema_version": "notarius.warnings.v2",
"group_count": 0,
"occurrence_count": 0,
"groups": []
}
```
It contains only process warnings. `group_count` is exact, and
`occurrence_count` is the exact sum of its group occurrence counts.
`diagnostics.json` is always the `notarius.diagnostics.v1` envelope:
```json
{
"schema_version": "notarius.diagnostics.v1",
"group_count": 0,
"occurrence_count": 0,
"truncated": false,
"unrepresented_occurrence_count": 0,
"groups": []
}
```
It contains only advisory and observation groups. `group_count` counts groups
represented in `groups`; `occurrence_count` includes both represented and
unrepresented occurrences. When `truncated` is true,
`unrepresented_occurrence_count` is the exact number omitted from group
representation.
Each group has `disposition`, `category`, `reason_code`, framework-owned
`origin`, exact `occurrence_count`, bounded `samples`, and
`omitted_sample_count`. Samples carry safe `scope` and `message`, plus a chunk
ID and zero-based chunk index when applicable. A group retains at most three
distinct samples. The framework fails rather than truncating actionable
warnings beyond 128 groups; it represents at most 256 advisory/observation
groups and records further occurrences through the diagnostic truncation
fields above.
## Compatibility
The index is the authoritative map from a logical lane to its published
payload. Consumers must tolerate omitted optional manifest and descriptor
fields, and should rely on the linked artifact contract for each lane’s JSON
shape. This contract describes the published logical bundle only; it does not
promise a filesystem layout or expose internal state formats.

View File

@@ -0,0 +1,122 @@
# CommandKit Integration
Notarius declares its CLI through the selected native modules:
| Module | Selected release | Attribution |
| --- | --- | --- |
| `go.maximumdirect.net/commandkit` | [v0.8.0](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0) | [CommandKit](../oss/attribution.md#commandkit) |
| `go.maximumdirect.net/ckconfig` | [v0.11.0](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/integrations%2Fckconfig%2Fv0.11.0/integrations/ckconfig/README.md) | [ckconfig](../oss/attribution.md#commandkit-ckconfig) |
| `go.maximumdirect.net/ckprompt` | [v0.12.0](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/integrations%2Fckprompt%2Fv0.12.0/integrations/ckprompt/README.md) | [ckprompt](../oss/attribution.md#commandkit-ckprompt) |
[go.mod](../../go.mod) owns declared versions. The integrations are independently
versioned modules in the CommandKit repository; their selected tags/source
revisions are not the root module's tag. The [tagged consumer guide][consumer]
and [CLI contract][cli] own native declaration, parser, reporter, and outcome
mechanics. [Notarius CLI Reference](../cli.md) owns the installed product surface.
## Application Construction And Inputs
Notarius supplies identity, declarations, loaders, and domain handlers to
`commandkit.New`. Native help/version and installed shell completion need no
configuration, engine, provider, or run storage. Application pipeline commands
coexist with the full selected configuration/PromptKit suites; adoption is
implemented, not deferred behind a manual dispatcher.
The run convenience route is `commandkit.Alias`, not a forwarding handler.
Typed flags/arguments carry native `Supplied` values, preserving omission and
explicit empty/false/zero. Native parsing, repeated-value handling, mode ordering,
formats, and progress remain CommandKit-owned. The application chooses the
applicable inputs and their domain validation; it does not reconstruct parsing
or recursively execute another command.
## Configuration Scopes
Notarius installs a `ckconfig.Suite` with invocation state and two adapters:
`FromConfigKit` for the application and `FromConfigKitSubtree` for the native
PromptKit subtree. Both use the original successful application result, not
an engine-owned second configuration load. Overrides are enabled because the
loader actually passes native override records into its selected load.
The selected [adapter API](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/integrations%2Fckconfig%2Fv0.11.0/integrations/ckconfig/configkit_adapter.go)
owns acquisition/focused-view semantics. Focused display/discovery retains native
root-relative explicit paths, whole-load validation, and source/findings evidence.
The application owns complete-selection result/engine reuse; comparisons retain
distinct sides including overlay/override presence. Native reports/differences
replace copied effective-configuration DTOs.
[ConfigKit integration](pkg-configkit.md) owns the load boundary and
[Configuration Internals](../internal/configuration.md) locates its implementation.
## PromptKit Suite And Run Overrides
Notarius installs `FromEngine` with request validation, request preparation,
smoke testing, namespace selection, and scoped convenience aliases through
`Declarations`. Standard upstream request builders are used without copied
inspection/probe implementations. The engine loader uses the same original
result and invocation state as configuration inspection/runtime.
Inspection/requirements do not call a provider. Concrete validation/preview
perform native request preparation; explicit smoke tests can perform network or
model work and retain native supported/applicable/result distinctions.
Pipeline validation is separately application-owned offline preflight, not a
mode added to native configuration validation.
The explicit pipeline preflight command submits its readiness value through the
same [native reporting API](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/consumers/guide.md#invocation-reporting),
including when readiness fails; process and delivery outcomes remain distinct.
Application run inputs reuse `NewResourceFlags` and `NewExecutionFlags`, selecting
profile/session and execution controls while leaving prompt/source inputs
module-owned. Native execution overrides reach initial, continuation, and nested
validator requests without mutating loaded settings. The selected
[request-flag API](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/integrations%2Fckprompt%2Fv0.12.0/integrations/ckprompt/request_flags.go)
owns those reusable values; [PromptKit integration](pkg-promptkit.md) owns engine
execution. Exact installed syntax belongs in [CLI Reference](../cli.md).
## Reports, Diagnostics, And Outcomes
Handlers submit ordinary values through `Invocation.Reporter().Report`, with a
native text template where appropriate. JSON/YAML render the same report value;
there is no Notarius-wide envelope or separate success serializer.
The [completion contract](../cli.md#completion-report) is intentionally small;
domain artifacts, not a saved report, are the durable deliverables.
The nonempty ckprompt declarations also install optional invocation usage
reporting. Notarius propagates the invocation context and joins its work before
returning; it supplies no manual flag, accounting totals, or final usage callback.
Run debug capture has its own independent native group; preflight smoke usage
remains in native smoke reports instead. See
[native usage reporting][usage] and [CLI internals](../internal/cli.md#native-reporting-and-outcomes).
Native reporting handles result/diagnostic destinations, visibility, progress,
and delivery evidence. Application findings retain process-warning versus
advisory classification. Fallback qualification remains in the report even when
optional warnings are hidden. Requested capture is application work independent
of native verbosity; on success it finishes after publication and before reporting.
Application outcomes retain operation causes separately from native rendering,
output-write, and diagnostic-delivery failures. Post-publication failure retains
valid artifacts/available locations without rerun or repeated terminalization;
failed stdout can be partial. Standard commands keep their native classifications,
including diff differences; [CLI Reference](../cli.md#output-streams-and-exit-statuses)
owns exact statuses/caller behavior. See the upstream
[reporting guide](https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/consumers/guide.md#invocation-reporting).
## Verification And Ownership
[Application tests](../../internal/cli/application_test.go),
[pipeline/preflight tests](../../internal/cli/pipeline_commands_test.go),
[native override tests](../../internal/cli/execution_overrides_test.go),
[real executable checks](../../internal/cli/native_process_test.go), and
[result-boundary tests](../../internal/cli/run_result_command_test.go) exercise
the actual kits with fake providers and temporary files. [Assembled recovery](../../internal/cli/recovery_contract_test.go)
verifies the same shared load/engine through domain work and publication/capture.
[CLI Internals](../internal/cli.md) locates declarations and orchestration;
[Operations](../operations.md) owns state handling and
[subprocess guidance](../consumers/subprocess.md) owns consumer workflow.
On dependency upgrades, review the core and separately versioned integrations,
installed capabilities, supplied-value/selection behavior, native outcomes,
and notices together rather than assuming root-version parity.
[consumer]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/consumers/guide.md
[usage]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-usage-reporting
[cli]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md

View File

@@ -1,18 +1,71 @@
# ConfigKit Integration # ConfigKit Integration
Notarius uses the public root package Notarius uses `go.maximumdirect.net/configkit` at `v1.4.0` from
[`gitea.maximumdirect.net/eric/ConfigKit`](https://gitea.maximumdirect.net/eric/ConfigKit) [the selected release](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0).
at v0.4.2 for version 5 configuration acquisition, imports, overlays, explicit [go.mod](../../go.mod) owns the declared version; [attribution](../oss/attribution.md#configkit)
overrides, diagnostics, and safe inspection rendering. owns notices/source revision. The [tagged consumer guide](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/consumers/README.md)
and [configuration contract](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md)
own native loading, presence, inheritance, inspection, and error semantics.
Notarius owns the typed document, domain defaults and validation, runtime ## One Application-Owned Result
conversion, catalog-dependent pipeline resolution, source-aware configured
paths, and command discovery. It uses only ConfigKit's public path, result,
diagnostic, and resolution-source APIs. Upstream documentation owns general
ConfigKit semantics; [Configuration](../config.md) owns Notarius's file and
operator contract.
The v0.4.2 patch updates upstream release tooling and policy/licensing Notarius supplies a typed application document containing native
documentation without changing configuration behavior or the public API. See `promptkit.Settings`, and composes its definition with `promptkit.Configure`.
the canonical [ConfigKit attribution](../oss/attribution.md#configkit) for its Application version/default/path/normalization/validation rules and native
license and notices. resource identity/sensitivity rules participate in the same load.
Production composition selects the main source and calls `configkit.LoadLayered`.
It supplies bundled provider, embedded application, and main-relative operator
underlays before the selected main/import/overlay/explicit override layers.
Native filesystem/destination/source contexts remain attached; the application
does not flatten resources or reimplement source composition.
[Configuration](../config.md#configuration-discovery-and-precedence) owns
Notarius's selected sources/precedence; the upstream
[layered-input guide](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/consumers/README.md#native-filesystem-and-layered-input)
owns the library mechanism.
The successful `*configkit.Result[config.Document]` supplies runtime conversion,
inspection, and `promptkit.NewFromConfig`. That handoff performs no second load,
callback run, or YAML round-trip. Runtime pipeline configuration is independently
owned; the original result retains native resource evidence and contexts.
See [PromptKit integration](pkg-promptkit.md) and the upstream
[component handoff](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/consumers/README.md#component-handoff).
## Inspection And Invocation Selection
CommandKit's [ckconfig integration](pkg-commandkit.md#configuration-scopes)
adapts the original result for whole-application and focused PromptKit views.
Focused presentation does not load another document: whole-load validation and
source/findings context remain, while explicit metadata/explanation paths retain
native application-root coordinates.
The invocation-owned loader retains complete selections, including supplied
overlay/override values, and lazily builds one engine for each retained result.
Distinct comparison sides cannot accidentally reuse the same selection.
This is not process-global persistent configuration caching.
Inspection delegates to native result views, diagnostics, explanations, and diff.
ConfigKit sensitivity and PromptKit's composed sensitivity apply together.
Do not infer that arbitrary application text is safe, or replace marked-secret
omissions with heuristic content scrubbing. Exact syntax/selection behavior
belongs in [Configuration](../config.md) and [CLI Reference](../cli.md#configuration-commands).
## Application Ownership And Verification
Notarius owns application document meaning, source-aware operational paths,
runtime conversion, catalog-dependent pipeline resolution, and physical runtime
initialization. ConfigKit does not parse transcripts, construct pipeline modules,
materialize execution references, or allocate run storage.
[Configuration Internals](../internal/configuration.md) locates those implementations.
[Native settings tests](../../internal/core/config/native_settings_test.go),
[loader tests](../../internal/cli/native_load_test.go), and
[scope/diff tests](../../internal/cli/application_test.go) verify the real selected
libraries, retained origins/settings, frozen inspection, secret handling, and
selection isolation. [Assembled recovery](../../internal/cli/recovery_contract_test.go)
uses that same handoff through actual domain execution.
There is no parallel old-path ConfigKit integration or translation layer.
When upgrading, review the composed definition, original-result and source-context
handoff, focused views, and selected native command integration against the new
public contracts; do not infer compatibility from a successful module download.

View File

@@ -1,178 +1,138 @@
# PromptKit Integration # PromptKit Integration
Notarius pins Notarius uses `go.maximumdirect.net/promptkit` at `v0.25.0` from
[`gitea.maximumdirect.net/eric/promptkit` v0.11.2](https://gitea.maximumdirect.net/eric/promptkit/src/tag/v0.11.2) [the selected release](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0).
as its in-process prompt engine. The upstream [go.mod](../../go.mod) owns the version and [attribution](../oss/attribution.md#promptkit)
[Go package consumer guide](https://gitea.maximumdirect.net/eric/promptkit/src/tag/v0.11.2/docs/consumers/pkg-promptkit.md) owns notices/source revision. The [tagged Go consumer guide][consumer] and
owns the public engine API, and the upstream [format reference][formats] own native API, resource, and schema mechanics.
[format reference](https://gitea.maximumdirect.net/eric/promptkit/src/tag/v0.11.2/docs/formats.md)
owns prompt, profile, and schema file contracts.
## Supported Boundary ## Configuration And Resources
Notarius relies on the root `promptkit` package to: The application embeds native `promptkit.Settings`, composes rules with
`Configure`, and supplies its successful original ConfigKit result to
`NewFromConfig`. It selects the bundled OpenRouter underlay before loading;
engine construction does not add sources or reinterpret YAML.
[ConfigKit integration](pkg-configkit.md) owns that shared load boundary and
the upstream [application-owned-load guide][handoff] owns the library contract.
- construct an `Engine` with filesystem-backed prompt, schema, and optional Ordinary embedded prompt/profile declarations retain native filesystem contexts.
operator and application-fallback profile sources; Main-relative operator companions, main imports, overlays, and explicit overrides
- prepare one frozen execution from a `RunRequest` with named inline artifacts, participate in the same application result. Qualified resources, whole-record
variables, a direct session ID, prompt identity, profile selection, and replacement/inheritance, null/presence, schema roots, and operator selection
optional appended rendered messages, then belong in [Configuration](../config.md#promptkit-profiles), not a private
record credential-redacted details and run that exact execution; profile/catalog parser.
- return rendered debug material, validated structured output, selected
profile, backend, effective model metadata, and token usage;
- register the optional conventional `local` backend through `BackendLocal`,
`LocalBackend`, and `WithBackend`;
- distinguish structured-output validation failure from execution failure; and
- identify a missing explicit profile through `ErrProfileNotFound` and backend
admission exhaustion through `ErrCapacityExceeded`.
The pinned Prompt declarations select default output contracts and schemas. Native
[`BackendLocal`, `LocalBackend`, and `WithBackend` API](https://gitea.maximumdirect.net/eric/promptkit/src/tag/v0.11.2/backends.go) preparation resolves the selected schema and performs structural validation/
owns the registration and backend-capacity contract. repair; Notarius does not register response schemas or pin omitted native repair
counts. Intrinsic durable artifact schemas remain application codec contracts.
Native backend/profile configuration is available directly; no conventional
local-backend wrapper or separate operator profile file setting is required.
The bundled OpenRouter underlay and complete example retain upstream provider
selection. [Backend definitions][backends] own provider, cost, and authentication
semantics; Notarius infers none from endpoint location and supplies no zero-cost
default.
For one completion, the adapter calls `PrepareExecution`, takes a One captured engine serves every model role in an invocation. Runtime-only
caller-owned `Details` snapshot, and calls `RunPrepared` for that same opaque client/HTTP settings and an optional native `LLMClient` injection remain native
prepared execution. It defers `Discard` for every unexecuted handle. Explicit construction options. Request-specific execution/transient-retry selections remain
profile preflight uses `Engine.InspectProfile`; it does not prepare a synthetic requests, not mutation of captured settings. Notarius adds no blanket transport
prompt. PromptKit's prepared handle, inspection result, and capacity-error retry/repair or backend-admission defaults; declared profiles and native policy
types stay inside the Notarius LLM adapter. control effective values.
When a PromptKit profile and runtime override leave `temperature`, `max_tokens`, ## Execution, Interpretation, And Continuation
or `top_p` unset, Notarius leaves that control unset as well. Compatible
providers therefore apply their own defaults; an operator that requires a
specific sampling value must select it explicitly in the profile or runtime
override.
Notarius does not use PromptKit's optional `ArtifactReader`. It materializes Pipeline preflight uses native [resource inspection](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/resource_inspection.go)
source and reference content itself and supplies owned inline artifacts at the and [smoke diagnostics](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/smoke_diagnostics.go)
adapter boundary. It also retains responsibility for pipeline retries, for selected targets. Notarius owns readiness interpretation and retains native
scheduling, debug persistence, redaction, profile provenance, and conversion reports separately from ordinary execution observation.
from private model responses into durable domain artifacts.
Notarius sends one stable effective session through PromptKit's direct session Modules build `RunRequest` with selected prompt/profile/session, owned inline
field, which is authoritative for provider session behavior. It also retains artifacts and variables; they interpret `RunResult` into typed domain values.
the same value as the `session_id` prompt variable for maintained prompt Notarius materializes source/references and contextual identity projections
compatibility. The generated identifier is 76 ASCII characters, within before execution. It uses native session selection rather than a compatibility
PromptKit's 256-code-point session limit. Session IDs are non-secret prompt variable. [CLI Reference](../cli.md#run-wide-llm-overrides) owns run-wide
correlation identifiers and may be exposed to providers and provider controls and [Module Internals](../internal/modules.md) owns the extension recipe.
observability. The CLI contract owns generation and override behavior.
Notarius records PromptKit's selected backend ID and effective reasoning The shared producer path uses ordinary `Run`, or the retained prepared handle
setting as optional run-manifest provenance. Endpoint-only profiles have no described below. Native error and validation status are checked before
backend ID. Debug prompt material also retains the selected backend ID and interpretation, including structural failure with no Go error.
PromptKit's stable lower-case `effective_model_params` JSON, which may include The application assesses usable candidates through its complete configured chain.
`backend_id`. Notarius production configuration exposes one optional
conventional `local` registration. It does not expose a general user-defined
PromptKit backend registry. Endpoint-only profiles remain supported unchanged.
Notarius retains its application-wide scheduled client around the PromptKit For actionable semantic correction, native `Coordinate` starts from a captured
adapter. PromptKit may apply a narrower limit for the selected backend; exchange. Fixed inputs and prior responses remain in growing native history;
endpoint-only profiles have no such backend limit. The adapter translates the follow-up adds new findings/assignment, not manually replayed latest-only
PromptKit capacity rejection into the provider-neutral Notarius messages. Every delivered usable revision, including the final allowed response,
`ErrLLMCapacityExceeded` contract. It may include the normalized selected receives complete assessment. Native stopped/exhausted status is not domain
backend ID in safe diagnostic context, without exposing PromptKit's capacity acceptance. Result-less failures do not recover earlier proposals, and undelivered
error type. PromptKit's built-in client retries eligible transient HTTP failures responses are unassessed. See the [continuation/coordination guide][continuation].
with its v0.11.2 default of two additional attempts per generation; Notarius
keeps pipeline-stage retries outside that completion boundary.
The adapter projects built-in generation failures as the application-owned LLM validators call the same engine directly and return domain judgments or
`LLMGenerationError`, retaining a safe failure kind, HTTP status when present, unavailable assessment, without a producer turn loop. Native typed errors/causes
and retry-exhaustion attempt count. Transport, malformed successful envelopes, remain inspectable; Notarius adds context/disposition rather than a
provider statuses, and generic generation failures remain distinct without provider-neutral replacement error taxonomy. Caller cancellation and native
exposing PromptKit error values to Notarius callers. operation timeouts remain distinguishable.
## Profile Sources And Compatibility ## Prepared Reuse, Admission, And Execution Facts
Notarius gives PromptKit the configured operator profile source, registered For eligible cached producers, `PrepareExecution` supplies initial
application fallback profile assets, and optional backend registration through `Details().MessageContentHash`; a miss executes that same handle with
the same construction path for inspection and execution. PromptKit owns the `RunPrepared`, and unused handles are discarded. A hit reuses the accepted typed
resulting source precedence and strict profile parsing: a matching operator artifact or checked plan without native execution, exchange restoration,
profile is a complete replacement for a fallback or built-in profile, while an semantic reassessment, or historical usage. Correction retains the initial key.
invalid matching document fails instead of falling through. The operator Native preparation does not reserve model capacity; the [prepared-handle contract][prepared]
configuration and deployment workflow are defined in owns lifecycle. [Operations](../operations.md#accepted-result-cache-and-recovery)
[Configuration](../config.md#promptkit-profiles) and owns Notarius reuse policy and [State Internals](../internal/state.md) its implementation.
[Operations](../operations.md#promptkit-profile-deployment).
PromptKit owns `base_profile` resolution under its Native backend admission is independent of application ready-job workers.
[pinned format rules](https://gitea.maximumdirect.net/eric/promptkit/src/tag/v0.11.2/docs/formats.md). No global LLM scheduler, extra admission queue, or application retry extends native
Notarius records the selected leaf identity and resolved target without parsing budgets. Completed producer turns release admission before assessment, so nested
or merging inheritance. An unset filesystem `api_key_env` is optional and may validators can use the same limited backend. Strict/permissive terminal handling
reach the provider without authorization, which can result in a 401 or 403. and supported fallback remain application choices; [Configuration](../config.md#producer-controls)
owns those controls.
PromptKit accepts only the `developer`, `system`, `user`, and Consumer-owned contextual observers follow the execution context through initial,
`assistant` text-chat roles after normalizing case and surrounding whitespace. prepared, coordinated, and validator calls. ckprompt owns optional CLI reporting;
Maintained Notarius prompt definitions use only `system` and `user`. requested debug capture owns a separate native group. The runner owns neither.
Native results, events, and snapshots retain accounting evidence directly, without
a Notarius accounting DTO or added totals. The upstream
[observation guide][observations] owns native accounting; the
[ownership decision](../adr/0025-use-consumer-owned-execution-observation.md) records
the application boundary.
For application-owned semantic correction, Notarius uses PromptKit's Optional capture retains available prepared/results/raw response/full exchange
`RunRequest.AppendedMessages` after the ordinary rendered prompt. It supplies views plus application context, without another preparation or model call.
exactly two messages in order: the latest validated producer response with Native credential omissions and ConfigKit marked-secret views remain intact;
role `assistant`, then deterministic validation guidance with role `user`. ordinary content is not heuristically rewritten. Debug serialization is private,
It never exposes a general caller-selected role API, accumulates earlier not a consumer protocol. [Operations](../operations.md#debug-bundles) owns handling.
correction turns, or changes the ordinary prompt prefix. Ordinary requests
leave appended messages unset.
PromptKit preserves supplied content but does not own Notarius's correction ## Inspection, Preflight, And Verification
bounds. Notarius rejects invalid UTF-8, blank, or oversized assistant material
(at most 1 MiB), guidance (at most 64 KiB), and combined content (at most
1,114,112 bytes) before preparing the request. The transport-neutral
application contract owns defensive copying and these limits. Default request
and terminal summaries retain only safe counts, digests, identities, and usage;
complete appended messages remain limited to the explicitly requested detailed
debug trace.
PromptKit obtains its maintained OpenRouter and Rakestrawhome backend and [CommandKit/ckprompt](pkg-commandkit.md) supplies resource inspection,
profile catalogs from independently versioned transitive modules. Notarius requirements, concrete request validation/preparation, namespaces, and explicit
does not import or register either catalog; PromptKit retains catalog source, smoke testing through the same loaders. Offline pipeline preflight checks declared
identity, precedence, credential, and capacity ownership. prompts and applicable profiles without synthetic requests, execution input reads,
credential lookup, or provider work. Partial profiles can pass inspection while
concrete preparation remains a later readiness boundary. Smoke execution is explicit.
External catalog profile names and settings can change between dependency [Native schema tests](../../internal/cli/native_schema_load_test.go),
releases, including removal without aliases. Review directly selected IDs and [producer tests](../../internal/framework/pipeline/producer_test.go),
inherited `base_profile` values when upgrading. An application-owned alias that [nested assessment](../../internal/framework/pipeline/native_assessment_test.go),
inherits an external profile does not freeze that profile's settings. and [assembled recovery](../../internal/cli/recovery_contract_test.go) verify the
PromptKit's opt-in `promptkit-openrouter-standard` and selected integration using real libraries and fake providers. They cover custom
`promptkit-openrouter-auto` names provide name continuity within its contracts, native status/causes, final-turn assessment, same-backend liveness,
selected-and-tested dependency scope, not a fixed model or provider availability initial-key reuse, fallback qualification, and observations without production
guarantee. See the upstream model-quality claims.
[catalog compatibility policy](https://gitea.maximumdirect.net/eric/promptkit/src/tag/v0.11.2/docs/policy/release.md#catalog-profile-compatibility).
Use a complete operator-owned profile with explicit backend or endpoint, model, [LLM Integration Internals](../internal/llm.md) locates current call sites.
and settings when those choices must remain operator-controlled. The embedded An upgrade requires reviewing these native contracts, declaration/schema
`dnd-extraction` fallback already follows this model and does not inherit an contexts, command integrations, retained domain behavior, and notices together;
external catalog profile. An upgrade updates Notarius's compiled-in catalog there is no private completion adapter to preserve.
checkpoint identity so prior profile-source checkpoints are not reused.
Notarius supports this boundary against PromptKit v0.11.2. Its fallback source, [consumer]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md
prepared-execution, inspection, and typed capacity APIs are used as public [backends]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md#backend-definitions
upstream contracts; other PromptKit APIs or file-format behavior are not [formats]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/formats.md
implicitly supported. A dependency upgrade requires reviewing the adapter, [handoff]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md#reuse-an-application-owned-load
profile-source construction, and this compatibility statement against the [continuation]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md#coordinate-application-directed-turns
pinned upstream documentation. [prepared]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md#prepare-now-and-execute-the-same-snapshot-later
[observations]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md#observe-an-ordinary-run
## Notarius Ownership
[LLM Runtime Internals](../internal/llm.md) describes how Notarius mounts
module assets, maps its transport-neutral completion contract, prepares and
executes requests, validates output, records provenance, captures debug
material, redacts errors, and preserves timeout ownership.
PromptKit provider error details do not cross the ordinary completion boundary.
Notarius exposes a provider-neutral generation category and optional status;
redacted provider details are retained only in requested debug material.
[D&D Module Internals](../internal/dnd.md) owns the embedded
`dnd-extraction` fallback profile and the maintained D&D prompt defaults.
[Configuration](../config.md#promptkit-profiles) defines how a Notarius
configuration selects one PromptKit profile source and optionally registers
the conventional local backend.
PromptKit API or format changes outside this boundary are not implicitly
supported. Updating the pinned version requires reviewing the adapter and
profile/configuration contracts against the upstream documentation. Maintained
production prompts use PromptKit's bounded structural-repair contract; their
current declaration is one additional repair attempt. Notarius retains the
transport-neutral boundary and does not expose PromptKit types to modules.
The v0.11.2 patch updates upstream policy and licensing documentation without
changing runtime APIs, profile settings, or dependency/catalog versions.
See the canonical [PromptKit attribution](../oss/attribution.md#promptkit),
[OpenRouter catalog notice](../oss/attribution.md#promptkit-openrouter-catalog),
and [Rakestrawhome catalog notice](../oss/attribution.md#promptkit-rakestrawhome-catalog).

View File

@@ -1,93 +0,0 @@
# Run Result Receipt
`notarius run --json` writes this receipt to standard output when a run
completes successfully. It lets a subprocess caller discover the physical root
of the published output bundle without parsing interactive command output.
Command syntax, streams, and exit statuses are defined in the
[CLI reference](../cli.md); logical files within the bundle are defined in the
[Published JSON Output contract](json-output.md).
## Schema
The current schema version is `notarius.run-result.v2`.
| Field | Required | Meaning |
| --- | --- | --- |
| `schema_version` | Yes | Exactly `notarius.run-result.v2`. |
| `run_id` | Yes | The finalized Notarius run identifier. |
| `pipeline_id` | Yes | The effective pipeline identifier. |
| `output_directory` | Yes | Absolute path to the published, run-specific output bundle. |
| `index_file` | For the production JSON output | Logical path `index.json`; omitted for other output modules. |
| `normalized_output_count` | Yes | Number of final normalized outputs. |
| `rejected_output_count` | Yes | Number of recorded rejected outputs. |
| `warning_group_count` | Yes | Exact number of actionable warning groups. |
| `warning_occurrence_count` | Yes | Exact occurrences represented by actionable warning groups. |
| `diagnostic_group_count` | Yes | Number of represented advisory and observation groups. |
| `diagnostic_occurrence_count` | Yes | Advisory and observation occurrences, including unrepresented occurrences. |
| `diagnostics_truncated` | Yes | Whether advisory/observation group representation was truncated. |
| `validation_status` | Yes | The final run manifest validation status. |
| `validation_summaries` | No | Bounded per-producer validation outcomes; present when producer work ran. |
| `debug_directory` | No | Absolute path to the run-specific debug bundle when requested debug capture completed. |
For the production `json` output module, `index_file` is present only when the
completed run returned exactly one logical output file named `index.json`.
For another output module, its absence does not indicate a failed run.
`validation_status` is `approved`, `rejected`, or `incomplete`; `incomplete`
means one or more otherwise accepted results advanced under validator-failure
`warn_continue`.
```json
{
"schema_version": "notarius.run-result.v2",
"run_id": "run-1770000000000000000-0123456789abcdef0123456789abcdef",
"pipeline_id": "dnd-session",
"output_directory": "/work/results/run-1770000000000000000-0123456789abcdef0123456789abcdef",
"index_file": "index.json",
"normalized_output_count": 6,
"rejected_output_count": 2,
"warning_group_count": 1,
"warning_occurrence_count": 2,
"diagnostic_group_count": 3,
"diagnostic_occurrence_count": 5,
"diagnostics_truncated": false,
"validation_status": "incomplete",
"validation_summaries": [
{
"stage": "extract",
"lane_id": "spells",
"status": "incomplete",
"incomplete_validators": ["dnd/spells/source_refs"],
"producer_attempt_count": 1,
"terminal_action": "warn_continue"
}
]
}
```
## Paths And Bundle Discovery
`output_directory` and `debug_directory`, when present, are lexical absolute
paths. They identify the paths used by Notarius and do not resolve symlinks.
`output_directory` is the run-specific bundle, not the configured output root.
The receipt is a summary and discovery document. Its optional validation
summaries contain only stable status, identity, validator names, reason codes,
attempt counts, and terminal actions. It does not contain lane descriptors,
payloads, manifest payloads, rejection messages, warnings, raw model responses,
correction guidance, or file contents.
For the production JSON output, resolve `index_file` beneath
`output_directory`, reject path escapes, and use the
[Published JSON Output contract](json-output.md) to discover logical files and
lane payloads.
## Delivery And Compatibility
Notarius writes the receipt only after the output bundle has been published and
any requested debug terminal reporting has completed. Standard output is not
transactional: a result-write failure returns a nonzero status and can leave
partial bytes. Consumers must ignore standard output unless the process exits
with status 0.
Future versions may add optional fields to this schema. Consumers must tolerate
unknown fields. An incompatible field or semantic change requires a new
`schema_version` value.

View File

@@ -34,7 +34,7 @@ array. This minimal document is valid:
``` ```
The maintained two-segment input is The maintained two-segment input is
[seriatim-minimal-transcript.json](../../examples/seriatim-minimal-transcript.json). [minimal transcript](../../examples/dnd-minimal/transcript.json).
| Field | Required | Meaning and constraints | | Field | Required | Meaning and constraints |
| --- | --- | --- | | --- | --- | --- |

View File

@@ -0,0 +1,68 @@
# Shared Domain Reference Inputs
Notarius accepts shared party and glossary documents as optional D&D reference
inputs. The complete example provides a [party](../../examples/dnd-complete/party.yml)
and one [multi-collection glossary](../../examples/dnd-complete/glossary.yml).
The reference binding interface and defaults belong to
[Configuration](../config.md#references-and-ordered-handoffs).
## Supported Contracts
Notarius bundles the following contracts from shared schemas distribution
`2026.11.1`, commit `f7e3cedeca11ed903311cdf29ca4d81fb1f216b7`, for offline
validation. The document marker is not a schema-version selector.
| Role | Version and marker | Upstream semantics |
| --- | --- | --- |
| `party` and accepted `roster` aliases | RPG party `0.2.0`, `maximumdirect.rpg.party.v1` | [Party semantics](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/rpg/party/v0.2.0/semantics.md) |
| `glossary` and `spell_catalog` | Glossary `0.2.0`, `maximumdirect.glossary.v1` | [Glossary semantics](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/glossary/v0.2.0/semantics.md) |
Inputs are YAML or JSON, with media types `application/yaml`,
`application/x-yaml`, or `application/json`. JSON must use JSON syntax.
Both serializations pass through ConfigKit's native mapping load and are
validated as complete documents, including unselected collections. See the
pinned [ConfigKit native contract](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md)
for loading, dynamic numeric binding, limits, and reserved controls such as
`extends` and source-root `config`. Notarius adds exact per-collection entry-ID
uniqueness and task-specific suitability checks; ordinary extensions remain
data, not instructions.
## Task Views
Each binding selects collections independently. General glossary context defaults
to the available `campaign` and `setting` collections; a bound
`spell_catalog` defaults to `spells`, which must exist. Explicit selections
must exist, may be empty, and compare names exactly. Empty valid selections or
collections contribute no added vocabulary. No binding is required merely
because another is present. The same file can serve both roles.
Party context includes names, aliases, optional player relationships and
classes/levels, without exposing roster IDs to the model. Distinct roster
entries remain distinct even when names match. `party` takes presentation
precedence over `roster`; both supplied documents are validated.
`players` remains optional supplemental text. No duplicate player list is
needed for relationships already in the roster.
General glossary context projects names, aliases, categories, descriptions,
and plural forms. Spell recognition projects names and aliases only and starts
with the embedded D&D 5e 2014 SRD vocabulary. Existing canonical display
names take precedence; selected entries may augment their aliases. Conflicting
recognition keys for different spells are task errors. Collection names and
entry IDs determine deterministic traversal; IDs, provenance, and irrelevant
extensions are not promoted to model instructions or transcript evidence.
## Migration
Replace plain-text `party` or `roster` files with the shared party envelope
and move character/player relationships into roster entries. Replace text
`glossary` files and the private `notarius.dnd.spell-catalog-overlay.v1`
envelope with shared glossary entries under named collections. Map old spell
names and aliases directly to entries; old ruleset metadata is not required,
and source information may be optional collection provenance. Aliases may be
omitted, null, or empty. Add `collections` on an external binding only when
the slot defaults are not appropriate. Existing slot names and CLI selectors
remain unchanged. There is no legacy reader or automatic conversion.
Run and explicit preflight validate supplied documents during preparation,
before domain inference; offline pipeline validation does not read reference
files. See [CLI preflight](../cli.md#preflight) for its readiness scope.

View File

@@ -1,188 +1,190 @@
# CLI Internals # CLI Internals
This document describes **internal/cli**, Notarius's production composition `internal/cli` is the production composition root. [CLI Reference](../cli.md)
root. The [CLI reference](../cli.md) owns command syntax and exit statuses; owns syntax, reports, and outcome codes; [Configuration](../config.md) owns
[Configuration](../config.md) owns configuration values; and settings; [Operations](../operations.md) owns physical state and recovery.
[Operations](../operations.md) owns filesystem layout, recovery, and operator This guide explains declaration, loading, and orchestration owners, not another
procedures. public command manual.
## Inputs, Outputs, And Boundaries ## Native Application Construction
The CLI accepts process arguments, standard streams, and injectable options [NewApplication](../../internal/cli/application.go) returns a native
used by tests and embedding code. It writes command results to the supplied `*commandkit.App` from application identity and injectable options. Construction
streams and returns a process exit status. For a run, it also creates the declares commands without configuration discovery, engine creation, provider
production catalog and runtime collaborators, hands a prepared pipeline and calls, or run-storage allocation. The executable and `RunWithOptions` supply
source bytes to the framework, and places the logical files returned by the identity from ReleaseKit's native buildinfo accessor; `RunWithOptions` is a
runner. convenience execution entry point, not a manual dispatcher.
The executable supplies a signal-cancelled context and restores ordinary signal
handling after the first interrupt or termination request; embedded applications
continue to use their caller-supplied contexts.
It is the only boundary allowed to compose concrete registries, LLM clients, The constructor wires:
cache/checkpoint collaborators, debug recorders, and physical output paths.
Pipeline modules receive interfaces and request data rather than CLI streams or
filesystem roots. The [Architecture](../policy/architecture.md) defines this
composition-root boundary; [Pipeline Internals](pipeline.md) owns resolution,
preparation, and runner mechanics after their inputs are supplied.
## Dispatch And Configuration Handoff - native help/version and installed shell completion;
- application pipeline declarations and native run and preflight aliases;
- ckconfig whole-application and focused PromptKit scopes, sharing one loader;
- ckprompt resource/requirements inspection, concrete request validation,
prepared preview, namespace selection, and explicit smoke testing.
The root dispatcher handles help, version reporting, configuration validation, ckconfig adapters use the original application result and focused native subtree
effective-configuration inspection, explanation inspection, pipeline listing, view. ckprompt uses an engine loader through its standard builders rather than
and a pipeline run. Version reporting resolves build application-owned copies of inspection DTOs. Ordinary resource inspection does
information through `internal/buildinfo` before production composition, so the not become request preparation or an implicit probe. The
diagnostic remains available without configuration or runtime collaborators. [native CLI reference][native-cli] owns parser/report mechanics.
The public syntax, streams, exit classes, and version semantics are defined by
the [CLI reference](../cli.md). Other root commands normalize injectable
options before dispatch so that a missing production dependency fails as a
command error rather than reaching execution.
Commands that need configuration use one shared ConfigKit-backed loader. The ## Invocation-Local Loading
CLI discovers the file, passes the requested overlay and only explicit
configuration-valued run overrides, and receives a **LoadedConfig**. The
configured discovery and precedence contract is in
[Configuration](../config.md), while the loading and resolution mechanics are
in [Configuration Internals](configuration.md).
`config effective` and `config explain` only render the loaded ConfigKit view; [nativeLoaders](../../internal/cli/configkit_load.go) belongs to one invocation.
they do not resolve pipelines or construct providers. Configuration validation without a selected pipeline checks structural It selects the main source and assembles one layered ConfigKit application
configuration only. Validation with a selected pipeline also builds the result. Engine construction calls `promptkit.NewFromConfig` on that result,
effective catalog, resolves the pipeline, and verifies every explicit effective with runtime-only client options; it does not load YAML again.
PromptKit profile. Selected LLM-backed input, chunk, lane, output, and validator
profiles are inspected
against the configured PromptKit source and backend registrations without
loading a prompt or performing generation, so an unknown or invalid profile
fails before pipeline preparation. Credential availability remains an
execution-time concern. Pipeline listing validates configuration before
returning normalized, sorted identifiers.
## Production Composition The retained selection includes supplied-value state, overlay, and override
values. Repeated identical selections share a result/engine, while distinct
comparison selections cannot be memoized into one side. There is no
process-global loader cache. The selected main's native context anchors companion
imports; source edits do not mutate an existing captured engine.
The production composition helper allocates every framework registry and the [Configuration Internals](configuration.md) owns definition, normalization,
prompt-asset registry, then registers the generic, Seriatim, and D&D module origins, and conversion. Shared loaders allocate no output/cache/debug data.
families in that order. The resulting registries provide both the module
catalog used for resolution and the concrete constructors used for preparation.
Tests may provide a catalog or registries instead; production code must not
silently merge an injected partial catalog with production registrations.
The production LLM factory builds one PromptKit-backed client from the resolved ## Catalog And Preflight Boundaries
**promptkit.profile_dir** or **promptkit.profile_file** source, attaches the
profile-provenance recorder, creates one scheduler from the effective global
LLM limit, and wraps the client before it reaches modules. Registration and LLM
construction errors are returned before a pipeline is prepared. Configuration
field definitions remain in [Configuration](../config.md#promptkit-profiles);
the D&D registrar's fallback profile assets and the adapter mechanics remain in
[LLM Runtime](llm.md).
The factory also accepts `LLMRuntimeOverrides`, whose reasoning pointer [catalog.go](../../internal/cli/catalog.go) composes generic, Seriatim, and D&D
preserves inherit, replace, and clear states across the composition boundary. registrars into typed registries, codecs, evidence projectors, and validator
Run orchestration constructs this value from the mutually exclusive defaults. Registration does not build an asset/schema registry or an LLM service.
`--reasoning-effort` and `--clear-reasoning-effort` controls. Absence preserves Injected registries/catalogs are alternative sources, not implicitly augmented
a nil pointer, replacement is trimmed, and clear uses a non-nil empty string. with production entries.
The same override reaches the one shared production client, checkpoint
identity, and debug invocation metadata. Persistent reasoning configuration [pipeline_commands.go](../../internal/cli/pipeline_commands.go) separates:
remains owned by PromptKit profiles; Notarius configuration has no reasoning
field. - listing: enumerate captured configured IDs without a catalog/engine;
- showing: domain resolution and composition description, without profile expansion;
- validating: domain resolution plus known-resource preflight, supplying the
same captured engine only when model roles require it.
[Offline dependency validation](../../internal/preflight/preflight.go) accepts
collaborators and data without reading execution inputs or allocating state.
Partial profiles pass inspection. The same package also discovers selected
initial targets and orchestrates explicit native smoke checks; the CLI owns
their input, destination, capture, and presentation boundaries.
## Run Inputs And Native Overrides
[run_input.go](../../internal/cli/run_input.go) binds typed application inputs
and repeated literal selections. [execution_overrides.go](../../internal/cli/execution_overrides.go)
uses reusable ckprompt resource/execution inputs, preserving omission versus
explicit empty/false/zero. Only profile/session and execution controls needed
by pipeline runs are selected; prompt inputs stay module-owned.
The resolved run-wide profile selection reaches every LLM-backed role. Native
execution overrides travel through operation requests to producers, validators,
and continuation, without mutating loaded settings. The
[public reference](../cli.md#run-wide-llm-overrides) owns exact spellings/semantics.
Reference selectors are expanded at the CLI boundary using registered target
specifications. Pipeline/lane actions become exact binding changes after
specificity/conflict handling. Generic resolution receives exact reference
bindings/unbinds, not CLI selector grammar. External/generated conflicts and
required-slot/type checks remain with domain resolution; materialization follows.
[session.go](../../internal/cli/session.go) resolves the effective session from
explicit supplied input or the input-module/raw-byte policy before runner work.
Framework/model code transports it rather than deriving another session.
## Run Orchestration ## Run Orchestration
After parsing and validating a run invocation, the CLI performs this ordered [pipeline_invocation.go](../../internal/cli/pipeline_invocation.go) shares
handoff: loading, selection, reference materialization, construction, input reading,
and session selection between run and
[preflight](../../internal/cli/pipeline_preflight.go). The latter parses through
the prepared pipeline, probes destinations, discovers targets, and hands native
observations to its readiness report without invoking the runner or cache store.
It finalizes requested capture before report delivery; assessment and capture or
delivery outcomes remain independently meaningful.
1. load and validate configuration with ConfigKit command overrides; The native command declaration in [pipeline_run.go](../../internal/cli/pipeline_run.go)
2. create and validate a safe run identity, then allocate a debug bundle only creates a private owner for each invocation. That owner performs the ordered
when requested; handoff and keeps capture and publication state local to that run:
3. build the effective catalog, resolve requested reference changes, resolve
the effective pipeline, and inspect its explicit effective PromptKit
profiles;
4. materialize external or generated references and record redacted invocation
and resolution provenance when debug capture is enabled;
5. construct registries, the scheduled LLM client, and prepared modules;
6. read the source input once, resolve its effective session from the explicit
override or resolved input module and raw bytes, then construct requested
checkpoint collaborators and invoke the framework runner with that same
value; and
7. write the runner's logical output files only after a successful run, then
complete the command report and user-facing result.
Preparation happens before source parsing, so module construction and 1. Load/validate the selected application result and derive runtime configuration.
dependency failures cannot begin stage execution. The CLI also preserves the 2. Generate a safe run identity and allocate requested capture. If enabled,
framework's result and warning information when it writes summaries and the attach its local native execution group to the inherited invocation context.
final command result. Detailed state lifecycle, resume handling, and physical 3. Capture selected configuration, compose registries, expand reference actions,
path confinement are maintained in [Run State Internals](state.md) and and resolve the effective pipeline.
[Operations](../operations.md).
The CLI owns the versioned generated-session policy and resolves the sole 4. Obtain the shared engine when needed and perform offline preflight.
effective value before checkpoint construction. It records that value in the 5. Materialize references, construct prepared typed modules, read input bytes,
final debug invocation summary when capture is enabled and passes it unchanged and resolve the effective session.
to checkpoint identity and `pipeline.RunInput`. The public flag and stability 6. Construct the accepted-result cache and optional recorder collaborator,
contract are defined by the [CLI reference](../cli.md#run); framework and LLM and invoke the runner with the context and independent worker/execution
packages only transport the supplied value. selections. Disabled capture adds no debug group.
7. Report process diagnostics, publish returned logical files only after runner
success, write the debug group's snapshot immediately before capture
finalization, then submit the native completion report.
The CLI also owns the scope grammar for reference flags. It enumerates the CLI reference grammar and precedence remain local; selector expansion uses the
selected chunk and lane targets from registered module specifications, expands pipeline's [target inventory](../../internal/framework/pipeline/selection.go)
pipeline- and lane-scoped actions into exact stage-and-lane bindings, and before complete resolution checks whether required slots are bound.
resolves overlapping bind and unbind actions by specificity before calling
configuration resolution. The generic pipeline therefore receives only exact
`ReferenceBinding` and `ReferenceUnbind` values and has no knowledge of CLI
selector syntax. Configuration resolution retains ownership of configured
external/generated conflicts, required slots, and module compatibility; file
materialization still occurs afterward.
For `run --json`, the CLI constructs and encodes its private run-result receipt Modules receive the shared engine, operation data, and explicit collaborators,
after a successful runner result is available, before it publishes logical not physical roots or CommandKit reporters. Detailed worker, assessment,
output files. It writes the prepared receipt to standard output only after eligibility, and cache algorithms belong in [Pipeline Internals](pipeline.md);
output publication and requested debug terminalization succeed. A receipt-write physical publication/capture collaborators belong in [Run State Internals](state.md).
failure exits with runtime status 1 and may leave partial standard-output bytes,
but the already-published output bundle remains complete and requested debug
reporting remains successfully terminalized. The CLI reports a bounded
command-owned error and does not repeat terminal reporting. The receipt remains
a CLI reporting concern rather than a framework or output-module responsibility;
its public contract is the
[run-result receipt](../integrations/run-result.md).
## Failure Mapping And Terminal Reporting Requested capture allocates before engine/preflight and finalizes once.
The runner has joined its work before returning; it owns neither this group nor
the summary write. Snapshot write errors use the recorder's sticky error handling.
Primary operation causes and additional capture failures remain available.
Later report delivery failure does not rerun model work, remove valid artifacts,
or terminalize capture again.
Argument, flag, and invocation-combination failures are reported to standard ## Native Reporting And Outcomes
error before runtime composition and use the syntax error class. Once an
invocation is syntactically valid, configuration loading and validation,
resolution, registration, profile checks, reference materialization, module
construction, input reads, runner failures, output publication, and requested
debug handling use the runtime failure class. The public status numbers and
stream contract are defined in the [CLI reference](../cli.md#output-streams-and-exit-statuses).
When debug capture has been allocated, one command-state value records the [run_result.go](../../internal/cli/run_result.go) submits one small application
known run result. Guarded terminalization writes a success report once, or value with a native text template. Native serializers render that same value.
attempts a failure report and error record once. A persistence failure is Domain files, not a persisted report or ledger, are the deliverables.
reported in addition to the original failure and never replaces it. If a debug Fallback qualification is independent of optional diagnostic visibility.
path exists, failure output includes that path so the retained diagnostic data
is discoverable.
## Invariants To Preserve The installed ckprompt feature owns optional invocation usage presentation.
The handler preserves its contextual observer, including when debug attaches
an independent group; it does not add overlapping totals or supply a final usage
callback. See [native usage reporting][usage] and
[consumer-owned observation](../adr/0025-use-consumer-owned-execution-observation.md).
- Only the CLI composes production implementations and physical runtime roots. Warnings/advisories keep their domain classification and use the reporter's
- Configuration and resolved composition failures occur before module diagnostic channel. Outcome helpers retain native configuration/preflight causes
preparation or source parsing. and distinguish identifiable invalid input from operational/mixed failures.
- A runner's logical files are published only after a successful run. CommandKit retains rendering/output/diagnostic delivery evidence separately from
- Production registries and a caller-supplied catalog or registries are the operation cause; quiet mode does not mask such failures.
alternative composition sources, not an implicit mixture.
- A requested debug bundle has one terminal report attempt; its persistence
errors supplement rather than obscure the primary command error.
- User-facing flags, paths, exit codes, and configuration fields are defined
by their public documentation, not duplicated here.
## Focused Tests The [completion report](../cli.md#completion-report) owns fields and
[stream/outcome contract](../cli.md#output-streams-and-exit-statuses) owns process
behavior. There is no universal Notarius envelope or parallel serializer.
- **internal/cli/command_contract_test.go** covers dispatch, help, syntax and ## Focused Verification
runtime error classes, discovery, validation, and listing.
- **internal/cli/run_contract_test.go** covers the run handoff, publication,
debug reporting, and command-owned state collaborators.
- **internal/cli/production_contract_test.go** covers registrar composition,
production catalog contents, assets, and representative configuration
validation.
- **internal/cli/reference_contract_test.go** covers scoped CLI reference
expansion, specificity, bind/unbind conflicts, generated-reference
protection, origin separation, and materialization boundaries.
- **internal/cli/state_hardening_test.go** covers safe run identity, state
roots, and failure ordering.
Run **go test ./internal/cli** after changing command composition or command - [Application tests](../../internal/cli/application_test.go) cover lazy built-ins,
behavior. Pair it with **go test ./internal/core/config** when the configuration shared scopes, selection evidence, and native diff outcomes.
handoff changes. - [Loader tests](../../internal/cli/native_load_test.go) and
[schema tests](../../internal/cli/native_schema_load_test.go) cover native
composition, captured contexts, and operator contracts.
- [Pipeline command tests](../../internal/cli/pipeline_commands_test.go) cover
offline listing, showing, and validation; [preflight tests](../../internal/cli/pipeline_preflight_test.go)
cover readiness reporting and the explicit online route.
- [Override tests](../../internal/cli/execution_overrides_test.go) and
[run tests](../../internal/cli/pipeline_run_test.go) cover supplied values,
routing, references, sessions, and run ordering.
- [Reference tests](../../internal/cli/reference_contract_test.go) cover selector
specificity, generated conflicts, and materialization boundaries.
- [Native executable tests](../../internal/cli/native_process_test.go) cover the
real command routes and fake-provider presentations.
- [Completion tests](../../internal/cli/run_result_command_test.go) and
[recovery contracts](../../internal/cli/recovery_contract_test.go) cover retained
publication, capture/delivery failures, reuse, fallback, and native facts.
Use focused CLI tests and pair with configuration/preflight tests when those
boundaries change. [Development](../development.md#validation) owns wider checks.
[native-cli]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md
[usage]: https://forge.maximumdirect.net/base-layer/commandkit/src/tag/v0.8.0/docs/cli.md#promptkit-usage-reporting

View File

@@ -1,144 +1,156 @@
# Configuration Internals # Configuration Internals
This document describes the maintainer-facing configuration boundary in This guide explains the maintained configuration boundary and its composition-root
**internal/core/config**. The [Configuration](../config.md) reference owns the handoff. [Configuration](../config.md) owns source selection, syntax, fields,
file format, fields, defaults, precedence contract, and selectable keys. The defaults, and selectable modules; [CLI Reference](../cli.md) owns invocation.
[CLI reference](../cli.md) owns command syntax; this document does not redefine [Architecture](../policy/architecture.md#configuration-and-provenance) defines
either interface. ownership. Do not infer operator contracts from private helper choices here.
## Boundary ## Owners And Handoffs
The configuration package turns a selected ConfigKit-composed YAML document | Owner | Responsibility |
into a validated, independently owned configuration. It then resolves a | --- | --- |
requested pipeline against a module catalog before the framework prepares or | [core/config definition](../../internal/core/config/load.go) | Typed application document, native PromptKit configuration rules, application resolution/validation. |
runs anything. | [CLI loaders](../../internal/cli/configkit_load.go) | Main-source selection, native underlays, invocation-local result/engine reuse. |
| [LoadedConfig](../../internal/core/config/loaded_config.go) | Retain the original result and derive independently owned runtime pipeline configuration. |
| [Config.Resolve](../../internal/core/config/effective_config.go) | Resolve a selected pipeline against the supplied catalog. |
| [preflight](../../internal/preflight/preflight.go) | Check known native resources from resolved composition and supplied engine. |
| Pipeline preparation | Construct typed execution collaborators from resolved, materialized inputs; see [Pipeline Internals](pipeline.md). |
| Boundary | Inputs | Outputs | Does not own | The production flow keeps one application-owned
| --- | --- | --- | --- | `*configkit.Result[config.Document]`. That result feeds runtime conversion,
| Loading | Selected file path, profile, overrides, and invocation directory | **LoadedConfig** with ConfigKit inspection metadata and a populated **Config** | Choosing the file path or reporting a command result. | whole-app/focused inspection, and `promptkit.NewFromConfig`. Rendered YAML is
| Validation | **Config** | Structural configuration errors with pipeline, lane, or binding context | Module availability, capabilities, or construction. | an operator view, not an interchange format for constructing the engine.
| Resolution | Valid **Config**, selected pipeline and lanes, runtime reference changes, LLM override, and module catalog | **EffectiveConfig** with a **ResolvedPipeline** | Materializing reference bytes, preparing modules, execution, or filesystem state. |
| Inspection | **LoadedConfig** and an optional JSON Pointer | Redacted effective YAML or explanation text | Pipeline selection, module preparation, or provider work. |
The CLI discovers a configuration file, invokes this package, and supplies the ## Definition And Application Meaning
result to the framework. Configuration never reads an input file, constructs a
module, or creates output, cache, or debug paths. Those responsibilities remain
at their respective [CLI](cli.md), [pipeline](pipeline.md), and
[run-state](state.md) boundaries.
## Loading And Validation `Document` contains native `promptkit.Settings` at its PromptKit field.
`Definition` composes application defaults, version policy, sensitivity,
identified step lists, resolution, and validation with `promptkit.Configure`.
Native resource rules therefore participate in the same load rather than being
validated by a separate application parser.
ConfigKit acquires the selected root, imports, optional selected overlay, and Application callbacks normalize pipeline identifiers and operational paths while
explicit CLI overrides in precedence order. Its document definition supplies retaining presence/source history. The per-load state tracks original coordinates
typed defaults, source-aware path normalization, and structural validation as map keys move. Paths are resolved before normalization loses their source
before conversion to the independently owned runtime **Config**. Only coordinates. Inherited values retain their contributing origins; CLI path
`NOTARIUS_CONFIG` participates in discovery; retired field-level environment assignments use invocation origin. See
variables do not participate in loading. Version 5 decoding rejects scalar [document paths](../../internal/core/config/document_paths.go) and
module bindings and scalar external references. ConfigKit retains redacted, [pipeline document normalization](../../internal/core/config/pipeline_document.go).
historical inspection metadata while **LoadedConfig** keeps that implementation
detail private behind effective and explanation writers.
**Config.Validate** checks configuration-only invariants before resolution. It ConfigKit owns parsing, imports, overlays, inheritance, typed composition, and
rejects incompatible profile sources, invalid state-surface values, unsupported provenance. The application supplies meaning through supported rules. It does
concurrency settings, malformed bindings and references, invalid retries, and not implement another inheritance resolver or translate retired inputs.
invalid pipeline, step, or lane structure. PromptKit local-backend validation [The public reference](../config.md#imports-and-sibling-inheritance) owns exact
accepts only an absolute HTTP or HTTPS endpoint with a host and no user presence/null/list rules and processing order.
information, query, or fragment, and rejects a negative local concurrency
limit. It also rejects a negative `promptkit.transient_retries` value; decoded
omission resolves to two, while explicit zero remains a distinct opt-out. Its
errors retain the closest known pipeline, lane, and binding context.
It deliberately does not require modules to be registered: that requires a
catalog and belongs to resolution.
The exact user-selectable values and validation rules are defined in `Config.Validate` checks application-only state and pipeline structure without
[Configuration](../config.md). Keep document schema, source-aware normalization, requiring registered modules. Catalog-dependent compatibility belongs to
runtime conversion, and that reference aligned in the same change. resolution. Configuration does not parse a source transcript, materialize
references, construct modules, or allocate run storage.
## Effective Resolution ## Production Source Assembly
**Config.Resolve** derives an absent extraction-worker value in an owned copy `nativeLoaders.application` selects the main source and uses
and validates the configuration. A programmatically supplied worker value is `configkit.LoadLayered` with the application definition, native underlays,
always explicit. It normalizes the requested pipeline ID, copies the selected selected overlay, and explicit overrides. Underlays come from bundled provider
profile, and passes the non-empty command-level LLM profile override, requested resources, ordinary embedded application content, and main-relative operator
lane selection, and reference changes to the framework resolver. companions. Native source/filesystem contexts survive the load.
After module and validator selection, the resolver applies the effective The embedded assets package supplies content, not registration behavior.
profile policy to LLM-backed bindings only: command override, binding profile, The operator companion uses a native main-relative context; it follows the
pipeline profile, then the prompt default. Deterministic bindings remain selected main rather than rediscovering the working directory. Strict peers,
profile-free, and no second inheritance decision occurs during execution. The optional absence, imports/destinations, and whole-record resource replacement
public field definitions and precedence are owned by remain native composition. Source grammar and precedence belong in
[Configuration](../config.md#pipelines). [Configuration](../config.md#configuration-discovery-and-precedence).
The resolver retains configured `validation_policy` overrides and derives one Core `Load`/`LoadSource` entry points support selected sources and the same
detached concrete terminal policy for the chunk producer and every lane's definition/conversion for direct consumers and tests. They do not replace the
extract, merge, and normalize producers. That field-by-field inheritance is production composition root's underlay assembly. Do not accidentally introduce
complete before preparation, and the effective values contribute to pipeline a second production load by combining those paths.
and checkpoint identity; execution does not interpret configuration defaults.
The framework resolver supplies defaults, selects lanes, resolves validator ## Result Lifetime And Runtime Conversion
chains, checks registered module and artifact compatibility, validates module
options, and returns the fixed ordered pipeline shape. Positive validator retry
budgets require an LLM-backed selected validator; deterministic validators are
rejected during resolution. Eligible LLM-backed producer specifications also
contribute their declared correction protocol to the resolved metadata. The
resulting **EffectiveConfig** retains the selected ID, requested selection and reference
changes, a clone of the input configuration, and the resolved pipeline.
Callers may therefore retain or modify their input slices and maps without
changing the resolved result, and later consumers cannot mutate the original
configuration through the effective value. This ownership includes the nested
PromptKit local-backend value.
Resolution failures stop before module construction and source parsing. They `LoadedConfig.Result()` exposes the original typed result for intentional native
include an error path for an unconfigured pipeline, missing module, missing handoff. `FromResult` derives pipeline runtime settings without loading sources
capability, incompatible artifact variant, invalid option, invalid reference, or serializing settings again. `RuntimeConfig` returns a detached copy;
or invalid lane selection. CLI code maps these valid-invocation failures to the the native PromptKit configuration stays with its owning result/engine rather
runtime error class described in the [CLI reference](../cli.md#output-streams-and-exit-statuses). than being copied into a private runtime wrapper.
## Resolved Identity And Redaction `MainSourcePath` reads the retained non-imported main-file evidence. It does not
repeat discovery or assume the first acquired file is the main.
The framework assigns the resolved pipeline a deterministic SHA-256 digest Within one invocation, `nativeLoaders` retains results by complete
after defaults, lane selection, module bindings, reference bindings, validator `ckconfig.Selection`, including overlay and override presence/values. Captured
chains, selected correction protocols, effective LLM profiles, and artifact override containers are copied. A repeated identical selection returns the
schema identity have been resolved. The digest excludes same result; distinct diff sides remain distinct selections. The engine is
its own stored value. It identifies resolved composition rather than raw YAML constructed lazily once for its retained result. This is invocation state,
bytes, a debug payload, or all runtime state. The CLI records it as invocation not a process-wide persistent loader cache.
provenance before execution; cache and checkpoint identity have additional
owners in [Run State Internals](state.md).
Configuration publication uses ConfigKit's redacted effective YAML. Resolved `NewFromConfig` consumes the completed result, preserving native contexts and
pipeline publication uses **RedactedResolvedPipelinePayload**, which copies inspection evidence without rerunning callbacks or adding underlays. Runtime-only
bindings and nested option containers, replaces credential-shaped values with HTTP/client settings and test provider options stay at engine construction.
**[REDACTED]**, and omits materialized reference content while retaining safe [PromptKit's application-owned-load contract][handoff] owns the library API.
provenance. This redaction is deliberately narrow and does not authorize
recording arbitrary environment values or provider requests.
## Invariants To Preserve ## Effective Resolution And Preflight
- ConfigKit composition applies defaults, imports, an optional overlay, and `Config.Resolve` clones configuration, resolves an empty programmatic cache-root
explicit overrides in one direction with retained origin metadata. selection, validates structure, and passes selected pipeline/lanes, profile/cache
- A configuration is structurally valid before it is resolved, and a resolved overrides, and exact reference changes to `pipeline.ResolvePipeline`.
pipeline is compatible with the supplied catalog before preparation begins. Structural validation uses the framework's catalog-independent layout; an omitted
- Whitespace-normalized identifiers are unique wherever they identify a profile ID is supplied from the validated map key on a detached value. Document
pipeline, step, lane, worker, or reference slot. presence, map-key matching, and reference-source checks remain configuration-owned.
- Runtime conversion and resolved-pipeline publication return detached data. CLI selector expansion and complete resolution share the framework's selected
- The resolved PromptKit transient-retry budget is always passed to the shared target inventory, while required-reference validation remains in resolution.
built-in client; document presence preserves an explicit zero. The framework resolves module/default/validator/type/reference compatibility and
- The resolved digest changes when resolved composition changes and never concrete producer controls before execution. Input slices/maps and the original
includes itself. configuration do not become mutable aliases of the effective result.
Pipeline-owned profile and binding copies use the framework's pure copy helpers;
they preserve configured values and supported nil/empty containers, while
interpretation and normalization remain separate responsibilities.
## Focused Tests Presence-aware selections preserve explicit invocation profile clearing, cache
overrides, and zero semantic-turn controls rather than collapsing into omission.
Deterministic bindings remain
separate from LLM roles. A resolved-composition digest is not an accepted-artifact
cache key; [state ownership](state.md) is a different boundary.
- **internal/core/config/document_test.go** and Preflight consumes resolved data, the catalog, and the captured engine when model
**operational_document_test.go** cover ConfigKit document loading, roles are selected. It checks static initial/correction/validator dependencies and
normalization, imports, overlays, and overrides. applicable explicit/default profiles. It does not load configuration, construct
- **internal/core/config/validation_contract_test.go** covers configuration modules, read reference/input bytes, or manufacture a request to prove readiness.
invariants and contextual failures. Partial profiles remain valid; dynamic request selections are runtime checks.
- **internal/core/config/effective_config_contract_test.go** covers defaults,
selections, overrides, resolution context, digest changes, and ownership.
- **internal/core/config/loaded_config_test.go** covers safe effective and
explanation rendering; **redaction_test.go** covers resolved-pipeline
redaction and reference-content exclusion.
Run **go test ./internal/core/config** after changing this boundary. Changes to ## Inspection And Sensitive Values
the handoff or resolved-composition semantics also need the focused framework
pipeline tests. Native whole-app and focused views use retained ConfigKit evidence. Existing
effective/explanation writers delegate to that result rather than walking YAML.
Application sensitivity rules and native resource sensitivity participate in the
same definition. Source/runtime option containers must not be independently
reserialized as an alternative secret-handling mechanism.
Do not infer that arbitrary source, prompt, provider, or module-option strings
are safe to disclose. Capture uses native inspection and exact marked-secret
paths, not heuristic application-text rewriting. See [CLI composition](cli.md)
and [LLM integration](llm.md) for those consumers.
## Focused Verification
- [Document/native settings tests](../../internal/core/config/native_settings_test.go)
prove typed handoff, native rules, source-relative messages, and secret-aware views.
- [Path tests](../../internal/core/config/document_paths_test.go) and
[inheritance tests](../../internal/core/config/inheritance_test.go) cover origins,
explicit presence, overlays, and source/runtime ownership.
- [Control tests](../../internal/core/config/validation_policy_contract_test.go)
cover loaded omission/zero and resolved controls.
- [Effective resolution tests](../../internal/core/config/effective_config_contract_test.go)
cover catalog checks, selection, and detached results.
- [CLI loader tests](../../internal/cli/native_load_test.go) cover actual production
underlays, strict companions, imports, frozen messages, and distinct selections.
[Schema-load tests](../../internal/cli/native_schema_load_test.go) exercise native
operator schema preparation/execution.
Use focused configuration and CLI tests when changing this handoff. The
[development guide](../development.md#validation) owns repository-wide checks.
[handoff]: https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.25.0/docs/consumers/pkg-promptkit.md#reuse-an-application-owned-load

View File

@@ -1,9 +1,10 @@
# D&D Module Internals # D&D Module Internals
This guide records the conventions shared by the production D&D module family. This guide explains shared D&D implementation conventions.
It complements [Module Internals](modules.md), which owns generic registration [Module Internals](modules.md) owns generic typed extension mechanics;
and extension mechanics, and [Configuration](../config.md), which owns the [Configuration](../config.md) owns keys, bindings, reference syntax, and default
selectable keys, bindings, reference syntax, and default validator chains. validator chains. [Pipeline Internals](pipeline.md) owns assessment/disposition
and [LLM Integration](llm.md) owns native execution.
## Durable Artifact Contracts ## Durable Artifact Contracts
@@ -25,317 +26,250 @@ does not repeat their JSON shapes or schemas.
## Family Composition ## Family Composition
The D&D registrar registers the family’s artifact codecs, extractors, typed The [D&D registrar](../../internal/modules/dnd/register/register.go) composes
append-order mergers, normalizers, validators, prompt assets, fallback LLM codecs, evidence projections, typed extractors/append-order mergers/normalizers,
profile asset, and default validator chains. Each extractor and normalizer has validators, and default chains. Scene planning, extractors, and the three
a stable module spec, explicit execution class, strict option decoding, and a registry normalizers are model-backed; current mergers and remaining normalizers
typed builder. Scene chunking, every extractor, and NPC, location, and are deterministic. A model-backed module can still have an ordinary no-model
item-registry normalization are registered as `llm_backed`; the remaining branch. Registration does not construct engines or register prompt/schema assets.
current D&D mergers and normalizers are `deterministic`. The metadata is
available to catalog inspection and resolved-pipeline debug data and determines
which selected bindings inherit the pipeline profile. The registry normalizers
use `single_response_v1`, forwarding corrections to their reconciliation
completion and retaining the accepted raw proposal only as an owned model
candidate. When deterministic proposal safety or typed application rejects a
group, they provide separate model-facing prose for a corrective module retry;
internal issue categories, reason codes, and operator messages remain
diagnostic-only. Configuration remains the canonical owner of the exact keys,
profile precedence, and validator order.
Private structured-LLM response schemas are deliberately minimal. They reject Each model producer prepares fixed operation inputs and returns an initial request,
invalid JSON structure, missing required fields, incompatible types, and interpretation, correction builder, and supported fallback to core. Static prompt
unknown fields, while preserving semantic candidates for deterministic dependencies match its request constants. Core owns the shared engine and complete
validation. Do not promote a private response envelope into a durable schema; candidate assessment; modules do not run another producer loop.
the contracts above define durable data. Pure codecs, identities, reference resolvers, and deterministic transforms remain
separate from execution integration.
A D&D producer that declares `single_response_v1` forwards any supplied
semantic correction to its structured completion and returns an owned copy of
that completion's exact validated raw response as its model candidate. It does
not serialize normalized artifacts to create that candidate, so deterministic
identity, evidence, warning, and durable-schema behavior remains separate from
the model transport material.
## Prompt Construction ## Prompt Construction
D&D LLM-facing content lives beneath `assets/dnd/`. Each module contributes a The [shared context preparer](../../internal/modules/dnd/shared/context.go)
local `prompt.yaml` declaration and `instructions.md`; input-specific files loads and validates selected party and glossary references at construction,
such as a catalog, registry, grounding projection, or candidate collection are then retains narrow immutable prompt projections. Each operation combines them
local only when that module needs them. New extractor content uses its feature with its own transcript; generated registry and scene handoffs remain dynamic.
subtree, while families with both extraction and normalization content use their The spell catalog builds recognition views from the same shared glossary
`extract` and `normalize` subtrees. Shared visual-provenance fragments use integration. The [shared input contract](../integrations/shared-domain-inputs.md)
the `common-dnd-` prefix. Production lane code belongs with its D&D codec, owns supported formats and selection semantics.
extractor, normalizer, and validator packages; registry projections and
identity helpers remain in their owning entity packages rather than in a
consumer lane.
The owning module’s manifest is the source of truth for which local and shared Content lives beneath [assets/dnd](../../assets/dnd/), with ordinary native
assets are selected, their mount paths, their message order, cache controls, declarations imported by [assets/notarius.yml](../../assets/notarius.yml).
and the files included in its prompt fingerprint. Shared fragments belong to The root assets package stays a content-only leaf. Declaration-relative content
the D&D shared implementation and are selected by name rather than copied into paths and the collection schema context replace mounted filesystems/manifests.
module directories. The root `assets` package is a content-only boundary; its Native declarations own output contracts and initial/correction pairs.
physical ownership and rationale are defined by [Configuration](../config.md#prompt-output-contracts-and-schemas) owns public
[ADR-0011](../adr/0011-centralize-llm-assets.md). schema-root/replacement behavior.
Use the [spell declaration](../../assets/dnd/spells/prompts/prompt.yaml),
[scene declaration](../../assets/dnd/scenes/prompts/prompt.yaml), and
[item-normalization declaration](../../assets/dnd/item-registry/normalize/prompts/prompt.yaml)
as distinct examples. IDs in module constants/static dependencies select their
qualified native resources. Embedded profile content participates in the same
native load as operator resources, not registrar fallback logic.
Put each rule at its narrowest owner: Put each rule at its narrowest owner:
- universal behavior belongs in the shared system asset; - Universal behavior belongs in shared system content.
- D&D-family behavior belongs in a selected `common-dnd-` asset; - D&D-family and input-specific rules belong in selected shared/input files.
- rules for an input projection belong with that input asset; - Enduring domain principles belong in the initial system context.
- lane-specific policy belongs in the module’s `instructions.md`; and - The initial assignment and correction assignment belong in their own messages.
- transport-envelope shape belongs in the private response schema. - Transport shape belongs in the private response schema, not repeated prose.
A rule is eligible for the system prompt only when every D&D LLM prompt needs Initial/correction pairs share schema/profile defaults. Follow-ups supply new
it regardless of lane, inputs, or response shape. Module instructions must not guidance, not a fresh transcript/reference bundle or a manually replayed assistant.
repeat rules selected from shared assets or schemas. Reintroduce such repetition Native coordination retains the growing exchange; structural repair is separate.
only after observational evaluation with representative transcripts shows that Private model schemas keep structure minimal and provider-compatible. Durable
it improves results at the intended target models and cost; structural prompt artifact schemas remain codec-owned contracts. Preserve supported semantic
tests alone are not that evidence. candidates for typed validation instead of silently transforming domain mistakes.
Every maintained D&D LLM prompt selects `dnd-extraction` as its default Shared content is selected by real relative paths rather than copied into modules.
profile. The D&D registrar registers the fallback, while an operator can Message ordering/cache hints remain meaningful prompt behavior; inspect the
replace it with a complete profile of the same ID from the configured PromptKit owning declaration before changing them. Extraction generally separates reusable
source. Deployment profile selection is documented in campaign/chunk context from lane-specific projections. Scene planning uses the
[Configuration](../config.md#promptkit-profiles). full transcript; normalization uses fixed generic candidate/window presentation.
Do not force those different roles into a universal prefix or snapshot prose.
Native asset tests check preparation, input placement, paired contracts, and
meaningful cache controls without asserting a provider-quality result.
The D&D transcript assets have distinct consumers. Scene chunking consumes the ## Representative Extraction And Correction
complete-session `common-dnd-transcript-full.md`, while extraction prompts
consume the current-chunk `common-dnd-transcript-chunk.md`. NPC, location, and
item normalization instead mount the generic semantic-reconciliation
candidate and transcript-window presentation assets. Player, party, glossary,
and compatible campaign references provide disambiguating context only when
declared by the active prompt; they never establish evidence. Reference
material is canonically ordered before rendering so equivalent inputs remain
stable.
Extraction prompts render the common system and identity messages first, then The [spell extractor](../../internal/modules/dnd/extract/spells/extractor.go)
cached campaign references and the cached chunk transcript. Evidence policy and uses [PrepareChunkExtraction](../../internal/modules/dnd/shared/extraction_inputs.go)
any lane-specific registry, catalog, or grounding projection follow that to validate source/chunk input, resolves catalog/NPC context once, and creates
prefix. The final module instructions message is ephemeral. This keeps the native artifact inputs. Its interpreter canonicalizes the private response into
reusable extraction prefix identical while preserving the lane-specific suffix. the existing durable value. The follow-up adds only aggregated guidance.
Catalog and source validators remain domain rules; accepted empty extraction
and a qualified empty fallback are different outcomes.
Scene chunking intentionally uses a different order: system, cached campaign Other extractors keep their own mapping/identity rules rather than consolidating
references, uncached module instructions, then the final ephemeral full unlike response envelopes into a generic parser. Unknown/ambiguous contextual
transcript. Entity normalization also has its own order: D&D system, mandatory selections produce actionable interpretation guidance without partial output or
generic protocol, ephemeral domain semantic instructions, generic candidate guessed identity. Run-wide native selections reach producer, continuation, and
presentation, and final ephemeral generic transcript windows. These orders and validator requests through the operation, without changing captured configuration.
cache controls are prompt behavior; change them only through the owning
manifest and prompt declaration.
NPC, item, and location registry reconciliation translate shared proposal
safety categories into bounded prose that references only the response-local
duplicate-group ordinals and candidate handles. Item reconciliation appends its
typed rule that currency may be consolidated only with aliases of the same
denomination and never with non-currency items. The next normalize attempt
receives that prose with the exact defective proposal under the shared
replacement-request protocol. Structurally invalid output has no valid proposal
candidate and receives a fresh feedback-free attempt instead. If the stage
budget is exhausted, safe groups stay applied, unsafe groups stay separate, and
one fallback warning summarizes the final defect without raw model content.
## Evidence, Candidates, And Normalization ## Evidence, Candidates, And Normalization
The current transcript is the only durable evidence source. Extractors assign The current transcript is the sole durable evidence source. Extractors attach
the current source identity and losslessly order any reversed range whose two its source identity and canonicalize resolvable reversed endpoints by document
endpoints resolve in that source, using transcript position rather than numeric position, not numeric unit-ID order. They order/deduplicate references without
unit-ID order. They then canonically order ranges and remove exact duplicates. turning ordinary canonicalization into a warning or correction. Wrong-source
This routine canonicalization does not request a retry or emit a warning. or unresolvable citations remain detectable, not silently repaired.
Unresolvable or wrong-source ranges remain unchanged for validators to reject. Campaign references and generated context can disambiguate or route work, never
Campaign context and generated artifacts may ground names or control routing, supply new source evidence.
but they never establish evidence for a D&D result.
Default chains keep responsibilities separate: structural validators assess the Extraction borrows the run's whole-source index for source ordering, grounding,
candidate, source-reference validators resolve cited ranges against the current and scene fallback. Validators reuse it for source-reference checks, citation
source and require extraction evidence to stay within the current chunk, resolution, and applicable invariants; standalone calls construct a local index
durable-schema validation checks an approved representation, and when none is supplied. `DocumentIndexForSource` and
relatedness validators report advisory evidence concerns. The configured order `NewCitationResolverForSource` in [shared helpers](../../internal/modules/dnd/shared/)
is documented in provide those optional-index paths.
[Configuration](../config.md#production-validator-keys-and-default-chains). See [Module Internals](modules.md#preparing-operations) for its ownership boundary.
The optional `extract/dnd/scene-descriptions/combat_semantics` validator is the Typed chains retain separate structural, source, identity/domain, durable-schema,
D&D family's LLM-backed review of only combat versus non-combat classification. and advisory responsibilities; [Configuration](../config.md#production-validator-keys-and-default-chains)
It selects the shared combat-policy prompt fragment and asks the model to owns their order and replacement rules. Extraction containment requires the
classify the current chunk independently as `combat` or `non_combat` without entire cited span inside the current chunk after ordinary reference validation.
receiving the proposed scene kind. Deterministic code compares that Scene descriptions instead require the exact one-scene identity/range.
classification with the proposed kind and either approves it or produces the NPC and location occurrences, combat turns, and spell casts share
appropriate correction guidance. This keeps every schema-valid classification [duplicate-position bookkeeping](../../internal/modules/dnd/shared/duplicates.go).
interpretable and avoids anchoring the reviewer on the producer's answer. It Each family supplies identity and source-reference eligibility and owns its output
does not assess titles, summaries, non-combat subtype, or scene boundaries; and diagnostic mapping. Spells retain the original list when no duplicate is
deferred boundary-coherence review remains separate. It is opt-in; removed; item occurrences keep their bucket-plus-exact-equality check separately.
[Configuration](../config.md) owns selection and retry/failure behavior. Occurrence and enemy-event normalizers prepare chronology and other invariant
comparison keys for owned records before sorting. Enemy invariant checks use
canonical evidence only after verifying its order and uniqueness; defensive
comparators remain for unproven inputs and evidence ties remain linear.
### Combat-semantics provider evaluation Guidance describes all currently detectable model-controlled defects using
contextual names, response fields, and source ranges. It does not copy operator
paths, hashes, validator keys, reason codes, or durable IDs. Shared
[diagnostic helpers](../../internal/modules/dnd/shared/diagnostics/diagnostics.go)
support classified/bounded operator findings and separate model guidance.
Deterministic identity/order invariants do not imply that the model owns those
derived fields.
The human-reviewed corpus at Item-holder mistakes remain semantic rejections, not synthesized holders or
`internal/modules/dnd/validate/scenedescriptions/combat_semantics/testdata/evaluation_cases.json` silent rewrites; guidance states the response's null/non-null relationship and
owns the proposed kind, expected combat classification, and reviewer rationale identifies records contextually. Enemy-event extraction rejects duplicate
for each synthetic case. Its package test validates the fixture contract only. engagement observations within one scene result; normalization intentionally
Provider evaluation remains an explicit maintainer operation and must not be combines across scenes instead. Retain these differences when sharing helpers.
added to the default offline test suite.
Use the following protocol before proposing default-chain inclusion: Deterministic normalizers canonicalize display/evidence and source ordering and
can emit cleanup observations. They run directly without synthetic requests.
1. Record the Notarius commit, prompt and schema fingerprints, provider, model, The three registry normalizers retain their intentional model-assisted exception.
profile settings, reasoning effort, structural-repair setting, number of
repetitions, and evaluation date before collecting results. Do not revise
expected classifications merely to agree with provider output; a substantive
corpus correction requires independent human review.
2. Exercise the production validator construction and prompt assets from an
explicitly invoked, disposable evaluation driver or test in the validator
package. For each corpus case, construct transcript source units from the
listed IDs and text, assign matching per-unit source references, and use
`source.MaterializeChunkPlan` with one range spanning those units. Construct
exactly one scene whose ID and source range match that chunk and whose kind
is the case's `proposed_kind`; title and summary may use fixed placeholders
because the validator neither receives nor evaluates them. Invoke the typed
validator at extract stage through the production registry and scheduled LLM
client. Do not commit provider credentials, generated source material, or an
always-on live test.
3. Compare the model classification with `expected_classification`, then verify
that its deterministic comparison with `proposed_kind` yields the expected
approval or rejection direction.
Record an unexpected approval of an expected rejection as a false
acceptance, an unexpected rejection of an expected approval as a false
rejection, and any validator execution failure separately from semantic
accuracy. Retain per-case results so repeated trials and systematic failure
modes remain visible.
4. Evaluate producer correction separately with representative complete
scene-description runs configured as shown in
[Configuration](../config.md#production-validator-keys-and-default-chains).
For every initial semantic rejection, record whether the next producer
attempt returns the requested combat status and is approved. Do not count a
PromptKit structural repair as a producer-correction attempt.
5. Run the correction evaluation with debug capture enabled and without reused
extraction checkpoints. Record added validator and producer calls, elapsed
latency, and cumulative prompt, completion, cached, and total token usage
from the debug attempt records. Compare these values with an otherwise
identical run whose scene-description chain omits the semantic validator.
The default-chain review must consider classification error, false acceptance,
false rejection, execution failure, producer-correction success, added calls,
latency, and token use together. A structurally successful provider run alone
is not evidence that the validator should become a default.
Every producer-correctable D&D rejection describes all currently detectable
corrections in transcript-grounded domain terms, using contextual names,
model-owned artifact fields, and source segment ranges when useful. Validators
collect independent record defects in one pass so one retry does not merely
reveal the next issue. Shared D&D diagnostic helpers keep repeated rules and
record descriptions stable, de-duplicated, and bounded; each artifact family
continues to own the semantic rule and its prose.
Operator diagnostics and model guidance are separate products of the same
assessment. Operator messages may use typed paths, reason details, and opaque
application identities. Correction guidance must not copy those messages or
ask the model to reproduce durable entity IDs, hashes, validator module keys,
reason codes, or Go field paths. A registry-normalization rejection instead
speaks in terms of the duplicate-group proposal response the normalizer can
actually revise. Normalization-only deterministic invariants retain useful
operator detail but do not imply that a model controls derived ordering or
identity. Only bounded actionable semantic guidance is eligible for a
correction prompt.
Private LLM schemas use simple enums for closed categorical fields when the
provider-compatible shape can express the rule directly. Deterministic typed
validators retain the same checks as defense in depth and for non-LLM
producers. Private schemas keep every property required and avoid optional
properties, `uniqueItems`, and conditional cross-field logic.
Item-occurrence shape validation groups repeated holder mistakes by occurrence
kind and gives the producer the required JSON null/non-null relationship. It
identifies affected records by contextual item name and cited transcript range,
never by the deterministically attached durable item ID. Holder mistakes remain
semantic rejections rather than silent rewrites because changing a holder can
also change the meaning of the occurrence kind.
Enemy-event extraction additionally rejects a second `engaged` observation for
the same comparison identity within one scene-scoped result. Normalization may
combine results from distinct scenes, so it intentionally does not apply that
rule. Configuration owns the exact validator key and chain position.
Extraction source-reference validators share one full-span chunk-containment
policy. After ordinary reference validity succeeds, the policy resolves both
endpoints through document order and requires every source unit in the
inclusive range to be present in the current chunk. It does not assume numeric
unit-ID ordering, mutate input, or weaken wrong-source and unresolved-reference
validation. Scene descriptions remain separate because their validator owns an
exact one-scene range contract rather than general extraction containment.
Normalizers are deterministic for spells, combat turns, item occurrences, NPC
occurrences, scene descriptions, enemy events, and location occurrences. They
canonicalize display values and evidence, use source-document order for stable
output, and emit bounded normalization observations for changes or collapsed duplicates. NPC,
item, and location registry normalizers are intentional exceptions: each first
produces a deterministic candidate set, then may use a bounded structured-LLM
proposal to reconcile identity groups.
## Semantic Registry Reconciliation ## Semantic Registry Reconciliation
The three registry normalizers instantiate the domain-neutral [NPC](../../internal/modules/dnd/normalize/npcregistry/normalizer.go),
`internal/framework/semanticreconcile` engine with default bounds. Each [item](../../internal/modules/dnd/normalize/itemregistry/normalizer.go), and
eligible candidate receives a contiguous, one-based `candidate_number` for that [location](../../internal/modules/dnd/normalize/locationregistry/normalizer.go)
request, and candidate material declares the exact inclusive range. The model normalization use the shared operation facility in
sees that handle, the candidate label and source-free evidence ranges, plus [semanticreconcile](../../internal/framework/semanticreconcile/operation.go),
bounded transcript windows; it returns only duplicate not a separate reconciliation engine/service.
groups of supplied handles and one supplied canonical handle per group. It
never returns names, evidence, durable IDs, or replacement records. Identical
labels and evidence remain independently selectable because their handles are
distinct. Transcript unit `id` values and evidence `start_unit_id` and
`end_unit_id` values are source positions in a separate namespace and are
never valid candidate numbers.
The generic core owns the mandatory handle protocol, candidate and transcript The operation retains the incoming merged artifact separately, preprocesses
presentation, the private response schema, source-reference validation, fixed originals once; the shared facility prepares candidates once. Preparation
candidate and combined-material limits, structured completion, proposal filters unusable candidate evidence, assigns contiguous one-based request-local handles, declares
assessment, stable group ordering, and typed plan-application mechanics. The their inclusive range, and builds bounded transcript windows/material.
D&D prompt contributes its system message and registry-specific semantic Candidate handles are not transcript unit IDs or durable identity. Identical
instructions. The generic registrar registers the shared prompt and schema; labels/evidence remain separately selectable.
the D&D registrar registers each consuming prompt and the fallback profile.
Fewer than two eligible candidates skips the LLM without a semantic warning. The native model proposes only duplicate groups and a supplied canonical handle.
An exceeded bound also skips the call and preserves the deterministic [Proposal assessment](../../internal/framework/semanticreconcile/proposal.go)
preprocessed registry, adding the registry's bounded fallback warning. Invalid rejects unsafe/unknown/overlapping selections; typed
structured output or discarded proposal groups use the normalizer's existing [application](../../internal/framework/semanticreconcile/application.go) uses
retry contract; retry exhaustion preserves the safe deterministic or family policies on the original records. Each response is a complete replacement
partially applied result and emits its bounded fallback warning. Provider, proposal, applied afresh before pipeline assessment, never a union of prior plans.
transport, cancellation, and context-material failures remain execution Correction uses the same handle mapping/windows and adds domain guidance only.
errors.
Application remains typed and registry-owned. All three policies select the Domain application chooses canonical display, unions evidence in source order,
canonical member's normalized display name, union member evidence in source preserves ungrouped originals, and derives durable identity after consolidation.
order, preserve ungrouped records, and derive durable identity only after NPC/item identity follows the final name; locations also use final evidence to
consolidation. NPC IDs derive from the final name. Item IDs also derive from preserve same-name distinct places. Item guards prevent currency denominations
the final name, and a typed guard prevents currency aliases from crossing from crossing or merging with non-currency records. Diagnostics and postconditions
denominations or mixing currency with non-currency records. Location IDs remain registry-owned; model output supplies no replacement names/evidence/IDs.
derive from the final name and final evidence, preserving same-name,
parent/child, and distinct physical-place identities. Registry warning scopes, Insufficient candidates use direct assessment without native execution.
reason codes, and postconditions remain outside the generic core. Preparation limits use resolved strict/permissive terminal handling, not implicit
semantic success. For supported permissive output, only compatible safe groups
from the final usable proposal can advance; otherwise the retained merged input
is checked as fallback. A result-less/structurally failed continuation cannot
recover an earlier proposal. Source/codec/identity construction checks still
apply without ordinary semantic revalidation. Strict mode and cancellation do
not silently preserve a result as accepted work.
## Planning, Scene Validation, And Fallback Limits
[Scene planning](../../internal/modules/dnd/chunk/scenes/chunker.go) prepares the
full input once and interprets complete ordered boundaries. The pipeline
materializes/assesses plans before lane work. Supported permissive planning can
construct one unannotated whole-source plan through normal source-addressing;
it does not invent classifications, prose, or bounded request sizes.
[Scene descriptions](../../internal/modules/dnd/extract/scenedescriptions/extractor.go)
have a stricter intrinsic requirement: one usable current-scene artifact.
Permissive construction can use only a final usable candidate satisfying shape,
source identity/range, and downstream invariants. It cannot fabricate a
kind/title/summary, emit an invalid empty list, or retrieve an earlier candidate.
Codec-valid empty collections are supported for the list extraction families,
but do not generalize to every producer.
The [scene family checks](../../internal/modules/dnd/scenedescriptions/checks.go)
report field facts shared by normalization and validators; the selectable shape
adapter owns extraction cardinality and corrective guidance. The durable codec
shares the kind predicate but retains its own whitespace and source-range rules.
[Combat semantics](../../internal/modules/dnd/validate/scenedescriptions/combat_semantics/validator.go)
is an opt-in independent combat/noncombat review of scene-local transcript input,
without the proposed kind. Deterministic interpretation compares classification
to the candidate. It does not evaluate title, summary, noncombat subtype, or
boundary coherence. One direct native execution returns a judgment or unavailable
assessment with causes; it has no producer continuation loop.
[Configuration](../config.md#production-validator-keys-and-default-chains) owns selection.
### Combat-semantics provider evaluation
The [human-reviewed synthetic corpus](../../internal/modules/dnd/validate/scenedescriptions/combat_semantics/testdata/evaluation_cases.json)
records proposed kind, expected classification, and rationale. Offline fixture/
fake-provider tests verify contracts, not production classification quality.
Live evaluation remains explicitly invoked maintainer work, not a default test.
Before proposing default-chain inclusion:
1. Record commit/content revisions, provider/model/profile/execution settings,
actual native repair selection, repetitions, and date. Do not change expected
judgments just to agree with provider output; corpus corrections need independent review.
2. Use a disposable explicit driver with the production typed validator and shared
native engine. Materialize corpus units into one chunk and construct the
matching scene identity/range/proposed kind. Title/summary can be placeholders:
they are not reviewer inputs. Commit no credentials or always-on live test.
3. Compare classification and deterministic approval/rejection separately. Retain
false acceptance, false rejection, and unavailable/execution-failure cases.
4. Evaluate producer correction separately through the configured full chain,
including the final permitted response. Native structural repair is not an
application semantic turn.
5. Use requested capture and explicit bypass/refresh rather than cached acceptance.
Compare added executions, latency, and native usage/terminal coverage with and
without the validator; preserve unknown usage instead of inventing totals.
Default-chain review must weigh quality, correction success, availability, calls,
latency, and cost together. Structural success alone does not justify inclusion.
## Generated References And Grounding ## Generated References And Grounding
Normalized D&D artifacts can be handed to a later step through a generated Normalized artifacts reach later steps through typed compatibility-checked
reference binding. The framework verifies artifact compatibility and retains handoffs. Consumers resolve supplied bytes into immutable contextual projections.
producer provenance; consumers resolve the handed-off artifact into an Valid fallback context remains usable in the current run but disables reuse for
immutable, validated projection for each operation. External files are checked actual consumers and their dependents; unrelated work is unaffected.
during preparation, while generated artifacts are resolved at the handoff.
NPC and item registry consumers receive names-only grounding. Location NPC/item selectors are names-only; location selectors include the name and
consumers receive a contextual selector containing the canonical name and the ordered registry references needed to distinguish same-name places. Consumers
registry references needed to distinguish same-name places. The calling module resolve selections locally to the unchanged durable ID/name pair. Unknown or
resolves those supplied selections locally and maps them into the unchanged ambiguous selections do not yield guessed IDs or partial occurrence results.
durable ID/name pair; an unknown or ambiguous selection rejects the complete Registry evidence disambiguates identity but never replaces each occurrence's
occurrence result rather than accepting a partial mapping. The NPC registry own current-transcript citations.
additionally supplies names-only actor grounding to spells, combat turns, and
enemy events.
Registry references establish a registry identity and may disambiguate a Scene projections route combat without conveying scene prose as evidence.
selection, but never become occurrence evidence. Each occurrence keeps its own Combat-turn projections retain actor/turn kind; NPC-occurrence projections select
current-transcript source references, even when it was grounded through the combat-opponent names/kinds for enemy grounding. These remain guidance, not
same registry record. event evidence.
Scene descriptions are eligibility-only projections: they retain current-chunk
classification data, not scene prose or evidence, and exist to route combat
extraction. Enemy-event extraction also projects combat turns to `actor` and
`turn_kind` and filters NPC occurrences to `combat_opponent` names and kinds.
These projections are guidance only and never event evidence.
## Lane-Specific Rules ## Lane-Specific Rules
@@ -344,14 +278,14 @@ shared helper changes.
Shared D&D text comparison is identified by `dnd.text_comparison.v1`. Any Shared D&D text comparison is identified by `dnd.text_comparison.v1`. Any
semantic change requires an explicit policy-version review for every affected semantic change requires an explicit policy-version review for every affected
identity, mapping, normalization, and validator policy; helper source is not a identity, mapping, normalization, and validator policy. This is domain policy,
checkpoint fingerprint. not accepted-result cache identity.
| Lane | Intentional behavior | | Lane | Intentional behavior |
| --- | --- | | --- | --- |
| Spells | May use a spell-catalog overlay and optional NPC grounding; the catalog validator supplies domain-specific semantic checks. | | Spells | May use a shared glossary for recognition and optional NPC grounding; the catalog validator supplies domain-specific semantic checks. |
| NPC registry | Establishes transcript-grounded NPC identities, including factual third-party mentions, without assigning occurrence categories. It does not consume an NPC registry, and its normalizer is the LLM-assisted reconciliation exception described above. | | NPC registry | Establishes transcript-grounded NPC identities, including factual third-party mentions, without assigning occurrence categories. It does not consume an NPC registry, and its normalizer is the LLM-assisted reconciliation exception described above. |
| Combat turns | Requires a scene-description artifact. It calls the LLM only for an exact `combat` classification; exact non-combat classifications return an accepted empty result, while missing or mismatched classifications return an empty result with a bounded warning. Optional NPC grounding never becomes evidence. | | Combat turns | Requires a scene-description artifact. It calls the LLM only for an exact `combat` classification; non-combat paths directly assess an empty result, while missing or mismatched classifications also retain a bounded warning. Optional NPC grounding never becomes evidence. |
| Item occurrences | Requires the normalized item registry for exact deterministic grounding at extraction and normalization. Campaign context may disambiguate, but the registry never becomes occurrence evidence. | | Item occurrences | Requires the normalized item registry for exact deterministic grounding at extraction and normalization. Campaign context may disambiguate, but the registry never becomes occurrence evidence. |
| Item registry | Produces source-grounded item types and unique designations. Its LLM-assisted reconciliation is proposal-only, preserves distinct currency denominations and item types, and does not create per-instance identities. | | Item registry | Produces source-grounded item types and unique designations. Its LLM-assisted reconciliation is proposal-only, preserves distinct currency denominations and item types, and does not create per-instance identities. |
| NPC occurrences | Requires the normalized NPC registry at extraction and normalization, using it for canonical actor grounding only. It separately emits cited current-transcript occurrence facts, including `mentioned`, rather than deriving them from registry provenance. | | NPC occurrences | Requires the normalized NPC registry at extraction and normalization, using it for canonical actor grounding only. It separately emits cited current-transcript occurrence facts, including `mentioned`, rather than deriving them from registry provenance. |
@@ -370,11 +304,14 @@ selectable bindings and validation chains.
## Focused Verification ## Focused Verification
When changing D&D behavior, test the affected codec, extractor, normalizer, Walk extensions through real [spell extraction](../../internal/modules/dnd/extract/spells/extractor_test.go),
validator, prompt-asset manifest, and registry projection. Also test generated [item reconciliation](../../internal/modules/dnd/normalize/itemregistry/normalizer_test.go),
handoffs at the integration boundary and run the full D&D module suite: [scene planning](../../internal/modules/dnd/chunk/scenes/chunker_test.go), and
[native semantic validation](../../internal/modules/dnd/validate/scenedescriptions/combat_semantics/native_execution_test.go).
~~~sh Retain family codec/identity/source/holder/eligibility regressions, contextual
go test ./internal/modules/dnd/... registry projection tests, and [assembled handoffs](../../internal/modules/integration/).
go test ./internal/modules/integration/... [Dependency registration](../../internal/modules/dnd/register/dependencies_test.go)
~~~ and [native asset tests](../../assets/) verify static resources and preparation
without behavioral asset registration. Use real kits with native provider fakes;
no ordinary test needs credentials, paid inference, or a private completion API.
[Development](../development.md#validation) owns repository-wide validation.

Some files were not shown because too many files have changed in this diff Show More