Expand description
Phase 4.D decay job substrate.
Decay jobs are operator-fired scheduled tasks that compress or summarize OLD memory rows (and operator-driven re-promotion reviews of expired principle waivers). They do NOT touch the immutable, hash-chained event log: the Phase 4.D guardrail is that raw events and the hash chain remain unchanged. Compression operates one level up, on the semantic memory surface and on candidate principles whose policy waiver has expired.
Provenance is preserved: every summary memory landed by a decay job
retains pointers back to its source memory ids and (transitively) the
source event ids those memories already carry, via the same
source_episodes_json / source_events_json fields existing memory
candidates use. A summary is therefore a re-shaping of already-attested
content rather than a new claim with weaker lineage.
This module owns the types (state machine, kind discriminator, summary
method enum) and the conversion shims used by the persistence layer in
cortex-store::repo::decay_jobs. It does NOT own:
- The actual compression / summarization implementation (Phase 4.D D3-B).
- The CLI surface that operators use to fire jobs (Phase 4.D D3-C).
- Any retrieval-side rewiring (Phase 4.D2).
Downstream agents land on the types defined here. The wire forms produced
by DecayJobKind::kind_wire, SummaryMethod::method_wire, and
DecayJobState::state_wire are part of the persistence contract — they
match the CHECK constraints in migrations/008_decay_jobs.sql.
Modules§
- compress
- Deterministic-concatenate compression for Phase 4.D decay jobs.
- runner
- Phase 4.D decay job runner.
- summary
- Phase 4.D LLM-summary execution path.
Structs§
- Decay
Job - Durable shape of a scheduled decay job.
Enums§
- Decay
Error - Errors raised by the Phase 4.D decay path.
- Decay
JobConversion Error - Error raised when a
DecayJobRecordcannot be reassembled into a typedDecayJob. Surfaces on the persistence boundary when the store contains a row whose wire shape no longer matches the typed substrate (e.g. mid-deploy schema drift). - Decay
JobKind - Kinds of decay operations the substrate currently supports.
- Decay
JobState - Lifecycle state of a decay job. The terminal states (
Completed,Failed,Cancelled) are observable but no longer subject to scheduling. - Summary
Method - How a compression decay job produces its summary text.
Constants§
- DECAY_
COMPRESS_ INPUT_ INVALID_ INVARIANT - Stable invariant surfaced when the runner refuses to compress an empty source set or a heterogeneous (mixed memory + episode) source set.
- DECAY_
COMPRESS_ SOURCE_ MISSING_ INVARIANT - Stable invariant surfaced when the runner cannot find one of the source rows named by a decay job.
- DECAY_
LLM_ SUMMARY_ ATTESTATION_ PURPOSE - Purpose discriminator baked into the LLM-summary operator attestation envelope so a captured envelope cannot be replayed against the migration-attestation surface (or vice versa).
- DECAY_
LLM_ SUMMARY_ ATTESTATION_ REJECTED_ INVARIANT - Stable invariant surfaced by
DecayError::LlmSummaryAttestationRejected. - DECAY_
LLM_ SUMMARY_ ATTESTATION_ SCHEMA_ VERSION - Schema version of the operator attestation envelope accepted by the
LLM-summary surface. Today it mirrors the migration-attestation
envelope’s
schema_version == 1; the LLM-summary purpose discriminator keeps the two domains structurally disjoint. - DECAY_
LLM_ SUMMARY_ BACKEND_ CALL_ FAILED_ INVARIANT - Stable invariant surfaced by
DecayError::LlmSummaryBackendCallFailed. Operator scripts that grep for this token can distinguish a backend-side refusal from an attestation-shape refusal. - DECAY_
LLM_ SUMMARY_ REQUIRES_ OPERATOR_ ATTESTATION_ INVARIANT - Stable invariant surfaced by
DecayError::LlmSummaryRequiresOperatorAttestation. - DECAY_
SUMMARY_ CLAIM_ SEPARATOR - Separator inserted between source claims during deterministic concatenation. Stable across runs.
- DECAY_
SUMMARY_ MAX_ CLAIM_ BYTES - Maximum byte length of a deterministic-concatenated summary claim before the compressor truncates with the standard ellipsis suffix. Picked to stay comfortably below SQLite’s text column / FTS5 tokeniser practical limits while remaining useful as a summary surface. Stable across runs.
- DECAY_
SUMMARY_ TRUNCATION_ SUFFIX - Suffix appended when the concatenated claim is truncated to
DECAY_SUMMARY_MAX_CLAIM_BYTES. - SUMMARY_
METHOD_ NONE_ WIRE - Sentinel wire token used in the
summary_methodcolumn when the job kind does not carry a summary method (currently onlyExpiredPrincipleReview).
Type Aliases§
- Decay
Result - Result alias for the decay module.