Files
narratio/docs/roadmap/implementation.md

872 lines
52 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Shared pipeline cutover implementation plan
## Purpose and execution instructions
Implement the final state in [pipeline.md](pipeline.md). That roadmap owns product
intent, operator choices, upstream baselines, and compatibility scope. This plan
owns the ordered implementation steps. All stages below are initially pending.
Each stage is a bounded prompt for a Luna coding agent. Execute them in order.
This is one end-to-end sprint across Narratio and `../narratio-reference-catalog`.
Intermediate stages may leave build errors or transitional test failures; record
the unresolved integration work and continue through the specified later stages.
Do not add temporary compatibility machinery to make an intermediate checkpoint
usable. A stage's completion means its assigned outcome is implemented and
reviewed; the sprint completes only after the final verification stage.
Start with [Development](../development.md) and [Agent Policy](../policy/agents.md).
Read the architecture, testing, documentation, and OSS policies for their
applicable work. Read each owning repository's agent instructions before changing
it. Follow its scoped commit policy; record the commit and verification outcome
for each completed stage here. Preserve unrelated changes. Publication, release
tags, pushes, and changes to other upstream applications are outside this plan.
Coverage map for the roadmap's verification outcomes:
| Outcome | Primary stages |
| --- | --- |
| Campaign contract and initialization | 4–6, 8, 22 |
| Shared contracts and catalog | 1, 4, 5, 7 |
| Prepared inputs, glossaries, references | 8–9 |
| Flat destinations and collision checks | 3, 10, 12, 16 |
| Audita and Notarius execution | 11–13 |
| Readiness | 14 |
| Latest views and diagnostic routing | 15–16 |
| Audio simplification | 17 |
| New-state boundary, publication, restore, cleanup | 2, 18–20 |
| Reuse, force, and integration evidence | 21–22 |
| Canonical documentation and final verification | 23 |
Read the complete feature roadmap once at sprint entry. Subsequent prompts can
read the named sections and owner documents for their stage. Inspect existing
tests and use codebase-memory-mcp for code discovery; the entry points below
identify owners rather than authorize indiscriminate rewrites. Prefer native
library APIs and the existing implementation boundaries.
## Baseline and fixed implementation choices
- Narratio baseline: `f2829f31e800551bce4a28ca73059d82357e61f7`.
It has native ConfigKit/CommandKit acquisition, four wrapperless glossaries,
Audita v4.2, Notarius v0.8.1 receipt/index handling, and the old workspace.
- Catalog baseline: `974b0403b610056f3477abb5dfa22d210cd3c2a9` at
`../narratio-reference-catalog`. Its catalog index and synthetic vocabulary
already exist; migration does not create real-world vocabulary.
- Use the exact released schema, ConfigKit, Audita, and Notarius revisions in
[Released baselines](pipeline.md#released-baselines-and-ownership). Obtain
contracts from those revisions, not an arbitrary later checkout. No schema SDK
import or subprocess Go-package dependency is required.
- Use `narratio.session-manifest.v2` as the new supported session-state marker.
Change the existing marker/validator, not a parallel migration framework.
Retain current remote commit/pointer formats unless a field actually changes.
Their referenced session manifest must be supported before local installation.
- Keep schema resources in a small `internal/domaininput` owner, with exact
versioned resource paths, adjacent semantics, and source provenance. It owns
shared structural/semantic validation, not configuration resolution or task
execution. Reuse the existing JSON Schema engine and register resources offline.
- Shared extensibility must survive typed binding. Use native dynamic mappings
and/or supported inline maps at extensible boundaries, retaining the actual
ConfigKit result and its presence/source evidence. Typed operational settings
remain strict. Do not round-trip YAML through a second loader to manufacture a
typed view; ordinary field interpretation yields separate domain views.
- Keep all campaign/session fields and omission rules exactly as specified in
[Campaign and session field layout](pipeline.md#campaign-and-session-field-layout).
Shared optional null rules and Narratio session clearing rules are distinct.
- Preserve the four individual glossary IDs and add exactly
`narratio.input.glossary.combined`, prepared as
`inputs/glossaries/combined.yml`. Bind it to both Notarius glossary roles.
The complete roster remains `narratio.input.party`.
- Keep existing absolute/relative output-path syntax where it can identify a
valid product destination. Analysis/bounds outputs must resolve directly under
`artifacts/`; combined transcripts directly under `transcripts/`. Extraction
output configuration gains optional `filename`, defaulting to `<output_key>.json`.
It names one flat file, not a remote publish destination.
- Use reported Notarius bundle roots below the run-local staging output root.
Retain original bundle evidence under its producing run, with its prior
session-durable lifetime. Canonical extraction availability depends on promoted
files and Narratio evidence, not on an index or diagnostic bundle surviving.
- Keep current byte limits, credential handling, workspace sharing modes,
cancellation, and file confinement. Add neither new caps nor exact-error-text
contracts. Managed latest-attempt links are a specifically supported navigation
feature, not general permission to follow arbitrary symlinks.
## Stage 1 — Bundle shared contracts and add offline domain validation
**Complete.** Commit: `Bundle shared domain contracts and validation`.
Verification: `go test ./internal/domaininput ./internal/glossary ./internal/doccheck`
with Go 1.27.4 passed. The existing private glossary validator remains in use
until its callers migrate to shared envelopes in later stages.
**Read:** roadmap “Shared acquisition and prepared inputs”; schema release
validation and each selected semantic document; OSS policy. Entry points:
`internal/glossary/glossary.go`, existing schema resources, and `go.mod`.
**Implement:**
1. Vendor the unmodified glossary, RPG party, and RPG campaign `0.2.0` schema
resources and their actual dependency closure from `2026.11.1`. Retain IDs,
semantics, exact source commit, and applicable licensing/attribution.
2. Add `internal/domaininput` using the existing JSON Schema dependency. Decode
schema-resource numbers exactly; register all required resources locally and
refuse missing-resource network retrieval through the compiler's loader.
3. Accept completed native domain values. Add only shared semantic checks not
expressed by JSON Schema, notably exact entry-ID uniqueness per collection.
Schema-valid extensions and omitted/null/empty distinctions remain data.
4. Replace the private glossary validator as callers migrate; leave acquisition
and composition with ConfigKit. Do not copy the schemas repository's harness.
**Verify:** structural and semantic boundaries for all three contracts, valid
extensions, aliases null/empty, duplicate glossary IDs, and the class-level bound.
Use local synthetic fixtures; no sibling checkout is needed by default tests.
## Stage 2 — Establish the supported-state boundary
**Complete.** Commit: `Reject unsupported session state before execution and restore`.
Verification: `go test ./internal/app ./internal/manifest ./internal/artifacts
./internal/doccheck` with Go 1.27.4 passed, including forced local and remote
rejection without session-file mutation. Remote discovery uses the existing
strict manifest loader before planning.
**Read:** roadmap “One cutover and durable-state boundary”;
[Manifest Internals](../internal/manifest.md) and
[Restore Internals](../internal/command-restore.md). Entry points:
`internal/manifest/{manifest,store}.go`, `internal/artifacts/current_state.go`,
runner acquisition, and restore discovery.
**Implement:**
1. Change creation, loading, saving, and validation to the selected v2 marker.
Keep current transcribe/analyze subcollections and their versioned contracts.
2. Reject unsupported local session state before changing historical session
files, creating execution workspaces, normalizing records, or attempting reuse.
Absence permits new-session creation; unsupported state is not absence.
3. Validate the session manifest in remote current-state discovery before restore
planning/installation and previous-session preparation. Do not migrate old
snapshots or change remote history. Disposable download staging is not a
conversion of historical state.
4. Preserve ordinary explicit whole-session deletion and lock behavior. Force
execution/restore does not reinterpret unsupported state as new-format data.
Explain regeneration or deliberate manual relocation using existing diagnostics.
**Verify:** current/new state succeeds; old, absent-version, and unsupported local
and remote manifests fail without rewriting existing session files. Test through
runner and restore entry points, not just the version comparison function.
## Stage 3 — Define the canonical workspace paths
**Complete.** Commit: `Define canonical session workspace paths`.
Verification: focused path-model, layout, reference-snapshot, and run-local tests
passed with Go 1.27.4. The broader `internal/stage` test run still has two
publication failures because previous-session publication enumeration uses the
old path; its migration belongs to Stage 18. Restore tests also retain old
previous-session paths and are assigned to Stage 19. Root reports/config paths
remain temporarily in use by producers until their routing changes later.
**Read:** roadmap “Final layout and ownership”; [Workspace Internals](../internal/workspace.md).
Entry points: `internal/artifacts/paths.go`, layout creation in its local store,
`internal/config` path constants, and `internal/stage/run_local.go`.
**Implement:**
1. Model flat products, raw/combined transcripts, inputs, audio, run-local
logs/debug, and latest-view paths through the existing path owner.
2. Move previous-session preparation to `inputs/previous/` and verified reference
snapshots to `inputs/references/<digest>/<basename>`. Keep their existing
content identity and confinement rather than inventing another cache.
3. Remove unused root-level reports/config/current/cache scaffolding where it
has no remaining content role, plus `transcripts/trimmed/`. Route remaining
consumers to their selected category in later stages; add no legacy aliases.
4. Retain root, campaign/session identity, manifest, lock, and restore-marker
placement. Do not eagerly create run directories or latest links for reuse.
**Verify:** path-model tests cover the complete target layout and preserved
configurable root. This stage defines paths; producer routing follows later.
## Stage 4 — Adopt the shared roster with Narratio-wide validation
**Complete.** Commit: `Adopt the shared party roster contract`.
Verification: `go test ./internal/config ./internal/domaininput ./internal/doccheck`
and focused party/roster stage tests passed with Go 1.27.4. A broader app/stage
run has the previously recorded publication and restore path transitions only.
**Read:** roadmap “Narratio-wide roster requirements”; shared party semantics;
[Party Contract](../integrations/party.md). Entry points: `internal/config/party.go`,
party acquisition/rendering, `artifact_families.go`, and native party inspection.
**Implement:**
1. Acquire shared party envelopes through ConfigKit; validate the completed
mapping with Stage 1 and apply Narratio's existing nonempty roster, ID,
player/name/class, ambiguity, and positive-level requirements consistently.
2. Replace the marker and singular `alias` with shared `aliases`. Preserve
supported extensions and explicit shared null/empty states in retained data;
derive family/member and players views separately. Preserve deterministic
consumer ordering without claiming YAML map order is shared identity.
3. Update file/bytes loading, explicit `--party-file` selection, native inspection,
and canonical rendering together. An override selects the roster for the
invocation without rewriting the campaign's authored reference.
4. Keep stable character-based artifact IDs and the existing players projection
identity. Its local projection format need not become another shared schema.
**Verify:** imports, overrides, whole-document extension forwarding, shared marker
and alias spelling, and consistent Narratio rejection even without class-related
artifacts. Family keys, dependencies, and repeated player names still work.
## Stage 5 — Replace campaign and session configuration shapes
**Complete.** Commit: `Adopt shared campaign and session configuration`.
Verification: focused shared-campaign, session-default, imported-origin,
snapshot, party, family, and template-path tests passed with Go 1.27.4;
`go test ./... -run '^$'` compiled all packages. A broader configuration and
application test run still contains many retired campaign/session fixtures and
the old prepared-autocorrection and spell-input consumers; acquisition,
preparation, and fixture reconciliation belong to Stages 6, 8, 21, and 22.
The shared optional-field binding and snapshot round trip were corrected in the
following session-acquisition commit after inspection exposed null expansion.
**Read:** roadmap “Campaign and session field layout” and “Shared acquisition”;
[Configuration Internals](../internal/configuration.md). Entry points:
`config.go`, `document_configkit.go`, validation, resource resolution, and renderers.
**Implement:**
1. Replace campaign `campaign_id` with shared `id`; use `references.party`, root
setting/system selectors, and the specified `narratio.inputs` extension.
Validate the shared envelope and strict typed Narratio settings through the
native lifecycle. Preserve shared extensions outside those typed settings.
2. Add inline autocorrection rules with the existing Seriatim rule fields
`target` and `match`; keep explicit replacement behavior separate from glossary
data. Remove campaign/session `autocorrect_file` and `spell_catalog_file`.
3. Apply each session default independently. Absent inherits; supplied values
replace; `[]`/null clears autocorrection; supplied inline glossary replaces
that whole contribution. Clearing inline vocabulary does not clear its file.
Retain existing optional-selector clears and reject null/empty required paths.
4. Resolve resource origins at their new native paths, including inherited/imported
references. Keep identity agreement, CLI-relative invocation context, safe
snapshots, and captured provenance. Shared root optional-field nulls remain
invalid where upstream says so; do not impose that rule on session clears.
5. Add optional `pipeline.campaigns.session_template_file`, resolving its source
origin. Keep the explicit campaign template override under `narratio`.
**Verify:** table-driven absent/null/empty/replacement cases, invalid retired keys,
wrong campaign identity, native imported origins, shared extensions, and strict
unknown operational fields. Exercise file and contextless session snapshots.
## Stage 6 — Complete native acquisition, inspection, and session initialization
**Complete.** Commit: `Complete native session acquisition and initialization`.
Verification: focused application tests for acquisition, independent native
inspection, party selection, remote authored-document preference, three-document
initialization, both template overrides, invalid templates, and template-relative
imports passed with Go 1.27.4. Focused shared-configuration tests also passed.
**Read:** roadmap “Author once” and “Worked campaign bundle”; native acquisition
and inspection sections of Configuration Internals. Entry points:
`configuration_acquisition.go`, `configuration_commands.go`, campaign selection,
`session_init_command.go`, and session-template helpers.
**Implement:**
1. Thread the new campaign identity/roster/settings through lazy campaign/session
acquisition, derived catalogs, identity assertions, and local/remote session
loading. Preserve actual ConfigKit results for all inspection scopes.
2. Select templates in campaign → pipeline installation → built-in order. Use
existing narrow placeholders and explicit session/audio options; add a small
built-in template rather than a new templating engine or required installed file.
3. Keep independent comparison acquisition, source/history evidence, redaction,
and inspection-only override behavior. Native inspection must not present a
prepared document or derived catalog as the effective configuration.
4. Render valid local and remote session documents with the new defaults and
original authoring-context behavior. No new CLI route is needed.
**Verify:** three-file setup initializes a session with no extra template; both
template overrides work and invalid selected templates do not fall back silently.
Cover party override, independent inspection, remote authored-session preference,
and source-relative template resources through existing application tests.
## Stage 7 — Migrate the shared reference catalog and its local checks
**Complete.** Catalog commit: `02dd53c6ea026347452d497350c40249c949f8ce`
(`Adopt shared glossary contracts in the reference catalog`). Verification in
the catalog with Go 1.27.4 and `GOPROXY=off GOSUMDB=off`: `go test ./...`
and `go run ./cmd/validate` passed after dependency preparation. Consumer
compatibility remains an opt-in Stage 22 verification.
**Read:** roadmap “Reference catalog adoption”; catalog README, FORMAT, license,
agent instructions if present, and compatibility script. Work only in
`../narratio-reference-catalog` for its migration, then record its resulting commit.
**Implement:**
1. Convert the indexed setting/spell entry points to shared envelopes, retaining
selectors, paths, entries, and partial import fragments. Remove consumer
instruction fields from maintained examples. Keep provenance factual and CC0.
2. Replace its private schema with the exact shared glossary resources, semantics,
dependency closure, and notices. FORMAT becomes the catalog authoring/selection
guide; upstream remains the field-level owner. No resolved export copies.
3. Add a small Go development validator under `cmd/validate` and a minimal module
using ConfigKit v1.4.0 and the maintained JSON Schema engine. Validate every
indexed source after native imports, its expected setting/spells role, and
exact final entry-ID uniqueness. Partial examples validate after composition
with a complete fixture; no new private partial schema is necessary.
4. Add focused valid/invalid tests and a local CI invocation of the same checker.
Keep dependencies pinned, source paths relative to their native definitions,
and default checks offline after dependency preparation. Read-only checking
must not generate canonical vocabulary. Update notices for actual dependencies.
5. Update README/FORMAT and retain the opt-in compatibility script; final consumer
execution is Stage 22. Commit this repository's unit locally and record its
full new commit for Narratio examples/verification. No catalog tag is required.
**Verify:** every indexed source and maintained example, imports, null aliases,
extensions, wrong marker/known shape, wrong collection role, and duplicate IDs.
Record `go test ./...` and validator results in the catalog checkout. Do not
require Narratio or Audita binaries for catalog validity.
## Stage 8 — Prepare campaign, session, speaker, and autocorrection inputs
**Complete.** Commit: `Prepare resolved documents and autocorrection rules`.
Verification: focused imported standalone-document, empty and populated rule,
checksum/provenance, reuse/invalidation, relocation, and prepared-source tests
passed with Go 1.27.4. The broader stage suite has the previously recorded
publication path failures and one maintained-example failure; the example
migration is assigned to Stage 22.
**Read:** roadmap “Shared acquisition and prepared inputs”;
[Prepare Internals](../internal/stage-prepare.md). Entry points: `prepare.go`,
`prepare_resume.go`, prepared-input identities, config renderers, and semantic contracts.
**Implement:**
1. Materialize effective standalone new-format campaign/session/party documents,
unchanged speaker-mapping input, and the players projection in canonical
`inputs/` locations. Derive from completed results, not a second resolution pass.
2. Serialize selected autocorrection rules to the Seriatim input envelope
`autocorrect: [...]`, including an empty list when no replacements apply.
The campaign/session authored field is the rule list, not a file wrapper.
Reuse existing replacement semantics and adapter validation boundaries.
3. Keep manifest-backed checksum/size/provenance records for the generated input.
Resume compares effective rule bytes and source meaning, not obsolete authored
filenames. Preserve independent session replacement/clearing behavior.
4. Remove private spell-overlay copies, cleanup, and prepared records. Update
input-source registration to reject its retired source rather than alias it.
**Verify:** imports and standalone snapshots, empty/nonempty autocorrection with
Seriatim-shaped files, checksum/provenance records, and changed rules triggering
ordinary preparation invalidation. Source relocation with equivalent effective
values must not gain a new blanket invalidator.
## Stage 9 — Prepare shared glossary envelopes, combined input, and references
**Complete.** Commit: `Prepare shared glossary envelopes and combined input`.
Verification: focused native composition, selected-only catalog acquisition,
individual/combined schema, dependency persistence, shared reference snapshot,
corruption, reuse, and safe publication-enumeration tests passed with Go 1.27.4.
The broader stage suite retains the previously recorded old-example and
publication-path transitions; downstream consumer execution is updated later.
**Read:** roadmap “Glossary composition and bindings”. Entry points:
`internal/glossary/{glossary,resolve}.go`, glossary configuration adaptation,
prepared source registration, and `extract_references.go`.
**Implement:**
1. Resolve only selected catalog files and the optional campaign file/inline
contribution. Compose campaign under inline through native ConfigKit inputs
and sequence identities, then validate the completed shared mapping.
2. Derive party vocabulary from the selected canonical roster. Write four
individual shared envelopes and the combined envelope, each with the shared
marker and collections mapping. Always include all four roles in the combined
file, even when empty. Preserve applicable collection metadata/extensions.
3. Register the combined logical identity and explicit input dependencies.
Preserve complete source data where task projections omit it; do not turn
collection extraction into an upstream schema rewrite or custom merge engine.
4. Use the Stage 3 reference snapshot paths and existing streamed checksum/size
verification before/after execution. Share verified paths between generation
and readiness. These files are managed inputs, not subprocess cache.
5. Update prepare reuse comparison and safe publication input enumeration for
the fifth file; later lifecycle stages complete transport/install behavior.
**Verify:** selected-only reads, native composition, empty and extended collections,
both Notarius roles resolving the same prepared source, four individual Audita
inputs, corrupted/missing snapshot handling, and whole-file invalidation when any
combined collection changes. Tests use a copied synthetic catalog, not a live repo.
## Stage 10 — Configure flat outputs and native Notarius controls
**Complete.** Commit: `Configure flat outputs and native Notarius controls`.
Verification: focused native configuration, retired-field rejection, extraction
filename, expanded-family/bounds/transcript collision, and explicit remote
destination tests passed with Go 1.27.4; `go test ./... -run '^$'` compiled all
packages. Older tests still author the retired campaign and Notarius formats;
their fixture reconciliation and the replacement extraction protocol follow in
the scheduled subsequent work.
**Read:** roadmap “Output placement and collision checks” and Notarius invocation
and cache sections. Entry points: output config/validation, artifact-family
derivation, artifact catalogs, and bounded planning.
**Implement:**
1. Replace Notarius resume/chunk-cache settings with optional native `cache`
modes; add enable-only `debug`. Remove output descriptor constraint fields,
retaining required output keys/lane IDs and optional flat `filename` overrides.
2. Apply the fixed output naming choices above. Reconcile analysis/family/bounds
configuration with flat local products and combined-transcript categories.
Reject collisions across built-ins, extraction, explicit artifacts, and all
expanded families, naming both producers before execution.
3. Perform session/roster-dependent checks after domain derivation but before
an execution attempt; app-only inspection need not acquire a roster. Planning
and execution consume the same validated derived destinations.
4. Preserve explicit remote publish destinations and semantic source IDs.
Do not sanitize or silently rename colliding products, filter lanes implicitly,
or require descriptor fields the producer no longer supplies.
**Verify:** native control omission/selection, retired-field rejection, default and
explicit extraction filenames, family/built-in cross-collisions, valid absolute
and relative canonical output forms, and unchanged remote destination semantics.
## Stage 11 — Replace the Notarius generation adapter protocol
**Complete.** Commit: `Adopt native Notarius completion reports`.
Verification: focused native argument, omission, successful fallback, failed
process, malformed report, and unsafe output-directory tests passed with Go
1.27.4; all packages compiled. The runner no longer parses receipt/index/sidecar
data; legacy test helpers and result fields remain temporarily for the extraction
consumer and fixtures migrated by the following work.
**Read:** roadmap Notarius invocation/completion sections and pinned upstream
subprocess, output, and CLI contracts. Entry points:
`internal/adapters/notarius/{runner,subprocess,fake}.go` and supervision tests.
**Implement:**
1. Build native args: `--input-file`, `--overlay`, `--format json`, references,
staging output, native cache, and debug controls. Preserve omitted versus
explicit overlay selectors, exact credentials, timeouts, and cancellation.
2. Decode completion only after successful process exit. Preserve expected
pipeline, reported absolute directory, counts, optional debug location, and
positive fallback count. Require a confined reported root under supplied
staging; never discover outputs by scanning or parsing run names.
3. Replace receipt/index/sidecar structs and parsing with the native report.
Keep stdout separate from bounded redacted diagnostics. Handle nonzero,
malformed, partial, or capture-failed outcomes without recovering success
from incidental files. Add no independent domain-quality assessment.
4. Update fakes to represent the native result and actual published directory;
remove old receipt-driven fixture machinery as its callers migrate.
**Verify:** argument vectors and environment, overlay omission/empty forwarding,
success/failure report delivery, unsafe directories, cancellation, and permissive
successful fallback. Do not compare artifact count with required lane count.
## Stage 12 — Promote extraction products and replace extraction evidence
**Complete.** Commit: `Promote native Notarius lane products`.
Verification: focused tests with Go 1.27.4 covered ten required lanes, custom
filenames and lane mapping, mapped-name collisions, missing and unsafe lanes,
partial promotion, a supervised subprocess report, canonical catalog/analysis/
publication resolution, JSON manifest round trips, reuse without the bundle,
changed references, cache/debug-only changes, forced refresh, visible fallback
counts, and retention-aware run cleanup. All packages compiled with
`go test ./... -run '^$'`. Tests and compatibility fields for the retired
receipt-based fixtures remain for their scheduled reconciliation.
**Read:** roadmap “Notarius completion, products, and cache”; artifact and extract
internals. Entry points: `extract.go`, `extract_resume.go`, extraction evidence,
catalog hydration/resolution, and source/publication metadata.
**Implement:**
1. Resolve required lanes using the upstream lane-ID filename mapping. Validate
bounded regular JSON files and stage every required result before promotion
to its Stage 10 flat destination. Keep existing promotion/failure semantics;
do not invent a multi-file transaction or rollback guarantee.
2. Record canonical output checksum/size, configured lane identity, factual
native completion metadata, and result-affecting reference/input evidence.
Remove `notarius_index` and descriptor/receipt acceptance dependencies.
3. Retain the original bundle under its producing run, including optional
chunk-map/evidence-context auxiliaries. Mark its retention role explicitly so
cleanup does not shorten the old bundle's session-durable lifetime. It is not
a required runtime index, wholesale publish payload, or diagnostic API.
4. Update runtime artifact resolution, status/catalog views, analysis inputs,
and resume to use canonical products and Narratio evidence. Display qualified
fallback counts for fresh and reused results without inferring lane quality.
5. Forced extract passes cache refresh; ordinary executed extract respects the
selected native mode. Cache/debug-only changes do not stale completed products.
Preserve transitive invalidation and old completed-file availability rules.
**Verify:** all ten maintained lanes, custom filename mapping, missing/unsafe lane,
partial failure, durable promotion, independent canonical resolution, ordinary
reuse, changed references, forced refresh, and visible fallback on reuse.
## Stage 13 — Adopt Audita shared inputs and workspace destinations
**Complete.** Commit: `Verify Audita shared inputs and diagnostics`.
The shared request builder and native report/debug routing were already in place;
the maintained polish fixtures now use schema-validated shared envelopes with
explicit empty lists and inert extension data. Verification with Go 1.27.4 passed
for prepared-file parity, repeated glossary arguments, destination/debug modes,
failure reports, transcript acceptance, resume evidence, credentials, and
cancellation. Controlled real-binary evidence remains scheduled separately.
**Read:** roadmap Audita section and pinned runtime-input/migration contracts;
[Polish Internals](../internal/stage-polish.md). Entry points: Audita adapter,
polish stage, production composition, and adapter boundary tests.
**Implement:**
1. Supply the four verified individual shared envelopes through existing repeated
`--glossary-file` args, including empty collections. Keep identical saved
inputs in process/preflight; retain config/overlay/profile and credential flow.
2. Keep collection selection, instruction handling, and empty-task readiness
downstream. No local nonempty-glossary rule or generated Audita config.
3. Select staged transcript output, actual polish logs/report destination, and
run-local diagnostic/debug destination through supported Audita controls.
Retain default ordinary reporting and enable-only debug behavior.
4. Keep existing transcript/report acceptance and failure evidence behavior.
Change semantic evidence for new prepared bytes without version-only reruns.
**Verify:** repeated envelopes, explicit empty replacement, inert shared instruction
extensions, process/preflight parity, default reporting, failed-run reports,
debug on/off destinations, and unchanged transcript validation and cancellation.
## Stage 14 — Integrate native Notarius readiness with shared preflight
**Complete.** Commit: `Add native Notarius readiness checks`.
Verification with Go 1.27.4 covered projected selection and reuse, forced cache
refresh, preparation ordering, isolated automatic and explicit probe paths,
real-versus-synthetic input choice, prepared-reference integrity, complete lane
inspection, missing lanes, incomplete/failed assessments, cache warnings,
credential forwarding, cancellation, lazy initialization, and unchanged stage
records on failure. All packages compiled with `go test ./... -run '^$'`.
The pipeline-inspection shape was also checked against the pinned v0.10.0
checkout; controlled real-binary interoperability evidence remains in Stage 22.
**Read:** roadmap “Readiness and invocation lifecycle”; pinned Notarius preflight
and pipeline inspection contracts; [Preflight Internals](../internal/preflight.md).
Entry points: Notarius adapter, `internal/preflight`, `runner_preflight.go`, lazy
dependencies, and session validation.
**Implement:**
1. Add native Notarius pipeline preflight and pipeline inspection through the
adapter. Inspect required lane definitions because upstream readiness cannot
know Narratio's required-output map. Preserve incomplete inspection as such.
2. Select extraction readiness only when projected selected work requires it;
retain full Audita readiness and existing Scriptorium requirements discovery.
Run after selected prepare/reuse and before remaining selected processing.
3. Share execution config/overlay, refs, credentials, cache choice, and native
debug settings, but use diagnostic probe destinations outside actual attempt
views. Use a verified real execution transcript when available, otherwise the
known-good synthetic input; report the input actually checked.
4. Accept only successful process status plus a complete expected-pipeline
assessment with ready true. Preserve warnings, including nonfatal cache
warnings. Keep native failures, partial delivery, and optional debug locations.
5. Explicit session validation uses existing prepared inputs and its established
probe namespace. Planning remains subprocess-free; no preflight stage record,
cached readiness guarantee, second mandatory paid probe, profile list, or
additional automatic offline validation subprocess is introduced.
**Verify:** target selection for bounded/reused/forced runs, preparation ordering,
missing lane/reference/provider, cache warnings, failed/incomplete reports,
synthetic limitations, lazy unrelated adapters, and probes leaving latest views
and ordinary stage records unchanged. Use controlled providers/subprocesses.
## Stage 15 — Add latest-attempt log/debug views to the runner
**Complete.** Commit: `Track latest stage attempt diagnostics`.
Verification with Go 1.27.4 covered first and repeated attempts, failed attempts,
empty debug directories, self-skips and reuse, distinct producer runs, relative
targets, reserved probe names, conflicting files and links, unsafe directory
components, creation failures, and workspace-free cleanup. The confined layout
checks also reject symlinked session directories. Focused preflight tests passed;
all packages compiled. Legacy fixture failures remain scheduled for reconciliation.
**Read:** roadmap “Latest attempts, debug, and retention”; workspace and runner
lifecycle docs. Entry points: run-local path owner, `runner_runtime.go`, execution
attempt transitions, and shared file operations.
**Implement:**
1. Add one narrow operation creating actual run-local stage log/debug directories
and advancing the two relative session symlinks at an actual attempt boundary.
Use existing confined operations; do not weaken general symlink rejection.
2. Advance both views on attempts that fail, with an empty debug directory when
capture is absent. Leave skipped/reused stage views untouched. Keep physical
run creation lazy; preserve cleanup-only behavior when no diagnostics need it.
3. Keep actual paths in manifest/publication references. Probes do not advance
actual stage views. Restore's independent diagnostic group is wired in Stage 19.
4. Handle managed-link replacement and unexpected path conflicts with existing
error/confinement semantics; do not delete arbitrary conflicting content.
**Verify:** first/repeated attempt, failure, no capture, skip/reuse, different
producing runs per stage, safe relative targets, unexpected conflicts, and
directory-write failure. Check that a reused invocation creates no empty run.
## Stage 16 — Route all producer diagnostics and remaining flat products
**Complete.** Commit: `Route producer diagnostics to run directories`.
Verification: focused artifact and producer-stage tests passed, including multiple
render invocations and debug-independent fingerprints; `go test ./... -run '^$'`
passed with Go 1.27.4. Broader publication tests still include old previous-cache
and extraction fixtures, to be reconciled in the publication, restore, and test
cutover stages.
**Read:** roadmap workspace and diagnostics sections; focused merge, normalize,
trim, render, and analyze internals. Entry points: `run_local.go`, those stages,
Seriatim/Scriptorium adapters, and render-debug helpers.
**Implement:**
1. Send process streams, invocation descriptions, Seriatim execution reports, and
ordinary failures to actual stage log directories. Remove reports from
canonical artifacts and unused root-level diagnostic destinations.
2. Route Scriptorium prepared render-debug products to trim/analyze run-local
debug paths, keeping per-artifact selection and distinguishable invocation
names. Preserve declared publication eligibility for existing render-debug
products; full Audita/Notarius capture remains local.
3. Finish flat analysis/family/session-bounds promotion and direct combined/raw
transcript placement. Generated files consumed later retain their product
location. Update paths in invocation metadata and per-artifact evidence.
4. Keep debug enablement from invalidating products and preserve result stdout
versus redacted diagnostic separation. Do not add a Seriatim debug mode.
**Verify:** representative successful/failed stages, multiple artifact invocations,
flat bounds/analysis/family outputs, log/debug categorization, preserved captured
result bytes, and correct latest views. Reuse existing stage tests rather than
creating a parallel orchestration harness.
## Stage 17 — Simplify audio acquisition to one retained session copy
**Complete.** Commit: `Keep one verified copy of session audio`.
Verification: focused audio, prepare, resume, cleanup, and command tests passed,
including reuse, changed or missing sources, corrupt bytes, failed download and
retry, and preservation of historical storage. All packages compile with
`go test ./... -run '^$'` using Go 1.27.4. Restore integration and remaining old
fixtures are reconciled in the subsequent restore and test cutover stages.
**Read:** roadmap “Audio acquisition”; current audio and restore contracts.
Entry points: `internal/audio`, prepare audio handling, artifact spool/cache
helpers, configuration, and manifest local-path bookkeeping.
**Implement:**
1. Refactor S3 materialization to validate/reuse canonical session audio or
download into a temporary destination and install verified bytes there.
Preserve current source-object identity/content checks and cancellation.
2. Remove persistent audio-cache identities/sidecars, retained spool copies,
cache/spool configuration and cleanup controls, and obsolete manifest fields.
Retain narrowly necessary download staging; no separate retained copy remains.
3. Keep local audio collision handling, membership, checksums, and per-speaker
continuation evidence. Restore uses the same materializer in Stage 19.
4. Do not delete recordings, historical old-session caches, or prepared audio
automatically as a side effect of removing the old configuration feature.
**Verify:** current prepared reuse, changed/missing/corrupt content, interrupted
download/retry, local/S3 selection, and no retained cache/spool duplicates. Missing
prepared audio is fetched again; separate subprocess caches are never targeted.
## Stage 18 — Publish new-format products and prepared inputs
**Complete.** Commit: `Publish prepared inputs and flat extraction products`.
Verification: focused publication and output-planning tests passed with Go
1.27.4, covering committed prepared inputs, flat extraction evidence, previous
input enumeration, declared diagnostics and private capture exclusion, locks,
failures, and pointer ordering. Restore mapping of these prepared inputs follows
in the next stage.
**Read:** roadmap durable lifecycle sections; [Publish Internals](../internal/stage-publish.md).
Entry points: publish source/output planning, transfer and commit code,
runtime catalog/evidence, and archive enumeration.
**Implement:**
1. Publish the supported manifest, standalone prepared inputs including five
glossaries and generated autocorrection, selected flat products, and declared
diagnostics using actual run paths. Relocate previous-session enumeration to
the new input subtree without changing immutable remote output destinations.
2. Remove distinguished index/receipt assumptions. Do not scan/upload Notarius
bundles wholesale, follow latest symlinks, upload reference snapshot duplicates,
or add full debug archives because capture was enabled.
3. Keep the existing five publish outcomes, remote locks, carried source identity,
confined regular-file streaming, immutable commit declaration, and pointer-last
commit boundary. Current canonical availability still requires manifest evidence.
4. Update metadata consumed by restore and cleanup; preserve exact successful
publication authorization rather than inferring it from directory contents.
**Verify:** prepared-input and extraction declarations, actual diagnostic paths,
local flat/remote nested mapping, absent index, debug exclusion, carried locks,
optional/required missing products, upload failure, and unchanged pointer safety.
## Stage 19 — Restore new-format sessions and previous-session inputs
**Complete.** Commit: `Restore prepared inputs and flat session products`.
Verification: focused restore planning, execution, unsupported-state, conflict,
audio, previous-input, transition-lock, and interrupted-retry tests passed, as
did previous-cache and manifest tests with Go 1.27.4. Older forced-analysis
workflow fixtures remain for the subsequent integration-test cutover.
**Read:** roadmap state boundary and workspace; Restore Internals. Entry points:
restore discovery/plan/execute/report, shared current-state acquisition,
`internal/previouscache`, and prepared-input mapping.
**Implement:**
1. Finish v2 remote/local checks before destination mutation. Map selected commit
declarations to new canonical input/product/audio paths, installing the
verified manifest last. Preserve generation/checksum/size and conflict rules.
2. Restore all prepared input records including combined vocabulary and generated
rules. Keep producer-local resource paths from becoming destination authority;
rebase through existing confined mapping. Reference snapshots can be recreated
from verified prepared inputs rather than archived twice.
3. Use the simplified audio materializer. Map previous-session data beneath
`inputs/previous/` while preserving source-to-published-object resolution and
restore/prepare/status/validation agreement.
4. Write restore diagnostics under a run-local restore group and update
`logs/restore` for actual execution, including useful failure reports. Dry-run
planning creates no execution view. Preserve incomplete-restore markers,
shared session locking, retries, and current non-rollback behavior.
**Verify:** publish/restore round trips into a new root, forced regular conflicts,
non-regular conflicts, unsupported old snapshots, partial-install retry, single
pointer-selected authority, audio restore without cache/spool, and previous-session
requirements. Restore never executes pipeline stages.
## Stage 20 — Reconcile cleanup with diagnostic and bundle retention
**Complete.** Commit: `Preserve current diagnostics during run cleanup`.
Verification: focused cleanup, managed-view, native bundle-retention, and
orchestration tests passed with Go 1.27.4, including link rotation, retained
evidence, unsafe links, publication authorization, cleanup-only execution,
and failure/retry without republishing.
**Read:** roadmap retention and durable lifecycle; [Cleanup Internals](../internal/stage-cleanup.md).
Entry points: `cleanup_plan.go`, `cleanup.go`, app cleanup targets, and confined
file operations.
**Implement:**
1. Remove spool/audio-cache deletion policies and targets. Keep explicit prepared
audio/session deletion under existing manual authorization, not a replacement
automatic cleanup behavior.
2. Replace whole-run deletion where needed with role-aware run cleanup preserving
latest log/debug targets and original Notarius bundle evidence for its prior
session-durable lifetime. Older diagnostics remain eligible under existing run
cleanup once no protected view refers to them. Add no age/count retention policy.
3. Derive protections through the canonical managed-link/evidence owner, not
arbitrary filesystem traversal. Do not delete subprocess working State/Cache.
4. Preserve publish-evidence prerequisites, selected published-run identity,
idempotence, and cleanup failure/retry semantics. Resume treats retained
protected material as intentional, not as recreated work requiring endless
cleanup. Explicit entire-session deletion removes that session's views/evidence.
**Verify:** latest targets from multiple runs, old eligible diagnostics, bundle
retention independent of latest views, no external cache deletion, disabled policy,
partial delete retry, cleanup-only invocation, and publication authorization.
## Stage 21 — Reconcile reuse, planning, and inspection across the cutover
**Complete.** Commit: `Reconcile reuse and inspection with native extraction`.
Verification: the Go 1.27.4 suite passed with only the maintained-example and
assembled-example tests assigned to Stage 22 excluded. Focused tests also passed
for restored reuse, forced analysis and extraction, bounded execution,
credential sharing, fallback reporting, current extraction evidence, and prepared
session publication. The full suite still identifies the example migrations
scheduled for Stage 22; no legacy-format fallback was added.
**Read:** roadmap verification and existing semantic/invalidation contracts.
Entry points: prepare/extract/analyze resume, artifact hydration, session planning,
status/validation, configuration persistence, and command result reporting.
**Implement:**
1. Close remaining source-ID/path/evidence references left by earlier stages.
Remove retired private spell, receipt/index, wrapperless, and persistent
audio-cache branches and fixtures; add no old-format fallback.
2. Verify that supported sessions preserve per-speaker/per-artifact checkpoints,
aggregate decisions, explicit forced refresh, and fixed transitive invalidation.
Config source layout, credential rotation, debug/cache selection, or executable
version alone must not become blanket reasons to repeat work.
3. Check bounded plan/run parity, prerequisite guards, source availability, and
non-mutating planning. Keep old completed-file/failed-replacement availability
consistent with the owning stage's current behavior; do not normalize all
stages to a newly invented availability policy.
4. Keep user-visible fallback/readiness qualifications and native failure causes
available through fresh and reused command reports, without a new error taxonomy.
**Verify:** assembled interrupted/retried transcript and artifact workflows,
force-extract versus analyze-only force, changed/unchanged vocabulary, bounded
runs with unrelated adapters absent, restored reuse, and no unexpected workspace
creation on fully reused or plan-only invocations.
## Stage 22 — Prove the three-file workflow and real consumer boundaries
**Read:** roadmap verification table and compatibility guidance. Entry points:
`internal/app/compatibility_test.go`, assembled workflow fixtures, existing
Notarius integration tests, and the catalog compatibility script.
**Implement:**
1. Copy the planning bundle into maintained examples, adjust remaining full and
production/testing examples, and use synthetic shared catalog data pinned to
the Stage 7 commit. Keep planning fixtures clearly labeled until replacement.
2. Extend existing offline assembled workflows to onboard with only the three
campaign documents, initialize a session, prepare selected vocabularies and
rules, execute controlled consumers, and exercise reuse/failure recovery.
Cover omitted/supplied inline sections and installation/campaign templates.
3. Refresh opt-in real Audita v4.3.0 checks and Notarius v0.10.0 checks using a
controlled local provider. Cover shared inputs, processing/preflight parity,
the complete ten-lane Notarius pipeline, cache reuse/refresh, and flat promotion.
Record executable revisions, catalog commit, commands, and results here.
4. Retarget the catalog's existing compatibility script to those checks. Keep
explicit binary/repository selection and opt-in gates. Default tests must
skip those external requirements and use repository-local fixtures.
**Verify:** run the offline workflow tests and available controlled real-binary
checks. If an executable cannot be obtained, record the precise missing evidence;
do not replace it with a paid-provider dependency or claim tested interoperability
from schema/unit results. Complete that evidence before claiming the sprint's
tested consumer baselines. No source release is needed to exercise local binaries.
## Stage 23 — Finish canonical documentation and end-to-end verification
**Read:** roadmap “Delivery, documentation, and verification”; documentation,
architecture, testing, and OSS policies; Development validation commands.
**Implement:**
1. Publish the operator setup/campaign/session responsibilities and complete
three-file onboarding workflow in Operations, linking field definitions in
Configuration and shared contracts upstream. Document required/optional
fields, defaults, clearing/override semantics, and source-relative references.
2. Update CLI examples, party/shared integration references, adapter and
preparation/preflight/workspace/artifact/manifest internals, troubleshooting,
and maintained example navigation. Document flat products, latest views,
diagnostic retention, separately configured subprocess caches, and the state
cutover/regeneration procedure. Remove obsolete cache/spool/index assumptions.
3. Align architecture policy with the accepted ADR ownership/layout and the
distinction between extensible shared documents and strict operational
settings. Preserve API-key protection and ordinary group sharing. Current
upstream APIs remain linked, not re-documented or translated locally.
4. Complete exact schema/catalog/dependency provenance and applicable attribution.
Keep catalog CC0 and Narratio's existing licensing scopes. Release migration
guidance can be written without creating a release note/tag or running publish.
5. Audit the roadmap verification table against the actual implementation and
Stage 22 evidence. Record final results and any genuinely unfinished work
here. Do not mark the sprint complete with unresolved required outcomes.
**Verify:** prepare dependencies separately, then use the maintained Go 1.27.4
toolchain for `go test ./...`, `go test -race ./...`, `go vet ./...`, and
`go build ./...`. Run declared Linux amd64/arm64 and best-effort darwin arm64
cross-builds using the repository's existing target selections; native macOS is
not required. Catalog checks run independently in its module. Validate local
documentation links, maintained examples, formatting/diffs, recorded real-binary
evidence, and a clean scoped Git status in each changed repository. Reuse passing
checks for unchanged final content rather than duplicating release validation.
## Open Questions
None requiring a product decision. The roadmap settles campaign/session fields,
roster policy, glossary bindings, state compatibility, and workspace behavior.
This plan selects the state marker, source/file identities, owner boundaries, and
work ordering. Record stage-local implementation details and evidence without
reopening those decisions or introducing additional policy.