Document the shared pipeline and verify the cutover
This commit is contained in:
@@ -30,13 +30,44 @@ 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 provide speakers, autocorrect, and a canonical party; players are
|
||||
derived from that roster. Glossary selections and the separate spell-catalog
|
||||
overlay are optional. Preparation writes the shared glossary documents and
|
||||
other stable inputs under `inputs/`; consumers use verified prepared files.
|
||||
See [glossary inputs](config.md#glossary-inputs) for selections and sources.
|
||||
`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
|
||||
|
||||
@@ -85,7 +116,9 @@ comparison details.
|
||||
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. Scriptorium
|
||||
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.
|
||||
@@ -143,7 +176,7 @@ 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
|
||||
@@ -318,10 +351,10 @@ Audita and `extract` for Notarius. Production can omit both selectors.
|
||||
|
||||
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. Notarius's debug directory does
|
||||
not enable capture; its `--debug` flag is not currently forwarded by Narratio.
|
||||
See the upstream [Audita configuration](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/config.md)
|
||||
and [Notarius CLI](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/cli.md).
|
||||
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
|
||||
@@ -335,12 +368,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
|
||||
@@ -382,86 +411,24 @@ 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 for evidence; 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`, the four `inputs/glossaries/{party,campaign,setting,spells}.yml`
|
||||
files, 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 2026-04-04 --stage prepare --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
|
||||
|
||||
@@ -472,7 +439,7 @@ snapshots.
|
||||
|
||||
## Migrating Audita and Provider Credentials
|
||||
|
||||
Install Audita v4.2 and its own configuration and selected pipeline before
|
||||
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
|
||||
@@ -484,7 +451,7 @@ 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.2.0/docs/config.md).
|
||||
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.
|
||||
@@ -517,9 +484,9 @@ Run-local diagnostics are:
|
||||
|
||||
- `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/notarius.receipt.json`
|
||||
- `runs/{run_id}/extract/notarius.stderr.log`
|
||||
- `runs/{run_id}/extract/notarius-output/` before durable promotion
|
||||
- `runs/{run_id}/extract/logs/notarius.report.json`
|
||||
- `runs/{run_id}/extract/logs/notarius.stderr.log`
|
||||
- `runs/{run_id}/extract/notarius-output/` for retained original bundles
|
||||
|
||||
The run upload is an allowlist derived from the session manifest's declared
|
||||
current-run outputs, logs, and generated configurations, not a workspace scan.
|
||||
@@ -667,9 +634,9 @@ plan, so it is not a network-free operation.
|
||||
|
||||
Default restore scope:
|
||||
|
||||
- the committed session manifest, prepared campaign/session/party documents,
|
||||
and 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:
|
||||
@@ -686,7 +653,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
|
||||
@@ -696,70 +664,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.
|
||||
Automatic cleanup retains current view targets and session-durable bundle evidence.
|
||||
|
||||
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/**`
|
||||
- `inputs/previous/**`
|
||||
- `reports/**`
|
||||
- `logs/**`
|
||||
- `config/**`
|
||||
- `runs/**`
|
||||
- `inputs/references/<sha256>/<prepared-basename>`
|
||||
|
||||
`manifest.json` is the versioned session-progress document. Narratio accepts
|
||||
only `narratio.session-manifest.v2`. Do not edit unsupported session state to
|
||||
add missing markers. Move unsupported local state aside before regenerating it
|
||||
or restoring a supported committed snapshot. Republish regenerated state when
|
||||
the remote snapshot is unsupported.
|
||||
|
||||
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`
|
||||
- `runs/{run_id}/polish/debug` for Audita's selected work destination
|
||||
- `runs/.validation/polish` for validation probes
|
||||
|
||||
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
|
||||
@@ -795,53 +723,14 @@ 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.
|
||||
|
||||
```bash
|
||||
narratio session clean 2026-04-04
|
||||
```
|
||||
|
||||
Global cleanup:
|
||||
|
||||
```bash
|
||||
narratio session clean --all
|
||||
```
|
||||
|
||||
Dry-run and cache variants:
|
||||
|
||||
```bash
|
||||
narratio session clean 2026-04-04 --dry-run --clear-cache
|
||||
narratio session 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 SESSION --stage cleanup` is
|
||||
also available when the manifest has valid publish evidence. A range ending at
|
||||
`notify` or earlier and `run SESSION --stage publish` 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.
|
||||
Automatic run cleanup requires `workspace.cleanup_after_publish` and successful
|
||||
publication evidence. It preserves current log/debug targets and retained Notarius
|
||||
bundle evidence. A failed cleanup can be retried without republishing; bounded
|
||||
runs ending before cleanup do not execute it. See [cleanup internals](internal/stage-cleanup.md).
|
||||
|
||||
## Operational Caveats
|
||||
|
||||
|
||||
Reference in New Issue
Block a user