The pipeline artifact layer: canonical attributed store, two-tier freshness, in-place and projection delivery, context-provider registry, human round-trip, and version-control seam.
This is the artifact layer: the data model, staleness engine, and delivery machinery between pipeline stages and the files on disk. Every stored field carries three attribution slices with a fixed precedence (human edit beats machine output beats original source), and that invariant is what the rest of the layer builds on. Sub-packages follow the data flow: a canonical record defines the shape, a hash engine decides what to regenerate, a delivery pair writes results back, a provider registry assembles prompts, a round-trip pair closes the human loop, and a version-control seam handles the commit. Nothing here calls an LLM or touches the run store.
Where to start
Open packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/store/attributed.py first: the three-slice precedence (human > machine > sourced) is the invariant every other module depends on, and reading it makes the delivery and freshness logic legible.
Routes
- Deliver generated content in place
- packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/store/projection.py computes the projected value
- packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/deliver/inplace.py applies it with a do-no-harm marker
- packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/vcs/git_vcs.py stages and commits the moved subset
- Refresh a derived artifact
- packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/freshness/hashing.py computes the content hash
- packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/freshness/classify.py classifies the record state
- packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/freshness/ensure.py regenerates cheaply and writes only on a real change
- Assemble prompt context
- packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/providers/registry.py runs every provider of a tier into a brief map
- packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/providers/assembly.py composes the map into ordered named blocks with slot substitution
Canonical record model
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/store/attributed.py -- three-slice fields (sourced, machine, human) with fixed precedence; the declarative merge policy that carries human edits and valid machine blocks across a regeneration without hardcoding field names.
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/store/candidate.py -- active, shadow, and retired candidate populations per cell; at-most-one-active enforced by every mutator; pluggable serialization for bulk stores.
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/store/intermediary.py -- the single-intermediary hashing anchor: a cheap hash check short-circuits the common case, and the full rebuild path fires only on drift.
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/store/projection.py -- reduces a canonical record to the plain value shape a delivery mode or external reader expects; applies the effective-value and active-candidate picks along the way.
Staleness engine
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/freshness/hashing.py -- stable deterministic content hashing (sorted-key JSON, SHA-256, separator-safe); the shared-snapshot plus per-item split that keeps a unit hash cheap to recompute.
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/freshness/classify.py -- the single freshness predicate (HUMAN > EXCLUDED > MISSING > STALE > FRESH); every needs-regeneration check and coverage bucket delegates here.
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/freshness/tier.py -- the two-tier model: a source tier that invalidates the cheap derived artifact, and a generation tier that invalidates one expensive output.
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/freshness/ensure.py -- the ensure-chain: always regenerate in memory, compare content hashes, write only on a real change; optional pre-write hook for the version-control seam.
Delivery modes
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/deliver/inplace.py -- in-place mutation with a configurable do-no-harm marker; apply is a pure function of the store so re-apply is idempotent; first-class revert; drives the injected VcsBackend for the two-phase changeset choreography.
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/deliver/projection.py -- append-only projection to a standalone artifact; .bak rollback via rename; reload validation before the swap; aggregation of many units into one artifact.
Prompt context assembly
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/providers/registry.py -- name-to-callable registry with two tiers (source, generation); deterministic sorted ordering; run_tier assembles a tier outputs into a brief map for the assembler.
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/providers/assembly.py -- the single owner of prompt-block composition (ordered, conditional), configurable slot-syntax tokenization, and opaque label indirection that defeats an LLM key-collapsing.
Human round-trip
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/roundtrip/questions.py -- machine-asks / human-answers loop; answers survive regeneration via the store merge policy, and an orphaned answered question is retained as authored work.
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/roundtrip/returns.py -- export-for-review and intake-corrections closed loop; corrections land on the human slice so the do-no-harm precedence protects them from the next machine pass.
Version-control seam
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/vcs/git_vcs.py -- the git VcsBackend: a staged set stands in for a pending changeset, literal pathspecs prevent glob-sweep, and the commit contains only the successfully-moved subset.
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/vcs/null_vcs.py -- no-op backend for CI, tests, and consumers that do not use version control.
Unsupported-stub registry
packages/katsoft-llm-kit/src/llm_kit/pipeline/artifacts/cli/unsupported.py -- sticky exclude-forever registry: marks structurally unsupported units so a bulk run never re-pays an LLM call for a shape the pipeline cannot handle; persistable and round-trips through any YAML engine.