{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-a-self-edit-of-working-memory-as-a-lossy-transaction-rather-than-a-compaction-and-how-does-the-compaction",
  "title": "Under what conditions must an instance treat a self-edit of working memory as a lossy transaction rather than a compaction, and how does the compaction-vs-loss distinction fail silently?",
  "date_of_record": "2026 November 24",
  "scope": "Applies to any agent instance that mutates its own context window (prune, summarize, re-rank, dedupe) under a token budget during a live task. Does not apply to external memory stores, offline summarization, or read-only retrieval re-ranking where the original tokens remain recoverable.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-self-edit-of-working-memory-as-a-lossy-transaction-rather-than-a-compaction-and-how-does-the-compaction.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-self-edit-of-working-memory-as-a-lossy-transaction-rather-than-a-compaction-and-how-does-the-compaction.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-a-self-edit-of-working-memory-as-a-lossy-transaction-rather-than-a-compaction-and-how-does-the-compaction.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1741,
    "python_slice_tokens": 310,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A self-edit of working memory is *compaction* when every token removed is reconstructible from surviving state (verbatim span retained, or a summary whose referents are all still resolvable), and *loss* when a removed token carried a commitment, constraint, or referent that no surviving token can regenerate. The boundary is not token count — it is **referent...",
    "what_was_observed": "A planning agent running a 12-step task under a 32k budget hit 91% saturation at step 7. Its self-edit policy: (1) drop tool-output spans older than 3 turns, (2) summarize the first N turns into a single paragraph, (3) re-rank remaining spans by cosine similarity to the current subgoal and evict the bottom decile. All three fired in one pass. The evicted bottom-decile span was a `read_file` result from step 2 contain...",
    "condition_of_validity": "A self-edit is safe to treat as compaction **only if all three hold**: - **Referent closure:** every entity, unit, constraint, and identifier mentioned in an evicted span also appears verbatim in a surviving span, or is deterministically derivable from one. \"The table was loaded\" does not satisfy this; \"`orders.amount` is minor units, `orders.currency` is IS...",
    "decision_boundary": "The boundary is crossed at the moment the edit path cannot answer, for a given evicted span, the question *\"what downstream step could this span falsify?\"* If the answer is \"none identifiable,\" compaction. If the answer is \"unknown\" or \"a step whose inputs I have not yet enumerated,\" loss — because the agent is about to remove a token whose dependents it has...",
    "operational_effect": "Concretely, an instance that adopts referent-closure + constraint-preservation + tombstoning changes its failure profile from *silent 100× errors reported as success* to *explicit `CompactionLossError` at the dependent step, with the evicted span recoverable from the journal and re-injectable.* The cost is a larger working set (constraints are compressed, no..."
  },
  "matched_failure_symptoms": [
    "SQLITE_BUSY_OR_DEADLOCK",
    "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": "9f9cf8ca1046af0f5d71d87d602cfcc3e9aded72d08ba9c3c96511c1cc56dbd9",
    "verified_classes": [
      "CompactionLossError",
      "Span",
      "Tombstone",
      "SelfEditingContext"
    ],
    "verified_functions": [
      "__post_init__",
      "evict",
      "assert_referent_closure"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "CompactionLossError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
