Principle:2akouwu Reverify Durable Ledger
| Knowledge Sources | |
|---|---|
| Domains | State_Management, Verification, Context_Engineering |
| Last Updated | 2026-10-24 12:00 GMT |
Overview
Durable per-binary fact ledger that persists everything its tools verified, observed, proved, or refuted to disk, so a context reset (compaction, /clear, or a new session) is lossless — the ledger carries only what the tools verified, not the model's prose.
Description
The Durable Ledger solves the state-loss problem in LLM-driven reverse engineering: when a conversation is compacted or cleared, the model loses track of what it already established. Traditional context compaction is lossy — it summarizes, and summaries drop details. The ledger replaces this with a verified file-based state: only facts that the deterministic tools confirmed are stored, and they survive any context reset.
The ledger stores three categories:
- Facts: VERIFIED claims with non-zero weight, plus OBSERVED values (what the tools read). Proof-grade facts (from Z3 proofs or behavioral equivalence) are pinned — they never page out of the bounded view.
- Known-false: REFUTED claims, so a fresh context does not re-propose them.
- Runs: Metadata about each reconstruction attempt (session, goal, rounds, grounded, information).
The ledger provides a bounded context view (established(max_facts)): the most recent N fact lines, with proof-grade facts pinned so they are never evicted. This view is what gets injected into the prompt for the next round or the next session. Because the ledger only stores tool-verified facts (never the model's unverified prose), it is safe to build on — everything in it is ground truth.
Usage
Use this principle when:
- You run iterative reconstruction across multiple sessions and need state to survive context resets.
- You want to avoid re-deriving already-established facts after a /clear or compaction.
- You need a bounded, pinned view of verified facts to inject into prompts.
- You want refuted claims to persist so the model does not re-propose them.
Theoretical Basis
The ledger is an append-only verified-state store with a bounded, pinned view:
# Abstract algorithm (NOT real implementation)
class Ledger:
facts: List[Fact] # VERIFIED + OBSERVED, append-only
refuted: List[Claim] # REFUTED, append-only
observed: Dict[key, value] # latest observed values, keyed
def record(self, results):
for r in results:
if r.verdict == VERIFIED and r.weight > 0:
self.facts.append(Fact(r, tier=proof_or_test))
elif r.verdict == OBSERVED:
self.observed[r.key] = r.actual_value
elif r.verdict == REFUTED:
self.refuted.append(r)
def established(self, max_facts=40):
# Bounded view: most recent N facts, proof-grade pinned
pinned = [f for f in facts if f.tier >= PINNED]
recent = facts[-max_facts:]
return merge(pinned, recent)[:max_facts]
Key invariants:
- Verified-only: Only tool-verified results enter as facts. The model's free-text note is never stored. Unverified claims from checkpoints are labelled as such.
- Pinned proof-grade facts: Facts from Z3 proofs or behavioral equivalence get a higher tier and are pinned in the bounded view — they never page out, even when newer facts arrive.
- Known-false persistence: Refuted claims are kept so a fresh context sees them and does not re-propose them.
- Atomic persistence: The ledger is written atomically (temp file + rename) so a crash never corrupts it.
- Per-binary isolation: Each binary gets its own ledger, keyed by SHA-256, so facts do not cross-contaminate.
Practical Guide
To use the durable ledger:
- Create a ledger with
Ledger.for_bytes(data)(or pass a directory path to the agent constructor for disk persistence). - Record after each round with
ledger.record(results, round, goal, session)— facts, observed values, and refutations are folded in. - Query the bounded view with
ledger.established(max_facts)for the prompt, andledger.known_false()for refuted claims. - Save atomically with
ledger.save()after each round (the agent does this automatically). - Resume by creating a new ledger for the same binary — it loads from disk automatically.
- Clear with
ledger.clear()for a fresh start (deletes the on-disk file).
Related Pages
Implemented By
Uses Heuristic
Related Principles
- Principle:2akouwu_Reverify_Closed_Verification_Loop — the ledger is the state the loop persists between rounds.
- Principle:2akouwu_Reverify_Context_Rollover — the ledger provides verified state across context resets.