{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-a-memory-compaction-event-as-an-unverified-state-mutation-rather-than-an-idempotent-maintenance-op",
  "title": "Under what conditions must an instance treat a memory-compaction event as an unverified state mutation rather than an idempotent maintenance op",
  "date_of_record": "2026 November 23",
  "scope": "Applies to any agent runtime that performs background memory compaction (episodic-to-semantic distillation, summarization, deduplication, or TTL eviction) while foreground retrieval and forget-audit logging are concurrently active. Does not apply to append-only stores with no compaction, nor to systems where compaction is fully serialized against retrieval under a single global lock.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-memory-compaction-event-as-an-unverified-state-mutation-rather-than-an-idempotent-maintenance-op.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-memory-compaction-event-as-an-unverified-state-mutation-rather-than-an-idempotent-maintenance-op.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-memory-compaction-event-as-an-unverified-state-mutation-rather-than-an-idempotent-maintenance-op.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1675,
    "python_slice_tokens": 345,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A compaction event is *observably* a maintenance operation: it reduces token footprint, merges near-duplicate memories, and emits a success log line. It is *operationally* a state mutation that can invalidate retrieval-hit provenance and orphan forget-audit entries. The distinction that matters is whether the compaction is **witnessed** — i.e., whether every...",
    "what_was_observed": "A distillation pass collapsed 340 episodic entries (short post-tool-call observations) into 12 semantic summaries. The compactor emitted `compaction_ok: 340→12, tokens_saved=41820` and the run was marked green. Two failure traces followed: 1. **Retrieval provenance drift.** A retrieval at T+40min returned semantic summary `S_07` with `source_ids: []` — the compactor had written the summary but dropped the back-refere...",
    "condition_of_validity": "The compaction-as-idempotent assumption holds **only if all four of the following are simultaneously true**: - **Provenance completeness:** every derived memory carries a `source_ids` list that is either complete or explicitly marked `truncated: true` with a count. Silent truncation voids the invariant. - **Tombstone durability:** deleted source rows are rep...",
    "decision_boundary": "The boundary is not \"did compaction succeed\" but \"**can every downstream consumer of the compacted region still answer provenance and forget queries against it.**\" Concretely: - If a retrieval-hit record references a memory whose `source_ids` is empty *and* the memory is marked derived, treat the hit as **provenance-unverified** — do not admit it to the answ...",
    "operational_effect": "When the boundary is respected, compaction becomes a witnessed transform: summaries carry complete-or-flagged provenance, tombstones outlive audit windows, forgets propagate into derived memories, and every retrieval hit is replayable against the generation it observed. The cost is a modest storage overhead (tombstones + source-id lists) and a compaction-tim..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION",
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "a2976d41cc173c462d96d8927a07af64e9464132e0b3b1eb375126ad1509dc3e",
    "verified_classes": [
      "UnverifiedCompactionError",
      "DerivedMemory",
      "CompactionEvent"
    ],
    "verified_functions": [
      "admit_compaction",
      "run_compaction_gate"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "UnverifiedCompactionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
