2026-05-19 08:47:45 -05:00
# Internal: Artifacts
## Purpose
2026-05-23 14:07:11 +00:00
Define canonical artifact IDs, runtime catalog behavior, source resolution rules, and shared current-state mechanics used by app and previous-cache code.
2026-05-19 08:47:45 -05:00
2026-05-23 12:57:59 +00:00
## Built-in Source IDs
2026-05-23 14:07:11 +00:00
2026-05-23 12:57:59 +00:00
- `narratio.transcript.base` -> `transcripts/base.json` (`merge` )
- `narratio.transcript.polished` -> `transcripts/polished.json` (`polish` )
- `narratio.transcript.final` -> `transcripts/final.json` (`normalize` )
- `narratio.transcript.final_trimmed` -> `transcripts/final.trimmed.json` (`trim` )
2026-05-25 00:46:27 +00:00
- `narratio.transcript.final_markdown` -> `transcripts/final.md` (`render` )
- `narratio.transcript.final_trimmed_markdown` -> `transcripts/final.trimmed.md` (`render` )
2026-05-23 12:57:59 +00:00
- `narratio.bounds.session` -> `artifacts/session_bounds.json` (`trim` )
2026-05-19 08:47:45 -05:00
2026-05-23 12:57:59 +00:00
## Configured and Previous-Session Sources
2026-05-19 08:47:45 -05:00
2026-05-23 14:07:11 +00:00
- configured source ID format: `narratio.artifact.<artifact_key>`
- previous-session source ID format: `narratio.previous_session.artifact.<artifact_key>`
Both formats are validated by strict source-policy rules.
2026-05-19 08:47:45 -05:00
2026-05-23 12:57:59 +00:00
## Runtime Catalog
2026-05-23 14:07:11 +00:00
2026-05-23 12:57:59 +00:00
`ArtifactCatalog` tracks:
2026-05-23 14:07:11 +00:00
- `planned` : source registered for run context;
- `executable` : selected and enabled for analyze execution;
- `available` : local file exists and validates;
2026-05-23 12:57:59 +00:00
- `provenance` : availability source.
2026-05-19 08:47:45 -05:00
2026-05-23 12:57:59 +00:00
Current provenance values:
2026-05-23 14:07:11 +00:00
2026-05-19 19:42:28 -05:00
- `generated.current_analyze_run`
- `filesystem.disabled_artifact_output`
2026-05-20 15:17:04 +00:00
- `manifest.inputs.previous_cache`
- `current_session.previous_cache`
2026-05-23 12:57:59 +00:00
## Resolution Rules
2026-05-23 14:07:11 +00:00
2026-05-23 12:57:59 +00:00
Built-ins:
2026-05-23 14:07:11 +00:00
2026-05-23 12:57:59 +00:00
1. manifest producer outputs (when present)
2026-05-23 14:07:11 +00:00
2. canonical session-path fallback
2026-05-20 15:17:04 +00:00
2026-05-23 12:57:59 +00:00
Configured sources (`narratio.artifact.*` ):
2026-05-23 14:07:11 +00:00
2026-05-23 12:57:59 +00:00
- resolve only through runtime catalog availability.
2026-05-19 08:47:45 -05:00
2026-05-23 12:57:59 +00:00
Previous-session sources (`narratio.previous_session.artifact.*` ):
2026-05-23 14:07:11 +00:00
- resolve only from local `previous/` cache state;
- prefer manifest-backed previous-input paths;
2026-05-23 12:57:59 +00:00
- fallback to existing previous-cache filesystem paths.
2026-05-19 08:47:45 -05:00
2026-05-23 12:57:59 +00:00
Validation by content type:
2026-05-23 14:07:11 +00:00
2026-05-25 00:46:27 +00:00
- transcript JSON built-ins: JSON with top-level `segments` array;
- transcript Markdown built-ins: non-empty text file;
2026-05-23 14:07:11 +00:00
- bounds built-in: valid JSON;
2026-05-23 12:57:59 +00:00
- configured/previous-session artifact files: non-empty text file.
2026-05-19 08:47:45 -05:00
2026-05-23 12:57:59 +00:00
## Previous Requirement Collection
2026-05-23 14:07:11 +00:00
2026-05-23 12:57:59 +00:00
`CollectPreviousArtifactRequirements` :
2026-05-23 14:07:11 +00:00
2026-05-23 12:57:59 +00:00
- scans enabled configured artifacts only;
- extracts only canonical previous-session sources;
- deduplicates by artifact key;
2026-05-23 14:07:11 +00:00
- merges required and optional references (required wins);
2026-05-23 12:57:59 +00:00
- returns deterministic ordering and source locations.
2026-05-23 14:07:11 +00:00
## Current-State Helpers
Artifacts package owns shared remote current-state loading mechanics used by restore, status/validate checks, and previous-cache planning.
Core helpers:
- `LoadCurrentRunPointer`
- `LoadCurrentManifest`
- `LoadCurrentState`
- `ValidateCurrentStateIdentity`
Typed missing-state errors:
- `CurrentRunPointerMissingError` (`ErrCurrentRunPointerMissing` )
- `CurrentManifestMissingError` (`ErrCurrentManifestMissing` )
Identity validation supports caller-provided expectations:
- expected campaign;
- expected session ID;
- expected run ID, or pointer/manifest run-ID consistency check.
Caller policy is intentionally outside artifacts helpers:
- some callers fail on missing current state;
- some callers downgrade missing state to status/findings;
- some callers skip optional behavior when state is missing.
2026-05-23 12:57:59 +00:00
## Key Path Helpers
2026-05-23 14:07:11 +00:00
`internal/artifacts/paths.go` and S3-key helpers define canonical helpers for:
2026-05-23 12:57:59 +00:00
- session/work/run paths;
- previous-cache paths;
- spool/cache paths;
2026-05-23 14:07:11 +00:00
- S3 session/run/current-state key layout.
2026-05-23 12:57:59 +00:00
## Invariants
2026-05-23 14:07:11 +00:00
- source ID formats are stable contracts;
- artifact resolution is deterministic and manifest-aware;
- previous-session source resolution in `analyze` is local-only;
- remote current-state key construction remains centralized in artifacts helpers.