313 Commits

Author SHA1 Message Date
89a587311c Remove completed audio implementation documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-12-02 03:54:17 +00:00
6ae2fc852e Correct the audit discussion status overview 2026-12-02 03:54:09 +00:00
914d98dd25 Record multi-format audio review findings 2026-12-02 03:52:32 +00:00
0ec57fe2f4 Document and verify multi-format audio discovery 2026-12-02 03:25:20 +00:00
9e2fc7313e Verify mixed audio retries and transport 2026-12-02 03:19:22 +00:00
3b16bf2790 Accept selected audio formats in transcription 2026-12-02 03:18:02 +00:00
35ddc5ed96 Use shared audio discovery in inspection 2026-12-02 03:17:05 +00:00
62ec37d9e2 Use shared discovery when preparing audio 2026-12-02 03:15:25 +00:00
f902e50def Share prepared audio names and speaker identities 2026-12-02 03:13:58 +00:00
9b59fa16b2 Add shared audio source discovery 2026-12-02 03:12:21 +00:00
1a66db4708 Plan shared multi-format audio discovery 2026-12-02 02:28:04 +00:00
0288111c72 Remove completed safety and transfer planning documents 2026-12-02 01:22:40 +00:00
89c8e5de3c Report workspace lock acquisition before waiting 2026-12-02 00:38:15 +00:00
4d7fc57a5e Record safety and transfer review findings 2026-12-02 00:07:06 +00:00
75eddf8adc Complete safety and transfer remediation verification 2026-12-01 20:47:59 +00:00
f59a53e31b Transfer publication sources one at a time 2026-12-01 20:33:18 +00:00
d311579dc0 Plan publication using source descriptors 2026-12-01 20:30:01 +00:00
d70bf98871 Stream changed local audio into the workspace 2026-12-01 20:28:58 +00:00
59813b72fa Bound restore and publication verification downloads 2026-12-01 20:28:13 +00:00
6f5464615e Record the downloaded audio object generation 2026-12-01 20:24:09 +00:00
d0c879ad09 Stream object responses with known size bounds 2026-12-01 20:22:42 +00:00
da4de023ad Wait for subprocess output before releasing resources 2026-12-01 20:20:41 +00:00
eb100e54f2 Protect session initialization from competing writers 2026-12-01 20:18:55 +00:00
9e3fc25fdd Coordinate workspace cleanup with active operations 2026-12-01 20:17:27 +00:00
038105ece9 Use a stable workspace lock for coordination 2026-12-01 20:13:16 +00:00
8e4627e262 Verify S3 upload payloads and clarify recovery 2026-12-01 20:11:56 +00:00
a92a117ad9 Plan safety and transfer audit remediations 2026-12-01 19:09:53 +00:00
074fe64e12 Record cancellation-aware workspace lock waiting 2026-12-01 19:02:23 +00:00
3d24fc4130 Record agreed audio decisions in the audit catalog 2026-12-01 18:41:17 +00:00
473f39bd90 Record audio discovery and naming decisions 2026-12-01 17:37:32 +00:00
b5ea9b4786 Plan multi-format audio input support 2026-12-01 14:52:09 +00:00
aa0379294f Record publication source lifetime decision 2026-12-01 12:43:10 +00:00
096a2f6745 Record subprocess shutdown ownership decision 2026-12-01 04:10:52 +00:00
4b75e283db Record audio acquisition and transfer-size decisions 2026-12-01 04:04:00 +00:00
bfd6369bc1 Record audit remediation ownership and roadmap overlap 2026-12-01 02:40:53 +00:00
5b8cc0c45c Record restore and render configuration decisions 2026-12-01 02:34:05 +00:00
9e07e9e5db Describe published artifact restore workflow 2026-12-01 02:26:23 +00:00
d8bc99b17e Focus recovery scope on published artifact imports 2026-12-01 02:14:20 +00:00
935b513255 Separate publication imports from execution recovery 2026-12-01 02:04:19 +00:00
2763890ffc Document audit remediation discussion points 2026-12-01 01:50:29 +00:00
02683f6d96 Consolidate and prioritize audit findings 2026-12-01 01:36:38 +00:00
191bd4342b Record documentation consistency audit findings 2026-12-01 01:24:57 +00:00
1b7742cd38 Record dead code audit findings
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-30 23:17:37 +00:00
bd8e8a0627 Record package boundary audit findings 2026-11-30 22:47:58 +00:00
28e54fb657 Record behavioral equivalence audit findings 2026-11-30 21:24:52 +00:00
bca7cd7c3a Record test coverage and effectiveness audit
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-30 20:17:27 +00:00
8f7d2ab181 Record error handling audit findings 2026-11-30 20:06:23 +00:00
7a9bbbde9f Record resource management audit findings
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-30 19:56:00 +00:00
f0e45b6035 Record concurrency audit findings 2026-11-30 18:50:14 +00:00
f02e7ec8de Record complexity and maintainability audit findings 2026-11-30 18:20:57 +00:00
3c00167912 Record algorithmic efficiency audit findings
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-30 17:50:25 +00:00
89ea4ff155 Record functional correctness audit findings 2026-11-30 17:30:45 +00:00
723b788161 Clarify operator command help and preflight migration 2026-11-30 17:21:07 +00:00
8aa552070d Remove completed preflight planning documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-30 17:17:03 +00:00
7320fd7957 Build artifact inventories only for pipeline run reports
Some checks failed
ci/woodpecker/push/verify Pipeline was canceled
2026-11-30 17:11:00 +00:00
c11b4ac309 Flatten Notarius readiness failure aggregation 2026-11-30 17:07:48 +00:00
f292edfe5c Record preflight algorithmic audit findings 2026-11-30 16:49:00 +00:00
b2877c1ea0 Document standalone preflight and complete verification 2026-11-30 15:42:21 +00:00
727ed783d1 Verify preflight recovery and cleanup interactions 2026-11-30 15:29:28 +00:00
6ea1b42d2a Replace session validation with standalone preflight 2026-11-30 15:26:06 +00:00
2b4123f48f Prepare sessions before checking readiness 2026-11-30 15:19:22 +00:00
5ca879e7e2 Share the locked invocation lifecycle 2026-11-30 15:16:45 +00:00
61e2a85842 Share downstream readiness checks across invocations 2026-11-30 15:16:00 +00:00
1f494c285a Factor the Audita readiness check 2026-11-30 15:13:41 +00:00
d4e5cfe41b Plan standalone session preflight implementation 2026-11-30 14:49:20 +00:00
07e6faed5a Remove completed cleanup planning documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-30 14:41:08 +00:00
826369c81a Protect validation probes with the session lock
Some checks failed
ci/woodpecker/push/verify Pipeline was canceled
2026-11-30 14:40:34 +00:00
fec29b541f Record cleanup validation integration finding 2026-11-30 14:30:27 +00:00
afd04e49d7 Clarify the completed cleanup roadmap history 2026-11-30 14:08:43 +00:00
719a6839d1 Document durable session cleanup 2026-11-30 14:08:28 +00:00
e9d74a7de0 Verify publishing and restore after cleanup 2026-11-30 14:04:10 +00:00
e9a81509b0 Verify durable reuse after session cleanup 2026-11-30 14:00:53 +00:00
c00c8169e2 Finish cleanup through the normal invocation lifecycle 2026-11-30 13:58:52 +00:00
03c16df524 Clean the complete session run history 2026-11-30 13:56:56 +00:00
5196c67570 Support removal of managed diagnostic views 2026-11-30 13:54:57 +00:00
2ca09e2a00 Make extraction products reusable without run bundles 2026-11-30 13:54:04 +00:00
95e297e917 Plan durable session cleanup 2026-11-30 12:51:24 +00:00
39ad49e09d Plan standalone session preflight 2026-11-30 12:44:49 +00:00
3b6449113e Plan cleanup that leaves a durable reusable session 2026-11-30 12:30:11 +00:00
13b28eeea8 Remove completed pipeline planning documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-30 12:16:02 +00:00
7906b2915e Record completed remediation verification
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-30 04:09:11 +00:00
1f5c0c435e Prevent collisions between prepared audio filenames 2026-11-30 04:06:30 +00:00
4d81a37638 Use a lexical heap for analysis scheduling 2026-11-30 04:06:00 +00:00
949e1ab189 Index roster names with Unicode case folding 2026-11-30 04:04:57 +00:00
b45e934feb Index prior audio inputs for reuse 2026-11-30 04:04:31 +00:00
807fbbeda3 Index product paths once during restore planning 2026-11-30 04:03:27 +00:00
3795d86587 Unify analysis product path identity 2026-11-30 04:02:53 +00:00
dbfcfa3f75 Correct runtime recovery commands 2026-11-30 04:00:26 +00:00
bc4878f2d7 Limit cleanup checks to owned diagnostic views 2026-11-30 03:59:19 +00:00
b6492ab4e8 Retain producer files after failed extraction 2026-11-30 03:58:26 +00:00
7ad6b718a0 Record algorithmic audit findings 2026-11-30 03:55:56 +00:00
4ee706bfb6 Record pipeline integration audit findings 2026-11-30 03:49:24 +00:00
d3d7728f1f Record shared pipeline review findings 2026-11-30 03:11:48 +00:00
2ec43305da Document the shared pipeline and verify the cutover 2026-11-30 02:40:17 +00:00
706c1bb7ad Exercise shared campaign and consumer workflows 2026-11-30 02:29:50 +00:00
b5b4672920 Reconcile reuse and inspection with native extraction 2026-11-30 02:20:09 +00:00
52a5d483e3 Preserve current diagnostics during run cleanup 2026-11-30 01:55:47 +00:00
3118bc35ba Restore prepared inputs and flat session products 2026-11-30 01:53:11 +00:00
e19ba81406 Publish prepared inputs and flat extraction products 2026-11-30 01:44:30 +00:00
3094ad892f Keep one verified copy of session audio 2026-11-30 01:41:12 +00:00
c07d4f24a2 Route producer diagnostics to run directories 2026-11-30 01:32:56 +00:00
16c3d7d643 Track latest stage attempt diagnostics 2026-11-30 01:24:29 +00:00
a5d541529d Add native Notarius readiness checks 2026-11-30 01:17:33 +00:00
7eed744ad1 Verify Audita shared inputs and diagnostics 2026-11-30 01:04:26 +00:00
815d727361 Promote native Notarius lane products 2026-11-30 01:02:01 +00:00
a3ce64f841 Adopt native Notarius completion reports 2026-11-30 00:48:14 +00:00
4e3ac343b4 Configure flat outputs and native Notarius controls 2026-11-30 00:45:13 +00:00
f05e711328 Prepare shared glossary envelopes and combined input 2026-11-30 00:39:39 +00:00
4e94b2157b Prepare resolved documents and autocorrection rules 2026-11-30 00:31:36 +00:00
5c4ca20b11 Record shared reference catalog migration 2026-11-30 00:23:44 +00:00
c70de21a7b Complete native session acquisition and initialization 2026-11-30 00:19:42 +00:00
d5e6d44fa7 Adopt shared campaign and session configuration 2026-11-30 00:14:07 +00:00
d1bf1fbfff Adopt the shared party roster contract 2026-11-30 00:03:54 +00:00
f923d75562 Define canonical session workspace paths 2026-11-29 23:59:15 +00:00
816453b444 Reject unsupported session state before execution and restore 2026-11-29 23:57:16 +00:00
8bc3ae56cb Bundle shared domain contracts and validation 2026-11-29 23:53:17 +00:00
c53c764c4d Plan the shared pipeline and workspace cutover 2026-11-29 23:43:39 +00:00
f2829f31e8 Settle campaign and session configuration decisions 2026-11-29 20:22:11 +00:00
b472ccfbbe Consolidate shared-input and workspace adoption roadmap 2026-11-29 20:11:25 +00:00
2043cdf25f Define the campaign operator contract and shared input decisions 2026-11-29 19:54:10 +00:00
8dc1724846 Revert mistaken release preparation
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-29 19:05:06 +00:00
c88182811c Prepare Narratio v4.0.0 release
Some checks failed
ci/woodpecker/push/verify Pipeline was canceled
2026-11-29 18:59:54 +00:00
cd12eb2f4c Update shared schema adoption plans for released consumer support 2026-11-29 18:57:12 +00:00
9c61299e86 Clarify schema alignment verification evidence 2026-11-29 04:37:10 +00:00
d1d505c9a2 Record completion of shared schema repository alignment 2026-11-29 04:36:49 +00:00
0676d7e40c Record progress on schema repository alignment 2026-11-29 04:30:56 +00:00
1d09762e31 Plan staged alignment of the shared schemas repository 2026-11-29 02:15:41 +00:00
b65f653380 Record Notarius glossary alignment decision for exploration 2026-11-29 02:15:27 +00:00
782bcceb1c Record native Notarius smoke tests as a preflight option 2026-11-28 02:28:18 +00:00
806526de68 Record Notarius output and glossary decisions 2026-11-28 02:12:00 +00:00
65b774b568 Add Notarius v0.9.0 adoption roadmap 2026-11-28 00:00:31 +00:00
55a4c49a31 Remove completed planning documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-27 23:51:37 +00:00
89f5a6a0ad Validate Audita report bounds with constant memory 2026-11-27 21:21:22 +00:00
aa0c1f1c03 Match prepared inputs with a linear record index 2026-11-27 21:19:12 +00:00
eb5e912fa3 Preserve native null aliases in prepared glossaries 2026-11-27 21:18:00 +00:00
447888e062 Reject selected catalog entries without source paths 2026-11-27 21:16:27 +00:00
d4036eea47 Record algorithmic review findings 2026-11-27 18:17:25 +00:00
54ba768a28 Record shared glossary adoption review findings 2026-11-27 18:02:48 +00:00
4f27331636 Verify shared glossary workflows and recovery 2026-11-27 17:14:44 +00:00
0de73ba25f Document shared glossaries and downstream preflight 2026-11-27 17:09:21 +00:00
8b9c0e664b Verify catalog and Audita compatibility offline 2026-11-27 17:04:49 +00:00
cfcb55e28c Update examples and tests for shared glossaries 2026-11-27 17:00:16 +00:00
410a4109ad Validate sessions with prepared downstream inputs 2026-11-27 16:48:38 +00:00
d178e2c437 Run downstream preflight after preparation 2026-11-27 16:45:46 +00:00
b9b154e59e Select and check downstream preflight targets 2026-11-27 16:41:09 +00:00
2db2554d1e Add native Audita preflight 2026-11-27 16:39:43 +00:00
5bafae048e Use prepared glossaries for transcript polishing 2026-11-27 16:38:10 +00:00
16e28b25a2 Adopt Audita native processing arguments 2026-11-27 16:34:15 +00:00
5da7db2b27 Publish and restore prepared glossary documents 2026-11-27 16:31:20 +00:00
0ce7568103 Make preparation reuse aware of glossary contents 2026-11-27 16:28:39 +00:00
28d149f7ed Prepare shared glossary documents 2026-11-27 16:26:22 +00:00
1bb1daa1f2 Register prepared glossary input identities 2026-11-27 16:24:08 +00:00
caddd668ca Resolve and project shared glossary collections 2026-11-27 16:22:10 +00:00
1cc37ef980 Add campaign and session glossary selections 2026-11-27 16:19:11 +00:00
5d44b41e74 Add reference catalog selection to pipeline configuration 2026-11-27 16:12:16 +00:00
66b7674e43 Add shared glossary validation 2026-11-27 16:10:23 +00:00
a6c1bceb26 Record the reference catalog foundation 2026-11-27 16:08:10 +00:00
6e6d64c289 Record CC0 license decision for reference catalog 2026-11-27 16:05:53 +00:00
bf86acd0a4 Plan Audita and shared glossary adoption 2026-11-27 16:04:05 +00:00
4f68fb27d9 Clarify empty glossaries and validation after composition 2026-11-27 15:14:05 +00:00
9400eb20da Specify glossary authoring precedence and shared input cutover 2026-11-27 15:08:38 +00:00
6fe5afcca4 Run downstream preflight after input preparation 2026-11-27 15:04:58 +00:00
95aac6367f Define shared glossary inputs and canonical schema ownership 2026-11-27 14:58:02 +00:00
f2cc45ea26 Define reference catalog distribution and development workflow 2026-11-27 14:26:25 +00:00
fa22c89622 Record Audita glossary preparation and full preflight decisions 2026-11-27 14:09:11 +00:00
9029dc4d7d Update Audita adoption roadmap for version 4.2 2026-11-27 04:48:10 +00:00
3b1718c44f Retarget Audita adoption roadmap to version 4.1 2026-11-26 14:25:43 +00:00
c9828b220e Remove completed Scriptorium roadmaps and audit record 2026-11-26 13:53:28 +00:00
0a43b67847 Avoid unnecessary reads when validating Scriptorium outputs 2026-11-26 13:51:06 +00:00
72eb597a72 Record Scriptorium result validation efficiency opportunity 2026-11-26 05:05:42 +00:00
f930ebf337 Document Scriptorium preflight and native integration 2026-11-26 04:40:25 +00:00
e9d57fb7aa Verify native Scriptorium workflows and retry behavior 2026-11-26 04:34:47 +00:00
d48215678a Include prompt requirements in session validation 2026-11-26 04:29:18 +00:00
150a59a928 Check prompt requirements before stage attempts 2026-11-26 04:25:47 +00:00
0cee77887d Assess prompt requirements against intended bindings 2026-11-26 04:22:45 +00:00
2c9668683a Build shared prompt inspection targets 2026-11-26 04:21:24 +00:00
3e7200ef28 Share read-only planning and analysis closure 2026-11-26 04:19:33 +00:00
f1fb77baa0 Share effective Scriptorium request context 2026-11-26 04:17:03 +00:00
de325006de Add Scriptorium prompt requirements inspection 2026-11-26 04:13:51 +00:00
b790cc73ca Use native prepared previews and correct diagnostic references 2026-11-26 04:08:40 +00:00
fcd7cffd18 Use native Scriptorium generation and capture its output 2026-11-26 04:05:35 +00:00
a9705a6b56 Capture subprocess results separately from diagnostics 2026-11-26 04:02:51 +00:00
bb84094385 Plan Scriptorium adoption and shared preflight checks 2026-11-26 03:20:19 +00:00
b9d56b8923 Plan shared preflight checks and retain inspection failures 2026-11-26 02:40:53 +00:00
e586e8c733 Clarify Scriptorium preflight policies and request context 2026-11-26 02:31:57 +00:00
1d1dfdf1ed Document Scriptorium adoption and prompt preflight roadmap 2026-11-26 01:56:54 +00:00
9fa179736b Remove completed roadmap documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-23 19:13:10 +00:00
e7b266f908 Allow literal environment values in workflow tests 2026-11-23 19:00:34 +00:00
b266031d56 Record ReleaseKit workflow test remediation 2026-11-23 18:38:14 +00:00
c893e1086a Complete ReleaseKit integration verification 2026-11-23 18:22:35 +00:00
3185795b4b Format imports with the release toolchain 2026-11-23 18:18:38 +00:00
c2c3232d8f Document the native ReleaseKit workflow 2026-11-23 18:16:15 +00:00
b031d35af7 Remove superseded release scripts and tests 2026-11-23 18:15:10 +00:00
ef4335cda3 Test ReleaseKit integration selections 2026-11-23 18:14:46 +00:00
8e5511b112 Use ReleaseKit for tag delivery 2026-11-23 18:13:42 +00:00
7ab594bc8b Add ReleaseKit profile and launcher 2026-11-23 18:13:25 +00:00
5776733ebd Adopt ReleaseKit runtime version and tool 2026-11-23 18:12:57 +00:00
aef88a9602 Plan native ReleaseKit adoption 2026-11-23 17:56:28 +00:00
0d0596b204 Document native ReleaseKit adoption 2026-11-23 17:48:29 +00:00
abaa3c78df Make the pure loader regression test detect bootstrap
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-23 17:24:16 +00:00
7f7033779c Simplify configuration acquisition and comparison guidance 2026-11-23 16:33:51 +00:00
bb15edc057 Record configured startup review finding 2026-11-23 16:33:48 +00:00
f04b6097b8 Complete configured startup integration review 2026-11-23 14:34:27 +00:00
c5970ff834 Align operator guidance with configured secrets startup 2026-11-23 14:31:49 +00:00
6026933b24 Update configuration and CLI startup documentation 2026-11-23 14:30:39 +00:00
43a7d398b6 Verify independent comparison startup 2026-11-23 14:29:39 +00:00
716869d553 Verify configured pipeline secrets startup 2026-11-23 14:28:02 +00:00
457b5a3976 Report configured bootstrap evidence at invocation completion 2026-11-23 14:25:50 +00:00
6175945230 Remove the secrets directory flag and update fixtures 2026-11-23 14:23:53 +00:00
a4491a8517 Prepare pipeline sources during acquisition 2026-11-23 14:19:21 +00:00
af3f49b644 Share native pipeline source selection and loading 2026-11-23 14:17:49 +00:00
14f33dde04 Update coordinated configuration dependencies 2026-11-23 14:16:51 +00:00
9fb0c6a994 Plan native configuration acquisition migration 2026-11-23 02:35:17 +00:00
b63bef2d43 Simplify configuration comparison acquisition 2026-11-23 02:29:19 +00:00
1d5dc370e8 Simplify the configuration adoption roadmap 2026-11-23 02:19:14 +00:00
c6214f6259 Adopt upstream dependency documentation guidance 2026-11-23 02:05:17 +00:00
04483a68e8 Plan upstream documentation deduplication 2026-11-23 01:03:24 +00:00
b1ef8e20b6 Include coordinated CommandKit upgrades in the ConfigKit roadmap 2026-11-23 01:02:15 +00:00
1701f0461f Document native ConfigKit startup adoption 2026-11-23 00:49:14 +00:00
b47cb35966 Remove completed CommandKit roadmap documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-20 15:29:55 +00:00
39b4bddbc9 Use native configuration validation and diagnostics 2026-11-20 15:22:57 +00:00
7e45ffca43 Classify invalid artifact relations as input errors 2026-11-20 13:48:55 +00:00
672b7f0ebd Use canonical source identities in publication reports 2026-11-20 13:45:17 +00:00
f44078724a Build publication report indexes once 2026-11-20 13:44:09 +00:00
af6cf8b6f1 Look up family identities without copying catalogs 2026-11-20 13:43:18 +00:00
7e65c29a61 Share provenance snapshots during catalog derivation 2026-11-20 13:42:11 +00:00
846f8470dc Keep source provenance out of prepare reuse decisions 2026-11-20 13:40:55 +00:00
32ff928786 Clarify optional spell catalog clearing 2026-11-20 13:39:20 +00:00
25c59ff62f Preserve campaign defaults in materialized sessions 2026-11-20 13:38:21 +00:00
38866110a7 Record CommandKit algorithm audit findings 2026-11-20 13:12:32 +00:00
65d24fb88f Record the party selection resume integration gap 2026-11-20 13:02:23 +00:00
8be65fd3a1 Record CommandKit migration review findings 2026-11-20 12:54:56 +00:00
0117f3f35d Verify native workflows and explain identity mismatches 2026-11-20 06:50:56 +00:00
0e9cbc9c2a Document the native CLI and migration workflows 2026-11-20 06:41:59 +00:00
faa8cb5822 Finish native completion and retire legacy command machinery 2026-11-20 06:32:47 +00:00
7db626781e Report audio, speaker, and artifact work progress 2026-11-20 06:04:34 +00:00
c523def852 Route console diagnostics and stage progress through native reporting 2026-11-20 05:59:09 +00:00
c7a5ff316d Propagate cancellation and preserve resumable state 2026-11-20 05:53:49 +00:00
a6c6f1e4ab Preserve partial run results and terminal failure causes 2026-11-20 05:47:41 +00:00
85df36a770 Add native restore and session cleanup commands 2026-11-20 05:41:16 +00:00
6b7a0847d4 Add native session initialization and remote lock commands 2026-11-20 05:29:27 +00:00
e44247b5b1 Report structured session validation and inspection results 2026-11-20 05:23:32 +00:00
97cced5d88 Expose native session planning and artifact catalogs 2026-11-20 05:15:43 +00:00
0238f82847 Install native run and artifact regeneration commands 2026-11-20 05:10:04 +00:00
ed29bdc473 Support independent native configuration comparisons and overrides 2026-11-20 05:06:26 +00:00
c3c6849bed Expose native configuration inspection scopes 2026-11-20 05:02:46 +00:00
1e67c429b7 Share lazy configuration and session acquisition 2026-11-20 04:54:12 +00:00
b537cb38ae Preserve derived publication and preparation evidence 2026-11-20 04:49:29 +00:00
065a615e5f Use derived artifact catalogs throughout planning and execution 2026-11-20 04:42:23 +00:00
6900cad104 Derive artifact catalogs from the selected party without changing configuration 2026-11-20 04:33:02 +00:00
c3e6245416 Complete session defaults within the ConfigKit lifecycle 2026-11-20 04:24:20 +00:00
16a4f7ee12 Retain authoritative pipeline and campaign load results 2026-11-20 04:17:29 +00:00
a3c58141a0 Adopt the native CommandKit application boundary 2026-11-20 04:13:05 +00:00
86692d58f9 Plan the CommandKit adoption sprint 2026-11-20 04:05:11 +00:00
bcbfc0fa4a Clarify progress and verbose reporting in the CommandKit roadmap 2026-11-20 03:46:30 +00:00
e476c08ea4 Consolidate the CommandKit adoption roadmap 2026-11-20 02:17:59 +00:00
8824ce330f Defer execution overrides to a reusable CommandKit binding 2026-11-20 01:17:56 +00:00
87142508e3 Record artifacts command family and pending override binding 2026-11-20 01:09:33 +00:00
7cc877ea7f Align configuration ownership policy with ADR 0003
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-20 00:46:06 +00:00
7ee362f1c3 Clarify configuration ownership and native inspection boundaries 2026-11-20 00:16:42 +00:00
084e6d178b Simplify CommandKit overrides and add party file selection 2026-11-19 18:53:26 +00:00
86ec48d2e4 Record delivery decisions and end-to-end sprint guidance 2026-11-19 18:16:43 +00:00
3868822277 Record diagnostics and invocation lifecycle decisions 2026-11-19 18:09:17 +00:00
d83c5f0062 Record agreed CommandKit reporting decisions 2026-11-19 17:50:25 +00:00
981eb6be8f Record native configuration override decisions 2026-11-19 16:24:52 +00:00
6b027873a5 Record session acquisition and selector decisions 2026-11-19 16:15:25 +00:00
d00cc8037d Record agreed configuration scopes and inspection views 2026-11-19 16:12:21 +00:00
b4b618a913 Record agreed CommandKit command organization 2026-11-19 16:01:02 +00:00
8ba001750e Record CommandKit migration direction and open decisions 2026-11-19 15:54:26 +00:00
fa9ed78a6d Remove completed ConfigKit planning documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-18 14:33:12 +00:00
4dae8e0d36 Stream verified prepared inputs into publication archives 2026-11-18 04:17:37 +00:00
35eaefd05d Read selected remote sessions directly without listing run history 2026-11-18 04:12:56 +00:00
f85f93bdfb Reuse party provenance within each inspection 2026-11-18 04:10:29 +00:00
0e34ea1d48 Reuse native source records and catalog source indexes 2026-11-18 04:09:24 +00:00
97a93d3393 Honor remote session authoring updates after publication 2026-11-18 04:08:43 +00:00
435ec79185 Initialize standalone sessions from native local authoring context 2026-11-18 04:06:29 +00:00
33d2ebf44c Pin Go attribution to the released source commit 2026-11-18 04:03:40 +00:00
e93fb8d5ab Record publish defaults and destinations at field level 2026-11-18 04:03:33 +00:00
69dc5cc8ec Make restore lock contention coverage independent of startup timing 2026-11-18 04:02:30 +00:00
5d62f9a88b Report effective resource contributors without superseded definitions 2026-11-18 03:59:09 +00:00
ba9079ee74 Record algorithmic refactoring opportunities 2026-11-18 01:10:44 +00:00
583c5bdf1b Record configuration integration audit findings 2026-11-18 00:30:09 +00:00
bccf03a99f Record ConfigKit migration review findings 2026-11-17 23:57:45 +00:00
39a958675d Verify native configuration workflows end to end 2026-11-17 22:49:22 +00:00
413b0d7134 Align configuration documentation with native loading 2026-11-17 22:42:53 +00:00
ff4bdaa483 Demonstrate native configuration authoring 2026-11-17 22:38:51 +00:00
ebcc5b32a0 Use native configuration diff and source evidence 2026-11-17 22:35:56 +00:00
ce661252d0 Render final configuration through native snapshots 2026-11-17 22:31:03 +00:00
ed7e722077 Publish and restore prepared session documents 2026-11-17 22:27:24 +00:00
bcfca7a044 Materialize effective campaign and session inputs 2026-11-17 22:21:55 +00:00
05f5607968 Render imported party rosters as canonical inputs 2026-11-17 22:18:57 +00:00
1657c9f65d Load campaign and session imports from their sources 2026-11-17 22:15:05 +00:00
c3023cb609 Resolve pipeline resources from their source locations 2026-11-17 22:09:58 +00:00
6593ccbeaf Use native pipeline discovery and independent secrets bootstrap 2026-11-17 22:06:29 +00:00
341fe93e3b Adopt ConfigKit and Go toolchain baseline 2026-11-17 21:59:19 +00:00
65d0e518e5 Plan the native ConfigKit migration 2026-11-17 20:41:34 +00:00
4a0e3c83db Record the agreed ConfigKit adoption decisions 2026-11-17 20:27:47 +00:00
f5451a0cf5 Outline native ConfigKit adoption and configuration ergonomics 2026-11-17 20:23:22 +00:00
381668568f Adopt the updated standard repository policies 2026-11-17 19:56:32 +00:00
8afb49c018 Record the ConfigKit configuration ownership boundary 2026-10-05 14:03:51 +00:00
535f47ef20 Cover inherited Notarius path resolution 2026-10-04 15:35:45 +00:00
dcb9bae215 Verify inherited configuration inspection commands 2026-10-04 15:33:16 +00:00
f1f71d8cdf Document native configuration inheritance 2026-10-04 15:25:48 +00:00
39af6ef941 Verify inherited credential safety 2026-10-04 14:41:34 +00:00
e1c934a492 Assert credential-safe projections survive rotation 2026-10-04 14:02:43 +00:00
dd760d84e0 Compare inherited effective pipeline values 2026-10-04 14:00:55 +00:00
6db49b3949 Verify inherited configuration semantics 2026-10-04 13:49:42 +00:00
f1672f6f95 Preserve composite ConfigKit provenance 2026-10-04 13:34:27 +00:00
428f435734 Accept composed ConfigKit artifact definitions 2026-10-04 13:10:53 +00:00
c4abdc19df Upgrade ConfigKit to v0.5.0 2026-10-04 12:53:29 +00:00
08327c2e63 Add documentation style guidance to the plan 2026-10-04 12:49:08 +00:00
2850498043 Simplify the ConfigKit adoption plan 2026-10-04 12:42:58 +00:00
fe9817f354 Plan the ConfigKit upgrade and workspace development 2026-10-04 12:28:09 +00:00
505 changed files with 33525 additions and 18789 deletions

1
.gitignore vendored
View File

@@ -25,6 +25,7 @@
# Go cache
.gocache
/dist/
# Go workspace file
go.work

View File

@@ -1,39 +1,56 @@
# Adapted from ReleaseKit v0.10.0 tag-delivery.yml.
matrix:
include:
- GO_IMAGE: golang:1.27.4-bookworm
when:
- event: tag
ref: refs/tags/v*
steps:
validate-release:
image: golang:1.26.7
commands:
- ./scripts/check-release-candidate.sh "$CI_COMMIT_TAG"
build-release-assets:
image: golang:1.26.7
depends_on:
- validate-release
- name: deliver
image: ${GO_IMAGE}
environment:
RELEASEKIT_GITEA_TOKEN:
from_secret: GITEA_RELEASE_TOKEN
commands:
- |
set -eu
case "$PWD" in
/*) ;;
*) echo "release workspace must have an absolute path" >&2; exit 1 ;;
esac
./scripts/build-release-assets.sh "$CI_COMMIT_TAG" "$PWD/dist"
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)"
publish-release:
image: woodpeckerci/plugin-release:0.3.1
depends_on:
- build-release-assets
settings:
api_key:
from_secret: GITEA_RELEASE_TOKEN
files:
- dist/narratio-*
title: Narratio ${CI_COMMIT_TAG}
note: docs/releases/${CI_COMMIT_TAG}.md
checksum: sha256
checksum-file: SHA256SUMS
checksum-flatten: true
file-exists: skip
overwrite: false
prerelease: false
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

@@ -3,6 +3,6 @@ when:
steps:
shuffled-race-tests:
image: golang:1.26
image: golang:1.27.4
commands:
- go test -race -shuffle=on -count=3 ./...

View File

@@ -3,30 +3,30 @@ when:
steps:
tests:
image: golang:1.26
image: golang:1.27.4
commands:
- go test ./...
race-tests:
image: golang:1.26
image: golang:1.27.4
depends_on: tests
commands:
- go test -race ./...
static-analysis:
image: golang:1.26
image: golang:1.27.4
depends_on: tests
commands:
- go vet ./...
build:
image: golang:1.26
image: golang:1.27.4
depends_on: tests
commands:
- go build ./...
cross-build:
image: golang:1.26
image: golang:1.27.4
depends_on: [race-tests, static-analysis, build]
commands:
- |

View File

@@ -5,7 +5,8 @@ polished transcripts, validated Notarius extraction lanes, and generated
artifacts.
It runs a deterministic workflow with manifest-driven continuation, remote
publish, and restore support.
publish, and restore support. Its CommandKit CLI provides native configuration
inspection, structured operation reports, progress, and shell completion.
```sh
narratio run 2026-04-04

View File

@@ -1,11 +1,22 @@
package main
import (
"context"
"os"
"os/signal"
"syscall"
"go.maximumdirect.net/commandkit"
"gitea.maximumdirect.net/eric/narratio/internal/app"
)
func main() {
os.Exit(app.Execute(os.Args[1:], os.Stdout, os.Stderr))
os.Exit(runProcess(os.Args[1:], commandkit.Streams{Out: os.Stdout, Err: os.Stderr}, app.Execute))
}
func runProcess(args []string, streams commandkit.Streams, execute func(context.Context, []string, commandkit.Streams) commandkit.Outcome) int {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
return execute(ctx, args, streams).Status
}

56
cmd/narratio/main_test.go Normal file
View File

@@ -0,0 +1,56 @@
package main
import (
"bufio"
"context"
"fmt"
"os"
"os/exec"
"syscall"
"testing"
"time"
"go.maximumdirect.net/commandkit"
)
func TestProcessSignalsCancelInvocation(t *testing.T) {
if os.Getenv("NARRATIO_TEST_SIGNAL_CHILD") == "1" {
os.Exit(runProcess(nil, commandkit.Streams{Out: os.Stdout, Err: os.Stderr}, func(ctx context.Context, _ []string, streams commandkit.Streams) commandkit.Outcome {
fmt.Fprintln(streams.Out, "ready")
<-ctx.Done()
return commandkit.Failure("interrupted").WithCause(ctx.Err())
}))
}
for _, sig := range []os.Signal{os.Interrupt, syscall.SIGTERM} {
t.Run(sig.String(), func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
child := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestProcessSignalsCancelInvocation$")
child.Env = append(os.Environ(), "NARRATIO_TEST_SIGNAL_CHILD=1")
out, err := child.StdoutPipe()
if err != nil {
t.Fatal(err)
}
child.Stderr = os.Stderr
if err := child.Start(); err != nil {
t.Fatal(err)
}
scanner := bufio.NewScanner(out)
if !scanner.Scan() || scanner.Text() != "ready" {
_ = child.Process.Kill()
_ = child.Wait()
t.Fatal("child failed to register its signal context")
}
if err := child.Process.Signal(sig); err != nil {
_ = child.Process.Kill()
_ = child.Wait()
t.Fatal(err)
}
err = child.Wait()
exit, ok := err.(*exec.ExitError)
if !ok || exit.ExitCode() != 1 {
t.Fatalf("child result=%v, want operational exit 1", err)
}
})
}
}

View File

@@ -0,0 +1,84 @@
# 0001. Classify session content by purpose and lifecycle
## Status
Accepted
## Date
2026-11-29
## Context
Narratio coordinates applications that produce transcripts, artifacts,
diagnostics, and working files. The current session layout mixes some of these
roles, including complete Notarius bundles under `artifacts/`. Operators use
transcripts and artifacts to evaluate results during development and need
predictable locations for diagnostics.
A shared classification model will guide the workspace design and subsequent
adapter changes. The [operator guide](../operations.md#local-state-layout)
describes the implemented layout.
## Decision
Classify content by its primary purpose and lifecycle:
| Category | Purpose |
| --- | --- |
| Inputs | Material consumed by an application, including audio, configuration, and reference documents. |
| Outputs | Completed substantive products, including intermediate artifacts exposed for further use. |
| Logs | Records of execution, including process logs, execution reports, warnings, and diagnostic summaries. |
| Cache | Reusable information whose absence permits ordinary recomputation or retrieval. |
| State | Application condition, progress, recovery records, and unfinished work. |
Classification is relative to the consuming application. An output of one stage
can serve as an input to another while retaining its output location. Completed
outputs reused to skip work remain Outputs. Narratio's manifest is State and
records whether those outputs are reusable.
Classify checkpoints according to their recovery behavior. A checkpoint needed
to continue a particular interrupted operation is State. A saved work result
that can be reused or recomputed is Cache. Recomputation cost informs retention
policy. File-specific classification remains necessary for stores serving both
purposes.
Treat Debug as a capture and retention mode that can include detailed Logs,
snapshots of State, and other diagnostic evidence. Retained debug snapshots have
a diagnostic role; live recovery records retain their State role.
Apply these directory principles to Narratio:
- Store completed artifacts, including intermediate artifacts like
`session_bounds.json`, directly in a flat `artifacts/` directory.
- Store combined transcripts directly in `transcripts/`, with a subdirectory
for the initial per-speaker transcripts.
- Store prepared external audio in `audio/` and other prepared external inputs
in `inputs/`.
- Organize Logs under `logs/` by stage. Execution reports belong to this category.
- Organize Cache under a cache root by the application that owns its format and
reuse behavior.
- Treat scratch files and unfinished outputs as State until completion permits
promotion to Outputs.
## Alternatives Considered
- Group outputs by producer. This exposes subprocess packaging to operators;
flat artifact and transcript locations better support comparison and review.
- Group Logs by application. Stage names match the operator's workflow and
collect diagnostics from stages that invoke multiple applications.
- Classify all checkpoints as State. Recovery behavior provides a more useful
distinction for eviction and reuse decisions.
- Treat all Debug material as Logs. A separate debug location can accommodate
retained state snapshots and larger diagnostic bundles when needed.
## Consequences
Each managed file family needs an identified role, owner, scope, and retention
rule. Subprocess bundles require classification before their contents are
placed in Narratio's output and diagnostic directories.
The [workspace reference](../operations.md#local-state-layout) defines the selected
physical layout, latest-attempt views, retention boundaries, and new-session cutover.
Current versus historical views remain separate from content categories.
Acceptance of this policy does not establish implementation of that layout.

View File

@@ -0,0 +1,77 @@
# 0002. Assign subprocess content ownership
## Status
Accepted
## Date
2026-11-29
## Context
[ADR 0001](0001-classify-session-content.md) defines content categories and
operator-facing directory principles. Narratio also needs an ownership boundary
for the applications it invokes. That boundary determines who selects locations,
manages retained files, and controls cleanup.
Subprocesses have their own execution state and reusable caches. Narratio
maintains its own session progress and recovery records.
## Decision
Assign responsibility by content category:
| Category | Responsibility |
| --- | --- |
| Inputs | Narratio supplies paths to prepared inputs, transcripts, and artifacts. |
| Outputs | Narratio selects destinations and promotes completed products into the output locations defined by ADR 0001. |
| Logs | Narratio selects stage-based destinations and captures subprocess output streams. |
| Debug | Narratio selects the destination when capture is enabled; the subprocess defines the diagnostic contents. |
| Subprocess State | Each application manages its working directory, temporary files, and execution lifecycle through its own configuration and defaults. |
| Subprocess Cache | Each application manages its configured persistent cache, including its format, identity, and reuse behavior. |
Narratio retains ownership of its own State, including the session manifest,
recovery bookkeeping, and staging files it manages.
Recommend a dedicated cache root for each cache-aware application, configurable
through that application's supported controls. For system-wide deployments,
`/var/cache/<application>` is a suggested location; `/var/cache/notarius` is an
example for Notarius. Each application defines its cache configuration, defaults,
and internal layout. Operators select locations and retention settings through
those controls. Narratio's session cleanup leaves subprocess caches under their
separate lifecycle policies.
Subprocesses retain ownership of their file formats and bundle structures.
Narratio can receive a complete result bundle at a selected staging destination
and promote the selected products into its canonical output directories.
Diagnostic snapshots of subprocess State follow the Debug destination selected
by Narratio.
Narratio's `runs/` directory can hold staging outputs and retained execution
evidence. Subprocess working directories follow the application's configuration
and may reside elsewhere. Narratio cleanup manages Narratio-owned material;
subprocess State and Cache follow their separate lifecycle policies.
## Alternatives Considered
- Place all subprocess working files and caches inside each Narratio session.
This makes sessions easier to collect as a unit, but couples application
internals and cache retention to Narratio's session lifecycle.
- Allow subprocesses to choose output, log, and debug destinations independently.
This simplifies invocation but scatters the material operators inspect.
- Give Narratio control of downstream bundle formats. This simplifies some
destination mappings but increases integration coupling. Selecting and
promoting products preserves application ownership of those formats.
## Consequences
Adapters need supported controls for Narratio-selected output, log, and debug
locations. Upstream changes may be needed where those destinations are coupled
to application working directories or to one another.
Workspace layout and file classification remain independent of subprocess
working-directory conventions. The
[workspace reference](../operations.md#local-state-layout) defines debug
placement, retained diagnostic views, and the new-session cutover.
Acceptance of this policy does not establish implementation of those changes.

View File

@@ -0,0 +1,38 @@
# 0003. Assign configuration ownership
## Status
Accepted
## Date
2026-11-19
## Context
Configuration loading, inspection, and domain execution need explicit ownership
so that effective configuration has one authority.
## Decision
- **ConfigKit owns configuration policy and resolution through the final
handoff.** Narratio supplies its schema, defaults, and configuration rules
through ConfigKit's supported extension points. The completed ConfigKit
result is authoritative.
- **Narratio owns domain interpretation and execution.** It consumes the
completed configuration without mutation and produces separate domain
objects. It must not construct a replacement effective configuration.
- **CommandKit owns CLI mechanics and presentation; `ckconfig` exposes
ConfigKit's inspection features.** Narratio supplies selection and acquisition
wiring and exposes those features through native adapters, without altering
their semantics or substituting its own inspection views.
## Alternatives Considered
Post-handoff configuration resolution and custom inspection projections are
rejected because they create competing configuration authorities.
## Consequences
Domain catalogs and plans remain separate from native configuration inspection.
Missing configuration or inspection capabilities are addressed upstream.

View File

@@ -1,485 +1,439 @@
# CLI Reference
## Shortest Useful Command
```bash
narratio run 2026-04-04
```
This runs the canonical full pipeline for session `2026-04-04`.
## Command Overview
Top-level commands:
- `version`: print the Narratio build version.
- `run <session_id>`: run all or one contiguous range of the canonical stage order.
- `regenerate-artifacts <session_id>`: force-run extraction through analysis.
- `run-stage <stage> <session_id>`: run one stage.
- `analyze <session_id>`: force-run analyze.
- `publish <session_id>`: force-run publish.
- `clean <session_id>` or `clean --all`: remove local work/spool state.
- `session <subcommand>`: session helper commands.
- `config <subcommand>`: validate, display, source-trace, catalog, or compare resolved pipeline configuration.
Session subcommands:
- `session init <session_id>`
- `session plan <session_id>`
- `session validate <session_id>`
- `session status <session_id>`
- `session restore <session_id>`
- `session artifacts <session_id>`
- `session locks <session_id>`
- `session locks add <session_id> <source>`
- `session locks remove <session_id> <source>`
## Common Config Flags
Most session-aware commands accept:
- `--config <pipeline.yml>`
- `--campaign <id>`
- `--campaign-file <campaign.yml>`
- `--session <session.yml>`
- `--session-id <session_id>`
- `--previous-session-id <session_id>`
- `--overlay <name>`
- `--secrets-dir <directory>`
Rules:
- `--campaign` and `--campaign-file` are mutually exclusive.
- `--session` is not used by `session init`.
- if both positional `<session_id>` and `--session-id` are provided, values must match.
- `--previous-session-id` is a strict expectation: the selected session file
must contain the same `previous_session_id`.
- `--overlay` selects `overlays/<name>.yml` relative to the pipeline root. It
may be supplied once; omitted, empty, and the exact name `default` select the
base configuration, while an unknown named overlay fails. The same selection
applies to all common-flag commands, including `regenerate-artifacts`.
- `--secrets-dir` selects ConfigKit credential-file bootstrap explicitly. A
relative value uses caller CWD. Without the flag, a present `secrets/`
directory beside the resolved root pipeline is used; an absent one is skipped.
- `clean --all` cannot be combined with campaign/session selectors.
- notification delivery is currently limited to the configured `noop` mode; see
the [configuration reference](./config.md#notifications).
## Session ID Input Rules
Session-aware commands accept one of these forms:
- positional session ID: `... <session_id>`
- compatibility flag: `... --session-id <session_id>`
When both are present, command parsing requires an exact match.
Commands with additional positionals keep their command-specific order:
- `run-stage <stage> <session_id>` or `run-stage <stage> --session-id <session_id>`
- `session locks add <session_id> <source>` or `session locks add --session-id <session_id> <source>`
- `session locks remove <session_id> <source>` or `session locks remove --session-id <session_id> <source>`
## Command Reference
### `config validate`, `config show`, `config sources`, `config artifacts`, and `config diff`
```bash
narratio config validate [--config <pipeline.yml>] [--campaign <id> | --campaign-file <campaign.yml>] [--overlay <name>] [--secrets-dir <directory>]
narratio config show [--config <pipeline.yml>] [--campaign <id> | --campaign-file <campaign.yml>] [--overlay <name>] [--secrets-dir <directory>]
narratio config sources [--config <pipeline.yml>] [--campaign <id> | --campaign-file <campaign.yml>] [--overlay <name>] [--secrets-dir <directory>]
narratio config artifacts [--config <pipeline.yml>] [--campaign <id> | --campaign-file <campaign.yml>] [--overlay <name>] [--secrets-dir <directory>]
narratio config diff <left-overlay> <right-overlay> [--config <pipeline.yml>] [--campaign <id> | --campaign-file <campaign.yml>] [--secrets-dir <directory>]
```
These commands resolve the selected overlay, defaults, ordinary paths, and—if
a campaign is selected—the campaign-owned party. They neither discover or load
a session nor create a workspace, manifest, run, lock, adapter, or remote
connection. Like every pipeline-loading command, they bootstrap the selected or
conventional secrets directory before resolving configuration; `config show`
never includes bootstrap reports or secret values in its YAML output.
Typed credential references, including `notarius.credentials[]`, must therefore
resolve even though these inspection commands never construct an adapter.
Campaign selection is optional for a pipeline without party-driven artifact
families. A pipeline with `scriptorium.artifact_families` needs a selected or
configured default campaign so Narratio can expand its concrete artifacts and
publish rules. `--campaign` and `--campaign-file` remain mutually exclusive.
Session, range, force, and artifact-execution flags are not accepted.
`config validate` writes a concise root-path, selected-overlay (or `none`), and
effective-digest summary after successful complete validation. `config show`
writes one deterministic, secret-free YAML document containing defaulted and
expanded concrete configuration. It omits ConfigKit directives, artifact
family declarations, and runtime provenance.
`config sources` reports the same fully validated resolution without printing
effective values. Its header identifies the root, ordered imports, selected
overlay and its file, selected campaign, party source, and digest. The
remaining tab-separated records are sorted as `path`, `role`, and `source`.
Roles distinguish root, import, overlay, centralized default, campaign, party,
and generated family ownership. A generated party member has
one family record and one party record at the same logical path. The output
never reads or prints secret values.
`config artifacts` prints the concrete catalog used by analysis, ordered by
artifact key. Its tab-separated header is `key`, `source`, `definitions`,
`enabled`, `output`, `dependencies`, `family`, `character`, `family_source`, and
`party_source`. Definitions and effective dependencies are sorted comma-separated
lists, and control characters in fields are escaped. Family-member rows identify
their family, character, defining family file, and party file. An empty catalog
prints only the header. Ordinary artifacts can be inspected without a campaign;
party-driven families retain the campaign requirement. See
[Scriptorium Artifact Entries](./config.md#scriptorium-artifact-entries) for the
configuration layout.
`config diff` resolves both supplied overlay names independently and compares
their fully resolved, secret-free effective mappings. It does
not accept `--overlay`; the two positional names must be distinct, valid
overlays. When party-driven families are present, both overlays must resolve to
the same selected campaign and party. Use `--campaign-file` if overlay-specific
campaign configuration would otherwise select different files.
Equal overlays print `no differences`. Otherwise, sorted tab-separated records
use one of these forms, with compact JSON values:
## Command tree
```text
added <path> <right-value>
removed <path> <left-value>
changed <path> <left-value> <right-value>
narratio
├── run SESSION
├── preflight SESSION
├── artifacts
│ ├── list
│ └── regenerate SESSION
├── session
│ ├── init SESSION
│ ├── plan SESSION
│ ├── status SESSION
│ ├── restore SESSION
│ ├── clean [SESSION | --all]
│ ├── artifacts SESSION
│ └── locks
│ ├── list SESSION
│ ├── add SESSION SOURCE
│ └── remove SESSION SOURCE
├── config
│ ├── scopes
│ ├── validate
│ ├── show
│ ├── sources
│ ├── explain
│ └── diff
├── version
├── completion bash|zsh|fish
└── help [COMMAND...]
```
Mappings are flattened to their logical field paths; lists remain one atomic
value. The command compares defaulted concrete artifacts and publish rules, not
overlay names, source-file layout, or formatting. It succeeds when differences
are found, making it suitable for review and migration checks.
Bare root and command groups display help. Use `narratio help session plan`
or `narratio session plan --help` for command-local flags and operands. Help,
version, completion, and `config scopes` do not bootstrap credentials, load
configuration, contact storage, or initialize adapters.
### `version`
## Invocation syntax
```bash
narratio version
Place flags after the complete command path; they may be interspersed with
operands. Use command help for installed flags. The [CommandKit CLI contract](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#registered-command-syntax)
describes parsing, repetition, and boolean values. Narratio additionally
normalizes repeatable `--artifacts` selections as described below.
## Configuration selectors
| Selector | Meaning |
| --- | --- |
| `--config PATH` | Exact pipeline root, regardless of configuration scope; omission uses discovery. |
| `--overlay NAME` | Pipeline overlay; omitted, empty, or `default` selects the base. |
| `--campaign ID` | Select and assert the effective campaign identity. |
| `--campaign-file PATH` | Exact campaign source; may accompany its identity assertion. |
| `--session ID` | Session identity for native configuration inspection only. |
| `--session-file PATH` | Exact session source; domain commands use positional `SESSION` as the identity assertion. |
| `--party-file PATH` | Select the canonical roster instead of the campaign's default file. |
| `--previous-session-id ID` | Assert the configured previous-session identity on applicable domain commands. |
Explicit relative file/directory paths use the invocation directory. Explicit
file errors and identity mismatches fail without fallback. A file selects the
source; an identity asserts its effective ID after resolution. File-only
configuration inspection may obtain identity from the file. Selecting a party
file does not rewrite the campaign's party setting; the selected roster feeds
players, family expansion, planning, and execution consistently.
Selectors are installed only where applicable; command help lists them.
`session init` creates new input and therefore has no existing-session-file
or party-file selection. `session clean --all` accepts pipeline/overlay
selection and rejects campaign, session, party, and previous-session selectors.
When no explicit session file is selected, local discovery precedes remote
acquisition. Only local absence permits remote fallback, with a known identity.
Remote loading prefers authored session-root YAML, then the current commit's
prepared snapshot only when the authored object is absent. Read-only commands
may perform these reads without initializing runtime state. See
[discovery](config.md#discovery-and-selection) and
[credential bootstrap](config.md#secrets-handling) for configuration details.
## Run
```sh
narratio run SESSION
narratio run SESSION --from extract --through analyze
narratio run SESSION --stage analyze --force --artifacts session_recap
```
Official release binaries report their exact Git tag. Binaries built directly
from source without release linker metadata report `dev`.
The default is the full canonical pipeline:
`prepare`, `transcribe`, `merge`, `polish`, `normalize`, `trim`, `render`,
`extract`, `analyze`, `publish`, `notify`, `cleanup`.
`--from` and `--through` select inclusive contiguous bounds. `--stage` selects
one stage and cannot accompany explicitly supplied range flags. `--force`
reruns selected work; dependent invalidation can extend beyond that range.
Bounded starts require valid preceding manifest state. Ordinary execution uses
semantic resume checks rather than rerunning all selected work.
### `run`
After preparation, `run` checks projected Audita, Notarius, and Scriptorium work before
processing continues. Failed checks stop the invocation; prompt warnings alone
do not. `artifacts regenerate` uses the same check.
See [operations](operations.md#prompt-requirements-preflight) for recovery.
```bash
narratio run <session_id> [--from <stage>] [--through <stage>] [--force] [--artifacts <name[,name...]>] [...common config flags]
Analysis-only rebuilding uses `run SESSION --stage analyze --force`; it does
not refresh extraction. Publishing alone uses `run SESSION --stage publish`,
adding `--force` when a rerun is intended. It does not schedule cleanup. See
[operations](operations.md#artifact-development-workflows) for regeneration workflows.
## Artifacts regenerate
```sh
narratio artifacts regenerate SESSION
narratio artifacts regenerate SESSION --artifacts session_recap,player_handout
```
Behavior:
Forces the fixed inclusive `extract` through `analyze` range. It refreshes the
whole configured Notarius extraction bundle and chunk work, then selected
analysis targets and required prerequisites. `--artifacts` narrows analysis,
not extraction lanes. Publication, notification, and cleanup are outside this
range. Independent `--from`, `--through`, `--stage`, and `--force` flags are
not installed on this command. It accepts applicable context selectors and
returns the same run report as `run`.
- evaluates one inclusive contiguous range of the canonical stage order;
- defaults an omitted `--from` to `prepare` and an omitted `--through` to
`cleanup`, so omitting both retains full-pipeline behavior;
- rejects unknown endpoints and a `--from` endpoint after `--through`;
- runs `render` before `extract`; an omitted or disabled Notarius
configuration records an explicit `notarius_disabled` self-skip;
- resolves every selected typed credential during the initial configuration
load, including Notarius credentials when extract is disabled, outside the
selected range, or later skipped as resumable;
- skips already-succeeded stages unless `--force` is set or a stage-specific
resume check finds its durable result obsolete;
- applies `--force` only to stages in the selected range;
- rejects repeated `--from`, `--through`, or `--force` options, including
`--name=value` spellings;
- continues interrupted or partially completed sessions by running non-succeeded stages;
- writes the session manifest as the sole durable progress ledger. Each
invocation also creates its run-local directory and returns an immediate
command summary; neither creates another durable progress record.
- reports the resolved overlay (or `none`) and effective configuration digest.
## Artifacts list
When `--artifacts` is present, the selected range must contain `analyze` or
`publish`. Either consumer is sufficient, including a one-stage range.
### `regenerate-artifacts`
```bash
narratio regenerate-artifacts <session_id> [--artifacts <name[,name...]>] [...common config flags]
```sh
narratio artifacts list --config pipeline.yml --campaign-file campaign.yml
```
Exactly equivalent to:
Lists domain definitions: source identities, producers, outputs, dependencies,
and selected-party family/member provenance. It acquires the context needed to
derive that catalog, without requiring a session solely for listing definitions.
It does not add generated members to native `config show` output.
```bash
narratio run <session_id> --force --from extract --through analyze [caller options]
## Session plan
```sh
narratio session plan SESSION --stage analyze --force --format json
```
The command always reruns extraction. Analysis rebuilds the selected configured
artifacts and any prerequisites required by those targets; without
`--artifacts`, it uses the normal default analysis selection. Publish and notify
never run. Common session/configuration options and repeatable artifact values
pass through unchanged.
Accepts the same stage/range, force, artifact, and context selections as `run`.
Reports execution/reuse actions and reasons, analysis targets, prerequisite work,
and publication mappings through shared planners. Planning reads existing state
without creating a workspace, changing manifests, acquiring execution locks, or
initializing stage adapters or invoking requirements inspection. It does not
predict unknown output identities.
The forced extraction rebuilds the complete configured Notarius bundle,
disables Notarius checkpoint loading, and requests chunk-plan refresh.
`--artifacts` narrows only the analysis work; it never selects Notarius lanes.
## Preflight
Because the expansion owns `--force`, `--from`, and `--through`, callers cannot
supply those options. The shared `run` parser reports them as duplicate
singleton flags. The alias has no private execution options or behavior, and
runtime diagnostics may identify the operation as `run`.
### `run-stage`
```bash
narratio run-stage <stage> <session_id> [--force] [--artifacts <name[,name...]>] [...common config flags]
```sh
narratio preflight SESSION --session-file ./session.yml
narratio preflight SESSION --format json
```
Valid stage names:
Preflight resolves the same session and configuration selectors as `run`,
prepares or reuses inputs, and checks enabled downstream capabilities and
prompt prerequisites even when their processing outputs are reusable. It may
create a workspace, download inputs, update the manifest, and contact providers.
It stops before processing and publication. Required failures or blocked
checks prevent readiness; conditional or incomplete prompt discovery can warn
without failing. Preparation remains reusable after a later readiness failure.
See [operations](operations.md#prompt-requirements-preflight) for details.
- `prepare`
- `transcribe`
- `merge`
- `polish`
- `normalize`
- `trim`
- `render`
- `extract`
- `analyze`
- `publish`
- `notify`
- `cleanup`
## Session status
Rules:
- `--artifacts` is accepted only for `analyze` and `publish` stage targets.
### `analyze`
```bash
narratio analyze <session_id> [--artifacts <name[,name...]>] [...common config flags]
```sh
narratio session status SESSION --format json
```
Equivalent to:
Reports local manifest stages and artifacts, configuration provenance, readiness,
and remote current state when storage is available. Remote output entries retain
exact committed declarations and carried-output origins separately from current
configured destinations. An absent remote current pointer is a reported missing
state, rather than an error by itself. Genuine inspection failures can return a
partial report with a failed outcome.
```bash
narratio run-stage analyze <session_id> --force [...common config flags]
## Session artifacts
```sh
narratio session artifacts SESSION --remote
```
This selects only `analyze`: it does not invoke Notarius, replace extraction,
or remove existing extract outputs. `--artifacts` narrows the forced analysis
targets and their required analysis prerequisites.
Reports definitions, dependencies, local availability/evidence, and optional
remote publication state without reading artifact payload bodies. Without
`--remote`, this command avoids remote artifact inspection. Current publication
outcomes include `published`, `carried_locked`, `locked_unpublished`,
`optional_missing`, and `unselected`.
### `publish`
## Session init
```bash
narratio publish <session_id> [--artifacts <name[,name...]>] [...common config flags]
```sh
narratio session init SESSION --output ./session.yml --audio-dir ./audio
narratio session init SESSION --remote --audio-s3-prefix audio/session/
```
Equivalent to:
Choose exactly one destination: `--output PATH` or `--remote`. Options include
`--date YYYY-MM-DD`, `--title TEXT`, `--previous-session-id ID`, `--force`,
configuration/overlay/campaign selectors, and exactly one audio override
if needed: `--audio-dir PATH` or `--audio-s3-prefix PREFIX`.
```bash
narratio run-stage publish <session_id> --force [...common config flags]
A configured session template retains its import/resource authoring context;
relative CLI audio paths use the invocation directory. Generated YAML is
standalone and concrete. `--format` changes only the confirmation report,
never the generated YAML file. See [initialization](operations.md#session-initialization).
## Session restore
```sh
narratio session restore SESSION --dry-run
narratio session restore SESSION --force --include-audio
```
This command selects only `publish`; it does not invoke cleanup. Use a normal
full run to include configured cleanup, or `run-stage cleanup` to retry cleanup
from valid publication evidence.
Uses pointer-selected committed state and returns actions/conflicts. Dry runs
make no local directory or mode changes. Actual restore preserves confined
replacement, transition locking, incomplete-restore recovery markers, and
manifest-last installation. `--force` permits replacement only of eligible
regular files. The public report is separate from the persisted restore
execution report. See [restore operations](operations.md#restore-workflow).
### `clean`
## Session clean
```bash
narratio clean <session_id> [--dry-run] [--clear-cache] [...common config flags]
narratio clean --all [--dry-run] [--clear-cache] [--config <pipeline.yml>]
```sh
narratio session clean SESSION --dry-run
narratio session clean --all --dry-run
```
Behavior:
Choose positional `SESSION` or `--all`. Removes the selected local workspace
state. Dry runs return planned
actions without deletion. Partial failures retain completed actions. This manual
operation is separate from the pipeline cleanup stage. Exact scope and recovery
implications belong in [cleanup operations](operations.md#cleanup).
- session mode removes the selected session's local work and spool state;
- `--all` removes all local session work and spool state;
- cache remains unless `--clear-cache` is provided.
## Session locks
See [Operations: Cleanup](./operations.md#cleanup) for manual and pipeline-stage
deletion scope.
### `session plan`
```bash
narratio session plan <session_id> [--from <stage>] [--through <stage>] [--force] [--artifacts <name[,name...]>] [...common config flags]
```sh
narratio session locks list SESSION
narratio session locks add SESSION narratio.artifact.session_recap --reason 'manual review'
narratio session locks remove SESSION narratio.artifact.session_recap
```
Uses the same inclusive bounds, endpoint validation, force scope, and artifact
selection contract as `run`. It validates config and prints run/skip decisions
for selected stages only without creating the local workdir or changing the
manifest. Resume-capable selected stages are checked against durable evidence.
The output includes the resolved overlay (or `none`) and effective configuration
digest without writing provenance or any manifest state.
For `analyze`, the preview also lists explicit targets, prerequisite-only work,
execution order, and reusable current artifacts with concise reasons. These
artifact decisions come from the same reconciliation and work planner used by
execution; the preview does not predict output identities.
A bare locks group displays help. List reports independent remote locks sorted
by source. Add reports an existing lock unless `--force` requests one
conditional, generation-matched replacement; concurrent change requires retry.
Remove is idempotent. `--reason TEXT` is available on add. See
[publish locks](operations.md#publish-locks) for their publication effect.
### `session validate`
## `--artifacts` selection rules
```bash
narratio session validate <session_id> [...common config flags]
`run`, `session plan`, and `artifacts regenerate` accept repeatable
`--artifacts NAME[,NAME...]`. Values are trimmed, deduplicated, and sorted.
Family keys select all concrete members; concrete keys select one member.
Analysis includes required prerequisite closure. Publication selects applicable
configured artifact outputs. The option requires a selected analysis or publish
consumer and does not select built-in output sources or individual extraction
lanes. See [artifact configuration](config.md#scriptorium-artifact-families).
## Configuration inspection
`config scopes` lists operations and features without loading. The four scopes
are `app` (default), `campaign`, `session`, and `party`. They expose their actual
typed ConfigKit results, with native provenance, resolution history, and safe
secret views. App inspection needs no campaign/party expansion. Domain catalogs
and execution plans are separate views.
```sh
narratio config show --scope app --format json
narratio config show --scope session --session SESSION --session-file ./session.yml
narratio config show --scope party --party-file ./party.yml
narratio config show --path /scriptorium --format yaml
narratio config sources --scope campaign --campaign-file ./campaign.yml
narratio config explain --path /scriptorium --format json
narratio config explain --list --under /scriptorium --historical
narratio config validate --details --severity error
```
Read-only preflight checks for config validity, required inputs, audio mode,
previous-session requirements, publish outputs, and independent remote locks.
Use native show, sources, explain, and validation operations; their options,
path syntax, findings, and report shapes are described in the
[CommandKit configuration contract](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#configuration-scopes).
`--scope all` is supported for show and validate and requires applicable context
for every reached scope. Domain catalog and plan views remain separate.
### `session status`
### Independent comparisons and overrides
```bash
narratio session status <session_id> [...common config flags]
```sh
narratio config diff --config pipeline.yml --against-config pipeline.yml --against-overlay testing --details --check
narratio config diff --scope party --party-file before.yml --against-party-file after.yml
narratio config show --scope app --set '/whisperx/concurrency=2'
```
Prints local manifest state and, when storage is available, status for the
pointer-selected remote commit and its declared published outputs. Current
publish metadata reports `published`, `carried_locked`, `locked_unpublished`,
`optional_missing`, and `unselected`; carried output lines include the run
derived from their exact declared key, the key itself, and its declared
destination. A separately displayed `dest` is the destination requested by the
current configuration and may differ while an older declaration is locked.
Diff loads each side independently. In addition to native `--against-config`
and `--against-overlay`, applicable scopes accept `--against-campaign`,
`--against-campaign-file`, `--against-session`, `--against-session-file`, and
`--against-party-file`. Omitted right-side selectors use their own normal
defaults; they never inherit left-side selections. Each party default follows
that side's campaign.
### `session init`
Each reached pipeline side performs its own configured startup; both sides use
the process environment. See the [native comparison contract](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#compare-configuration-selections)
for report and comparison semantics.
```bash
narratio session init <session_id> --output ./session.yml [options]
narratio session init <session_id> --remote [options]
Only app inspection supports ordered, repeatable `--set POINTER=JSON`, plus
`--against-set POINTER=JSON` for the comparison side. ConfigKit applies these
during that load. They affect only that invocation. Other scopes and aggregate
inspection reject overrides. Execution/planning use files and overlays;
they have no field-override flags.
## Reporting and visibility
Reports go to stdout; diagnostics and progress go to stderr. Domain commands
return one final public report where useful, including meaningful partial work
on failure. `--format text|yaml|json` selects presentation. Automatic structured
reports use YAML; text uses the same data. Version and native inspection commands
may have native text renderers. Report format does not change artifact formats.
There is no public report schema-version field.
[CommandKit reporting](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#reporting) defines formats and visibility controls.
Bootstrap evidence is presented as final diagnostics on stderr, independently
of the substantive command report and its `--format` selection.
Progress covers stage transitions/reuse, audio transfers/cache reuse, and
individual durable speaker/artifact checkpoints and validated reuse. Info adds
selected sources, destinations, and decision context. Concurrent completion
order is not fixed. Workers settle before the final report.
Console debug does not enable downstream debug captures or change retention.
Downstream streams stay in captured logs and are not replayed automatically.
Quiet changes visibility, not execution, persistence, or logging. A report or
diagnostic delivery failure can fail the invocation after durable work has
completed; it does not roll back that work.
### Public domain report fields
Optional fields appear when meaningful; these reports do not expose raw
manifests, resolved credentials, or internal dependency containers.
| Report | Fields |
| --- | --- |
| Run/regenerate | `campaign`, `session_id`, `run_id`, `stages`, `executed`, `skipped`, `stage_results`, `available_artifacts`, `artifact_targets`, `complete` |
| Plan | `campaign`, `session_id`, `stages` with `name`, `action`, `reason`, optional `analysis`; `publication_actions` |
| Catalog | `artifacts` with source, producer, output, enabled state, dependencies, optional concrete key and family/member/source provenance |
| Preflight | `campaign`, `session_id`, optional `session_source` and `run_id`, `preparation` with outcome and optional reason, `ready`, `checks` with group, outcome and optional message, `findings` with severity, category and message |
| Status/artifacts | Identities/source, `local_manifest`, `stages`, `artifacts`, optional `remote`, configuration provenance, audio/previous-artifact readiness, `findings` |
| Init | `campaign`, `session_id`, `destination`, `remote`, `written` |
| Locks | Identities, `operation`, `result`, `complete`, optional `source`, `locks` |
| Restore | Identities/run, `dry_run`, `complete`, `status`, `downloaded`, `conflicts`, `actions` |
| Clean | Optional identities, `all`, `dry_run`, `complete`, `cache`, `actions`, optional `error` |
Preflight preparation outcomes are `completed`, `reused`, `failed`, or
`not_attempted`. Check outcomes are `succeeded`, `failed`, or `blocked`;
inapplicable groups may be omitted. Findings include errors, warnings, and
information where available. Quiet mode suppresses the report and retains
failure diagnostics on stderr.
Run `stages` is the complete selection. `executed` includes attempted work,
including failures and self-skips. `skipped` includes reuse and self-skips.
Each `stage_results` entry has `name`, `attempted`, `outcome`
(`completed`, `failed`, `reused`, `skipped`, `not_attempted`), and optional
`reason`. Available artifacts carry `stage`, optional `source`, `kind`, `path`,
optional `producer_run_id`, and durable `evidence` (`stage_result`,
`speaker_checkpoint`, `artifact_checkpoint`). Failed or unpersisted work is not
reported as completed.
Plan analysis contains `targets`, `prerequisites`, `execute`, and `reuse`;
artifact entries identify key, optional family/character, role, reason, and
force. Publication actions identify source, destination, required, and selected.
Remote status outputs retain source, destination, required, state, lock state,
optional outcome, declared destination/key, origin run, and error. Restore
actions carry kind, relative local path, remote key, status, optional reason/error.
Clean actions carry path, status (`would_delete`, `deleted`, `missing`, `empty`,
`failed`), and optional error; cache records whether it was preserved, requested,
processed, or not applicable. Lock rows include source, reason, creation time,
and whether publication is configured for that source.
## Cancellation and exit status
Ctrl-C and termination cancel acquisition and active operations. Narratio stops
scheduling work, waits for started workers, attempts terminal local manifest
persistence, and releases acquired resources. Successful checkpoints remain
resumable. Cancellation does not schedule cleanup. Abrupt process death has no
added finalization guarantee.
| Status | Meaning |
| --- | --- |
| `0` | Success, including ordinary diff with differences. |
| `1` | Operational/readiness failure, cancellation, or output failure. |
| `2` | Invalid invocation or identifiable invalid configuration input. |
| `3` | `config diff --check` found differences. |
Missing/unreadable sources and ambiguous or callback loading failures are
operational; malformed or explicitly rejected configuration input uses native
input classification. Mixed failures preserve underlying causes and operational
precedence. Terminal failure is presented once, including in quiet mode.
## Version and completion
```sh
narratio version --format text
narratio version --scope commandkit --format json
source <(narratio completion bash)
source <(narratio completion zsh)
narratio completion fish | source
```
Required target selection:
Version text is `NAME VERSION` with an optional revision; structured identity
contains `name`, `version`, and `revision`. ReleaseKit supplies the version:
it uses an injected release identifier, then the main-module version when
available, and otherwise reports `dev`. Bash requires bash-completion
initialized; Zsh requires its completion system initialized. Native completion offers command/flag names,
static stage/scope values, and applicable file/directory hints. Dynamic campaign
and artifact completion is deferred.
- exactly one of:
- `--output <path>`
- `--remote`
## Migration from the previous CLI
Options:
Removed command paths have no compatibility aliases.
- `--config <pipeline.yml>`
- `--campaign <id>` or `--campaign-file <campaign.yml>`
- `--secrets-dir <directory>`
- `--previous-session-id <id>`
- `--date <YYYY-MM-DD>`
- `--title <text>`
- `--audio-dir <path>`
- `--audio-s3-prefix <prefix>`
- `--force`
| Previous invocation | Current invocation |
| --- | --- |
| `session validate SESSION` | `preflight SESSION` |
| `run-stage STAGE SESSION` | `run SESSION --stage STAGE` |
| `analyze SESSION` | `run SESSION --stage analyze --force` |
| `publish SESSION` | `run SESSION --stage publish --force` |
| `regenerate-artifacts SESSION` | `artifacts regenerate SESSION` |
| `clean SESSION` / `clean --all` | `session clean SESSION` / `session clean --all` |
| `config artifacts` | `artifacts list` |
| `session locks SESSION` | `session locks list SESSION` |
| `--session FILE` | `--session-file FILE`; inspection `--session` now asserts identity |
| `--session-id ID` | Positional `SESSION` on domain commands; `--session ID` on config inspection |
| `--secrets-dir PATH` | Configure the main pipeline file or supply environment values; see [Secrets Handling](config.md#secrets-handling). |
| `config diff LEFT_OVERLAY RIGHT_OVERLAY` | `config diff --overlay LEFT_OVERLAY --against-overlay RIGHT_OVERLAY` |
Rules:
Unlike the former `session validate`, `preflight` prepares or reuses inputs and
can create workspace state, download inputs, and update the manifest. See
[preflight](#preflight) for its readiness-check behavior.
- `--audio-dir` and `--audio-s3-prefix` are mutually exclusive.
- if campaign `session_template_file` is configured, `session init` renders it.
- generated session YAML must be concrete (no unresolved `{{ ... }}` placeholders).
### `session restore`
```bash
narratio session restore <session_id> [--dry-run] [--force] [--include-audio] [...common config flags]
```
Behavior:
- discovers committed remote current state;
- plans local restores;
- writes an execution report;
- blocks unresolved conflicts. `--force` permits replacement only of eligible
regular files.
See [Operations: Restore Workflow](./operations.md#restore-workflow) for the
default restore scope, report location, and conflict-handling workflow.
### `session artifacts`
```bash
narratio session artifacts <session_id> [--remote] [...common config flags]
```
Lists effective built-in, configured Scriptorium, and configured extraction
sources; reports planned, available, unavailable, and published state without
reading payload bodies; and includes publish rules, lock state, and optional
remote published-state availability. Remote inspection uses exact commit
declarations and displays the five current publish outcomes when recorded.
### `session locks`
```bash
narratio session locks <session_id> [...common config flags]
narratio session locks add <session_id> <source> [--reason <text>] [--force] [...common config flags]
narratio session locks remove <session_id> <source> [...common config flags]
```
Behavior:
- list mode validates and reports independent remote locks sorted by source;
- add creates one lock and reports an existing lock unless `--force` is used;
- `--force` performs one generation-matched replacement and reports a
concurrent change for operator retry; and
- remove is idempotent and reports when the source was not locked.
See [Operations: Publish Locks](./operations.md#publish-locks) for lock storage
and publication behavior.
## `--artifacts` Selection Rules
An artifact-family key selects all of its concrete character members. A
concrete generated key selects only that member; mixed family and concrete
selection is deduplicated and executed as concrete keys. The resulting plan
and command output identify both the concrete key and, where applicable, its
family and character ID.
- accepted on `run`, `session plan`, `run-stage`, `analyze`, and `publish`;
- repeatable and comma-separated values are combined, surrounding whitespace
is removed, and duplicate names are collapsed;
- names must exist in `pipeline.scriptorium.artifacts`;
- empty entries are invalid;
- on `run-stage`, only `analyze` and `publish` accept the option.
Effects:
- selects explicit analyze targets; required configured prerequisites may be
reused or rebuilt before them;
- filters publish rules that source `narratio.artifact.<name>`;
- does not filter built-in transcript/bounds or explicitly configured
`narratio.extraction.<name>` publish sources; and
- does not select or filter Notarius lanes.
## Common Workflows
Run full pipeline:
```bash
narratio run 2026-04-04
```
Dry-run restore plan:
```bash
narratio session restore 2026-04-04 --dry-run
```
Generate a concrete session file from template/default structure:
```bash
narratio session init 2026-04-04 --output ./session.yml --date 2026-04-04 --title "Session 12"
```
Force publish only:
```bash
narratio publish 2026-04-04
```
Regenerate post-transcript artifacts without publishing:
```bash
narratio regenerate-artifacts 2026-04-04 --artifacts session_recap,player_handout
```
## Output And Exit Behavior
- Successful commands write their result or summary to standard output and
exit with status `0`.
- Command failures and invalid invocations write an error to standard error and
exit with status `1`.
- An unknown top-level command also prints the top-level usage summary to
standard error.
- `session restore --help` prints its command-specific usage and exits with
status `0`.
Output is intended for operator inspection. Narratio does not currently offer
a machine-readable CLI output mode; durable machine-readable state is recorded
in manifests and reports described in [Operations](./operations.md).
Campaign identity and file selectors may now accompany each other. Party-file
selection consistently overrides the roster without editing campaign settings.
Native configuration inspection retains declarations and their actual evidence;
use catalog/plan/session views for generated domain products. Comparison defaults
are independent. Field overrides are inspection-only. Update scripts to consume
structured reports and exit classifications, place flags after the complete
command path, and account for native repetition and cancellation behavior.

View File

@@ -2,7 +2,8 @@
## Purpose
Narratio resolves three YAML documents:
Narratio loads pipeline, campaign, and session YAML, with a canonical party
roster selected explicitly or through the campaign:
- `pipeline.yml`: pipeline/runtime settings
- `campaign.yml`: campaign identity and stable input defaults
@@ -12,10 +13,20 @@ Narratio resolves three YAML documents:
### `pipeline.yml`
When `--config` is omitted, search order is:
An explicit `--config` selects exactly that file, including a custom filename.
Otherwise ConfigKit searches these locations in order:
1. `/usr/local/etc/narratio/pipeline.yml`
2. `/etc/narratio/pipeline.yml`
1. The working directory, for `narratio.yml` then `narratio.yaml`.
2. The Go user-config directory's `narratio/` subdirectory, for those named
files followed by `config.yml`, `config.yaml`, `main.yml`, and `main.yaml`.
3. The Go user-config directory itself, for the named files.
4. `/usr/local/etc/narratio/` and then `/etc/narratio/`, each for named files
followed by the generic filenames above.
5. `/etc/`, for the named files.
On Linux, the user-config directory normally follows `XDG_CONFIG_HOME`, or
`~/.config` when it is unset. A selected invalid file fails loading; discovery
does not continue to another candidate.
### `campaign.yml`
@@ -27,56 +38,52 @@ Selection rules:
### `session.yml`
When `--session` is omitted, local search order is:
An explicit `--session-file` selects exactly that file. Otherwise local search
order is:
1. `/usr/local/etc/narratio/session.yml`
2. `/etc/narratio/session.yml`
If local session discovery fails and a `session_id` is known, Narratio attempts remote session loading from:
If no local session exists and a `session_id` is known, Narratio loads the
session from configured object storage. Downloaded session bytes are contextless
snapshots, with remote object
provenance retained independently of locally materialized checksums.
- `{root_prefix}/campaigns/{campaign}/sessions/{session_id}/session.yml`
Remote loading prefers an authored session-root `session.yml`, including updates
from `session init --remote --force`. When that object is absent, loading falls
back to the current commit's standalone prepared session. Published snapshots
remain immutable; restore validates the pointer-selected committed state.
using configured object storage.
### Native inspection and domain derivation
The downloaded remote session file is command-scoped: Narratio removes it after
the command finishes and records only the remote object provenance alongside
the durable copied session input.
Native configuration inspection exposes four actual typed ConfigKit results:
app (the default pipeline scope), campaign, session, and party. Defaults,
normalization, and configuration-owned validation finish within their supported
load lifecycle. Session configuration includes applicable campaign defaults
before handoff. Completed values remain unchanged by planning or execution.
### Read-only effective pipeline inspection
App inspection retains artifact-family declarations and needs no campaign or
party solely for expansion. Narratio derives concrete artifact catalogs, players,
resolved dependencies, and publication actions separately using the selected
canonical roster. `artifacts list` inspects those domain definitions;
`session plan` and `session artifacts` expose decisions and availability.
`narratio config validate`, `narratio config show`, `narratio config sources`,
and `narratio config artifacts` use the same `--config`, `--campaign`,
`--campaign-file`, and
`--overlay` selection rules as pipeline commands, but do not select, discover,
or load a session. They resolve configured typed credential references as part
of the ordinary ConfigKit load but expose only their environment-variable names;
they do not create runtime state.
`narratio config diff <left-overlay> <right-overlay>` uses the same pipeline and
campaign selectors, resolves each named overlay with an independent ConfigKit
load, and does not accept a separate `--overlay` flag.
Native sources/explanations retain actual imports, origins, history, and recorded
resolution evidence. Comparisons load each side independently using its own
normal defaults. App-only inspection overrides apply during that invocation's
load. Safe views hide resolved credentials. Persisted preparation projections
retain reference names and do not replace the native inspection result.
See the [CLI reference](cli.md#configuration-inspection) for scopes, selectors,
path operations, overrides, comparison modes, and report shapes.
Campaign selection is optional only when the resolved pipeline has no
`scriptorium.artifact_families`. When families are declared, Narratio selects a
campaign through an explicit flag or `pipeline.campaigns.default_campaign_id`,
then parses the campaign-owned party and expands concrete artifacts and any
family publish rules before validation. `config validate` prints the resulting
root, overlay, and effective digest. `config show` emits the normalized
effective pipeline YAML, with defaults and concrete expansion included but
ConfigKit directives and family declarations omitted. This review projection is
not promised to be a reloadable authoring document. `config sources` prints a stable
source projection instead of effective values: root/import/overlay/default
ownership plus campaign/party and generated-family records. Canonical derived
players trace to the party. `config artifacts` lists the concrete artifact map,
effective dependencies, and defining sources. The [CLI reference](cli.md#config-validate-config-show-config-sources-config-artifacts-and-config-diff)
owns command syntax and output conventions.
### Party selection
`config diff` compares normalized field values rather than YAML text or source
ownership. It emits sorted `added`, `removed`, and `changed` records, uses
compact deterministic JSON values, treats lists atomically, and reports `no
differences` when the complete effective configurations are equal. Concrete
family members and generated publish rules participate after expansion; moving
an equal value between eligible root/import sources does not create a
difference.
`--party-file` selects an exact canonical roster instead of the campaign-default
file. Explicit relative paths use the invocation directory; invalid or missing
explicit input fails without fallback. The campaign's configured party field
remains unchanged. Inspection, players, family derivation, planning, and execution
use the same selected roster. Format and validation belong in the
[party integration contract](integrations/party.md).
### Migrating to the maintained bundle
@@ -87,7 +94,8 @@ in the fixed `overlays/testing.yml` overlay. Put ordinary artifacts and families
in the recommended one-definition files shown by that bundle. Convert campaign
rosters to [canonical party input](integrations/party.md), then express character
work as families. Inspect the result with `config validate`, `config show`,
`config sources`, and `config artifacts`; use `config diff default testing` to
`config sources`, and `artifacts list`; use
`config diff --against-overlay testing` to
review the overlay before running a session. Unversioned party documents are
rejected.
@@ -102,25 +110,13 @@ remote state with an unsafe legacy identity must be migrated before use.
## Validation and Merge Rules
- ConfigKit performs strict typed YAML decoding and accepts exactly one document;
unknown fields, duplicate keys, and trailing documents fail load.
- A pipeline file may explicitly import additive YAML fragments through the
root-only `configkit.imports` list. Imported files contribute fields to one
logical pipeline document; they do not override fields supplied by the root
or another import.
- An omitted overlay, an empty overlay option, and the exact name `default`
select the base configuration. Any other name selects
`overlays/<name>.yml` relative to the pipeline root. Move previously selected
`profiles/<name>.yml` files there; the old directory is not searched, and
`--profile` is no longer accepted for Narratio pipeline selection. Explicit
imports from a directory named `profiles` remain valid.
- Campaign, session, and canonical-party documents are strict single-source
ConfigKit schemas. They do not enable imports, overlays, or `configkit`
directives.
- Local pipeline, campaign, session, and party documents may declare native
imports and sibling inheritance. Only the pipeline selects an overlay.
- An omitted overlay, empty overlay option, and exact `default` select the base;
another name selects `overlays/<name>.yml` relative to the pipeline root.
- Configured timeout and retry-delay durations must be positive. An omitted
artifact timeout continues to inherit its configured Scriptorium timeout.
- Session files must be concrete; unresolved `{{ ... }}` placeholders fail load.
- Session and party inputs inspected before typed loading are limited to 8 MiB.
- Pipeline defaults are applied before validation.
- Defaults apply only to absent fields. Explicit empty strings, zero values,
`false`, and `null` retain ConfigKit's typed meaning and are then checked by
@@ -128,13 +124,14 @@ remote state with an unsafe legacy identity must be migrated before use.
Explicit null optional stage sections stay absent, while required sections
fail validation.
- Campaign and session identities must agree.
- Required stable files (`speakers_file`, `autocorrect_file`, `glossary_file`,
`party_file`) are campaign-owned; the first three may be overridden by the
session. The optional `spell_catalog_file` also inherits a campaign value
when omitted by the session.
- `party_file` is parsed when pipeline and campaign configuration are combined.
It must be a versioned [canonical party](integrations/party.md), is
campaign-owned and derives the players input internally. `players_file` and
- The campaign supplies required speakers, autocorrect, and canonical party
files. Sessions may independently override speakers and autocorrect.
Optional glossary selections and the separate spell overlay inherit as
described under [glossary inputs](#glossary-inputs).
- The selected party is parsed when domain context or party inspection needs
it. It must be a versioned [canonical party](integrations/party.md). The
campaign supplies its default file; an explicit CLI selection replaces it
for the invocation and supplies the derived players input. `players_file` and
session `party_file` are unsupported configuration keys.
- Exactly one audio mode must be configured in session input:
- local (`audio_dir` or `audio_files`), or
@@ -142,57 +139,45 @@ remote state with an unsafe legacy identity must be migrated before use.
### Pipeline imports and overlays
Large pipeline configurations may be split into explicitly named fragments and
may use fixed-path selected overlays:
Narratio uses ConfigKit v1.4.0 for imports, composition, inheritance, and
pipeline overlays. The [ConfigKit configuration contract](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md)
owns their syntax and semantics; the [maintained bundle](../examples/production-testing/pipeline.yml)
shows a complete Narratio configuration. Only the pipeline selects an overlay;
Narratio validates the resulting effective domain entries.
```yaml
configkit:
imports:
- path: config/storage.yml
- path: config/integrations.yaml
Relative host-resource paths, including integration configuration files,
workspace/campaign roots, campaign template and stable inputs, and
session stable inputs and local audio references, resolve from the effective
value's defining source. Inherited values follow their origin. When no distinct
usable source context exists, the main source is the fallback; if it too is
contextless, the invocation directory is used. Explicit CLI-relative file paths
use the invocation directory. Artifact outputs, publish destinations, logical
IDs, and binary names retain their domain meanings.
campaigns:
root: /usr/local/share/narratio/campaigns
```
The effective digest excludes source layout, overlay identity, and secret values;
credential reference names and resolved resource paths participate. Prepared
campaign, session, and party documents contain effective standalone values rather
than authored import directives. A prepared session snapshot carries the resolved
values used for that session; retain authored files for future edits.
The maintained [production/testing bundle](../examples/production-testing/pipeline.yml)
is a complete copyable example of this structure, including canonical-party
artifact families.
### Upgrade from earlier configuration
Imports are resolved relative to the directory containing the root pipeline
file and are loaded in declaration order. Narratio does not scan directories or
infer fragments. Each import must be a confined regular `.yml` or `.yaml` file:
absolute paths, traversal, symlinks, directories, duplicate files, and an
import of the root pipeline itself are rejected. Imported files cannot declare
another `configkit` control section.
- Rename source-root `configkit:` controls to `config:`. Nested `config` data
and the Go `configkit` package and secret tags have different meanings.
- Rename or move pipeline files to the discovery names above, or retain a custom
filename such as `pipeline.yml` and pass it with `--config`.
- Remove `--secrets-dir` from invocations and configure the pipeline main file
as described in [Secrets Handling](#secrets-handling), or provision environment values.
- Review relative resource references moved into fragments: their defining
source now supplies the base. Mark necessary imports `required: true`.
- Review lists and use `config.sequences` where append or whole-record upsert is
intended. Verify the effective result with the inspection commands.
- Prepared documents contain effective values; retain authored roots and their
companions separately for editing. Separately installed downstream tools own
their own configuration migrations.
Base merging is additive. A map may be extended by multiple files when every
leaf is distinct, but a scalar, list, or map/list/scalar kind cannot be claimed
more than once, even when the repeated values are identical. Conflict errors
name the full field path and every source that claimed it. Narratio additionally
rejects an artifact or artifact-family key declared by more than one base file,
even when those files contribute disjoint children.
Overlay names are case-sensitive and use ConfigKit's safe fixed-path naming
rules. Only the selected overlay is opened; a malformed unselected overlay does
not affect a base or different-overlay load. Maps merge recursively, overlay
scalars replace base scalars, and overlay lists replace base lists completely.
Explicit `false`, zero, empty strings, empty containers, and null values remain
explicit inputs and are not refilled by defaults. Overlays cannot inherit,
stack, import files, or declare another ConfigKit control section.
During ConfigKit loading, Narratio applies fresh typed defaults, recorded
entry-level defaults and normalization, read-only file-local validation, and
ordinary path resolution before computing a deterministic effective
configuration digest. The digest represents the normalized, secret-free
runtime pipeline mapping; it excludes ConfigKit directives, source
provenance, overlay identity, and raw environment secret values. Equivalent
effective mappings therefore have the same digest regardless of how fields are
split among the root and imports.
An imported field has the same meaning it would have in a monolithic root
pipeline. In particular, ordinary relative pipeline paths continue to resolve
from the root pipeline directory, not from the importing fragment's directory.
These control-key changes require a major version for the eventual Narratio
release. This migration does not itself publish a release.
## Minimal Working Configuration
@@ -209,12 +194,12 @@ whisperx:
`campaign.yml`
```yaml
campaign_id: sample-campaign
inputs:
speakers_file: ./speakers.yml
autocorrect_file: ./autocorrect.yml
glossary_file: ./glossary.yml
party_file: ./party.yml
schema_version: maximumdirect.rpg.campaign.v1
id: sample-campaign
references: {party: ./party.yml}
narratio:
inputs:
speakers_file: ./speakers.yml
```
`session.yml` (local audio)
@@ -227,32 +212,31 @@ inputs:
## Secrets Handling
- Do not place raw secrets in YAML.
- Credential fields contain environment-variable names, represented internally
as ConfigKit typed secret references (for example
`pipeline.notarius.credentials: [NOTARIUS_LLM_API_KEY]`). A configured reference
must resolve to a nonempty environment value during load.
- Every surviving reference is resolved during ordinary pipeline loading,
regardless of whether its integration is disabled, outside the selected
stage range, or eligible for resume. Omit the field or set it to `null` when
that deployment should not require the credential.
- Every command that loads a pipeline accepts `--secrets-dir <path>`. When the
flag is omitted, Narratio uses a present `secrets/` directory beside the
resolved root `pipeline.yml`; an absent conventional directory is ignored.
Explicit relative paths are resolved from the caller's working directory,
and a missing or empty explicit selection is an error.
- Each immediate regular file whose name is a valid environment-variable name
supplies one value. ConfigKit removes trailing CR/LF, permits a symlink as the
selected directory, rejects non-hidden symlink entries, and limits input to
1 MiB per file, 8 MiB total, and 1024 entries. Dot-prefixed entries (including
files, directories, and symlinks) are ignored and omitted from bootstrap
reports, but still count toward the directory entry limit.
- An existing process environment value takes precedence over a credential file.
- On POSIX, operators must provision the directory with no group/other access
(normally `0700`) and files with no group/other access (normally `0600`);
ConfigKit validates type and bounds but does not enforce permission modes.
- Bootstrap happens once per command, before any configuration load or adapter
construction. Safe reports contain filenames, paths, and statuses, never values.
Credential fields contain environment-variable names as ConfigKit typed secret
references. Each surviving reference must resolve to a nonempty value when the
pipeline loads, including for disabled integrations or stages outside the run.
Do not put raw secret values in YAML.
A pipeline main file can select configured bootstrap before its typed load:
```yaml
config:
secrets_dir: secrets
```
Narratio passes the selected pipeline source to ConfigKit's configured bootstrap,
then loads the returned prepared source. Without a directory declaration,
credentials may be supplied in the process environment. Narratio no longer
accepts `--secrets-dir` or probes a conventional directory automatically. See
[ConfigKit's configured-startup contract](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md#explicit-secrets-directory-bootstrap)
for path rules, environment precedence and overwrite controls.
Each pipeline acquisition prepares its own source; an already acquired result is
reused. Comparisons use ordinary acquisition on each reached side and share the
process environment. Direct local campaign, session, and party inspection does
not load a pipeline solely for bootstrap. Bootstrap reports and diagnostics are
safe, final stderr output, separate from command reports. Protect provisioned
secret directories and files from access by other users.
## Publish Configuration Summary
@@ -282,7 +266,7 @@ Rules:
- `outputs[].source` is required.
- `outputs[].dest` may be omitted when derivable from source.
- extraction sources require an explicit `outputs[].dest` and publish only when
a rule names that source; the Notarius index and complete bundle are not
a rule names that source; the Notarius bundle is not
publish sources.
- `outputs[].required` defaults to `true`.
- publish locks are independent remote session objects managed with
@@ -294,11 +278,14 @@ Rules:
| Field | Type | Required | Default / Rule |
| --- | --- | --- | --- |
| `configkit.imports[].path` | string | No | explicit additive pipeline fragment relative to the root pipeline directory; `.yml` or `.yaml` regular files only |
| `config.imports` | list | No | native source-root import selections; see [imports and overlays](#pipeline-imports-and-overlays) |
| `pipeline.reference_catalog.settings` | map[string]string | No | setting IDs to source-relative vocabulary files |
| `pipeline.reference_catalog.systems` | map[string]string | No | system IDs to source-relative vocabulary files |
| `pipeline.workspace.root` | string | No | `/var/lib/narratio` |
| `pipeline.workspace.cleanup_after_publish` | bool | No | `false`; selects the published run's workspace target for final cleanup and requires effective `pipeline.publish.enabled=true` and `pipeline.publish.upload_run=true` |
| `pipeline.workspace.cleanup_after_publish` | bool | No | `false`; selects the session's entire run history for final cleanup and requires effective `pipeline.publish.enabled=true` and `pipeline.publish.upload_run=true` |
| `pipeline.campaigns.root` | string | No | `/usr/local/share/narratio/campaigns` |
| `pipeline.campaigns.default_campaign_id` | string | No | empty |
| `pipeline.campaigns.session_template_file` | string | No | installation session template; built-in default when absent |
| `pipeline.storage.backend` | string | No | `local`; supported values are `local` and `s3` (case-insensitive) |
| `pipeline.storage.s3.bucket` | string | Conditional | required when backend is `s3` and S3 session-audio or publish upload is enabled |
| `pipeline.storage.s3.root_prefix` | string | No | `dnd` |
@@ -307,10 +294,6 @@ Rules:
| `pipeline.storage.s3.force_path_style` | bool | No | `false` |
| `pipeline.storage.s3.access_key_id` | secret reference | Conditional | unset; must be paired with `secret_access_key` |
| `pipeline.storage.s3.secret_access_key` | secret reference | Conditional | unset; must be paired with `access_key_id` |
| `pipeline.spool.root` | string | No | `/var/spool/narratio` |
| `pipeline.spool.delete_audio_after_publish` | bool | No | `false`; selects the published run's spool-audio target for final cleanup and requires effective `pipeline.publish.enabled=true` and `pipeline.publish.upload_run=true` |
| `pipeline.cache.root` | string | No | `/var/cache/narratio` |
| `pipeline.cache.s3_audio` | bool | No | `true` |
| `pipeline.publish.enabled` | bool | No | `true` |
| `pipeline.publish.upload_run` | bool | No | `true` |
| `pipeline.publish.outputs[]` | list | No | defaults to final trimmed JSON plus final and final-trimmed Markdown outputs |
@@ -335,7 +318,7 @@ Rules:
| `pipeline.audita.binary` | string | No | `audita` |
| `pipeline.audita.timeout` | duration | No | `3h` |
| `pipeline.audita.credentials[]` | list[secret reference] | No | empty; exact environment-variable names forwarded to Audita |
| `pipeline.audita.modules[]` | list[string] | No | unset; omit to use Audita defaults, set `[]` for no modules |
| `pipeline.audita.debug` | bool | No | `false`; true requests Audita debug capture |
| `pipeline.audita.overlay` | string | No | empty; no downstream overlay override |
| `pipeline.audita.proposal_profile` | string | No | empty; no downstream proposal-profile override |
| `pipeline.audita.validation_profile` | string | No | empty; no downstream validation-profile override |
@@ -359,12 +342,12 @@ Rules:
| `pipeline.notarius.binary` | string | No | `notarius` |
| `pipeline.notarius.credentials[]` | list[secret reference] | No | empty; exact environment-variable names forwarded to Notarius |
| `pipeline.notarius.config_overlay` | string | No | unset; exact Notarius ConfigKit overlay selector |
| `pipeline.notarius.config_path` | string | Conditional | required when enabled; relative paths resolve from the pipeline file directory |
| `pipeline.notarius.config_path` | string | Conditional | required when enabled; relative paths resolve from their defining source |
| `pipeline.notarius.pipeline_id` | string | Conditional | required when enabled |
| `pipeline.notarius.timeout` | duration | No | `3h`; must be positive |
| `pipeline.notarius.working_directory` | string | No | directory containing resolved `config_path`; relative paths resolve from the pipeline file directory |
| `pipeline.notarius.resume` | bool | No | `false`; request compatible Notarius checkpoint reuse during ordinary executed extraction |
| `pipeline.notarius.chunk_cache` | string | No | empty; when set, exactly `auto`, `bypass`, or `refresh` |
| `pipeline.notarius.working_directory` | string | No | directory containing resolved `config_path`; relative paths resolve from their defining source |
| `pipeline.notarius.cache` | string | No | unset; when set, `auto`, `bypass`, or `refresh` |
| `pipeline.notarius.debug` | bool | No | `false`; true requests debug capture |
| `pipeline.notarius.references` | map[string]string | No | empty; maps normalized Notarius selectors to supported prepared Narratio source IDs; maximum 256 entries |
| `pipeline.notarius.outputs` | map | Conditional | at least one entry when enabled |
| `pipeline.render.enabled` | bool | No | `true` |
@@ -384,38 +367,30 @@ Rules:
### Audita Selection and Credentials
`pipeline.audita.config_path` optionally passes an Audita v2 configuration file;
when empty, Audita uses its own native config discovery. `overlay`,
`proposal_profile`, and `validation_profile` are independent, optional Audita
selectors. Empty or omitted strings add no command-line override. Narratio's
selected pipeline overlay is never inferred as an Audita overlay, and Narratio
does not create or validate Audita's backend or PromptKit profile files. Prepare
them with [Audita's v2 migration guide](https://gitea.maximumdirect.net/eric/audita/src/tag/v2.0.0/docs/migrations/v2.md).
`pipeline.audita.config_path` optionally selects an Audita v4.3.0 configuration;
otherwise Audita uses native discovery. `overlay`, `proposal_profile`, and
`validation_profile` independently select downstream settings. Empty values
add no override. Narratio does not create Audita configuration or infer its
selectors from a Narratio overlay. Configure the ordered Audita pipeline in
Audita itself; the retired `pipeline.audita.modules` field is rejected. See
[Audita's configuration guide](https://forge.maximumdirect.net/eric/audita/src/tag/v4.3.0/docs/config.md)
and the [integration contract](integrations/audita.md). `debug: true` requests
Audita debug capture; false or omission adds no debug override. Debug alone does
not invalidate a completed polish result.
Omit `modules` or set it to `null` to use Audita's configured default sequence.
Set `modules: []` to run no correction modules. A nonempty list is passed in
order, including repetitions. Narratio does not add a reporting or debug flag;
Audita's external configuration controls those settings.
`pipeline.audita.credentials` lists secret-reference names, not values. Narratio
resolves every listed name during pipeline loading and forwards the captured
nonempty value under that exact name to Audita. It does not inspect Audita's
configuration to discover names or map them to aliases. Audita v2 resolves
credentials for **all configured backends**, even ones not selected by the
current profiles: list every named backend credential in the selected Audita
configuration. An unauthenticated backend needs no reference. Omission, `null`,
or `[]` forwards nothing. A Narratio overlay replaces the entire list, and
`[]` clears it. See the [Audita integration contract](./integrations/audita.md)
for the subprocess and redaction boundary.
`pipeline.audita.credentials` contains exact environment-variable references,
not values. Narratio resolves each name at pipeline load and forwards its value
under the same name. Supply every credential required by the selected Audita
configuration. Omission, `null`, or `[]` forwards nothing; a Narratio overlay
replaces the list. Captured diagnostics redact those values.
<a id="notarius-configuration-profile"></a>
### Notarius Configuration Overlay
Migration: rename `pipeline.notarius.config_profile` to `config_overlay`.
The old field is rejected; there is no compatibility alias. For Notarius v0.8+
move selected downstream files from `profiles/` to `overlays/` beside its root
configuration. This does not rename PromptKit LLM profiles.
The old field is rejected; there is no compatibility alias. For current Notarius versions, move selected downstream files from `profiles/`
to `overlays/` beside its root configuration. This does not rename PromptKit LLM profiles.
The renamed selector also changes extraction resume evidence for named
selections: their existing extraction is regenerated on the next applicable
run, with normal dependent invalidation. Omitted/base selections do not acquire
@@ -475,87 +450,51 @@ delivery and redaction boundary.
### Notarius Cache Controls
`pipeline.notarius.resume` defaults to `false`. When true, an executed ordinary
extraction passes `--resume`; the deployed Notarius configuration must already
enable checkpoint recording and should select an explicit persistent checkpoint
root. Narratio does not inspect or generate that configuration.
`pipeline.notarius.chunk_cache` is empty by default, leaving Notarius's
configured mode in control. A nonempty value must be `auto`, `bypass`, or
`refresh` and is passed as `--chunk_cache`. Forced extraction takes precedence
over both fields: it omits `--resume` and passes `--chunk_cache refresh`.
Neither field changes Narratio's semantic extraction fingerprint, so changing
them alone does not rerun an otherwise complete durable extraction.
`pipeline.notarius.cache` is optional; omission leaves the Notarius configuration
in control. Supply `auto`, `bypass`, or `refresh` to select native cache behavior.
Forced extraction uses `refresh`. Narratio's own completed-stage reuse is separate;
changing cache or debug selection alone does not invalidate completed products.
Notarius owns its configuration, pipeline, and cache storage.
### Notarius Reference Bindings
`pipeline.notarius.references` maps a Notarius CLI selector to a prepared
Narratio source, not to a filesystem path:
Map selectors to prepared source IDs, for example:
```yaml
notarius:
references:
glossary: narratio.input.glossary
party: narratio.input.party
players: narratio.input.players
spell_catalog: narratio.input.spell_catalog
glossary: narratio.input.glossary.combined
spell_catalog: narratio.input.glossary.combined
```
Supported sources are `narratio.input.party`, `narratio.input.players`,
`narratio.input.glossary`, and `narratio.input.spell_catalog`. Each map entry is
required by its presence: omit a binding when the selected Notarius pipeline
does not need it. A spell-catalog binding additionally requires an effective
campaign or session `spell_catalog_file`.
Selectors accept Notarius's `slot`, `chunk.slot`, `lane.slot`,
`lane.extract.slot`, `lane.merge.slot`, and `lane.normalize.slot` forms.
Narratio trims whitespace around
selectors and their dot-separated components, rejects empty components and
`=`, rejects duplicate normalized selectors, and limits the map to 256 entries.
It validates only selector structure and the prepared source vocabulary;
Notarius owns target-slot declarations and media compatibility.
Before extraction, Narratio resolves every binding from the current prepared
session manifest and streams it into a verified, content-addressed session
snapshot whose absolute path is passed to Notarius. Missing, unsafe, empty,
changed-during-copy, or checksum-inconsistent prepared evidence fails with
guidance to force `prepare`. Bindings are sorted by normalized selector and are
part of extraction fingerprint and resume identity. See the
[Notarius integration contract](./integrations/notarius.md) for the subprocess
boundary and the [complete example](../examples/pipeline.full.annotated.yml)
for a copyable configuration.
Supported IDs are `narratio.input.party`, `narratio.input.players`, and
`narratio.input.glossary.{party,campaign,setting,spells,combined}`. Every
configured binding is required; omit unused bindings. Selectors use Notarius's
native slot forms. Narratio verifies and snapshots the prepared files before
passing them to the subprocess. See the [Notarius contract](integrations/notarius.md)
and [complete example](../examples/pipeline.full.annotated.yml).
### Notarius Output Entries
For each `pipeline.notarius.outputs.<name>`:
| Field | Type | Required | Rule |
| --- | --- | --- | --- |
| `lane_id` | string | Yes | unique Notarius lane ID |
| `media_type` | string | Yes | exact accepted descriptor media type |
| `schema_id` | string | Yes | exact accepted descriptor schema ID |
| `schema_version` | string | Yes | exact accepted descriptor schema version |
| `module_key` | string | No | exact accepted module key when set |
Output names must match `^[a-z][a-z0-9_]*$` and become selectable sources named
`narratio.extraction.<name>`. Lane IDs must be unique. Every declared output is
required from a successful Notarius result; a missing, rejected, duplicate, or
contract-incompatible lane fails extraction. See the
[complete maintained example](../examples/pipeline.full.annotated.yml) for the
current ten-lane D&D mapping and the [Notarius contract](./integrations/notarius.md)
for compatibility ownership.
Each `pipeline.notarius.outputs.<name>` requires a unique `lane_id` and may set
`filename` to a flat JSON filename. The default is `<name>.json`. Names create
`narratio.extraction.<name>` source IDs. Each configured lane is required, and
its completed JSON is promoted into the session's flat artifacts directory.
See the [Notarius contract](integrations/notarius.md).
### Scriptorium Credentials
Set `scriptorium.credentials: [OPENROUTER_API_KEY]` in the pipeline file to
forward that provider key to Scriptorium. List additional provider names only
when the selected downstream configuration needs them. The same list applies
to trim bounds generation, analysis (including character families), and their
render-debug calls. Scriptorium retains provider/profile selection; Narratio
does not pass a model-request `--api-key-env` override.
to requirements inspection, trim bounds generation, analysis (including
character families), and their render-debug calls. Scriptorium retains
provider/profile selection; Narratio does not pass a model-request
`--api-key-env` override.
As with Audita and Notarius, names are ConfigKit secret references resolved at
pipeline load time using the existing environment/secrets bootstrap precedence,
pipeline load time using the configured bootstrap and environment,
even when no Scriptorium stage executes. Omitted, null, or empty lists forward
nothing. An overlay replaces the entire list; `[]` clears it. Captured values
are forwarded under their exact names and registered for diagnostic redaction.
@@ -581,6 +520,9 @@ For each `pipeline.scriptorium.artifacts.<name>`:
| `vars` | map | No | values must be string or bool; `session_id` is reserved and overwritten by Narratio |
Narratio adds `session_id=narratio-session-<session_id>` to every Scriptorium request for sticky upstream LLM routing. If an artifact config sets `vars.session_id`, Narratio replaces that value before invoking Scriptorium. Use a different variable name if a prompt needs the raw Narratio session ID as content.
Discovery, preview, and generation receive the same effective variables,
including family member values and explicitly empty strings. Narratio forwards
the sticky value as a template variable, not as a direct session override.
Without `--artifacts`, analyze executes enabled configured artifacts. With an
explicit `--artifacts` list, the exact named configured artifacts are the
@@ -599,6 +541,13 @@ For each artifact input `pipeline.scriptorium.artifacts.<name>.inputs.<input_nam
| `source` | string | Yes | built-in runtime source, prepared input source, `narratio.extraction.<name>`, `narratio.artifact.<name>`, or `narratio.previous_session.artifact.<name>` |
| `required` | bool | No | optional input requirement |
The input map key is the prompt input name; `source` identifies the Narratio
artifact that supplies it. Requirements discovery compares exact input names
with these keys before generated files exist. A required prompt input bound to
an optional source produces a warning when availability is unknown; runtime
resolution may still omit the source. See
[prompt preflight](operations.md#prompt-requirements-preflight).
`artifact` and `path` are obsolete and rejected by strict configuration
loading. Use the canonical `source` identifier to select the input; Narratio
does not provide adapter-specific input passthrough fields.
@@ -606,19 +555,19 @@ does not provide adapter-specific input passthrough fields.
Each `narratio.artifact.<name>` input source automatically contributes an
effective dependency on that configured artifact. Narratio unions these inferred
edges with explicit `depends_on` entries, then trims, deduplicates, and sorts the
result during final configuration resolution. Authors use `depends_on` only for
result during domain catalog derivation. Authors use `depends_on` only for
ordering constraints that are not already expressed by an artifact input.
Use [`narratio config artifacts`](./cli.md#config-validate-config-show-config-sources-config-artifacts-and-config-diff)
Use [`narratio artifacts list`](./cli.md#artifacts-list)
to inspect keys, definition sources, outputs, and effective dependencies without
loading a session or creating runtime state.
### Scriptorium Artifact Families
`pipeline.scriptorium.artifact_families` declares a shared artifact template
for every canonical campaign character. Configuration resolution expands each
family into ordinary `pipeline.scriptorium.artifacts` entries before analyze
planning or Scriptorium invocation. Party parsing rejects unsupported document
schemas before family expansion.
for every canonical campaign character. Domain catalog derivation expands each
family into separate concrete artifact entries before analyze planning or
Scriptorium invocation, retaining the authored declarations in configuration.
Party parsing rejects unsupported document schemas before family expansion.
For each `pipeline.scriptorium.artifact_families.<name>`:
@@ -626,10 +575,19 @@ For each `pipeline.scriptorium.artifact_families.<name>`:
| --- | --- | --- | --- |
| `enabled`, `prompt_id`, `profile_id`, `timeout`, `render_debug`, `depends_on`, `inputs`, `vars` | ordinary artifact fields | No | copied to each generated artifact under the corresponding ordinary rules |
| `for_each` | string | Yes | exactly `party.characters` |
| `output_path_pattern` | string | Yes | safe path beneath `artifacts/` with exactly one `{character_id}` token and no other brace syntax |
| `output_path_pattern` | string | Yes | flat filename directly beneath `artifacts/` with exactly one `{character_id}` token and no other brace syntax |
| `member_vars` | map | No | maps an ordinary Scriptorium variable name to a supported canonical character selector |
| `member_dependencies` | list | No | unique family keys; each generated member depends on the corresponding generated member of each listed family |
| `publish` | map | No | typed family publish policy (`enabled`, `required`, `dest_pattern`) expanded into concrete publish outputs when enabled |
| `publish` | map | No | typed family publish policy (`enabled`, `required`, `dest_pattern`) validated against effective `pipeline.publish` settings and expanded into concrete publish outputs when enabled |
An enabled family publish declaration is validated against the effective
`pipeline.publish` configuration, including its defaults; it does not require
an explicit `publish.enabled` declaration in the same source file.
Explicit and generated analysis artifacts and session bounds must use flat
filenames directly beneath `artifacts/`; combined transcripts use flat filenames
directly beneath `transcripts/`. Remote publish destinations remain independent.
Collisions among effective producers are rejected.
Generated keys are `<family>_<character_id>` and generated output paths must
not collide with explicit artifacts or another generated artifact. Families
@@ -660,15 +618,45 @@ integration.
### Campaign
| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `campaign_id` | string | Yes | canonical opaque campaign identity |
| `session_template_file` | string | No | used by `session init` when set |
| `inputs.speakers_file` | string | Yes | stable input default |
| `inputs.autocorrect_file` | string | Yes | stable input default |
| `inputs.glossary_file` | string | Yes | stable input default |
| `inputs.party_file` | string | Yes | stable campaign party source; relative paths resolve from `campaign.yml` |
| `inputs.spell_catalog_file` | string | No | optional spell-catalog overlay default; required when a Notarius reference selects `narratio.input.spell_catalog` |
The campaign is a shared [RPG campaign document](https://schemas.maximumdirect.net/rpg/campaign/v0.2.0/schema.json).
Shared extensions are allowed; Narratio's `narratio` settings are strict.
| Field | Required | Meaning |
| --- | --- | --- |
| `schema_version` | Yes | `maximumdirect.rpg.campaign.v1` |
| `id` | Yes | campaign identity |
| `name`, `description` | No | shared context |
| `references.party` | Yes | shared roster path; `--party-file` can select another roster |
| `setting`, `system` | No | selected installed catalog IDs |
| `references.glossaries` | No | shared relationships, not an ordered Narratio composition list |
| `narratio.inputs.speakers_file` | Yes | speaker mapping path |
| `narratio.inputs.glossary_file` | No | shared campaign glossary path |
| `narratio.inputs.glossary` | No | inline campaign collection |
| `narratio.inputs.autocorrect` | No | replacement rules, default empty |
| `narratio.session_template_file` | No | campaign template; otherwise installation or built-in template |
Resource paths resolve relative to their defining source. See the
[three-file example](../examples/campaigns/lantern-coast/campaign.yml) and
[party contract](integrations/party.md).
### Glossary Inputs
Install a reference catalog and import its root into the pipeline. Selected
setting and system IDs resolve to source-relative shared glossary files; only
selected files are read. Campaign file and inline contributions compose using
ConfigKit identity and list controls. Session omissions inherit each selection
independently; explicit null or empty optional selectors clear them. A supplied
inline glossary or autocorrection list replaces the campaign contribution as a
whole, and null clears it. Clearing inline vocabulary leaves a selected file
unchanged; `autocorrect: []` disables inherited campaign rules.
Preparation writes shared envelopes for party, campaign, setting, spells, and
combined collections, including empty collections. Audita receives the four
individual envelopes and Notarius may bind the combined envelope to both glossary
roles. Collection extensions such as `instruction` are data, not prompt guidance.
[Shared glossary schema](https://schemas.maximumdirect.net/glossary/v0.2.0/schema.json)
and [semantics](https://schemas.maximumdirect.net/glossary/v0.2.0/semantics.md)
own the contract; see the [maintained examples](../examples/README.md).
### Session
@@ -680,9 +668,11 @@ integration.
| `date` | string | No | metadata |
| `title` | string | No | metadata |
| `inputs.speakers_file` | string | No | overrides campaign stable input |
| `inputs.autocorrect_file` | string | No | overrides campaign stable input |
| `inputs.glossary_file` | string | No | overrides campaign stable input |
| `inputs.spell_catalog_file` | string | No | overrides the optional campaign spell catalog; empty or omitted inherits the campaign value |
| `inputs.autocorrect` | list | No | replaces inherited rules; null or empty clears them |
| `inputs.setting` | string | No | independently overrides the campaign setting selection |
| `inputs.system` | string | No | independently overrides the campaign system selection |
| `inputs.glossary_file` | string | No | independently overrides the campaign vocabulary file |
| `inputs.glossary` | mapping | No | replaces the campaign's inline contribution |
| `inputs.audio_dir` | string | Conditional | local audio mode |
| `inputs.audio_files[]` | list[string] | Conditional | local audio mode |
| `inputs.audio_s3.prefix` | string | Conditional | S3 audio mode |
@@ -691,6 +681,21 @@ Audio rules:
- configure local mode (`audio_dir` or `audio_files`) or S3 mode (`audio_s3.prefix`), not both.
- `audio_s3` requires `pipeline.storage.backend: s3` and a configured S3 bucket.
- Explicit `audio_files` take precedence over `audio_dir`. Paths are resolved relative
to the session document and must identify regular files. Explicit files and
manifest-registered audio may have any suffix or none.
- Local directory scans are non-recursive. S3 selection scans the configured
prefix relative to the session's S3 prefix. Both use the same case-insensitive
candidate suffixes: `.aac`, `.aif`, `.aifc`, `.aiff`, `.alac`, `.amr`,
`.ape`, `.au`, `.caf`, `.flac`, `.m4a`, `.m4b`, `.mka`, `.mp2`, `.mp3`,
`.mp4`, `.oga`, `.ogg`, `.opus`, `.snd`, `.wav`, `.wave`, `.weba`, `.webm`,
`.wma`, and `.wv`. Other entries are ignored by automatic discovery.
- Distinct local paths with the same full basename receive distinct prepared
names. Speaker IDs use the prepared filename without its final extension. If
two resulting IDs match, choose one encoding or rename the recordings. S3
objects with the same full basename are rejected.
- Selection does not verify encoding. The transcription backend determines
whether it can decode the selected bytes.
### Storage backend selection
@@ -705,6 +710,16 @@ select a backend on its own. Unknown backend names and an S3 block paired with
`--previous-session-id`, however, the session file must contain the same value;
an omitted or different value is rejected before the command performs work.
## Shared contract provenance
Narratio validates the shared glossary, RPG party, and RPG campaign `0.2.0`
schemas and their dependency closure offline from schemas distribution
`2026.11.1`, commit `f7e3cedeca11ed903311cdf29ca4d81fb1f216b7`.
The supplied synthetic catalog data is based on commit
`02dd53c6ea026347452d497350c40249c949f8ce`. Installed catalogs are selected
independently. See [attribution](oss/attribution.md) and the
[integration contracts](integrations/README.md) for tested consumers.
## Maintained Examples
See the [maintained examples index](../examples/README.md) for complete pipeline,

View File

@@ -14,10 +14,14 @@ Agents must read [Agent Policy](policy/agents.md) before recommending, planning,
or implementing changes. It owns implementation discipline and the default
commit-after-completed-work rule; it does not authorize pushing or releasing.
Narratio integrates [ConfigKit v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/consumers/README.md), [CommandKit v0.8.0](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/consumers/guide.md), and [ReleaseKit v0.10.0](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/adoption.md); their guides own upstream APIs and behavior.
## Go Prerequisite
Maintained development and verification require Go 1.26. Use the official Go
1.26 toolchain before running repository commands.
The Go consumer minimum is 1.27.0, declared in `go.mod`. Maintained development
and verification use the official Go 1.27.4 toolchain. Release validation and
builds use the selected patch version and setup instructions in the
[release procedure](release.md#release-toolchain).
## Policy Reading Guide
@@ -78,9 +82,8 @@ The full suite includes documentation-link and Woodpecker dependency checks
and loads maintained pipeline and session examples. For focused diagnosis,
run `go test ./internal/doccheck` or
`go test ./internal/config -run '^TestExamplesLoadAndValidate$'` directly;
these are available developer tools, not additional CI steps. Tag CI
independently revalidates the tagged source before asynchronous asset delivery;
it is not a second synchronous release prerequisite. The normal maintainer
these are available developer tools, not additional CI steps. Tag CI delivers assets asynchronously from the tagged source; it does not
repeat candidate validation. The normal maintainer
entry point is the single publication command in the
[Release Procedure](release.md).

View File

@@ -19,12 +19,12 @@ focused stage documents.
## Integration Contracts
- [Audita](./audita.md): transcript polishing (`audita process`).
- [Notarius](./notarius.md): complete pipeline execution and safe JSON bundle
discovery (`notarius run`).
- [Notarius](./notarius.md): complete pipeline execution and safe JSON product
promotion (`notarius run`).
- [Party](./party.md): canonical campaign roster input.
- [Seriatim](./seriatim.md): merge, normalize, trim, and render operations.
- [Scriptorium](./scriptorium.md): artifact generation and debug rendering
(`scriptorium run|render`).
- [Scriptorium](./scriptorium.md): artifact generation, prepared previews, and
prompt requirements discovery.
- [WhisperX](./whisperx.md): speaker-audio transcription over HTTP.
## Related Canonical Docs

View File

@@ -1,54 +1,46 @@
# Integration: Audita
Narratio invokes Audita v2's `process INPUT --glossary PATH --output PATH`
subprocess for `polish`. The configured timeout and parent cancellation bound
execution. Narratio passes explicit `--config`, `--overlay`,
`--proposal-profile`, `--validation-profile`, `--transcript-description`,
`--output-schema`, and `--modules` only when selected. An omitted module list
leaves Audita's default sequence in place; `modules: []` passes an explicit
empty argument and runs no correction modules. Order and repetitions are kept.
Narratio passes no debug, work-directory, or reporting flags, leaving those
choices to Audita's own configuration.
Narratio invokes Audita v4.3.0 for polishing. Its adapter supplies the prepared
party, campaign, setting, and spells documents as repeated `--glossary-file`
arguments, the merged transcript and requested output, and run-local report and
work destinations. Optional config, overlay, profile, transcript-description,
and output-schema selectors are forwarded only when set. `audita.debug: true`
forwards `--debug`; false adds no debug override. Audita owns its
configuration, ordered pipeline, profiles, and native discovery. Narratio does
not generate a downstream configuration. See [Audita configuration](https://forge.maximumdirect.net/eric/audita/src/tag/v4.3.0/docs/config.md)
and its [runtime glossary input contract](https://forge.maximumdirect.net/eric/audita/src/tag/v4.3.0/docs/integrations/transcript-glossary-files.md).
Audita owns its ConfigKit file, backend and profile definitions, native config
discovery, and their validation. Narratio does not create an Audita
configuration or infer downstream overlay/profile names from its own selected
pipeline overlay. An empty Narratio Audita selector adds no CLI override.
The [configuration reference](../config.md#audita-selection-and-credentials)
owns Narratio's fields and defaults. Audita's
[v2 migration guide](https://gitea.maximumdirect.net/eric/audita/src/tag/v2.0.0/docs/migrations/v2.md)
owns its downstream file format.
All four entry lists are supplied, including empty ones, and replace same-named
Audita-configured lists. Other collections and configured instructions retain native downstream
composition; shared collection extensions are data, not prompt guidance. The [configuration reference](../config.md#glossary-inputs)
explains selection and migration of the prepared inputs.
Each name in `pipeline.audita.credentials` is a ConfigKit secret reference
resolved when Narratio loads the pipeline. Narratio forwards only the selected
names and their captured, nonempty values under those exact names, in the
minimal child environment; it never maps them to a fixed alias or rereads the
parent environment. Every name is registered for captured stdout/stderr and
failure-diagnostic redaction. Audita resolves credentials for all configured
backends, including unselected ones, so operators must list every backend
credential that its selected configuration needs. The downstream files and
provider output remain Audita's responsibility, outside Narratio's
captured-stream redaction boundary.
After preparation, Narratio runs native Audita preflight when projected polish
work needs execution. The adapter supplies the same selections and prepared
files with a synthetic transcript. Audita's provider smoke checks remain enabled;
they can contact providers and destination probes can create directories.
Standalone `preflight` prepares or reuses inputs and checks Audita regardless
of output reuse, using invocation-scoped probe destinations. A successful check
does not guarantee later real-transcript processing or editorial quality. See
[operations](../operations.md#prompt-requirements-preflight)
and [Audita preflight](https://forge.maximumdirect.net/eric/audita/src/tag/v4.3.0/docs/cli.md#preflight).
The corrected transcript is the only canonical polish output. A successful
invocation must produce a valid JSON transcript with a top-level `segments`
array within Narratio's 64 MiB bound. Exit zero is accepted even if Audita's
ordinary reports describe recoverable model errors or no corrections. Narratio
does not parse report status, counts, or Markdown. It discovers only
`errors.yml`, `recoveries.yml`, and `report.md` next to the requested output,
each subject to a 16 MiB read bound. Missing reports are allowed, for example
when Audita reporting is disabled externally. Available reports are diagnostic
references, not canonical artifact outputs. See Audita's
[ordinary output contract](https://gitea.maximumdirect.net/eric/audita/src/tag/v2.0.0/docs/integrations/output-files.md)
for their schemas, and [operations](../operations.md) for placement and
publication.
Each `pipeline.audita.credentials` value is an exact ConfigKit secret reference.
Narratio forwards selected names and captured values in the child environment
and registers them for captured-stream redaction. It does not discover backend
credentials or scrub files created by Audita. The configured timeout and parent
cancellation initiate subprocess shutdown; completion can take longer while
process output finishes.
On nonzero exit, Narratio preserves the original subprocess error and
available run-local evidence; it never promotes a transcript merely because
the file exists. The adapter returns safe paths, exit details, and selection
metadata on failure. Narratio's `audita.generated.v2` YAML records the
invocation, including arguments, paths, and credential names but never values;
it is a diagnostic record, not a generated Audita config file.
The corrected transcript is the only canonical polish output. It must be valid
JSON with a top-level `segments` array within Narratio's 64 MiB limit. Exit zero
is accepted even when ordinary reports describe recoverable errors or no
corrections. Narratio records available `errors.yml`, `recoveries.yml`, and
`report.md` from the requested report directory as diagnostics, each subject
to a 16 MiB bound. Reports may be absent when disabled. See Audita's
[output contract](https://forge.maximumdirect.net/eric/audita/src/tag/v4.3.0/docs/integrations/output-files.md).
Maintained Narratio examples: [full annotated pipeline](../../examples/pipeline.full.annotated.yml)
and [production-shaped pipeline](../../examples/pipeline.production.yml).
On nonzero exit, Narratio preserves the subprocess error and available run-local
evidence and does not promote an incidental transcript. The generated invocation
record contains arguments, paths, and credential names, never values; it is a
diagnostic record, not an Audita configuration file.

View File

@@ -1,201 +1,50 @@
# Notarius Integration Contract
## Boundary
Narratio uses Notarius as a subprocess to extract configured structured JSON
lanes from the final trimmed Seriatim transcript. Narratio owns invocation,
safe bundle discovery, lane selection, and its own artifact metadata. Notarius
owns pipeline definitions, lane schemas, the receipt, and bundle formats.
Canonical Notarius v0.8.1 references:
- [CLI reference](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/cli.md)
- [Subprocess consumer contract](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/consumers/subprocess.md)
- [D&D pipeline and lane contracts](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/consumers/dnd-pipeline.md)
- [Run-result receipt](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/integrations/run-result.md)
- [JSON output bundle](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/integrations/json-output.md)
- [D&D spell-catalog overlay](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/integrations/dnd-spell-catalog-overlays.md)
The [complete Narratio example](../../examples/pipeline.full.annotated.yml)
records the exact current constraints for all ten D&D lanes. Treat the linked
Notarius documents as canonical when changing those values; Narratio does not
duplicate the complete schemas.
Narratio invokes a separately installed Notarius v0.10.0 executable and the
operator's existing Notarius configuration and pipeline. Narratio does not build
that configuration. The [Notarius consumer guide](https://forge.maximumdirect.net/eric/notarius/src/tag/v0.10.0/docs/consumers/dnd-pipeline.md)
owns the maintained pipeline and [CLI](https://forge.maximumdirect.net/eric/notarius/src/tag/v0.10.0/docs/cli.md)
owns its invocation and native output contracts. Controlled local-provider
compatibility was exercised against commit `752c9b44d2c0bb3bfb1e02a5d4379f7cc5b6261e`.
## Invocation
When `pipeline.notarius.enabled` is true, Narratio resolves the executable,
configuration path, input path, output directory, and working directory to
absolute paths. Configured references require support for the `--reference`
contract introduced in Notarius v0.6.0. Cache controls require support for the
selected `--resume` and `--chunk_cache` flags. Notarius v0.8.1 is the tested
cache integration baseline, not an unconditional minimum version; Narratio
does not impose a runtime version gate. Each reference binding is a separate
argument before `--json`. When `pipeline.notarius.config_overlay` is present,
its exact value is another argument pair before `--json`:
Narratio supplies `run <pipeline_id>`, `--config`, `--input-file`, `--output-dir`,
`--debug-dir`, and `--format json`. It forwards an explicitly selected overlay,
cache mode, and reference bindings; debug true requests capture. The configured
child credentials are forwarded by exact name and captured streams are redacted.
The same selected configuration, credentials, references and cache mode are used
for native pipeline inspection and preflight. Preflight may contact providers and
probe destinations; a synthetic transcript establishes readiness for that input
only. See [operations](../operations.md#prompt-requirements-preflight).
```text
notarius run <pipeline_id> --config <config_path> --input <trimmed_json> --output-dir <staging_dir> [--resume] [--chunk_cache <mode>] [--reference <selector>=<verified_snapshot_path>]... [--config-overlay <name>] --json
```
Notarius v0.8.1 is a known supporting version for `--config-overlay`; using the
option requires a compatible Notarius executable, but deployments that omit the
field acquire no additional version requirement. Omitted or null configuration
adds no flag. Supplied empty, `default`, and named selectors are forwarded
without normalization so Notarius can apply its own ConfigKit semantics. This
option selects a Notarius configuration overlay, not a PromptKit profile through
`--llm-profile`, and Narratio never substitutes its own selected overlay name.
A missing or invalid downstream overlay is an ordinary Notarius subprocess
failure: Narratio does not retry without the selector or fall back to another
overlay.
Reference paths are absolute stable snapshots streamed from manifest-verified
canonical files prepared inside the current Narratio session workspace. They
live at `cache/notarius/references/<sha256>/<prepared-basename>` and retain the
full lowercase content digest. Narratio verifies snapshot checksum and size
before and after the subprocess, reconstructs missing or corrupt regular files
from a still-valid prepared source, and passes only configured bindings,
ordered lexically by normalized selector, as direct argument-vector entries
without shell interpretation. Symlinks, directories, other non-regular
conflicts, and prepared-source mismatches fail rather than being deleted. A CLI
binding takes precedence over a matching external path in Notarius
configuration. Narratio never emits `--without-reference`.
For canonical party configuration, the `party` binding is the unchanged,
validated authored roster and the `players` binding is its generated
projection. Both retain their established `narratio.input.party` and
`narratio.input.players` source IDs, and both are resolved from the prepared
manifest rather than from campaign configuration at extraction time.
The maintained D&D boundary binds only the four campaign-owned external slots:
```text
notarius run dnd-session \
--config <absolute config path> \
--input <absolute trimmed transcript path> \
--output-dir <absolute staging directory> \
--reference glossary=<absolute verified glossary snapshot> \
--reference party=<absolute verified party snapshot> \
--reference players=<absolute verified players snapshot> \
--reference spell_catalog=<absolute verified spell catalog snapshot> \
--json
```
The spell-catalog binding is omitted when the campaign does not maintain that
optional overlay. Registry, scene-description, combat-turn, and occurrence
handoffs generated during the same Notarius run remain in Notarius pipeline
composition and must not be emitted as CLI references. The linked CLI and D&D
consumer documents own selector targeting, declared slots, media compatibility,
and generated-handoff collision rules.
Standard output is reserved for the JSON receipt. Standard error is captured
separately as diagnostic output. Narratio applies the configured timeout and
does not interpret stdout as a receipt unless the subprocess exits successfully.
It does not pass a Narratio session ID or run `notarius config validate`
automatically; the configured working directory and Narratio's minimal child
environment apply to the subprocess.
Ordinary extraction maps `pipeline.notarius.resume: true` to `--resume` and a
nonempty `pipeline.notarius.chunk_cache` to `--chunk_cache <mode>`. Forced
extraction always omits `--resume` and supplies `--chunk_cache refresh`.
Notarius owns checkpoint enablement, recording, identity, and both cache roots;
Narratio neither reads nor synthesizes its configuration. Use explicit
persistent roots in Notarius when reuse must span subprocess invocations.
Changing a reference path/digest or other upstream identity input correctly
causes a cold miss. Chunk refresh bypasses lookup and publishes the accepted
replacement for the active source; it does not delete unrelated plans or
checkpoint state.
When `pipeline.notarius.credentials` is absent, null, or empty, Narratio adds no
credentials to that environment. When configured, each list entry names an
environment variable whose already-loaded nonempty value is forwarded under
that exact name. Operators must use the names referenced by the selected
Notarius/PromptKit providers. Narratio does not inspect the Notarius configuration
to infer providers or destination names, and it does not forward unrelated
credentials from its parent environment or secrets directory. A Narratio
overlay replaces the whole credential list; `[]` clears it.
Every selected name is registered with Narratio's shared streaming redactor.
Credential bytes written by the child to captured stdout, captured stderr, or
stderr-derived failure diagnostics are replaced with `<redacted>`, including
custom names not known to the built-in sensitive-name list. Narratio does not
serialize the credential into arguments, stage metadata, manifests, or
generated configuration.
This captured-stream protection is not a filesystem sandbox. Notarius remains
responsible for keeping credentials out of files it writes directly, including
bundle artifacts and its own diagnostics. Narratio does not scan or rewrite
arbitrary downstream files and cannot promise redaction of transformed or
encoded credentials.
The prepared shared roster can bind to `party`; the combined shared glossary can
bind to both `glossary` and `spell_catalog`. Notarius owns collection selection,
D&D recognition, its configuration and caches. See [configuration](../config.md#notarius-reference-bindings).
Narratio stage reuse and Notarius cache reuse are separate. Forced extraction
requests native cache refresh.
## Accepted Result
Narratio's tested invocation baseline is Notarius v0.8.1. The accepted
receipt remains `notarius.run-result.v2`; reference flags do not change the
receipt or ten-lane output contract. The receipt
must identify the configured pipeline, and its `index_file` must be exactly
`index.json` beneath the reported bundle root. The production index must name
the management files exactly as `manifest.json`, `rejected.json`,
`warnings.json`, and `diagnostics.json`. All receipt, index, and lane paths must
stay inside that bundle; symlinks and non-regular lane payloads are rejected.
After a successful exit, Narratio reads the native JSON completion report, checks
its pipeline and confined output directory, and validates each configured
`lanes/<lane-id>.json` as a safe regular JSON file. It promotes those required
lanes to flat session artifacts and records content evidence. The reported
`artifact_count` can include reused or auxiliary results; it is not an inventory.
Optional `chunk-map.json` and `evidence-context.json` stay in the original
bundle, which is subject to Narratio cleanup. Selected canonical products and
their recorded evidence support reuse without that bundle. A positive native
`fallback_count` remains visible in fresh and reused reports.
Supported receipt and index shapes tolerate unknown fields for forward
compatibility, while required identity, validation, count, manifest,
rejection, warning, diagnostic, and lane-list fields remain mandatory.
Narratio applies bounded reads to the receipt, index, rejection, warning, and
diagnostic documents. Warning and diagnostic envelopes, group counts,
occurrence counts, truncation state, framework-owned origins, and
receipt-to-bundle counts must be internally consistent. Optional chunk-map and
evidence-context descriptors must carry their complete generic contract
metadata when present.
For every entry in `pipeline.notarius.outputs`, Narratio requires exactly one
index descriptor with the configured lane ID, media type, schema ID, schema
version, and, when configured, module key. Missing, duplicate, rejected, or
incompatible required lanes fail extraction even if Notarius exited zero. A
configured lane whose v2 validation summary is `rejected` or `incomplete` also
fails extraction.
An accepted reused producer may report `producer_attempt_count: 0`; Narratio
preserves that valid summary rather than treating it as a missing field.
Unconfigured lanes may remain in the preserved bundle but do not become
selectable Narratio sources.
Each accepted configured lane is registered as
`narratio.extraction.<output_key>`. The bundle index is retained for audit and
resume validation but is not selectable. Scriptorium and publish rules consume
only explicitly named lane sources; `--artifacts` never selects Notarius lanes.
## Failure And Compatibility Behavior
- Startup and nonzero-exit errors fail extraction and retain captured diagnostics.
- Invalid receipt JSON or an unsupported receipt schema fails before bundle use.
- Unsafe or incompatible index data and required-lane rejection fail before the
staged bundle is promoted to durable storage.
- Contract and external provenance metadata are preserved on lane artifact
records and through explicit publication.
- Undeclared selectors, incompatible reference files, and external/generated
reference collisions are Notarius errors and fail extraction normally.
Rejection, validation, warning, and diagnostic summaries retain bounded stable
identity, category, origin, reason-code, status, and occurrence fields without
copying free-form external messages into Narratio manifest metadata or reading
lane payload bodies.
Configuration fields and defaults are in [Configuration](../config.md).
Operator paths, rerun procedures, and bundle retention are in
[Operations](../operations.md). See [Troubleshooting](../troubleshooting.md)
for failure recovery.
Nonzero exit, malformed completion, unsafe output, or a missing required lane
fails extraction. Diagnostics and available files remain for investigation; an
incidental file or partial report does not establish success. See
[extraction operations](../operations.md#extraction-workflow).
## Opt-in Integration Test
The production-boundary cache test requires an absolute path to a locally
built Notarius v0.8.1-compatible executable. It uses only a local
OpenAI-compatible `httptest` provider and temporary cache/config/output roots:
```sh
NARRATIO_TEST_NOTARIUS_BINARY=/absolute/path/to/notarius \
GOWORK=off go test ./internal/stage \
-run '^TestNotariusCacheReuseIntegration$' -count=1 -v
```
When the variable is unset, the normal test suite skips this test and never
searches `PATH`, a sibling checkout, the network, or a real provider.
The [catalog compatibility script](https://forge.maximumdirect.net/eric/narratio-reference-catalog/src/commit/016473fd16b15847f3e913670c423faa7c35720b/scripts/check-compatibility.sh)
accepts explicit Narratio and Notarius checkouts and Audita and Notarius binary
paths. It uses a controlled local provider and verifies readiness, the ten-lane
pipeline, flat promotion, cache reuse, and forced refresh. Ordinary tests skip
external binaries.

View File

@@ -1,71 +1,27 @@
# Canonical Party Input
`party.yml` is a campaign-owned roster input. It must be a single, versioned
`narratio.party.v1` document when Narratio resolves a pipeline, campaign, and
session together.
`party.yml` is a campaign-owned roster conforming to the [shared RPG party
contract](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/rpg/party/v0.2.0/semantics.md).
ConfigKit resolves native imports before Narratio validates the complete roster.
Shared extensions and the authored null or empty `aliases` values survive in the
prepared party document and native inspection.
```yaml
schema_version: narratio.party.v1
Narratio additionally requires a nonempty roster, stable character IDs using the
configured-artifact key grammar, player and character names, and at least one
class per character. Names, aliases, and class names must be nonempty, trimmed
strings without control characters. Character names and aliases cannot be
ambiguous under case-insensitive comparison; class names cannot repeat within
one character. Player names may repeat. A supplied class level must be positive.
characters:
arannis:
player:
name: Eric
character:
name: Arannis
alias:
- Ari
- The Grey Owl
classes:
- name: wizard
level: 8
```
`characters` is a non-empty mapping. Each key is a stable character ID using
the configured-artifact key grammar: a lowercase ASCII letter followed by zero
or more lowercase ASCII letters, digits, or underscores. Character order is
preserved where roster order matters.
Every entry has `player.name`, `character.name`, and a non-empty
`character.classes` list. Class entries require a non-empty `name` and may
include a positive integer `level`. The optional, intentionally singular
`character.alias` field is a list. Names, aliases, and class names must be
non-empty, trimmed display strings without control characters. Character names
and aliases must be unique across the full roster under Unicode-aware
case-insensitive comparison; player names may repeat.
The document has exactly one YAML document and accepts no unknown fields.
`schema_version` is required: a missing, wrong, or malformed value is an error.
## Migration
Unversioned party inputs are rejected. Replace each legacy party document with
the versioned structure above, move each roster entry under `characters`, and
remove separate player and session-party settings: those keys are unsupported.
The configuration rules and source-relative path behavior are defined in the
[Configuration Reference](../config.md).
The maintained [party example](../../examples/campaigns/sample-campaign/party.yml)
shows the shared marker and plural `aliases` field. The configuration reference
owns party selection and source-relative paths.
## Derived players document
During `prepare`, Narratio copies the canonical party source bytes unchanged
to `inputs/party.yml` and writes this deterministic players-only projection to
`inputs/players.yml`:
```yaml
schema_version: narratio.players.v1
players:
- name: Eric
character:
id: arannis
name: Arannis
alias:
- Ari
- The Grey Owl
```
There is one entry per character, sorted by stable character ID. Repeated
player names remain separate entries. The optional `alias` list retains its
declared order and is omitted when empty. The projection carries no class
data. Its prepared manifest record is marked `derived_from_party`; it is not a
separate user-provided `players_file`.
During preparation, Narratio writes the resolved shared roster to
`inputs/party.yml` and derives `inputs/players.yml`. The projection uses
`narratio.players.v1`, contains one entry per character sorted by stable ID,
and keeps its existing singular `alias` field. It contains player and character
names and aliases, but no class data. Repeated player names remain separate
entries. Its manifest source is `derived_from_party`.

View File

@@ -1,80 +1,57 @@
# Integration: Scriptorium
## Purpose
Define the Scriptorium adapter contract used by `analyze` and trim-bounds generation in `trim`.
## Boundary
## External Boundary
Narratio uses the independently installed Scriptorium v0.16.0 native CLI for
trim bounds and configured analysis artifacts. It invokes `run PROMPT_ID` for
generation, `promptkit show prepared PROMPT_ID` for optional preview, and
`promptkit requirements show PROMPT_ID` for early discovery. Scriptorium owns
prompt, profile, backend, and private configuration resolution. The
[upstream CLI migration guide](https://forge.maximumdirect.net/eric/scriptorium/src/tag/v0.16.0/docs/consumers/upgrading-cli.md)
and [subprocess contract](https://forge.maximumdirect.net/eric/scriptorium/src/tag/v0.16.0/docs/integrations/subprocess.md)
own the native interface and deployment migration.
Narratio invokes Scriptorium as a subprocess in these modes:
Configured glossary inputs use explicit prepared `narratio.input.glossary.*`
source IDs while prompt input names remain independently configured bindings.
See [glossary inputs](../config.md#glossary-inputs).
- `scriptorium run`
- `scriptorium render`
Generation selects artifact-only text output. Preview and requirements use
native JSON. Narratio forwards selected configuration and profile identifiers,
sorted repeated `--input-file NAME=PATH` bindings where files are needed, and
repeated `--var KEY=VALUE` assignments. Commas and later equals signs remain
literal. Discovery supplies no input paths and makes no model call. Narratio's
supervisor deadline covers each invocation; generation also forwards the same
duration as `--run-timeout`, separate from Scriptorium's per-attempt timeout.
The request timeout and parent cancellation bound each invocation. Internal
runner composition is documented in
[the adapter implementation guide](../internal/adapters.md).
## Streams And Outcomes
## Request Contract
Both request types carry:
- binary/config/prompt/profile IDs;
- input map and vars map;
- output path;
- timeout;
- generated config + stdout/stderr log paths;
- optional list of already-resolved credential references;
- optional working directory.
Narratio captures stdout directly into the run-local artifact or preview, or
into memory for discovery. Result bytes are preserved and limited to 64 MiB;
they are not diagnostic logs and are not redacted. Treat generated artifacts
and prepared previews as potentially sensitive. Stderr remains separately
bounded and redacted. A capture failure aborts the supervised subprocess.
## Result Contract
`ArtifactResult` returns:
- output/log/generated-config paths;
- exit code and duration;
- command mode (`run` or `render`);
- prompt/profile provenance;
- `ValidationFailed` marker;
- metadata map.
A successful generation or preview must produce a nonempty result; preview must
also be valid JSON. Narratio validates the result before stage-owned canonical
promotion. A nonzero outcome or delivery failure remains an error even if
stdout contains bytes. Native exit status 4 identifies completed generated
content validation failure; status 2 is a usage or configuration failure.
Invocation records describe the actual arguments and stdout destination.
## Validation and Failure Semantics
Request validation fails for:
- missing binary, prompt id, or output path;
- non-positive timeout;
- empty input/var names;
- empty input path values;
- unresolved or empty selected credential references.
Requirements discovery returns the native inventories, identities,
completeness, and structured issues. A successful partial report is distinct
from a process or decoding failure. Narratio compares the reported requirements
with its intended bindings; discovery does not establish future file availability
or guarantee a later model call. See [preflight internals](../internal/preflight.md)
and the [upstream requirements contract](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#promptkit-requirements).
Both modes use the shared credential forwarding used by Audita and Notarius:
selected names and captured values augment the minimal child environment, and
all selected values are registered for captured-stream redaction. The adapter
does not reread the parent environment or override Scriptorium's provider
selection with `--api-key-env`. Generated invocation records and result metadata
contain `credential_env_names`, never credential values. This does not scan or
redact files written directly by Scriptorium. Selection semantics belong in
[Scriptorium credentials](../config.md#scriptorium-credentials).
## Credentials And Configuration
Run behavior:
- subprocess errors propagate with context;
- `run` exit code `2` is mapped to `ValidationFailed=true`;
- successful subprocess still fails if output file is missing or empty.
Each artifact result is limited to 64 MiB and must be a regular file without
symlinked path components.
Render behavior:
- subprocess errors propagate;
- output file must exist and be non-empty.
## Deterministic Behavior
- input and var maps are sorted into deterministic `--input` and `--var` CLI args.
- stage wiring adds `session_id=narratio-session-<session_id>` to every Scriptorium request for sticky upstream routing, overriding any configured `vars.session_id`.
- generated invocation YAML (`scriptorium.generated.v1`) is emitted when requested.
- adapter is stateless and does not own artifact-selection policy.
## Configuration
Operator-selected values are defined under `pipeline.scriptorium.*`, including
per-artifact settings under `pipeline.scriptorium.artifacts.*`, in the
[configuration reference](../config.md#pipeline).
Maintained examples with Scriptorium config:
- [Full annotated pipeline](../../examples/pipeline.full.annotated.yml)
- [Production-shaped pipeline](../../examples/pipeline.production.yml)
Selected ConfigKit secret references are forwarded by exact environment name
for discovery, preview, and generation. Their captured values are registered
for stderr diagnostic redaction, while invocation records retain names only.
Narratio does not choose the provider or pass a direct API-key override. This
does not scrub arbitrary result content or files written by Scriptorium. See
[Scriptorium credentials](../config.md#scriptorium-credentials) and
[artifact entries](../config.md#scriptorium-artifact-entries) for Narratio's
configuration and binding semantics.

View File

@@ -12,7 +12,8 @@ Narratio invokes Seriatim as a subprocess in these modes:
- `seriatim trim`
- `seriatim render`
The configured timeout and parent cancellation bound each invocation. Internal
The configured timeout and parent cancellation initiate subprocess shutdown;
completion can take longer while process output finishes. Internal
runner composition is documented in
[the adapter implementation guide](../internal/adapters.md).

View File

@@ -15,7 +15,10 @@ Narratio sends an HTTP `POST` to the configured transcription URL using
- `language`: the configured language string.
The server must return a `2xx` response whose body is valid JSON. Narratio does
not currently require a more specific response schema at this boundary.
not currently require a more specific response schema at this boundary. The
backend determines codec and container support; a malformed or unsupported
recording remains a transcription failure. Narratio does not transcode or probe
the selected audio. See [audio selection](../config.md#session).
The transcription URL must be an absolute `http` or `https` URL. Each
application attempt creates one bounded multipart framing and streams the audio

View File

@@ -61,13 +61,17 @@ state without constructing or invoking stage-execution adapters. The shared
command configuration loader may still use object storage to retrieve a missing
remote session file before planning begins.
Notarius is composed only when extraction is enabled; the extract stage owns
prepared reference resolution, receipt, bundle, and configured-lane policy.
The adapter validates the ordered selector/absolute-path pairs and is the sole
owner of serializing them as repeated `--reference` arguments before `--json`.
It also serializes an effective resume request as `--resume` and a nonempty
validated chunk mode as `--chunk_cache <mode>`. The extract stage, not the
adapter, resolves force precedence before constructing the request.
After preparation, the application projects remaining selected work and uses
invocation-owned Audita, Notarius, and Scriptorium runners for applicable
readiness checks. The same runners are available to processing. Standalone
preflight prepares inputs through the same lifecycle and uses invocation-owned
factories for all enabled readiness checks. See
[preflight internals](preflight.md).
Notarius is composed only when extraction is enabled. The stage resolves
prepared references and promotes configured products; the adapter builds native
inspection, preflight, and run commands and validates the completion report.
Force selects native cache refresh before request construction.
Its request may also carry already-resolved ConfigKit secret references.
Audita and Scriptorium requests carry the same kind of list. All three adapters use the shared
subprocess helper to convert their selected references into exact-name child
@@ -95,11 +99,15 @@ in-memory backend without changing package state.
for remaining group members and uses bounded graceful then forceful termination.
Cancellation, deadlines, and
diagnostic limits use the same terminal disposal path without losing their
original result classification. Child environments contain only the execution
original result classification. Escalation is bounded, but the command waiter
and output copying are joined before logs are flushed or ownership returns;
blocked I/O may prolong shutdown and workspace lock ownership. Child environments contain only the execution
baseline and adapter-specified values; configured credentials are resolved
once by ConfigKit and passed explicitly as sensitive values. Adapters do not
re-read their named environment references. Stdout and stderr are redacted while streaming into separate
8 MiB diagnostic captures; a bounded wait closes a stream retained by a
re-read their named environment references. Diagnostic-only stdout and stderr
are redacted while streaming into separate 8 MiB captures. Scriptorium result
mode directs stdout to a caller-owned, byte-preserving bounded writer instead;
capture failures use the same abort path. A bounded wait closes a stream retained by a
departed leader's descendant. Unsupported platforms reject owned command
execution.

View File

@@ -33,14 +33,15 @@ validator. The focused stage documents own their input/output flow;
All formats are validated by strict source-policy rules. Configured artifact and
extraction keys use `^[a-z][a-z0-9_]*$`; source parsers never normalize an
unrecognized token into a valid source. Extraction sources are registered only
from `pipeline.notarius.outputs`; the Notarius index has no selectable source
ID.
from `pipeline.notarius.outputs`; the original bundle is not a selectable
source.
Prepared stable source IDs are `narratio.input.players`,
`narratio.input.party`, `narratio.input.glossary`, and
`narratio.input.spell_catalog`. Artifact policy owns their canonical manifest
`narratio.input.party`, `narratio.input.glossary.party`,
`narratio.input.glossary.campaign`, `narratio.input.glossary.setting`,
`narratio.input.glossary.spells`, and `narratio.input.glossary.combined`. Artifact policy owns their canonical manifest
kind and prepared filename vocabulary. Canonical party mode preserves the
party source bytes in the party record and supplies the players record from the
effective standalone party document in the party record and supplies the players record from the
deterministic `derived_from_party` projection; both remain ordinary prepared
source IDs for consumers.
@@ -58,16 +59,16 @@ Configured definitions are always registered. Without an explicit selection,
the effective analyze set contains enabled definitions. With `--artifacts`, the
exact named configured definitions become the effective set for that invocation,
regardless of their `enabled` value. The effective-set resolver itself does not
expand dependencies. Configuration has already materialized the sorted union of
explicit ordering edges and configured-artifact input edges, and the analyze
expand dependencies. Shared domain catalog derivation has materialized the sorted
union of explicit ordering edges and configured-artifact input edges, and the analyze
work planner closes targets over that one concrete prerequisite graph.
Availability is separate from executability. Configuration may normalize a
Availability is separate from executability. Invocation selection normalizes a
family selection into its concrete generated members before this resolver runs.
The effective set retains optional family
and character origin metadata, but its keys, catalog sources, and runtime
lookups remain concrete configured-artifact identities.
Family publish policies are likewise expanded into ordinary configured-source
publish rules during configuration resolution.
publish actions during domain catalog derivation.
Configured outputs, including non-executable prerequisites, become available
only when the versioned analyze state identifies a current result whose source,
contract, canonical configured path, size, and checksum match a confined
@@ -131,10 +132,10 @@ Prepared stable sources (`narratio.input.*`):
Extraction sources (`narratio.extraction.*`):
- use the shared typed bundle evidence inspection in `extraction_evidence.go`;
- use the shared product evidence inspection in `extraction_evidence.go`;
- require a current successful extract record with the exact configured source,
compatible contract and Notarius provenance, a confined regular durable
payload, matching checksum, and the current resolved trimmed-transcript
Notarius provenance, a confined regular flat product with matching size and
checksum, and the current resolved trimmed-transcript
identity;
- remain unavailable unless catalog hydration receives valid evidence. Resume
treats absent or obsolete evidence as a rerun decision and unsafe evidence as
@@ -177,7 +178,7 @@ Artifacts package owns shared remote current-state loading mechanics used by
restore, status and validation checks, and previous-cache planning.
The selected session manifest is accepted only with
`schema_version: narratio.session-manifest.v1` and complete stage identity.
`schema_version: narratio.session-manifest.v2` and complete stage identity.
An unsupported local or downloaded manifest must be replaced by regeneration,
verified restore, or republication; artifact resolution never fills in missing
authority markers.
@@ -248,7 +249,7 @@ generation, and removal is idempotent.
- session/work/run paths;
- previous-cache paths;
- spool/cache paths;
- managed session, run, and diagnostic paths;
- S3 session/run/current-state key layout.
New publication creates run-scoped immutable objects, including

View File

@@ -37,6 +37,8 @@ Restore planner action kinds:
Planner behavior:
- prepared campaign, session, party, and all four glossary inputs are restored
from declared immutable run objects to their canonical local input paths;
- a new-protocol restore uses only the selected commit's declared artifact set;
each action carries that artifact's immutable key, checksum, size, and
generation;
@@ -50,7 +52,7 @@ Planner behavior:
directories, symlinks, and other non-regular targets remain conflicts.
For a non-dry-run restore, planning/classification happens only after acquiring
the session lock. Runner manifest/reuse checks acquire that same lock first.
the workspace lock. Runner manifest/reuse checks acquire that same lock first.
Previous-cache readiness is resolved through `previouscache.Resolve` for restore,
prepare, status, and validation. Each requirement selects the unique
@@ -83,17 +85,16 @@ Execution order and safety:
- restored manifest local references are rebased beneath the selected local
session root. Unsafe relative references and producer-machine absolute paths
outside the manifest's producer session root are rejected; producer-local
spool paths and run-local diagnostic references are not restored as
run-local diagnostic references are not restored as
authority. Cleanup remains ordinary restored stage state and is not reset or
synthesized by restore.
Audio restore path:
- uses `audio.MaterializeS3Audio`;
- integrates spool and S3 audio cache paths;
- reuses cached audio only when its opened regular file, content digest, and
identity sidecar all match the selected remote object version; otherwise it
refreshes through the validated download path.
- restores selected audio directly into the prepared session audio directory;
- reuses a prepared copy only when manifest identity and its content checksum
match; otherwise downloads to a verified temporary sibling before installation.
## Reporting Contract

View File

@@ -1,216 +1,114 @@
# Configuration Internals
User-visible fields, defaults, and selection behavior belong in the
[Configuration Reference](../config.md). This document describes the internal
pipeline-loading boundary implemented by `internal/config`.
User-visible fields, defaults, discovery, and selection belong in the
[Configuration Reference](../config.md). This document describes the
`internal/config` loading and derivation boundary established by
[ADR 0003](../adr/0003-assign-configuration-ownership.md).
## Pipeline Loading
## Typed Configuration Handoff
`LoadPipeline` assembles and validates a pipeline in this order:
Pipeline, campaign, session, and party loaders retain their actual
ConfigKit results. Campaign and party inputs retain shared extensions, while
Narratio's operational settings use strict typed bindings. ConfigKit owns imports, overlay composition, inheritance,
presence, typed secrets, and native source/history evidence. Narratio's
supported definition callbacks complete configuration-owned defaults,
normalization, resource resolution, and validation before handoff. Consumers
read completed values without mutation.
1. Give ConfigKit a fresh typed `PipelineConfig` default value, the root file,
enabled imports, and the caller's overlay selection. Omitted, empty, and
exact `default` selections use the base; named overlays use the fixed
`overlays/<name>.yml` convention.
2. ConfigKit parses the root and declared imports, additively merges base
sources, applies only the selected overlay, and strictly decodes the result.
3. The definition resolver applies recorded entry-level and inherited defaults,
runs deterministic domain normalization, records derived publish destinations,
and resolves ordinary paths relative to the root pipeline file.
4. The definition validator performs read-only checks that require only the
pipeline file. Checks requiring canonical-party family expansion remain at
the existing explicit pipeline/campaign resolution boundary.
5. Narratio inspects public ConfigKit metadata to reject artifact and family keys
declared by multiple base files, adapts source ownership records, attaches
runtime-only state, and computes the normalized effective digest.
Session definitions receive selected-campaign defaults before loading finishes.
Recorded resolution preserves explicit empty/null/false/zero behavior and
truthful dependencies. Campaign, session, and previous-session assertions run
against resolved values in native validation callbacks. Standalone document
renderers preserve materialization semantics without providing a second
inspection authority.
This ordering preserves monolithic configuration behavior. Moving a field to
an imported fragment changes its source ownership, not its path base, default,
or schema semantics.
Resource resolution consults native entry origins and source contexts. A usable
effective source supplies the base, otherwise the main source and then captured
invocation directory provide the fallback. Explicit CLI paths use the invocation
directory. Reference-catalog entries are resolved individually from their native
field origins; selection does not read unused vocabulary files. See [resource rules](../config.md#pipeline-imports-and-overlays).
## Loaded Context Resolution
## Invocation Acquisition
`LoadedPipelineCampaign` carries one already composed pipeline and its selected
campaign into session resolution. `LoadSessionWithPipelineCampaignOptions`
loads a local session against that context, while
`ResolveLoadedPipelineCampaign` also accepts an already loaded remote session
or no session while a caller retrieves one. Compatibility loaders route through
these functions after their initial pipeline and campaign reads.
`internal/app/configuration_acquisition.go` owns lazy invocation selections and
acquired context. Exact sources and effective-identity assertions are
complementary. App acquisition needs no campaign or party for expansion;
campaign acquisition needs no session. Session acquisition loads campaign
context when required for defaults. Explicit party acquisition does not require
a session. Each reached pipeline acquisition prepares its native source and applies
configured bootstrap after static input checks; completed acquisitions are reused.
Application commands own pipeline and campaign discovery, campaign-file versus
registry selection, and the corresponding mutual-exclusion rules. Once they
have a `LoadedPipelineCampaign`, local session discovery and remote-session
download retain that exact pipeline object and its private provenance. Removing
a temporary downloaded session file therefore cannot invalidate the resolved
pipeline or campaign context.
`LoadedPipelineCampaign` retains one selected pipeline/campaign while local or
remote session resolution proceeds. Only absence permits remote fallback;
access, decoding, and identity failures retain their causes. Remote acquisition
prefers authored session-root input and uses the committed prepared snapshot
only when authored input is absent. Temporary materialization retains object
provenance and releases resources on success or failure. Read-only acquisition
creates no runtime workspace, execution lock, restore state, or stage adapter.
Campaign and session files use independent ConfigKit definitions with imports
and overlays disabled. Campaign files normally load directly from their source;
session files are first read through the 8 MiB bounded-read boundary because the
application must reject unresolved template placeholders before passing an exact
byte snapshot to ConfigKit. Local and remotely downloaded session bytes then use
the same typed loader and retain the existing post-load identity expectations,
stable-input precedence, and source-relative path semantics.
## Native Inspection
The application also has a separate read-only inspection resolver for `config
validate`, `config show`, `config sources`, and `config artifacts`. It uses the
same production root, overlay, and campaign selection functions, but never routes
through session discovery,
remote-session download, adapter composition, workspace
initialization, manifest access, or cleanup. A pipeline with retained artifact
family declarations must resolve its selected campaign before ordinary pipeline
validation, which expands its canonical-party members and generated publish
rules. A pipeline without those declarations may be validated by itself.
Secret-directory bootstrap remains invocation-scoped and happens before the
ordinary ConfigKit load because explicit typed references must resolve even for
inspection.
`configuration_commands.go` adapts actual results with `ckconfig.FromConfigKit`.
Native show, sources, explain/history, validation, and comparisons consume that
result's values and evidence. There is no flattened replacement snapshot,
synthetic source reconciliation, or generated family catalog in app inspection.
`MarshalEffectivePipeline` is the configuration-owned projection for `config
show`. It serializes one explicit typed safe projection with the existing YAML
encoder. The projection has no slots for resolution-only artifact family
declarations or private provenance. The result has one trailing newline;
commands do not marshal runtime objects directly.
Comparison sides load independently using each side's normal defaults and
selectors. App-only overrides pass through native selection into ConfigKit;
they remain invocation-local. Field overrides are unavailable to domain
execution/planning and other scopes. Comparison sides acquire separately and share the process environment while
retaining separate completed results. Public inspection and error paths preserve typed-secret
redaction and credential reference metadata. Load failures retain native errors
and source evidence; domain commands use `ckconfig.AdaptDiagnostics` for their
presentation without rewriting diagnostic records.
`EffectivePipelineSources` and `EffectiveCampaignSources` provide the separate
safe provenance projection for `config sources`. Pipeline ownership begins with
the complete logical field paths projected from the schema and classifies
each contributor as root, import, overlay, or centralized default. The
projection replaces generated concrete member paths with paired family and
canonical-party records, and does the same for generated publish rules.
Campaign records identify campaign-owned fields and party inputs; canonical
derived players point to the party source. The application command only joins these sorted
records with selection metadata and never reparses configuration files.
## Glossary Derivation
`EffectiveArtifactCatalog` projects the same finalized concrete artifact map for
`config artifacts`. It derives source identity from each map key, carries sorted
effective dependencies, aggregates ConfigKit definition contributors, and adds
family/character/party provenance for generated members. It does not inspect
files named after artifacts or infer another runtime graph.
`internal/config` adapts resolved selections and canonical party context to
`internal/glossary`. That owner loads native vocabulary, validates the pinned
schema, projects the roster, and serializes four individual envelopes and a
combined envelope.
Preparation and resume comparison share this resolver. Derived vocabulary does
not replace the authored ConfigKit results used by native inspection. Catalog
entry imports use the source file's native relative context.
`config diff` uses a thin paired loader that performs two independent ConfigKit
loads. When campaign
resolution is needed, the command loads one selected campaign and party and
expands both effective pipelines from that same party value. The configuration
owner projects each normalized effective mapping directly from that same typed
projection into sorted logical paths using JSON number preservation;
mapping leaves are compared individually while sequence values remain atomic.
Values are compact deterministic JSON representations for command output, not
raw YAML fragments, ownership records, or secret material. A differing digest
with no projected difference is treated as an internal consistency error.
## Canonical Party And Derived Catalog
Campaign context construction reads the campaign-owned party source through
`ParseParty`. The required canonical party retains its raw bytes and normalized
roster in runtime-only `ResolvedParty` provenance. Canonical resolution creates
a deterministic `derived_from_party` players projection. The party is the only
configured roster authority; player and session-party fields are unsupported.
File-backed party loading supports imports; contextless `ParseParty` accepts
bytes. The completed native mapping is validated against the shared contract and
Narratio's roster requirements. Character IDs determine projection order. The
native result supplies standalone canonical party YAML. The selected roster
supplies both the players projection and concrete family members, including when
an explicit party file replaces the campaign default.
## Canonical Party Domain
`ArtifactCatalog` carries derived artifacts, family/member origins, resolved
dependencies, and expanded publication outputs separately from pipeline values.
Family declarations remain in the typed pipeline result. Derivation sorts
family keys and character IDs, substitutes `{character_id}` in outputs,
resolves closed member variables, and checks key/output collisions and domain
dependencies. Member-artifact inputs become ordinary concrete artifact sources;
family publish declarations become ordinary publication actions. No family
wildcard matcher is added to runtime publication.
`ParseParty` is the package-owned boundary for parsing a party source. Its
single-source ConfigKit definition disables imports and overlays, requires
`schema_version` through `VersionRule`, and strictly decodes the
character-keyed typed schema before applying Narratio's party-domain checks.
Successful metadata coordinates recover authored character-map order without a
second YAML parse; class and alias slice order comes directly from typed decode.
The canonical value retains a separate exact byte copy of its source so
consumers can materialize the authored party document without reserializing it.
Its `PlayersYAML` method deterministically derives the ID-sorted, versioned
players-only projection.
Catalog listing, planning, stage execution, artifact inspection, fingerprinting,
and previous-session requirements consume the same derived products. Validation
of these products belongs to domain derivation rather than app inspection.
External roster shape belongs in the [party contract](../integrations/party.md).
An unversioned source is rejected before resolution, family expansion, or
prepare-stage materialization.
## Safe Persistence And Semantic Resume
## Validation Ownership
Preparation materializes standalone campaign/session/party/players and five glossary inputs and
a secret-safe pipeline projection. The projection preserves credential names,
family declarations, numeric values, and null/empty distinctions. It is a
persistence service, not a fabricated native result. An effective digest is
informational; resume compares result-affecting semantic evidence from the same
concrete products used by execution. Source arrangement, provenance, and overlay
labels alone do not invalidate work.
Configuration validation remains within `internal/config`, with the public
entry points and pipeline-domain sequencing separated from the private owners
for core pipeline/session rules, external adapters, publish/storage, Notarius,
Scriptorium, and shared scalar/path checks. These are package-local ownership
boundaries rather than extension points or a general validation framework.
Focused configuration/application fixtures cover imports, defaults, selected
rosters, independent comparisons, override isolation, secret-safe persistence,
and unchanged completed configuration across domain derivation and execution.
Validation is read-only, fails fast, and does not define which of several
independent invalid fields is reported first. Map-backed declarations are
nevertheless traversed deterministically. Reusable domain normalization is an
explicit preceding operation for both loaded and programmatically constructed
pipelines. Notarius normalization commits canonical scalar, reference, and output
values only after the complete normalization succeeds; its validator then checks
that candidate without changing it. Scriptorium validates artifact declarations
and outputs, dependencies and inputs, variables, referenced outputs, and the final
dependency graph in deterministic artifact order.
Diagnostics identify the relevant semantic field. Merge conflicts also
retain every claiming source needed to correct an additive ownership conflict.
Complete prose, punctuation, formatting, and private validation choreography are
not compatibility contracts.
## Diagnostics And Runtime Metadata
Syntax, duplicate-key, merge, overlay, and schema failures include the
relevant source name and full field path. Additive conflicts report every
claiming source so operators can repair the split without repeatedly
rediscovering additional conflicts.
The loaded pipeline retains private runtime metadata for the absolute root
path, ordered imports, selected overlay name, source, and path, original
ConfigKit metadata and source snapshots, effective digest,
and leaf ownership. Base
leaves retain their root/import owners, replaced leaves belong to the selected
overlay, and centrally supplied values use the synthetic `default` owner. This
metadata does not participate in YAML decoding or alter the public
configuration model.
The effective digest is SHA-256 over a versioned deterministic JSON encoding of
the same typed safe projection used by show and diff. Runtime Notarius paths remain absolute for
execution, but the digest substitutes their normalized logical values captured
before root-relative resolution, so relocating an equivalent configuration
bundle does not change provenance. Because ConfigKit and resolution metadata
are private, the digest excludes source layout, overlay name, and ownership.
Configuration stores credentials as ConfigKit typed references. A successful
load resolves their values inside the opaque typed boundary, while this safe
projection serializes only `EnvName()` identities. Credential-value changes are
therefore never hashed; reference-name changes remain ordinary provenance.
The optional Notarius credential follows the same path even for disabled or
resumable extraction; normalization copies the opaque reference without reading
or resolving it again. Direct YAML serialization has a configuration-owned safe
projection so only the reference name can leave this boundary.
`recomputePipelineEffectiveDigest` is the single package-owned refresh point
for later runtime expansion.
## Test Surfaces
`pipeline_configkit_test.go` exercises real imports and fixed-path overlays,
base selection, unselected-overlay isolation, source attribution, and Narratio's
unique artifact/family base-declaration rule. Existing focused configuration
tests protect defaults, explicit-value semantics, strict decoding, validation,
metadata, and root-relative path behavior. Application configuration-loader tests protect the
single-read boundary by changing the pipeline file after its initial load and
confirming local session resolution retains the original pipeline. Other
configuration tests continue to protect defaults and validation after assembly.
`party_test.go` protects the versioned typed party schema, domain invariants,
authored character order, retained bytes, and deterministic players projection
without involving campaign or runtime wiring.
`party_resolution_test.go` protects campaign-owned party loading, canonical
input restrictions, source provenance, and virtual players input selection.
## Artifact Family Resolution
Pipeline loading retains `scriptorium.artifact_families` as a resolution-only
declaration. Once campaign party resolution establishes a canonical roster,
configuration expands families in sorted family-key and character-ID order
into ordinary `ScriptoriumArtifactConfig` values. The expansion owns the narrow
`{character_id}` output substitution, closed member-variable selectors, key and
output collision checks, and the runtime-only family-origin catalog. It then
removes family declarations from `ScriptoriumConfig`, runs ordinary Scriptorium
validation, and refreshes the effective pipeline digest. Stages and adapters
therefore receive only concrete artifact maps.
The catalog retains sorted family member keys plus family/character/source
origins and the typed dependency/publish declarations for their later owners.
`member_dependencies` add corresponding ordinary concrete dependencies, while
the family-only `narratio.member_artifact.<family>` input form is rewritten to
the matching ordinary configured-artifact source. The catalog records those
resolved dependency and input identities with their declaring family and party
member. No member-artifact source is registered as a runtime policy source.
An enabled family publish declaration expands to ordinary configured-artifact
publish rules before the existing publish and lock validators run. Runtime
publication consequently receives no family wildcard or special matcher.
ConfigKit's [consumer guide](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/consumers/README.md)
and [CommandKit consumer guide](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/consumers/guide.md)
own the upstream APIs and feature behavior.

View File

@@ -15,8 +15,13 @@ sibling temporary file, validates the complete result, and passes that file to
remote object selection, validation, conflict handling, and temporary-file
cleanup.
Directory bundles are not promoted by `internal/fileops`; extraction owns its
validated Notarius bundle rename.
Directory bundles are not promoted by `internal/fileops`; extraction keeps
the original bundle in its run until cleanup and promotes individual validated
products.
Fileops updates, inspects and removes recognized managed latest-attempt links
without following their targets, including dangling links. Unrelated entries are
left alone and conflicting managed names are rejected.
## Cleanup Contract

View File

@@ -10,9 +10,9 @@ manifest placement belongs in
`manifest.Manifest` records:
- required `schema_version: narratio.session-manifest.v1`
- required `schema_version: narratio.session-manifest.v2`
- identity (`session_id`, `campaign`, `run_id`)
- local path metadata (`local_workdir`, `local_spool_dir`)
- local path metadata (`local_workdir`)
- remote identity metadata (`s3_bucket`, `s3_session_prefix`, `s3_run_prefix`)
- `inputs` records
- durable `artifacts` records
@@ -24,17 +24,17 @@ guidance rather than being normalized into a different workspace or remote
namespace.
Decoding rejects unknown typed fields, including informational fields inside
`effective_config` and its nested selection. The schema version remains
`narratio.session-manifest.v1`; there is no compatibility reader that silently
drops retired fields. See [overlay migration](../operations.md#migrating-manifest-overlay-provenance)
for deliberate migration of retired selection provenance. Cleanup progress uses
only the cleanup entry in `stages`.
`effective_config` and its nested selection. The schema version is
`narratio.session-manifest.v2`; there is no compatibility reader that silently
drops retired fields. See [overlay provenance](../operations.md#migrating-manifest-overlay-provenance)
for handling retired selection provenance. Cleanup progress uses only the
cleanup entry in `stages`.
Every persisted session manifest has a non-nil `stages` map. Each entry is
non-nil and its embedded `name` exactly matches its map key; loading never
invents either marker. A missing or unsupported schema version, or incomplete
stage identity, is unsupported local state: move it aside and regenerate it,
or restore a verified current committed snapshot when that is authoritative.
stage identity, is unsupported local state: move it aside before regenerating it
or restoring a supported committed snapshot when that is authoritative.
Prepare records independent `party` and `players` input checksums. In canonical
party mode, the party record retains its campaign source identity while the
@@ -86,10 +86,8 @@ from reviving pre-force results.
Older aggregate-only transcribe success is conservatively regenerated once
when transcribe is selected because it does not bind individual outputs to the
audio bytes used. The session-manifest schema identifier remains
`narratio.session-manifest.v1`; this additive state is accepted by current
Narratio, but older strict-decoding binaries may reject manifests after these
fields have been written.
audio bytes used. The transcribe subcollection has its own version independent
of the session-manifest marker.
### Analyze-owned artifact state
@@ -332,12 +330,11 @@ writes, or run-directory creation. Excluded prefix records are not passed to
resume validators. Records after the selected end are not prerequisites and
may be made stale by selected work without being scheduled.
After a publish commits remotely, any configured local cleanup is first recorded
as a session-manifest obligation before deletion begins. Each target becomes
complete only after its confined deletion (or safe absence check) and a
successful manifest save. An incomplete obligation is retried when publish
executes again and retains the committed run and remote identity that authorized
it; an invocation that does not execute publish does not perform cleanup.
Cleanup is an ordinary selected stage. It validates recorded successful
publication evidence before deleting local run history, saves its normal stage
transition, and retries incomplete work on a later selected invocation without
republishing. Historical run-local paths in records are provenance, not a
requirement that those files remain present. See [cleanup](stage-cleanup.md).
Each invocation derives campaign, session, run, local-path, and remote-prefix
metadata from the validated resolved configuration as one projection. A persisted
@@ -373,4 +370,13 @@ where the last session transition can require operator interpretation.
- Transcribe speaker state: `internal/manifest/transcribe_state.go`
- Package tests: `internal/manifest/*_test.go`
- Assembled execution behavior: `internal/app/runner_test.go`,
`internal/app/run_stage_test.go`
`internal/app/run_selection_test.go`
## Prepared Glossary Evidence
Preparation records four distinct glossary input kinds with canonical paths,
checksums, sizes, and provenance. Polish records the resolved glossary identity
evidence used for its result; preflight itself records no stage success. Publish
and restore carry the prepared inputs using their declared manifest identities.
See [prepare](stage-prepare.md), [polish](stage-polish.md), and
[artifact internals](artifacts.md).

View File

@@ -8,6 +8,9 @@ in the [CLI](../cli.md), [Configuration](../config.md),
Externally observable tool and format contracts belong under
[Integrations](../integrations/).
Configuration and CLI integration use [ConfigKit v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/consumers/README.md) and [CommandKit v0.8.0](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/consumers/guide.md); the upstream guides
own their APIs.
## Execution Path
```text
@@ -16,36 +19,43 @@ cmd/narratio -> internal/app -> configuration and production composition
-> manifests and artifact resolution -> durable local/remote output
```
The executable delegates process behavior to the application boundary. The
The executable supplies signal-aware context and caller-owned streams to the
native CommandKit application boundary. The
application resolves configuration, composes concrete collaborators, acquires
session safety controls, and runs commands. Pipeline commands execute the
canonical stage sequence through adapter interfaces, while manifests record
progress and artifact services resolve durable inputs and outputs.
The pipeline runner follows one explicit invocation lifecycle: inspect bounded
prerequisites without mutation, prepare the workspace layout, acquire one
session lock, load or create the authoritative session manifest, compose only
the collaborators needed by the selected range, execute each selected stage in
order, and then return the summary. Cleanup, when selected, is the ordinary
final stage rather than runner finalization work.
The lock remains held from manifest initialization through finalization, and a
prerequisites without mutation, acquire the workspace lock, prepare the workspace
layout, load or create the authoritative session manifest, complete or
reuse selected preparation, check projected downstream work, compose only the
collaborators needed by selected work, execute each selected stage in order, finalize terminal state, release resources, and return a possibly partial
summary with preserved failure causes. Narrow terminal local persistence detaches
cancellation; active work retains the canceled operation context. Cleanup, when
selected, is the ordinary final stage rather than runner finalization work.
The lock remains held from layout preparation through finalization, and a
failed stage or required manifest save prevents later stages from starting.
Standalone preflight shares that lifecycle, runs only preparation, and checks
enabled capabilities while holding the same lock.
## Components
| Area | Implemented owners | Responsibility |
| --- | --- | --- |
| Executable | `cmd/narratio` | Process entry, standard stream wiring, argument handoff, and exit status. |
| Application orchestration | `internal/app` | Command dispatch, configuration selection, secret-file environment loading, production composition, session locking, planning, execution, restore, and user-facing reporting. |
| Configuration | [`internal/config`](configuration.md) | ConfigKit-backed pipeline imports and overlays, canonical party and family expansion, strict YAML loading, defaults, normalization, session templating, and validation. |
| Application orchestration | `internal/app` | Native CommandKit declarations/reporting, lazy configuration selection, secret-file environment loading, production composition, workspace locking, planning, execution, restore, and user-facing reporting. |
| Configuration | [`internal/config`](configuration.md) | Typed ConfigKit results and lifecycle defaults, imports/overlays, canonical party loading, separate catalog/player/publication derivation, session templating, and validation. |
| Pipeline stages | `internal/stage` | Canonical stage registry, shared stage contract, execution dependencies, and implemented stage behavior. |
| Glossaries | `internal/glossary` | Native vocabulary resolution, schema validation, party projection, and deterministic documents. |
| Downstream preflight | [`internal/preflight`](preflight.md) | Assess Audita, Notarius, and prompt requirements for execution and standalone preflight. |
| External boundaries | `internal/adapters`, `internal/audio` | WhisperX HTTP, downstream subprocesses, notification, object storage, and S3 audio materialization behind Narratio contracts. |
| Manifests | `internal/manifest` | Durable session progress, stage transitions, validation, and atomic persistence. |
| Artifacts and paths | `internal/artifacts`, `internal/pathsafe` | Artifact identities and resolution, local and remote path/key models, current-state discovery, and confined relative destinations. |
| Previous-session cache | `internal/previouscache` | Deterministic planning and materialization requirements for configured previous-session inputs. |
| Artifact policy | `internal/artifactpolicy` | Source and destination policy, configured artifact identity validation, and publish destination safety. |
| Shared models and file operations | `internal/artifactmodel`, `internal/contracts`, [`internal/fileops`](fileops.md) | Transcript and artifact data contracts plus atomic single-file replacement, bounded reads, workspace modes, and root-scoped cleanup helpers. |
| Logging | `internal/logging` | Application logger construction and shared structured logging behavior. |
| Logging | `internal/logging` | Small Narratio-owned diagnostic/progress interface adapted to the invocation reporter. |
The application boundary composes concrete implementations. Stages depend on
Narratio-level contracts; external transport and SDK details remain in
@@ -107,9 +117,11 @@ so any earlier replacement can stale a prior cleanup result.
## Focused Documentation
- [Configuration Internals](configuration.md): pipeline imports and overlays,
field ownership, decoding, and root-relative path semantics.
field ownership, decoding, and source-relative resource semantics.
- [Adapter Internals](adapters.md): external adapter boundaries, composition,
failure behavior, and test surfaces.
- [Preflight Internals](preflight.md): projected target selection and shared
requirements assessment and standalone preparation.
- [Artifact Internals](artifacts.md): source identities, runtime catalog,
resolution, previous requirements, and current-state helpers.
- [Manifest Internals](manifest.md): session records, persistence, and execution
@@ -137,4 +149,4 @@ before changing behavior.
The stage registry is implemented in `internal/stage/placeholders.go` and its
ordering is protected by `internal/app/planner_test.go`. Cross-invocation skip,
force, failure, and invalidation behavior is exercised in
`internal/app/runner_test.go` and `internal/app/run_stage_test.go`.
`internal/app/runner_test.go` and `internal/app/run_selection_test.go`.

View File

@@ -0,0 +1,45 @@
# Internal: Downstream Preflight
The application runs automatic downstream checks after selected preparation and
before selected processing. It projects remaining work against a clone of the
locked manifest, using the stage decisions and analysis planner shared with
`session plan`. Projected polish selects Audita; projected enabled extraction
selects Notarius; projected trim and analysis select Scriptorium requirements.
A projection is not an execution commitment, and an empty target set invokes no
checker.
Standalone `preflight` acquires configuration once and uses the runner's locked
invocation lifecycle to execute or reuse `prepare`. Within that same lock it
selects all enabled capabilities and prompt prerequisites regardless of reuse,
then invokes the shared downstream request builders and checkers. A preparation
failure blocks probes requiring prepared inputs but permits independent prompt
and remote-lock inspection while the context remains active. Preparation success
is persisted even when later readiness fails; readiness itself creates no stage
or reusable success record.
Shared finalization retains terminal manifest evidence while locked. Normal
pipeline execution projects that evidence into its run-artifact inventory;
standalone preflight returns its readiness report without building that inventory.
Audita receives verified prepared glossary files and production selections with
an embedded synthetic transcript. Its adapter performs native provider smoke
checks and retains failure causes. Notarius receives production controls and
verified reference snapshots, which are checked again after its native call.
The application projects transcript-producing work before allowing a verified
current transcript; otherwise it reports the synthetic fallback. Neither probe
publishes work, and the synthetic input cannot establish real-transcript
feasibility or editorial quality.
Scriptorium input-map keys remain binding names distinct from Narratio source
IDs. Missing required bindings or variables and inspection failures are errors;
optional sources for required inputs, conditional requirements, incomplete
discovery, and discovery issues produce warnings. Findings survive independent
failures and cancellation stops new work.
Probe files use invocation-scoped destinations under `runs/`, protected by the
workspace lock through report consumption, reference verification, and terminal
persistence. A later authorized cleanup can remove those files without removing
durable prepared inputs. See [workspace internals](workspace.md),
[CLI](../cli.md#preflight), and [operations](../operations.md#prompt-requirements-preflight).
Implementation is in `internal/preflight`, `internal/app/downstream_readiness.go`,
`internal/app/runner_preflight.go`, and `internal/app/session_readiness.go`.

View File

@@ -20,7 +20,7 @@ dependency order, and safely materialize validated outputs.
Supported source families:
- built-ins: `narratio.transcript.*`, `narratio.bounds.session`
- prepared stable inputs: `narratio.input.players`, `narratio.input.party`,
`narratio.input.glossary`, `narratio.input.spell_catalog`
`narratio.input.glossary.{party,campaign,setting,spells,combined}`
- configured artifacts: `narratio.artifact.<key>`
- extraction lanes: `narratio.extraction.<key>`
- previous-session cache: `narratio.previous_session.artifact.<key>`
@@ -53,7 +53,7 @@ Supported source families:
manifest record and durable output pass the configured-artifact evidence
contract; an incidental or stale canonical file is unavailable.
- validates selected artifact dependency order (cycle-safe topo ordering).
- consumes only the concrete dependency graph finalized by configuration;
- consumes only the concrete dependency graph derived in the shared domain catalog;
planning, prerequisite closure, execution, reuse, invalidation, and semantic
evidence do not infer a second graph from inputs.
- resolves required/optional inputs per artifact source definition into an
@@ -141,6 +141,10 @@ Supported source families:
- resolves previous-session sources from local `previous/` cache only.
- runs optional render-debug, then artifact execution.
- validates non-empty output files and materializes canonical outputs.
- shares effective prompt context and variables with requirements inspection;
preview and generation capture their own results separately from stderr logs.
Application preflight selects projected work through the same planner; see
[preflight internals](preflight.md).
## Failure Semantics

View File

@@ -1,54 +1,28 @@
# Stage: cleanup
## Purpose
## Purpose And Authorization
Remove explicitly configured local data for the run selected by a successful
publish commit. Cleanup is the twelfth and final canonical stage, after
`notify`.
## Authorization And Targets
Cleanup is disabled unless at least one of these policies is true:
- `pipeline.spool.delete_audio_after_publish`
- `pipeline.workspace.cleanup_after_publish`
An enabled cleanup requires the manifest's publish stage to be succeeded with
`uploaded=true`, a canonical `published_run_id`, and the exact remote commit and
current commit-pointer keys for the manifest campaign/session prefix. The
configured campaign and session must match the manifest. Cleanup derives its
only possible targets through the canonical artifact path helpers:
- the published run's session spool-audio directory; and
- the published run's workspace run directory.
It does not scan parent directories, infer the newest run, or read object
storage. Every deletion uses the root-confined file operation, which rejects a
root itself, traversal, symlink escape, and out-of-root targets.
The final selected cleanup stage removes local run history after successful
publication when `workspace.cleanup_after_publish` is enabled. It validates the
published run, commit and pointer evidence and configured campaign/session
identity. Explicit whole-session cleanup is a separate operator action.
## Execution And Resume
Disabled cleanup records an explicit skipped result. Enabled cleanup removes
targets in deterministic policy order and treats an already-missing target as
success. A successful record contains the published run ID and completed policy
names.
Cleanup removes recognized managed stage and restore log/debug links without
following them, then deletes the selected session's entire `runs/` directory
through a confined workspace root. Missing runs and links are successful;
unsafe paths and managed-name conflicts fail. Subprocess state, caches, durable
session products and remote objects are outside its scope.
A previous cleanup success is reusable only while its semantic configuration
matches and every selected target remains absent. A recreated target makes the
stage non-resumable. A failure is recorded against cleanup; publish remains
succeeded and remote current state is unchanged. On a later normal full run,
valid upstream stages are skipped and cleanup is retried without republishing.
`narratio publish` selects publish only and never invokes cleanup. A bounded run
through `notify` or any earlier endpoint also excludes it. Operators may run
`narratio run-stage cleanup <session_id>` directly; missing, failed, malformed,
or identity-mismatched publication evidence fails before deletion.
Resume inspects both the runs directory and managed views without mutation. An
empty runs directory, a new attempt, or a dangling managed view requires cleanup
again. Deletion is not transactional: a failure can leave partial progress and
is recorded as a failed stage. A later selected cleanup retries without another
publish. See [operations](../operations.md#cleanup).
## Implementation And Tests
- Planning and evidence validation: `internal/stage/cleanup_plan.go`
- Execution and resume: `internal/stage/cleanup.go`
- Root-confined deletion: `internal/fileops/cleanup.go`
- Focused tests: `internal/stage/cleanup_plan_test.go`,
`internal/stage/cleanup_test.go`, and
`internal/app/cleanup_orchestration_test.go`
`internal/stage/cleanup_plan.go`, `cleanup.go`, `internal/fileops/cleanup.go`,
`attempt_views.go`, and their tests own authorization, inspection, managed view
removal and confined deletion.

View File

@@ -2,147 +2,42 @@
## Responsibility
`extract` runs after `render` and before `analyze`. It converts the canonical
`narratio.transcript.final_trimmed` JSON into configured Notarius lane artifacts.
An omitted or disabled Notarius section makes the stage explicitly self-skip
with reason `notarius_disabled`, no outputs, and no Notarius runner.
The external protocol is documented in the
[Notarius integration contract](../integrations/notarius.md). Configuration
fields belong in [Configuration](../config.md), and physical paths and force
procedures belong in [Operations](../operations.md).
The extract stage invokes the configured Notarius pipeline on the verified
final trimmed transcript and prepared references, promotes configured lane
products, and records Narratio-owned content evidence. Notarius owns its
pipeline, cache, validation and completion protocol; see the
[integration contract](../integrations/notarius.md).
## Lifecycle
`internal/stage/extract.go`:
1. resolves the final trimmed transcript from the shared artifact catalog;
2. resolves every configured prepared reference through the shared
manifest-authoritative identity resolver before creating run-local output;
3. resolves each reference to a stable content-addressed session snapshot,
reusing verified bytes or reconstructing a missing/corrupt regular entry,
and rejects any source change observed while copying;
4. fingerprints the byte- and provenance-bearing Notarius invocation evidence,
including sorted reference identities and the explicit downstream
configuration-overlay selection;
5. creates a run-local staging directory and invokes the injected
`notarius.Runner`, carrying the optional already-resolved credential
reference without exposing its value, the optional exact configuration
overlay, plus effective resume and chunk-cache controls after force
precedence;
6. revalidates the reference snapshots, then validates the v2 successful
receipt, confined index, management documents, configured required lane
descriptors, validation summaries, and regular payload files;
7. atomically promotes the complete bundle to its immutable durable location;
8. records one non-selectable `notarius_index` output and one selectable
`notarius_lane` output per configured lane; and
9. registers each lane as `narratio.extraction.<output_key>` for downstream
Scriptorium and publish resolution.
Lane records retain checksum, contract, producer run ID, and Notarius system,
run, pipeline, and lane provenance. Stage metadata retains the durable bundle
root, receipt, diagnostic paths, rejection/warning summaries, producing
Narratio run ID, the resolved trimmed-input identity, and invocation
fingerprint. The input identity binds the exact transcript bytes, canonical
source ID, producer stage/output/run identity, and resolution provenance.
Reference metadata contains only selector, source ID, canonical session-relative
path, checksum, and size; adapter requests receive selector and absolute stable
snapshot path, never payload contents. Snapshot bytes must
match the prepared identity both before and after Notarius runs, so a concurrent
prepared-file replacement cannot make recorded provenance describe different
bytes from those supplied to Notarius.
Validation completes before the single durable rename, so a rejected result
cannot expose a partial durable bundle.
Snapshot destinations are owned by `internal/artifacts` under
`cache/notarius/references/<sha256>/<prepared-basename>`. They contain no run ID
or timestamp and can be reused across invocations. Identical bytes and basename
share a verified file; changed bytes select a different digest directory.
Unsafe path components and non-regular conflicts fail without recursive
deletion. Snapshot paths are delivery details and never become manifest output
evidence or prerequisites for reuse of an already complete extract bundle.
Any executed extraction outcome that replaces a different effective outcome
marks succeeded analysis and delivery dependents stale. Render is an independent
sibling and remains current. Repeating the same disabled self-skip with no
outputs is stable and does not repeatedly invalidate dependent stages.
Disabled extraction records a skip. An execution resolves manifest-backed input
identities, creates immutable content-addressed reference snapshots, and invokes
Notarius with run-local output, log and debug destinations. The adapter accepts a
successful native completion report for the expected pipeline and confined output
directory. The stage reads each configured lane JSON, validates its safe path and
content, then promotes all required products to flat artifact paths before
recording success. The original bundle and optional domain auxiliaries stay in
the producing run until authorized cleanup removes run history. Positive native
fallback counts are recorded and reported.
## Resume Validation
Before the focused validator runs, the application compares extract's versioned
semantic fingerprint. It covers enablement, Notarius pipeline identity, sorted
reference selector/source mappings, sorted declared output contracts, and each
canonical `narratio.extraction.<key>` output identity. It also covers the
explicit Notarius configuration-overlay selection; omitted, empty, and exact
`default` selectors share the base-selection identity. It excludes executable,
timeout, working directory, config path, and private Notarius config contents.
Credential presence, reference name, and resolved value are likewise
operational-only and excluded. Ordinary command loading still resolves a
selected reference before resume evaluation, but a credential-only change does
not rerun a valid completed extraction or stale its dependents.
`internal/stage/extract_resume.go` then permits a skip only when the existing
stage record still matches the current byte- and provenance-bearing invocation
evidence. That evidence covers the current direct trimmed-transcript identity,
sorted prepared-reference identities, pipeline identity, and configured output
contracts, plus the same downstream overlay-selection identity. The same
reference helper and transcript identity are resolved again for artifact
evidence, so changing current transcript bytes, reference bytes, producer
identity, or a named downstream selection makes the prior extraction obsolete.
Operational runner settings do not invalidate otherwise current durable
evidence. This includes `resume` and `chunk_cache`; changing them alone cannot
make a complete extraction non-resumable. If extraction executes, ordinary
runs forward the configured values, while force disables resume and selects
`refresh`.
A valid prepared-reference change makes extraction non-resumable. Missing,
unsafe, or checksum-inconsistent prepared evidence is a hard validation error
with prepare-force guidance because an immediate extract rerun cannot succeed.
The validator then checks the producing run identity, canonical immutable
bundle root, path confinement and absence of symlink components, receipt
identity, exactly one canonical index, the exact configured source set,
contracts and provenance, regular-file status, and stored checksums. Missing or
obsolete results are non-resumable and run again; unsafe filesystem conditions
return an error rather than silently accepting or replacing data.
This sensitivity is limited to the explicit downstream selector. Narratio's
own overlay label and whole effective-configuration digest are not blanket
extraction invalidators. Neither contract can observe files imported by
Notarius configuration, profile contents, prompt/module definitions, or other
transitive inputs. Operators must force extraction after changing any such
private input behind a stable identifier.
Resume checks the direct transcript identity, configured pipeline and lane
selection, reference identities, and manifest-backed output checksums and sizes.
It does not reopen the original bundle or completion report.
Cache and debug selection, executable version and private downstream config are
not blanket invalidators. Force invokes extraction with cache refresh. A failed
replacement is not represented as a current successful extraction.
## Failure Behavior
Adapter startup, timeout, nonzero exit, receipt decoding, path confinement,
index compatibility, inconsistent warning or diagnostic envelopes,
required-lane rejection or incomplete validation, payload inspection,
checksum, or installation errors fail the stage through ordinary manifest
transition handling.
Stdout receipt and stderr diagnostics remain separate. Downstream stages are
not given selectable extraction sources unless the complete configured result
has passed validation and installation.
When a replacement attempt begins, the current session-stage record no longer
advertises payload from the previous success. A failed replacement therefore
has no current outputs, logs, generated configuration references, or metadata,
while the earlier immutable promoted bundle remains available for audit and
recovery.
Native errors, malformed completion, missing required lanes, unsafe paths, or
invalid JSON fail the attempt while preserving available diagnostics. A partial
report or incidental output is not success. See [operations](../operations.md#extraction-workflow).
## Implementation And Focused Tests
- Stage execution, selection, and resume validation: `internal/stage/extract.go`,
`internal/stage/extract_resume.go`,
`internal/stage/extract_test.go`,
`internal/stage/semantic_contracts_delivery.go`
- Stable snapshot materialization and verification:
`internal/stage/extract_references.go`
- Subprocess boundary: `internal/adapters/notarius/subprocess.go`,
`internal/adapters/notarius/subprocess_test.go`
- Catalog hydration: `internal/artifacts/extraction_catalog.go`,
`internal/artifacts/extraction_catalog_test.go`
- Composition and downstream behavior: `internal/app/runner_test.go`,
`internal/stage/analyze_test.go`, `internal/stage/publish_test.go`
- Opt-in Notarius v0.8.1 production-boundary coverage:
`internal/stage/notarius_cache_integration_test.go`
`internal/stage/extract.go`, `extract_preflight.go`, `extract_native_test.go`,
`internal/artifacts/extraction_evidence.go`, and `internal/adapters/notarius/`
own the stage, readiness, evidence and subprocess boundaries. The opt-in
`notarius_cache_integration_test.go` exercises a real executable.

View File

@@ -1,58 +1,23 @@
# Stage: polish
## Purpose
Polish resolves the base transcript from verified merge evidence and all four
prepared glossary documents from manifest-backed input records. It invokes the
Audita adapter with those paths and configured downstream selectors, then
validates the returned transcript before promoting `transcripts/polished.json`.
The transcript is the only canonical output. Available ordinary reports,
stdout/stderr, and the generated invocation record are run-local diagnostics;
Audita's work directory is separately selected. The [Audita contract](../integrations/audita.md)
owns invocation and diagnostic behavior.
Run Audita polishing on base transcript and produce polished transcript.
Polish records the prepared glossary identities as resume evidence alongside
semantic configuration. Changes to effective glossary content require new
polish work through ordinary prepare invalidation. Credentials, executable,
timeout, and diagnostics are operational. Narratio does not fingerprint the
contents of Audita-owned configuration or profiles: force polish after changing
those files behind unchanged selectors. Older evidence is reconsidered when
polish is selected; a downstream-only invocation does not eagerly run it.
## Inputs
- `transcripts/base.json`
- `inputs/glossary.yml`
## Outputs
- `transcripts/polished.json`
The transcript is the only canonical output. Available `errors.yml`,
`recoveries.yml`, and `report.md` remain beside the run-local transcript and
are recorded as diagnostics, not artifact outputs.
## Key Behavior
- resolves base transcript only from verified merge manifest output evidence.
- invokes an Audita v2 runner with external configuration selectors and
explicitly forwarded provider credentials; the invocation supplies paths.
- validates processed transcript structure (`segments` array required).
- validates reported diagnostic paths against the three fixed adjacent names.
- materializes only the canonical transcript; records available reports with
stdout/stderr logs, generated invocation, and safe adapter metadata.
## Invariants
- polished transcript schema validation is mandatory.
- reports are optional diagnostics; Audita's external configuration may disable
them. A failed invocation never promotes an incidental transcript.
## Resume Semantics
Version 2 semantic evidence covers Audita's config path, downstream overlay,
proposal and validation profile selectors, ordered module selection (including
the distinction between omission and an explicit empty list), transcript
description, output schema, and canonical polished-transcript identity.
Credentials, executable path, timeout, and diagnostics are operational and do
not invalidate a successful result. Public credential reference names may
participate in configuration provenance but never expose resolved values.
Narratio fingerprints selections, not the contents of Audita-owned config or
profiles. Force `polish` after changing those files behind unchanged selections.
When polish is selected, older semantic evidence is reconsidered and the stage
reruns; a downstream-only invocation does not eagerly run polish.
## Related Contracts And Tests
- [Audita](../integrations/audita.md) owns subprocess, validation, and failure
semantics.
- [Configuration](../config.md#pipeline) owns operator-selected Audita values.
- Implementation and tests: `internal/stage/polish.go`,
`internal/stage/polish_test.go`,
`internal/stage/semantic_contracts_refinement.go`
A failed invocation does not promote an incidental output. Preflight is an
invocation check after preparation, not a successful polish record. See
[preflight internals](preflight.md), `internal/stage/polish.go`,
`internal/stage/polish_resume.go`, and their focused tests.

View File

@@ -7,8 +7,7 @@ Materialize canonical current-session inputs before processing stages.
## Inputs
- resolved campaign, session, and pipeline configuration
- stable input files (`speakers`, `autocorrect`, `glossary`, `players`, `party`)
- optional spell-catalog overlay
- the stable speakers input, inline autocorrection rules, canonical party, and optional glossary selections
- one resolved local or S3 audio source
- enabled configured artifact input requirements for previous-session sources
@@ -19,30 +18,34 @@ Materialize canonical current-session inputs before processing stages.
- `inputs/pipeline.resolved.yml`
- `inputs/speakers.yml`
- `inputs/autocorrect.yml`
- `inputs/glossary.yml`
- `inputs/glossaries/{party,campaign,setting,spells,combined}.yml`
- `inputs/players.yml`
- `inputs/party.yml`
- optional `inputs/spell_catalog.json`
- `audio/*.flac`
- optional `previous/manifest.json`
- optional `previous/artifacts/**`
- prepared recordings in `audio/`
- optional `inputs/previous/manifest.json`
- optional `inputs/previous/artifacts/**`
- deterministic `manifest.inputs` entries (checksums + provenance)
## Key Behavior
- validates required config/store state.
- validates required config/store state and resolves selected vocabulary before audio work.
- derives the party glossary and resolves the remaining named collections through
`internal/glossary`; writes four individual shared envelopes and a combined
envelope with checksums, sizes, and provenance. The combined record declares
its four individual input dependencies.
- enforces local audio vs S3 audio mutual exclusivity.
- rejects duplicate explicit local audio sources after resolution.
- uses `internal/audio` for read-only source discovery shared with inspection;
rejects duplicate explicit local audio sources after resolution.
- gives distinct local source paths with the same basename deterministic unique
prepared filenames so neither source is overwritten.
- materializes S3 audio through spool/cache-aware logic.
- materializes a configured spell catalog with checksum and provenance, or
safely removes an obsolete canonical spell catalog and its manifest record
when the effective input is omitted.
- copies the validated canonical party bytes unchanged and deterministically
generates the prepared players projection.
prepared filenames so neither source is overwritten; unresolved speaker-ID
collisions fail before audio materialization.
- downloads S3 audio into a temporary sibling before verifying and installing the prepared copy; its recorded identity comes from the same response as the bytes.
- writes effective autocorrection rules as a Seriatim envelope, with checksum,
size, and source provenance, including an empty list when no rules apply.
- renders standalone effective campaign, session, and canonical party documents,
and deterministically generates the prepared players projection.
- scans enabled configured artifact inputs for `narratio.previous_session.artifact.*` requirements.
- clears managed `previous/` state on every invocation, then, when requirements exist:
- clears managed `inputs/previous/` state on every invocation, then, when requirements exist:
- resolves the pointer-selected previous source through the shared resolver;
- downloads previous manifest/artifacts;
- records previous inputs in `manifest.inputs`.
@@ -55,10 +58,10 @@ cache path, then validates the committed checksum, size, and generation.
## Invariants
- only `prepare` hydrates canonical `previous/` cache state.
- managed previous artifacts are stored under `previous/artifacts/**` without
- only `prepare` hydrates canonical `inputs/previous/` state.
- managed previous artifacts are stored under `inputs/previous/artifacts/**` without
duplicate `artifacts/artifacts/` nesting.
- managed `previous/` state represents only the current requirement set.
- managed `inputs/previous/` state represents only the current requirement set.
- `manifest.inputs` ordering is deterministic (`kind`, `path`).
## Resume Evidence
@@ -71,21 +74,21 @@ previous-artifact requirement set. A change reruns prepare and
stales its fixed descendants. Existing successful records without this
evidence rerun once when selected.
Workspace, spool, and cache placement and absolute source relocation are not
semantic when logical selection, canonical names, and bytes are equivalent.
Workspace placement are not semantic when logical selection,
canonical names, and effective bytes are equivalent.
The fingerprint deliberately does not read or rehash large audio. Prepared
input checksums remain the content provenance. Before reusing success, prepare
validates every durable prepared copy and compares current stable-input bytes,
canonical party and derived-player bytes, local audio membership/checksums, or
S3 key/size/entity-tag identity with that provenance. Source relocation with
equivalent names and bytes remains reusable; changed or unavailable evidence
causes a normal prepare rerun.
effective campaign/session, canonical party, derived-player and resolved glossary
bytes, local audio membership/checksums, or S3 key/size/entity-tag identity with that provenance.
Source relocation with equivalent effective documents, names, and bytes remains
reusable; changed or unavailable evidence causes a normal prepare rerun.
## Related Contracts And Tests
- [Configuration](../config.md) owns audio selection, stable input fields, and
previous-session settings.
- [Operations](../operations.md) owns physical input, audio, spool, cache, and
- [Operations](../operations.md) owns physical input, audio, and
previous-state layout.
- [Storage Internals](storage.md) and [Artifact Internals](artifacts.md) explain
the internal collaborators.
@@ -95,5 +98,5 @@ causes a normal prepare rerun.
`internal/stage/prepare_resume_test.go`,
`internal/stage/semantic_contracts_initial.go`,
`internal/stage/semantic_contracts_initial_test.go`,
`internal/audio/s3_audio_test.go`,
`internal/audio/discovery_test.go`, `internal/audio/s3_audio_test.go`,
`internal/previouscache/*_test.go`

View File

@@ -15,8 +15,8 @@ Upload run/session outputs to object storage and atomically advance remote curre
## Outputs
- uploaded session manifest, declared run-local diagnostics, and selected
publish outputs;
- uploaded session manifest, prepared campaign/session/party inputs, declared
run-local diagnostics, and selected publish outputs;
- uploaded durable previous-session cache files when present;
- immutable run-scoped commit manifest; and
- current commit pointer, written last.
@@ -34,7 +34,10 @@ and optional rules, destination resolution, and collision inputs live in
remote verification live in `publish_transfer.go`; committed-manifest,
immutable-commit, and current-pointer encoding and writes live in
`publish_commit.go`. `publish_output_plan.go` owns the deterministic, I/O-free
five-outcome model and its secret-free metadata projection.
five-outcome model and its secret-free metadata projection. Prepared input
objects are committed under the immutable run; the committed standalone session
supports remote loading when no authored session override is available. The
[configuration reference](../config.md#sessionyml) owns input selection.
- when publishing or run upload is disabled, completes successfully with no
outputs and records explanatory metadata. This is not an explicit self-skip:
@@ -58,8 +61,11 @@ five-outcome model and its secret-free metadata projection.
canonical file, aggregate output, stale/failed/unselected record, or
mismatched path, size, or checksum remains unavailable. Built-in and
extraction sources likewise require their own current manifest evidence.
- includes the four manifest-backed prepared glossary documents with their
declared input identities for restore;
- publishes extraction lanes only through explicit configured output rules;
neither run-local nor durable Notarius bundles are scanned or uploaded wholesale.
original Notarius bundles are not scanned or uploaded wholesale. Historical
run-local references are not required for later publication.
- selected artifact filter applies to configured artifact sources only.
- plans every configured output into exactly one source-sorted outcome:
`published`, `carried_locked`, `locked_unpublished`, `optional_missing`, or
@@ -69,11 +75,13 @@ five-outcome model and its secret-free metadata projection.
an earlier run in the same session and retains its source, key, checksum,
size, and generation; the bytes are not copied.
- verifies a carried object's exact key, size, and generation through object
metadata without downloading or opening the local output source.
metadata without downloading or opening the local output source; catalog
hydration skips carried output payloads.
- an initially locked source with no prior declaration remains absent even
when the output rule is required. Optional missing unlocked outputs remain
absent; required missing unlocked outputs fail.
- creates one complete immutable source-to-destination mapping before upload;
- creates one complete immutable source-to-destination mapping before upload,
then opens, verifies, transfers, and closes sources sequentially;
- uploads and verifies every declared immutable object and the commit manifest;
- writes the immutable commit from the combined new and exact carried
declarations.
@@ -101,9 +109,10 @@ Includes counts/lists for:
- run files, selected outputs, previous-cache files, and the committed session
manifest are all declared by an immutable commit under the run prefix.
- run and previous uploads contain only manifest-declared regular files opened
from verified descriptors; symlinks, special files, replacement races, and
undeclared entries are rejected or ignored before uploads begin.
- run-local diagnostics, including Notarius receipt and stderr files, are
from verified descriptors. Symlinks, special files, and changed declared
content are rejected; undeclared entries are ignored. A later invalid source
can leave earlier immutable uploads unselected.
- run-local diagnostics, including Notarius completion report and stderr files, are
archived only when recorded by the session manifest. A run with no declared
current-run diagnostics legitimately uploads none.
- independent publish locks are not overridden by `--force`; every initially
@@ -126,7 +135,7 @@ evidence does not replace those safety checks.
The commit boundary and cleanup authorization are normative architecture invariants; see
[Architecture](../policy/architecture.md#publish-commit-boundary).
Publish never deletes local state. The standalone `publish` command selects
Publish never deletes local state. `run SESSION --stage publish` selects
only this stage; a full run selects notify and cleanup afterward.
## Related Contracts And Tests

View File

@@ -6,7 +6,7 @@ Generate raw per-speaker transcripts from prepared audio using WhisperX.
## Inputs
- `audio/*.flac` from `prepare`
- prepared recordings in `audio/` from `prepare`
## Outputs
@@ -15,7 +15,9 @@ Generate raw per-speaker transcripts from prepared audio using WhisperX.
## Key Behavior
- discovers prepared audio from manifest inputs or the canonical audio
directory and derives each speaker identity from its `.flac` filename.
directory. Manifest-selected files are authoritative; fallback scans use the
shared candidate filter. Speaker IDs remove the final filename extension;
duplicate IDs are rejected before dispatch.
- hashes the current audio and reconciles it with the versioned per-speaker
completion collection before starting HTTP work.
- reuses only records whose audio identity, observable WhisperX semantics,
@@ -83,7 +85,7 @@ reuse it normally.
- [WhisperX](../integrations/whisperx.md) owns HTTP, retry, timeout, and
cancellation semantics.
- [Configuration](../config.md#pipeline) owns concurrency and other
- [Configuration](../config.md) owns source selection, concurrency, and other
operator-selected values.
- Implementation and tests: `internal/stage/transcribe.go`,
`internal/stage/transcribe_reconciliation.go`,

View File

@@ -17,6 +17,7 @@ applies a bounds-driven trim.
## Key Behavior
When `trim.enabled=true`:
- shares the effective prompt context with early requirements inspection;
- runs Scriptorium bounds artifact generation;
- optionally runs render-debug output generation;
- validates bounds payload against transcript;
@@ -32,6 +33,12 @@ When `trim.enabled=false`:
- normalized transcript is required input.
- bounds output exists only in enabled trim path.
- render-debug output is diagnostic and not a declared stage output.
- prepared preview and generated bounds use separate result destinations;
Scriptorium stderr and invocation records are the diagnostic references.
The application checks projected bounds requirements before attempting any
stage. See [preflight internals](preflight.md); actual transcript resolution and
bounds validation remain responsibilities of this stage.
## Resume Semantics

View File

@@ -13,7 +13,6 @@ operator-selected storage fields and credential mechanisms belong in
- `List(ctx, prefix)`
- `Read(ctx, key)` returns an object body and the generation observed with it
- `Download(ctx, key, localPath)`
- `Upload(ctx, localPath, key, opts)`
- `UploadConditional(ctx, source, key, opts, condition)`
- `Delete(ctx, key)` removes one object and succeeds when it is already absent
@@ -30,6 +29,11 @@ limit-plus-one read. It closes the body on every exit. Callers own the policy
limit and add the control-object category to errors; this helper is not used for
large artifact payloads.
`StreamObject` transfers payloads to caller-owned writers using the metadata
from the same response. It checks a caller-declared size or the observed size
when available, reads at most one byte beyond that size, and closes the body.
Unknown-size responses stream to EOF; known zero is distinct from unknown.
## Composition
`NewObjectStoreFromConfig` constructs the S3-backed implementation from
@@ -43,7 +47,6 @@ not own discovery, defaults, or configuration validation.
- `List` paginates and returns normalized `ObjectInfo`.
- A truncated S3 listing must supply a new, non-empty continuation token;
otherwise listing fails with bucket and prefix context instead of looping.
- `Download` writes local files with parent directory creation.
- `Upload` streams local file and returns remote metadata.
- `Read` binds a returned body to its S3 ETag. `UploadConditional` maps an ETag
match or absence precondition directly to the provider request and reports a

View File

@@ -8,7 +8,7 @@ retention workflow belong in [Operations](../operations.md#local-state-layout).
## Path Ownership
`internal/artifacts` owns canonical session, run, spool, cache, and
`internal/artifacts` owns canonical session, run, and
previous-cache path construction. `SessionPathsFor` provides the session-scoped
path model, and layout creation goes through `EnsureLayoutFor`. Callers should
consume those helpers instead of rebuilding relative paths.
@@ -32,29 +32,37 @@ materialized into canonical session paths before stage success. Managed
previous-session cache paths remain session-durable and are never redirected
into run-local output space.
Extraction uses run-local receipt, stderr, and output-root helpers, then
validates and renames the external bundle to the unique immutable Notarius
bundle path supplied by `internal/artifacts`. Exact physical paths belong in
[Operations](../operations.md#extraction-workflow).
Polish and extraction write to actual run-local output, log, and debug paths.
Each attempt advances managed relative `logs/<stage>` and `debug/<stage>` links;
skips do not rotate them. Restore has its own diagnostic attempt. Extraction
promotes validated lanes to flat artifacts; the original bundle remains in
the producing run until cleanup. See [Operations](../operations.md#local-state-layout).
Prepared references delivered to Notarius use session-durable paths owned by
`internal/artifacts` beneath
`cache/notarius/references/<sha256>/<prepared-basename>`. These verified
`inputs/references/<sha256>/<prepared-basename>`. These verified
content-addressed snapshots are outside run-local layout, survive ordinary
published-run cleanup, and are excluded from publish and restore enumeration.
session run-history cleanup, and are excluded from publish and restore enumeration.
## Locking
`artifacts.LocalStore` enforces the single-writer session lock via an
operating-system lock held on `.lock` (`ErrLockConflict` on contention). The
`artifacts.LocalStore` enforces single-writer workspace access via an
operating-system lock held on `<workspace.root>/.lock` (`ErrLockConflict` on contention). The
file retains owner metadata after release or process death; its existence is
not evidence that a lock is active. Command and restore flows wait for this
lock only while their context remains active, and report a release failure.
not evidence that a lock is active. Runs, preflight, mutating restore, and
manual cleanup acquire it before creating or changing managed session state.
Initialization targeting managed work also acquires it. They wait only while
their context remains active and report a release failure. Read-only inspection
and dry runs do not acquire it; separate workspaces remain independent.
Standalone preflight holds the same lock through preparation, readiness probes,
and finalization, keeping active probe files outside concurrent cleanup.
Preparation uses ordinary manifest transitions and invalidation.
The runner assigns every invocation a run-workspace identity but creates the
physical directory only before an executing stage that requires it. Fully
reused invocations and cleanup-only invocations therefore do not accumulate
empty run directories.
physical stage run directory only when an executing stage requires it. Fully
reused pipeline invocations and cleanup-only invocations do not accumulate
empty run directories. Readiness probes create their separate invocation-scoped
diagnostic directories when checks run, including during a reused preparation.
## Cleanup Semantics
@@ -65,6 +73,7 @@ The canonical cleanup stage:
ID, remote commit key, and current commit-pointer key;
- consumes the resolved cleanup policy described in
[Configuration](../config.md);
- removes the entire session run history and recognized managed diagnostic views;
- refuses unsafe deletes (root delete, traversal, and out-of-root targets);
- treats missing targets as successful, idempotent deletion; and
- uses its ordinary failed/succeeded manifest stage record for retry. A later
@@ -72,7 +81,7 @@ The canonical cleanup stage:
republishing.
Manual cleanup uses the same root-confined deletion mechanism. Invocation
syntax and exact deletion scope belong in [CLI](../cli.md#clean) and
syntax and exact deletion scope belong in [CLI](../cli.md#session-clean) and
[Operations](../operations.md#cleanup).
## Invariants
@@ -90,7 +99,7 @@ syntax and exact deletion scope belong in [CLI](../cli.md#clean) and
- Path model and local store: `internal/artifacts/paths.go`,
`internal/artifacts/local.go`
- Run-local materialization: `internal/stage/run_local.go`
- Immutable bundle installation: `internal/stage/extract.go`
- Bundle validation and product promotion: `internal/stage/extract.go`
- Workspace modes: `internal/fileops/modes.go`
- Cleanup confinement: `internal/fileops/cleanup.go`,
`internal/stage/cleanup.go`, `internal/stage/cleanup_plan.go`, and

View File

@@ -6,17 +6,13 @@ For command syntax, see [docs/cli.md](./cli.md). For field-level config, see [do
## Campaign and Session Selection
Campaign selection priority:
- `--campaign-file`
- `--campaign`
- `pipeline.campaigns.default_campaign_id`
Session source priority:
- `--session`
- local default search paths
- remote session object (S3) when local session file is not found and storage is configured
Identity and exact-file selection are complementary: a selected file supplies
configuration and an explicit ID asserts its effective identity. Session domain
commands take positional identity; `--session-file` selects its source. An
explicit `--party-file` supplies the roster consistently across consumers.
See [CLI selectors](cli.md#configuration-selectors) and
[configuration discovery](config.md#discovery-and-selection) for selection rules.
Existing scripts should follow the [CLI migration table](cli.md#migration-from-the-previous-cli).
## Session Initialization
@@ -34,22 +30,52 @@ Remote session object:
narratio session init 2026-04-04 --remote --force
```
If `campaign.yml` sets `session_template_file`, `session init` renders it. Template variables must resolve to concrete values.
Installation config supplies services, credentials, and an optional reference
catalog. Onboard a campaign with [campaign.yml](../examples/campaigns/lantern-coast/campaign.yml),
[party.yml](../examples/campaigns/lantern-coast/party.yml), and
[speakers.yml](../examples/campaigns/lantern-coast/speakers.yml). The campaign
selects its roster, speakers, optional catalog sources, inline vocabulary and
replacement rules. The roster describes characters and players; speaker mapping
separately describes recordings. The example uses synthetic catalog data.
Campaigns must provide stable input files for speakers, autocorrect, glossary,
players, and party, and may provide an optional spell-catalog overlay. Session
files may override those paths for one session. The `prepare` stage
materializes them under `inputs/`; configured consumers use the prepared files,
never the original campaign or session source paths. Field definitions and
source IDs are in [Configuration](./config.md#notarius-reference-bindings).
`session init` uses a campaign template if configured, otherwise the installation
template or built-in default. Supply session audio and metadata, for example:
```bash
narratio session init 2026-04-04 --output ./session.yml --audio-dir ./audio
```
Preparation resolves the roster, rules, and vocabularies into standalone inputs.
See [Configuration](config.md#campaign) for fields, inheritance and clearing.
## Migrating to the shared pipeline
Before upgrading an existing deployment, retain its authored sources and any
committed snapshots. Convert campaign identity and inputs to the shared campaign
fields and Narratio extension in [Configuration](config.md#campaign); replace
file-based autocorrection with inline rules and the private spell source with a
shared glossary. Reauthor wrapperless vocabularies as shared envelopes. Remove
retired spool/audio-cache settings, Notarius descriptor fields, `resume`, and
`chunk_cache`; select native `cache` and optional debug controls as needed.
Keep external tool configuration under each tool's ownership: Audita uses its
version 3 configuration and Notarius its version 6 configuration. Consult the
[Audita](integrations/audita.md) and [Notarius](integrations/notarius.md)
contracts for their upstream guides.
Move unsupported local state aside before regenerating it; restore only a
supported committed session manifest, or regenerate and republish. Do not edit
state markers manually. Products now use flat session paths and diagnostics use
latest-attempt views; explicit remote destinations remain independent. Review
cleanup and separately configured subprocess caches before removing old state.
This guidance does not create a release or publish any changes.
## Standard Session Workflow
1. Select pipeline/campaign/session config.
2. Validate session readiness:
2. Prepare inputs and check session readiness:
```bash
narratio session validate 2026-04-04
narratio preflight 2026-04-04
```
3. (Optional) inspect stage decisions:
@@ -70,21 +96,51 @@ narratio run 2026-04-04
narratio session status 2026-04-04
```
Run, plan, and status output identify the resolved pipeline overlay (or `none`)
and effective configuration digest. Status distinguishes the current resolved
value from the last value persisted in the session manifest, which helps
diagnose overlay switches without changing resume authority.
Status distinguishes currently resolved configuration provenance from the last
persisted configuration, helping diagnose overlay switches without changing
semantic resume authority. Run and plan reports describe execution and decisions;
see the [report fields](cli.md#public-domain-report-fields).
Before switching an operational overlay, compare its effective meaning with the
production base through `narratio config diff default <overlay>`.
The command is read-only and succeeds whether it finds differences or not. Its
sorted records describe defaulted, expanded concrete configuration—not source
file layout—so it can be used to review model, artifact, and publish changes
without creating a session or run. Use `narratio config artifacts` to review the
concrete artifact identities, definitions, outputs, and dependencies. Select the
same campaign explicitly when overlays could resolve different campaign paths;
see the [CLI reference](cli.md#config-validate-config-show-config-sources-config-artifacts-and-config-diff)
for syntax and record format.
Before switching an operational overlay, compare its effective configuration
with the base through `narratio config diff --against-overlay NAME`. When using an
explicit root, supply it with both `--config` and `--against-config`. Each side
loads independently using its own defaults. Native inspection retains authored
family declarations; use `narratio artifacts list` to review concrete identities,
outputs, dependencies, and selected-party members. See
[configuration inspection](cli.md#configuration-inspection) for selection and
comparison details.
### Prompt requirements preflight
After selected preparation completes or is reused, Narratio checks downstream
work projected to run before processing continues. Audita preflight uses the
prepared glossary files, a synthetic transcript, and the selected Audita
configuration; its native provider smoke checks are enabled. Notarius inspection
and preflight use its configured pipeline and the verified transcript when available,
or a synthetic transcript otherwise. Both may contact providers. Scriptorium
requirements discovery checks projected trim and analysis bindings. A missing
required binding or failed check stops the invocation; incomplete or conditional
prompt discovery can produce warnings. Already completed work remains recorded.
`session plan` does not invoke these downstream checks.
Standalone `preflight` prepares or reuses the session's real inputs before
checking every enabled downstream capability and prompt prerequisite, including
work whose outputs could be reused. It may create workspace state, download
inputs, update the manifest, and contact providers. Changed inputs can stale
dependent stage records through ordinary preparation rules. Preparation remains
available for reuse if a later readiness check fails. Preflight stops before
processing, publishing, notification, or cleanup.
Audita checks a synthetic transcript. Notarius uses a verified trimmed
transcript only when the normal work projection indicates its producers will
not rerun; otherwise it uses a synthetic input. These checks do not establish
real-transcript feasibility, editorial quality, or future provider availability.
See [Audita](integrations/audita.md) and [Scriptorium](integrations/scriptorium.md).
The workspace lock covers preparation, probes, and finalization. Probe diagnostics
under `runs/` are disposable and can be removed by a later authorized cleanup;
prepared inputs remain durable. Preflight itself does not run cleanup or rotate
processing-stage diagnostic views. See [cleanup](#cleanup).
## Stage Execution and Continuation Behavior
@@ -125,13 +181,13 @@ its fixed descendants without requiring `--force`. Changing prepare selection
semantics likewise reruns all fixed descendants; changing
WhisperX language/service identity reuses prepare; changing a Seriatim merge
transformation reuses prepare and transcribe; and changing a selected Audita
overlay, profile, or module sequence reuses prepare, transcribe, and merge while
rebuilding transcript refinement. A trim change invalidates both render and
overlay or profile reuses prepare, transcribe, and merge while rebuilding
transcript refinement. A trim change invalidates both render and
extract through the fixed dependency relation, while a render-only change
preserves the extract sibling.
Operational timeouts, retry/concurrency tuning, executable paths,
workspace/cache/spool placement, reports, diagnostics, and secret values are
workspace placement, reports, diagnostics, and secret values are
excluded. Configuration, models, prompts, modules, or resources loaded
privately inside external tools remain unobservable to Narratio. If their
contents change behind the same configured identifier, explicitly force the
@@ -148,7 +204,7 @@ the stage self-skip.
Single-stage execution:
```bash
narratio run-stage normalize 2026-04-04 --force
narratio run 2026-04-04 --stage normalize --force
```
Contiguous bounded execution uses inclusive canonical endpoints:
@@ -199,13 +255,15 @@ canonical `transcripts/raw/<speaker>.json` files remain durable, however.
After correcting the underlying problem, retry normally:
```bash
narratio run-stage transcribe 2026-04-04
narratio run 2026-04-04 --stage transcribe
```
Narratio hashes the current prepared audio, validates recorded transcript JSON,
checksum, size, and location, and calls WhisperX only for missing or obsolete
speakers. A changed audio file replaces only its speaker; a changed WhisperX
URL or language makes every current speaker non-reusable. Retry, timeout, and
speakers. Preparation and inspection share read-only [audio selection](config.md#session);
prepared recordings retain their bytes and filename suffixes. A changed audio
file replaces only its speaker; a changed WhisperX URL or language makes every
current speaker non-reusable. Retry, timeout, and
concurrency tuning do not invalidate completed speakers.
Use force only when every current transcript must be replaced, including after
@@ -213,7 +271,7 @@ a WhisperX model or private server-side configuration changes behind the same
URL and language:
```bash
narratio run-stage transcribe 2026-04-04 --force
narratio run 2026-04-04 --stage transcribe --force
```
Force durably clears the reusable collection before sending requests. If that
@@ -242,21 +300,21 @@ Choose the narrowest workflow that matches the intended replacement:
| Intent | Command | Preserved and rebuilt state |
| --- | --- | --- |
| Rebuild analysis only | [`narratio analyze 2026-04-04`](./cli.md#analyze) | Preserves transcripts and the current extraction bundle; force-runs selected analysis artifacts and their required analysis prerequisites. |
| Rebuild extraction and analysis | [`narratio regenerate-artifacts 2026-04-04`](./cli.md#regenerate-artifacts) | Preserves transcripts; force-runs the complete configured extraction bundle, then selected analysis. `--artifacts` narrows analysis only. |
| Rebuild analysis only | [`narratio run 2026-04-04 --stage analyze --force`](./cli.md#run) | Preserves transcripts and current extraction products; force-runs selected analysis artifacts and their required analysis prerequisites. |
| Rebuild extraction and analysis | [`narratio artifacts regenerate 2026-04-04`](./cli.md#artifacts-regenerate) | Preserves transcripts; force-runs the complete configured extraction bundle, then selected analysis. `--artifacts` narrows analysis only. |
| Continue bounded work normally | [`narratio run 2026-04-04 --from extract --through analyze`](./cli.md#run) | Uses ordinary resume decisions: current extraction and analysis can be skipped, while incomplete or obsolete work runs. |
All three stop before publication. Inspect the results and run
[`narratio publish`](./cli.md#publish) separately when delivery is intended.
[`narratio run SESSION --stage publish --force`](./cli.md#run) separately when delivery is intended.
For the extraction-plus-analysis development loop, use:
```bash
narratio regenerate-artifacts 2026-04-04
narratio regenerate-artifacts 2026-04-04 --artifacts session_recap,player_handout
narratio artifacts regenerate 2026-04-04
narratio artifacts regenerate 2026-04-04 --artifacts session_recap,player_handout
```
This command is a transparent expansion to a forced bounded `run` from
This command shares the forced bounded execution operation from
`extract` through `analyze`. Extraction always rebuilds its complete configured
bundle. Analysis rebuilds the selected targets and their required analysis
prerequisites, or uses the normal default selection when no artifact names are
@@ -268,7 +326,7 @@ set is ready:
```bash
narratio session artifacts 2026-04-04
narratio publish 2026-04-04
narratio run 2026-04-04 --stage publish --force
```
If planning or execution reports stale, missing, failed, or tampered
@@ -304,26 +362,12 @@ Select the Narratio file with `--overlay testing` on the desired command. Each
downstream selector is used only when its stage actually executes: `polish` for
Audita and `extract` for Notarius. Production can omit both selectors.
For Audita debug inspection, its testing overlay can include:
```yaml
diagnostics:
debug: true
work_dir: /path/to/audita-debug
```
Audita retains detailed artifacts under that directory. Inspect them there;
Narratio does not collect or manage them. Ordinary Audita reports remain a
separate existing integration. Leave debug disabled in Audita's production
configuration unless deliberately needed.
Notarius's debug controls are different: `debug.directory` selects a location
but does not enable capture. Capture requires its `--debug` flag, which Narratio
does not currently forward. Selecting a Notarius testing overlay therefore does
not by itself enable a debug bundle. See the upstream
[Audita configuration](https://gitea.maximumdirect.net/eric/audita/src/tag/v2.0.1/docs/config.md)
and [Notarius CLI](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/cli.md)
for their respective controls.
Set `audita.debug: true` in Narratio to request Audita debug capture. Omission
or false adds no debug override. Narratio supplies the run-local `polish/debug` work destination and
the separate `polish/logs` report destination. Set `notarius.debug: true` to request Notarius capture; its debug directory alone
does not enable capture.
See the upstream [Audita configuration](https://forge.maximumdirect.net/eric/audita/src/tag/v4.3.0/docs/config.md)
and [Notarius CLI](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.10.0/docs/cli.md).
Edits inside downstream configuration behind an unchanged selector are not
automatically detected by Narratio. To inspect a fresh Audita debug run, explicitly
@@ -337,12 +381,8 @@ This replaces polish output and invalidates dependent results; it is not a
diagnostics-only operation. Selecting testing does not create an isolated
workspace or retain a separate current result.
Notarius v0.8+ defaults to two additional eligible transient provider attempts
per generation. Review downstream retry settings and Narratio's extraction
timeout together; retries can increase elapsed time and provider charges.
Notarius v0.8.1 refreshes its built-in profile checkpoint identity, so older
checkpoints may not be reused. Source-keyed chunk plans and already published
outputs are unaffected; no manual cache deletion is required.
Review downstream retry settings and Narratio's extraction timeout together;
retries can increase elapsed time and provider charges.
Selecting Narratio's `testing` overlay then supplies `downstream-economy` only
when extraction executes. Switching that explicit selector makes a recorded
@@ -352,8 +392,9 @@ not create a separate workspace or retain a separate current extraction result.
Narratio cannot observe edits inside Notarius configuration behind an unchanged
selector. Force extraction after such an edit when a replacement is intended.
Use `regenerate-artifacts` when both extraction and analysis must be rebuilt;
use `analyze` when the existing extraction bundle should be preserved. Field
Use `artifacts regenerate` when both extraction and analysis must be rebuilt;
use `run SESSION --stage analyze --force` when the existing extraction products
should be preserved. Field
semantics belong in [Configuration](./config.md#notarius-configuration-overlay),
with Audita selectors covered under
[Audita selection and credentials](./config.md#audita-selection-and-credentials).
@@ -367,13 +408,13 @@ concrete character artifact. Select a concrete generated key to operate on one
member only. Manifests and plan output retain the concrete key as the durable
identity and include the family and character ID as optional provenance.
`--artifacts` can be used on `run`, `session plan`, `run-stage`, `analyze`, and
`publish`. For a bounded run or plan, the selected range must contain `analyze`
`--artifacts` can be used on `run`, `session plan`, and
`artifacts regenerate`. For a bounded run or plan, the selected range must contain `analyze`
or `publish`.
Selection behavior:
- validates names against `pipeline.scriptorium.artifacts`;
- validates names against the derived concrete catalog and family selections;
- selects explicit analyze targets and permits their required configured
prerequisites to be reused or rebuilt first;
- filters publish rules for `narratio.artifact.<name>` sources only;
@@ -383,162 +424,58 @@ Selection behavior:
## Extraction Workflow
When Notarius is omitted or disabled, `extract` records an explicit skipped
outcome with reason `notarius_disabled` and no outputs. A later invocation
reconsiders the skipped stage, so enabling Notarius does not require force.
Disabled extraction records a skipped outcome. When enabled, Narratio uses the
configured Notarius pipeline and verified prepared inputs. Bind the shared party
and combined glossary as described in [Configuration](config.md#notarius-reference-bindings).
The final trimmed transcript and content-identified snapshots under
`inputs/references/` are passed to the subprocess.
When Notarius extraction is enabled, the stage consumes the final trimmed JSON
and preserves the complete validated Notarius bundle at:
Successful configured lanes become flat `artifacts/<name>.json` products and
`narratio.extraction.<name>` sources. The original bundle remains under the
producing run until authorized cleanup removes it; it is not implicitly
published. A failed replacement does not make the earlier extraction record current. Native fallback counts and
readiness warnings remain visible in command reports.
- `artifacts/notarius/{narratio_run_id}/`
The directory is immutable once promoted. Configured lanes become
`narratio.extraction.<name>` sources for Scriptorium and explicit publish rules;
the bundle and `index.json` are retained for audit and resume validation but
are not selectable or published implicitly.
Configured Notarius references resolve only from the current manifest-backed
prepared inputs. Their canonical locations are `inputs/party.yml`,
`inputs/players.yml`, `inputs/glossary.yml`, and, when configured,
`inputs/spell_catalog.json`. Extraction supplies Notarius with verified,
content-addressed copies under
`cache/notarius/references/<sha256>/<prepared-basename>`. The full lowercase
SHA-256 digest identifies the reference bytes, so retries and later invocations
reuse the same path while changed bytes select a new path. Older snapshots are
retained and are not current artifact evidence. A concurrent refresh of
canonical prepared files therefore cannot change the bytes consumed by an
in-flight invocation.
For a canonical party, preparation retains the validated authored party bytes
at `inputs/party.yml` and generates `inputs/players.yml` from that roster.
The manifest records their checksums separately, with the players input marked
as derived from the party; refresh preparation after changing the roster rather
than editing either prepared file.
Inspect the effective stable-input inventory and
prepared-file readiness with:
```bash
narratio session status 2026-04-04
narratio session validate 2026-04-04
```
Reference metadata records selector, source ID, session-relative path,
checksum, and byte size, but never payload contents. Changing a prepared
reference changes extraction identity: ordinary continuation rejects the old
result, reruns Notarius, and marks successful downstream stages stale. If the
prepared file is missing or inconsistent with its manifest checksum, repair
the source configuration and refresh prepared state first:
```bash
narratio run-stage prepare 2026-04-04 --force
```
Starting a replacement clears the previous extraction payload from the current
session-stage record. If that replacement fails or self-skips, the current
record does not fall back to the earlier outputs. The earlier immutable bundle
remains available for inspection, but downstream resolution requires a new
current successful extraction record.
Notarius extraction validates its run-local bundle and moves it once to the
unique durable bundle path. A pre-existing durable destination is a collision;
no duplicate promotion tree is created.
`pipeline.notarius.resume` and `pipeline.notarius.chunk_cache` control work
inside an executed Notarius invocation. Ordinary extraction forwards their
configured values. Forced extraction always disables checkpoint loading and
requests chunk-plan `refresh`, even when the configured mode is `bypass`.
Refresh regenerates and replaces only the active input's accepted chunk plan;
it is not cache deletion.
Notarius checkpoint recording must be enabled in the deployed Notarius
configuration. Narratio neither creates a Notarius pipeline/configuration nor
reads it to infer checkpoint availability. Configure explicit persistent
Notarius chunk-plan and checkpoint roots when reuse must survive separate
Narratio subprocesses. A changed reference, transcript, selected profile,
profile content, endpoint, or other Notarius checkpoint identity input can
produce a legitimate cold miss.
There are two independent resume boundaries: Narratio may skip a completed
`extract` stage without invoking Notarius, while `--resume` allows Notarius to
reuse compatible accepted work only after Narratio has decided extraction must
execute. Deleting Narratio's local reference snapshots does not invalidate a
complete durable extraction; missing snapshots are reconstructed only when a
later extraction actually runs.
Narratio can reuse completed extraction without starting Notarius. When extraction
runs, Notarius owns its own cache and configuration. Select native `cache` if
needed; force extraction requests `refresh`. Configure downstream cache locations
in Notarius, outside Narratio cleanup. A changed private downstream model or config
is not automatically detected; force extraction when fresh work is needed.
See [Notarius integration](integrations/notarius.md).
## Migrating Manifest Overlay Provenance
The pipeline-selection rename is a clean cutover. Manifests containing
`effective_config.selected_profile` are rejected by strict decoding; Narratio
does not silently discard or translate that retired field.
Before using an affected local session with the new version:
1. Stop Narratio activity for the session and back up its manifest.
2. Rename only `effective_config.selected_profile` to `selected_overlay`, keeping
its `name` and `source`, or remove the retired informational member. If a
current `selected_overlay` member already exists, retain it and remove the
retired member rather than creating duplicate keys.
3. Preserve the schema version, digest, stage records, checkpoint evidence,
output references, and other session state. Retry the intended command.
This metadata is informational, not resume authority. Do not delete session
progress or force all stages merely to perform this migration. Other unknown
fields still require investigation rather than blanket removal.
Do not edit immutable remote committed snapshots. Restoring an older snapshot
with retired provenance requires a compatible previous Narratio version, followed
by migration of the restored local manifest before using the new version.
Manifests containing `effective_config.selected_profile` are rejected by strict
decoding. Historical session state is not converted in place; move it aside and
regenerate the session using the supported format. Do not edit immutable remote
snapshots.
## Migrating Audita and Provider Credentials
This is a breaking clean cutover to Audita v2. Narratio does not translate an
Audita v1 configuration, retain old field aliases, or generate a downstream
configuration. Update both the deployed Audita executable/configuration and
the Narratio pipeline before running polish. Retired Narratio fields are
rejected by strict configuration loading; account for this break when choosing
a release version.
Install Audita v4.3.0 and its own configuration and selected pipeline before
running polish. Move ordered processing configuration into Audita; remove the
retired Narratio `pipeline.audita.modules` field. Update every old
`narratio.input.glossary` binding to the intended explicit glossary source and
rewrite legacy glossary files into the named-collection format. Narratio does
not translate these settings or files. Install a catalog separately when using
setting or system selections; see [glossary inputs](config.md#glossary-inputs).
| Previous Narratio setting | New ownership and selection |
| --- | --- |
| `audita.base_url` | Audita v2 `backends.<id>.endpoint` |
| `audita.total_llm_concurrency`, `proposal_llm_concurrency`, `validation_llm_concurrency` | Audita v2 `backends.<id>.concurrency` and optional `queue_capacity`; backend capacity is shared across roles |
| `audita.model`, `validation_model` | Audita PromptKit profile files; optionally select them from Narratio with `audita.proposal_profile` and `validation_profile` |
| `audita.llm_api_key` | `audita.credentials: [PROVIDER_KEY_NAME]`, matching each Audita backend's `credential` name |
| `notarius.llm_api_key` | `notarius.credentials: [PROVIDER_KEY_NAME]`, matching references in Notarius-owned profiles |
| `audita.work_dir_retention`, `report` | Remove; Audita's external configuration owns diagnostics and reporting |
List each downstream provider's exact environment-variable name in
`audita.credentials`; Narratio passes resolved values to Audita and does not
infer names or generate the downstream configuration. `audita.config_path`
and `audita.overlay` select Audita's configuration independently of Narratio's
overlay. Consult [Audita's configuration guide](https://forge.maximumdirect.net/eric/audita/src/tag/v4.3.0/docs/config.md).
Operators can install the independently maintained [D&D recipes](https://forge.maximumdirect.net/eric/audita-pipelines-dnd/src/commit/6d5e66dcfca4bb5971a8423332a19ce884b846c0/README.md)
and select their production or testing overlays explicitly; Narratio does not
bundle those recipes or infer a downstream selection.
An Audita configuration can also be selected through `audita.config_path`,
and `audita.overlay` selects an Audita overlay independently of Narratio's
`--overlay`. Narratio forwards no implicit provider key: a single provider-named
secret source may be listed for both adapters, and an Audita-only backend key
may be listed only for Audita. Audita resolves credentials for all configured
backends, including those not currently selected. Notarius looks up its own
profiles; Narratio does not discover their credential names. Credential lists
may be cleared with `[]` in a Narratio overlay.
Prepare the external file from Audita's maintained
[local example](https://gitea.maximumdirect.net/eric/audita/src/tag/v2.0.0/examples/minimal-config.yml),
[service example](https://gitea.maximumdirect.net/eric/audita/src/tag/v2.0.0/examples/production-config.yml),
and [v2 migration guide](https://gitea.maximumdirect.net/eric/audita/src/tag/v2.0.0/docs/migrations/v2.md).
Before switching the executable, validate the file offline:
```bash
audita config validate --config /usr/local/etc/audita/config.yml
```
Use `audita config print-effective --config /usr/local/etc/audita/config.yml --view profiles`
to inspect downstream profile selection without contacting a provider. For a
production Audita configuration, leave ordinary reports enabled
and debug disabled unless an operator deliberately chooses otherwise; Narratio
does not override those settings. Audita writes `errors.yml`, `recoveries.yml`,
and `report.md` beside the polished output when reporting is enabled. An
exit-zero run with a valid transcript succeeds even if those reports describe
recoverable errors or no applied corrections. See the [Audita integration
contract](./integrations/audita.md) for report placement and limits.
Narratio's polish resume evidence tracks selected config path, Audita overlay,
profiles, ordered modules, description, schema, and output identity. Editing
Audita-owned files behind unchanged selectors is invisible to Narratio; force
polish with `narratio run-stage polish <session-id> --force` after such edits.
Preparation compares effective vocabulary and prepared evidence when deciding
reuse. If it changes, normal preparation invalidation applies; use
`narratio run <session-id> --stage prepare --force` when regeneration is needed.
Polish tracks its selected configuration and prepared glossary evidence, but
does not inspect the contents of Audita-owned files. Force polish after changing
those files behind unchanged selectors. Reports and debug destinations are
run-local; see the [Audita integration contract](integrations/audita.md).
## External Command Lifecycle
@@ -550,38 +487,41 @@ reaped, and descendants that keep standard output or error open cannot keep
the invocation blocked. Other operating systems fail closed rather than launch
a command without tree ownership.
Subprocess stdout and stderr diagnostics are separately redacted and capped at
8 MiB per invocation. Narratio does not retain configured credential values in
these logs or their error tails; reaching a capture limit terminates the command
tree and reports which stream exceeded the limit.
Subprocess diagnostic streams are separately redacted and capped at 8 MiB per
invocation. Narratio does not retain configured credential values in these logs
or their error tails; reaching a capture limit terminates the command tree and
reports which stream exceeded the limit. Scriptorium result stdout is captured
separately without redaction; see its [integration contract](integrations/scriptorium.md).
Run-local diagnostics are:
- `runs/{run_id}/polish/outputs/transcripts/errors.yml`,
`recoveries.yml`, and `report.md` when Audita writes them beside its
run-local polished transcript
- `runs/{run_id}/extract/notarius.receipt.json`
- `runs/{run_id}/extract/notarius.stderr.log`
- `runs/{run_id}/extract/notarius-output/` before durable promotion
- `runs/{run_id}/polish/logs/{errors.yml,recoveries.yml,report.md}` when
Audita reporting is enabled, alongside captured streams and invocation records
- `runs/{run_id}/extract/logs/notarius.report.json`
- `runs/{run_id}/extract/logs/notarius.stderr.log`
- `runs/{run_id}/extract/notarius-output/` for original bundles until cleanup
The run upload is an allowlist derived from the session manifest's declared
current-run outputs, logs, and generated configurations, not a workspace scan.
References to canonical session files and prior-run paths are excluded. Each
declared source is opened without following symlinked ancestors or the leaf,
verified as a regular file, and streamed from that verified descriptor.
verified as a regular file, and streamed from that verified descriptor. After
destination planning, sources are verified and transferred sequentially. A
later invalid source can leave unselected immutable uploads; the current
publication remains unchanged.
Unlisted files and unsafe entries are never uploaded; a run with no declared
current-run diagnostics uploads no run-local files. No distinguished diagnostic
file is uploaded. The durable bundle is never scanned for implicit publication;
file is uploaded. The original bundle is never scanned for implicit publication;
only lanes named by explicit `pipeline.publish.outputs` rules are uploaded.
To inspect a published polish report remotely, read its declared object under
the run archive's `polish/outputs/transcripts/` prefix. Session restore does
the run archive's `polish/logs/` prefix. Session restore does
not restore run-archive diagnostics as canonical session files; it restores only
the committed manifest and declared transcript/artifact objects.
To intentionally replace the current extraction result, run:
```bash
narratio run-stage extract 2026-04-04 --force
narratio run 2026-04-04 --stage extract --force
```
Narratio automatically reruns extraction when its recorded invocation contract,
@@ -610,22 +550,18 @@ before commit selection.
Run publish only:
```bash
narratio publish 2026-04-04
narratio run 2026-04-04 --stage publish --force
```
Equivalent:
```bash
narratio run-stage publish 2026-04-04 --force
```
This standalone command stops after publish and does not invoke cleanup. A
This selection stops after publish and does not invoke cleanup. A
default full `run` continues through notify and cleanup.
Publish commit model:
- uploads eligible run files under `{session_prefix}/runs/{run_id}/`, excluding
audio and the run-local Notarius staging bundle;
- uploads prepared campaign, session, and party documents under the run's
`prepare/inputs/` prefix, when recorded by the manifest;
- uploads configured published outputs and `previous/**` cache files into the
same immutable run scope, including only explicitly configured extraction
lanes;
@@ -687,7 +623,7 @@ Operational rules:
Examples:
```bash
narratio session locks 2026-04-04
narratio session locks list 2026-04-04
narratio session locks add 2026-04-04 narratio.artifact.session_recap --reason "manual edits" --force
narratio session locks remove 2026-04-04 narratio.artifact.session_recap
```
@@ -714,9 +650,9 @@ plan, so it is not a network-free operation.
Default restore scope:
- the committed session manifest and the committed transcript/artifact objects
declared by the selected remote commit
- `previous/**` when needed by configured previous-session artifact inputs;
- the committed session manifest, prepared inputs, and transcript/artifact
objects declared by the selected remote commit
- `inputs/previous/**` when needed by configured previous-session artifact inputs;
each is selected from its exact committed `published_output` declaration
Optional:
@@ -733,7 +669,8 @@ Before each install, restore validates the destination again beneath the
selected session root. A target changed into a symlink, directory, or other
non-regular entry is not overwritten.
Restore writes an execution report at `reports/restore-latest.json`.
Restore writes an execution report under `runs/<run_id>/restore/logs/restore.json`;
`logs/restore` points to the latest actual restore attempt.
If restore fails after beginning installation, it leaves a durable
`.restore-incomplete.json` marker in the session root. Pipeline runs will stop
@@ -743,68 +680,30 @@ snapshot is the recovery procedure.
## Local State Layout
Session root:
A session lives at `{workspace.root}/work/{campaign}/{session_id}`. It contains
`manifest.json`, prepared `inputs/` and `audio/`, `transcripts/` (including
`raw/` speaker files), flat `artifacts/`, and `runs/` for actual attempts.
Previous-session inputs live under `inputs/previous/`; verified subprocess
reference snapshots live under `inputs/references/`.
- `{workspace.root}/work/{campaign}/{session_id}`
Each attempted stage writes actual logs and debug capture beneath its run.
`logs/<stage>` and `debug/<stage>` are relative links to the latest attempt,
including failed attempts; skipped work does not rotate them. Restore writes its
own diagnostic attempt. Original Notarius bundles remain in the producing run
until authorized cleanup. The `runs/` directory is created on demand.
Durable session paths:
Remote audio is downloaded to a temporary sibling and verified before replacing
its single prepared `audio/` copy. Restore follows the same layout. Subprocess
cache and state locations are configured separately in those applications.
- `manifest.json`
- `inputs/**`
- `audio/**`
- `transcripts/**`
- `artifacts/**`
- `previous/**`
- `reports/**`
- `logs/**`
- `config/**`
- `runs/**`
- `cache/notarius/references/<sha256>/<prepared-basename>`
`manifest.json` is the versioned session-progress document. Narratio accepts
only `narratio.session-manifest.v1`. Do not edit unsupported session state to
add missing markers. Move it aside and regenerate it, restore a verified
current committed snapshot, or republish healthy regenerated state as the
relevant workflow requires.
Validated Notarius bundles live below `artifacts/notarius/{run_id}/`; receipt,
stderr, and pre-promotion output remain in the producing run's `extract`
directory as described in [Extraction Workflow](#extraction-workflow).
Stable reference snapshots live in the session cache path above. Ordinary
published-run cleanup removes its selected run-local target but retains this
cache, and publish/restore never enumerate it as an artifact. Remove a snapshot
or digest directory manually only while no command is active for the session;
regular missing or corrupt content is reconstructed on the next executed
extraction, while symlinks, directories, and other unsafe conflicts must be
investigated and removed deliberately.
Run-local layout:
- `runs/{run_id}/{stage}/outputs`
- `runs/{run_id}/{stage}/logs`
- `runs/{run_id}/{stage}/reports`
- `runs/{run_id}/{stage}/config`
- `runs/{run_id}/{stage}/scratch`
Spool layout (runtime/transient):
- `{spool.root}/{campaign}/{session_id}/{run_id}/...`
- restore audio spool under `{spool.root}/{campaign}/{session_id}/restore/audio`
Cache layout (durable S3 audio cache):
- `{cache.root}/s3/{bucket}/...`
Each cached audio file has an adjacent managed identity record. It binds the
file to its remote object version and verified digest; deleting or altering the
record simply causes Narratio to download and verify the object again.
Remote audio and restored files are fully transferred into sibling temporary
files and validated before they replace their canonical workspace paths.
Only `narratio.session-manifest.v2` is supported. Move older local state aside
and regenerate it, or restore a supported committed snapshot; republish after
regeneration when remote state is incompatible. Do not edit old markers by hand.
### Workspace Permissions
Ordinary Narratio workspace content is intentionally shareable with the
workspace group. On POSIX systems, Narratio-created workspace, spool, and cache
workspace group. On POSIX systems, Narratio-created workspace
directories converge on setgid `02775`; ordinary files, including manifests,
transcripts, generated configuration, logs, reports, and Notarius artifacts,
converge on `0664`. Narratio explicitly applies these modes so a restrictive
@@ -818,14 +717,12 @@ Provision a credential directory as `0700` and credential files as `0600`;
these permission modes are an operator requirement and are not enforced by
ConfigKit.
Every pipeline-loading command bootstraps credentials once, before the first
configuration load and before any adapter is constructed. `--secrets-dir`
selects an explicit directory (relative paths use caller CWD). Otherwise a
present `secrets/` beside the resolved root pipeline is used, while an absent
conventional directory is skipped. Explicit missing/empty selections and
invalid existing directories fail the command. ConfigKit follows a symlink used
as the selected directory, but immediate entries must be regular non-symlink
files. Existing environment variables—including empty values—always win.
Pipeline acquisition uses the directory declared in the main pipeline file,
when present, before resolving typed credentials. Remove `--secrets-dir` from
old invocations and declare `config.secrets_dir`, or provision environment values.
A pipeline beside the former system-wide directory can select `secrets`; other
layouts follow [ConfigKit's path rules](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md#explicit-secrets-directory-bootstrap).
See [Secrets Handling](config.md#secrets-handling) for Narratio's integration.
S3 `access_key_id` and `secret_access_key` are an optional pair of typed
environment references. When both are absent, the AWS SDK retains its default
@@ -842,53 +739,27 @@ the session workload.
## Cleanup
Session-scoped cleanup:
Use `narratio session clean SESSION` to remove an entire local session, or
`narratio session clean --all` for all local sessions. Add `--dry-run` to inspect
planned targets. These commands do not delete subprocess caches or remote data.
Mutating cleanup waits for the same workspace lock used by runs, preflight, and
restore. Waiting can be cancelled; dry-run inspection does not take the lock.
Mutating commands report the lock path through progress reporting before
acquisition; normal visibility controls apply.
The lock file remains at `<workspace.root>/.lock` after cleanup.
```bash
narratio clean 2026-04-04
```
Automatic cleanup requires `workspace.cleanup_after_publish=true` and successful
publication evidence. When selected, it removes the entire session `runs/` tree,
including older failures, restore attempts, probes, logs, debug captures, and
original Notarius bundles. Managed stage and restore views are removed as well.
Canonical products, prepared inputs, manifests, other sessions, subprocess
state and caches, and remote objects remain. Set the option to `false` to keep
run history and diagnostics.
Global cleanup:
```bash
narratio clean --all
```
Dry-run and cache variants:
```bash
narratio clean 2026-04-04 --dry-run --clear-cache
narratio clean --all --dry-run --clear-cache
```
Rules:
- `clean` deletes work/spool session state;
- cache is preserved unless `--clear-cache` is set;
- each deletion is confined beneath its configured workspace, spool, or cache
root; root, traversal, and out-of-root targets are refused;
- the final cleanup stage is gated by successful publish evidence plus:
- `pipeline.spool.delete_audio_after_publish=true`
- `pipeline.workspace.cleanup_after_publish=true`
- the manifest publish record has `uploaded=true`, the published run ID, the
exact remote commit key, and the current commit-pointer key.
Cleanup derives only the configured run-scoped spool and workspace targets,
uses root-confined deletion, and does not read or mutate object storage. A
failure leaves publish succeeded and the remote committed snapshot current.
Retry with a normal full run: valid upstream work, including publish and notify,
is skipped while the failed cleanup stage runs again. `run-stage cleanup` is
also available when the manifest has valid publish evidence. A range ending at
`notify` or earlier and the standalone `publish` command never delete local
state.
Older local manifests that contain the retired cleanup-obligation field are
intentionally incompatible with strict manifest decoding. If such an
obligation is still outstanding, complete it with the pre-upgrade binary.
Otherwise verify that the remote publication is committed, move aside or
regenerate the incompatible local manifest (or restore the verified remote
snapshot), and then use the cleanup stage. Manual JSON editing is not the
normal migration path.
A failed cleanup is reported and may have removed some files already. Retry the
cleanup stage or a full run without republishing. Bounded runs ending before
cleanup do not execute it; their new attempts remain until a later authorized
cleanup. See [cleanup internals](internal/stage-cleanup.md).
## Operational Caveats
@@ -896,5 +767,11 @@ normal migration path.
- Publish requires prerequisite stages through `render` and `analyze` to be succeeded.
- Markdown publish defaults require render outputs (`transcripts/final.md` and `transcripts/final.trimmed.md`).
- Restore requires configured object storage and committed remote current state.
- Pipeline-loading commands bootstrap filesystem secrets once before configuration
resolution and object-store initialization.
- Each reached pipeline acquisition applies its configured startup before typed
credential resolution and object-store initialization.
Console progress and informational diagnostics use native invocation visibility.
`--progress` shows work without requiring verbose mode; `--verbose` adds source
and decision context. Console `--debug` does not enable downstream debug capture
or change retention. Downstream streams stay in captured logs. See
[CLI reporting](cli.md#reporting-and-visibility) for mode combinations and formats.

View File

@@ -2,23 +2,28 @@
## Standard Repository Policies
Material: `docs/policy/agents.md`, `architecture.md`, `documentation.md`,
`testing.md`, `release.md`, `meta.md`, and `oss.md`; root `AGENTS.md` and the policy reading
guide in `docs/development.md`, adapted for this repository.
Material: `docs/policy/documentation.md`, adapted from revision
`5b9088601290564647a9e20c13f95c0da9f4cb15`; `docs/policy/agents.md`,
`architecture.md`, `testing.md`, `release.md`, `meta.md`, and `oss.md`; root
`AGENTS.md` and the policy reading guide in `docs/development.md`, adapted from
revision `593c9b52273c5c879785ae9e995d21026df467b4` for this repository.
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: CC-BY-SA-4.0
License and notices: [CC BY-SA 4.0](licenses/CC-BY-SA-4.0.txt) |
[COPYRIGHT](https://gitea.maximumdirect.net/eric/policy/src/commit/d84a38ebab26f048cafbe59a2246700c35d29843/COPYRIGHT) |
[LICENSE](https://gitea.maximumdirect.net/eric/policy/src/commit/d84a38ebab26f048cafbe59a2246700c35d29843/LICENSE).
[COPYRIGHT](https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/COPYRIGHT) |
[LICENSE](https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/LICENSE) |
[COPYRIGHT](https://gitea.maximumdirect.net/eric/policy/src/commit/5b9088601290564647a9e20c13f95c0da9f4cb15/COPYRIGHT) |
[LICENSE](https://gitea.maximumdirect.net/eric/policy/src/commit/5b9088601290564647a9e20c13f95c0da9f4cb15/LICENSE).
[Source](https://gitea.maximumdirect.net/eric/policy/src/commit/d84a38ebab26f048cafbe59a2246700c35d29843).
[Source](https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4).
[Source](https://gitea.maximumdirect.net/eric/policy/src/commit/5b9088601290564647a9e20c13f95c0da9f4cb15).
## ConfigKit
Selected module: `gitea.maximumdirect.net/eric/ConfigKit` at `v0.4.2`.
Selected module: `go.maximumdirect.net/configkit` at `v1.4.0`.
Copyright (C) 2026 Eric Rakestraw
@@ -26,10 +31,83 @@ SPDX-License-Identifier: LGPL-3.0-or-later
License and notices: [LGPL 3.0](licenses/LGPL-3.0.txt) |
[GPL 3.0](licenses/GPL-3.0.txt) |
[COPYRIGHT](https://gitea.maximumdirect.net/eric/ConfigKit/src/commit/67c03690181c5af8dde6be325abac241dae6732f/COPYRIGHT) |
[LICENSE](https://gitea.maximumdirect.net/eric/ConfigKit/src/commit/67c03690181c5af8dde6be325abac241dae6732f/LICENSE).
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/COPYRIGHT) |
[LICENSE](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/LICENSE).
[Source](https://gitea.maximumdirect.net/eric/ConfigKit/src/commit/67c03690181c5af8dde6be325abac241dae6732f).
[Source](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3).
## CommandKit
Selected module: `go.maximumdirect.net/commandkit` at `v0.8.0`.
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: LGPL-3.0-or-later
License and notices: [LGPL 3.0](licenses/LGPL-3.0.txt) |
[GPL 3.0](licenses/GPL-3.0.txt) |
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/COPYRIGHT) |
[LICENSE](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/LICENSE).
[Source](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae).
## CommandKit ckconfig
Selected module: `go.maximumdirect.net/ckconfig` at `v0.11.0`.
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: LGPL-3.0-or-later
License and notices: [LGPL 3.0](licenses/LGPL-3.0.txt) |
[GPL 3.0](licenses/GPL-3.0.txt) |
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/cd5cf483a46caeff7ca0a91fb4747d57188a3888/integrations/ckconfig/COPYRIGHT) |
[LICENSE](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/cd5cf483a46caeff7ca0a91fb4747d57188a3888/integrations/ckconfig/LICENSE).
[Source](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/cd5cf483a46caeff7ca0a91fb4747d57188a3888).
## ReleaseKit
Selected module: `go.maximumdirect.net/releasekit` at `v0.10.0`; adapted launcher and Woodpecker delivery workflow.
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: LGPL-3.0-or-later
License and notices: [LGPL 3.0](licenses/LGPL-3.0.txt) |
[GPL 3.0](licenses/GPL-3.0.txt) |
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/COPYRIGHT) |
[LICENSE](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/LICENSE).
[Source](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243).
## Cobra
Selected module: `github.com/spf13/cobra` at `v1.10.2` (transitive dependency).
Copyright 2013-2023 The Cobra Authors
SPDX-License-Identifier: Apache-2.0
License and notices: [Apache 2.0](licenses/Apache-2.0.txt) |
[LICENSE.txt](https://github.com/spf13/cobra/blob/88b30ab89da2d0d0abb153818746c5a2d30eccec/LICENSE.txt).
[Source](https://github.com/spf13/cobra/commit/88b30ab89da2d0d0abb153818746c5a2d30eccec).
## pflag
Selected module: `github.com/spf13/pflag` at `v1.1.0` (transitive dependency).
Copyright (c) 2012 Alex Ogier. All rights reserved.
Copyright (c) 2012 The Go Authors. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/spf13/pflag/blob/f8a990678a6d44385313e9b19e40737f889f9b14/LICENSE).
[Source](https://github.com/spf13/pflag/commit/f8a990678a6d44385313e9b19e40737f889f9b14).
## YAML v3
@@ -54,7 +132,7 @@ License and notices: [MIT](licenses/MIT.txt) |
## YAML v4
Selected module: `go.yaml.in/yaml/v4` at `v4.0.0-rc.6`.
Selected module: `go.yaml.in/yaml/v4` at `v4.0.0`.
Copyright 2006-2010 Kirill Simonov
@@ -66,10 +144,10 @@ SPDX-License-Identifier: MIT AND Apache-2.0
License and notices: [MIT](licenses/MIT.txt) |
[Apache 2.0](licenses/Apache-2.0.txt) |
[LICENSE](https://github.com/yaml/go-yaml/blob/1c17b9cee72bf81ae73a8be50fbd7dd3a9985125/LICENSE) |
[NOTICE](https://github.com/yaml/go-yaml/blob/1c17b9cee72bf81ae73a8be50fbd7dd3a9985125/NOTICE).
[LICENSE](https://github.com/yaml/go-yaml/blob/f2f9563503f11b7a60da0c532175dcc693ce8d5a/LICENSE) |
[NOTICE](https://github.com/yaml/go-yaml/blob/f2f9563503f11b7a60da0c532175dcc693ce8d5a/NOTICE).
[Source](https://github.com/yaml/go-yaml/commit/1c17b9cee72bf81ae73a8be50fbd7dd3a9985125).
[Source](https://github.com/yaml/go-yaml/commit/f2f9563503f11b7a60da0c532175dcc693ce8d5a).
## go-cmp
@@ -114,18 +192,18 @@ License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
## Go runtime and standard library
Material: Go `1.26.7` runtime and standard library material incorporated in
release binaries built with the declared `golang:1.26.7` CI toolchain.
Material: Go `1.27.4` runtime and standard library material incorporated in
release binaries built with the declared `golang:1.27.4` CI toolchain.
Copyright 2009 The Go Authors.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/golang/go/blob/e3336a22ad3f0a90bd252c95d8b5544e02674205/LICENSE) |
[PATENTS](https://github.com/golang/go/blob/e3336a22ad3f0a90bd252c95d8b5544e02674205/PATENTS).
[LICENSE](https://github.com/golang/go/blob/7b2881024c95a11ddb86663a616340aa3a88b67f/LICENSE) |
[PATENTS](https://github.com/golang/go/blob/7b2881024c95a11ddb86663a616340aa3a88b67f/PATENTS).
[Source](https://github.com/golang/go/commit/e3336a22ad3f0a90bd252c95d8b5544e02674205).
[Source](https://github.com/golang/go/commit/7b2881024c95a11ddb86663a616340aa3a88b67f).
## AWS SDK for Go v2
@@ -211,3 +289,54 @@ License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/aws/smithy-go/blob/e094f45e716e33a1b950cf8bbe804790bf87f965/internal/sync/singleflight/LICENSE).
[Source](https://github.com/aws/smithy-go/commit/e094f45e716e33a1b950cf8bbe804790bf87f965).
## JSON Schema
Selected module: `github.com/santhosh-tekuri/jsonschema/v6` at `v6.0.3`.
SPDX-License-Identifier: Apache-2.0
License and notices: [Apache 2.0](licenses/Apache-2.0.txt) |
[LICENSE](https://github.com/santhosh-tekuri/jsonschema/blob/b0fc661f4939578bc429f408c18202573dbafcc4/LICENSE).
[Source](https://github.com/santhosh-tekuri/jsonschema/commit/b0fc661f4939578bc429f408c18202573dbafcc4).
## Go text extension
Selected module: `golang.org/x/text` at `v0.14.0`.
Copyright 2009 The Go Authors.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/golang/text/blob/6c97a165dd661335ff7bce6104a008558123c353/LICENSE) |
[PATENTS](https://github.com/golang/text/blob/6c97a165dd661335ff7bce6104a008558123c353/PATENTS).
[Source](https://github.com/golang/text/commit/6c97a165dd661335ff7bce6104a008558123c353).
## Maximum Direct shared schemas
Material: `internal/domaininput/resources/`, copied without modification from `2026.11.1`.
Copyright 2026 Eric Rakestraw
SPDX-License-Identifier: CC0-1.0
License and notices: [CC0 1.0](licenses/CC0-1.0.txt) |
[COPYRIGHT](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/COPYRIGHT) |
[LICENSE](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/LICENSE).
[Source](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7).
## Narratio reference catalog
Material: synthetic files under `examples/reference-catalog/`, adapted from
revision `02dd53c6ea026347452d497350c40249c949f8ce`.
SPDX-License-Identifier: CC0-1.0
License and notices: [CC0 1.0](licenses/CC0-1.0.txt) |
[LICENSE](https://forge.maximumdirect.net/eric/narratio-reference-catalog/src/commit/02dd53c6ea026347452d497350c40249c949f8ce/LICENSE).
[Source](https://forge.maximumdirect.net/eric/narratio-reference-catalog/src/commit/02dd53c6ea026347452d497350c40249c949f8ce).

View File

@@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

View File

@@ -2,9 +2,9 @@
**Base Policy Version:** 1.3
**Last Updated**: 2026-09-28
**Last Updated**: 2026-11-17
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/d84a38ebab26f048cafbe59a2246700c35d29843/docs/policy/agents.md
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/agents.md
## Purpose

View File

@@ -2,9 +2,9 @@
**Base Policy Version:** 1.3
**Last Updated**: 2026-09-28
**Last Updated**: 2026-11-22
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/d84a38ebab26f048cafbe59a2246700c35d29843/docs/policy/architecture.md
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/architecture.md
## Purpose And Ownership
@@ -52,7 +52,7 @@ their domains:
- Notarius extracts validated structured artifact bundles; and
- Scriptorium executes prompts and produces configured artifacts.
Narratio owns orchestration, configuration resolution, session and run state,
Narratio owns orchestration, configuration interpretation, session and run state,
artifact and path modeling, manifest persistence, stage sequencing, resume,
restore, cleanup gates, and publish semantics. External contracts are defined
in the [integration documentation](../integrations/).
@@ -73,8 +73,8 @@ itself an architectural goal.
## Ownership And Dependency Direction
The application boundary owns command dispatch, configuration selection,
production composition, session locking, and top-level lifecycle. It may depend
The application boundary owns command composition, configuration selection,
production composition, workspace locking, and top-level lifecycle. It may depend
on concrete implementations to assemble a run.
Stage orchestration expresses intent in Narratio-level data and interfaces.
@@ -122,11 +122,18 @@ merely on incidental files existing on disk.
A failed or interrupted stage must not be presented as successful. Failure
should preserve enough local state and diagnostics for inspection, recovery,
and resume. Forcing a stage invalidates succeeded transitive dependents
and resume until a later authorized cleanup. Forcing a stage invalidates
succeeded transitive dependents
according to a fixed application-owned relation that is separate from canonical
execution order. The relation is validated against the stage inventory and is
not configurable.
Downstream readiness is an invocation check after selected preparation and
before the selected processing work. It does not create a stage success.
Standalone preflight prepares or reuses session inputs and checks enabled
capabilities under the same workspace lock; its checks may probe destinations and
contact configured providers.
A stage may explicitly self-skip with a stable reason and no outputs. That
outcome is persisted, clears older outputs owned by the stage, and is
reconsidered on a later invocation. A stage may also validate whether an
@@ -172,18 +179,32 @@ or other non-regular conflict into a successful restore.
## Configuration
Configuration is strict, explicit, centralized, and operator-oriented.
Configuration ownership follows
[ADR 0003](../adr/0003-assign-configuration-ownership.md):
- ConfigKit owns configuration policy and resolution through the final handoff.
Narratio supplies its schema, defaults, and configuration rules through
supported extension points. The completed ConfigKit result is authoritative.
- Narratio consumes that result without mutation and derives separate domain
objects. It must not construct a replacement effective configuration.
- CommandKit owns CLI mechanics and presentation; `ckconfig` exposes ConfigKit
inspection. Narratio supplies selection and acquisition wiring through native
adapters without changing upstream semantics or substituting inspection views.
Missing configuration or inspection capabilities are addressed upstream.
- YAML decoding rejects unknown fields.
- Defaults are centralized and testable.
- Empty configured values do not silently replace meaningful defaults.
- Defaults apply only to absent fields. Explicit false, zero, empty, and null
values remain present and are evaluated by Narratio's domain rules.
- Validation rejects invalid configuration before stage execution where
practical.
- Root-owned imports and one selected overlay resolve deterministically through
the configuration owner; commands do not implement their own merge rules.
- Canonical party rosters are campaign-owned. Their derived players projection
and concrete character-family artifacts are resolved before runtime stages
or adapters receive configuration.
- ConfigKit resolves local imports and the selected pipeline overlay. Shared
campaign, party, and glossary documents permit schema extensions; Narratio
operational settings remain strict, as selected in [ADR 0003](../adr/0003-assign-configuration-ownership.md).
- Canonical party rosters are campaign-owned inputs. Narratio derives players
projections and concrete character-family artifacts as separate domain
objects before execution, without modifying configuration.
- Resume uses stage- or artifact-owned semantic evidence for observable
result-affecting configuration; overlay identity and an effective digest are
provenance, never blanket cache keys.
@@ -201,27 +222,26 @@ field-level contract and credential-supply mechanisms belong in
## Artifacts, Paths, And Storage
Artifact identities and local and remote paths are application contracts.
Canonical helpers own workspace, spool, cache, session, run, input, transcript,
Canonical helpers own workspace, session, run, input, transcript,
artifact, log, report, configuration, and publish-current paths. Callers must
not reconstruct canonical paths through scattered string concatenation.
Reusable audio cache entries require a typed record that binds a confined,
no-follow regular file and its digest to the selected remote object identity.
Size alone and unqualified multipart ETags are not content-integrity evidence.
Prepared audio reuse requires manifest-backed identity and checksum evidence.
Subprocess applications own their own state and caches, separately configured
and outside Narratio cleanup. See [ADR 0001](../adr/0001-classify-session-content.md)
and [ADR 0002](../adr/0002-assign-subprocess-content-ownership.md).
Artifact resolution is deterministic and manifest-aware. Producers materialize
canonical outputs before reporting success, and consumers resolve declared
artifact identities rather than infer files from unrelated directory contents.
External artifact bundles become current only through validated immutable
promotion and manifest records; directory presence alone never establishes
availability.
Configured products become current through validated promotion and manifest
records; directory presence alone never establishes availability.
Writes, moves, replacements, and deletions must use narrow, explicit,
root-confined destinations. Symlinks, traversal, broad roots, and ambiguous
relative destinations must not expand the scope of an operation. Cleanup is
permitted only through explicit operator action or the configured final cleanup
stage, and it must preserve durable cache unless cache removal is explicitly
requested.
stage, and must preserve subprocess-owned state and caches.
Physical layout, retention, and operational lifecycle belong in
[Operations](../operations.md). Logical external formats and durable integration
@@ -232,6 +252,8 @@ contracts belong under [Integrations](../integrations/).
Publish has one explicit remote commit boundary. A remote run becomes current
only after Narratio has successfully uploaded its immutable run-scoped objects,
the immutable commit manifest, and finally the current commit pointer.
Destination planning precedes sequential source verification and transfer;
failed attempts may leave immutable objects that are not selected as current.
`current/commit-pointer.json` is the sole mutable selector and must be written
exactly once, last. Failed, incomplete, skipped, or uncommitted publish attempts
@@ -246,14 +268,14 @@ transaction boundary.
Automatic local cleanup is permitted only after a successful publish commit,
only when explicitly configured, and only through the path-safety guardrails.
It is the final ordinary pipeline stage after `notify`. The stage derives its
exact run-scoped targets from validated publish metadata and the configured
campaign/session identity; it never infers a target from directory contents or
It is the final ordinary pipeline stage after `notify`. The stage derives the
selected session's run-history target from validated publish metadata and the
configured campaign/session identity; it never infers a target from directory contents or
rereads remote storage. A cleanup failure makes the invocation incomplete while
leaving publish succeeded and the committed remote snapshot authoritative. A
normal later full run reuses valid upstream stages and retries cleanup.
The standalone `publish` command selects only publish and therefore never
`run SESSION --stage publish` selects only publish and therefore never
invokes cleanup. Operators may select cleanup directly only when the manifest
contains valid successful publication evidence.
@@ -278,18 +300,18 @@ uses a separate restrictive contract.
Raw secrets must not be stored in pipeline, campaign, or session YAML or written
to manifests, logs, generated configuration, reports, publish metadata,
documentation, or examples. Pipeline configuration names environment variables;
command-owned startup may populate previously unset variables from ConfigKit's
explicit or conventional secrets directory. This bootstrap occurs once per
invocation before any typed configuration load or adapter construction and is
not hidden inside library loaders. Safe bootstrap diagnostics may identify
files and statuses but never values. Diagnostics should avoid transcript and
documentation, or examples. Pipeline configuration names environment variables. Command-owned pipeline
acquisition explicitly prepares the selected source through ConfigKit's
configured bootstrap before typed credential resolution and adapter construction.
Completed acquisitions are reused normally; ConfigKit's selected environment
policy governs each preparation. Library loading does not write the environment.
Safe bootstrap diagnostics may identify files and statuses but never values. Diagnostics should avoid transcript and
prompt content unless a deliberate, bounded inspection mechanism requires it.
Logs, reports, generated invocation files, generated configuration, and render
debug files are diagnostics, not canonical pipeline products. They should be
durable and discoverable where configured, and manifest references must preserve
the distinction between diagnostics and artifacts.
debug files are diagnostics, not canonical pipeline products. They remain
discoverable until configured cleanup removes their run history. Manifest
references must preserve the distinction between diagnostics and artifacts.
Documentation security rules belong in the
[Documentation Policy](documentation.md). Credential supply belongs in

View File

@@ -1,15 +1,15 @@
# Documentation Policy
**Base Policy Version:** 1.11
**Base Policy Version:** 1.13
**Last Updated**: 2026-09-28
**Last Updated**: 2026-11-22
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/d84a38ebab26f048cafbe59a2246700c35d29843/docs/policy/documentation.md
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/5b9088601290564647a9e20c13f95c0da9f4cb15/docs/policy/documentation.md
## Purpose
This policy assigns each documentation topic to one canonical owner. Its goal is
to keep Narratio's documentation accurate, concise, discoverable, and resistant
to keep this application's documentation accurate, concise, discoverable, and resistant
to drift for users, operators, developers, integrators, and LLM coding agents.
## Core Rules
@@ -75,19 +75,19 @@ secret values.
| Release policy | `docs/policy/release.md` | Versioning, compatibility, release integrity and immutability, release documentation, proportionate gates, publication controls, completion, and required versus optional checks. | Repository-specific commands, product installation guidance, CLI version semantics, historical release summaries, and CI implementation detail. |
| Open source licensing and attribution policy | `docs/policy/oss.md` | License defaults and author choices, COPYRIGHT and attribution formats, license/notice links, discoverability, maintenance, and concrete exceptions. | Component entries, license texts, release commands, and dependency security review. |
| Project copyright and license grant | `COPYRIGHT` | Project identity, copyright holders and years, SPDX expression, grant, warranty disclaimer, and third-party statement. | Complete license texts and upstream component attribution. |
| Project license text | `LICENSE` | Complete GPLv3 project license text. | Companion dependency license texts and upstream component attribution. |
| Project license texts | `LICENSE` | Complete project and incorporated companion license texts, with required project-specific fields. | General licensing policy and upstream component attribution. |
| Upstream component attribution | `docs/oss/attribution.md` | House Format component entries: identity, material scope and modifications where applicable, copyright, license, required notices, and license, notice, and source links. | General attribution policy, exception reasoning, research narratives, compliance commentary, and complete standard license texts. |
| Standard dependency license texts | `docs/oss/licenses/` | Complete, verbatim standard license texts shared by applicable entries. | Project-specific upstream notices, attribution prose, and policy interpretation. |
| Repository-specific release procedure | `docs/release.md` | Maintainer prerequisites, candidate preparation, validation and publication commands and automated guards, asynchronous deliverables, delivery status, optional consumer verification, and recovery. | General release requirements, product installation guidance, historical release summaries, and current compatibility contracts. |
| CLI contract (if applicable) | `docs/cli.md` | Commands, arguments, flags, invocation semantics, and exit codes. | End-to-end operating procedures, configuration field definitions, runtime filesystem layout, module implementation details. |
| Configuration contract (if applicable) | `docs/config.md` | Discovery, precedence, schema, fields, defaults, environment overrides, validation, and selectable module and validator keys. | Complete example files, CLI syntax, runtime state lifecycle, module implementation details. |
| Operations | `docs/operations.md` | Runtime workflows, physical filesystem and state layout, output, cache and debug handling, resume, cleanup, permissions, recovery, and limits. | CLI flag syntax, configuration field definitions, logical output schemas, implementation mechanics. |
| Operations (if applicable) | `docs/operations.md` | Runtime workflows, physical filesystem and state layout, output, cache and debug handling, resume, cleanup, permissions, recovery, and limits. | CLI flag syntax, configuration field definitions, logical output schemas, implementation mechanics. |
| Troubleshooting | `docs/troubleshooting.md` | Symptom-driven diagnosis, likely causes, safe inspection, and remedies. | Canonical commands, configuration definitions, operational procedures, and integration contracts. |
| Integration contracts for external components (if applicable) | `docs/integrations/` | External formats and protocols, upstream and downstream contracts, logical output paths and schemas, media types, and compatibility. | Physical runtime placement and lifecycle, internal transformations, CLI syntax, configuration defaults. |
| Inventory of implemented internal packages | `docs/internal/overview.md` | Implemented packages and components, responsibilities, and links to focused internal docs. | Normative architecture, contributor reading policy, external contracts. |
| Behavior and architecture of internal packages | Other files under `docs/internal/` | Implementation flow, collaborators, state transitions, package-local guarantees and failures, and relevant tests. | Global architecture invariants, configuration definitions and defaults, external schemas, operator procedures. |
| Architectural decision records | `docs/adr/` | Significant decisions, context, alternatives, rationale, consequences, and supersession history. | Current behavior reference, implementation status, task sequencing. |
| Future work and implementation status | `docs/roadmap/` | Proposed, accepted, deferred, or rejected work; implementation status, sequencing, and task breakdowns. | Implemented behavior reference and architectural decision rationale. |
| Architectural decision records | `docs/adr/` | Records of significant architectural decisions and supporting rationale. | Ordinary design choices, current behavior reference, implementation status, task sequencing. |
| Future work and implementation status | `docs/roadmap/` | Proposed, accepted, or future work; implementation status, sequencing, and task breakdowns. | Implemented behavior reference and architectural decision rationale. |
| Release-note history | `docs/releases/` | One checked-in summary per source release under the procedure; the note at its immutable tag is the release record. | Current commands, behavior, contracts, and compatibility definitions. |
| Complete copyable artifacts | `examples/` | Maintained configuration, inputs, and other copyable or runnable files. | Field-by-field reference, command reference, prose explanation. |
@@ -131,6 +131,15 @@ semantics. Internal documents explain how this application implements or consume
contracts. Internal docs may name a field, file, or protocol to identify a
dependency, but must link to its canonical contract for the definition.
### Upstream Dependencies
When documenting an upstream dependency, identify the library and link to its
canonical documentation for its features and behavior. Maintain local
documentation for application-specific integration, configuration, and
adaptations. Brief summaries may orient readers; upstream documentation remains
the canonical reference for upstream behavior. Where behavior differs by
version, link to documentation applicable to the imported version.
### Security Topics
This policy owns what documentation and examples may contain. Architecture owns
@@ -153,8 +162,15 @@ Use sequentially numbered ADR filenames such as
Treat the decision content of an accepted ADR as immutable. When a decision
changes, create a new ADR and update the earlier ADR's status to superseded.
Rejected architectural alternatives belong in the ADR; rejected product ideas
belong in the roadmap.
ADRs should be reserved for major architectural decisions, such as ownership
boundaries, large-scale architectural features, or invariants that rise to
the level of architectural significance. Routine choices, implementation
decisions, and rejected suggestions do not warrant an ADR unless they
otherwise represent a significant architectural decision.
Roadmaps should preserve plausible future work, not rejected product
ideas.
## Maintenance

View File

@@ -2,9 +2,9 @@
**Base Policy Version:** 1.0
**Last Updated**: 2026-09-28
**Last Updated**: 2026-11-17
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/d84a38ebab26f048cafbe59a2246700c35d29843/docs/policy/meta.md
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/meta.md
## Origin And Local Authority

View File

@@ -1,10 +1,10 @@
# Open Source Licensing And Attribution Policy
**Base Policy Version:** 1.8
**Base Policy Version:** 1.9
**Last Updated**: 2026-09-28
**Last Updated**: 2026-11-17
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/d84a38ebab26f048cafbe59a2246700c35d29843/docs/policy/oss.md
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/oss.md
## Purpose And Scope
@@ -74,6 +74,9 @@ individual packages.
Use the upstream [application COPYRIGHT example](https://gitea.maximumdirect.net/eric/policy/src/commit/a469273adda336625f96b9d769ea27b33999f146/examples/licensing/application/COPYRIGHT)
or [library COPYRIGHT example](https://gitea.maximumdirect.net/eric/policy/src/commit/a469273adda336625f96b9d769ea27b33999f146/examples/licensing/library/COPYRIGHT)
to create the project’s root `COPYRIGHT` file.
Use the COPYRIGHT examples exactly as provided, except for placeholder
substitutions and changes expressly required or authorized by this policy or
the author.
Use verified project names, contribution years, and copyright holders.
For another selected license, adapt the grant, SPDX expression, disclaimer, and
text references together to reflect the author's selected grant.
@@ -169,10 +172,15 @@ source files; the central attribution entry does not authorize stripping them.
## Discoverability
End Narratio's README with two friendly statements linking to its actual grant
in root `COPYRIGHT` and to `docs/oss/attribution.md`, using paths relative to
the README. The statements identify Narratio's GPL v3.0-or-later grant and make
the open source attribution notices discoverable.
End the project's README with two friendly statements linking to its actual
grant in `COPYRIGHT` and the attribution document. For example, for a project
with the stated license:
```markdown
PROJECT_NAME is licensed under the [LGPL v3.0 or later](COPYRIGHT).
[Open Source attribution notices](docs/oss/attribution.md) are available.
```
Each new checked-in release document and its hosted download page must end
with links whose visible text is `COPYRIGHT | LICENSE | ATTRIBUTION`. Use absolute

View File

@@ -1,10 +1,10 @@
# Release Policy
**Base Policy Version:** 1.4
**Base Policy Version:** 1.7
**Last Updated**: 2026-09-28
**Last Updated**: 2026-11-23
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/d84a38ebab26f048cafbe59a2246700c35d29843/docs/policy/release.md
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/release.md
## Purpose
@@ -12,6 +12,9 @@ This policy defines a proportionate workflow for validating and publishing an
intended source revision under a fresh version. Releases should require little
routine intervention, avoid repeated work, and preserve published contents.
Adopt stronger verification or reproducibility requirements through an explicit
project-specific decision justified by the intended audience and support needs.
The repository-specific commands belong in `docs/release.md`. Historical release
summaries belong in `docs/releases/`. The procedure must agree with the adopted
policy and link to it rather than introduce additional release requirements.
@@ -59,9 +62,14 @@ requires a deliberate update to the policy and procedure where needed.
For releases at or after `v1.0.0`:
- a major release may make intentional incompatible changes;
- a minor release may add backward-compatible behavior; and
- a minor release may add backward-compatible behavior or raise the Go consumer
minimum as described below; and
- a patch release may make backward-compatible fixes.
In this context, "backward-compatible" means only that pre-existing, valid
configurations will continue to work following the release. Behavior need not
remain strictly identical.
Before `v1.0.0`, a minor release may change a documented public, operational,
configuration, data, integration, or compatibility contract when the release
note explains the impact and required consumer action. A patch release must
@@ -71,6 +79,36 @@ Additional compatibility promises and deliberate exceptions belong in the
adopted policy or canonical contract documentation. Release notes explain
changes; they do not redefine current compatibility contracts.
## Consumer Minimum And Release Toolchain
Distinguish the minimum toolchain supported for consumers from the toolchain
maintainers use to build and validate a release. Record the consumer minimum in
the language's standard metadata and explain its support meaning in canonical
documentation. Define the selected release toolchain and its setup commands in
`docs/release.md`. Toolchain selection and upgrade cadence are repository-specific
choices.
For Go repositories, normally declare the initial stable release of the selected
series as the consumer minimum, such as `go 1.26.0`. Use a higher patch minimum
when a dependency or an identified correctness fix requires it, and document
the reason.
For release-policy purposes, successful build and release validation on the
selected Go patch release are sufficient to presume support across that Go
series, subject to the declared consumer minimum and concrete evidence of
incompatibility. Investigate specific compatibility concerns as they arise.
Use the selected release toolchain for candidate validation and release builds,
including CI jobs performing those tasks. A newer validation patch version alone
leaves the consumer minimum unchanged.
A minor release may raise the Go consumer minimum, including from one Go series
to the next, both before and after `v1.0.0`. This is an explicit exception to the
backward-compatibility requirement for minor releases. Patch releases preserve
the consumer minimum. Explain an increase's impact and required consumer action
in the release note. Other incompatible changes remain subject to the versioning
rules above.
## Release Documentation And Preparation
Every new release must include `docs/releases/<version>.md` in the tagged
@@ -136,23 +174,12 @@ Do not add routine confirmations for checks the command can perform itself.
## Narratio Candidate Checks
Narratio's candidate checker adds the following checks to the one full,
race-enabled offline suite:
- `go mod tidy -diff` detects an incomplete checked-in module graph without
changing source.
- Tracked Go formatting and diff whitespace checks catch inexpensive source
hygiene defects before publication.
- Race instrumentation adds distinct coverage for concurrent I/O,
cancellation, and shared state.
- `go vet ./...` detects static issues not established by runtime tests.
- The asset builder verifies the declared Linux amd64, Linux arm64, and
best-effort macOS arm64 binaries and checks the embedded version on the host.
The checker uses `GOWORK=off` and readonly module mode for tests, vet, and
builds. Versioned module replacements are allowed; filesystem replacements
are not release inputs. Workspace and vendor files are not prohibited solely
by their presence.
Narratio selects one race-enabled offline suite, full `go vet`, Go formatting,
and local module-replacement checks through ReleaseKit. The selected builds
verify Linux amd64, Linux arm64, and best-effort macOS arm64 binaries and the
embedded version on a host executable. Versioned module replacements remain
allowed; filesystem replacements are not release inputs. Workspace and vendor
files are not prohibited solely by their presence.
## Publication Guards
@@ -206,7 +233,8 @@ release without replacing its contents or reusing its version.
Maintain `docs/release.md` as a short, executable maintainer runbook. It must
identify:
1. prerequisites, primary branch, and authoritative remote;
1. prerequisites, selected release toolchain, primary branch, and authoritative
remote;
2. version and release-note preparation;
3. one publication command with its selected local checks and automated guards;
4. declared deliverables, required build targets, and automation responsibilities;

View File

@@ -2,9 +2,9 @@
**Base Policy Version:** 1.3
**Last Updated**: 2026-09-28
**Last Updated**: 2026-11-17
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/d84a38ebab26f048cafbe59a2246700c35d29843/docs/policy/testing.md
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/testing.md
## Purpose

View File

@@ -1,114 +1,92 @@
# Releasing Narratio
This is the maintainer runbook for the [Release Policy](policy/release.md).
The source release completes when the intended tag is successfully pushed to
`origin`; binary delivery is a separate asynchronous status.
This is the maintainer runbook for the [release policy](policy/release.md).
The authoritative source destination is `origin` at
`ssh://git@forge.maximumdirect.net:22222/eric/narratio.git`; use `main`.
The hosted destination is [Narratio on Gitea](https://forge.maximumdirect.net/eric/narratio).
Install Git, a POSIX shell, and the native compiler and tools needed for Go race
builds. Git access must permit fetching and pushing tags.
## Prepare the candidate
## Release toolchain
Use `main` and the authoritative Git remote `origin`. Install Git, a POSIX
shell, standard Unix build tools, and Go 1.26. Have the selected Go modules
available before offline validation. Git access must permit fetch and tag push.
Application-provider credentials are not required; Gitea delivery credentials
belong to CI.
Use the official Go 1.27.4 toolchain for validation and builds. The consumer
minimum remains Go 1.27.0. Prepare the selected toolchain, application modules,
and the module-selected ReleaseKit tool before offline validation:
Choose an unused stable `vMAJOR.MINOR.PATCH` under the
[compatibility rules](policy/release.md#versioning-and-compatibility). Narratio
is past v1.0.0, so intentional CLI or configuration breaks require a major
release. Update affected canonical documentation with the change. Write the
matching `docs/releases/vMAJOR.MINOR.PATCH.md` with a short summary and any
relevant compatibility impact or upgrade action; choose sections to suit the
release.
```sh
export GOTOOLCHAIN=go1.27.4
go version
go mod download
./releasekit version
```
End that checked-in note with these three links, replacing the version in
each URL with the intended tag. The tag need not exist remotely yet. Check that
`COPYRIGHT`, `LICENSE`, and `docs/oss/attribution.md` are present in the
candidate. The tag CI reuses the checked-in note as the hosted release body.
The launcher runs the ReleaseKit version selected in `go.mod`. The CI image
uses the same Go patch. See [upstream adoption guidance](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/adoption.md).
## Prepare and publish
Choose an unused stable version under the [versioning and compatibility
rules](policy/release.md#versioning-and-compatibility). Update affected current
documentation and prepare `docs/releases/vMAJOR.MINOR.PATCH.md` with a title
containing Narratio and the version, a summary, and any compatibility impact
or upgrade instructions. End the note with this footer, replacing the version
in each URL with the intended tag:
```markdown
[COPYRIGHT](https://gitea.maximumdirect.net/eric/narratio/src/tag/vMAJOR.MINOR.PATCH/COPYRIGHT) | [LICENSE](https://gitea.maximumdirect.net/eric/narratio/src/tag/vMAJOR.MINOR.PATCH/LICENSE) | [ATTRIBUTION](https://gitea.maximumdirect.net/eric/narratio/src/tag/vMAJOR.MINOR.PATCH/docs/oss/attribution.md)
[COPYRIGHT](https://forge.maximumdirect.net/eric/narratio/src/tag/vMAJOR.MINOR.PATCH/COPYRIGHT) | [LICENSE](https://forge.maximumdirect.net/eric/narratio/src/tag/vMAJOR.MINOR.PATCH/LICENSE) | [ATTRIBUTION](https://forge.maximumdirect.net/eric/narratio/src/tag/vMAJOR.MINOR.PATCH/docs/oss/attribution.md)
```
Retire completed roadmaps included in the release while preserving planned or
deferred work and repairing affected links. Review the change through the
ordinary development workflow for unintended files, credentials, private data,
and documentation accuracy. Commit and push the candidate to `origin/main`
before tagging; record its exact commit if needed:
For the next release note, describe the cleanup retention change: when automatic
cleanup is enabled and authorized, it removes the selected session's entire run
history, including failed-attempt diagnostics and original Notarius bundles.
Operators can retain that material by setting `workspace.cleanup_after_publish`
to `false`.
Also document the replacement of `session validate` with `preflight SESSION`,
which prepares or reuses inputs before checking readiness. See the
[preflight command](cli.md#preflight).
Retire completed roadmaps as appropriate, preserve pending work, and review the
candidate through the ordinary development workflow. Commit the candidate and
push it to `origin/main`, then publish from the clean `main` checkout:
```sh
git rev-parse HEAD
git add <candidate-files>
git commit -m "Prepare Narratio release"
git push origin main
./releasekit publish vMAJOR.MINOR.PATCH
```
## Publish
ReleaseKit validates the committed candidate with the selected race-enabled
suite, full vet, Go formatting and local-replacement checks, and builds the
three selected binaries with an injected-version smoke check. It creates an
annotated tag and pushes it. Confirmed source-tag publication completes the
release; CI and hosted delivery are separate observations. For optional
diagnosis, use `./releasekit check vMAJOR.MINOR.PATCH`; publication runs its
own validation, so this is not a prerequisite. See the upstream
[check](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/check.md)
and [publish](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/publish.md)
guides for native behavior and diagnostics.
From a clean `main` checkout at the pushed candidate, run one command:
## Delivery and recovery
```sh
scripts/release.sh vMAJOR.MINOR.PATCH
```
It fetches `origin/main` and tags; requires local `HEAD` to equal
`origin/main`; checks the committed note and unused version; runs the
candidate checker **once**; then repeats cheap mutable-state guards before
creating an unsigned lightweight tag at the recorded commit. It verifies the
tag target and pushes only
`refs/tags/vMAJOR.MINOR.PATCH:refs/tags/vMAJOR.MINOR.PATCH`. It does not
commit, push `main`, force updates, or publish all tags.
The checker runs `go mod tidy -diff`, tracked Go formatting and diff whitespace
checks, one `go test -mod=readonly -race -count=1 ./...` full suite, and
`go vet -mod=readonly ./...`. Its asset builder cross-builds Linux amd64,
Linux arm64, and best-effort macOS arm64, then checks the embedded version
on a host binary. The macOS cross-build proves compilation, not native
runtime behavior. Owned Go commands run with `GOWORK=off`; tests, vet, and
builds use readonly module mode. The deterministic suite includes documentation
and maintained-example checks. The command does not contact application
services or Gitea and does not wait for CI.
A successful tag push is the source-release completion point. The command
prints the tag and commit and exits without a separate network read-back.
For optional diagnosis before publication, run
`scripts/check-release-candidate.sh vMAJOR.MINOR.PATCH`; publication will
validate the candidate again, so this is not a required preparation step.
## Artifact delivery
Tag-triggered `.woodpecker/release.yml` independently validates the tagged
source, builds the same three targets, and publishes these Gitea downloads:
Tag-triggered Woodpecker CI uses the tagged module's ReleaseKit selection to
build and deliver the checked-in note and these assets asynchronously:
- `narratio-vMAJOR.MINOR.PATCH-linux-amd64`
- `narratio-vMAJOR.MINOR.PATCH-linux-arm64`
- `narratio-vMAJOR.MINOR.PATCH-darwin-arm64` (best effort)
- `SHA256SUMS`
The builder embeds the tag version and checks host `version` output. CI
generates checksums and uses non-overwriting publication settings. It does
not select versions, change the source, or move tags. No image or package
registry output is declared. Tag publication is not proof that these
asynchronous downloads are available.
A cross-build establishes compilation, not native macOS runtime coverage.
CI maps its existing `GITEA_RELEASE_TOKEN` secret to
`RELEASEKIT_GITEA_TOKEN`. Delivery does not determine source-release completion.
## Failure and recovery
If validation fails before tagging, correct and commit the candidate, push
it to `main`, and rerun the publication command. If the tag push reports
failure, its outcome may be ambiguous: keep the local tag and inspect the
exact `refs/tags/vMAJOR.MINOR.PATCH` at `origin` before declaring success
or retrying. A reachable matching remote tag at the recorded commit establishes
publication; a confirmed absent tag permits investigation of the transport
failure. If `origin` cannot be inspected, publication status is unknown.
Do not move, overwrite, or automatically retry the tag. Remove a local tag
only after confirming it was never published or used by a release channel.
A transient CI or delivery failure can be retried from the same immutable
tag. Missing assets may be added later if they match the tagged source and
any published checksum manifest; do not overwrite existing binaries,
checksums, or release-note contents. A source/content defect, or delivery
that cannot be corrected without replacement, requires a new suitable
version and matching note. Leave the original release intact.
Optional consumer inspection may compare the tag's remote commit with the
recorded candidate, check the Woodpecker delivery job and hosted Gitea note,
download the assets into an empty directory, run `sha256sum --check
SHA256SUMS` (or `shasum -a 256 --check SHA256SUMS` on macOS), and run
the matching host binary's `version` command. This is separate delivery
observation, never a source-release gate.
If publication is uncertain, use the recovery entry point printed by ReleaseKit
and its saved private publication record to reconcile the outcome before
retrying. Follow the [publication recovery guide](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/publish.md#retain-and-reconcile-publication-evidence).
For failed or partial delivery, retry from the same immutable tag using the
[delivery guide](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/delivery.md).
Investigate conflicts or uncertain outcomes according to that guide; do not
replace published content. For older tags, use the tooling and workflow selected
by those tags.

View File

@@ -0,0 +1,255 @@
# Multi-Format Audio Inputs and Shared Discovery
Status: Implemented and verified
## Goal
Accept ordinary audio recordings without a FLAC-only restriction. MP3, AAC, OGG,
WAV, FLAC, and other audio formats can be supplied to the transcription backend.
The backend determines whether it can decode a recording; Narratio coordinates
selection, preparation, upload, and local progress.
Use shared read-only discovery so preparation and operator inspection agree on
the selected sources. Apply the regular-file requirement approved during
[audit topic 7](audit/discussion.md#7-give-preparation-and-inspection-the-same-audio-selection-rules),
incorporating the subsequent operator clarification permitting multiple audio
formats. Earlier FLAC-only descriptions are not the target contract.
This is a feature roadmap, not a staged implementation plan. It extends the
shared-discovery remediation in
[CAT-12](audit/catalog.md#cat-12--p2-share-audio-discovery-and-accept-valid-same-basename-recordings-in-inspection).
The original audit identified inconsistent discovery under the old behavior;
the multi-format scope follows the operator's later decision.
## Historical Baseline
Reviewed against `aa0379294fba8422f7e6469261e4730b1c19bd8e`.
| Area | Current behavior |
| --- | --- |
| Local preparation | Explicit paths must have a `.flac` extension; directory scanning filters to FLAC. |
| S3 preparation | Object discovery filters to FLAC keys. |
| Operator inspection | Independently repeats local/S3 FLAC filtering and disagrees with preparation on duplicates. |
| Transcription | Both manifest-selected audio validation and fallback directory discovery independently require FLAC. |
| Preparation reuse | Reconstructs source inventory through preparation's discovery functions. |
| Speaker naming | Removes the final filename extension to derive speaker ID and raw transcript path. |
| Local copying/S3 materialization | Preserves selected filenames and copies bytes without transcoding. |
| WhisperX upload | Preserves the prepared basename and uses a generic multipart file part; no FLAC media type is forced. |
| Speaker checkpoints | Store paths, byte identities, and settings without a FLAC-specific schema requirement. |
Relevant owners are [preparation](../../internal/stage/prepare.go),
[inspection](../../internal/app/operator_inspection.go),
[transcription](../../internal/stage/transcribe.go),
[preparation reuse](../../internal/stage/prepare_resume.go),
[speaker reconciliation](../../internal/stage/transcribe_reconciliation.go),
[speaker state](../../internal/manifest/transcribe_state.go), and
[multipart upload](../../internal/adapters/whisperx/multipart_body.go).
Two naming cases need to remain distinct:
- Different local sources with the same full basename are already given distinct
prepared names. Inspection currently rejects those valid selections.
- `speaker.mp3` and `speaker.wav` have different basenames but derive the same
speaker ID, `speaker`. Existing preparation disambiguation does not resolve this
case. Transcription currently detects the ambiguity before dispatch rather
than silently overwriting `transcripts/raw/speaker.json`.
Existing tests explicitly expect MP3 rejection and FLAC-only directory selection.
Those expectations encode behavior intentionally changed by this feature.
## Agreed Target
### One selection responsibility
Share path resolution, source eligibility, deterministic selection order, and
duplicate handling between preparation and inspection. Keep file copying,
workspace writes, and manifest transitions with preparation. Inspection remains
read-only; it does not execute preparation to discover inputs.
Use the existing audio-focused owner or another narrow shared operation where
dependency direction requires it. A discovery framework or public reusable
library is unnecessary.
Preserve these established behaviors:
- Reject repeated selection of the same resolved local source path.
- Preserve distinct local recordings sharing a full basename through the
existing prepared-name disambiguation.
- Keep the existing local and S3 duplicate-basename rules distinct.
- Preserve ordinary unambiguous speaker IDs and prepared names.
Detect remaining same-stem collisions across different extensions during shared
discovery, after applying existing prepared-name disambiguation. Identify both
source paths and ask the operator to select one encoding or give the recordings
distinct names. Preserve stem-based speaker IDs rather than adding automatic
renaming for cross-extension collisions. This moves an existing transcription
failure earlier; it does not add content-based audio deduplication.
### Regular files, without a codec allowlist for explicit sources
An explicitly selected local recording must resolve to a regular file. It need
not have a `.flac` suffix or belong to a Narratio-maintained codec allowlist.
Existing path rules remain applicable; this decision adds no blanket symlink
prohibition or unrelated filesystem hardening.
S3 discovery deals with object entries; local regular-file checks apply to local
sources and materialized copies rather than inventing filesystem types for S3.
### Broad extension filtering for automatic discovery
Use one shared, case-insensitive extension filter when scanning a local audio
directory or S3 prefix. The initial discovery set is:
```text
.aac .aif .aifc .aiff .alac .amr .ape .au .caf .flac
.m4a .m4b .mka .mp2 .mp3 .mp4 .oga .ogg .opus .snd
.wav .wave .weba .webm .wma .wv
```
These suffixes identify candidates, including common audio-bearing containers;
they do not guarantee backend decoding or the presence of a valid audio stream.
Keep the set in one central, discoverable location in the shared audio-selection
owner. Preserve existing enumeration scope and directory-marker handling.
Automatic scans ignore nonmatching entries such as `ignore.txt`, unfamiliar
suffixes, and extensionless files. Explicit local file selections remain
extension-agnostic, as do already registered manifest audio inputs. The discovery
set is not a universal codec-validation rule. Document its scope, including that
S3 currently selects by prefix and therefore uses this filter; no new S3 override
or per-object selector is introduced by this feature.
Automatic scans in preparation, inspection, preparation reuse, and transcription
must use the same filter. This supports mixed-content source directories without
submitting obvious sidecars and avoids divergent format lists among consumers.
### Carry selected audio through the whole pipeline
Remove FLAC-only acceptance checks from transcription, including its manifest
input path and fallback directory path. A recording selected during preparation
must not be rejected later solely because of its extension.
Preserve the actual bytes and meaningful filename suffix during copying,
disambiguation, S3 materialization, and upload. Keep the existing format-neutral
multipart transport and replay mechanics. This feature requires no transcoding,
new MIME registry, or local decoder/probe before submitting audio.
Backend rejection of unsupported or malformed audio remains a transcription
failure. Accepting a candidate in Narratio is not a guarantee that every backend
deployment supports every codec or container.
### Retain local retry and reuse
Preparation, its reuse checks, and inspection must derive the same source
inventory under the chosen discovery policy. Transcription must continue to
checkpoint and reuse individual speakers with mixed-format inputs.
Keep path, checksum, size, and observable transcription settings as ordinary
local reuse evidence. No codec-specific manifest fields or schema migration are
required merely to admit additional formats. Keep existing unambiguous FLAC
inputs reusable under their ordinary evidence rather than renaming them wholesale.
After transcription, merge and later stages consume transcript JSON; this feature
does not require codec changes in Audita, Notarius, or Scriptorium.
## Required Changes
### Discovery and eligibility
Replace duplicated `isFlac`/`isInspectionFlacPath` selection rules and error messages
in local and S3 discovery. Implement the approved regular-file check consistently
for local recordings. Resolve same-source duplicates and the existing basename
disagreement through the shared selection owner.
Apply the shared extension set to automatic source discovery and transcription's
fallback enumeration. Manifest-registered audio is already explicitly selected;
it should not encounter another extension-based gate.
Primary areas: `internal/stage/prepare.go`,
`internal/app/operator_inspection.go`, `internal/audio`, and
`internal/stage/transcribe.go`.
### Speaker identity and prepared destinations
Detect unresolved same-stem ambiguity consistently during shared discovery,
before transcription dispatch. Account for prepared filenames as well as original
source paths: checking original stems alone must not reject the distinct
same-basename inputs that preparation already disambiguates successfully.
Keep speaker mappings, raw transcript paths, and checkpoint keys consistent with
the existing IDs. Report both ambiguous sources and direct the operator to select
one encoding or rename recordings. Preserve actual format suffixes and the
established disambiguation of identical full basenames. Do not silently choose
an encoding or extend automatic naming to the unresolved cross-extension case.
Use existing reporting paths to make any derived names understandable to operators.
Primary areas: preparation's destination naming, `buildTranscribeJobs`, source
inspection, and the speaker/input mapping documentation.
### Reuse and transport verification
Review source-inventory reconstruction in `prepare_resume.go` and input discovery
used by transcribe reconciliation. Preserve per-speaker success across ordinary
retries with mixed formats. The current generic copy, hash, checkpoint, and upload
mechanisms should be reused rather than replaced with format-specific machinery.
Confirm that multipart filenames and audio bytes survive initial submission and
transport replay unchanged. The existing generic file-part content type is not
a FLAC-only assumption and need not change for this feature.
### Documentation and tests
Update configuration, operations, preparation/transcription internals, examples,
and the WhisperX integration description where needed to explain the approved
discovery and naming behavior. FLAC can remain an example; it should not be
presented as the only permissible input format. Keep backend-specific decoding
capabilities under the backend's ownership.
Replace tests whose purpose is to reject MP3 or require FLAC-only selection with
tests of the chosen contract. Retain unrelated file, path, and failure coverage;
do not mechanically rename every FLAC fixture.
## Validation Outcomes
Use representative offline behavior tests with real temporary files and fakes at
the transcription/storage boundaries:
- Preparation and inspection agree for explicit mixed-format sources and for
directory/S3 discovery. Automatic scans recognize the shared suffix set
case-insensitively and ignore nonmatching sidecars; explicit files with other
suffixes or no extension are not rejected solely by their names.
- Non-FLAC audio registered in the manifest reaches transcription. Fallback
discovery follows the same candidate-selection policy.
- Duplicate resolved paths are rejected, distinct same-basename local recordings
remain usable, and unresolved cross-extension same-stem cases fail during
discovery with both sources identified, before transcription is dispatched.
- Copying and S3 materialization retain the selected bytes and suffixes; upload
and replay retain the multipart filename and payload.
- A partial mixed-format transcription can retry without repeating previously
checkpointed speakers, while changed inputs still receive normal reconciliation.
- Non-regular local inputs are rejected consistently, and ordinary existing FLAC
inputs retain their established naming and reuse behavior.
- Backend decoding errors remain visible failures; discovery does not claim to
have validated the actual encoding.
Offline tests verify Narratio's selection and transport, not a live backend's
codec support. No paid/live transcription gate, local codec toolchain, or new
benchmark requirement is introduced.
## Relationship to Other Work
This roadmap owns the multi-format extension and shared discovery work associated
with CAT-12. CAT-12 is closed after implementation and verification; the
historical audit reports remain unchanged.
The agreed source-identity and transfer-size changes in
[topic 4](audit/discussion.md#4-keep-downloaded-audio-and-its-source-identity-together)
are implemented, as is streaming local audio copying (CAT-04, CAT-06, and
CAT-08 are closed in the catalog). Build on those acquisition paths while
changing discovery; preserve their identity, transfer bounds, and streaming
behavior. This feature does not reopen the storage/resource remediation scope.
The [session-restore roadmap](session-restore.md) enables downstream work without
raw audio. This roadmap concerns workflows that actually select and transcribe
audio. Neither roadmap requires completing the other first. Remote execution
checkpoints, new audio-size caps, additional format conversions, and live-stream
input support are outside this scope.

View File

@@ -0,0 +1,178 @@
# Functional Correctness Audit
Reviewed on 2026-11-30 against commit
`723b788161f59fd3b0a45eabd370385cc5640b4d`.
## Scope And Evidence
The review examined configuration acquisition and domain projections, canonical
stage execution, semantic resume and invalidation, speaker/artifact checkpoints,
artifact resolution, subprocess and HTTP boundaries, prepared previous-session
inputs, publication, restore, and cleanup. Findings use the current application
contracts in the architecture policy, operations guide, and focused internal
documents. They do not require compatibility shims or stronger transactional
guarantees.
The unmodified repository passed these checks with `GOTOOLCHAIN=go1.27.4`:
- `go test ./...`
- `go test -race -count=1 ./...`
- `go vet ./...`
- `go build ./...`
Four temporary offline diagnostics, supplied through Go's `-overlay` facility,
reproduced the three findings below. They exercised real internal collaborators
and existing filesystem fixtures, with the in-memory storage adapter at the
remote boundary. Their expected-behavior assertions failed as described below;
no production code or repository tests were changed. Live downstream tools,
paid providers, and a real S3 service were not exercised. This review does not
establish the absence of other defects.
## FC-01 — P2: Previous-session hydration omits analysis prerequisites
Status: Open
Relevant code:
- [Preparation](../../../internal/stage/prepare.go):
`collectPreparePreviousRequirements` (line 533) and its caller in `Run`.
- [Requirement collection](../../../internal/artifacts/previous_requirements.go):
`CollectPreviousArtifactRequirements`, particularly lines 32–36.
- [Analysis planning](../../../internal/stage/analyze_plan.go):
`planAnalyzeWork` and `AnalyzeTargetClosure`.
- [Restore planning](../../../internal/app/restore_plan.go):
`buildPreviousCacheRestoreActions` uses the same target-only collector.
**Trigger.** An enabled target `summary` depends on a disabled artifact
`history`, and `history` consumes
`narratio.previous_session.artifact.history`. The same issue occurs with an
explicit `--artifacts summary` selection that excludes its prerequisite from
the target set, even if that prerequisite is otherwise enabled. A previous
session and its published history can be available remotely.
**Expected.** The prerequisite participates in the documented analysis work
closure, so preparation makes its previous-session inputs available before
analysis executes. Required and optional inputs retain their configured
meaning. See [analysis behavior](../../internal/stage-analyze.md) and
[artifact selection](../../operations.md#artifact-development-workflows).
**Actual.** Preparation scans only `EffectiveArtifactSet` targets. Analysis
separately expands those targets to prerequisites. In the diagnostic,
analysis's closure was `[history summary]`, but preparation collected no
previous-session requirements. A required input consequently fails later with
prepare-rerun guidance; repeating the same preparation cannot supply it. An
optional input can instead be omitted despite an available remote artifact.
Restore's previous-cache planning has the same omission for disabled
prerequisites of enabled targets.
**Remediation approaches.** Collect previous-session requirements over the
existing shared analysis dependency closure. Use that requirement set
consistently for preparation, its semantic evidence, object-store composition,
and restore. Preserve explicit targets separately so this change does not
broaden force or publication selection. An alternative is to pass a separately
derived prerequisite-inclusive input-requirement set to these consumers;
avoid maintaining a second dependency algorithm.
**Verification to retain when fixed.** Exercise enabled-target/disabled-
prerequisite and explicit-target/prerequisite cases, including required and
optional previous inputs, followed by analysis and previous-cache restore.
## FC-02 — P2: Carried publication bytes conflict with restored manifest evidence
Status: Open
Relevant code:
- [Publication planning](../../../internal/stage/publish_output_plan.go):
`buildPublishOutputPlan` preserves an exact prior declaration for a locked
source.
- [Committed session manifest](../../../internal/stage/publish_commit.go):
`writeCommittedSessionManifest` (lines 103–134) copies current local output
evidence unchanged.
- [Restore planning](../../../internal/app/restore_plan.go):
`buildCommittedRestoreActions` (lines 172–193) maps the carried object to the
canonical product path.
- [Manifest installation](../../../internal/app/restore_manifest_paths.go):
`rebaseRestoredManifestPaths` changes paths and diagnostic references while
retaining output checksums and completion evidence.
**Trigger.** Publish transcript or artifact version A, lock its source, then
generate local version B and publish again. The new remote commit correctly
carries A's exact declaration while its session-manifest object records B's
local completion. Restore that committed snapshot into an empty workspace.
**Expected.** Restore preserves the locked publication and installs a ledger
whose output authority agrees with the available bytes. It must not claim
that A is the completed B result. The relevant contracts are
[committed publication](../../internal/stage-publish.md) and
[manifest-authoritative resolution](../../internal/manifest.md).
**Actual.** Restore installs A into the canonical product path and preserves
B's checksum and successful stage record. It can return success, but the
restored product then fails normal artifact resolution. The real publication
diagnostic confirmed the conflicting declaration and session-manifest
checksums. A second diagnostic passed that shape through the real restore
planner, installer, manifest loader, and resolver: restore succeeded, then
`narratio.transcript.final_trimmed` failed with `checksum mismatch`. A bounded
analysis run consuming that transcript cannot use the restored publication;
configured-artifact evidence similarly becomes non-current.
**Remediation approaches.** Reconcile restored authority with the selected
commit's actual product identities. Where carried bytes replace a different
local generation, preserve truthful provenance and reconcile affected stage,
per-artifact, and dependent completion state. Another approach is to
separate the generation-ledger snapshot from the restore/publication projection
and explicitly construct a coherent restored manifest. Simply replacing a
checksum while preserving B's fingerprint or dependent success would falsely
certify A as B. Preserve exact carried declarations and checksum validation.
**Verification to retain when fixed.** Publish A, lock, generate B, republish,
restore into a new workspace, and inspect both restored content and reuse
decisions. Include a built-in transcript and a configured analysis artifact.
## FC-03 — P2: Session planning reports reusable S3 preparation as changed
Status: Open
Relevant code:
- [Work projection](../../../internal/app/plan.go):
`projectSelectedWork` (lines 81–104) constructs a stage environment without
an object store.
- [Preparation resume](../../../internal/stage/prepare_resume.go):
`currentPrepareAudioSourceInputs` (lines 196–200) requires an S3 listing;
`ValidateResume` (lines 50–55) converts that failure to a changed-input result.
- [Runtime composition](../../../internal/app/runner_stage_execution.go):
`executeSelectedStage` composes preparation collaborators before checking
its resume evidence, unlike the planning path.
**Trigger.** A session uses `inputs.audio_s3`, preparation has succeeded, and
the prepared copies and remote key/size/ETag identities remain unchanged. Run
`session plan` over a range containing preparation.
**Expected.** The plan reflects verified resume evidence, or identifies evidence
it could not inspect. The documented shared planning semantics should not
describe unchanged inputs as changed solely because a planning collaborator
was omitted. See [planning](../../cli.md#session-plan).
**Actual.** The projection cannot list S3 audio without an object store. It
reports `prepare` as `run` with reason "prepared inputs or their current sources
changed; rerun prepare" and models dependent invalidation. Ordinary execution
supplies the store and can reuse the same preparation. The diagnostic prepared
S3 audio with the existing fake backend, verified `Resumable=true` with that
backend, then projected the identical configuration and manifest and observed
the erroneous `run` decision. This is misleading planning output, not a
durable invalidation or an observed execution rerun.
**Remediation approaches.** Obtain read-only audio identity evidence at the
planning boundary and provide it to the shared decision, keeping stage
execution and the projection's mutation-free behavior separate. A storage
reader or an acquired identity snapshot can supply that evidence. If planning
is deliberately kept free of this remote lookup, expose an unverified or
conditional decision and document that limit instead of reporting a definite
input change. Avoid treating unverifiable inputs as proven reusable.
**Verification to retain when fixed.** Compare plan and execution for unchanged
and changed S3 object identities, and distinguish an unavailable remote source
from an actual content change. Confirm that planning leaves the workspace and
manifest untouched.

View File

@@ -0,0 +1,211 @@
# Algorithmic Efficiency Audit
Reviewed on 2026-11-30 against commit
`89ea4ff1556633f217844b4a8c81a4bc2c9ffede`.
## Scope And Method
The review traced repository-owned loops, lookups, copying, graph traversal,
error construction, and their callers across configuration, orchestration,
stages, artifact resolution, storage, restore, and subprocess adapters.
Complexities below follow from source-level operation counts. Hash-map bounds
are expected bounds; path, key, and error-message lengths are treated as
bounded unless stated otherwise. No benchmarks or production performance
measurements were collected. Production code and tests remain unchanged.
The five findings concern implementation choices without an expressly selected
algorithm requiring the current cost. They preserve the existing data and
execution contracts.
## EF-01 — P2: Local audio copying buffers the complete recording
Status: Open
**Code.** [prepare.go](../../../internal/stage/prepare.go),
`materializeLocalAudioInputs` (line 367) and `copyFileIfChanged` (lines 635–663).
On the missing or changed destination path, `copyFileIfChanged` first hashes
the source, then calls `os.ReadFile(src)` and passes the complete byte slice to
`store.WriteFileAtomic`. This path handles prepared local `.flac` files as well
as small configuration inputs.
**Complexity.** For a recording of B bytes, copying takes Θ(B) time and Θ(B)
auxiliary RAM. Sequential processing limits this to the current recording,
but a single large speaker file still requires a file-sized allocation. The
same copy can take Θ(B) time and O(1) auxiliary RAM relative to B using a
fixed-size streaming buffer. This is a space-complexity improvement, not an
asymptotic time improvement.
**Refactoring opportunity.** Retain the existing unchanged-destination check,
then use the streaming artifact-copy path. `artifacts.Store.CopyInputFor` is
already available; its local implementation delegates to
[fileops.CopyFileAtomic](../../../internal/fileops/fileops.go).
`CopyFileAtomicWithChecksum` and `WriteReaderAtomicWithChecksum` also provide
the underlying streaming replacement mechanism. Preserve destination naming,
workspace modes, atomic visibility, and the recorded checksum. File-sized
buffering is not required for any of those behaviors. No new input-size cap
is needed.
## EF-02 — P3: Analysis rebuilds the same dependency index after each completion
Status: Open
**Code.** [analyze_execution_state.go](../../../internal/stage/analyze_execution_state.go),
`acceptArtifact` (lines 93–101), and
[analyze.go](../../../internal/stage/analyze.go),
`staleUnscheduledAnalyzeDependents` / `staleAnalyzeDependentClosure`
(lines 278–319).
Every newly generated artifact, or artifact whose output identity changed,
calls the invalidation helper. That helper rebuilds the entire reverse
dependency map, renormalizes dependency lists, and sorts reverse adjacency
lists before traversing the affected descendants. Configuration is unchanged
throughout the execution.
**Complexity.** Let V be configured artifacts, E dependency edges, and K
new/changed completions. Graph construction alone costs at least Ω(K(V+E)),
with repeated dependency/adjacency sorting adding up to O(K E log V) work.
On an initial execution of V independent artifacts, E=0 and K=V: this setup
still costs Θ(V²), although each descendant traversal is empty. It also
repeatedly allocates graph maps and edge slices.
**Refactoring opportunity.** Build the immutable reverse dependency index once
for the analysis execution, retaining any required deterministic ordering.
Pass it to success and failure invalidation. Setup then costs O(V+E), plus
any one-time sorting, followed by O(reached vertices + reached edges) for each
affected traversal. For independent artifacts, the invalidation work becomes
O(V+K). Preserve the current eligibility rule for evaluated artifacts and the
timing of dependent invalidation.
The selected complete-collection checkpoints still have their own cumulative
cost. This finding removes redundant graph work; it does not claim that the
whole analysis stage becomes linear.
## EF-03 — P3: Previous-session metadata is repeatedly searched as a list
Status: Open
Three related lookup paths have straightforward indexing alternatives:
1. **Remote declarations.**
[previouscache.go](../../../internal/previouscache/previouscache.go),
`Resolve` (lines 145–147) calls `committedPublishedArtifactBySource`
(lines 196–209) separately for every requirement. With R requirements and
C commit declarations, the lookup work is O(RC), including quadratic
cases when both grow together. Build one source-keyed index of validated
`published_output` declarations in O(C), then resolve requirements in
O(R). Existing sorting of the returned plan remains unchanged. The index
must remain bound to the single pointer-selected commit.
2. **Local input records.**
[artifact_resolver.go](../../../internal/artifacts/artifact_resolver.go),
`ResolvePreviousSessionArtifactWithCatalog` (lines 271–288), scans every
`manifest.Inputs` entry for each previous-artifact binding. The prepared
stable-input resolver in
[prepared_input.go](../../../internal/artifacts/prepared_input.go),
`ResolvePreparedInput`, also searches that collection on each call.
Analysis invokes these through input-identity resolution across configured
artifacts. For U lookups and I input records, record selection costs O(UI)
before content verification. A phase-local kind/source index reduces
selection to O(I+U), plus candidate validation. Retain candidate
multiplicity and existing ambiguity/path checks; a last-write-wins map
would change behavior. Continue verifying the selected files' content.
3. **Optional-absence reporting.**
[session_state_command.go](../../../internal/app/session_state_command.go),
`inspectSessionState` (lines 227–232), calls
[previousRequirementSkipped](../../../internal/app/operator_inspection.go)
for each requirement. It linearly searches the skipped-name list. With R
requirements and S skipped names, membership costs O(RS); when all are
optional and absent, it performs a triangular Θ(R²) number of comparisons.
Build a skipped-name set once for O(R+S) total work. Binary search is also
viable while the existing sorted-result property is retained, giving
O(R log S) membership work.
These indexes can remain private to each phase. They need not become a generic
manifest framework or cache file contents across executions. Required/optional
policy, checksum validation, and selected-commit authority remain intact.
## EF-04 — P3: Restore reporting performs a full search after each install
Status: Open
**Code.** [restore_execute.go](../../../internal/app/restore_execute.go),
`executeRestorePlan` (lines 81–93), and
[restore_report.go](../../../internal/app/restore_report.go),
`markDownloaded`, `markFailed`, and `findAction` (lines 102–153).
The report is built from the complete restore plan. Each downloaded file then
calls `markDownloaded`, which searches the report from the first action to
find the matching local-path/remote-key pair. Failure marking uses the same
search.
**Complexity.** For A report actions and D downloads, successful reporting
costs O(DA). When every action downloads, the searches perform
1+2+...+A = Θ(A²) comparisons, even though each report entry changes once.
Moving the manifest install last does not change that sum.
**Refactoring opportunity.** Build a private composite-key-to-report-index map
when constructing the report: O(A) setup and space, then expected O(1) per
update, for O(A+D) total bookkeeping. Alternatively, carry the original report
index alongside each execution action, including when moving the manifest
action last. Preserve public report order, serialized fields, and install
ordering. Downloading, verification, and report serialization are separate
costs and are not removed by this change.
## EF-05 — P3: Publication-inspection errors form a quadratic-formatting tree
Status: Open
**Code.** [session_state_command.go](../../../internal/app/session_state_command.go),
`inspectPublishedOutputs` (lines 300–303).
For every failed publication lookup, the loop assigns
`resultErr = errors.Join(resultErr, err)`. Multiple failures, such as object
metadata requests failing during a storage outage, produce a left-nested
error tree. The returned error is subsequently rendered by command reporting.
**Complexity.** Creating each join is constant work, so aggregation itself is
linear in F failures. Formatting is different: Go 1.27.4's
`errors.joinError.Error` recursively formats the previous join and copies its
growing message into the parent result. For bounded-size leaf messages, one
final formatting pass takes Θ(F²) time and cumulative allocation, with Θ(F)
tree depth, even though the final text is only Θ(F) bytes.
**Refactoring opportunity.** Append failures to `[]error` and call
`errors.Join(failures...)` once after the loop. Formatting then takes O(F+T),
where T is the total rendered leaf-message size, with a flat aggregate.
Retain per-output error details, error order, partial results, and
`errors.Is`/`errors.As` visibility. The existing preflight collectors already
use this approach.
## Deliberately Retained Designs And Review Results
The following were treated as selected behavior rather than optimization
findings:
- the fixed canonical stage sequence, separate invalidation relation, and
pure planning projection;
- deterministic topological artifact ordering and required dependency closure;
- complete-collection manifest checkpoints after each accepted speaker or
artifact, including the detached-copy boundary;
- manifest-authoritative checksum/content validation, publication commit
ordering, and restore's manifest-last installation;
- native ConfigKit configuration resolution and upstream-owned processing
algorithms.
Nested loops over independent collections were not classified as quadratic
without tracing the relevant input dimensions. Fixed-stage and fixed-glossary
loops are bounded by the application model. Existing map-based publication
mapping and prepared-record matching, heap-based artifact ordering, streaming
WhisperX upload, and streaming remote downloads already avoid the corresponding
simple scaling pitfalls.
No additional ordinary functional defect was established in this pass. The
previously recorded findings remain in [01-correctness.md](01-correctness.md);
they were not duplicated here.
Validation: `GOTOOLCHAIN=go1.27.4 go test ./...` passed. This is behavioral
baseline evidence, not a performance measurement or proof that the identified
costs are operational bottlenecks. The findings identify available asymptotic
improvements; their practical priority remains a maintainer decision.

View File

@@ -0,0 +1,355 @@
# Complexity And Maintainability Audit
Reviewed on 2026-11-30 against commit
`3c00167912a47e566a1622097dcea2904fe50094`.
## Scope And Method
The review covered repository-owned configuration/domain derivation,
application orchestration, stages, manifests, artifact resolution, restore,
publication, file operations, and external adapters. It considered both local
control-flow complexity and duplicated responsibilities across package
boundaries. Production code and repository tests were left unchanged.
Codebase-memory-mcp supplied symbol discovery, call relationships, and
cyclomatic/cognitive metrics. Its Go index merges some same-named receiver
methods, including stage `Run` methods, so those rankings are incomplete. A
temporary standard-library Go AST scanner supplemented the graph with
receiver-qualified metrics across non-test Go files. `gocyclo`, `gocognit`, and
`staticcheck` were not installed.
The scanner's **decision score** is one plus the count of `if`, `for`, `range`,
non-default case/communication clauses, and `&&`/`||` expressions inside a
function, including nested closures. **Span** includes comments and blank
lines from the function declaration through its closing brace. These are
screening signals, not formal quality thresholds or active-LOC measurements.
Representative results were:
| Function | File | Decision score | Span |
| --- | --- | ---: | ---: |
| `extractStage.Run` | `internal/stage/extract.go` | 56 | 200 |
| `trimStage.Run` | `internal/stage/trim.go` | 55 | 326 |
| `prepareStage.Run` | `internal/stage/prepare.go` | 44 | 238 |
| `publishStage.Run` | `internal/stage/publish.go` | 39 | 208 |
| `assessSessionReadiness` | `internal/app/session_readiness.go` | 35 | 116 |
| `inspectSessionState` | `internal/app/session_state_command.go` | 33 | 129 |
| `executeSelectedStage` | `internal/app/runner_stage_execution.go` | 31 | 125 |
The graph additionally reported cognitive scores of 81 for
`inspectSessionState`, 78 for `assessSessionReadiness`, and 51 for
`preflight.Check`. Source inspection determined which scores corresponded to
useful refactoring seams. Guard clauses and explicit failure ordering account
for substantial scores in otherwise readable functions.
No benchmarks, production measurements, or live-provider tests were used. Two
temporary offline diagnostics, supplied through Go's `-overlay` facility,
confirmed the reporting defect in CX-01. The metric scanner and diagnostics
ran with the maintained Go 1.27.4 toolchain and were not added to the repository.
## CX-01 — P2: Audio discovery is duplicated and inspection rejects valid inputs
Status: Open
**Code.** [Preparation](../../../internal/stage/prepare.go):
`resolveLocalAudioFiles` (line 311), `localAudioDestinations` (line 381), and
`listS3AudioObjects` (line 487).
[Operator inspection](../../../internal/app/operator_inspection.go):
`resolveLocalInspectionAudioPaths` (line 207) and
`inspectRemoteAudioPresence` (line 101).
**Complexity.** Preparation and inspection independently implement relative-path
resolution, explicit-file versus directory discovery, FLAC filtering, file
checks, duplicate handling, and deterministic ordering. The local discovery
functions occupy 56 and 54 lines respectively and both have graph cognitive
scores of 25. Remote discovery repeats prefix/list/filter/basename logic with
different return shapes. Maintaining these implementations requires tracing
both call paths to know which rules actually govern accepted audio.
**Confirmed correctness issue.** Given `first/speaker.flac` and
`second/speaker.flac` in `inputs.audio_files`, preparation accepts both and
assigns distinct managed destination names. Inspection instead rejects the
second file with `duplicate audio basename`. Consequently `session status`
can report valid local audio as unavailable and return an error even though
preparation can succeed. Configuration validation does not prohibit this
selection. The existing
[distinct-recording test](../../../internal/stage/audio_destinations_test.go)
also protects preparation's preservation of these recordings.
One temporary diagnostic executed the real preparation stage and confirmed two
distinct recorded audio destinations. A second exercised
`inspectLocalAudioPresence` over the same input shape; its expected-available
assertion failed with the duplicate-basename error. This is a local
inspection defect, separate from the S3 planning defect in FC-03.
**Refactoring opportunity.** Give read-only audio discovery one owner, naturally
the existing `internal/audio` area or a small adjacent domain helper. Return
normalized local sources or remote object identities and let preparation own
copying/checkpoints while inspection owns reporting. Keep session-prefix
construction at the Narratio boundary and pass explicit prefixes to storage.
Share the remote object filter and duplicate rules as well as local discovery.
Fix inspection to accept distinct same-basename local recordings. Retain
preparation's rejection of duplicate resolved local sources, destination
disambiguation, and the separately selected S3 basename rule. A shared helper
must express these real differences rather than impose a new global basename
restriction. A durable regression should exercise accepted local inputs
through preparation and operator inspection.
## CX-02 — P3: Prepared stable inputs have parallel materialization and resume definitions
Status: Open
**Code.** [prepare.go](../../../internal/stage/prepare.go): `prepareStage.Run`;
[prepare_resume.go](../../../internal/stage/prepare_resume.go):
`currentPrepareSourceInputs`, `currentPreparePartySourceInputs`, and
`prepareSourceInputsMatch`;
[prepare_party.go](../../../internal/stage/prepare_party.go):
`materializeCanonicalPartyInputs`;
[semantic_contracts_initial.go](../../../internal/stage/semantic_contracts_initial.go):
`prepareStableInputSemantics`.
**Complexity.** Execution builds input records through several local closures,
individual render/write/register blocks, a glossary list, and a separate party
writer. Resume reconstructs much of the same rendering and glossary dependency
information in a different representation, then maintains another explicit
managed-kind set. Semantic selection has its own stable-input enumeration.
Adding a prepared source requires finding all the relevant definitions and
keeping their kind, content, dependencies, and presence semantics aligned.
The existing
[prepared-source descriptors](../../../internal/artifactpolicy/policy.go)
already centralize source IDs, manifest kinds, and filenames. The opportunity
is to reuse that investment, not introduce a competing registry.
**Refactoring opportunity.** Build a small stage-owned stable-input description
from the resolved domain data, reused by materialization and current-source
identity calculation. Share the glossary name/descriptor/dependency mapping and
party/player rendering. Derive managed-kind membership from those descriptions
where appropriate. Keep audio and previous-session hydration as explicit phases
with their distinct acquisition rules. This also shortens `prepareStage.Run`
without replacing it with a configurable preparation engine.
Preserve the distinction between raw materialized checksums and the intentional
semantic normalization of campaign/session snapshots. Semantic fingerprint
projection should continue to select result-affecting evidence, not hash all
configuration or perform materialization. Keep the ConfigKit result immutable
and use only post-handoff Narratio domain data. Focused regression coverage
should compare fresh preparation with reuse after unchanged and changed
inputs, including combined-glossary dependencies and source relocation.
## CX-03 — P3: Trim and extraction mix invocation mechanics with product acceptance
Status: Open
**Code.** [trim.go](../../../internal/stage/trim.go): `trimStage.Run` (line 23);
[extract.go](../../../internal/stage/extract.go): `extractStage.Run` (line 38);
[extract_preflight.go](../../../internal/stage/extract_preflight.go):
`BuildNotariusReadiness`.
**Complexity.** Trim's 326-line entry point interleaves input/layout discovery,
disabled-copy behavior, optional Scriptorium debug rendering, bounds generation
and validation, selector interpretation, Seriatim execution, output promotion,
and extensive diagnostic-map assembly. The disabled and enabled branches both
perform trimmed-transcript validation and promotion. A change to bounds
execution requires reading through several unrelated phases.
Extraction's 200-line entry point similarly combines resolved options,
reference snapshots, invocation paths, subprocess execution, completion and
bundle checks, staged lane selection, canonical promotion, and evidence
construction. Execution and `BuildNotariusReadiness` independently resolve the
binary, configuration/working paths, timeout, and force-to-cache-refresh option.
Those copies must remain aligned even though probe and execution destinations
legitimately differ.
**Refactoring opportunity.** Extract cohesive operations with typed inputs and
results: obtain validated bounds, optionally render diagnostics, produce the
trimmed transcript, and promote accepted products. Keep a small explicit
disabled branch and share the final transcript acceptance path. For extraction,
share the resolved Notarius invocation options with readiness, then isolate
native-completion acceptance and staged-lane promotion from request setup.
Return diagnostic information from those operations instead of using one
long-lived mutable map as their communication channel.
The benefit should be fewer duplicated rules and smaller reasoning scopes,
not a helper for each statement. Keep orchestration visible in `Run`, CLI
translation in adapters, validation before canonical promotion, reference
verification after invocation, and failed-attempt diagnostics available.
Existing phase separation in
[analysis execution](../../../internal/stage/analyze_artifact_execution.go)
and shared request construction for polish offer local examples. No generic
subprocess-stage or workflow framework is warranted.
## CX-04 — P3: Inspection and readiness combine collection, policy, and presentation
Status: Open
**Code.** [session_state_command.go](../../../internal/app/session_state_command.go):
`inspectSessionState` (line 109);
[session_readiness.go](../../../internal/app/session_readiness.go):
`assessSessionReadiness` (line 93);
[downstream_readiness.go](../../../internal/app/downstream_readiness.go):
`checkDownstreamReadiness` (line 27);
[preflight/check.go](../../../internal/preflight/check.go): `Check`.
**Complexity.** Inspection loads ledger/catalog evidence, discovers a remote
commit, reads locks and publication state, inspects stable inputs/audio/previous
requirements, mutates a public report, and accumulates failures in one function.
Readiness combines preparation outcome interpretation, transcript projection,
tool checks, severity/category formatting, storage initialization, and lock
reporting. Deep per-tool initialization/build/check branches further obscure
which work is blocked, canceled, or independently eligible.
`preflight.Check` has a related smaller seam: its target loop handles transport
failures and cancellation while also interpreting required/conditional inputs,
variables, incomplete reports, and duplicate missing-variable findings.
These rules are easier to understand separately from iteration and I/O.
**Refactoring opportunity.** Keep explicit top-level sequencing, but collect
cohesive local-state, remote-publication, and input-readiness results before
projecting them into reports. Extract tool-specific readiness operations that
retain the initialized adapters on the invocation. Existing result types and
the current `record` helper provide a starting point; a broad check registry is
unnecessary. Isolate Scriptorium report interpretation as a pure operation
over one target/report, leaving inspection calls and cancellation in the loop.
Preserve partial findings, independent checks after ordinary failures, blocked
checks when preparation is unavailable, cancellation, and the distinction
between preparation and readiness. Keep inspection read-only and standalone
preflight's preparation/provider effects explicit. Reuse current report shapes;
there is no need for new commands, stricter readiness rules, or exact diagnostic
wording guarantees. The nested-error performance issue is already EF-05 and is
not a new finding here.
## CX-05 — P3: Artifact dependency semantics span several representations and owners
Status: Open
**Code.** [validate_scriptorium.go](../../../internal/config/validate_scriptorium.go):
`ValidateScriptoriumArtifactDependencies` (line 265);
[analyze_fingerprint.go](../../../internal/stage/analyze_fingerprint.go):
`normalizedAnalyzeDependencyKeys` and `orderConfiguredAnalyzeArtifacts`;
[analyze_plan.go](../../../internal/stage/analyze_plan.go):
`planAnalyzeWork` and `AnalyzeTargetClosure`;
[analyze.go](../../../internal/stage/analyze.go): `staleAnalyzeDependentClosure`;
[effective_set.go](../../../internal/artifacts/effective_set.go):
`EffectiveArtifactSet`;
[previous_requirements.go](../../../internal/artifacts/previous_requirements.go):
`CollectPreviousArtifactRequirements`.
**Complexity.** Configuration builds normalized dependency adjacency and a DFS
for validation. Stage code separately normalizes edges, builds topological
ordering, expands prerequisite closure, and constructs reverse adjacency for
invalidation. Other consumers receive `EffectiveArtifactSet`, whose keys are
explicit/enabled targets rather than the prerequisite-inclusive work set. Its
comment describes artifacts an invocation will execute, which obscures that
distinction. Several consumers must reconstruct enough graph semantics to ask
what inputs or capabilities the invocation needs.
The omission in FC-01 demonstrates the maintenance risk of these interfaces:
preparation collects previous inputs from targets while analysis separately
expands prerequisites. EF-02 records the repeated reverse-index construction
cost; neither defect is duplicated as a new correctness/performance finding.
**Refactoring opportunity.** Centralize normalized configured-artifact graph
mechanics under a small domain owner, potentially alongside the separately
derived `config.ArtifactCatalog`. Reuse its dependency view for validation,
deterministic ordering, prerequisite queries, and dependent traversal. Expose
target selection and required work closure distinctly to preparation,
preflight/planning, analysis, and restore. Narrow domain helpers are sufficient;
a general graph library or workflow engine is unnecessary.
Keep execution flat and canonical. Artifact force/publication targets remain
distinct from prerequisites, and invalidation eligibility remains caller policy.
Preserve family-origin diagnostics and semantic dependency fingerprints. Do not
merge this graph with the fixed stage invalidation relation: they represent
different domains. The outcome should be one definition of dependency
mechanics and clearer caller contracts, not another effective configuration.
## CX-06 — P3: Unstructured metadata carries cross-package control evidence
Status: Open
**Code.** [publish.go](../../../internal/stage/publish.go): `publishMetadata`
(line 316);
[publish_output_plan.go](../../../internal/stage/publish_output_plan.go):
`publishOutputOutcomeMetadata`;
[cleanup_plan.go](../../../internal/stage/cleanup_plan.go):
`validateCleanupPublishEvidence` (line 84);
[artifact_inspection.go](../../../internal/app/artifact_inspection.go):
`committedPublishOutputOutcomes` (line 41);
[extraction_evidence.go](../../../internal/artifacts/extraction_evidence.go):
`InspectExtractionEvidence`.
**Complexity.** `StageRecord.Metadata` serves both free-form diagnostics and
machine-consumed evidence. Publication writes string-keyed completion and
outcome maps; cleanup reconstructs required types/keys and identity evidence;
application inspection manually decodes outcomes. Extraction similarly writes
metadata in stage code and reads it in artifact resolution. A producer/consumer
change can compile while silently changing what another package recognizes.
Publication outcomes also require separate handling of freshly built
`[]map[string]any` and JSON-decoded `[]any`.
**Refactoring opportunity.** Start with the publication completion/outcome
payload: provide narrowly typed construction and decoding under an existing
shared contract owner. Let consumers use named fields while retaining
stage-specific decisions, such as cleanup eligibility, at the stage boundary.
Apply the same treatment to extraction control evidence if it removes repeated
producer/consumer knowledge. Keep arbitrary diagnostic metadata flexible.
This can preserve the existing JSON shape; a new manifest schema or generic
metadata framework is not needed just to centralize conversion. Fresh versus
decoded collection shapes are normal JSON behavior, not a legacy migration
surface. Preserve missing/malformed evidence handling and test a persistence
round trip as well as direct in-memory use. Typed decoding does not replace
identity checks or make successful publication imply that every local output
matches a carried remote object; FC-02 remains a separate correctness issue.
## Deliberately Retained Complexity
The audit does not recommend a package split merely because `internal/stage`
and `internal/app` are large. They already contain 51 and 54 non-test Go files
respectively. Moving unchanged branches between files would not address the
duplicated models or mixed responsibilities above.
Several complex areas have useful existing boundaries:
- Publication exposes immutable uploads, commit creation, lock revalidation,
and pointer selection in an understandable ordered sequence. Restore
separates discovery, planning, conflict classification, and installation.
Keep those protocol boundaries visible rather than hiding them in a generic
transaction abstraction.
- The runner's explicit stage lifecycle and manifest save ordering coordinate
real failure transitions. Shared invocation handling and checkpoint helpers
already consolidate behavior. A lower decision count alone would not justify
rewriting them.
- Artifact-family expansion and manifest/evidence validation contain many
genuine domain rules. Prefer the shared dependency/source models identified
above to mechanically fragmenting every validator.
- File-operation helpers already have narrow owners. The inspected path
walkers have different read/create/install responsibilities; this audit did
not establish that replacing them with one configurable FileOps framework
would simplify their contracts.
- ConfigKit, CommandKit, external tool semantics, streaming transport, and
adapter isolation remain appropriate upstream/boundary responsibilities.
## Review Outcome
Six findings warrant consideration: one confirmed P2 reporting defect with a
cross-package consolidation opportunity, and five P3 maintainability
opportunities. Fix CX-01 first. The highest-leverage structural work is sharing
prepared-input definitions and artifact dependency semantics; phase extraction
can then reduce the reasoning scope of stage and operator entry points.
Publication metadata typing is a narrower follow-up. These are opportunities,
not a requirement to implement all refactors together.
Earlier open findings remain in [01-correctness.md](01-correctness.md) and
[02-efficiency.md](02-efficiency.md). Apart from CX-01, this pass established no
additional ordinary correctness defect. It does not establish the absence of
other defects or guarantee a net LOC reduction. The main expected gain is fewer
independent definitions and clearer ownership; helpers that only relocate
complexity should be avoided.
Validation: `GOTOOLCHAIN=go1.27.4 go test ./...`, the focused documentation-link
check, and `git diff --check` passed. The temporary expected-available inspection
diagnostic failed as described in CX-01; the corresponding preparation
diagnostic passed. No bug fixes or refactors were implemented in this pass.

View File

@@ -0,0 +1,317 @@
# Concurrency Audit
Reviewed on 2026-11-30 against commit
`f02e7ec8deabc0ad7527803298c317f0cfcff21b`.
## Scope And Evidence
The review followed goroutine ownership, shared mutable state, channel
lifetimes, cancellation, subprocess supervision, local session locking,
destructive commands, remote publication, and input acquisition. It included
interactions among application orchestration, stages, manifests, artifact
storage, HTTP/subprocess adapters, and object storage.
Codebase-memory-mcp supplied symbol discovery and caller/callee tracing. Direct
source inspection supplemented incomplete same-named Go method indexing, and a
non-test-source search checked the inventory of goroutines, channels,
synchronization primitives, and cancellation operations. The maintained Go
1.27.4 `os/exec` implementation was inspected for wait and stream-copy lifetime
semantics.
Existing checks passed with `GOTOOLCHAIN=go1.27.4`:
```sh
go test -race -count=1 ./...
go test -race -shuffle=on -count=5 ./internal/stage ./internal/artifacts ./internal/adapters/whisperx ./internal/adapters/subprocess
go vet ./...
```
No race-detector warning was observed. The findings below are source-established
ordering/lifetime hazards; this pass did not dynamically reproduce their
specific interleavings. Existing tests were inspected to establish what they
exercise. No production code or tests were added or modified. No live S3
service or paid downstream provider was used. Native execution evidence is
from Linux, not macOS.
Passing race tests cover only exercised memory-access interleavings. They do
not establish cross-process filesystem exclusion, atomic remote creation, or
correct behavior after the exceptional reaping timeout described below.
## Current Concurrency Architecture
Narratio executes its fixed pipeline stages sequentially. Application
orchestration owns the invocation and session lock; stage code owns its local
work, and adapters own HTTP and subprocess lifetimes. ConfigKit configuration
resolution completes before stage execution. The manifest is invocation-owned
mutable authority rather than a generally concurrent store.
| Area | Implemented ownership and synchronization |
| --- | --- |
| Run, standalone preflight, restore, and final cleanup stage | One per-session OS file lock spans local state transitions. Finalization precedes release. Restore plans local changes under that lock. |
| Transcription | A bounded `errgroup` owns speaker workers and joins them before returning. A mutex serializes collection checkpoints and promotion of saved manifest evidence. Jobs have distinct output paths. |
| WhisperX HTTP | One immutable client can serve workers. Each attempt/replay has its own audio handle and multipart reader. Mutexes protect close/error state; context callbacks close sources to release reads. |
| Subprocesses | One goroutine calls `Cmd.Wait`; a buffered channel reports completion. The supervisor handles cancellation, timeout, and capture failure, with process-group termination on supported platforms. Stdout/stderr copying is concurrent. |
| Diagnostics | Per-stream redactors normally have one copying owner. A shared mutex protects diagnostic file writes, tails, and limit reporting; safe final flush depends on stream-copy completion. |
| Configuration and shared schemas | Configuration acquisition belongs to an invocation. Bundled schema compilation uses `sync.Once`, followed by read-only schema access. |
| Remote publication | Immutable objects and a commit precede current-pointer selection. Lock creation/replacement uses provider conditions; publication rechecks initially unlocked sources before selecting the pointer. This is not a distributed transaction. |
Manual whole-session cleaning is the important exception to local lock
participation, as described in CN-01.
## CN-01 — P1: Whole-session cleaning bypasses and can dismantle session exclusion
Status: Open
**Relevant code.**
[clean_command.go](../../../internal/app/clean_command.go):
`cleanSelectedSession` (line 70) and `cleanScopedTarget` (line 115);
[paths.go](../../../internal/artifacts/paths.go): `buildSessionPathsFromRoot`
(line 228);
[local.go](../../../internal/artifacts/local.go):
`AcquireSessionLockForContext` (line 204) and `acquireSessionLockForPaths`
(line 229);
[runner.go](../../../internal/app/runner.go): `withLockedInvocation`;
[restore_command.go](../../../internal/app/restore_command.go):
`restoreSessionState`.
**Circumstances.** A run, restore, or standalone preflight holds the session's
`.lock` while `session clean SESSION` or `session clean --all` executes in
another process. Cleaning validates the target and immediately calls recursive
removal without acquiring an execution lock. The lock file itself lies inside
the removed session tree.
A possible ordering is:
1. Invocation A holds the lock on the original `.lock` inode and starts work.
2. Cleaning removes its active inputs, outputs, manifest, diagnostics, and lock
pathname. Holding an advisory file lock does not prevent these removals.
3. Invocation B recreates the session layout and a new `.lock` inode, which it
can lock while A still holds the unlinked original inode.
4. A continues running or finalizing against pathnames that B now also owns.
**Consequences.** Active work can lose its files or recreate part of a supposedly
cleaned session. More seriously, two invocations can pass the local exclusion
boundary and overwrite each other's manifest/products. Cancellation and restore
recovery markers cannot repair a lock-identity split after the fact.
**Potential remediation.** Make destructive manual cleaning participate in the
same local coordination scheme as the other mutating operations. Keep the
coordination identity outside every tree that cleaning can delete, or retain
an equivalent stable admission gate while deleting/recreating session paths.
For `--all`, coordinate new session admission as well as already enumerated
sessions; checking existing lock files once leaves another creation race.
Choose wait-versus-busy-error behavior deliberately.
A stable workspace gate plus session locks can preserve unrelated-session
concurrency. A single exclusive workspace gate is simpler if serializing
different sessions is acceptable, but that would be a separate operational
tradeoff. Merely acquiring the current in-tree lock and then deleting it does
not solve the problem.
**Existing evidence and gap.** Lock contention, cancellation, process-death
recovery, and preflight-versus-final-cleanup exclusion have existing coverage.
The manual clean tests exercise deletion and path confinement without an active
lock holder. The final pipeline `cleanup` stage already runs under the session
lock and preserves its root/lock; this finding concerns the distinct manual
whole-session commands. It does not require defending against a privileged
external filesystem attacker.
## CN-02 — P2: Session initialization's no-overwrite check is not atomic
Status: Open
**Relevant code.**
[operator_helpers.go](../../../internal/app/operator_helpers.go):
`writeLocalFile` (line 27);
[session_init_command.go](../../../internal/app/session_init_command.go):
`initializeSession` (line 96), particularly local installation and the remote
`Exists`/`Upload` sequence;
[object_store.go](../../../internal/adapters/storage/object_store.go):
`UploadConditional` and `WriteCondition`;
[s3_backend.go](../../../internal/adapters/storage/s3_backend.go):
`UploadConditional` and `uploadReader`.
**Circumstances.** Two `session init` invocations target the same absent output
without `--force`. Locally, both can pass `os.Stat` before either performs
`os.WriteFile`. That write uses create/truncate behavior rather than exclusive
creation. Remotely, both can observe `Exists=false` before unconditional uploads
to the same key. A different ordinary writer creating the destination during
either interval has the same effect.
**Consequences.** Initialization can overwrite an output without the requested
force authorization, and both callers can report success. Local writes can
also truncate or mix content under an unlucky open/write ordering. Remote
initialization loses whichever independently authored session document was
uploaded first.
**Potential remediation.** Enforce absence at the write itself. For local
non-forced creation, use an exclusive create such as
`os.OpenFile(..., O_WRONLY|O_CREATE|O_EXCL, ...)`, with normal write/close error
handling. For remote non-forced creation, use the existing
`UploadConditional` boundary with `RequireAbsent=true` and translate a failed
condition into the existing already-exists/conflict outcome. The preliminary
existence lookup can remain an operator hint, but cannot authorize a later
unconditional write.
Keep deliberate forced replacement separate. This fix needs neither a
distributed lock nor a new crash/power-loss guarantee. Existing initialization
tests cover local/remote creation and configuration semantics, but do not race
two creators against the same target. Existing storage conditional-write tests
already protect the necessary provider-side mechanism.
## CN-03 — P2: The exceptional subprocess reap timeout releases ownership too early
Status: Open
**Relevant code.**
[execution.go](../../../internal/adapters/subprocess/execution.go):
`executeOwnedCommand` (line 32) and `terminateAndReap` (line 73);
[run.go](../../../internal/adapters/subprocess/run.go): `Run` (line 41);
[diagnostics.go](../../../internal/adapters/subprocess/diagnostics.go):
`diagnosticWriter.Write`, `Flush`, and `logWriters.Close`;
[result.go](../../../internal/adapters/subprocess/result.go):
`boundedResultWriter`;
[Scriptorium adapter](../../../internal/adapters/scriptorium/subprocess.go):
`RunArtifact` and `RenderArtifact`.
**Circumstances.** After cancellation or capture abort, graceful and forceful
wait timers expire before the wait channel yields a result. `terminateAndReap`
returns an error without receiving from `waitCh`. `executeOwnedCommand` then
reads `cmd.ProcessState`, and `Run` proceeds toward diagnostic flush/closure
and caller return, even though the goroutine running `cmd.Wait` may still be
active.
This is an exceptional path, for example when process reaping or output-copy
completion is delayed beyond the internal wait windows. It is not necessary
to assume that normal cancellation always reaches it. Go's `Cmd.Wait` sets
`ProcessState` and joins stream copying before returning. `WaitDelay` closes
pipes when its timer expires, but its implementation still waits for copying
goroutines; it cannot interrupt an arbitrary blocked destination `Write`.
Process-group disposal does not join the Go wait goroutine.
**Consequences.** There is no completion-channel synchronization for reading
`ProcessState` on this branch. A delayed wait can subsequently write that field.
Stream copy can also overlap final redactor flushing, whose per-stream pending
state relies on a single owner rather than a flush/write mutex. Callers can
close a stdout result file after `Run` returns while its copying goroutine
still owns a write to it. A blocked write can also stall final flushing or
leave the wait/copy goroutines alive. Returning an error does not by itself
make those shared resources safe to reuse or close.
**Potential remediation.** Keep one supervisor responsible for the command and
all associated I/O until completion is joined. Signal-escalation deadlines and
completion/ownership are different concerns: do not treat expiry of the former
as proof of the latter. Inspect `Cmd` state and flush/close writers only after
the wait result is received. Where bounded pipe teardown is necessary, own
and close the relevant pipes before joining their copying operations.
The simplest safe approach can retain bounded graceful/forceful escalation
while joining completion afterward. If returning before completion remains a
requirement, it needs an explicit ownership handoff that also protects
caller-owned output destinations; adding a mutex around `ProcessState` reads
or starting an unowned background reaper would not suffice. Scope shutdown
claims accurately for delayed kernel I/O rather than introducing an absolute
termination-time guarantee.
**Existing evidence and gap.** Tests exercise ordinary cancellation, timeout,
capture overflow, retained descendant streams, and descendant disposal after
leader exit. `TestTerminateAndReapPreservesWaitAndCleanupErrors` starts with an
already populated wait channel. Those tests passed, including repeated race
runs, but do not establish safe ownership after the final wait timer expires.
No dynamic race or permanent goroutine leak was reproduced in this pass.
## CN-04 — P2: S3 audio provenance can combine two object generations
Status: Open
**Relevant code.**
[prepare.go](../../../internal/stage/prepare.go):
`materializeS3AudioInputs` (line 423) and `listS3AudioObjects`;
[s3_audio.go](../../../internal/audio/s3_audio.go):
`MaterializeS3Audio` (line 35) and `downloadObjectAtomic`;
[download_writer.go](../../../internal/adapters/storage/download_writer.go):
`DownloadTo`;
[s3_backend.go](../../../internal/adapters/storage/s3_backend.go):
`Read` and `DownloadTo`.
**Circumstances.** Preparation lists object generation A with size N and ETag
A. Before downloading that key, an ordinary uploader replaces it with different
generation B of the same size. The download fetches the current body, B.
Materialization checks the expected size and hashes those bytes, while
preparation records size/ETag from the earlier listing, A.
The S3 `Read` operation already returns metadata correlated with its response
body. `S3Backend.DownloadTo` discards that metadata, and the audio result
returns a checksum without a downloaded generation. Nothing on this path
detects the mismatch before installing the file and recording its provenance.
**Consequences.** The manifest associates B's bytes/checksum with A's source
identity. A later listing of B normally causes a redundant download. A more
consequential sequence is a remote rollback to the original A: the recorded
ETag/size then match A again, while the local B bytes still match their recorded
checksum, so the prepared-copy reuse check can accept B for current source A.
This undermines the existing source-identity-plus-checksum reuse evidence.
**Potential remediation.** Preserve metadata from the same object read used to
stream the body. Compare its key/size/generation with the selected identity and
fail or reacquire on drift, or explicitly adopt that observed generation and
return it for the manifest record. Either approach must keep the recorded
identity and materialized bytes from one read together. The existing `Read`
boundary provides this information; a second independent listing after download
does not reliably bind the body to a generation.
This is a per-input provenance correction, not a requirement for a bucket-wide
or whole-session atomic snapshot. Preserve streaming, sibling-temp installation,
and the existing reuse checks. Restore's committed-object checksum/generation
verification is a separate additional check; this finding specifically follows
normal preparation's audio record construction.
**Existing evidence and gap.** Audio tests cover changed advertised generations,
corrupt or missing prepared copies, failed downloads, size mismatches, and
cancellation. They do not replace the remote object between listing and reading
or exercise the rollback/reuse sequence. This finding follows the concrete
metadata/body data flow; no live-storage interleaving was reproduced.
## Other Reviewed Behavior
- Speaker work is joined before the stage returns. Loop jobs are captured
separately, concurrency is bounded, and the first worker error cancels
sibling adapter contexts. Accepted completions serialize through one mutex
and save detached collections before updating live manifest authority.
- Analysis executes configured artifact work sequentially. It shares the
checkpoint mechanism with transcription without adding another concurrent
writer to the same invocation's manifest.
- HTTP body factories own independent handles for replay. Body/source locks,
the once-completed close channel, and cancellation callbacks avoid double
closing and release blocked reads in the existing tests. Shared HTTP client
settings are read-only during speaker work.
- Normal subprocess completion receives the wait result before final stream
handling. Buffered wait/abort channels avoid requiring a receiver at every
send, and only the supervisor calls `Cmd.Wait`. CN-03 concerns the exceptional
completion timeout, not that normal protocol.
- Run, restore, preflight, and final pipeline cleanup share a session lock.
Terminal manifest persistence narrowly detaches cancellation while holding
that lock; adapter work and ordinary checkpoints retain operation contexts.
- Remote lock creation/replacement uses provider preconditions. Publication's
final lock-check/pointer-write interval is an expressly documented limited
race window, not a newly discovered distributed-transaction defect. Read-only
inspection similarly does not promise a transactional local/remote snapshot.
- Test-fake request/object operations and shared schema initialization have
synchronization. Their mutable setup fields are configured before use;
this audit does not impose concurrent reconfiguration on those types.
## Review Outcome
Four findings warrant consideration. CN-01 is the highest-priority data-safety
gap; CN-02 and CN-04 concern check/use races across persistence boundaries.
CN-03 identifies unsafe ownership on an exceptional shutdown path despite
passing normal-path race tests. The current architecture does not need a
general concurrency framework to address them.
Prior findings remain in [01-correctness.md](01-correctness.md),
[02-efficiency.md](02-efficiency.md), and [03-complexity.md](03-complexity.md).
This pass does not duplicate them, implement remediations, or establish the
absence of other races, deadlocks, or leaks.
The documentation-link check and whitespace validation also passed. Only this
audit record was changed.

View File

@@ -0,0 +1,285 @@
# Resource Management Audit
Reviewed on 2026-11-30 against commit
`f0e45b60350f930e4de05d4d7c76ffc9ca350077`.
## Scope And Evidence
The review traced file descriptors, temporary files/directories, memory and
buffer retention, network bodies and transports, timers, cancellation callbacks,
goroutines, process supervision, and cleanup ownership. It followed their
lifecycles across application orchestration, stages, manifests, artifact
resolution, file operations, and HTTP/subprocess/object-storage adapters.
Codebase-memory-mcp supplied symbol discovery and caller tracing. Direct
source inspection and a non-test-source search supplemented incomplete indexing
of same-named Go methods. Acquisition sites were matched to normal, error, and
cancellation cleanup paths. Previous audit records were checked to avoid
duplicating their findings.
These existing checks passed with `GOTOOLCHAIN=go1.27.4`:
```sh
go test ./...
go test -count=1 ./internal/fileops ./internal/audio ./internal/adapters/storage ./internal/adapters/whisperx ./internal/adapters/subprocess ./internal/stage
go vet ./...
```
The focused run exercised existing body-close, cancellation, temporary-file,
failed-transfer, bounded-output, checkpoint, and publication tests. Those tests
support the baseline resource mechanisms; they do not reproduce every finding
below. No production code or tests were added or modified. No benchmarks,
heap profiles, descriptor-exhaustion experiments, disk-filling tests, live S3
requests, or paid-provider calls were performed. Native execution evidence is
from Linux.
## Current Resource Ownership
Narratio runs its fixed stages sequentially and bounds concurrent speaker
transcription. The invocation owns its session lock and composed collaborators;
stages own local attempts and product promotion; adapters own HTTP bodies,
subprocesses, and transfer mechanics. The manifest is the durable progress
ledger. Failed attempts and diagnostics are intentionally retained under
`runs/` until authorized cleanup, while subprocess applications own their
separate state and caches.
| Resource | Implemented lifecycle |
| --- | --- |
| Session locks | A held file descriptor owns the OS lock. Run, preflight, and restore defer release through terminal persistence. |
| Speaker workers | A bounded `errgroup` joins workers before stage return. Checkpoint updates are serialized and retain the selected complete-collection behavior. |
| HTTP uploads/responses | Multipart attempts and replays own independent audio handles. Cancellation closes sources; the attempt closes all tracked bodies and its response body. |
| Subprocesses and logs | The shared supervisor owns process groups and a wait goroutine. Normal completion joins stream copying before final flushing/closure. Diagnostic streams and result stdout have explicit per-invocation limits. |
| Ordinary file replacement | Sibling temporary files are closed and either renamed or removed on handled errors. Canonical promotion follows validation. |
| Remote control objects | Bounded readers enforce byte limits during transfer, close bodies on every exit, and retain only control-document-sized payloads. |
| Remote products/audio | Transfers stream into temporary files, with validation before installation. RS-02 concerns the missing transfer-time enforcement of already-known sizes. |
| Publication sources | Sources are opened and retained through publication. RS-01 concerns how this scales with the complete source inventory. |
| Configuration and schemas | ConfigKit owns resolution. Configuration acquisition owns downloaded session-file cleanup; compiled bundled schemas are retained once for reuse. |
## RS-01 — P2: Publication retains one open descriptor per source
Status: Open
**Relevant code.**
[publish.go](../../../internal/stage/publish.go): `publishStage.Run`;
[publish_sources.go](../../../internal/stage/publish_sources.go):
`openPublishRunFiles` (line 249), `openPublishSourceUnderRoot`, and
`closePublishSources`;
[publish_transfer.go](../../../internal/stage/publish_transfer.go):
`buildPublishTransferPlan` (line 24), `uploadPublishTransfers` (line 151), and
`closePublishTransfers` (line 309).
**Circumstances.** Publication first opens every declared current-run archive
file and retains those descriptors. It then opens every previous-cache source,
opens each selected local publication output, and adds the committed manifest.
All remain open until the stage's deferred cleanup. Uploading is sequential;
completed transfers do not release their source descriptors as they finish.
For R run files, P previous-cache files, and O newly published outputs, the
retained source-descriptor count is R+P+O+1, plus locks, network connections,
diagnostic handles, and temporary directory traversal handles. A product can
also be opened separately for its run archive and publication destination.
Artifact families, per-artifact logs/configuration, speaker outputs, and
previous-session products all contribute to this count.
**Consequences.** A sufficiently large valid inventory can exhaust the
process's descriptor limit before uploading begins, even though the transfer
algorithm needs only one active upload. Publication then fails with an
open-file error and retrying the same inventory has the same pressure.
Successful/error defers generally close the descriptors afterward: this is
over-retention and capacity scaling, not a demonstrated permanent normal-path
descriptor leak.
The audit host's soft descriptor limit was 1,048,576; this review did not attempt
to exhaust it. That limit is an environment setting, not a Narratio guarantee.
The source-count dependency remains relevant to deployments with lower limits;
no universal failure threshold is asserted.
**Potential remediation.** Separate the complete immutable destination mapping
from possession of all its source handles. Use a bounded source-opening window
and close a source after its verified transfer/reuse check, preserving confined
opening, checksum validation, and hashing/uploading through the same descriptor.
Keep the current-pointer write after every declared object has been accepted.
An upfront validation pass can remain bounded as well. Review the documented
upfront source-rejection behavior when designing that pass; merely replacing
verified descriptors with unchecked pathname uploads would discard an existing
safety boundary. If pinning every original inode for the entire attempt is a
deliberate requirement, disk-backed verified snapshots offer a bounded-FD
alternative with an explicit disk/I/O tradeoff. Raising the descriptor limit
is an operational mitigation, not removal of the scaling dependency. Avoid
imposing a new artifact-count restriction as the default fix.
**Existing evidence and gap.** Publication tests cover declared-source
confinement/replacement rejection, immutable mapping, upload failure, and pointer
ordering. Their small inventories do not establish behavior near a low
descriptor limit. Retain those safety checks when changing handle lifetime.
## RS-02 — P2: Known-size downloads consume the full response before rejecting oversize
Status: Open
**Relevant code.**
[restore_execute.go](../../../internal/app/restore_execute.go):
`executeRestoreDownloadAction` (line 97), `downloadRestoreTemp`, and
`verifyRestoredObject` (line 282);
[prepare_previous.go](../../../internal/stage/prepare_previous.go):
`hydratePreviousSessionArtifacts` (line 35), `writePreviousTemp`, and
`validatePreviousTemp`;
[s3_audio.go](../../../internal/audio/s3_audio.go):
`downloadObjectAtomic` (line 95) and `validateLocalAudio`;
[publish_transfer.go](../../../internal/stage/publish_transfer.go):
`verifyExistingImmutableObject` (line 219);
[temp_download.go](../../../internal/adapters/storage/temp_download.go) and
[s3_backend.go](../../../internal/adapters/storage/s3_backend.go): streaming
download implementations.
**Circumstances.** These callers know an expected object size from a committed
declaration, selected source identity, or already-hashed local upload source.
They nevertheless stream the entire remote body into a temporary file and check
size only after the download completes. The underlying `DownloadTo`/`Download`
paths copy to EOF without a caller-supplied byte boundary.
Examples include restoring a small committed artifact whose remote key was
accidentally replaced with a much larger object, or downloading audio after its
listed object was replaced. The content will eventually be rejected when its
declared size/checksum disagrees, but every returned byte has already consumed
staging space. A faulty or unexpectedly long response can consume far more
space than the already-selected object identity permits.
**Consequences.** An invalid transfer can fill the workspace or system temporary
volume, interfere with other operations, and hold the session lock for a large
unnecessary download. Handled failures generally remove the temporary file and
preserve the canonical destination; that cleanup does not prevent temporary
exhaustion or the effects on other writers before removal.
**Potential remediation.** Enforce the existing expected size while streaming.
For a known-size object, inspect metadata from the opened response and perform
a bounded size-plus-one read/copy so the caller can distinguish exact content
from oversize and stop promptly. Close the body and remove partial staging on
failure. A larger `Content-Length` can reject early, but the actual byte count
must remain authoritative. Retain checksum/generation validation and canonical
installation ordering.
This does not require buffering artifact bodies or using the small-control-
object helper for large payloads. Preserve the current meaning of unknown-size
audio; a universal audio cap would be a separate policy choice. For committed
objects, a declared zero-byte size is known, rather than an unknown-size signal.
Errors should identify the responsible transfer boundary and expected byte
count. The observed-size metadata work in CN-04 is a related acquisition seam,
but provenance correctness and transfer-space enforcement are distinct concerns.
Stopping at a size already required by validation adds no new user-data limit.
Aggregate workload size and intentionally retained outputs still require the
existing [capacity guidance](../../operations.md#local-state-layout) and
[retention policy](../../operations.md#cleanup). This finding does not promise
to prevent every disk-full condition or reserve disk space.
**Existing evidence and gap.** Tests establish that short/wrong-size downloads
fail and preserve destinations, and that failed temporary downloads are removed.
The bounded control-object tests demonstrate early metadata rejection and
limit-plus-one enforcement. The large-payload callers above do not use an
equivalent transfer boundary, and existing tests do not establish that an
oversized body is stopped before it is fully staged.
## RS-03 — P3: Publication's temporary manifest has cleanup gaps before ownership transfer
Status: Open
**Relevant code.**
[publish_commit.go](../../../internal/stage/publish_commit.go):
`writeCommittedSessionManifest` (line 99);
[publish.go](../../../internal/stage/publish.go): the helper call followed by
`appendCommittedSessionManifest`;
[publish_transfer.go](../../../internal/stage/publish_transfer.go):
`appendCommittedSessionManifest` (line 117) and `closePublishTransfers`.
**Circumstances.** The writer creates a file in the system temporary directory.
If writing or closing fails, it returns an empty pathname without removing the
file. The descriptor is closed or a close is attempted, but the created path
remains. On successful writing, a later `os.Open` in
`appendCommittedSessionManifest` can fail before adding the path to the
transfer collection. The caller has no separate removal defer for that gap.
Descriptor exhaustion from RS-01 is one possible cause of this second failure.
**Consequences.** Failed publication can leave partial or complete
`narratio-committed-session-manifest-*.json` files outside the session's `runs/`
tree. Repeated disk-pressure, permission, or open-file failures can accumulate
untracked temporary files. Session cleanup does not own this system-temp
location. These are disposable publication intermediates, not intentionally
retained attempt diagnostics.
**Potential remediation.** Give the creator cleanup responsibility immediately
after creation, retaining that responsibility on every error. On successful
return, make the caller responsible for removal until the transfer plan
explicitly accepts ownership. Normal transfer cleanup can then remain the
successful-path owner. Straightforward deferred removal with a clear handoff
is sufficient; no general temporary-resource framework is needed.
**Existing evidence and gap.** Normal publication puts `TemporaryPath` on the
transfer and `closePublishTransfers` closes/removes it. This finding concerns
the earlier error paths, not a successful-publication leak. Existing tests do
not inject temp-manifest write/close or ownership-handoff open failures.
## Previously Recorded Resource Findings
- **EF-01**, in [02-efficiency.md](02-efficiency.md), already records local
recording copies buffered through `os.ReadFile`. One large speaker recording
can require recording-sized RAM even though the repository has a streaming
copy primitive. It remains the clearest existing memory-pressure finding.
- **CN-03**, in [04-concurrency.md](04-concurrency.md), already records the
exceptional subprocess reap-timeout ownership gap. Its effects include live
wait/copy goroutines and premature writer cleanup. It remains relevant to
resource release after cancellation and is not duplicated here.
- **EF-05** records nested inspection-error aggregation whose formatting can
allocate quadratically. That finding also remains relevant without becoming
a new memory-retention issue in this pass.
## Other Reviewed Lifecycles And Deliberately Retained Behavior
- Ordinary file/root handles have local closes or explicit ownership returns.
Restore planning closes inspected files and traversed roots; installation
processes temporary objects sequentially. Shared file-replacement helpers
remove sibling temporary files on handled pre-rename failures.
- Downloaded remote session configuration normally transfers its removal
callback to invocation-owned configuration acquisition. Error and
cancellation paths invoke cleanup; successful command finalization closes
that acquisition. Audita's synthetic preflight directory has a local removal
defer.
- WhisperX response bodies, original upload bodies, and replay bodies have
cleanup paths. Per-attempt timeout contexts are canceled after use, and
retry/lock-wait/supervisor timers are stopped where appropriate. Multipart
cancellation callbacks are unregistered or complete through source closure.
No additional normal-path goroutine/timer leak was established.
- HTTP transport pooling and shared compiled schemas have useful reuse
lifetimes. The current CLI does not establish a further unbounded connection
or schema-retention defect merely because those resources remain reusable.
SDK/library-owned pools are not reimplemented in Narratio.
- Diagnostic redaction/tails and adapter result buffers are individually
bounded. Scriptorium requirement inspection uses a bounded stdout writer
despite retaining its JSON in memory. Notarius lanes are validated/staged
one at a time rather than retaining every lane's bytes together.
- Manifests keep current stage/collection state rather than an append-only
invocation history. Whole-collection checkpoint copying and serialization
have a cost, but are deliberately selected behavior rather than a new leak.
- Original tool bundles, failed runs, debug files, reference snapshots, and
subprocess-owned state/caches follow their selected retention/ownership
rules. This audit does not introduce automatic pruning or reinterpret retained
diagnostics as leaked temporary files. Ordinary aggregate disk use remains
an operator capacity/quota responsibility.
## Review Outcome
Three new findings warrant consideration: descriptor capacity during
publication, late oversize rejection during known-size transfers, and an
error-path temporary-file ownership gap. They arise within helpers and across
stage/adapter boundaries. The earlier audio-copy memory and subprocess
lifetime findings should also be included when prioritizing remediation.
No additional ordinary correctness defect was established independently of
these resource findings. The review does not establish absence of other leaks
or exhaustion conditions. The expected direction is shorter resource lifetimes,
streaming, and explicit ownership, rather than new global limits or a generic
resource-management framework.
The documentation-link check and whitespace validation also passed. Only this
audit record was changed.

View File

@@ -0,0 +1,200 @@
# Error-Handling Audit
Reviewed: 2026-11-30
Baseline: `7a9bbbde9f850debc87e17e6d305c755b6b53fd8`
## Scope And Evidence
This review examined failure detection, propagation, reporting, cancellation,
timeouts, and recovery across configuration acquisition, CLI outcomes,
preflight, pipeline execution, speaker/artifact checkpoints, subprocess and
HTTP adapters, local persistence, remote publication, restore, and cleanup.
The knowledge graph located implementations and call relationships. Direct
source inspection supplemented its incomplete indexing of same-named Go
receiver methods. Findings were checked against the architecture, CLI,
configuration, manifest, artifact, stage, storage, and operator documentation
and relevant existing failure tests.
Verification used Go 1.27.4:
- `go test ./...` passed; this run used cached package results.
- Fresh `go test -count=1` runs passed for `internal/app`, `internal/stage`,
`internal/preflight`, `internal/adapters/whisperx`,
`internal/adapters/subprocess`, `internal/adapters/storage`,
`internal/manifest`, `internal/fileops`, and `internal/artifacts`.
- `go vet ./...` passed.
- `go test -count=1 ./internal/doccheck` passed after writing this report.
- A temporary CLI binary reproduced EH-01 using maintained examples and two
small configuration fixtures outside the repository. These commands performed
planning and configuration validation; they invoked no providers or pipeline
stages.
No production code or tests were changed. This was an offline implementation
review, not live infrastructure, disk-failure, or kernel-stall fault injection.
Existing tests and successful checks establish the paths they exercise; they
do not prove that every exceptional condition is covered.
## Current Failure-Handling Architecture
- CommandKit owns CLI execution and reporting; ckconfig adapts native ConfigKit
diagnostics. Narratio adds domain-input classification and preserves mixed
operational failures through wrapped and joined errors.
- The application runner holds a session lock, persists stage transitions,
stops on failure, and attempts terminal manifest persistence with cancellation
detached from that final local save. Persistence and lock-release errors are
returned alongside the originating failure.
- Transcription joins bounded concurrent speaker workers. Transcription and
analysis checkpoint typed progress collections through the shared manifest
persistence helper. Failed checkpoint saves retain prior durable authority.
- Adapters own external transport and process failures. WhisperX uses
replayable streaming request bodies, per-attempt timeouts, selected retries,
and cancellable retry delays. The subprocess runner owns process-tree
termination, bounded output capture, credential redaction, and diagnostics.
- Stages validate run-local products before canonical promotion. Resume uses
manifest evidence and content identities; missing or changed evidence can
request regeneration without certifying incidental files as completed work.
- Publication selects a remote snapshot only after immutable transfers and
commit creation. Restore verifies selected objects, installs the manifest
last, and retains an incomplete-restore marker after installation failure.
Cleanup is a separate, explicitly enabled stage.
## EH-01 — P3: Domain configuration failures lose the CLI input classification
Status: Open
**Relevant code.**
- [Resolved validation](../../../internal/config/validate.go), `Validate`
(lines 41–45), returns product-destination and cross-document validation
failures without a typed input-error marker.
- [Cross-document validation](../../../internal/config/validate_core.go),
`validateCrossConfig` (lines 109–123), rejects incompatible storage/audio
selections using ordinary errors.
- [Product destination validation](../../../internal/config/product_destinations.go),
`validateProductDestinations` (lines 29–33), returns ordinary errors for
invalid placement or colliding configured destinations.
- [CLI classification](../../../internal/app/command_outcome.go),
`classifyOperationError` (lines 31–56), recognizes Narratio request errors,
artifact-catalog input errors, and native ConfigKit diagnostics. These
unmarked domain errors fall through to ckconfig's operational classification.
- [Execution entry point](../../../internal/app/execution_command.go),
`executeSelectedPipeline`, returns `config.Validate` failures unchanged.
Planning, preflight, status, restore, and lock commands also consume resolved
domain validation.
**Failure condition.** Individually loadable documents form an invalid resolved
configuration, or a completed configuration selects colliding product paths.
The failure is an identified configuration mistake, rather than a missing file,
network failure, cancellation, or ambiguous loading callback failure.
**Expected behavior.** The existing [CLI exit-status contract](../../cli.md#cancellation-and-exit-status)
assigns status `2` to identifiable invalid configuration input. These domain
rejections should retain that classification and their explanatory cause.
Unrelated operational, cleanup, and cancellation causes must retain precedence
when joined with them.
**Actual behavior and reproduction.** A CLI built from the baseline produced:
1. With the maintained minimal pipeline, sample campaign, and S3-audio session:
```sh
narratio session plan 2026-05-03 \
--config examples/pipeline.minimal.yml \
--campaign-file examples/campaigns/sample-campaign/campaign.yml \
--session-file examples/session.s3-audio.yml
```
It reported that `pipeline.storage.backend must be s3 when
session.inputs.audio_s3 is configured`, but exited with status `1`.
The same command using `examples/session.local-audio.yml` succeeded with
status `0`.
2. A temporary pipeline containing the required valid WhisperX URL and
`normalize.output_path: transcripts/base.json`, combined with the sample
campaign and local-audio session, was rejected because the base and final
transcripts share a destination. It also exited with status `1`.
3. As a control, a temporary pipeline with an invalid WhisperX URL was rejected
by native ConfigKit validation and exited with status `2`.
The error messages are useful and the commands stop before execution. The
defect is inconsistent failure classification, not acceptance of invalid
configuration or observed data corruption. Automation cannot consistently
distinguish configuration corrections from operational failures using the
documented statuses.
**Potential remediation.** Give positively identified domain-validation failures
a small typed configuration-input error that preserves its cause, and recognize
it at the existing CLI classification boundary. Apply it where these semantic
checks reject supplied values, following the existing artifact-catalog input
error pattern. Preserve the current wrapped/joined-error operational precedence.
Path-resolution or other environmental failures remain operational.
An alternative is to adapt these domain checks into native ConfigKit validation
diagnostics at a suitable completed-configuration boundary. That requires more
coordination because the checks span separately loaded documents; it should
preserve ConfigKit's configuration-resolution ownership. A narrow domain error
is the simpler local approach. Neither approach requires new validation rules or
reclassifying every error returned by configuration code as an input mistake.
**Verification when addressed.** Retain behavioral CLI checks for a cross-document
storage conflict and a destination collision returning status `2`, a valid
combination succeeding, and input errors joined with cancellation or operational
failures returning status `1` with both causes preserved. Existing native
configuration and artifact-catalog classification tests cover the neighboring
cases, not these two rejections.
## Related Findings Already Recorded
These failure-path issues remain relevant and retain their existing owners:
- [FC-02](01-correctness.md#fc-02--p2-carried-publication-bytes-conflict-with-restored-manifest-evidence):
restore can report success while installed carried products disagree with
restored completion evidence.
- [FC-03](01-correctness.md#fc-03--p2-session-planning-reports-reusable-s3-preparation-as-changed):
planning converts its missing S3 inspection collaborator into a definite
changed-input result rather than representing the inspection limitation.
- [CN-03](04-concurrency.md#cn-03--p2-the-exceptional-subprocess-reap-timeout-releases-ownership-too-early):
an exceptional reap timeout returns while process waiting and stream copying
may still own resources that callers subsequently close.
- [RS-02](05-resources.md#rs-02--p2-known-size-downloads-consume-the-full-response-before-rejecting-oversize):
some downloads detect an oversized object only after consuming the body.
- [RS-03](05-resources.md#rs-03--p3-publications-temporary-manifest-has-cleanup-gaps-before-ownership-transfer):
publication can orphan a temporary manifest on write, close, or
ownership-handoff failure.
These are cross-references, not additional findings from this pass.
## Deliberate Behavior And Review Outcome
The following choices were not treated as defects:
- Console-reporting methods intentionally leave delivery-error retention to
CommandKit so broken output does not interrupt checkpoint persistence.
Delivery failure can still fail the invocation after durable work completes.
- Secondary Audita report discovery is best-effort after a primary process or
output-validation failure. The primary error and diagnostic locations remain
available.
- Read-handle close errors and best-effort temporary cleanup are not uniformly
required to override an already useful failure. RS-03 concerns a specific
missing ownership cleanup, rather than every ignored cleanup error.
- Preparation explicitly treats changed or unavailable resume evidence as a
normal rerun. This audit does not introduce a general requirement that every
failed evidence check preserve prior success. FC-03 covers the distinct
planning/execution discrepancy.
- Optional source absence and explicitly non-current artifact evidence can be
represented as unavailable under their existing contracts. This does not
establish a general license to suppress unrelated transport or persistence
errors.
- Partial canonical promotion and restore do not promise rollback of every
completed write. Durable manifest authority, output verification, and the
restore recovery marker govern subsequent recovery.
- Abrupt process death, power-loss durability, automatic retry of every failure,
and atomic rollback across multiple products are outside the selected
guarantees.
One new P3 finding was confirmed. The reviewed ordinary failure, retry,
checkpoint, cancellation, and terminal-reporting paths otherwise preserve the
selected behavior, subject to the separately recorded findings above.

View File

@@ -0,0 +1,334 @@
# Test Coverage And Effectiveness Audit
Reviewed: 2026-11-30
Baseline: `8f7d2ab1811314f0ae0af9feb4bdc67d2b27ff5a`
## Scope, Policy, And Evidence
This audit evaluated both missing behavioral protection and candidates for
removal or simplification against the [testing policy](../../policy/testing.md).
The review covered CLI classification, configuration, stage transitions,
speaker/artifact checkpoints, adapters, publication/restore, concurrency,
destructive operations, and shared file/manifest helpers. Existing contract and
implementation documents supplied the requirements; coverage percentages did
not create additional requirements.
The knowledge graph located tests and collaborators. Source inspection
supplemented its incomplete indexing of same-named receiver methods. The review
examined assertions and fixture behavior as well as executed statements.
Verification used Go 1.27.4 on Linux:
- `go test -count=1 -covermode=atomic -coverpkg=./... -coverprofile=<temporary-file> ./...`
passed. `go tool cover -func=<temporary-file>` reported **83.9%** total
statement coverage. Cross-package instrumentation includes coverage supplied
by consumers, rather than treating each package's own tests as its only
protection.
- `go test -race -shuffle=on -count=3 ./...` passed.
- `go test -count=1 ./internal/doccheck` passed after writing the report.
- Two temporary S3 adapter mutations were evaluated with Go's `-overlay`
option. Replacing the upload body with fixed incorrect bytes survived the
full existing suite. Changing the provider request key failed the existing
upload test, establishing that the overlay was effective.
- A temporary metadata struct-field reorder failed the existing JSON test
while retaining the same JSON object members and values.
Coverage profiles, overlay files, and mutated source copies were outside the
repository. No application code or tests were changed. The mutation checks were
targeted experiments, not an exhaustive mutation score. No paid services, live
object storage, or optional external-binary compatibility checks were used.
## Architecture And Existing Strengths
Narratio is a fixed-stage Go orchestrator. CommandKit owns CLI execution and
reporting; ConfigKit owns configuration resolution. Narratio derives and
validates its domain configuration, then runs stages under a session lock.
Stages use adapter interfaces for WhisperX, Seriatim, Audita, Notarius,
Scriptorium, and object storage. Shared manifest persistence records stage and
sub-stage progress. Publication selects an immutable remote snapshot through a
current pointer; restore verifies that snapshot and installs manifest authority
last. Cleanup is a separate stage and a separate whole-session command.
The suite generally follows the policy's classical style: real local files and
manifest stores, HTTP test servers, subprocess helper executables, and fakes at
external boundaries. Particularly useful protection includes:
- durable speaker/artifact progress after adapter and checkpoint failures;
- retry reuse and preservation of unrelated completed work;
- cancellation propagation, request-body replay, process-tree cleanup, and
credential redaction across subprocess integrations;
- bounded-read boundary cases and atomic replacement preserving old content;
- immutable publication ordering, conditional remote locks, and interrupted
restore recovery;
- configuration provenance, secret-safe projections, maintained examples,
native structured CLI reports, and output-delivery failures.
These tests should be retained. The findings below concern specific missing
conditions or avoidable coupling, not a proposal to replace the suite.
## TE-01 — P2: S3 upload tests do not verify the transmitted content
Status: Open
**Functionality and tests.**
[S3 backend](../../../internal/adapters/storage/s3_backend.go), `uploadReader`;
[S3 tests](../../../internal/adapters/storage/s3_backend_test.go),
`fakeS3API.PutObject` (lines 111–119), `TestS3BackendUploadAndExists`, and
`TestS3BackendConditionalUploadUsesProviderPrecondition`.
**Deficiency.** The fake records `PutObjectInput` and returns an ETag without
consuming its body. Assertions inspect keys, returned metadata, and
preconditions, but never compare the supplied stream with the expected bytes.
Higher-level publication tests use the separate `storage.FakeBackend`, so they
also bypass this production adapter mapping.
**Evidence and unprotected failure.** A temporary overlay changed the production
request from `Body: source` to a reader containing a fixed incorrect string.
`go test -count=1 -overlay=<overlay> ./...` still passed. A separate wrong-key
overlay failed `TestS3BackendUploadAndExists` as expected. Thus the suite can
accept an adapter that uploads unrelated content despite exercising the upload
function. This is a test gap; the unmodified adapter currently passes the
correct source reader.
**Improvement.** Have the narrow SDK fake consume and retain request bytes during
`PutObject`, then compare them with the caller's payload for file-backed and
reader/conditional uploads. Include propagation of a simulated stream-read
failure where warranted. A small HTTP test server exercising the real SDK is
also viable if it adds useful transport confidence. Live S3 is unnecessary.
Retain the current key and precondition checks; they detected the control
mutation.
## TE-02 — P2: Publication and restore tests do not prove carried-output authority is coherent
Status: Open
**Functionality and tests.**
[Publication tests](../../../internal/stage/publish_test.go),
`TestPublishCarriesLockedRequiredOutputAndCommits` (line 726);
[restore commit tests](../../../internal/app/restore_commit_test.go),
`TestCommittedRestoreDownloadsCarriedOutputFromDeclaredRun` (line 129) and
`seedCommittedRestoreSnapshot` (line 442);
[restore workflow tests](../../../internal/app/restore_workflow_test.go).
**Deficiency.** Publication assertions prove that a lock carries the old object
declaration and avoids uploading a replacement. Restore assertions prove that
the exact carried object is downloaded. They do not follow a real publication
through restoration and resolve the resulting artifact against its restored
stage/per-artifact evidence. The general restore fixture uses a synthetic
`fixture` stage rather than authentic producer/checkpoint state. One previous-
cache workflow repairs manifest evidence after restoration before testing the
consumer, so that test proves the consumer's behavior after repair.
**Unprotected behavior.** Publish A, lock it, generate local B, republish while
carrying A, and restore into an empty workspace. The restored bytes and
completion authority must agree. [FC-02](01-correctness.md) establishes that
current code can return successful restoration with A's bytes and B's evidence;
the existing green tests do not detect that interaction.
**Improvement.** Add one focused cross-package round trip using the real publish,
remote-state discovery, restore, and artifact resolver with an in-memory object
store. Inspect restored bytes, checksums/provenance, and appropriate reuse or
rebuild decisions without repairing the restored manifest in the test. Include
the distinct built-in and configured-artifact authority paths when fixing
FC-02. Keep narrow transfer tests for their separate risks; every restore test
does not need a full pipeline fixture.
## TE-03 — P2: Previous-session hydration coverage stops short of dependency closure
Status: Open
**Functionality and tests.**
[Effective-set tests](../../../internal/artifacts/effective_set_test.go),
`TestCollectPreviousArtifactRequirementsUsesExactEffectiveSet`;
[prepare selection test](../../../internal/stage/prepare_effective_artifacts_test.go),
`TestCollectPreparePreviousRequirementsUsesExplicitDisabledArtifact`;
[hydration tests](../../../internal/stage/prepare_previous_test.go);
[incremental analysis tests](../../../internal/stage/analyze_incremental_execution_test.go),
`TestAnalyzeRebuildsNestedStalePrerequisitesInDependencyOrder`.
**Deficiency.** Requirement-collection tests select a disabled artifact directly.
Analysis tests independently verify rebuilding disabled prerequisites. Hydration
tests pass an already constructed requirements list. These fixtures omit the
combination in which an enabled or explicitly selected child requires a disabled
prerequisite that itself consumes previous-session input.
**Unprotected behavior.** Preparation must hydrate history needed by actual
prerequisite work while excluding unrelated disabled artifacts. Required
history must reach the downstream request; optional history must not disappear
solely because its consumer was scheduled as a prerequisite. The missing
combination allowed [FC-01](01-correctness.md).
**Improvement.** Exercise preparation followed by analysis for a selected child,
a disabled prerequisite with a previous-session binding, and an unrelated
disabled artifact. Use real selection/hydration/planning and fake external
storage/generation. Assert the hydrated source identity and downstream binding,
as well as exclusion of unrelated work. A small required/optional table can
protect the different observable failure modes. Do not broaden the meaning of
explicit publication targets merely to make this test pass.
## TE-04 — P2: Whole-session cleanup tests never contend with an active invocation
Status: Open
**Functionality and tests.**
[Manual cleanup](../../../internal/app/clean_command.go);
[cleanup command tests](../../../internal/app/clean_test.go) and
[selection tests](../../../internal/app/clean_command_test.go);
[local lock tests](../../../internal/artifacts/local_test.go);
[restore locking tests](../../../internal/app/restore_recovery_test.go),
`TestRestoreHoldsTransitionLockBeforePlanning`.
**Deficiency.** Manual cleanup tests verify scope, preserved storage, missing
targets, dry-run behavior, and unsafe destinations with no lock holder. Separate
tests prove that the lock implementation and restore coordinate with runners.
No test combines `session clean` or `--all` with an active runner, restore, or
preflight. Final-stage cleanup tests exercise a different, already locked path.
**Unprotected behavior.** Deletion must not dismantle an active session's
single-writer exclusion or let a second invocation acquire a new lock inode
while the first still writes. [CN-01](04-concurrency.md) records the current
production defect. A passing race detector cannot establish this filesystem
coordination property.
**Improvement.** Use real temporary workspaces and OS locks, with channels
holding an invocation at a known active point. Exercise session-scoped and
whole-workspace deletion and a second contender. Assert no deletion during
active ownership and no overlapping writers. Encode wait-versus-busy behavior
after that remediation decision is selected; the test should not invent it.
Include whole-workspace admission behavior in the `--all` case rather than
assuming a single existing session lock covers new invocations.
## TE-05 — P2: Subprocess lifecycle tests do not exercise a delayed reap after escalation
Status: Open
**Functionality and tests.**
[Owned execution](../../../internal/adapters/subprocess/execution.go),
`terminateAndReap` (lines 73–92);
[execution unit test](../../../internal/adapters/subprocess/execution_test.go),
`TestTerminateAndReapPreservesWaitAndCleanupErrors`;
[process-tree tests](../../../internal/adapters/subprocess/process_tree_supported_test.go).
**Deficiency.** The unit test preloads the wait channel, so it always takes the
early completion path. Real-process cancellation, timeout, capture-limit, and
descendant-disposal tests cover useful ordinary behavior, but none withholds
wait completion beyond escalation. Coverage reports `terminateAndReap` at
45.5%; its post-grace escalation and final forceful-wait outcomes are unexecuted
in this run.
**Unprotected behavior.** A delayed waiter or stream copier must retain ownership
until the relevant cleanup boundary is safe. Otherwise caller cleanup can race
with still-running work. [CN-03](04-concurrency.md) identifies that exceptional
path in the production implementation. Ordinary process tests and a successful
race run do not exercise it.
**Improvement.** When addressing CN-03, use a controlled process-tree/waiter
boundary that completes only after escalation and observes when output
resources are released. Assert the ownership/join relationship and preservation
of wait/cleanup causes. Reuse the existing real-process tests for normal OS
behavior. Avoid requiring an actual unkillable process, freezing private delay
constants, or adding a new absolute kernel-I/O completion guarantee.
## TE-06 — P3: CLI classification tests omit real resolved-domain rejections
Status: Open
**Functionality and tests.**
[Outcome tests](../../../internal/app/commands_boundary_test.go),
`TestOperationOutcomePreservesCausesAndOperationalPrecedence`;
[catalog command tests](../../../internal/app/config_artifacts_test.go),
`TestNativeCatalogValidationErrorsAreUsage`;
[configuration validation tests](../../../internal/config/storage_publish_test.go).
**Deficiency.** Tests cover native loader errors, explicit request markers,
artifact-catalog markers, and joined operational causes. Configuration tests
check that conflicting storage selections fail, but do not carry that actual
failure through a command and assert its exit classification. Destination
validation likewise lacks that CLI assertion.
**Unprotected behavior.** Identified domain configuration mistakes should produce
status `2` under the [CLI contract](../../cli.md#cancellation-and-exit-status).
[EH-01](06-error-handling.md) reproduced status `1` for both a storage/audio
conflict and a product-path collision while the current suite passed.
**Improvement.** Add a small real-command table covering those two rejections,
their valid counterparts, and operational precedence where causes are joined.
Assert status and cause/classification rather than complete error prose. Keep
missing/unreadable sources and environmental failures operational; do not
reclassify every configuration-package error as invalid input.
## TE-07 — P3: Some assertions freeze incidental serialization or validation order
Status: Open
**Relevant tests.**
- [Metadata serialization](../../../internal/artifactmodel/metadata_test.go),
`TestArtifactMetadataJSON` (lines 32–34), compares the entire JSON byte string,
including object-member order.
- [Native campaign validation](../../../internal/config/native_results_test.go),
`TestNativeCampaignResultValidatesConfigurationWithoutReadingResources`
(lines 106–114), supplies a campaign missing multiple required application
fields and requires the first diagnostic to identify `speakers_file`.
**Deficiency and evidence.** A temporary overlay swapping only the declaration
order of `ContractMetadata.SchemaID` and `MediaType` failed the metadata test.
The JSON object still had identical members and values. The asserted byte order
is not the data-shape contract. Likewise, reordering otherwise valid campaign
checks would fail the diagnostic assertion even though the same invalid input
is rejected. These assertions make correct internal changes unnecessarily
expensive under the testing policy.
**Improvement/removal scope.** Replace the complete byte snapshot with structural
JSON assertions for the public member names, values, and omission behavior.
Give the campaign test one intended invalid condition or locate the relevant
diagnostic without prescribing its position. Retain the meaningful
serialization, native-error, and path-context checks; the whole tests need not
be deleted. This recommendation does not apply to deliberately canonical byte
formats used by fingerprints or remote commit contracts.
## TE-08 — P3: Two normalized-transcript tests are exact duplicates
Status: Open
**Relevant tests.** In
[analysis tests](../../../internal/stage/analyze_test.go):
- `TestAnalyzeSupportsCanonicalNormalizedTranscriptSourceFromManifestOutput`
(lines 1279–1305);
- `TestAnalyzeSupportsNormalizedTranscriptSourceFromManifestOutput`
(lines 1307–1333).
**Deficiency.** Their bodies are identical. Both create the same incidental
`final.json`, declare the same alternate manifest-backed file, bind the same
`narratio.transcript.final` source, run the same stage, and assert the same
request path. Their different names do not exercise separate formats or
contracts. The second execution adds no distinct protection.
**Improvement/removal scope.** Remove one copy and retain the manifest-authority
test. Keep neighboring missing-input and other source-kind cases, which protect
different behavior. If future cases differ only in source kind, a small table
can consolidate shared setup while preserving the distinct assertions.
## Proportionate Follow-Up
TE-01 provides a direct, low-cost opportunity to strengthen an external adapter
boundary. TE-02 through TE-06 should accompany their associated remediation
work; the earlier audit records remain the owners of the production defects.
TE-07 and TE-08 reduce test maintenance without weakening selected contracts.
Other earlier findings, including concurrent session initialization, same-size
S3 object replacement, and oversized download handling, also identify useful
regression conditions when their implementations are corrected. Their existing
audit records describe those conditions; this report does not duplicate each
one as another testing finding.
No blanket coverage threshold, exhaustive fault matrix, generic mock framework,
mandatory live service test, or native macOS CI gate is recommended. Uncovered
dead helpers and trivial executable wrappers do not automatically warrant new
tests. Optional external compatibility checks remain explicitly opt-in.
The suite has substantial behavioral coverage, but is not fully aligned with
the policy's sufficiency criteria: consequential cross-package gaps coexist
with a small amount of redundant and implementation-sensitive protection.

View File

@@ -0,0 +1,366 @@
# Behavioral Equivalence And Shared Abstraction Audit
Reviewed: 2026-11-30
Baseline: `bca7cd7c3a263be75549fed7461bcb781e8c4d0f`
## Scope And Evidence
This audit followed direct comparison tests and separate tests expressing the
same behavior into their production implementations. It examined configuration
equivalence, preparation and resume, planning and execution, transcript
validation, downloads and replacement, artifact dependencies, checkpoints, and
downstream invocation contexts. Findings identify shared responsibilities worth
considering for consolidation; similar names, repeated assertions, or matching
results alone were insufficient.
Codebase-memory-mcp supplied symbol discovery, source snippets, and call
relationships. Direct source inspection supplemented incomplete indexing of
same-named Go receiver methods. Recommendations were checked against the
[architecture](../../policy/architecture.md),
[testing](../../policy/testing.md), and focused integration/internal documents.
Tests establish the particular equivalences described below, rather than
equivalence of entire packages or every failure path.
These existing checks passed using Go 1.27.4 on Linux:
- `go test -count=1 ./...`
- `go vet ./...`
- `go test -count=1 ./internal/doccheck` after writing this report.
No production code or tests were changed. No new tests, benchmarks, live
downstream applications, paid APIs, or remote storage services were used.
## Current Architecture
Narratio is a fixed-stage Go orchestrator:
`prepare → transcribe → merge → polish → normalize → trim → render → extract → analyze → publish → notify → cleanup`.
The notification stage currently uses the no-op mode. CommandKit owns CLI
execution and ConfigKit owns configuration resolution; Narratio validates and
derives its application-specific configuration after that handoff.
Application orchestration owns invocation/session locking, planning, execution,
and restore. Stages own domain decisions and use adapter contracts for WhisperX,
Seriatim, Audita, Notarius, Scriptorium, and object storage. Manifest persistence
and the shared stage checkpoint helper retain durable progress. Artifact
services own identities and resolution; narrow file helpers own replacement and
bounded reads. Publication selects immutable remote snapshots, and restore
verifies their contents before installing manifest authority last.
The opportunities below fit these existing boundaries. None requires a generic
workflow engine, a public reusable library, or a new compatibility layer.
## EQ-01 — P3: Four boundaries repeat the same minimal transcript-shape validator
Status: Open
### Evidence
- [Seriatim adapter tests](../../../internal/adapters/seriatim/subprocess_test.go):
`TestSubprocessRunnerNormalizeOutputMissingSegmentsFails` (line 472) and
`TestSubprocessRunnerTrimOutputMissingSegmentsFails` (line 331) reject a
successful command's JSON output when its top-level `segments` is missing.
- [Audita adapter tests](../../../internal/adapters/audita/subprocess_test.go):
`TestSubprocessRunnerRejectsMissingOrMalformedTranscript` (line 116) rejects
absent output and `{"segments":"wrong"}` after a successful subprocess.
- [Artifact resolution tests](../../../internal/artifacts/artifact_resolver_test.go):
`TestResolveSessionArtifactValidatesTranscriptShape` (line 255) rejects
manifest-backed polished JSON containing `not_segments` instead of `segments`.
- [Normalize stage tests](../../../internal/stage/normalize_test.go):
`TestNormalizeStageFailsWhenProcessedTranscriptMissingSegments` (line 82),
together with the corresponding trim and analyze stage tests, verifies that
downstream consumers also reject that shape. These consumers reach the shared
artifact resolver; they are not additional independent implementations.
Together these tests support a common, deliberately minimal envelope rule:
the transcript is JSON with a top-level `segments` array. They do not establish
a universal schema for every JSON product or the contents of each segment.
### Implementation
Four functions independently unmarshal into `map[string]any`, require the
`segments` member, and assert `[]any`:
- [Seriatim](../../../internal/adapters/seriatim/subprocess.go):
`validateJSONFileWithSegments`, lines 656–675.
- [Audita](../../../internal/adapters/audita/subprocess.go):
`validateProcessedOutput`, lines 201–218.
- [Stages](../../../internal/stage/polish.go):
`validateProcessedTranscriptOutput`, lines 171–192.
- [Artifact resolution](../../../internal/artifacts/artifact_resolver.go):
`validateTranscriptSegmentsJSON`, lines 394–411.
Their surrounding file checks, bounded readers, and diagnostic labels differ.
The duplicated responsibility is the in-memory envelope predicate.
### Opportunity And Remediation Options
Prefer a small byte-oriented validator in the existing
`internal/contracts` package. Each boundary can retain its file acquisition and
contextual errors and delegate the common shape check. This gives one owner to
an acceptance rule shared by producers and consumers without coupling adapters
to stages or artifact persistence.
A viable smaller alternative is to consolidate the adapter validators first
and leave consumer validation local. That reduces some duplication with a
smaller change, but leaves multiple owners of the same envelope rule.
### Tradeoffs
A defect in the shared predicate would affect every consumer. Keep independent
literal valid/invalid fixtures and representative tests at each integration
boundary; deriving expected acceptance through the new validator would weaken
those tests. Boundary validation remains useful even when its predicate is
shared.
Keep size limits, filesystem eligibility, and adapter-specific reporting at
their current owners. Preserve the minimal acceptance rule, including empty
arrays and unrelated JSON members. Seriatim's generic JSON validation and the
stricter segment-ID checks used for session bounds serve different contracts
and remain distinct. Consolidation does not justify imposing IDs, nonempty
segments, or one downstream schema on all transcripts.
## EQ-02 — P3: Verified downloads duplicate sibling temporary-file ownership
Status: Open
### Evidence
- [Audio materialization tests](../../../internal/audio/s3_audio_test.go):
`TestMaterializeS3AudioFailedDownloadPreservesDestination` (line 71) checks
that an invalid download leaves the old destination intact, removes temporary
debris, and permits a successful retry. `TestMaterializeS3AudioUsesVerifiedPreparedCopy`
checks the installed bytes and the absence of extra files after success.
- [Restore tests](../../../internal/app/restore_commit_test.go):
`TestCommittedRestoreRejectsChangedDeclaredObjectBeforeManifestInstall`
(line 297) rejects a changed ordinary product before manifest installation.
[Restore execution tests](../../../internal/app/restore_execution_test.go),
`TestExecuteRestorePlanInvalidManifestDoesNotCorruptExistingManifest`
(line 497), preserve existing manifest bytes after downloaded content fails
manifest validation. Earlier ordinary products remain installed, confirming
that this is per-file replacement rather than whole-restore rollback.
- [Previous-session preparation tests](../../../internal/stage/prepare_previous_test.go):
`TestHydratePreviousSessionArtifactsDownloadsManifestAndRequiredArtifact`
(line 21) verifies installation and manifest input registration through the
third implementation. It does not independently cover every failed-write
cleanup branch.
- [File operation tests](../../../internal/fileops/fileops_test.go):
`TestReplaceFileAtomicCancellationPreservesDestinationAndCleansTemp`
(line 49) independently establishes the existing lower-level replacement
behavior when a caller's final check rejects installation.
The common responsibility is staging a complete file separately from its
canonical destination so caller-specific validation can precede replacement.
The tests cover different rejection points; they do not prove identical
validation rules or complete failure-path coverage across all three domains.
### Implementation
- [Audio](../../../internal/audio/s3_audio.go): `writeAudioTemp`, lines 121–147.
- [Previous-session preparation](../../../internal/stage/prepare_previous.go):
`writePreviousTemp`, lines 111–137.
- [Ordinary restore](../../../internal/app/restore_execute.go):
`downloadRestoreTemp`, lines 254–280.
Each checks its arguments, ensures the destination directory, creates a sibling
temporary file, invokes an `io.Writer` callback, closes the file, removes it on
handled write/close failure, and transfers the closed path to its caller on
success. Callers then validate and install it or remove it. The implementations
are nearly identical apart from error context.
Audio restore already calls `audio.MaterializeS3Audio`; it is not a fourth
independent downloader. Its outer staging step permits committed-object
verification before canonical audio replacement.
### Opportunity And Remediation Options
Prefer one small closed-sibling-temp writer in `internal/fileops`, with explicit
ownership transfer on success. Keep download selection, validation, cancellation,
and installation in the existing callers. This replaces three copies of an
error-sensitive resource lifecycle while retaining their sequencing.
An alternative is a narrow scoped helper that supplies a closed temporary path
to a caller operation and owns its cleanup throughout. That can reduce deferred
cleanup repetition, but makes the callback boundary larger. The closed-path
helper is the less intrusive starting point.
### Tradeoffs
`WriteReaderAtomicWithChecksum` is not a direct replacement: it installs the
file before a caller can validate its complete downloaded contents. The
existing `InstallSiblingTempFile` already provides the shared installation
half. Restore also has root-scoped destination checks and manifest rebasing;
previous-session objects have committed identities; audio has its own reuse
and nonempty/size rules. Those responsibilities remain separate.
Preserve domain-level tests for rejection, retained destinations, and retry;
shared helper tests alone would not prove correct integration. Keep the helper
limited to ordinary file mechanics. A download framework, transaction manager,
platform emulation layer, or stronger crash-durability guarantee would exceed
the demonstrated need. The existing transfer-size issue remains separately
recorded as RS-02 in the [resource audit](05-resources.md).
## EQ-03 — P3: Configured-artifact dependency mechanics have multiple owners
Status: Open
### Evidence
- [Configuration dependency tests](../../../internal/config/artifact_dependencies_test.go):
`TestArtifactDependencyResolutionUnionsNormalizesAndIsIdempotent` verifies
sorted, deduplicated explicit and inferred dependencies.
`TestExplicitAndInferredDependencyGraphsHaveEqualDigests` directly compares
semantically equivalent authored graphs. `TestInferredArtifactDependencyDiagnosticsPointToInputs`
checks unknown/self/cyclic dependencies and source-oriented diagnostics.
- [Fingerprint tests](../../../internal/stage/analyze_fingerprint_test.go):
`TestComputeAnalyzeFingerprintsOrdersDependenciesAndRejectsInvalidGraphs`
checks dependency-first ordering and rejection of unknown edges and cycles.
- [Work planner tests](../../../internal/stage/analyze_plan_test.go):
`TestPlanAnalyzeWorkRejectsUnknownSelectionAndInvalidGraphs` repeats the
graph-validity requirement. `TestPlanAnalyzeWorkOrderIsDeterministicAcrossMapInsertion`
independently expects `alpha, middle, zeta`, and
`TestPlanAnalyzeWorkSelectionAndDependencyClosure` distinguishes explicit
targets, disabled prerequisites, reuse, and force.
- [Execution tests](../../../internal/stage/analyze_test.go):
`TestAnalyzeRunsDependenciesBeforeDependents` checks that inferred input edges
result in producer-first Scriptorium calls and the correct dependent input.
These tests establish one configured-artifact dependency relation across
authored configuration, fingerprints, planning, and execution. The validity
tests alone do not demonstrate independent validators: planning and
fingerprinting already call the configuration validator. Source inspection
shows the additional independent normalization and traversal below.
### Implementation
[Configuration](../../../internal/config/artifact_dependencies.go),
`resolveArtifactDependencies`, derives the edge union and origin information.
[Validation](../../../internal/config/validate_scriptorium.go),
`ValidateScriptoriumArtifactDependencies` (line 265), rebuilds normalized
adjacency and traverses it with DFS. [Fingerprinting](../../../internal/stage/analyze_fingerprint.go),
`normalizedAnalyzeDependencyKeys` and `orderConfiguredAnalyzeArtifacts`, again
normalizes dependencies and builds adjacency/indegrees for heap-based ordering.
[Planning](../../../internal/stage/analyze_plan.go), `AnalyzeTargetClosure`,
traverses prerequisites and filters that full order.
[Invalidation](../../../internal/stage/analyze.go),
`staleAnalyzeDependentClosure`, independently constructs reverse adjacency.
The edge union itself is already shared; the remaining duplication is its
graph mechanics and the interfaces exposing targets versus prerequisite work.
### Opportunity And Remediation Options
Prefer a small configured-artifact dependency view alongside the existing
derived `config.ArtifactCatalog`. Share validated adjacency, deterministic
ordering, prerequisite queries, and reverse-edge queries across consumers.
Retain origin information so configuration diagnostics identify authored
inputs or family declarations. Callers continue to decide force, reuse,
invalidation eligibility, and required previous inputs.
A viable alternative is a lower-level internal artifact-graph package taking
plain keys/edges, with configuration translating errors back to their origins.
That gives a cleaner dependency boundary if needed, at the cost of another
representation and package. Reusing the existing catalog owner is the smaller
initial design.
### Tradeoffs
Target selection and prerequisite closure are intentionally different results:
force applies to explicit targets, while required disabled prerequisites can
be reused or rebuilt. Preserve both concepts. Raw configuration validation also
rejects empty dependencies, whereas runtime normalization currently skips
empty strings after validation; sharing normalization must preserve that
validation responsibility. Keep literal expected orders and independent
invalid-graph fixtures rather than computing test expectations through the
shared implementation.
This is the test-grounded consolidation opportunity already identified as
CX-05 in the [complexity audit](03-complexity.md), not another defect count.
FC-01's omitted previous-input closure and EF-02's repeated reverse-index
construction illustrate the consequences of fragmented ownership. A shared
view can support their remediation, but does not itself decide those callers'
policies. The fixed pipeline-stage relation remains a separate domain.
## EQ-04 — P3: Preparation and resume separately describe the same stable products
Status: Open
### Evidence
- [Preparation tests](../../../internal/stage/prepare_test.go):
`TestPrepareStageMaterializesCanonicalPartyAndDerivedPlayers` (line 162)
checks canonical party/players bytes, distinct checksums and provenance, and
repeatability. `TestPrepareWritesVerifiedGlossaryDocuments` (line 797)
checks resolvable prepared glossary products and manifest records.
- [Resume tests](../../../internal/stage/prepare_resume_test.go):
`TestPrepareResumeDetectsCanonicalPartyChange` runs preparation, verifies
reuse, changes canonical party data, and verifies regeneration is needed.
`TestPrepareResumeValidatesCurrentLocalSourcesAndPreparedCopies` checks
reuse before changes and rejection after prepared glossary tampering.
`TestPrepareResumeRequiresAllGlossaryRecords` checks inventory completeness.
`TestCombinedGlossarySharesVerifiedReferenceAcrossRoles` verifies that the
combined glossary's declared dependencies survive persistence and that
omitting those dependencies prevents reuse.
- `TestPrepareResumeAcceptsRelocatedEquivalentSpeakerAndRosterSources`, in the
same file, requires reuse when source placement changes but content does not.
These assembled tests require the materializer and read-only resume checker to
agree on which stable products exist, their effective content, and their
dependency evidence. They establish more than a coincidental checksum match.
### Implementation
[Preparation](../../../internal/stage/prepare.go), `prepareStage.Run`, and
[resume](../../../internal/stage/prepare_resume.go), `currentPrepareSourceInputs`,
separately enumerate campaign/session snapshots, speakers, autocorrection,
and five glossary products. Both repeat the named-glossary/source-ID mapping
and combined-glossary dependency construction.
[Party materialization](../../../internal/stage/prepare_party.go) and
`currentPreparePartySourceInputs` similarly obtain party and players bytes
through separate product descriptions.
[Semantic selection](../../../internal/stage/semantic_contracts_initial.go),
`prepareStableInputSemantics`, repeats the stable-kind inventory for presence
evidence.
The underlying renderers, glossary composition, and prepared-input descriptors
are already shared. The opportunity is the remaining product inventory and
its projection into writes versus expected evidence, not a replacement for
those existing components.
### Opportunity And Remediation Options
Prefer a stage-owned description of stable prepared products derived from the
final Narratio configuration. Materialization can attach destinations and
write the described content; resume can calculate expected identities from
the same descriptions. Reuse the existing `artifactpolicy` descriptors for
source IDs, kinds, and filenames. Presence-only semantic selection can reuse
the relevant inventory without acquiring file contents.
A smaller viable alternative is to start with just the five glossary mappings
and combined dependencies, then party/players content. This captures the most
obvious repeated definitions without introducing a generalized input registry.
### Tradeoffs
Keep construction read-only and keep effects in materialization. Snapshot
comparison deliberately ignores relocated source references; party, glossary,
and autocorrection products have their own content identities. Audio membership
and remote identities have different acquisition costs and remain separate.
Semantic fingerprinting retains its existing bounded selection role rather
than reading every input merely to share a helper.
Preserve independent tests for expected products, corruption, and missing
records. Generating all test expectations from the shared inventory would let
an accidental omission pass both writer and reader tests. This finding refines
CX-02 in the [complexity audit](03-complexity.md). It fits within Narratio's
post-ConfigKit domain derivation boundary and requires no inspection of upstream
configuration-resolution internals.
## Recommendation
Consider EQ-01 and EQ-02 as focused helper extractions. Address EQ-03 and EQ-04
with the corresponding existing audit workstreams so their overlapping changes
are designed and reviewed once. Keep representative consumer tests independent
of the shared implementation. Similar behavioral assertions at distinct
boundaries remain useful when they detect incorrect integration; sharing
production mechanics does not automatically make those tests redundant.

View File

@@ -0,0 +1,327 @@
# Package Cohesion And Architectural Boundaries Audit
Reviewed: 2026-11-30
Baseline: `28e54fb657e7915dd79f8b09bfde0636847ede1a`
## Scope And Method
The review covered the repository's 26 internal Go packages and the executable
entry point. It examined declared responsibilities, actual imports, public
contracts, and representative implementations and callers across configuration,
orchestration, stages, adapters, manifests, artifacts, workspace operations,
input preparation, readiness, publication, and restore. Third-party package
implementations and vendor code were outside scope.
Codebase-memory-mcp supplied package exploration, symbol discovery, source
snippets, and call tracing. Its coarse package grouping and same-named receiver
method resolution were supplemented with source inspection and `go list`'s
actual production imports. Package size or a graph metric alone was not treated
as evidence of poor cohesion.
The [architecture policy](../../policy/architecture.md) supplied the intended
ownership boundaries. Focused internal documents and existing tests supplied
additional implementation evidence. These checks passed on Linux with Go 1.27.4:
- `go list -f '{{.ImportPath}}|{{join .Imports ","}}' ./...`
- `go test -count=1 ./...`
- `go vet ./...`
- `go test -count=1 ./internal/doccheck` after writing this report.
No production code or tests were changed. No new tests, live provider calls,
external subprocess applications, or remote-storage experiments were needed.
This is an ownership audit, not proof that every runtime path is correct.
## Current Architecture
Narratio is a fixed-stage orchestrator:
`prepare → transcribe → merge → polish → normalize → trim → render → extract → analyze → publish → notify → cleanup`.
Notification currently uses the no-op mode.
| Package area | Implemented responsibility |
| --- | --- |
| `cmd/narratio`, `internal/app` | Entry, native CommandKit composition, configuration acquisition, invocation/session lifecycle, planning, execution, operator commands, and restore. |
| `internal/config` | Typed ConfigKit handoff, Narratio validation, party/family/catalog derivation, and safe configuration materialization. |
| `internal/domaininput`, `internal/glossary` | Shared input-schema validation and Narratio's selected vocabulary projections/composition. |
| `internal/stage` | Fixed stage contracts, stage execution and resume semantics, sub-stage reconciliation, and stage-owned semantic fingerprints. |
| `internal/adapters/*` | Narratio-owned external contracts and HTTP, subprocess, notification, or object-store implementations. Shared subprocess supervision and credential handling have a dedicated owner. |
| `internal/manifest`, `internal/artifactmodel`, `internal/artifactpolicy` | Durable progress records/persistence, shared product models, and source/destination vocabulary and validation. |
| `internal/artifacts` | Canonical paths and local store/locking, runtime availability and evidence, artifact resolution, remote commit/current-state models, and remote locks. |
| `internal/audio`, `internal/previouscache` | Verified S3 audio materialization and selection of committed previous-session inputs. |
| `internal/preflight` | Downstream readiness assessment over supplied targets and adapter reports. Application code selects targets and coordinates probes. |
| `internal/pathsafe`, `internal/fileops` | Path confinement, ordinary workspace modes, bounded reads, replacement/deletion mechanics, and the diagnostic-view behavior discussed below. |
| `internal/contracts`, `internal/notariusref`, `internal/logging`, `internal/doccheck` | Focused bounds/selector contracts, reporting interfaces, and repository validation support. |
The actual import graph respects the main direction: the executable imports
`app`; `app` composes stages and implementations; stages consume Narratio-owned
adapter contracts and support services. Stages do not import `app`. Locating
an interface in an adapter package does not itself leak an SDK or subprocess
protocol into its consumers.
The five findings below concern responsibility allocation within that generally
sound structure. Several refine existing audit findings and should be addressed
as the same work rather than counted as additional runtime defects.
## BN-01 — P3: Diagnostic-view layout policy is embedded in file-operation mechanics
Status: Open
**Relevant implementation.**
[fileops/attempt_views.go](../../../internal/fileops/attempt_views.go):
`BeginAttemptViews`, `attemptTarget`, `existingManagedView`,
`InspectManagedAttemptViews`, `RemoveManagedAttemptViews`, and `AttemptViews.Revert`.
[artifacts/paths.go](../../../internal/artifacts/paths.go):
`SessionInvocationProbeDir`, `SessionRunLogsDir`, `SessionRunDebugDir`, and the
latest-view path helpers.
[stage/run_local.go](../../../internal/stage/run_local.go): `resolveRunStageLayout`.
**Basis.** Fileops knows Narratio's `runs/<run>/<stage>/{logs,debug}` grammar,
the corresponding latest-attempt links, and reserved `.preflight`/`.validation`
identities. It constructs and recognizes those paths independently of the
canonical path owner. This is application workspace/navigation policy, beyond
writing, replacing, or removing a caller-selected file. Changing the attempt
layout or probe convention requires coordinated changes in fileops, artifacts,
and stage/application callers.
The application correctly decides when to advance or revert a view in
`executeSelectedStage`; restore uses the same fileops operation, and cleanup
removes recognized views. The ownership issue is the location of the layout
grammar, not those callers' lifecycle decisions.
**Remediation options.** Prefer moving the existing diagnostic-view operation
to the canonical layout owner, currently `internal/artifacts`, and making it
consume the same path model. Keep root-scoped directory creation, permissions,
and ordinary replacement/deletion mechanics in fileops. Move the operation
without introducing a generalized symlink-management framework.
An alternative is a focused `internal/workspace` owner containing the canonical
local path model, session locking, and attempt views. That gives the broad
artifacts package a clearer boundary, but requires a larger interface/import
change. Establishing one owner for attempt layout is useful independently of
whether that broader extraction is worthwhile.
**Supporting tests and tradeoffs.**
[Fileops view tests](../../../internal/fileops/attempt_views_test.go), including
`TestAttemptViewsAdvanceAndRestoreManagedTargets`, and
[application attempt tests](../../../internal/app/attempt_views_test.go),
`TestAttemptViewsTrackAttemptsFailureSkipAndReuse`, protect advancement,
failed-attempt visibility, self-skip reversion, and reuse without an empty run.
Keep those behaviors and root-confinement rules. The runner still decides
whether an attempt exists; cleanup still chooses authorized targets. A package
move should not add retention, locking, or filesystem guarantees.
## BN-02 — P3: Notarius output-protocol translation partly lives in stage orchestration
Status: Open
**Relevant implementation.**
[stage/notarius_lanes.go](../../../internal/stage/notarius_lanes.go):
`notariusLanePath` (line 23) and `stageRequiredNotariusLanes`.
[stage/extract.go](../../../internal/stage/extract.go): `resolveExecutable`
(line 317) and its extraction caller.
[stage/extract_preflight.go](../../../internal/stage/extract_preflight.go):
`BuildNotariusReadiness`.
[adapters/notarius/runner.go](../../../internal/adapters/notarius/runner.go):
`RunRequest` and `RunResult`;
[subprocess.go](../../../internal/adapters/notarius/subprocess.go):
completion decoding and bundle discovery.
**Basis.** The adapter owns CLI arguments, completion decoding, and bundle-root
discovery, but returns only the bundle root rather than locations of requested
native outputs. The stage therefore implements Notarius's lane-ID sanitization
and `lanes/<name>.json` mapping itself. This mapping changes with the external
output protocol, not Narratio's stage policy. Executable discovery through
`exec.LookPath` also lives in the stage and is used by execution and readiness,
although process launch belongs to the adapter/shared subprocess boundary.
The source mapping is directly protected by
[TestNotariusLanePath](../../../internal/stage/notarius_lanes_test.go), with
native filename expectations in the stage package.
[TestNativeExtractionRejectsMappedLaneCollisions](../../../internal/stage/extract_native_test.go)
also exercises the external sanitization collision. These tests demonstrate
where the external contract currently resides.
**Remediation options.** Prefer making the existing Notarius adapter own the
lane-to-native-path translation, through a narrow resolver or requested-lane
result contract. The stage supplies required lane IDs and receives their
locations, then applies Narratio's staging, checksum, canonical-name, and
promotion policy. Pass executable selection through the adapter/shared process
runner or production composition, retaining the same operator override semantics.
A smaller alternative moves only lane-path resolution into an exported helper
in the existing Notarius adapter package. That fixes the clearest misplaced
responsibility without redesigning `Runner`. A separate shared contract package
is warranted only if another actual consumer needs the same protocol.
**Tradeoffs.** Keep Narratio's canonical filename selection and collision rules
outside the downstream protocol resolver. Confined paths, bounded valid JSON,
verification before replacement, and manifest evidence remain Narratio
responsibilities. Typed adapter results do not eliminate those checks. Move
native naming fixtures with their owner while retaining stage tests that prove
the correct configured lanes are promoted. This is distinct from decomposing
the large extraction function in CX-03 of the
[complexity audit](03-complexity.md).
## BN-03 — P3: Machine-consumed publication metadata lacks a shared contract owner
Status: Open
**Relevant implementation.**
[stage/publish.go](../../../internal/stage/publish.go): `publishMetadata`.
[stage/publish_output_plan.go](../../../internal/stage/publish_output_plan.go):
`publishOutputStatus` and `publishOutputOutcomeMetadata` (line 245).
[stage/cleanup_plan.go](../../../internal/stage/cleanup_plan.go):
`validateCleanupPublishEvidence` (line 84).
[app/artifact_inspection.go](../../../internal/app/artifact_inspection.go):
`committedPublishOutputOutcomes` (line 41) and `isPublishOutputOutcome`.
**Basis.** Publish serializes completion identity and per-source outcomes into
`StageRecord.Metadata`. Cleanup independently reconstructs completion fields and
checks their meaning. App inspection independently knows the outcome keys and
repeats the producer's five status strings. Its parser handles both
`[]map[string]any` and JSON-decoded `[]any`. A producer change can compile while
silently changing cleanup eligibility or operator reporting.
These values are shared control/reporting evidence, even though they currently
share a map with arbitrary diagnostics. Manifest persistence supplies a common
container, but does not own the meaning of publication fields. Stage-private
types also cannot be the sole contract for independent app consumers.
**Remediation options.** Prefer small typed publication completion/outcome
values and map encoding/decoding helpers under an existing shared owner, such
as `internal/artifacts` alongside its remote publication identities. Have the
producer and consumers use that contract while preserving the existing JSON
shape. Keep cleanup eligibility in cleanup and presentation decisions in app.
An alternative is a focused publication package if remote commit, lock, and
publication evidence responsibilities are extracted together. That creates a
stronger domain boundary at the cost of a larger change. A generic metadata
framework or new manifest schema is unnecessary for the immediate issue.
**Supporting tests and tradeoffs.**
[TestCommittedPublishOutputOutcomesRecognizesAllStates](../../../internal/app/restore_commit_test.go)
checks the app-side vocabulary.
[Cleanup plan tests](../../../internal/stage/cleanup_plan_test.go), notably
`TestBuildCleanupPlanRejectsInvalidPublishEvidenceWithoutExecutablePlan`,
exercise the safety gate. Retain direct and persisted-round-trip coverage.
Tolerant display parsing and authoritative cleanup checks have different
failure policies; a shared decoder should not silently make them equally
strict. Arbitrary diagnostic metadata can remain flexible.
This is the publication part of CX-06 in the
[complexity audit](03-complexity.md), with a concrete ownership recommendation.
Typed evidence does not resolve FC-02's carried-output/manifest coherence issue.
## BN-04 — P3: Audio discovery is owned independently by preparation and inspection
Status: Open
**Relevant implementation.**
[stage/prepare.go](../../../internal/stage/prepare.go):
`resolveLocalAudioFiles` (line 311), `resolveAudioInputs`, and
`localAudioDestinations`.
[app/operator_inspection.go](../../../internal/app/operator_inspection.go):
`inspectLocalAudioPresence`, `resolveLocalInspectionAudioPaths` (line 207),
and remote-audio inspection.
[audio/s3_audio.go](../../../internal/audio/s3_audio.go):
`MaterializeS3Audio`, the existing audio-focused domain helper.
**Basis.** Both app and stage own explicit-list/directory selection, relative
resolution, FLAC filtering, duplicate handling, and deterministic ordering.
There is no shared read-only source-selection owner. Their policies have already
diverged: preparation rejects duplicate resolved source paths and supports
distinct same-basename recordings; inspection accepts repeated identical paths
and rejects distinct paths with the same basename. File eligibility checks also
differ: preparation's `requireFile` rejects directories, while inspection
requires a regular file.
The same-basename reporting defect is already CX-01 in the
[complexity audit](03-complexity.md), including its dynamic evidence. This audit
does not recount it as a new defect; it identifies the missing ownership seam.
**Remediation options.** Prefer a read-only audio-source discovery operation in
the existing `internal/audio` package. Supply explicit selection and source-base
values and return sources or remote identities. Preparation retains copying,
canonical destination naming, and manifest updates; app retains reporting.
Storage adapters continue to receive explicit bucket-relative prefixes.
A narrow separate source-selection package is viable if it materially avoids
dependencies on audio materialization. The existing audio owner is the smaller
starting point. Share discovery and filters rather than turning operator
inspection into a preparation-stage invocation.
**Supporting tests and tradeoffs.**
[Preparation tests](../../../internal/stage/prepare_test.go) cover explicit
lists, directory enumeration, and duplicate source rejection.
[TestLocalAudioDestinationsPreserveDistinctRecordings](../../../internal/stage/audio_destinations_test.go)
protects disambiguation and source preservation. Keep inspection read-only and
retain the separately selected S3 basename rules. Resolve current eligibility
differences explicitly against the existing contract rather than adopting the
strictest implementation merely to simplify sharing. CX-01's correctness fix
retains its original priority.
## BN-05 — P3: Configured-artifact graph operations are fragmented across domain owners
Status: Open
**Relevant implementation.**
[config/artifact_dependencies.go](../../../internal/config/artifact_dependencies.go):
`resolveArtifactDependencies` derives the concrete edge union and origin data.
[config/validate_scriptorium.go](../../../internal/config/validate_scriptorium.go):
`ValidateScriptoriumArtifactDependencies` rebuilds adjacency and validates it.
[stage/analyze_fingerprint.go](../../../internal/stage/analyze_fingerprint.go):
`normalizedAnalyzeDependencyKeys` and `orderConfiguredAnalyzeArtifacts`.
[stage/analyze_plan.go](../../../internal/stage/analyze_plan.go):
`AnalyzeTargetClosure`.
[stage/analyze.go](../../../internal/stage/analyze.go):
`staleAnalyzeDependentClosure`.
[artifacts/previous_requirements.go](../../../internal/artifacts/previous_requirements.go):
`CollectPreviousArtifactRequirements` consumes the selected target set.
**Basis.** Configuration owns the concrete graph, while stage code owns its
normalization, work ordering, prerequisite closure, and reverse-edge rebuilding.
Artifact services expose an effective selection that is targets-only; consumers
must know when to expand it. These are different views of one domain relation,
with no single query boundary for its mechanics. The earlier FC-01 missing
previous-input closure illustrates the resulting cross-package ambiguity.
**Remediation options.** Prefer exposing dependency queries from the existing
derived `config.ArtifactCatalog` owner: validated adjacency, dependency-first
order, prerequisite closure, and dependent traversal. Make selected targets and
required work separate explicit results. Preparation and restore can then ask
for inputs of the work closure without depending on analyze-stage internals.
Stage code retains force, reuse, fingerprint payloads, and invalidation decisions.
A lower-level artifact-graph package taking keys and edges is a viable
alternative if needed to keep dependencies acyclic. Preserve configuration's
source-origin diagnostics at its boundary. A generic workflow engine would
serve a different problem.
**Supporting tests and tradeoffs.** Configuration dependency tests,
[fingerprint ordering tests](../../../internal/stage/analyze_fingerprint_test.go),
and [work-plan tests](../../../internal/stage/analyze_plan_test.go) protect
normalization, invalid-graph rejection, deterministic ordering, disabled
prerequisites, and target-only force. Preserve those distinctions.
`config.ArtifactCatalog` describes derived definitions; the runtime
`artifacts.ArtifactCatalog` additionally tracks manifest-backed availability.
Those responsibilities remain distinct even if their graph queries are shared.
The fixed stage-invalidation relation also remains separate.
This refines CX-05 in the [complexity audit](03-complexity.md) and EQ-03 in the
[equivalence audit](10-equivalence.md); implement it as their shared remediation.
## Proportionate Follow-Up
Address BN-01 and BN-02 as focused ownership corrections. Fold BN-03 through
BN-05 into the cited existing work rather than parallel refactors. The
equivalence audit's transcript predicate and sibling-temp recommendations are
additional small shared-helper opportunities under existing owners.
The review does not recommend splitting app or stage by file count, merging
configuration definitions with runtime availability, moving stage execution
policy into persistence, or creating an umbrella package for every contract.
Native configuration acquisition, input-schema validation, vocabulary
composition, process supervision, typed checkpoint persistence, and
pointer-selected remote-state verification already have useful boundaries.
Preserve these owners and the fixed pipeline while correcting the narrower
allocation problems above.

View File

@@ -0,0 +1,309 @@
# Dead Code And Obsolete Functionality Audit
Reviewed: 2026-11-30
Baseline: `bd8e8a0627e7dfe0425e380212e82f00c79aa1d2`
## Scope And Method
The review examined repository-owned functions, helpers, constants, structs,
interfaces, configuration/defaulting paths, conditional branches, and retained
compatibility behavior. It followed supported command entry points and checked
tests, registrations, interface calls, reflection, build constraints, and
documented retention purposes before classifying candidates.
Codebase-memory-mcp supplied discovery, source snippets, and caller searches.
Its same-named Go method and constant-reference indexing is incomplete; graph
degree alone was not used to establish deadness. Source searches and the
following tools supplied independent evidence:
- `deadcode` from `golang.org/x/tools v0.52.0`, built with Go 1.27.4, analyzed
`./cmd/narratio` for Linux amd64, Linux arm64, and macOS arm64. Each produced
the same 88 unreachable-function candidates, including legitimate test fakes
and library/test entry points.
- `deadcode -test ./...` on Linux amd64 reduced that list to 12 functions:
six in production files and six in test files. DD-01 records those confirmed
orphaned functions. Results were filtered to Narratio's module.
- Staticcheck 2026.2.2 (`honnef.co/go/tools v0.8.2`) with `-checks=U1000`
reported the same ten unused unexported helpers on Linux amd64 and macOS
arm64. The additional exported wrapper and its helper were found by
`deadcode`. `-checks=U1000,SA4*,SA9*` also reported DD-06's unused assignment.
- A temporary standard-library `go/ast` scan counted references to declarations
in `config/defaults.go` across all repository Go source under `cmd/` and
`internal/`, including tests and platform files. Six constants occurred only
at their declarations; source searches confirmed the DD-02 candidates.
Analyzer binaries, their build module, and the small AST diagnostic were kept
outside the repository. Project dependencies were unchanged. Cross-target
analysis is source/type-analysis evidence, not native macOS or arm64 execution.
Analyzer diagnostics were reviewed as candidates rather than automatic deletion
instructions.
`go test -count=1 ./...` and `go vet ./...` passed with Go 1.27.4 on Linux.
`go test -count=1 ./internal/doccheck` passed after writing this report.
Staticcheck's nonzero exit reflects the findings above. No production code,
tests, or functionality were changed, and no live providers or object storage
were used.
## Current Architecture
Narratio is a fixed-stage orchestrator:
`prepare → transcribe → merge → polish → normalize → trim → render → extract → analyze → publish → notify → cleanup`.
The application owns command composition, invocation/session lifecycle,
planning, and restore. Stages own execution and semantic resume decisions;
adapters own external interactions. Manifests and typed speaker/artifact
collections provide durable progress. Artifact services provide identities,
evidence, canonical paths, and committed remote-state resolution. ConfigKit owns
configuration resolution, with Narratio's domain derivation after handoff.
The main supported paths are connected. The findings are focused remnants and
redundant machinery rather than an abandoned pipeline subsystem.
## DD-01 — P3: Completely orphaned helper functions remain in production and tests
Status: Open
### Code And Evidence
The following production functions remain unreachable even when all test
executables are included:
| File | Functions | Evidence |
| --- | --- | --- |
| [Notarius subprocess adapter](../../../internal/adapters/notarius/subprocess.go) | `resolveRegularFile` (line 244), `requireRegularFileTree` (line 273) | U1000 and reachability analysis agree. The first calls the second, but neither has an external caller. Current bundle and lane validation use other paths. |
| [Cleanup target validation](../../../internal/app/cleanup_targets.go) | `validateCleanRoot` (line 69) | U1000 and reachability analysis agree; supported cleaning uses `validateScopedTarget`. |
| [Configuration validation helpers](../../../internal/config/validate_helpers.go) | `validatePathWithinRoot` (line 41) | U1000 and reachability analysis agree; current product-destination validation is implemented elsewhere. |
| [Effective pipeline helpers](../../../internal/config/effective_pipeline.go) | `NormalizedConfigurationPath` (line 32), `normalizedProvenancePath` (line 65) | The exported wrapper has no callers, including tests; its private path helper is used only by that wrapper. `deadcode -test` reports both. |
Six test helpers also have no callers; both analyzers report them:
- [Notarius adapter tests](../../../internal/adapters/notarius/subprocess_test.go):
`cloneMap` (line 557).
- [Application command tests](../../../internal/app/commands_test.go):
`writeManifestPathForExecute` (line 509).
- [Configuration command tests](../../../internal/app/config_commands_test.go):
`writeInspectionOverlays` (line 48).
- [Path test helpers](../../../internal/app/paths_test_helpers_test.go):
`mustPreviousArtifactPathForCampaign` (line 9).
- [Extraction tests](../../../internal/stage/extract_test.go):
`stringPointerForExtractTest` (line 957).
- [Preparation tests](../../../internal/stage/prepare_test.go):
`assertManifestInputsSorted` (line 766).
Source inspection found no registration, reflective lookup, build-tag consumer,
or documented future/compatibility purpose for these helpers. In particular,
the Notarius pair is a disconnected helper chain, not a live security check
that merely lacks a direct call edge in the graph. The functions are in
internal packages rather than a supported external Go library API.
### Removal Approach And Cautions
Remove the orphaned declarations and any newly unused imports. Delete a helper
file if it becomes empty. Keep live Notarius directory/file checks, current
cleanup confinement, and current product-destination validation intact.
Removing the unused sorting assertion does not imply removing the active
preparation ordering assertions.
No replacement abstraction is needed. Re-run the analyzers and focused package
tests after removal; do not replace these declarations with forwarding shims.
## DD-02 — P3: Unused constants and retired workspace paths advertise obsolete concepts
Status: Open
### Code And Evidence
Six constants in [config/defaults.go](../../../internal/config/defaults.go)
have no Go identifier references beyond their declarations, including tests
and alternate-platform files:
- `DefaultScriptoriumArtifactOutputRoot`;
- `PathTranscriptBase`, `PathTranscriptPolished`, and `PathTranscriptFinal`;
- `S3ManifestFile` and `S3RunIDFile`.
Their exported names do not establish use. The active transcript vocabulary is
in `artifactmodel`; remote publication selects immutable commit declarations
through the current pointer. No supported source or documentation consumer of
these particular aliases/constants was found. Removing an unused name does not
remove the corresponding live transcript path or manifest/run identity.
Separately, [artifacts/paths.go](../../../internal/artifacts/paths.go) declares
`SessionPaths.ReportsDir` and `ConfigDir` (lines 25–26) and assigns
`<session>/reports` and `<session>/config` in `buildSessionPathsFromRoot`
(lines 239–240). Neither field is read elsewhere. Their only path constants,
`PathReportsDirSegment` and `PathConfigDirSegment`, feed those unused assignments.
`LocalStore.ensureLayout` does not create these directories.
The [operator layout](../../operations.md#local-state-layout) places actual
attempt diagnostics under `runs/` and exposes latest logs/debug links. Prepared
configuration belongs in `inputs/`; the retained top-level path fields describe
an earlier organization without providing a live layout capability.
### Removal Approach And Cautions
Remove the six disconnected constants, the two unused `SessionPaths` fields,
their assignments, and their two now-unnecessary directory constants. Keep the
canonical artifact-model vocabulary and current remote commit/key helpers.
This is code-model cleanup. It should not delete existing session directories,
alter physical layout, migrate sessions, or add a default artifact output path.
In particular, reconnecting an unused constant by inventing a new fallback would
change behavior instead of removing dead code.
## DD-03 — P3: Extraction still carries descriptor fields that the current model discarded
Status: Open
### Code And Evidence
[stage/extract.go](../../../internal/stage/extract.go), `fingerprintOutput`
(lines 261–268), retains `MediaType`, `SchemaID`, `SchemaVersion`, and
`ModuleKey`. All four have `json:"-"` tags. `extractionFingerprint` constructs
only key, lane ID, and filename; nothing writes or reads the four excluded
fields. They cannot affect the fingerprint's serialized payload.
[artifacts/extraction_evidence.go](../../../internal/artifacts/extraction_evidence.go)
also retains `ExtractionEvidenceOutput.Contract`. Its sole production
construction supplies path, checksum, and size but never a contract. The nil
field is passed by `HydrateExtractionArtifacts` to
`markAvailableFromExtractManifest` in
[catalog.go](../../../internal/artifacts/catalog.go), where it is cloned back
to nil. There is no non-nil producer along this path.
The current configured extraction definition contains only lane, pipeline, and
filename. [TestNotariusNativeControlsAndOutputs](../../../internal/config/product_destinations_test.go)
expressly rejects the retired `media_type` output descriptor. Extraction
execution and resume validate the configured JSON products and provenance
without resurrecting those old descriptor fields.
### Removal Approach And Cautions
Remove the four JSON-excluded fingerprint fields. Remove the always-nil
extraction evidence field and its extraction-only parameter/copy plumbing.
Keep shared `CatalogEntry.Contract`, manifest contract metadata, and the
analyze-generated contract path: they have live consumers and different roles.
The existing fingerprint JSON and digest can remain unchanged because the
discarded fields are already excluded. This does not require a fingerprint or
manifest schema migration, stricter lane validation, or reintroduction of
retired configuration options. Retain current extraction/resume and dependent
input-identity coverage.
## DD-04 — P3: Manual cleaning retains a file-target mode unavailable through its CLI
Status: Open
### Code And Evidence
[app/clean_command.go](../../../internal/app/clean_command.go),
`cleanSelectedSession`, passes `directory=true` for both supported target
choices: one entire session or the whole session-work tree for `--all`.
Its `appendTarget` closure forwards that boolean to `cleanScopedTarget` and
then to [validateScopedTarget](../../../internal/app/cleanup_targets.go).
Only [cleanup target unit tests](../../../internal/app/cleanup_targets_test.go)
request the false/file branch through
[validateScopedFile](../../../internal/app/clean.go). The sibling
`validateScopedDir` wrapper is likewise test-only, while production bypasses
both wrappers. This preserves an artificial two-mode validation API for a
directory-only command.
The [documented cleanup contract](../../operations.md#cleanup) provides whole
local-session deletion and a separate publication-gated run-history stage.
Neither accepts individual file targets. No future file-clean command or
compatibility caller is documented. DD-01 separately covers the fully unused
`validateCleanRoot` helper in the same area.
### Removal Or Consolidation Approach
Make the manual-clean validation path explicitly directory-oriented. Eliminate
the forwarded directory boolean, the false-only branch, and `validateScopedFile`.
Use one live directory validation entry point from commands and tests rather
than preserving test-only wrappers around the implementation.
Retain directory/root/traversal/symlink checks, missing-target behavior,
dry-run behavior, and the selected command's deletion scope. Consolidate the
unit tests onto that live contract, removing file-only cases. General file
operations used elsewhere remain available. This cleanup does not resolve or
replace CN-01's separate session-locking remediation.
## DD-05 — P3: A superseded publish-default mutation helper survives only in a no-op test call
Status: Open
### Code And Evidence
[config/validate_publish.go](../../../internal/config/validate_publish.go),
`applyMissingPublishDestinations` (line 36), directly writes destinations into
its input configuration. Its only caller is
`TestProductDestinationsPreserveExplicitRemotePaths` in
[product_destinations_test.go](../../../internal/config/product_destinations_test.go).
That fixture already supplies a destination, so `deriveMissingPublishDestinations`
returns no entries and the call performs no mutation.
The production path in
[pipeline_configkit.go](../../../internal/config/pipeline_configkit.go),
`resolvePipelineConfig` (lines 191–199), uses the shared derivation directly
and records actual defaults through native `configkit.Normalize`. Reachability
analysis therefore reports the old writer as absent from the production
command graph while retaining it when tests are roots.
### Removal Or Consolidation Approach
Remove the unused writer. Keep `deriveMissingPublishDestinations` and the
native ConfigKit resolution path. Preserve explicit-destination testing through
the production loader/domain boundary; the current validator assertion can
also remain without the irrelevant helper call.
The [configuration ownership decision](../../adr/0003-assign-configuration-ownership.md)
already assigns resolution to ConfigKit's supported hooks. No new configuration
semantics or stricter destination policy is needed, and this finding does not
claim the obsolete writer currently mutates an authoritative runtime result.
## DD-06 — P3: Input hashing stores a normalized path that is never consumed
Status: Open
[stage/analyze_input_identity.go](../../../internal/stage/analyze_input_identity.go),
`hashAnalyzeInputFile` (line 262), assigns the normalized result back to
`relative`, then uses only `err` and opens the previously resolved `target`.
Staticcheck reports this assignment as SA4006. The original `filepath.Rel`
result is used as the normalization input; only the normalized return value
is discarded by all later code.
Use a blank identifier for that unused return value, or an equivalently clear
error-only validation form. Keep the normalization call and its error check:
they enforce the existing relative-path confinement rule. Removing the entire
call to silence a dead-value diagnostic would remove live validation. This is
a small mechanical cleanup, not a new path-resolution abstraction or a change
to accepted input paths.
## Deliberately Retained Behavior And Limits
- The fixed registry and stage interfaces make stage methods reachable without
direct concrete calls. ConfigKit callbacks such as `pipelineConfigDefaults`
and validation hooks are explicitly registered function values. The
`deadcode -whylive` result also retained the defaults callback, but its
conservative reflection path is a static approximation rather than a runtime
trace; the native definition's callback registration supplies the direct
source evidence.
- Fakes, test entry points, and loader conveniences with actual test consumers
are not dead merely because the CLI does not call them. The documented
package-internal compatibility form of `config.Load` is not proposed for
removal. Future-facing aliases were not classified solely from production
reachability.
- No-op notification is an explicit supported mode. The documented one-time
regeneration of aggregate-only transcription state also has a live recovery
purpose. Neither is an obsolete feature to delete in this audit.
- Build-tagged locking and process-tree code was evaluated in the supported
target configurations. Lack of an edge in one platform's graph does not
establish deadness. No blanket deletion of alternate/unsupported-platform
implementations is recommended; unsupported platforms were not build gates.
- Native YAML/JSON bindings, embedded schemas, and reflective semantic-type
validation were considered. A missing direct field read is insufficient for
bound configuration options. No operator-facing configuration option is
recommended for removal merely because it is optional or indirectly consumed.
The recommended changes remove disconnected symbols, inert data, and
superseded internal variants. They preserve the current supported workflow,
selected compatibility behavior, and deliberate test seams.

View File

@@ -0,0 +1,361 @@
# Documentation Consistency Audit
Reviewed: 2026-12-01
Baseline: `1b7742cd385c8852e058898ba1e25b928bc4eb9d`
## Scope And Evidence
The review compared current-facing documentation with the implemented code,
focused tests, accepted ownership decisions, and the
[documentation policy](../../policy/documentation.md). It covered the root and
examples READMEs, CLI and configuration references, operations and
troubleshooting, internal and integration documents, package/API comments,
maintained YAML examples, development instructions, and the release/deployment
instructions and automation. Narratio has no separate maintained container or
service deployment recipe in this baseline.
The policy's current-behavior, canonical-owner, example-validity, and upstream
documentation rules informed the findings. Code discovery used the knowledge
graph, supplemented by source inspection where Go receiver-method indexing was
incomplete. No production code, tests, configuration examples, or documents
under review were changed.
Verification used Go 1.27.4 on Linux:
- Fresh `go test -count=1 ./...` passed, including maintained-example loading,
documentation-link checks, and release/workflow checks.
- `go vet ./...` and a temporary CLI build passed.
- The production/testing walkthrough's validate, show, sources, diff, and
artifact-catalog commands succeeded against the maintained local fixtures.
Help for the root, plan, preflight, cleanup, and regeneration commands agreed
with their documented command paths and installed selectors.
- Native inspection of the minimal pipeline confirmed the documented effective
defaults, including the empty Audita output-schema selector and ordinary
publish defaults. An explicit configuration in another example is not a
different application default.
- A read-only check inspected 148 local Markdown fragment links. Its only
apparent missing heading was an old profile heading linked from the
historical v2.0.0 release note. Current-facing local targets passed the
existing link test and this additional check. The existing test checks file
existence, not heading existence or prose accuracy.
Commands used no live providers, paid APIs, remote publication, destructive
cleanup, or release publication. Tests establish their exercised behavior;
passing them does not validate every prose claim. External URLs were treated as
references, not as evidence that current upstream services or tools were tested
live.
Historical release notes were read as records of their tagged versions.
Accepted ADR context and consequences were distinguished from current behavior
references; the policy permits a decision to precede implementation. Existing
audit records describe pending findings. None of these were treated as a claim
that historical or proposed behavior must be implemented now.
## Current Architecture
Narratio is a fixed-stage Go orchestrator:
`prepare → transcribe → merge → polish → normalize → trim → render → extract → analyze → publish → notify → cleanup`.
Notify is currently a no-op. The application owns CLI composition, acquisition,
session locking, planning, execution, and restore. ConfigKit owns configuration
resolution through its final handoff; Narratio derives separate domain catalogs
and plans. CommandKit and ckconfig provide native CLI and inspection behavior.
Stages coordinate WhisperX HTTP transcription, Seriatim transcript operations,
Audita polishing, Notarius extraction, and Scriptorium bounds/analysis. Typed
speaker and analysis checkpoints share a manifest persistence boundary.
Manifest-backed product identities govern reuse and resolution. Completed
products occupy flat transcript/artifact locations; run-local attempts retain
diagnostics and expose latest-attempt views. Publication uploads immutable
objects and a commit before advancing the current pointer. Restore verifies
declared objects and installs the manifest last; authorized cleanup separately
removes local run history. ReleaseKit owns native release mechanics.
## DOC-01 — P2: Recovery examples publish before the stated inspection step
Status: Open
**Documentation.** [Troubleshooting](../../troubleshooting.md), lines 690–696,
instructs operators recovering an unsupported manifest to run an unbounded
`narratio run`, then force publish. The following sentence says to inspect the
regenerated records and publish explicitly. Its publish-failure section also
places `run ... --stage publish --force` in the **Diagnostics** block
(lines 884–889), alongside inspection commands.
**Implementation and discrepancy.**
[BuildFullPlan](../../../internal/app/planner.go), line 127, and
[the canonical registry](../../../internal/stage/placeholders.go), line 61,
include publish, notify, and cleanup in an unbounded run. The command can
therefore advance remote current state before the proposed inspection, and can
remove run diagnostics when automatic cleanup is enabled. The subsequent force
publish is a second publication attempt. The command in the diagnostics block
also performs publication rather than inspection. These effects agree with the
[CLI](../../cli.md#run) and
[operations guide](../../operations.md#publish-workflow), but not the recovery
sequence implied by the troubleshooting text. The assembled full-run test
checks the complete canonical order.
**Correct behavior and remediation.** If inspection before publication is the
intended recovery workflow, bound regeneration through `analyze`, inspect the
results, and then publish explicitly. Move the forced publish command from
diagnostics to the repair/retry step, identifying its remote mutation. A viable
alternative is to retain the full-run recovery example and explicitly describe
its publication and possible cleanup effects, removing the claim that
inspection precedes publication. This finding calls for truthful instructions,
not an additional CLI confirmation or publication restriction.
## DOC-02 — P3: Operator guidance incorrectly requires force after enablement
Status: Open
**Documentation.** [Operations](../../operations.md), lines 196–201, says that
successful no-output render, publish, and analyze results are reused on later
runs and tells operators to force the stage after enabling or configuring it.
This contradicts the same document's semantic-resume explanation and the
focused [render](../../internal/stage-render.md),
[publish](../../internal/stage-publish.md), and
[analyze](../../internal/stage-analyze.md) documents.
**Implementation and discrepancy.** Render enablement is included by
`renderStage.SemanticConfigFingerprint` in
[semantic_contracts_refinement.go](../../../internal/stage/semantic_contracts_refinement.go),
line 130. Publish enablement/upload policy is likewise fingerprinted in
[semantic_contracts_delivery.go](../../../internal/stage/semantic_contracts_delivery.go).
The sensitivity tests cover these changes. Analysis
[resume reconciliation](../../../internal/stage/analyze_resume.go), line 13,
plans newly selected or newly enabled missing artifacts. The shared
[execution decision](../../../internal/app/run_control.go), line 45, runs a
succeeded stage when its resume evidence is non-current without requiring force.
**Correct behavior and remediation.** An ordinary invocation selecting the
affected stage detects these observable configuration changes. Force remains
appropriate for intentional replacement of current results or private upstream
changes Narratio cannot observe. Correct the operator paragraph and link to the
focused evidence descriptions. Alternatively, replace the repeated enablement
explanation with a short link to that resume contract. Preserve the distinction
between successful no-output results and explicit self-skips.
## DOC-03 — P3: Internal resume summaries describe obsolete fingerprint inputs
Status: Open
**Documentation and implementation.** Three related descriptions have drifted:
- [Analyze](../../internal/stage-analyze.md), lines 79–83, includes effective
render-debug behavior in the artifact fingerprint. The payload and artifact
structs in [analyze_fingerprint.go](../../../internal/stage/analyze_fingerprint.go),
lines 49–63, contain no debug selection. The explicit
`TestAnalyzeFingerprintIgnoresRenderDebugSelection` test in
[analyze_fingerprint_test.go](../../../internal/stage/analyze_fingerprint_test.go),
line 136, verifies that toggling it preserves product identity.
- [Prepare](../../internal/stage-prepare.md), lines 67–73, includes stable-input
ownership and a party mode in its fingerprint description.
[semantic_contracts_initial.go](../../../internal/stage/semantic_contracts_initial.go),
lines 19–40 and 98–168, records stable input kind/presence and the players
schema, not source ownership or a selectable party mode. Its source comment
expressly keeps ownership as provenance. The sensitivity test verifies that
changing source ownership or relocating equivalent sources preserves the
fingerprint.
- [Manifest](../../internal/manifest.md), lines 275–289, lists extraction,
analysis, and cleanup validators and describes prepare reuse as an aggregate
fingerprint alone. Prepare also implements
[ValidateResume](../../../internal/stage/prepare_resume.go), line 36, checking
current sources and durable prepared files. The nearby transcribe row already
acknowledges its speaker reconciliation; the overview should distinguish
these validators consistently.
**Correct behavior and remediation.** Debug selection and stable-input
ownership alone do not change these product fingerprints. Prepare combines
semantic configuration with content/source validation; its fingerprint alone
does not establish reuse. Update the summaries from these current typed
payloads and validator implementations. A smaller alternative is to remove
duplicated field inventories from the manifest overview and link to each stage's
corrected resume section. Do not change fingerprint contracts or add
invalidation to satisfy the obsolete prose.
## DOC-04 — P3: Seriatim reports are documented as canonical artifact outputs
Status: Open
**Documentation.** The output lists in
[merge](../../internal/stage-merge.md), line 16, and
[normalize](../../internal/stage-normalize.md), line 14, advertise
`artifacts/seriatim.report.json` and
`artifacts/seriatim.normalize.report.json`.
**Implementation and discrepancy.**
[merge.go](../../../internal/stage/merge.go), line 82, selects the run-local
logs directory for its report, and
[normalize.go](../../../internal/stage/normalize.go), lines 74–80, does the same.
Each stage returns only its canonical transcript as `Outputs`; an enabled report
is included in `Logs`. The reports are available through the corresponding
latest-attempt log view and follow run-history retention. They are not promoted
into the flat canonical artifact directory. The existing descriptions also
conflict with the content classification in
[ADR 0001](../../adr/0001-classify-session-content.md) and the
[workspace reference](../../operations.md#local-state-layout).
**Correct behavior and remediation.** List the transcript as the substantive
stage output and describe the optional report as a diagnostic. Link to the
operations owner for physical placement and retention. Alternatively, give
outputs and diagnostics separate subsections with that same ownership link.
Moving report files back into canonical artifacts would reverse the selected
workspace design and is not a documentation fix.
## DOC-05 — P3: Annotated example comments retain obsolete contracts and defaults
Status: Open
**Documentation.** [pipeline.full.annotated.yml](../../../examples/pipeline.full.annotated.yml)
contains three misleading annotations despite being valid executable YAML:
- Line 210 says configured-artifact input sources require matching authored
`depends_on` membership.
- Line 27 labels `OBJECT_STORAGE_KEY_ID` and `OBJECT_STORAGE_KEY` as defaults.
- Line 7 describes cleanup as removing a run-scoped work directory, omitting
its current whole-session run-history scope.
**Implementation and discrepancy.**
[resolveArtifactDependencies](../../../internal/config/artifact_dependencies.go),
line 17, infers dependencies from configured-artifact inputs and unions them with
explicit ordering edges. The
[dependency tests](../../../internal/config/artifact_dependencies_test.go) and
the maintained split bundle exercise input-only edges. These inputs do not
require a duplicate authored `depends_on` entry.
S3 credential references default to absent. The
[S3 constructor](../../../internal/adapters/storage/s3_backend.go), line 77,
uses explicit captured static values only when the pair is configured;
otherwise the default provider chain is retained. The names in the example are
operator-selected references, not automatically recognized defaults.
[buildCleanupPlan](../../../internal/stage/cleanup_plan.go), line 27, targets
the session's entire runs directory after authorization. This includes earlier
failed attempts and diagnostics, as correctly described in
[operations](../../operations.md#cleanup).
**Correct behavior and remediation.** Correct these comments and link to the
configuration and cleanup owners where details are needed. An alternative is
to remove volatile explanatory comments and retain only short labels plus those
links. Example-loading tests validate the YAML and effective domain values;
they cannot detect incorrect natural-language annotations. No new dependency,
credential alias, or cleanup contract is needed.
## DOC-06 — P3: Internal credential ownership descriptions predate native bootstrap
Status: Open
**Documentation.** [File operations](../../internal/fileops.md), lines 37–39,
assigns credential mode policy and environment precedence to `internal/app`.
[Adapters](../../internal/adapters.md), lines 85–88, says application-owned
object-store construction loads filesystem secrets before invoking the factory.
**Implementation and discrepancy.**
[configurationAcquisition.Pipeline](../../../internal/app/configuration_acquisition.go),
line 65, prepares the selected source before its typed load. The production
dependency in [command_dependencies.go](../../../internal/app/command_dependencies.go),
lines 29–36, delegates this to
`configkit.LoadSecretsIntoEnvironmentFromConfig`.
[Object-store construction](../../../internal/app/object_store.go), lines 11–29,
only invokes the configured factory with already-resolved configuration; it
does not load or inspect credential files. Permission requirements are operator
policy in [operations](../../operations.md#workspace-permissions).
The stale descriptions assign implementation responsibilities to Narratio that
the native integration deliberately moved upstream. They disagree with
[ADR 0003](../../adr/0003-assign-configuration-ownership.md), the
[configuration reference](../../config.md#secrets-handling), and
[configuration internals](../../internal/configuration.md).
**Correct behavior and remediation.** Describe invocation acquisition as the
caller of ConfigKit's configured startup, and the storage factory as a consumer
of resolved values. Link to ConfigKit for bootstrap/precedence behavior and to
operations for local credential permissions. Removing credential-policy prose
from the generic file helper document is a viable simpler alternative. This
does not call for restoring Narratio-side bootstrap, file-mode enforcement, or
upstream configuration inspection.
## DOC-07 — P3: Internal glossary inventories omit the combined prepared document
Status: Open
**Documentation.** [Manifest](../../internal/manifest.md), line 377, describes
four prepared glossary kinds. [Publish](../../internal/stage-publish.md), line 64,
and [restore](../../internal/command-restore.md), line 40, likewise describe
four prepared glossary documents carried across publication and restore.
**Implementation and discrepancy.** Preparation produces five envelopes:
party, campaign, setting, spells, and combined. The inventory in
[prepare resume](../../../internal/stage/prepare_resume.go), line 57, verifies
all five. [collectPublishPreparedInputs](../../../internal/stage/publish_sources.go),
line 31, includes both the four individual descriptors and the combined
descriptor. The
[prepared-input publication test](../../../internal/stage/publish_prepared_test.go),
line 61, checks all five remote declarations. The
[committed restore test](../../../internal/app/restore_commit_test.go), line 46,
includes and restores `glossaries/combined.yml`.
The [configuration reference](../../config.md#glossary-inputs), prepared source
inventory, and prepare output list already describe the combined product. It is
important to distinguish five retained inputs from the four individual
glossaries intentionally passed to Audita.
**Correct behavior and remediation.** Update the manifest/publish/restore
summaries to include the combined prepared input. Prefer linking to the
prepared-input inventory instead of repeating counts in multiple documents.
Explicitly listing five names in each location is viable but increases drift
risk. Keep Audita's four-file invocation description unchanged.
## DOC-08 — P3: Logging package documentation advertises a removed responsibility
Status: Open
**Documentation.** [logging/doc.go](../../../internal/logging/doc.go), line 1,
says the package provides structured logger construction.
**Implementation and discrepancy.**
[logging.go](../../../internal/logging/logging.go) defines the `Reporter`
interface and nil-safe Info/Warn/Debug/Progress forwarding helpers. It exposes
no logger constructor. Invocation presentation is supplied through the native
CommandKit boundary. The current
[internal overview](../../internal/overview.md) describes the small reporting
interface correctly.
**Correct behavior and remediation.** Update the package summary to identify
the reporting interface and helpers. Alternatively, use a short reference to
the implemented reporting owner. No logger factory or new logging abstraction
is required; this is a stale GoDoc comment.
## Existing Implementation Gaps And Audit Boundaries
Some documentation/implementation mismatches already have implementation
findings. They remain pending rather than becoming additional prose fixes:
- EH-01 in the [error-handling audit](06-error-handling.md): identified domain
configuration failures can exit 1 instead of the documented input status 2.
Preserve the selected exit-status contract when fixing classification.
- CN-03 in the [concurrency audit](04-concurrency.md): the exceptional late-reap
path can return before ownership settles, contrary to the documented
subprocess lifecycle. Do not erase that selected ownership boundary merely
to match the defective branch.
- FC-01/FC-02 in the [correctness audit](01-correctness.md) and CX-01 in the
[complexity audit](03-complexity.md) cover previous-input dependency closure,
carried-publication/restore authority, and inconsistent audio discovery.
Those need their recorded implementation decisions and tests, not a general
weakening of current manifest or input contracts.
The reviewed release runbook agrees with the module-selected ReleaseKit tool,
release profile, CI toolchain, three build targets, delivery token mapping, and
source-tag completion boundary. The maintained CLI command tree and native
inspection walkthrough are current. No additional platform support, live
upstream compatibility result, historical-note rewrite, or stronger runtime
guarantee is proposed by this audit.
## Review Outcome
Eight documentation findings warrant follow-up. Prioritize DOC-01's recovery
sequence because it changes the consequences of copying the instructions.
The remaining findings correct stale behavior, path, inventory, example, and
ownership descriptions. Use the canonical owners and existing behavioral tests
when updating them; no production-code changes are required to resolve these
eight documentation findings.

View File

@@ -0,0 +1,967 @@
# Consolidated Audit Catalog
Catalogued: 2026-12-01
Repository baseline: `191bd4342bc75246caf8bd3d65f33fb8f5f0b8df`.
## Scope And Use
This catalog accounts for **53 findings across all 11 audit reports** in this
directory, consolidated into **43 entries: one P1, twelve P2, and thirty P3**.
Every original finding belongs to one catalog entry. Original-entry links retain
the detailed code references, evidence, alternatives, and qualifications.
The original source reports retain their historical open statuses and evidence.
The catalog records subsequent verified remediation without changing those reports.
Only audit documents changed between the first audit's code baseline and this
review's baseline. The original evidence therefore concerns the same application
code as it stood at the audit baseline; its limits still apply: source-established hazards are distinct from
dynamically reproduced failures, and green tests do not disprove unexercised
conditions.
Entries are ordered first by the highest source priority and then by likely
consequence and breadth: data safety and lifecycle integrity, valid-workflow
failures/resource pressure, followed by maintainability and smaller hygiene
corrections. Ordering within a priority is a review judgment, not a new severity
assessment or a measured production-impact ranking.
This is an inventory, not a staged implementation plan. Directions summarize the
audits' possible remedies without closing unresolved operational choices.
Required regression work is included with its associated production finding;
the independent S3-upload test gap remains separate. Related entries identify
shared change surfaces, not extra prerequisites.
## Remediation Ownership And Remaining Decisions
The [session-restore roadmap](../session-restore.md) owns the agreed redesign for
importing published artifacts. The [audio-inputs roadmap](../audio-inputs.md) owns
shared audio discovery and the approved multi-format extension of CAT-12.
Disposition notes below relate findings to those roadmaps without expanding
their scope. Unless assigned otherwise, a finding remains independent audit
remediation. Shared code does not make a refactoring a prerequisite or assign
the whole finding to a roadmap.
Ten entries are closed by the safety, transfer, and audio discovery work; 33
remain open. **Planned** identifies an agreed remedy awaiting
implementation. **Potentially eliminated** requires verification that the offending
lifecycle is removed. **Coordinate** identifies shared changes, not a commitment
that the roadmap implements the entire finding. Findings close only after their
relevant behavior or code removal is verified. Original audit reports, finding
identities, priorities, and source links remain unchanged.
Directions for CAT-01, CAT-02, CAT-04, CAT-05, and CAT-09 reflect subsequent agreed choices.
CAT-12 also reflects the approved audio selection and naming decisions.
Other direction paragraphs retain the audit's candidate remedies; agreed
choices and roadmap ownership are identified by the disposition notes.
Decisions on [audio generation/size handling](discussion.md#4-keep-downloaded-audio-and-its-source-identity-together),
[subprocess completion](discussion.md#5-finish-subprocess-shutdown-before-releasing-its-files),
[publication source lifetimes](discussion.md#6-open-publication-sources-as-they-are-needed),
and [audio selection and naming](discussion.md#7-give-preparation-and-inspection-the-same-audio-selection-rules)
are agreed and implemented. Topic 1
records cancellation-aware workspace lock waiting, now implemented. Remote checkpoint timing and
failure handling are deferred, not decisions blocking publication import.
## Consolidation Decisions
- Production defects and their matching test gaps share entries: CN-01/TE-04,
FC-02/TE-02, CN-03/TE-05, FC-01/TE-03, and EH-01/TE-06.
- Repeated ownership findings share entries: CX-01/BN-04, CX-02/EQ-04,
CX-05/EQ-03/BN-05, and CX-06/BN-03. The last entry retains CX-06's broader
extraction-evidence consideration as well as publication.
- Related but distinct problems remain separate: graph ownership versus
repeated reverse-index construction; prerequisite selection versus history
hydration; extraction protocol ownership versus large-function decomposition;
transfer-size enforcement versus sibling-temp reuse; and manual-clean safety
versus its dead file-target branch.
- Cross-references in audit summaries are not counted again. Deliberately
retained behavior, rejected generalizations, and areas with no actionable
finding are outside this catalog.
## Architecture Context
Narratio remains a fixed-stage orchestrator. The application coordinates
invocations, locks, plans, stages, and restore; adapters own external transports.
ConfigKit supplies completed configuration, CommandKit/ckconfig supply native
CLI/inspection, and Narratio derives separate domain catalogs. Manifest-backed
speaker/artifact checkpoints govern product reuse. Publication selects immutable
snapshots through a current pointer, restore installs manifest authority last,
and cleanup has a separate authorization/lifecycle. See the
[implemented overview](../../internal/overview.md) and
[architecture policy](../../policy/architecture.md).
## Prioritized Findings
### CAT-01 — P1: Coordinate whole-session deletion with active invocations
Status: Closed
**Closure.** The stable workspace lock and command wiring are covered by `internal/artifacts/local_test.go` and `internal/app/clean_lock_test.go`.
Acquisition-path progress reporting and its command-level regression were
completed in `89c8e5d`; the review follow-up is resolved.
**Disposition / owner.** Independent locking remediation — the [agreed direction](discussion.md#1-coordinate-destructive-cleanup-with-other-work)
permits one workspace-wide lock. Restore will use that coordination, but the
[restore roadmap](../session-restore.md) does not own this fix. Cancellation-aware
waiting is implemented and verified.
Original findings: [CN-01](04-concurrency.md#cn-01--p1-whole-session-cleaning-bypasses-and-can-dismantle-session-exclusion),
[TE-04](08-testing.md#te-04--p2-whole-session-cleanup-tests-never-contend-with-an-active-invocation).
**Original issue.** Manual `session clean` and `--all` bypass session locking and can
delete the in-tree lock pathname while a run, restore, or preflight still holds
its inode. A new invocation can then lock a replacement inode and overlap the
original writer. Existing cleanup tests never combine manual deletion with an
active invocation.
**Agreed remedy.** Use a stable coordination identity or admission gate that survives
deletion, including admission of new sessions during `--all`. Use
cancellation-aware waiting and identify the lock being waited on. Add real-lock,
controlled-interleaving coverage for deletion, a second contender, and cancellation
while waiting. The already-locked final cleanup stage is a different operation.
Related: [CAT-39](#cat-39--p3-simplify-manual-clean-to-its-live-directory-only-contract).
### CAT-02 — P2: Make restored carried products agree with manifest authority
Status: Open
**Disposition / owner.** Planned — the [restore roadmap](../session-restore.md#build-and-consume-restore-defined-completion)
owns this remedy. Its publication-import and synthesized-completion model
supersedes historical producer-evidence reconciliation; implementation and the
original round-trip regression outcomes remain outstanding.
Original findings: [FC-02](01-correctness.md#fc-02--p2-carried-publication-bytes-conflict-with-restored-manifest-evidence),
[TE-02](08-testing.md#te-02--p2-publication-and-restore-tests-do-not-prove-carried-output-authority-is-coherent).
**Issue.** After publishing A, locking its source, generating B locally, and
republishing, the remote commit carries A while its session-manifest snapshot
retains B's completion evidence. Restore can succeed with A's bytes and B's
checksum/fingerprint authority; normal resolution then rejects the restored
product. Separate publish/restore tests miss this interaction.
**Direction.** Implement the roadmap's publication import and locally synthesized
completion instead of restoring historical execution evidence. Retain
publish–lock–regenerate–republish–restore–resolve round trips for built-in and
configured outputs, verifying usable restored products without reconstructing
their historical generation fingerprints or provenance.
Related: [CAT-20](#cat-20--p3-share-typed-publication-control-evidence-across-producer-and-consumers).
### CAT-03 — P2: Enforce non-forced session creation at the write boundary
Status: Closed
**Closure.** Exclusive local creation and conditional remote upload are covered by `internal/app/session_init_conflict_test.go`.
Original findings: [CN-02](04-concurrency.md#cn-02--p2-session-initializations-no-overwrite-check-is-not-atomic).
**Original issue.** Local stat-then-write and remote Exists-then-unconditional-upload allow
concurrent `session init` calls to overwrite a destination without `--force`. Both
can report success; local writes can also truncate or mix content.
**Agreed remedy.** Use exclusive local creation and the existing remote absence
precondition for non-forced writes. Keep deliberate forced replacement separate
and test competing creators. A preliminary existence check may inform diagnostics
but cannot authorize the later write.
### CAT-04 — P2: Bind prepared S3 audio bytes to their observed generation
Status: Closed
**Closure.** Response-bound audio identity, replacement, reuse, and rollback are covered by `internal/audio/s3_audio.go` and `internal/stage/prepare_test.go`.
**Disposition / owner.** Independent audio-acquisition remediation — [discussion topic 4](discussion.md#4-keep-downloaded-audio-and-its-source-identity-together)
selects accepting the raw-audio generation actually downloaded; this is implemented
and verified. This is separate from the
[audio-inputs roadmap's discovery changes](../audio-inputs.md#relationship-to-other-work).
The [restore roadmap](../session-restore.md)
relaxes generation-history requirements for imported products, not source identity
for local audio reuse.
Original findings: [CN-04](04-concurrency.md#cn-04--p2-s3-audio-provenance-can-combine-two-object-generations).
**Original issue.** Preparation records listing metadata from generation A but can download
same-sized generation B. Its checksum then describes B while source provenance
describes A, allowing incorrect reuse after a remote rollback.
**Agreed remedy.** Retain metadata from the same opened response as the streamed body.
Accept and record that observed raw-audio generation when the download passes
existing acquisition checks, even if it differs from the earlier listing.
Test replacement between listing and reading, including rollback/reuse. This
corrects per-object consistency without a whole-session snapshot guarantee or
automatic retries until sources stop changing.
Related: [CAT-06](#cat-06--p2-stop-known-size-downloads-before-oversized-bodies-exhaust-staging-space).
### CAT-05 — P2: Retain subprocess and stream ownership through delayed completion
Status: Closed
**Closure.** Waiter joining and delayed output ownership are covered by `internal/adapters/subprocess/execution.go` and `execution_test.go`.
**Disposition / owner.** Independent subprocess remediation — [discussion topic 5](discussion.md#5-finish-subprocess-shutdown-before-releasing-its-files)
selects joining process/output completion after bounded termination escalation,
before releasing resources; this is implemented and verified. Publication import
does not remove downstream process ownership.
Original findings: [CN-03](04-concurrency.md#cn-03--p2-the-exceptional-subprocess-reap-timeout-releases-ownership-too-early),
[TE-05](08-testing.md#te-05--p2-subprocess-lifecycle-tests-do-not-exercise-a-delayed-reap-after-escalation).
**Original issue.** The exceptional final reap timeout can return without receiving the
wait result. `ProcessState` inspection, redactor flushing, diagnostic closure, and
caller-owned result-file closure can then overlap a still-active waiter or stream
copier. Current tests exercise ordinary shutdown or pre-populated completion, not
delayed completion beyond escalation.
**Agreed remedy.** Retain bounded graceful-to-forceful escalation, then join process
and output completion before reading process state, flushing/closing diagnostics,
or returning resource ownership to callers. Add a controlled delayed-wait/stream
test for release ordering and preserved error causes. Exceptional I/O delays can
outlast escalation timers; no absolute return-time guarantee or early-return
ownership handoff is required.
### CAT-06 — P2: Stop known-size downloads before oversized bodies exhaust staging space
Status: Closed
**Closure.** Bounded response streaming and consumer regressions are covered by `internal/adapters/storage/stream_test.go`, `internal/app/restore_commit_test.go`, and `internal/stage/prepare_previous_test.go`.
**Disposition / owner.** Coordinate — the [restore roadmap](../session-restore.md#existing-restore-controls-remain-useful)
touches verified downloads. Transfer-size enforcement remains a separate audit
remediation across all listed callers. [Discussion topic 4](discussion.md#4-keep-downloaded-audio-and-its-source-identity-together)
approves bounded known-size streaming with existing unknown-size behavior; this
is implemented and verified.
Original findings: [RS-02](05-resources.md#rs-02--p2-known-size-downloads-consume-the-full-response-before-rejecting-oversize).
**Original issue.** Restore, previous-input hydration, S3 audio, and immutable-object
verification can know the expected size yet copy the entire body before rejecting
oversize. Invalid responses can fill temporary storage and hold the session lock
unnecessarily.
**Agreed remedy.** Enforce the existing known size during transfer, with correlated
response metadata and size-plus-one detection, then close/remove failed staging.
Retain checksum/generation checks and installation ordering. Test early rejection
and destination preservation; a declared zero size is known. Unknown-size audio
needs no newly invented universal cap.
Related: [CAT-04](#cat-04--p2-bind-prepared-s3-audio-bytes-to-their-observed-generation), [CAT-21](#cat-21--p3-share-closed-sibling-temporary-file-creation-mechanics).
### CAT-07 — P2: Correct recovery instructions that publish before inspection
Status: Closed
**Closure.** Inspection-first regeneration and the mutating retry are corrected in `docs/troubleshooting.md`; documentation checks pass.
**Disposition / owner.** Coordinate documentation — the [restore roadmap](../session-restore.md#align-policies-and-canonical-documentation)
changes recovery guidance. Explicitly verify the inspection-before-publication
sequence; a restore documentation rewrite alone does not close this finding.
Original findings: [DOC-01](13-documentation.md#doc-01--p2-recovery-examples-publish-before-the-stated-inspection-step).
**Original issue.** Troubleshooting's unsupported-manifest recovery invokes a full run,
then force publish, while describing inspection before explicit publication. The
first command can already publish and run authorized cleanup. A separate
diagnostics block also includes a mutating forced publish.
**Agreed remedy.** For inspection-first recovery, bound regeneration through analyze,
inspect, and then publish. Alternatively, describe the full run's
publication/cleanup effects accurately. Move publication retries out of the
inspection-only diagnostics sequence. This is a documentation correction, not a
new command confirmation or publication restriction.
### CAT-08 — P2: Stream local audio copies instead of buffering whole recordings
Status: Closed
**Closure.** Streaming atomic input copying and replacement behavior are covered by `internal/stage/prepare.go` and `prepare_copy_test.go`.
**Disposition / owner.** Independent copy-resource remediation — coordinate with the
[audio-inputs roadmap](../audio-inputs.md#reuse-and-transport-verification), which
reuses the copy path. Multi-format discovery does not remove whole-file buffering.
Original findings: [EF-01](02-efficiency.md#ef-01--p2-local-audio-copying-buffers-the-complete-recording).
**Original issue.** The changed/missing local-copy path hashes a recording, reads all its
bytes into memory, then writes them atomically. One large speaker file therefore
requires recording-sized auxiliary RAM despite sequential processing.
**Agreed remedy.** Use the existing streaming artifact/file-copy mechanism while
preserving unchanged-destination checks, naming, workspace modes, atomic
visibility, and recorded checksums. The improvement is O(1) auxiliary buffering
relative to file size, not asymptotically faster I/O. No new audio-size limit is
required.
### CAT-09 — P2: Bound publication's simultaneously open source descriptors
Status: Closed
**Closure.** Sequential confined source transfers, same-handle uploads, and pointer preservation are covered by `internal/stage/publish_transfer.go` and `publish_lifetime_test.go`.
**Disposition / owner.** Independent publication-resource remediation — coordinate with the
[roadmap's snapshot removal](../session-restore.md#decouple-remote-discovery-from-execution-snapshots).
Removing one manifest source does not bound the remaining descriptors;
[discussion topic 6](discussion.md#6-open-publication-sources-as-they-are-needed)
selects sequential source opening, verification, upload, and closure, accepting
late-source failure after unselected uploads. This is implemented and verified.
Original findings: [RS-01](05-resources.md#rs-01--p2-publication-retains-one-open-descriptor-per-source).
**Original issue.** Publication retains descriptors for every run file, previous-cache
source, selected output, and committed manifest until its final defer, although
uploads are sequential. Valid larger inventories can exhaust lower process
descriptor limits before transfer begins.
**Agreed remedy.** Plan identities, destinations, and rules upfront; then open,
verify, upload, and close sources one at a time. Preserve confined regular-file
opening, checksum checks, and hashing/uploading through the same descriptor.
Validating every source before any upload is no longer required. A late invalid
source may leave an unselected attempt, while pointer-last publication preserves
the current selection on failure. No artifact-count cap, source-snapshot system,
or new cleanup subsystem is needed.
Related: [CAT-14](#cat-14--p3-close-temporary-committed-manifest-cleanup-gaps).
### CAT-10 — P2: Hydrate previous inputs for the full analysis prerequisite closure
Status: Open
**Disposition / owner.** Coordinate — the [restore roadmap](../session-restore.md#adapt-preparation-and-operator-reporting)
changes preparation and previous-session acquisition. The prerequisite-inclusive
requirement fix still needs explicit implementation and regression coverage;
publication-inventory-only discovery does not supply the missing closure.
Original findings: [FC-01](01-correctness.md#fc-01--p2-previous-session-hydration-omits-analysis-prerequisites),
[TE-03](08-testing.md#te-03--p2-previous-session-hydration-coverage-stops-short-of-dependency-closure).
**Issue.** Preparation and previous-cache restore collect history requirements
from enabled/explicit targets only, while analyze separately schedules
prerequisites. A prerequisite's required history can remain unavailable despite an
available remote product; optional history can disappear silently. Existing tests
cover these mechanisms separately.
**Direction.** Use one prerequisite-inclusive requirements view for preparation,
semantic evidence, store composition, and restore. Retain explicit targets
separately for force/publication policy. Add selected-child/disabled-prerequisite
preparation-to-analysis coverage for required and optional history, unrelated-work
exclusion, and restore.
Related: [CAT-17](#cat-17--p3-centralize-configured-artifact-dependency-queries).
### CAT-11 — P2: Verify the bytes supplied to the production S3 upload adapter
Status: Closed
**Closure.** SDK-boundary upload bytes and reader failures are covered by `internal/adapters/storage/s3_backend_test.go`.
Original findings: [TE-01](08-testing.md#te-01--p2-s3-upload-tests-do-not-verify-the-transmitted-content).
**Original issue.** The SDK fake records upload requests without consuming their bodies.
Replacing the production body with unrelated fixed bytes survived the full suite;
higher-level storage fakes bypass that mapping. This is a demonstrated protection
gap, not a finding that the unmodified adapter sends wrong bytes.
**Agreed remedy.** Consume and compare upload bytes in the narrow SDK fake for file
and conditional-reader uploads, retaining key/precondition assertions and
appropriate stream-error coverage. A local HTTP SDK test is an alternative; live
S3 is unnecessary.
### CAT-12 — P2: Share audio discovery and accept valid same-basename recordings in inspection
Status: Closed
**Disposition / owner.** Implemented and verified under the
[audio-inputs roadmap](../audio-inputs.md) and
[discussion topic 7](discussion.md#7-give-preparation-and-inspection-the-same-audio-selection-rules).
**Closure.** `internal/audio` owns local and S3 selection, prepared names, and
speaker-ID collision checks. Preparation, reuse, and inspection consume these
selections; transcription accepts manifest-selected files and uses the shared
filter for fallback. Audio discovery and real preparation/inspection tests cover
same-basename and mixed-format selection; transcription retry and WhisperX HTTP
and replay tests cover durable reuse and byte-preserving transport. Full tests,
race tests, vet, and build pass on Go 1.27.4.
Original findings: [CX-01](03-complexity.md#cx-01--p2-audio-discovery-is-duplicated-and-inspection-rejects-valid-inputs),
[BN-04](11-boundaries.md#bn-04--p3-audio-discovery-is-owned-independently-by-preparation-and-inspection).
**Issue.** Preparation and operator inspection independently implement source
resolution, filtering, eligibility, duplicates, and ordering. Preparation
preserves distinct same-basename recordings with unique prepared names; inspection
rejects them. The audits also identify differing duplicate-path and
file-eligibility handling.
**Direction.** Give read-only audio selection a shared owner, preferably
`internal/audio`. Keep materialization and checkpoint transitions in preparation
and reporting in app. Apply the approved regular-file requirement and the
roadmap's shared case-insensitive filter for automatic discovery; explicit local
file selections and manifest-registered audio remain extension-agnostic. Preserve
duplicate-resolved-source rejection, existing local prepared-name disambiguation,
and the separately selected S3 basename rule. Retain stem-based speaker IDs and
reject remaining cross-extension stem collisions during discovery, identifying
both sources after existing disambiguation. Verify consistent mixed-format
selection, downstream acceptance, transport, and local retry across consumers
without imposing backend codec guarantees.
Related: [CAT-13](#cat-13--p2-give-s3-session-planning-the-evidence-needed-for-truthful-reuse-decisions).
### CAT-13 — P2: Give S3 session planning the evidence needed for truthful reuse decisions
Status: Open
**Disposition / owner.** Independent planning/preflight remediation — the [agreed decision](discussion.md#3-inspect-s3-when-planning-and-preflighting)
selects read-only S3 checks for both commands. Coordinate with the
[restore roadmap's planning changes](../session-restore.md#preparation-and-readiness-support-artifact-only-execution);
skipping covered audio work does not fix planning for raw-audio sessions. Use the
[audio roadmap's shared selection rules](../audio-inputs.md#one-selection-responsibility)
when composing raw-audio evidence; discovery consolidation alone does not supply
the missing remote collaborator.
Original findings: [FC-03](01-correctness.md#fc-03--p2-session-planning-reports-reusable-s3-preparation-as-changed).
**Issue.** The planning projection omits the object store needed to inspect S3
audio identities. Resume converts that missing collaborator into 'inputs changed',
so plan can predict prepare reruns and dependent invalidation while actual
execution reuses identical evidence.
**Direction.** Supply read-only remote identities to the shared planning decision,
or explicitly report conditional/unverified evidence if remote inspection is
intentionally unavailable. Test unchanged, changed, and unavailable identities
while proving no workspace mutation. Keep this distinct from local audio discovery
disagreement.
Related: [CAT-12](#cat-12--p2-share-audio-discovery-and-accept-valid-same-basename-recordings-in-inspection).
### CAT-14 — P3: Close temporary committed-manifest cleanup gaps
Status: Open
**Disposition / owner.** Potentially eliminated — the [restore roadmap](../session-restore.md#decouple-remote-discovery-from-execution-snapshots)
removes unnecessary execution-snapshot publication. Close only after verifying
that the temporary-manifest creation and ownership gaps disappear; repair any
retained lifecycle rather than assuming snapshot removal fixes it.
Original findings: [RS-03](05-resources.md#rs-03--p3-publications-temporary-manifest-has-cleanup-gaps-before-ownership-transfer).
**Issue.** Publication can orphan a system-temp committed-manifest file when
writing/closing fails or opening it fails before the transfer collection accepts
ownership. These files are outside run-history cleanup.
**Direction.** Make the creator own removal immediately, and retain caller cleanup
until transfer ownership is explicit. Exercise write/close/handoff failure paths.
Straightforward deferred cleanup suffices; this is distinct from intentionally
retained attempt diagnostics.
Related: [CAT-09](#cat-09--p2-bound-publications-simultaneously-open-source-descriptors), [CAT-21](#cat-21--p3-share-closed-sibling-temporary-file-creation-mechanics).
### CAT-15 — P3: Preserve input-error classification for resolved domain validation
Status: Open
Original findings: [EH-01](06-error-handling.md#eh-01--p3-domain-configuration-failures-lose-the-cli-input-classification),
[TE-06](08-testing.md#te-06--p3-cli-classification-tests-omit-real-resolved-domain-rejections).
**Issue.** Cross-document storage/audio conflicts and product-destination
collisions return ordinary errors, so commands exit 1 instead of the documented
identifiable-input status 2. Existing tests check rejection or synthetic markers
but do not carry these real failures through the CLI.
**Direction.** Use a narrow cause-preserving domain input marker at the
rejection/classification boundary, or integrate suitable checks with native
validation diagnostics. Add real-command cases for both conflicts, valid
counterparts, and joined operational/cancellation precedence. Environmental
failures stay operational; no new validation rule is needed.
### CAT-16 — P3: Flatten inspection-error aggregation
Status: Open
Original findings: [EF-05](02-efficiency.md#ef-05--p3-publication-inspection-errors-form-a-quadratic-formatting-tree).
**Issue.** Repeated `errors.Join(previous, next)` creates a left-nested
publication-inspection error tree. Formatting F bounded-size failures takes
quadratic cumulative copying and linear nesting, particularly during storage
outages.
**Direction.** Collect ordered failures and join once. Preserve per-output
details, partial results, and `errors.Is`/`errors.As` causes. Existing preflight
collectors provide a local pattern.
Related: [CAT-25](#cat-25--p3-separate-inspectionreadiness-collection-assessment-and-presentation).
### CAT-17 — P3: Centralize configured-artifact dependency queries
Status: Open
**Disposition / owner.** Independent dependency-refactoring owner — the [restore roadmap](../session-restore.md#restore-synthesizes-a-local-completion-baseline)
uses a fixed stage/output coverage mapping, not this configured-artifact graph.
Do not make graph consolidation a prerequisite; coordinate only where existing
artifact reconciliation is actually changed.
Original findings: [CX-05](03-complexity.md#cx-05--p3-artifact-dependency-semantics-span-several-representations-and-owners),
[EQ-03](10-equivalence.md#eq-03--p3-configured-artifact-dependency-mechanics-have-multiple-owners),
[BN-05](11-boundaries.md#bn-05--p3-configured-artifact-graph-operations-are-fragmented-across-domain-owners).
**Issue.** One derived edge relation has separately maintained normalization,
validation adjacency, topological ordering, prerequisite traversal, and
reverse-edge mechanics. Targets-only selection is easily confused with required
work, as the history-hydration defect illustrates.
**Direction.** Expose a small validated dependency view alongside the derived
artifact catalog, or a narrow key/edge package if dependency direction requires
it. Share deterministic order, closure, and dependent queries while retaining
origin diagnostics and caller-owned force/reuse/invalidation policy. Keep
configuration definitions, runtime availability, and the fixed stage relation
distinct.
Related: [CAT-10](#cat-10--p2-hydrate-previous-inputs-for-the-full-analysis-prerequisite-closure), [CAT-18](#cat-18--p3-reuse-the-analysis-reverse-dependency-index-within-an-invocation).
### CAT-18 — P3: Reuse the analysis reverse-dependency index within an invocation
Status: Open
Original findings: [EF-02](02-efficiency.md#ef-02--p3-analysis-rebuilds-the-same-dependency-index-after-each-completion).
**Issue.** Each new/changed completion rebuilds and sorts the unchanged reverse
graph. Independent artifacts still incur quadratic setup work. This performance
issue can be fixed independently of broader graph ownership.
**Direction.** Construct the immutable reverse index once and reuse it for
success/failure invalidation. Preserve traversal ordering, eligibility, and
invalidation timing. Complete-collection checkpoint costs remain separate.
Related: [CAT-17](#cat-17--p3-centralize-configured-artifact-dependency-queries).
### CAT-19 — P3: Describe stable prepared products once for materialization and reuse
Status: Open
**Disposition / owner.** Coordinate — the [restore roadmap](../session-restore.md#adapt-preparation-and-operator-reporting)
changes preparation and reuse. Review the shared stable-product description
there to avoid another parallel inventory; the roadmap does not itself perform
this consolidation or replace evidence for locally prepared products.
Original findings: [CX-02](03-complexity.md#cx-02--p3-prepared-stable-inputs-have-parallel-materialization-and-resume-definitions),
[EQ-04](10-equivalence.md#eq-04--p3-preparation-and-resume-separately-describe-the-same-stable-products).
**Issue.** Preparation, party/player writing, resume reconstruction, managed-kind
matching, and semantic presence repeat stable-product inventories and dependency
mappings. Existing renderers and source descriptors are already shared, but
callers can omit different products.
**Direction.** Use a small stage-owned read-only product description backed by
current descriptors, with separate write and expected-evidence projections.
Preserve snapshot normalization, combined-glossary dependencies, source
relocation, ConfigKit immutability, and bounded presence-only fingerprinting. Keep
audio and previous acquisition explicit and retain independent literal
inventory/corruption tests.
Related: [CAT-34](#cat-34--p3-include-the-combined-glossary-in-prepared-input-documentation).
### CAT-20 — P3: Share typed publication control evidence across producer and consumers
Status: Open
**Disposition / owner.** Coordinate — the [restore roadmap](../session-restore.md#decouple-remote-discovery-from-execution-snapshots)
changes publication consumers and extraction availability. Typed local control
evidence remains a separate simplification; neither snapshot removal nor import
completion automatically centralizes the remaining codecs.
Original findings: [CX-06](03-complexity.md#cx-06--p3-unstructured-metadata-carries-cross-package-control-evidence),
[BN-03](11-boundaries.md#bn-03--p3-machine-consumed-publication-metadata-lacks-a-shared-contract-owner).
**Issue.** Publish writes map-based completion/outcome evidence; cleanup and app
inspection independently reconstruct keys, status strings, types, and in-memory
versus JSON-decoded collection shapes. Extraction has a related producer/reader
metadata boundary.
**Direction.** Start with narrow typed publication values and codecs under an
existing shared owner, preserving the JSON shape. Keep cleanup authorization and
tolerant display policy at their callers. Apply the same treatment to extraction
evidence where useful; leave free-form diagnostics flexible. Test direct and
persistence-round-trip use. Typing does not resolve carried-product authority.
Related: [CAT-02](#cat-02--p2-make-restored-carried-products-agree-with-manifest-authority).
### CAT-21 — P3: Share closed sibling-temporary-file creation mechanics
Status: Open
**Disposition / owner.** Coordinate — the [restore roadmap](../session-restore.md#existing-restore-controls-remain-useful)
retains staging and validation before installation. Reassess the common mechanics
across the surviving download callers; helper extraction remains separate from
both product import and CAT-06's transfer bounds.
Original findings: [EQ-02](10-equivalence.md#eq-02--p3-verified-downloads-duplicate-sibling-temporary-file-ownership).
**Issue.** Audio, previous-input hydration, and ordinary restore repeat creating,
writing, closing, and error-cleaning a sibling temporary file before
domain-specific verification and installation.
**Direction.** Use a small `internal/fileops` helper returning an owned closed
temporary path, or a narrowly scoped cleanup callback. Keep selection,
cancellation, validation, root confinement, and installation with callers. Atomic
reader-copy helpers that install before validation are not substitutes. Retain
representative consumer failure/retry tests.
Related: [CAT-06](#cat-06--p2-stop-known-size-downloads-before-oversized-bodies-exhaust-staging-space), [CAT-14](#cat-14--p3-close-temporary-committed-manifest-cleanup-gaps).
### CAT-22 — P3: Share the minimal transcript-envelope predicate
Status: Open
Original findings: [EQ-01](10-equivalence.md#eq-01--p3-four-boundaries-repeat-the-same-minimal-transcript-shape-validator).
**Issue.** Seriatim, Audita, stage acceptance, and artifact resolution
independently implement the same JSON top-level `segments` array check. Their
surrounding filesystem and diagnostic rules legitimately differ.
**Direction.** Prefer a byte-oriented predicate in existing `internal/contracts`,
leaving acquisition, bounds, file eligibility, and contextual errors at each
boundary. Preserve empty arrays and unrelated members; do not impose segment IDs
or a universal downstream schema. Keep independent literal fixtures and
representative adapter/consumer tests.
### CAT-23 — P3: Move Notarius native output mapping and executable lookup to their boundary
Status: Open
Original findings: [BN-02](11-boundaries.md#bn-02--p3-notarius-output-protocol-translation-partly-lives-in-stage-orchestration).
**Issue.** Stage code implements Notarius lane-ID sanitization and native bundle
filenames, and performs executable discovery shared by execution and readiness.
These are external-protocol/launch details rather than Narratio product policy.
**Direction.** Move native mapping to the existing adapter through a narrow
resolver or requested-output result contract; route executable selection through
adapter/composition. Stages retain required-lane selection, canonical names,
collisions, confinement, bounded JSON checks, checksums, and promotion. This
ownership correction is distinct from decomposing the large stage functions.
Related: [CAT-24](#cat-24--p3-separate-trimextract-invocation-phases-from-product-acceptance).
### CAT-24 — P3: Separate trim/extract invocation phases from product acceptance
Status: Open
Original findings: [CX-03](03-complexity.md#cx-03--p3-trim-and-extraction-mix-invocation-mechanics-with-product-acceptance).
**Issue.** Large stage entry points interleave layout, disabled branches, debug
rendering, native execution, validation, promotion, and metadata. Extraction
readiness and execution also repeat resolved invocation options.
**Direction.** Extract cohesive typed operations and shared invocation options,
keeping explicit orchestration and one final acceptance path where behavior is
shared. Preserve validation before promotion, post-call reference verification,
and failure diagnostics. Avoid a generic stage framework or helpers that only
relocate statements.
Related: [CAT-23](#cat-23--p3-move-notarius-native-output-mapping-and-executable-lookup-to-their-boundary).
### CAT-25 — P3: Separate inspection/readiness collection, assessment, and presentation
Status: Open
**Disposition / owner.** Coordinate — the [restore roadmap](../session-restore.md#adapt-preparation-and-operator-reporting)
changes inspection and readiness for restored inputs. The broader separation of
collection, assessment, and presentation retains independent audit ownership;
do not require it before adding coverage-aware decisions.
Original findings: [CX-04](03-complexity.md#cx-04--p3-inspection-and-readiness-combine-collection-policy-and-presentation).
**Issue.** Operator entry points mix local/remote evidence acquisition,
independent probes, preparation outcomes, cancellation, policy interpretation, and
report mutation. Scriptorium discovery interpretation is interleaved with
transport iteration.
**Direction.** Collect cohesive typed results, isolate tool-specific readiness and
pure requirements interpretation, then project the existing reports. Preserve
partial findings, independent work after ordinary failures, preparation-blocked
checks, cancellation, read-only inspection, and preflight effects. No check
registry or stronger readiness rule is required.
Related: [CAT-16](#cat-16--p3-flatten-inspection-error-aggregation).
### CAT-26 — P3: Place diagnostic-view layout grammar with canonical workspace paths
Status: Open
Original findings: [BN-01](11-boundaries.md#bn-01--p3-diagnostic-view-layout-policy-is-embedded-in-file-operation-mechanics).
**Issue.** Fileops constructs and recognizes Narratio-specific
run/stage/log/debug/probe paths independently of the canonical path owner. A
layout change therefore spans file mechanics and multiple domain callers.
**Direction.** Move the existing view operation to `internal/artifacts` and its
path model, or consider a focused workspace owner if the broader extraction is
justified. Keep ordinary root-scoped file mechanics in fileops and attempt/cleanup
decisions in callers. Retain advancement, failure, self-skip, reuse, and
confinement coverage.
### CAT-27 — P3: Index repeated previous-input and prepared-record lookups
Status: Open
**Disposition / owner.** Coordinate — the [restore roadmap](../session-restore.md#decouple-remote-discovery-from-execution-snapshots)
changes previous-input discovery and prepared-record consumers. Reassess the
surviving scans after those changes; inventory-only selection does not by itself
remove repeated linear lookups.
Original findings: [EF-03](02-efficiency.md#ef-03--p3-previous-session-metadata-is-repeatedly-searched-as-a-list).
**Issue.** Requirement resolution repeatedly scans remote commit declarations,
local input identities are repeatedly selected from manifest lists, and
optional-absence reporting repeatedly searches skipped names.
**Direction.** Build phase-local source/kind indexes and skipped-name membership
sets (or use appropriate sorted lookup). Keep one selected commit, candidate
multiplicity, ambiguity checks, deterministic result order, and content
verification. Index selection rather than caching payloads across invocations.
### CAT-28 — P3: Index restore report action updates
Status: Open
**Disposition / owner.** Coordinate — the [restore roadmap](../session-restore.md#adapt-preparation-and-operator-reporting)
touches restore reporting. Carry or index action identity if that path is changed;
new manifest construction alone does not fix quadratic report updates.
Original findings: [EF-04](02-efficiency.md#ef-04--p3-restore-reporting-performs-a-full-search-after-each-install).
**Issue.** Each restored object's success/failure searches the report's full
action list, yielding quadratic bookkeeping when all actions download.
**Direction.** Use a private composite-key-to-report-index map or carry the
original index with execution actions. Preserve report order and shape and the
separate manifest-last installation order.
### CAT-29 — P3: Correct force-after-enablement guidance
Status: Open
**Disposition / owner.** Coordinate documentation — the [restore roadmap](../session-restore.md#align-policies-and-canonical-documentation)
adds render selection and supplied-baseline reuse. Correct the existing
render/publish/analyze enablement guidance explicitly while distinguishing
ordinary local semantic reuse from restore-defined completion.
Original findings: [DOC-02](13-documentation.md#doc-02--p3-operator-guidance-incorrectly-requires-force-after-enablement).
**Issue.** Operations says newly enabled/configured render, publish, or analyze
requires force, contradicting current fingerprints and reconciliation.
**Direction.** Explain automatic reruns for observable configuration changes when
the affected stage is selected. Reserve force guidance for intentional
current-result replacement or private upstream changes. Link to canonical resume
descriptions rather than repeating stale behavior.
### CAT-30 — P3: Correct internal resume and fingerprint descriptions
Status: Open
**Disposition / owner.** Coordinate documentation — the [restore roadmap](../session-restore.md#align-policies-and-canonical-documentation)
rewrites resume descriptions. Check each original mismatch for locally generated
work as well as documenting the new baseline; do not change fingerprints to
match obsolete prose.
Original findings: [DOC-03](13-documentation.md#doc-03--p3-internal-resume-summaries-describe-obsolete-fingerprint-inputs).
**Issue.** Analyze prose incorrectly includes debug selection in fingerprints;
prepare prose includes source ownership/party mode; the manifest overview omits
prepare's durable source/content validator.
**Direction.** Describe the current typed payloads and prepare's combined
semantic/content checks, or shorten the overview to links to focused stage owners.
Preserve diagnostic-only debug selection and provenance-only ownership. Correct
prose without changing fingerprints to match it.
### CAT-31 — P3: Correct annotated-example dependency, credential, and cleanup claims
Status: Open
Original findings: [DOC-05](13-documentation.md#doc-05--p3-annotated-example-comments-retain-obsolete-contracts-and-defaults).
**Issue.** Comments require redundant authored `depends_on` edges, label example
S3 secret-reference names as defaults, and understate cleanup as one run's work
directory.
**Direction.** State inferred input dependencies, operator-selected credential
references, and whole-session run-history cleanup accurately. Link to the
configuration/operations owners. YAML-loading tests cannot detect incorrect
comments.
### CAT-32 — P3: Document Seriatim reports as diagnostics
Status: Open
Original findings: [DOC-04](13-documentation.md#doc-04--p3-seriatim-reports-are-documented-as-canonical-artifact-outputs).
**Issue.** Merge and normalize output lists advertise canonical `artifacts/`
report files, while implementation retains reports in run-local logs and returns
only canonical transcripts as substantive outputs.
**Direction.** Separate products from diagnostics and link to the
workspace/retention owner. Keep the selected content taxonomy; moving reports back
to canonical artifacts is not a prose fix.
### CAT-33 — P3: Align credential-ownership descriptions with native ConfigKit startup
Status: Open
Original findings: [DOC-06](13-documentation.md#doc-06--p3-internal-credential-ownership-descriptions-predate-native-bootstrap).
**Issue.** Internal fileops/adapter prose assigns credential precedence/mode
responsibility to app and describes bootstrap during object-store construction.
Actual acquisition delegates configured startup to ConfigKit before typed loading,
and storage consumes resolved values.
**Direction.** Describe native startup at acquisition and link upstream for its
semantics; link operations for operator-managed permissions. Remove stale
credential-policy prose from file helpers. Do not restore duplicate bootstrap or
filesystem enforcement in Narratio.
### CAT-34 — P3: Include the combined glossary in prepared-input documentation
Status: Open
**Disposition / owner.** Coordinate documentation — the [restore roadmap](../session-restore.md#align-policies-and-canonical-documentation)
changes prepared-input/publication descriptions. Verify the retained combined
input inventory explicitly; execution-snapshot removal does not make the four
individual Audita inputs a five-input invocation.
Original findings: [DOC-07](13-documentation.md#doc-07--p3-internal-glossary-inventories-omit-the-combined-prepared-document).
**Issue.** Manifest/publish/restore summaries count four retained glossaries,
omitting the combined fifth envelope that is prepared, committed, and restored.
**Direction.** Include combined alongside party/campaign/setting/spells,
preferably linking to one inventory instead of repeating counts. Audita
intentionally receives four individual envelopes; keep that distinct.
Related: [CAT-19](#cat-19--p3-describe-stable-prepared-products-once-for-materialization-and-reuse).
### CAT-35 — P3: Remove assertions on incidental serialization and validation order
Status: Open
Original findings: [TE-07](08-testing.md#te-07--p3-some-assertions-freeze-incidental-serialization-or-validation-order).
**Issue.** A metadata test freezes JSON object-member order and a campaign test
with multiple invalid conditions freezes the first diagnostic. Valid internal
reorderings fail despite equivalent contractual results.
**Direction.** Assert JSON structure/omissions and the intended validation
condition without prescribing irrelevant order. Retain canonical-byte assertions
where bytes actually define fingerprints or remote contracts; do not delete
meaningful boundary tests.
### CAT-36 — P3: Remove confirmed orphaned production and test helpers
Status: Open
Original findings: [DD-01](12-deadcode.md#dd-01--p3-completely-orphaned-helper-functions-remain-in-production-and-tests).
**Issue.** Reachability analysis and source review identify six disconnected
production helpers and six unused test helpers across Notarius, cleanup,
configuration, and fixtures.
**Direction.** Remove the exact source-listed declarations and newly unused
imports/files. Retain live path/bundle validation, supported callbacks, and
independent preparation assertions. Verify current references before deletion; no
replacement abstraction or compatibility shim is needed.
### CAT-37 — P3: Remove unused constants and retired workspace path fields
Status: Open
Original findings: [DD-02](12-deadcode.md#dd-02--p3-unused-constants-and-retired-workspace-paths-advertise-obsolete-concepts).
**Issue.** Six disconnected constants and unused
`SessionPaths.ReportsDir`/`ConfigDir` fields, assignments, and directory constants
preserve obsolete names without providing runtime capabilities.
**Direction.** Delete only the listed inert model elements. Keep active artifact
vocabulary and commit/path helpers. This does not authorize deleting session
directories, changing layout, migrating sessions, or inventing an output fallback.
### CAT-38 — P3: Remove inert extraction descriptor fields and nil-only plumbing
Status: Open
Original findings: [DD-03](12-deadcode.md#dd-03--p3-extraction-still-carries-descriptor-fields-that-the-current-model-discarded).
**Issue.** Four extraction fingerprint fields are JSON-excluded and unused. An
extraction evidence contract field has no non-nil producer and is passed through
redundant extraction-only plumbing.
**Direction.** Remove those fields and extraction-only parameters/copies while
retaining live analyze/catalog/manifest contracts. Existing fingerprint bytes can
remain unchanged. No schema migration, stricter lane check, or retired
configuration descriptor is needed.
### CAT-39 — P3: Simplify manual clean to its live directory-only contract
Status: Open
Original findings: [DD-04](12-deadcode.md#dd-04--p3-manual-cleaning-retains-a-file-target-mode-unavailable-through-its-cli).
**Issue.** Both CLI cleaning modes always pass `directory=true`; file-target
behavior and wrapper variants survive only through unit tests.
**Direction.** Use one live directory validation path and remove the forwarded
mode, file-only branch, and obsolete wrappers/tests. Preserve confinement,
symlink/root/traversal checks, dry runs, missing targets, and deletion scope. This
simplification is separate from the workspace-lock remediation in CAT-01.
Related: [CAT-01](#cat-01--p1-coordinate-whole-session-deletion-with-active-invocations).
### CAT-40 — P3: Remove the superseded publish-default mutation helper
Status: Open
Original findings: [DD-05](12-deadcode.md#dd-05--p3-a-superseded-publish-default-mutation-helper-survives-only-in-a-no-op-test-call).
**Issue.** `applyMissingPublishDestinations` has only a test caller whose explicit
destination makes the call a no-op. Production uses native ConfigKit normalization
and the shared derivation directly.
**Direction.** Remove the obsolete writer and irrelevant call; retain derivation
and explicit-destination protection through the live boundary. Do not alter
configuration ownership or introduce new destination semantics.
### CAT-41 — P3: Remove the duplicate normalized-transcript test
Status: Open
Original findings: [TE-08](08-testing.md#te-08--p3-two-normalized-transcript-tests-are-exact-duplicates).
**Issue.** Two differently named analyze tests have identical bodies and
assertions for the same manifest-authoritative normalized source.
**Direction.** Keep one authority test and delete its exact duplicate. Retain
neighboring source-kind and missing-input cases, which protect different behavior.
### CAT-42 — P3: Discard the unused normalized-path result while retaining validation
Status: Open
Original findings: [DD-06](12-deadcode.md#dd-06--p3-input-hashing-stores-a-normalized-path-that-is-never-consumed).
**Issue.** Input hashing reassigns a normalized relative path that is never used
afterward; only the validation error matters.
**Direction.** Discard the unused return value explicitly. Preserve the
normalization call and error check, which enforce live path confinement.
### CAT-43 — P3: Correct the logging package summary
Status: Open
Original findings: [DOC-08](13-documentation.md#doc-08--p3-logging-package-documentation-advertises-a-removed-responsibility).
**Issue.** GoDoc advertises structured logger construction, but the package
supplies a Reporter interface and nil-safe forwarding helpers, with presentation
supplied by CommandKit.
**Direction.** Update the package summary or link to the implemented reporting
owner. No logger constructor or new logging abstraction is needed.

View File

@@ -0,0 +1,480 @@
# Audit Remediation Discussion
Status: Decisions agreed; safety and transfer work complete; feature work pending
## Purpose
Work through the seven topics raised in the catalog review before preparing a
remediation roadmap. Section numbers match that review and the operator's
responses. They are discussion topics, not implementation stages or catalog IDs.
The [catalog](catalog.md) remains the findings inventory. Its original audit links
own the detailed evidence. This document records decisions, explains consequences,
and distinguishes recommendations from approved scope. No remediation has been
implemented by this document.
Problem descriptions below record the original audit baseline. The catalog owns
current finding status and closure evidence; consult it for remaining work.
The operator has settled the direction for all seven topics, including
cancellation-aware waiting for lock contention. The
[session-restore](../session-restore.md) and [audio-inputs](../audio-inputs.md)
roadmaps own their respective target behavior. Implementation details can be
settled during planning against those roadmaps and the remaining catalog entries.
## 1. Coordinate destructive cleanup with other work
Status: Implemented and verified
Finding: [CAT-01](catalog.md#cat-01--p1-coordinate-whole-session-deletion-with-active-invocations).
### What goes wrong today
A run holds a lock inside its session directory. Manual whole-session cleanup
can delete that directory, including the lock's filename, while the run is still
active. Another run can create a replacement lock file and start working against
the same paths. The first process still owns its original lock, but it no longer
coordinates access to the replacement file.
The final pipeline cleanup stage is different: it already runs under invocation
locking and preserves the session root.
### Agreed direction
Concurrent sessions are not a goal or known use case. Use one workspace-wide lock
if that is the simplest design. Serializing work on different sessions is
acceptable. A shared/exclusive admission hierarchy and per-session concurrency
are unnecessary for this scope.
The coordination file must survive the directory deletions it protects. All
participating operations must use the same identity, including whole-workspace
session cleanup and creation of a new session's working state. This is local
process coordination for a workspace, not a distributed lock across machines.
### Agreed contention behavior
Use cancellation-aware waiting, consistent with existing invocation locking,
and identify the lock being waited on. A contending invocation waits for the
workspace lock and can be cancelled while waiting.
The roadmap should identify the mutating command participants explicitly. Pure
inspection and unrelated workspaces need no new serialization requirement.
Operator response:
_Approved: use cancellation-aware waiting for the workspace lock. CAT-01 is
closed, including the acquisition-diagnostic review follow-up._
## 2. Import published artifacts and retain local resume
Status: Scope agreed; remote execution checkpoints deferred
Finding: [CAT-02](catalog.md#cat-02--p2-make-restored-carried-products-agree-with-manifest-authority).
### Separate publication from execution recovery
Publication and remote execution recovery are independent capabilities:
1. Store completed artifacts for publication and later use. Publication locks
preserve selected published files.
2. Store execution checkpoints so a saved session can later be restored and
resumed, retaining its manifest, fingerprints, and applicable provenance.
The operator has selected publication import for this development scope and
deferred remote execution checkpoints. Local execution checkpoints and ordinary
resume remain supported.
The current session manifest is Narratio's local progress ledger. It records
completed work and evidence used to decide whether that work can be reused.
The remote publication commit separately identifies published files. The current
restore flow combines these records in a way that can mix different generations.
### Concrete example
1. Generate transcript A and publish it.
2. Lock the published transcript because A is the distributed, canonical copy.
3. Regenerate locally, producing transcript B. The local manifest describes B.
4. Publish again. The lock correctly keeps A in the remote publication.
5. Restore that publication into an empty workspace.
The audit reproduced this result:
| Item | Restored value |
| --- | --- |
| Transcript file | A |
| Manifest's recorded transcript checksum | Checksum of B |
| Manifest's completion evidence | Generation B |
| Restore command | Reports success |
| Subsequent normal transcript resolution | Rejects the checksum mismatch |
The lock correctly retained A. The failure comes from combining publication's A
with execution's manifest describing B.
### Agreed direction: published artifacts
Published artifacts are finished products available for consumption. They can be
imported as inputs to a subsequent session or a fresh run of the same session.
Publication import uses file identity and location to select the requested
product. Transfer-integrity checks, such as verifying downloaded bytes against
a checksum, are separate from generation history.
Generation fingerprints, historical inputs, prompts, models, settings, and
generation provenance are irrelevant to using these published products. Import
does not require reconstructing historical completion records or evaluating
whether the original producer would be reusable under today's configuration.
An imported artifact is a supplied input; it does not assert that its producer
executed in the receiving workspace.
Published products may come from different generations. This direction adds no
requirement for a publication-wide coherent pipeline generation.
### Agreed operator workflows
The immediate scope supports three distinct workflows:
- Start from original sources: supply campaign/session configuration and raw
audio in a fresh workspace, then generate transcripts and artifacts.
- Start from published products: select and import finished transcripts or
artifacts as supplied inputs, then execute the downstream work that consumes
them. This starts new execution rather than recovering historical execution.
- Continue local work: rerun against the existing workspace and use its local
manifest and files to retain completed speaker/artifact work and retry unfinished
work under normal resume checks.
For the failed-transcription example, the existing local workspace already
preserves completed speaker work. Remote backup is unnecessary for that ordinary
retry. Recovering unpublished progress after workspace loss or moving execution
to another machine is a separate capability without an established immediate
operational need.
The import workflow is a real gap. Previous-session published-artifact consumption
already exists, but starting a fresh same-session execution from a published
transcript needs explicit support. Current bounded starts require preceding
manifest stage records; copying files into place and selecting a downstream range
does not provide the agreed workflow. Imported inputs should enable their consuming
work without inventing upstream stage-completion history.
In the A/B example, publication import retrieves A and makes it usable as a
supplied input. The local workspace containing B can continue independently
through normal local resume. Recovering B's execution after losing that workspace
is deferred.
### Consequences for remediation
Use the publication inventory to select imported products and verify their
transfer, independently of a remotely saved execution manifest. The earlier
proposal to reconstruct historical producer evidence for publication import is
superseded by this decision.
Current remote-state loading, restore, status, and previous-session acquisition
depend on the uploaded session-manifest snapshot. The roadmap should remove that
coupling for publication consumption and review which snapshot-publication and
execution-recovery machinery becomes unnecessary. Preserve the configuration
inputs needed for the selected workflow. Previous-session artifact selection
already uses the publication inventory and should follow the import semantics
above.
Physical layout, command syntax, and storage formats remain implementation-planning
matters. This discussion does not select a new CLI or treat the current mixed
restore behavior as the target contract.
This decision preserves local execution checkpoints and normal resume behavior.
It adds no requirement for publication imports to carry or satisfy the original
producer's fingerprints or generation provenance.
### Deferred capability: remote execution checkpoints
Remote checkpoint upload and recovery are outside the immediate scope. Upload
timing, cancellation behavior, transfer-failure handling, and retry machinery are
therefore deferred rather than open decisions blocking this remediation.
If a future operational need warrants remote checkpoints, design that recovery
workflow separately from publication import. A resumable checkpoint would need
the saved execution ledger and matching files, with ordinary resume validation;
a publication lock could not substitute an older product for a checkpoint output.
Operator response:
_Approved: defer remote execution checkpoints, retain local resume, and focus on
importing published artifacts._
## 3. Inspect S3 when planning and preflighting
Status: Read-only S3 checks agreed
Finding: [CAT-13](catalog.md#cat-13--p2-give-s3-session-planning-the-evidence-needed-for-truthful-reuse-decisions).
### What goes wrong today
Execution can compare current S3 audio identities with preparation's recorded
identities. The planning projection omits that storage collaborator and can
translate its absence into "inputs changed." It can therefore predict work that
execution would correctly reuse.
### Agreed direction
Planning should make a read-only S3 check. Preflight should make the relevant
read-only S3 check as well. Use existing storage capabilities and share the
identity interpretation with execution where practical.
The S3 identity check is read-only. This decision does not redefine the entire
preflight command as read-only. The current
[preflight workflow](../../operations.md#prompt-requirements-preflight) prepares
or reuses inputs, may download files and update the manifest, and checks downstream
providers. Preserve those responsibilities unless separately changed.
### Follow-through for the roadmap
Verify which S3 checks preflight already performs through preparation and reuse
that work rather than adding redundant calls. Observe unchanged, changed, and
unavailable sources through both commands. An access or connectivity failure
should be identified as such rather than reported as proven content change.
Use existing command failure/reporting conventions where they fit. The lookup
does not guarantee that S3 remains unchanged between planning and execution.
Operator response:
_Read-only S3 checks approved; no further product choice identified here._
## 4. Keep downloaded audio and its source identity together
Status: Both decisions implemented and verified
Findings: [CAT-04](catalog.md#cat-04--p2-bind-prepared-s3-audio-bytes-to-their-observed-generation)
and [CAT-06](catalog.md#cat-06--p2-stop-known-size-downloads-before-oversized-bodies-exhaust-staging-space).
### Concrete example
Narratio lists a speaker recording in S3 and sees version A. Before the download,
an ordinary uploader replaces that key with version B of the same size. Narratio
downloads B but records A's listed source identity alongside B's checksum.
If S3 later contains A again, Narratio can conclude that its local copy is current:
the remote identity matches the recorded A identity, and the local bytes match
the recorded B checksum. Both checks pass individually, but they describe
different versions. Narratio can reuse the wrong recording.
Here "version" means an observed object generation/identity; this does not
require enabling S3 bucket versioning. The existing read operation already
provides metadata associated with the returned body. The audio download path
currently loses that association.
### Agreed direction: audio source identity
Use the metadata returned with the actual download as the identity of the bytes
accepted. If B is a valid recording satisfying the acquisition rules, record B
and continue. This accommodates ordinary uploads without claiming that the
earlier directory listing froze all the session's audio.
If the observed response cannot satisfy the applicable checks, fail clearly.
The earlier listing does not require rejecting an otherwise acceptable replacement.
This adds no automatic retry-until-stable loop or session-wide snapshot protocol.
### Agreed direction: known-size transfers
Restore and other downloads already reject content that differs from a known
expected size, but only after writing the complete response. Stop an oversized
response during transfer instead. This applies an existing acceptance condition
earlier; it introduces no universal maximum recording size.
Use a bounded streaming transfer: for an expected N bytes, reading at most N plus
one byte distinguishes an exact-sized response from an oversized one. Retain
existing short-response and checksum validation. On failure, close the response,
remove partial staging, preserve the canonical destination, and identify the
responsible transfer and expected size in the error.
For committed products, the committed size is authoritative. If audio adopts B
instead of A, the response identity and size boundary must both describe B.
The byte count remains checked rather than trusting response metadata alone.
Unknown-size input retains its existing behavior and remains distinct from a
known zero-byte declaration. The change does not reserve disk space or prevent
every disk-full condition.
For raw audio, the observed download supplies the accepted identity. For published
products, the selected publication inventory supplies the expected identity;
different content is rejected rather than silently adopted. Transfer verification
is separate from historical generation provenance for imported products.
Operator response:
_Approved: accept and record the raw-audio generation actually downloaded, using
metadata from the same response; enforce known expected sizes while streaming,
without a universal audio-size cap. CAT-04 and CAT-06 are closed._
## 5. Finish subprocess shutdown before releasing its files
Status: Implemented and verified
Finding: [CAT-05](catalog.md#cat-05--p2-retain-subprocess-and-stream-ownership-through-delayed-completion).
### What goes wrong today
When a downstream command times out or is cancelled, Narratio requests graceful
termination and then forceful termination. A separate waiter observes process
exit and completion of output copying.
On an exceptional path, the final wait timer expires before that waiter finishes.
Narratio can return an error and start closing log or result files while the
waiter or output copier still uses them. Issuing a kill request is not the same
as observing completion of every resource user.
The audit established this ordering from source. It did not reproduce a dynamic
race. Normal cancellation and subprocess tests passed.
### Agreed direction
Keep the bounded graceful-to-forceful escalation, then join process/output
completion before releasing the associated resources or returning their ownership
to callers. Read process state and flush/close diagnostics after completion is
joined. Preserve the original timeout or cancellation cause. Exercise the
delayed-completion branch with a controlled test of resource-release ordering.
Ordinary cancellation should still terminate promptly. In an exceptional blocked
filesystem write or kernel operation, resource completion can take longer than
the escalation windows. The invocation may remain in shutdown and continue
holding its workspace lock while resource ownership completes.
Document the timeout as starting command shutdown, not guaranteeing that every
resource is released at that instant. Retain bounded escalation without an
absolute return-time guarantee for arbitrary blocked I/O. Use the existing
supervisor and standard process-waiting mechanisms; an early-return ownership
handoff or background cleanup service is unnecessary for this fix.
Operator response:
_Approved: retain bounded termination escalation, then wait for process and output
completion before releasing resources, even when exceptional I/O delays outlast
the escalation timers. CAT-05 is closed._
## 6. Open publication sources as they are needed
Status: Implemented and verified
Finding: [CAT-09](catalog.md#cat-09--p2-bound-publications-simultaneously-open-source-descriptors).
### What goes wrong today
Publication opens every selected local source before uploading and keeps all
those handles open until the stage ends. Each open file consumes an operating
system descriptor. A large inventory can exhaust that resource even though
uploads occur one at a time. Closing the handles at the end prevents an ordinary
leak but does not prevent excessive simultaneous use.
The audit established this scaling from source; it did not reproduce exhaustion
or establish a failure threshold for a production deployment.
### Why the current approach exists
Opening and validating sources up front catches invalid sources before uploading.
Retaining a verified handle also avoids substituting a later pathname lookup for
the file that was checked. Those are separate concerns from retaining every handle
throughout the entire attempt.
Remote publication becomes current only when the final pointer is updated.
An earlier failure may already leave immutable uploads that were never selected
as current. Preserving the old current pointer is the important existing commit
boundary; failure does not promise that no remote bytes were uploaded.
### Agreed direction
Keep complete destination planning, then open, verify, upload, and close each
source in sequence using a bounded number of handles. Retain confinement,
regular-file and checksum checks, and use the verified handle for hashing and
transfer. Close each source when its transfer and verification finish rather
than retaining all sources until the stage ends.
An invalid later source may be discovered after earlier immutable uploads.
Such a failure leaves the prior publication current; the new attempt is not
selected. On a first publication, failure leaves no newly selected publication.
Keep the current-pointer write last, after all required publication work succeeds.
This explicitly relaxes the documented all-sources-rejected-before-upload behavior.
Planning identities, destinations, and rules remains upfront; opening and validating
every source before any upload is no longer required.
Use the existing sequential transfer mechanism. This decision adds no artifact-count
cap, descriptor-limit tuning, disk-backed source snapshots, or upload-concurrency
framework. Unselected objects from unsuccessful attempts do not require a new
cleanup subsystem as part of this fix. Existing publication locks retain their
semantics, including carrying locked remote products without opening their local
replacements.
Verify bounded source-handle lifetimes with a growing inventory and a late-source
failure that leaves current publication unchanged. Retain the existing source
validation and pointer-ordering coverage.
Operator response:
_Approved: plan destinations upfront, then open, verify, upload, and close one
source at a time. A later invalid source may leave an unselected remote attempt;
the current publication must remain unchanged on failure. CAT-09 is closed._
## 7. Give preparation and inspection the same audio selection rules
Status: Implemented and verified
Finding: [CAT-12](catalog.md#cat-12--p2-share-audio-discovery-and-accept-valid-same-basename-recordings-in-inspection).
Roadmap owner: [Multi-Format Audio Inputs and Shared Discovery](../audio-inputs.md).
### Concrete example
At the audit baseline, the operator selects `first/speaker.flac` and
`second/speaker.flac`. Preparation accepts these distinct recordings and gives the prepared copies distinct names.
Inspection rejects them because their basenames match. A status command can
therefore report unavailable audio for a session preparation can process.
The duplicate implementations also differ on selecting the exact same file twice
and on file eligibility. Preparation's initial file check rejects directories;
inspection requires a regular file. A named pipe or device can pass the former
check but fail the latter. The audit does not establish successful end-to-end
support for those non-regular sources.
### Agreed direction
Share read-only selection rules. Accept distinct local recordings with matching
basenames and retain preparation's rejection of duplicate resolved source paths.
Keep materialization and checkpoint transitions with preparation and reporting
with inspection. Preserve the existing prepared-name disambiguation and keep
the separately selected S3 basename rule distinct from local selection.
Local recording sources must resolve to regular files. This supports repeated
reading, hashing, and resume. Existing path and symlink rules remain separate.
Accept multiple audio formats. Automatic directory and S3-prefix scans use one
shared, broad, case-insensitive extension filter; nonmatching sidecars are
ignored. The [roadmap](../audio-inputs.md#broad-extension-filtering-for-automatic-discovery)
owns the extension set and its application to preparation, inspection, reuse,
and transcription fallback. Explicit local file selections and manifest-registered
audio remain extension-agnostic. Backend decoding determines actual codec support;
selection adds no transcoding or format-probing requirement.
Preserve stem-based speaker IDs. After existing prepared-name disambiguation,
reject remaining same-stem collisions across extensions during shared discovery,
identify both sources, and ask the operator to select one encoding or rename the
recordings. Distinct same-full-basename local recordings remain supported. This
moves the existing transcription ambiguity failure earlier without adding
automatic cross-extension renaming or content-based deduplication.
The roadmap extends CAT-12's shared-discovery remediation with the subsequently
approved multi-format behavior. Audio generation identity and transfer bounds
remain the separate corrections agreed under topic 4. Publication import is
independent of raw-audio discovery; neither feature roadmap requires completing
the other first.
Operator response:
_Approved: regular-file selection, shared broad audio-extension filtering for
automatic discovery, extension-agnostic explicit inputs, and early rejection of
unresolved speaker-stem collisions. CAT-12 is closed after implementation
and verification._
## After Discussion
Prepare remediation plans against the catalog, using the two feature roadmaps
for their assigned work. Distinguish agreed behavior changes from internal
refactoring, retain the audit evidence links, and include focused regression
coverage. Build on the completed safety and transfer work. Recording an approved
direction alone does not close its finding; pending work still requires
implementation and verification.

View File

@@ -0,0 +1,393 @@
# Session Restore from Published Artifacts
Status: Agreed scope; implementation pending
## Goal
Define `narratio session restore ID` as retrieving the identified session's
published artifacts and making them usable as inputs to subsequent work.
Restore constructs local manifest completion state from the products available
after import. Completion means that a stage's work is satisfied by those
products; it does not assert that the stage executed in this workspace.
The operator can start from original audio, start downstream work from published
products, or continue interrupted work in an existing local workspace. Remote
execution-checkpoint upload and recovery are deferred.
This is a feature roadmap, not a staged implementation plan. It incorporates
the decisions in the [audit discussion](audit/discussion.md) and the subsequent
agreement to synthesize stage completion using a small stage/output mapping.
That agreement supersedes earlier suggestions that restore must reconstruct
historical producer evidence or avoid marking covered upstream stages complete.
## Current Baseline
Reviewed against `d8bc99b17efdddd0a728ef519b2e5a1d25f85fa9`.
- Publication writes immutable objects, a remote commit inventory, and a current
pointer. The inventory already identifies sources, exact object keys, sizes,
checksums, and storage generations. It also includes a session-manifest snapshot.
- Remote-state discovery requires that snapshot and decodes its execution ledger.
Restore uses it to map products, rebase producer-machine paths, and install a
local manifest after downloading files.
- Publication locks can retain output A while the local execution ledger describes
replacement B. Current restore can install A alongside B's completion evidence,
report success, and leave normal artifact resolution rejecting the result.
- Built-in, extraction, and configured-artifact resolution depend on recorded
producer success or generation evidence. Files copied into canonical locations
alone are insufficient.
- Bounded runs require preceding stage statuses. A full run additionally applies
semantic and content resume checks, so merely writing `succeeded` would not
establish a durable restored baseline under the current validators.
- Prepare combines stable reference materialization, audio acquisition, and
previous-session inputs. Session validation requires an audio source. These
responsibilities currently obstruct a fresh artifact-only workflow.
- Previous-session artifact selection already uses the publication inventory,
but its shared discovery and local cache still require the execution snapshot.
- Local speaker and analysis checkpoints already retain completed work after
ordinary failures. They do not need remote backup to support local retry.
Implemented mechanics are documented in [restore](../internal/command-restore.md),
[artifacts](../internal/artifacts.md), [manifests](../internal/manifest.md),
[prepare](../internal/stage-prepare.md), and [publication](../internal/stage-publish.md).
The original defect and test gap are linked from
[CAT-02](audit/catalog.md#cat-02--p2-make-restored-carried-products-agree-with-manifest-authority).
Their historical-evidence remediation direction is replaced by this roadmap's
product-import model.
## Operator Workflows
### Start from original sources
Supply the authored campaign/session inputs and raw audio in a fresh workspace.
Run Narratio normally. Processing stages generate their products and record
ordinary local progress and reuse evidence.
### Start from published products
Run `narratio session restore ID` using the selected campaign and remote storage.
Restore retrieves that session's published products, places them in the local
workspace, and constructs the corresponding completion baseline.
Then select downstream stages, or run the ordinary full pipeline. Covered work
is reused; remaining work proceeds in canonical order when its actual inputs
are available. Required campaign/session configuration and references remain
inputs to the new work. Restoring a transcript does not reconstruct all authored
configuration or make unrelated inputs appear.
For example, a restored final trimmed JSON transcript should allow extraction
and analysis without raw audio, per-speaker transcripts, or earlier combined
transcripts. The selected work still needs its configured party, glossary, and
other required inputs. Configure render for the transcript variants to produce;
a trimmed-only selection needs no untrimmed JSON transcript.
### Continue local work
Rerun Narratio against the existing local workspace. Ordinary local checkpoints
retain completed speakers/artifacts, and normal local resume decides what work
remains. Restore is unnecessary for this workflow.
## Targeted End State
### Publication is the import authority
Restore selects published products through the current pointer and its publication
inventory, including exact older declarations preserved by publication locks.
It uses source identities and Narratio's local product-path definitions rather
than a remote execution manifest to place and register products.
Imported products are accepted as supplied inputs. Their historical prompts,
models, configuration, generation fingerprints, producer run IDs, and generation
provenance are unnecessary for acceptance and use. Existing transfer-integrity,
content, and destination checks remain distinct from generation history.
The product inventory remains useful for selecting and verifying files. A remote
session-progress snapshot is not a prerequisite for publication consumption.
Products from different generations can coexist in one publication.
### Restore synthesizes a local completion baseline
Use a small, centrally owned mapping of stages to products and the ultimate
products that satisfy earlier transcript work. Use the existing artifact
identities and fixed pipeline rather than a configurable workflow graph.
Illustrative coverage:
| Restored product | Work satisfied for continuation |
| --- | --- |
| Base JSON transcript | Transcription and merge |
| Polished JSON transcript | The transcript chain through polish |
| Final normalized JSON transcript | The transcript chain through normalize |
| Final trimmed JSON transcript | The transcript chain through trim |
| Rendered Markdown products | Their configured render output work; they do not substitute for JSON inputs |
| Extraction products | Corresponding extraction output availability and aggregate coverage when its required products are present |
| Configured analysis artifacts | Their individual artifact work; unrelated missing artifacts remain work |
This mapping is about satisfaction, not reconstruction. A final trimmed
transcript can cover earlier stages even though their intermediate files are
absent. The manifest records actual imported files and marks covered stages
complete without inventing output records for files that do not exist.
Keep independent products independent. A transcript does not prove that
extraction, analysis, or rendering completed. Render and extract remain sibling
consumers. Bounds are separately available only when their actual product is
present. Prepared campaign references and previous-session inputs also need
their actual documents; transcript coverage does not supply them.
The baseline is durable across invocations. Its representation must be accepted
by manifest loading, resolution, planning, and execution without fabricating
historical fingerprints or satisfying irrelevant per-speaker records. Use only
the local bookkeeping needed to express coverage and actual product availability.
The manifest representation is an implementation choice.
Import does not authorize publish or cleanup by synthesizing their successful
execution metadata. Those actions retain their own lifecycle and authorization.
### Resume respects the supplied baseline
A normal full run and a bounded downstream run honor restored completion.
Absent audio, missing superseded intermediate transcripts, changed original
model settings, and unavailable historical fingerprints do not by themselves
regenerate covered work.
Preparing references for new downstream work must likewise preserve the supplied
transcript baseline rather than invalidate it for lacking the new preparation's
generation history. Locally generated dependents still follow their ordinary
input-change and invalidation rules.
Existing checks on actual required inputs still apply. If a consumer requests an
intermediate product that was not restored, completion coverage does not make
that file available. Report the missing input through the normal command path;
the operator can supply it, select different downstream work, or regenerate its
producer with the needed inputs.
Force retains its existing stage/range and artifact-target meaning. Explicit
regeneration requires the inputs actually consumed by that operation; restoring
a final transcript does not supply audio for forced transcription. Newly executed
work receives ordinary local checkpoints and semantic reuse evidence. The relaxed
import rules do not disable normal local retry or freshness behavior for that work.
Partial analysis imports must remain usable individually. Additions to the current
artifact selection can schedule missing work without requiring all published
artifacts to have historical analyze fingerprints. Existing explicit-target versus
prerequisite force behavior remains unchanged.
### Preparation and readiness support artifact-only execution
Make the stable references needed by remaining work available without requiring
audio acquisition or execution of covered transcript producers. Relax unconditional
audio-source requirements where necessary for this workflow, while validating
audio configuration and availability when audio processing is actually needed.
Use ConfigKit's completed configuration and existing Narratio domain projections.
Separate the needed preparation responsibilities narrowly; this is not a second
configuration system or a general input scheduler.
Planning, automatic downstream readiness, and adapter composition must agree with
the restored coverage. A covered producer is not projected to rerun merely to
recover historical evidence. Standalone preflight retains its own documented
capability checks; it must accommodate the artifact-only input context without
rebuilding covered transcript work.
### Render selection is explicit
Configuration selects which transcript variants render produces: normalized
(untrimmed) Markdown, trimmed Markdown, or both. Preserve the current both-variant
behavior when the new selection is omitted. Existing render enablement remains
available.
Render resolves the JSON inputs and produces the Markdown outputs for the selected
variants. Selecting only trimmed Markdown requires only the final trimmed JSON;
absence of the unselected normalized JSON does not block rendering. A selected
variant's missing or invalid input remains an error rather than causing an
automatic switch to whichever variants happen to be available.
Apply this selection consistently to generation, restore-derived completion,
resume evidence, planning, and readiness. Restored Markdown products satisfy
render according to the configured selection; selecting an additional missing
output leaves that render work to perform. Semantic evidence covers the selected
variants and their inputs rather than requiring an unselected JSON variant.
An operator restoring only the final trimmed JSON can select trimmed-only render
and run the remaining pipeline. A downstream artifact or publication rule that
requires an unselected Markdown product still needs that actual product. This
does not add per-output checkpointing or a general partial-stage framework.
### Existing restore controls remain useful
Retain dry-run reporting, ordinary file conflicts, explicit forced replacement,
workspace path handling, transfer verification, and retry after partial restore.
Dry run reports planned imports and resulting stage coverage without installing
files or a manifest. Existing optional published-audio handling can remain an
input import; it is not execution-checkpoint recovery.
Install or update the local baseline after the corresponding imports have been
accepted. Preserve the existing partial-restore recovery mechanism rather than
adding whole-workspace rollback or stronger crash/power-loss guarantees.
### Restore preserves existing local progress
Restore can import into a fresh workspace or a workspace with local execution
progress. Merge imported product records and derived completion into the local
manifest, preserving unrelated local progress and speaker/artifact checkpoints.
This combines local progress with supplied products, not two historical execution
ledgers.
Retain ordinary file conflicts: download missing products, retain identical files,
and require `restore --force` for eligible conflicting replacements. That flag
authorizes file replacement, not forced pipeline regeneration.
If an imported replacement changes an input of locally generated work, apply the
existing local dependent-invalidation rules. Products imported in the same restore
form the selected supplied baseline; their historical generation consistency is
not examined. Do not copy remote execution history or discard unrelated local
completions as a shortcut to constructing the baseline.
## Required Changes
### Decouple remote discovery from execution snapshots
Change the shared current-state reader to expose publication identity and
declared products without requiring, decoding, or validating a historical session
manifest. Update restore, remote status, artifact inspection, configuration
fallback consumers, and previous-session acquisition accordingly.
Stop emitting execution-ledger snapshots solely for the deferred checkpoint
purpose. Remove execution-snapshot rebasing and recovery code that no longer
serves the chosen workflow. Preserve the authored or standalone prepared session
configuration used for remote configuration acquisition: that document is distinct
from the session progress manifest. Keep required reference/input material under
its existing purpose rather than preserving a backup feature implicitly.
Reuse the current publication inventory and storage primitives where they fit.
Existing inventories can contain historical execution-snapshot declarations;
product import should not interpret those declarations as execution authority.
This scope does not require a new remote checkpoint protocol or historical
generation reconstruction.
Primary areas: `internal/artifacts/current_state*.go`,
`internal/artifacts/remote_commit.go`, `internal/previouscache`,
`internal/stage/publish*.go`, and application remote/configuration consumers.
### Build and consume restore-defined completion
Replace downloaded-ledger installation with local baseline construction from
the product mapping, merging it with existing local progress where present.
Reconcile affected local completion records after eligible replacements while
preserving unrelated records. Extend manifest handling and artifact availability
so built-ins, extraction lanes, and configured artifacts can be supplied by
restore without historical producer evidence.
Apply the same coverage interpretation to full-run decisions, bounded
prerequisites, stage resume validators, and analysis reconciliation. Merely
writing existing success statuses while leaving current validators unchanged
would not implement the feature. Source resolution must continue distinguishing
actual products from earlier stages satisfied only by an ultimate output.
Update publication's local-source resolution as well: an imported product should
not become unusable merely because the operator later selects publication.
Existing remote publication locks remain authoritative.
Primary areas: `internal/app/restore*.go`, bounded prerequisites and runner
decisions, `internal/manifest`, `internal/artifacts` resolution/catalog/evidence,
and stage-owned resume/checkpoint handling.
### Adapt preparation and operator reporting
Review unconditional session audio validation, prepare materialization and reuse,
and readiness/composition for actual remaining work. Preserve local per-speaker
and per-artifact retry behavior while allowing restored completion to bypass
irrelevant generation checks.
Status, plan, restore reports, and command help should explain which work is
satisfied by restored products and which actual inputs or products are missing.
Reporting local restored completion is administrative state, not a requirement
to recover generation provenance.
Primary areas: `internal/config/validate_core.go`, `internal/stage/prepare*`,
`internal/app/plan.go`, runner/readiness composition, and report projections.
### Make transcript rendering variant-selectable
Add a narrow variant selection to render configuration using native configuration
defaults and validation. Keep the existing both-variant default. Configuration
field spelling and representation can be settled in the implementation plan.
Update render invocation, source requirements, output declarations, semantic
evidence, and restore coverage to use the selected variants. Use the same rules
for ordinary and restored sessions. Retain existing content validation and failure
handling for selected inputs and attempted conversions.
Primary areas: `internal/config`, `internal/stage/render.go`,
`internal/stage/semantic_contracts_refinement.go`, restore's product mapping,
and related planning/readiness tests.
### Align policies and canonical documentation
Update [architecture policy](../policy/architecture.md) provisions that currently
equate stage completion and product availability exclusively with recorded local
generation, require remote manifest installation, or imply historical resume
evidence for every restored product. Define restore-created completion positively
as satisfaction by supplied products, alongside ordinary executed completion.
Update [CLI](../cli.md), [operations](../operations.md), troubleshooting, and the
focused restore, artifact, manifest, prepare, publication, and affected stage
documents when implementation lands. Include the three operator workflows and
explain that remote execution-checkpoint recovery is deferred. Keep upstream
library behavior linked to its canonical documentation.
Audit records remain evidence of the baseline; they are not policy constraints
requiring the old restore semantics. Workspace-wide locking and the scoped
safety/transfer fixes are implemented. Reuse those boundaries during the restore
redesign. Remaining audit remediations retain separate ownership; shared change
surfaces do not make them prerequisites for a publication-import framework.
## Validation Outcomes
Use focused offline behavioral tests and representative assembled workflows:
- Publish A, lock it, generate B locally, republish, and restore into a fresh
workspace. A resolves and supports downstream work without importing B's
fingerprints or requiring the execution snapshot's contents to be readable.
Cover a transcript and a configured artifact.
- Restore an ultimate transcript with no audio and no superseded intermediate
transcript files. Persist and reload the synthesized manifest, then compare
planning and actual downstream execution. Covered producers make no adapter
calls; required references are prepared or supplied normally.
- Re-run the full pipeline after restore and demonstrate coverage reuse plus
execution of genuinely remaining work with the configured render selection.
No restored publish/cleanup success is fabricated.
- Restore into a workspace with local progress. Exercise identical files,
ordinary conflicts, and forced replacement; preserve unrelated checkpoints and
apply local invalidation to affected locally generated work without inspecting
the generation history of imported products.
- Render trimmed-only with no untrimmed JSON, render untrimmed-only, and retain
both-variant behavior when selection is omitted. Confirm missing selected
inputs fail, unselected inputs are unnecessary, and selection changes affect
render completion and reuse consistently.
- Import extraction and partial analysis products, consume them through normal
source IDs, and generate additional selected artifacts without reconstructing
historical tool settings. Preserve meaningful force behavior.
- Continue a locally failed transcription or analysis invocation and retain its
previously checkpointed completions. This remains independent of restore.
- Read previous-session products and remote status from publication inventory
alone. Preserve configuration acquisition from the distinct session document.
- Retain representative dry-run, conflicting-target, invalid-transfer, failed
baseline-save, and partial-restore retry coverage. Choose tests for observable
risks, not exact helper structure or incidental wording.
The implementation plan should select checks proportionately under the
[testing policy](../policy/testing.md). This planning pass implements no behavior.
## Scope Boundaries
Keep the fixed pipeline and existing command name. New command families, arbitrary
workflow graphs, continuous remote backup, checkpoint upload timing/failure
machinery, and historical generation reconciliation are outside this scope.
Local resume remains a supported feature.
Preserve selected transfer, path, conflict, and publication behavior without
turning incidental implementation choices into additional guarantees. This
roadmap introduces no publication-wide same-generation requirement, new data-size
cap, requirement to publish every intermediate file, or compatibility/migration
framework. New restrictions or stronger guarantees need an explicit decision.

View File

@@ -22,7 +22,7 @@ narratio session plan 2026-04-04
Safe fix:
- pass explicit `--config`, `--campaign` or `--campaign-file`, and `--session`.
- pass explicit `--config`, `--campaign` or `--campaign-file`, and `--session-file`, with the positional session ID.
Relevant reference: [Configuration discovery](./config.md#discovery-and-selection).
@@ -39,7 +39,7 @@ Likely cause:
Diagnostics:
```bash
narratio session validate 2026-04-04 --session /path/session.yml
narratio preflight 2026-04-04 --session-file /path/session.yml
```
Safe fix:
@@ -62,7 +62,7 @@ Likely cause:
Diagnostics:
```bash
narratio session plan 2026-04-04 --config /path/pipeline.yml --campaign-file /path/campaign.yml --session /path/session.yml
narratio session plan 2026-04-04 --config /path/pipeline.yml --campaign-file /path/campaign.yml --session-file /path/session.yml
```
Safe fix:
@@ -90,13 +90,13 @@ Symptom:
Likely cause:
- the campaign `party.yml` is an unversioned legacy document, or names a
schema other than `narratio.party.v1`.
- the campaign party main document is unversioned, or names a
schema other than `maximumdirect.rpg.party.v1`.
Safe fix:
- replace the file with one exact, single-document
[`narratio.party.v1` party](./integrations/party.md); do not add a version
- replace the main file with a versioned
[`maximumdirect.rpg.party.v1` party](./integrations/party.md); do not add a version
marker to an otherwise incompatible legacy structure. The versioned party is
the only configured roster authority.
@@ -115,22 +115,27 @@ Diagnostics:
narratio config sources --config /path/pipeline.yml --overlay testing
```
Add `--campaign` or `--campaign-file` when the pipeline has party-driven
artifact families. The output identifies each effective logical field's root,
import, overlay, default, campaign, party, or family source without printing
the field value or credential contents.
Native sources list the actual files and import evidence for the selected
scope. To trace a value, use `config explain --path POINTER`, or discover paths
with `config explain --list`. App inspection keeps family declarations;
`artifacts list` derives concrete members from the selected campaign/party.
Safe fix:
- move a duplicated base field so it has one owner;
- correct the selected overlay; or
- correct the campaign party/family declaration that owns generated values.
- inspect the field's effective origin and history;
- correct the selected source or overlay; or
- select the intended roster when reviewing family members.
To review what would actually change before switching overlays, run `config
diff` with the same pipeline and campaign selectors. It compares normalized
effective values rather than YAML formatting or source-file layout.
To compare an explicit pipeline root with its testing overlay, select the root
on both sides:
Relevant reference: [Configuration inspection](./config.md#read-only-effective-pipeline-inspection).
```sh
narratio config diff --config /path/pipeline.yml --against-config /path/pipeline.yml --against-overlay testing --details
```
The sides use independent defaults. Comparison concerns effective native values,
including declarations, rather than generated domain objects or YAML layout.
See [configuration inspection](./cli.md#configuration-inspection).
## Audio mode conflict
@@ -145,7 +150,7 @@ Likely cause:
Diagnostics:
```bash
narratio session validate 2026-04-04
narratio preflight 2026-04-04
```
Safe fix:
@@ -164,7 +169,7 @@ Likely causes:
- key not defined in `pipeline.scriptorium.artifacts`;
- empty list entry (for example trailing comma);
- `run-stage` used with non-`analyze`/`publish` target.
- selected run/plan range contains neither `analyze` nor `publish`.
Diagnostics:
@@ -201,7 +206,7 @@ narratio session plan 2026-04-04 --from render --through analyze
Safe fix:
- widen the bounded range to include the first reported stage, or recover that
stage explicitly with `run-stage` before retrying. The failed check does not
stage explicitly with `run --stage` before retrying. The failed check does not
create a run-local directory or modify the manifest. Narratio does not
resume-validate excluded prefix stages, and stages after `--through` are not
prerequisites.
@@ -242,7 +247,7 @@ Safe fix:
for a successful checkpoint.
```bash
narratio run-stage transcribe 2026-04-04
narratio run 2026-04-04 --stage transcribe
```
Valid earlier speaker checkpoints remain reusable even while aggregate
@@ -270,7 +275,7 @@ Safe fix:
retry if the replacement attempt is interrupted.
```bash
narratio run-stage transcribe 2026-04-04 --force
narratio run 2026-04-04 --stage transcribe --force
```
Transport replay and application retries do not provide an exactly-once remote
@@ -319,15 +324,15 @@ Likely causes:
- the named environment variable is absent or empty;
- the selected secrets directory lacks a file with that exact name;
- a process environment variable exists but is empty, so bootstrap correctly
leaves it in place; or
- a process environment variable is empty and the selected bootstrap policy
preserves it; or
- the Narratio reference name does not match `api_key_env` in the selected
Notarius/PromptKit profile.
Safe fix:
- set the exact nonempty environment variable or provide an equivalently named
file through the conventional or explicit secrets directory;
file through the pipeline-configured secrets directory;
- remove, set to `null`, or set to `[]` when that deployment needs no credential;
and
- use `config show`, `config sources`, and `config diff` to inspect the public
@@ -341,7 +346,16 @@ for the command to proceed.
Relevant references: [Secrets](./config.md#secrets-handling) and
[Notarius credentials](./config.md#notarius-credentials).
## Audita v2 configuration or credential failure
## Prepared glossary is unavailable or invalid
If preflight or downstream work reports missing, changed, or invalid prepared
glossary evidence, check the selected catalog IDs, source-relative files, and
campaign inline contribution. Re-run `prepare` after correcting the source;
use `--force` when an explicit refresh is needed. Update old monolithic source
bindings and glossary files using the [glossary input guidance](config.md#glossary-inputs).
Preflight runs or reuses preparation; after correcting the source, retry it.
## Audita configuration or credential failure
Symptom:
@@ -354,16 +368,16 @@ Likely causes:
- the Narratio pipeline still uses v1 endpoint, model, capacity, singular key,
report, or retention settings;
- the named key is missing or empty, including a present but empty process
environment variable that takes precedence over a secrets-directory file;
- Audita's external v2 file references a backend credential name not forwarded
environment variable preserved by the selected bootstrap policy;
- Audita's external configuration references a backend credential name not forwarded
by `pipeline.audita.credentials`, including a backend not selected by the
current profile; or
- an Audita overlay or profile selector names a missing downstream definition.
Safe fix:
- follow the [migration table](./operations.md#migrating-audita-and-provider-credentials)
and use a supported Audita v2 executable and configuration;
- follow the [migration guidance](./operations.md#migrating-audita-and-provider-credentials)
and use an Audita v4.3.0 executable and configuration;
- provide each needed provider-named variable through the environment or
secrets directory, and list that same name in `pipeline.audita.credentials`;
- validate the external file offline with
@@ -374,7 +388,7 @@ Safe fix:
An exit-zero polish with a valid transcript succeeds even when Audita reports
recoverable errors or no corrections. Missing reports are allowed when Audita
reporting is disabled externally. Edits to Audita-owned files behind unchanged
selectors require `narratio run-stage polish <session-id> --force` to replace a
selectors require `narratio run <session-id> --stage polish --force` to replace a
previously successful result. See the [Audita integration contract](./integrations/audita.md).
## Notarius executable missing
@@ -400,12 +414,12 @@ and [Notarius integration](./integrations/notarius.md).
Symptom:
- extraction reports a Notarius exit error instead of a receipt.
- extraction reports a Notarius exit error instead of a completion report.
Diagnostics:
- inspect `runs/{run_id}/extract/notarius.stderr.log`; stdout is reserved for
the receipt and is not merged with diagnostics.
- inspect `runs/{run_id}/extract/logs/notarius.stderr.log`; stdout is reserved for
the completion report and is not merged with diagnostics.
Safe fix:
@@ -431,13 +445,13 @@ Likely causes:
- `prepare` has not run since the campaign/session stable input changed;
- the configured source file is missing;
- a prepared `inputs/` file or its manifest record was modified independently;
- a spell-catalog binding exists without an effective `spell_catalog_file`.
- a configured glossary binding does not identify a prepared shared glossary.
Diagnostics:
```bash
narratio session status 2026-04-04
narratio session validate 2026-04-04
narratio preflight 2026-04-04
```
Safe fix:
@@ -446,7 +460,7 @@ Safe fix:
evidence before extraction:
```bash
narratio run-stage prepare 2026-04-04 --force
narratio run 2026-04-04 --stage prepare --force
```
Do not point Notarius directly at the original source path or edit the manifest
@@ -458,7 +472,7 @@ and [Operations: Extraction Workflow](./operations.md#extraction-workflow).
Symptom:
- extraction reports that a path beneath
`cache/notarius/references/<sha256>/` is a symlink, directory, or another
`inputs/references/<sha256>/` is a symlink, directory, or another
non-regular or unsafe entry.
Safe fix:
@@ -477,34 +491,11 @@ Relevant reference: [Operations: Extraction Workflow](./operations.md#extraction
## Notarius resume executes work instead of reusing it
Symptom:
- Narratio executes `extract`, and Notarius makes provider calls despite
`pipeline.notarius.resume: true`.
Likely causes:
- checkpoint recording is disabled in the Notarius configuration;
- Notarius is using a nonpersistent or different checkpoint root;
- transcript/reference bytes, reference paths, pipeline/profile content,
local-backend endpoint, selected lanes, or another checkpoint identity input
changed; or
- Narratio extraction was forced, which deliberately omits `--resume`.
Safe fix:
- validate the deployed Notarius configuration and configure explicit
persistent chunk-plan and checkpoint roots;
- inspect Notarius checkpoint decision reason codes for a legitimate cold miss;
and
- retry without force only when reuse is intended.
Remember that Narratio skipping a completed `extract` stage is separate from
Notarius reusing work inside an extraction that does execute. Narratio does not
read the Notarius configuration to infer checkpoint enablement.
Relevant references: [Notarius cache controls](./config.md#notarius-cache-controls)
and [Notarius integration](./integrations/notarius.md).
Narratio may reuse a completed extraction without invoking Notarius. When it
executes, Notarius independently selects cached results based on its own
configuration and inputs. Verify its configured cache location and native
cache mode; force requests `refresh`. Changed inputs or downstream settings can
cause a cold miss. See [cache controls](config.md#notarius-cache-controls).
## Notarius reference selector or generated-handoff collision
@@ -531,44 +522,13 @@ Narratio validates selector structure and prepared evidence, while Notarius
owns slot declarations, media compatibility, and generated-handoff conflicts.
Relevant reference: [Notarius integration](./integrations/notarius.md).
## Notarius receipt or index incompatible
## Notarius completion or required lane invalid
Symptom:
- extraction rejects the receipt schema, pipeline identity, bundle/index path,
lane descriptor, or payload path even though Notarius exited successfully.
Likely causes:
- Narratio and Notarius versions disagree on their consumer contract;
- the configured pipeline or lane constraints are stale;
- output paths escape the bundle or traverse symlinks.
Safe fix:
- compare installed Notarius output with the canonical Notarius contracts,
including receipt `index_file: index.json` and index management names
`manifest.json`, `rejected.json`, `warnings.json`, and `diagnostics.json`; align
`pipeline.notarius` constraints and rerun. Do not bypass confinement or schema
checks.
Relevant reference: [Notarius integration](./integrations/notarius.md).
## Required Notarius lane rejected or missing
Symptom:
- extraction fails because a configured lane is rejected, missing, duplicated,
or incompatible, including after a zero exit.
Safe fix:
- inspect the Notarius diagnostic log and bundle rejection/warning information;
- correct the Notarius module or the exact declared lane contract;
- remove an output declaration only if downstream consumers genuinely no longer
require that source, then rerun extraction.
Every configured output is required. Narratio does not promote a partial result.
If successful subprocess output is rejected, inspect the native completion
report and stderr under the extraction attempt's logs. Confirm the configured
pipeline identity, safe output directory, and required lane IDs against the
[Notarius contract](integrations/notarius.md). Correct the configuration and
rerun; do not treat partial output as a success or bypass confinement checks.
## Extraction resume invalidated
@@ -578,11 +538,11 @@ Symptom:
Likely causes:
- the pipeline ID or configured output contracts changed;
- the pipeline ID or configured output selection changed;
- a configured prepared reference selector, source, path, checksum, or byte
size changed;
- the direct trimmed transcript identity or bytes changed; or
- the durable bundle, index, lane set, provenance, regular-file status, or
- a promoted product, its manifest provenance, regular-file status, size, or
checksum no longer validates.
Safe fix:
@@ -606,7 +566,7 @@ Symptom:
Safe fix:
```bash
narratio run-stage extract 2026-04-04 --force
narratio run 2026-04-04 --stage extract --force
```
Narratio fingerprints its invocation contract and prepared Narratio reference
@@ -649,7 +609,7 @@ Safe fix:
the canonical path as a substitute for current evidence.
```bash
narratio analyze 2026-04-04 --artifacts session_recap
narratio run 2026-04-04 --stage analyze --force --artifacts session_recap
```
Relevant references: [Operations: Artifact Selection](./operations.md#artifact-selection)
@@ -728,17 +688,39 @@ Safe fix:
pre-upgrade backup. Do not delete only the speaker fields by hand.
```bash
narratio run 2026-04-04
narratio publish 2026-04-04
narratio run 2026-04-04 --through analyze
narratio session status 2026-04-04
```
After current records exist, inspect them and publish explicitly. Do not copy
Inspect the regenerated records and outputs, then publish explicitly:
```bash
narratio run 2026-04-04 --stage publish --force
```
Do not copy
old files into canonical paths merely to influence selection; availability is
manifest-owned.
Relevant references: [Operations: Stage Execution and Continuation Behavior](./operations.md#stage-execution-and-continuation-behavior)
and [Manifest Internals](./internal/manifest.md#transcribe-owned-speaker-state).
## Prompt requirements fail during preflight
If a run or `preflight` reports a missing prompt input, compare the exact
input name in the finding with the configured binding key, not just the source
ID. Supply a missing required variable, or correct the selected prompt and
profile. An optional source warning means the source may be omitted later; make
it required only if that is the intended configuration. Incomplete discovery
and conditional requirements warn without failing by themselves.
If inspection cannot start or decode a report, check the selected executable,
its native configuration and prompt resources, and the diagnostic context.
The [Scriptorium migration guide](https://forge.maximumdirect.net/eric/scriptorium/src/tag/v0.16.0/docs/consumers/upgrading-cli.md)
explains the v0.16.0 interface and configuration changes. Retry after correcting
the issue; a preflight failure preserves completed output authority. See
[prompt preflight](operations.md#prompt-requirements-preflight).
## Scriptorium returns HTTP 401 during trim or analyze
Check that Narratio's pipeline selects the credential names required by
@@ -774,7 +756,7 @@ Safe fix:
reusable unless selected themselves.
```bash
narratio analyze 2026-04-04 --artifacts session_recap
narratio run 2026-04-04 --stage analyze --force --artifacts session_recap
```
Relevant reference: [Analyze Internals](./internal/stage-analyze.md#invariants).
@@ -795,7 +777,7 @@ Likely causes:
Diagnostics:
```bash
narratio session validate 2026-04-04
narratio preflight 2026-04-04
narratio session status 2026-04-04
```
@@ -808,26 +790,26 @@ narratio session restore 2026-04-04
or rerun prepare after correcting session config:
```bash
narratio run-stage prepare 2026-04-04 --force
narratio run 2026-04-04 --stage prepare --force
```
Relevant reference: [Operations: Restore Workflow](./operations.md#restore-workflow).
## Session lock conflict (`.lock`)
## Workspace lock wait (`.lock`)
Symptom:
- command fails acquiring session lock.
- a mutating command waits for the workspace lock or is cancelled while waiting.
Likely causes:
- another process is running for the same session;
- another process is mutating the same workspace;
- a process still holds the operating-system lock while it is shutting down.
Diagnostics:
```bash
ls -l {workspace.root}/work/{campaign}/{session_id}/.lock
ls -l {workspace.root}/.lock
ps aux | grep narratio
```
@@ -910,7 +892,6 @@ Diagnostics:
```bash
narratio session artifacts 2026-04-04 --remote
narratio session status 2026-04-04
narratio run-stage publish 2026-04-04 --force
```
Safe fix:
@@ -919,6 +900,13 @@ Safe fix:
- correct publish source/destination rules;
- retry after storage failure is resolved.
To retry publication after inspection and repair, run the following mutating
command; it can update remote publication state:
```bash
narratio run 2026-04-04 --stage publish --force
```
Relevant reference: [Publish configuration](./config.md#publish-configuration-summary).
## Render markdown source missing
@@ -943,8 +931,8 @@ Safe fix:
- rerun render and then retry downstream stage(s):
```bash
narratio run-stage render 2026-04-04 --force
narratio run-stage analyze 2026-04-04 --force
narratio run 2026-04-04 --stage render --force
narratio run 2026-04-04 --stage analyze --force
```
Relevant reference: [Operations: Stage Execution](./operations.md#stage-execution-and-continuation-behavior).
@@ -957,8 +945,8 @@ Symptom:
Likely causes:
- missing, unreadable, or invalid explicit `--secrets-dir`;
- invalid entries in the conventional `secrets/` directory beside the root pipeline;
- a missing, unreadable, or invalid pipeline-configured secrets directory;
- invalid secret-directory entries;
- missing credential environment variables;
- invalid S3 endpoint/bucket settings.
@@ -971,7 +959,7 @@ env | sed 's/=.*//' | grep -E 'OBJECT_STORAGE|AWS|AUDITA|NOTARIUS|SCRIPTORIUM'
Safe fix:
- correct `--secrets-dir`, secret-file type/name, and operator-managed permissions;
- correct the main pipeline secrets selection, file type/name, and operator-managed permissions;
- provide required env vars;
- keep secret values out of YAML.
@@ -986,13 +974,13 @@ Symptom:
Likely causes:
- incorrect `session.inputs.audio_s3.prefix`;
- no matching `.flac` objects;
- no matching [audio candidates](config.md#session);
- storage connectivity or permissions failure.
Diagnostics:
```bash
narratio session validate 2026-04-04
narratio preflight 2026-04-04
```
Safe fix:

View File

@@ -9,28 +9,41 @@ in the [configuration reference](../docs/config.md).
- [Minimal pipeline](pipeline.minimal.yml): campaign discovery plus the required
WhisperX URL.
- [Synthetic catalog pipeline](pipeline.catalog.yml): imports the small
[example catalog](reference-catalog/catalog.yml), whose setting imports a
relative fragment. Install an operator-selected catalog separately for a
production deployment.
- [Production-shaped pipeline](pipeline.production.yml): S3 storage, publish,
external tools, and configured Scriptorium artifacts.
- [Production-base/testing-overlay bundle](production-testing/pipeline.yml):
explicit `conf.d` imports, one ordinary artifact per `artifacts/<key>.yml`,
one family per `artifact-families/<key>.yml`, and the fixed
explicit required `conf.d` imports, an optional local import, destination-mounted
artifact files, a YAML-filtered directory of keyed families, and the fixed
`overlays/testing.yml` overlay. Production values live in the base. The
bundle demonstrates an input-only artifact dependency, two character families
sharing the campaign party, and a testing-only disabled artifact. Inspect it
offline with:
sharing the campaign party, and a testing-only disabled artifact. The testing
overlay's `testing_notes` artifact inherits the recap prompt, inputs, and
testing profile while retaining its disabled status and separate output path.
The testing overlay upserts the transcript publish rule by `source`. A
destination key defines each artifact ID; filenames do not. Full-root and
disjoint definitions are also valid. Upsert replaces a matching list record
as a whole; empty append or upsert contributions leave existing entries intact.
Inspect it offline with:
```sh
narratio config validate --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml
narratio config show --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml --overlay testing
narratio config sources --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml --overlay testing
narratio config artifacts --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml --overlay testing
narratio config diff default testing --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml
narratio config validate --config examples/production-testing/pipeline.yml
narratio config show --config examples/production-testing/pipeline.yml --overlay testing
narratio config sources --config examples/production-testing/pipeline.yml --overlay testing
narratio artifacts list --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml --overlay testing
narratio config diff --against-config examples/production-testing/pipeline.yml --against-overlay testing --config examples/production-testing/pipeline.yml
```
These inspection commands load configuration and resolve explicit credential
references, but do not load a session or create runtime state. This bundle is
intentionally local-storage and credential-reference free so the walkthrough
needs no tools or cloud services.
needs no tools or cloud services. Native app inspection retains family
declarations; `artifacts list` derives their concrete members using the selected
campaign. Diff selects the example root on both sides because omitted
right-side selectors use their own discovery defaults.
- [Full annotated pipeline](pipeline.full.annotated.yml): every implemented
pipeline section with explanatory comments.
- [Extraction subset pipeline](pipeline.extraction-subset.yml): a focused
@@ -41,30 +54,44 @@ with the sample campaign and a compatible local- or S3-audio session.
## Campaign And Session Configuration
- [Lantern Coast](campaigns/lantern-coast/campaign.yml) is a complete three-file
campaign with adjacent [party](campaigns/lantern-coast/party.yml) and
[speakers](campaigns/lantern-coast/speakers.yml). Its optional vocabulary and
autocorrection rules may be omitted. Select the synthetic catalog through the
[catalog pipeline](pipeline.catalog.yml).
- [Sample campaign](campaigns/sample-campaign/campaign.yml), its
[session template](campaigns/sample-campaign/session.template.yml), and its
adjacent stable inputs provide a complete campaign directory shape.
adjacent stable inputs provide a complete campaign directory shape. Its
imported settings and split party demonstrate local secondary imports;
relative resources follow the file that supplies each value.
- [Local-audio session](session.local-audio.yml) and
[S3-audio session](session.s3-audio.yml) are concrete session files.
- [Session template](session.template.yml) and the campaign-local equivalent
demonstrate the narrow placeholder syntax consumed by `session init`; they
are templates, not runtime session files.
The [inline-only](glossary-authoring/inline-only.yml),
[file-only](glossary-authoring/file-only.yml), and
[combined](glossary-authoring/combined.yml) inputs fragments illustrate campaign
vocabulary selection. They omit optional setting and system selections; add
those IDs only when the pipeline imports a matching catalog.
## Input Fixtures
- [Speakers](speakers.yml), [autocorrect](autocorrect.yml), and
[glossary](glossary.yml) show the standalone input shapes.
- The sample campaign references its local
[speakers](campaigns/sample-campaign/speakers.yml),
[autocorrect](campaigns/sample-campaign/autocorrect.yml),
[glossary](campaigns/sample-campaign/glossary.yml), and canonical
[party](campaigns/sample-campaign/party.yml) fixture, plus an optional
[spell-catalog overlay](campaigns/sample-campaign/spell_catalog.json) that
follows the Notarius v0.7 contract. Narratio derives the players projection
from this party source.
- [Speakers](speakers.yml) and [glossary](glossary.yml) show standalone
formats. Autocorrection is authored inline in campaign or session configuration.
- The sample campaign uses its local [speakers](campaigns/sample-campaign/speakers.yml),
[glossary](campaigns/sample-campaign/glossary.yml), and
[party](campaigns/sample-campaign/party.yml). Narratio derives players from
the roster and writes the Seriatim autocorrection input during preparation.
- The synthetic [reference catalog](reference-catalog/catalog.yml) is adapted
from catalog commit `02dd53c6ea026347452d497350c40249c949f8ce`, under CC0-1.0;
see [attribution](../docs/oss/attribution.md).
- [Sample speaker audio](audio/sample-speaker.flac) is a text placeholder that
reserves the expected filename and directory shape. Replace it with a real
FLAC file before running transcription.
supported recording before running transcription; keep the configured filename
or update the session file to match.
The examples contain environment-variable names but no credential values. Set
`OBJECT_STORAGE_KEY_ID`, `OBJECT_STORAGE_KEY`, `AUDITA_LLM_API_KEY`, and
@@ -73,11 +100,11 @@ examples that reference them. They use fictional campaign content and reserved
example domains. The Audita and Notarius names are example references, not
implicit aliases: external backend/profile configurations must use those exact
names, or the Narratio credential lists must be changed to match. See the
[Audita v2 migration guide](https://gitea.maximumdirect.net/eric/audita/src/tag/v2.0.0/docs/migrations/v2.md)
[Audita v4.3.0 configuration guide](https://forge.maximumdirect.net/eric/audita/src/tag/v4.3.0/docs/config.md)
for maintained downstream configuration examples.
For a deployed bundle, keep credential files out of source control in a
`secrets/` directory beside the root `pipeline.yml`, one file per referenced
environment-variable name, or select another directory with `--secrets-dir`.
For a deployed bundle, keep credential files out of source control. Select a
directory in the main pipeline or provide environment values; see
[Secrets Handling](../docs/config.md#secrets-handling).
Static S3 credentials are optional: omit both S3 credential references to use
the AWS SDK discovery chain.

View File

@@ -1,2 +0,0 @@
[]

View File

@@ -0,0 +1,18 @@
# Synthetic three-file campaign example.
schema_version: maximumdirect.rpg.campaign.v1
id: lantern-coast
name: Lantern Coast expedition
setting: lantern_coast_sample
system: sample_magic
references:
party: ./party.yml
narratio:
inputs:
speakers_file: ./speakers.yml
glossary:
entries:
- id: glass-harbor
name: Glass Harbor
category: place
aliases: [The Harbor]
autocorrect: []

View File

@@ -0,0 +1,11 @@
schema_version: maximumdirect.rpg.party.v1
characters:
mira:
player:
name: Rowan
character:
name: Mira
aliases: [Mira of Glass Harbor]
classes:
- name: Wizard
level: 3

View File

@@ -0,0 +1,7 @@
match:
- speaker: Rowan
match:
- Rowan_recording
- speaker: GM
match:
- GM_recording

View File

@@ -1,8 +1,6 @@
campaign_id: sample-campaign
session_template_file: ./session.template.yml
inputs:
speakers_file: ./speakers.yml
autocorrect_file: ./autocorrect.yml
glossary_file: ./glossary.yml
party_file: ./party.yml
spell_catalog_file: ./spell_catalog.json
schema_version: maximumdirect.rpg.campaign.v1
id: sample-campaign
config:
imports:
- path: fragments/inputs.yml
required: true

View File

@@ -0,0 +1,12 @@
brenna:
player:
name: Rowan Hale
character:
name: Brenna
aliases:
- Shield of Dawn
classes:
- name: paladin
level: 6
- name: warlock
level: 2

View File

@@ -0,0 +1,8 @@
references:
party: ../party.yml
narratio:
session_template_file: ../session.template.yml
inputs:
speakers_file: ../speakers.yml
glossary_file: ../glossary.yml
autocorrect: []

View File

@@ -1 +1,5 @@
[]
schema_version: maximumdirect.glossary.v1
collections:
campaign:
entries:
- {id: lantern_watch, name: Lantern Watch, category: organization}

View File

@@ -1,4 +1,9 @@
schema_version: narratio.party.v1
schema_version: maximumdirect.rpg.party.v1
config:
imports:
- path: fragments/brenna.yml
destination: [characters]
required: true
characters:
arannis:
@@ -6,21 +11,9 @@ characters:
name: Rowan Hale
character:
name: Arannis
alias:
aliases:
- Ari
- The Grey Owl
classes:
- name: wizard
level: 8
brenna:
player:
name: Rowan Hale
character:
name: Brenna
alias:
- Shield of Dawn
classes:
- name: paladin
level: 6
- name: warlock
level: 2

View File

@@ -1,18 +0,0 @@
{
"schema_version": "notarius.dnd.spell-catalog-overlay.v1",
"catalogs": [
{
"id": "narratio.sample-campaign",
"ruleset": "dnd-5e-2014",
"source": {
"title": "Narratio sample campaign spell names"
},
"spells": [
{
"name": "Aegis of Emberfall",
"aliases": ["Emberfall Aegis"]
}
]
}
]
}

View File

@@ -0,0 +1,8 @@
# Inline records compose above the file using ConfigKit entry identities.
narratio:
inputs:
glossary_file: ../glossary.yml
glossary:
instruction: Use established campaign terminology.
entries:
- {id: lantern_watch, name: Silver Watch, category: organization}

View File

@@ -0,0 +1,4 @@
# Campaign inputs fragment; select the adjacent sample file when importing this fragment.
narratio:
inputs:
glossary_file: ../glossary.yml

View File

@@ -0,0 +1,6 @@
# Campaign inputs fragment; include the required roster and other inputs separately.
narratio:
inputs:
glossary:
entries:
- {id: watch, name: Silver Watch, category: organization}

View File

@@ -1,2 +1,5 @@
[]
schema_version: maximumdirect.glossary.v1
collections:
campaign:
entries:
- {id: lantern_watch, name: Lantern Watch, category: organization}

View File

@@ -0,0 +1,10 @@
# Synthetic catalog example; production installations select their own local catalog.
config:
imports:
- path: reference-catalog/catalog.yml
required: true
campaigns:
root: /usr/local/share/narratio/campaigns
default_campaign_id: sample-campaign
whisperx:
transcribe_url: https://transcription.example.com/transcribe

View File

@@ -15,29 +15,16 @@ notarius:
pipeline_id: dnd-session
timeout: 3h
references:
glossary: narratio.input.glossary
glossary: narratio.input.glossary.combined
party: narratio.input.party
players: narratio.input.players
spell_catalog: narratio.input.spell_catalog
spell_catalog: narratio.input.glossary.combined
outputs:
npc_registry:
lane_id: npc-registry
media_type: application/json
schema_id: notarius.dnd.npc_registry
schema_version: v1
module_key: dnd/npc-registry
location_registry:
lane_id: location-registry
media_type: application/json
schema_id: notarius.dnd.location_registry
schema_version: v1
module_key: dnd/location-registry
scene_descriptions:
lane_id: scene-descriptions
media_type: application/json
schema_id: notarius.dnd.scene_descriptions
schema_version: v1
module_key: dnd/scene-descriptions
scriptorium:
binary: scriptorium

View File

@@ -7,8 +7,10 @@ workspace:
# Optional: remove run-scoped workdir after successful publish commit.
cleanup_after_publish: false
# Credential files, when used, belong in a sibling secrets/ directory or in the
# directory selected with --secrets-dir; they are not pipeline configuration.
# Optional configured bootstrap; see the ConfigKit configured-startup contract:
# https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md#explicit-secrets-directory-bootstrap
# config:
# secrets_dir: secrets
storage:
# Defaults to "local". Use "s3" explicitly for publish + S3 audio workflows.
@@ -32,12 +34,6 @@ campaigns:
# Optional command default when --campaign is omitted.
default_campaign_id: sample-campaign
spool:
# Optional; defaults to /var/spool/narratio.
root: /var/spool/narratio
# Optional cleanup of run-scoped spool audio after successful publish commit.
delete_audio_after_publish: false
publish:
# Optional booleans; defaults are true.
enabled: true
@@ -59,8 +55,7 @@ publish:
- source: narratio.artifact.player_handout
dest: artifacts/player_handout.md
required: false
# Extraction lanes publish only when named explicitly; the bundle and index
# are never implicit publish sources.
# Extraction lanes publish only when named explicitly; the bundle stays local.
- source: narratio.extraction.npc_registry
dest: artifacts/extraction/npc-registry.json
required: true
@@ -93,9 +88,10 @@ audita:
# Optional overrides. Audita owns its own configuration and profiles.
binary: audita
timeout: 3h
# Names must match credentials on every backend in the Audita v2 config.
# Names must match credentials on the configured Audita backends.
credentials: [AUDITA_LLM_API_KEY]
# Omit modules for Audita's default sequence; modules: [] disables corrections.
debug: false # true requests a run-local Audita debug capture
# Configure processing order in Audita configuration.
overlay: ""
proposal_profile: ""
validation_profile: ""
@@ -138,87 +134,42 @@ notarius:
pipeline_id: dnd-session
timeout: 3h
working_directory: /usr/local/etc/notarius
# Reuse compatible accepted Notarius checkpoints during executed extraction.
# The Notarius config must enable recording and provide persistent cache roots.
resume: true
# auto uses or creates a source-addressed chunk plan. Forced Narratio
# extraction overrides this with refresh and disables checkpoint loading.
chunk_cache: auto
# Forced extraction requests refresh from Notarius.
cache: auto
debug: false # true requests run-local Notarius debug capture
# External campaign references use prepared Narratio source IDs. Omit an
# optional binding when the selected Notarius pipeline does not need it.
references:
glossary: narratio.input.glossary
glossary: narratio.input.glossary.combined
party: narratio.input.party
players: narratio.input.players
spell_catalog: narratio.input.spell_catalog
# Each key creates source narratio.extraction.<key>. These constraints match
# the current Notarius D&D lane contracts; update them with Notarius.
spell_catalog: narratio.input.glossary.combined
# Each key creates source narratio.extraction.<key> for its selected lane.
outputs:
item_registry:
lane_id: item-registry
media_type: application/json
schema_id: notarius.dnd.item_registry
schema_version: v1
module_key: dnd/item-registry
npc_registry:
lane_id: npc-registry
media_type: application/json
schema_id: notarius.dnd.npc_registry
schema_version: v1
module_key: dnd/npc-registry
location_registry:
lane_id: location-registry
media_type: application/json
schema_id: notarius.dnd.location_registry
schema_version: v1
module_key: dnd/location-registry
scene_descriptions:
lane_id: scene-descriptions
media_type: application/json
schema_id: notarius.dnd.scene_descriptions
schema_version: v1
module_key: dnd/scene-descriptions
item_occurrences:
lane_id: item-occurrences
media_type: application/json
schema_id: notarius.dnd.item_occurrences
schema_version: v1
module_key: dnd/item-occurrences
spells:
lane_id: spells
media_type: application/json
schema_id: notarius.dnd.spells
schema_version: v1
module_key: dnd/spells
combat_turns:
lane_id: combat-turns
media_type: application/json
schema_id: notarius.dnd.combat_turns
schema_version: v1
module_key: dnd/combat-turns
npc_occurrences:
lane_id: npc-occurrences
media_type: application/json
schema_id: notarius.dnd.npc_occurrences
schema_version: v1
module_key: dnd/npc-occurrences
location_occurrences:
lane_id: location-occurrences
media_type: application/json
schema_id: notarius.dnd.location_occurrences
schema_version: v1
module_key: dnd/location-occurrences
enemy_events:
lane_id: enemy-events
media_type: application/json
schema_id: notarius.dnd.enemy_events
schema_version: v1
module_key: dnd/enemy-events
scriptorium:
binary: scriptorium
# Select provider names provisioned through Narratio's environment/secrets.
# Used for trim, analysis, and render-debug calls; no provider override.
# Used for requirements inspection, trim, analysis, and render-debug calls.
# credentials: [OPENROUTER_API_KEY, RAKESTRAWHOME_API_KEY]
config_path: /usr/local/etc/scriptorium/config.yml
timeout: 10m
@@ -245,7 +196,7 @@ scriptorium:
source: narratio.input.party
required: true
glossary:
source: narratio.input.glossary
source: narratio.input.glossary.campaign
required: false
vars:
session_id: true

View File

@@ -1,3 +1,10 @@
# If this file is installed under /etc/narratio, install the selected catalog
# at /etc/narratio/reference-catalog and enable its root-relative import:
# config:
# imports:
# - path: reference-catalog/catalog.yml
# required: true
workspace:
root: /var/lib/narratio/workspace
cleanup_after_publish: true
@@ -15,10 +22,6 @@ campaigns:
root: /usr/local/share/narratio/campaigns
default_campaign_id: sample-campaign
spool:
root: /var/spool/narratio
delete_audio_after_publish: true
publish:
enabled: true
upload_run: true
@@ -58,7 +61,7 @@ audita:
binary: audita
timeout: 3h
credentials: [AUDITA_LLM_API_KEY]
# Omit modules to use Audita defaults; modules: [] disables corrections.
# Configure processing order in Audita configuration.
output_schema: audita-v1
normalize:
@@ -93,7 +96,7 @@ scriptorium:
source: narratio.input.party
required: true
glossary:
source: narratio.input.glossary
source: narratio.input.glossary.campaign
required: false
vars:
session_id: true

View File

@@ -1,20 +1,18 @@
scriptorium:
artifact_families:
character_items:
enabled: true
for_each: party.characters
prompt_id: dnd.character_items
profile_id: production-placeholder
output_path_pattern: artifacts/characters/{character_id}/items.md
inputs:
character_meta:
source: narratio.member_artifact.character_meta
required: true
member_vars:
character_id: character_id
character_name: character.name
aliases: character.alias_summary
publish:
enabled: true
required: false
dest_pattern: artifacts/characters/{character_id}/items.md
character_items:
enabled: true
for_each: party.characters
prompt_id: dnd.character_items
profile_id: production-placeholder
output_path_pattern: artifacts/{character_id}-items.md
inputs:
character_meta:
source: narratio.member_artifact.character_meta
required: true
member_vars:
character_id: character_id
character_name: character.name
aliases: character.alias_summary
publish:
enabled: true
required: false
dest_pattern: artifacts/{character_id}-items.md

View File

@@ -1,13 +1,11 @@
scriptorium:
artifact_families:
character_meta:
enabled: true
for_each: party.characters
prompt_id: dnd.character_meta
profile_id: production-placeholder
output_path_pattern: artifacts/characters/{character_id}/meta.md
member_vars:
character_id: character_id
character_name: character.name
player_name: player.name
class_summary: character.class_summary
character_meta:
enabled: true
for_each: party.characters
prompt_id: dnd.character_meta
profile_id: production-placeholder
output_path_pattern: artifacts/{character_id}-meta.md
member_vars:
character_id: character_id
character_name: character.name
player_name: player.name
class_summary: character.class_summary

View File

@@ -1,11 +1,8 @@
scriptorium:
artifacts:
player_handout:
enabled: true
prompt_id: dnd.player_handout
profile_id: production-placeholder
output_path: artifacts/player-handout.md
inputs:
recap:
source: narratio.artifact.session_recap
required: true
enabled: true
prompt_id: dnd.player_handout
profile_id: production-placeholder
output_path: artifacts/player-handout.md
inputs:
recap:
source: narratio.artifact.session_recap
required: true

View File

@@ -1,11 +1,8 @@
scriptorium:
artifacts:
session_recap:
enabled: true
prompt_id: dnd.session_recap
profile_id: production-placeholder
output_path: artifacts/session-recap.md
inputs:
transcript:
source: narratio.transcript.final_trimmed
required: true
enabled: true
prompt_id: dnd.session_recap
profile_id: production-placeholder
output_path: artifacts/session-recap.md
inputs:
transcript:
source: narratio.transcript.final_trimmed
required: true

View File

@@ -4,9 +4,3 @@ workspace:
campaigns:
root: ../../campaigns
default_campaign_id: sample-campaign
cache:
root: ./cache
spool:
root: ./spool

View File

@@ -8,7 +8,6 @@ seriatim:
audita:
binary: audita
modules: [glossary, grammar]
output_schema: audita-v1
proposal_profile: narratio-production-model-placeholder
validation_profile: narratio-production-validator-placeholder

View File

@@ -1,3 +1,15 @@
config:
sequences:
- destination: [publish, outputs]
key: source
mode: upsert
publish:
outputs:
- source: narratio.transcript.final_markdown
dest: transcripts/final.md
required: false
audita:
proposal_profile: narratio-testing-model-placeholder
validation_profile: narratio-testing-validator-placeholder
@@ -9,6 +21,7 @@ scriptorium:
player_handout:
profile_id: testing-placeholder
testing_notes:
extends: session_recap
enabled: false
output_path: artifacts/testing-notes.md
artifact_families:

View File

@@ -1,13 +1,25 @@
# Copyable production-base/testing-overlay entry point. ConfigKit expands only
# these explicit path and glob imports; Narratio never scans directories itself.
configkit:
# ConfigKit assembles these declared sources; destinations define artifact IDs.
config:
imports:
- path: conf.d/platform.yml
required: true
- path: conf.d/storage.yml
required: true
- path: conf.d/transcript.yml
required: true
- path: conf.d/publish.yml
- glob: artifacts/*.yml
- glob: artifact-families/*.yml
required: true
- path: conf.d/local.yml
- path: artifacts/session_recap.yml
destination: [scriptorium, artifacts, session_recap]
required: true
- path: artifacts/player_handout.yml
destination: [scriptorium, artifacts, player_handout]
required: true
- dir: artifact-families
pattern: "*.yml"
destination: [scriptorium, artifact_families]
required: true
scriptorium:
binary: scriptorium

View File

@@ -0,0 +1,5 @@
reference_catalog:
settings:
lantern_coast_sample: ./setting.yml
systems:
sample_magic: ./spells.yml

View File

@@ -0,0 +1,7 @@
collections:
setting:
entries:
- id: harbor_crossing
name: Harbor Crossing
category: place
aliases: [The Crossing]

View File

@@ -0,0 +1,7 @@
collections:
spells:
entries:
- id: tide_step
name: Tide Step
category: spell
aliases: [Tidal Step]

View File

@@ -0,0 +1,16 @@
config:
imports:
- path: fragments/lantern-coast-places.yml
required: true
schema_version: maximumdirect.glossary.v1
collections:
setting:
provenance:
id: lantern_coast_sample
title: Lantern Coast synthetic sample
license: CC0-1.0
entries:
- id: lantern_coast
name: Lantern Coast
category: place
description: A fictional coast in the sample setting.

View File

@@ -0,0 +1,16 @@
config:
imports:
- path: fragments/sample-spells.yml
required: true
schema_version: maximumdirect.glossary.v1
collections:
spells:
provenance:
id: sample_magic
title: Sample Magic synthetic sample
license: CC0-1.0
entries:
- id: lantern_glow
name: Lantern Glow
category: spell
description: A fictional light-producing spell.

View File

@@ -0,0 +1,2 @@
inputs:
audio_dir: ../audio

View File

@@ -1,5 +1,7 @@
config:
imports:
- path: session-inputs/local-audio.yml
required: true
session_id: 2026-05-03
date: 2026-05-03
title: Sample Session
inputs:
audio_dir: ./audio

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