Heuristic:2akouwu Reverify Pinned Proof Facts
| Knowledge Sources | |
|---|---|
| Domains | Optimization, Context_Engineering, Verification |
| Last Updated | 2026-10-24 12:00 GMT |
Overview
Proof-grade and tested facts (PROVEN, TESTED tiers) are pinned in the bounded context view and never page out, ensuring the highest-confidence facts always survive context compaction.
Description
The ledger maintains a bounded context view (`established(max_facts)`) that shows only the most recent N fact lines. However, facts with a tier of PROVEN (Z3 proof) or TESTED (behavioral execution) are pinned — they are never dropped from the view regardless of age. This means that when the context is compacted or a new session resumes, the mathematically proven and empirically tested facts are always available, while lower-tier facts (VERIFIED, DERIVED, OBSERVED) may page out. The pinning threshold is `PINNED_RANK = 2`, which includes PROVEN (rank 3) and TESTED (rank 2) but not VERIFIED (rank 1).
Usage
Use this heuristic when reasoning about what survives a context reset or compaction in the reconstruction loop. PROVEN and TESTED facts are always visible to the model; lower-tier facts may be trimmed. When designing claim strategies, prioritize proof-grade and behavioral-equivalence claims for facts that must persist across sessions.
The Insight (Rule of Thumb)
- Action: Facts with `TIER_RANK >= 2` (PROVEN, TESTED) are pinned in the context view and never page out.
- Value: `PINNED_RANK = 2`. Tier hierarchy: PROVEN=3 > TESTED=2 > VERIFIED=1 > DERIVED=1 > OBSERVED=0.
- Trade-off: The bounded view (`max_facts`, default 40) may drop older VERIFIED/DERIVED/OBSERVED facts, but PROVEN and TESTED facts always remain. This prioritizes high-confidence results over recency.
- Compatibility: Applied in `Ledger.established()` which feeds both the agent loop and the MCP `re_ledger` tool.
Reasoning
When context is scarce, the model needs the most reliable facts available. A Z3-proven equivalence is mathematically certain — losing it to page-out would waste the cost of proving it. A behavioral-equivalence-tested fact is empirically strong. Pinning these tiers ensures the strongest results survive, while weaker facts (a single bytes_at verification) can be re-derived if needed. This is a form of cache prioritization: the facts that were hardest to establish and carry the most confidence are kept.
Code Evidence
Tier definitions from `ledger.py:54-59`:
PROVEN = "PROVEN"
TESTED = "TESTED"
DERIVED = "DERIVED"
TIER_RANK = {PROVEN: 3, TESTED: 2, VERIFIED: 1, DERIVED: 1, OBSERVED: 0}
PINNED_RANK = 2 # PROVEN and TESTED never fall out of the bounded view
Pinning logic in `established` from `ledger.py:492-506`:
def established(self, max_facts: int = 40) -> List[str]:
n = max(1, int(max_facts))
if len(self.facts) <= n:
return [e["line"] for e in self.facts]
pinned = [i for i, e in enumerate(self.facts) if TIER_RANK.get(e.get("tier"), 0) >= PINNED_RANK]
chosen = set(pinned[-n:]) | set(range(len(self.facts) - n, len(self.facts)))
for i in sorted(chosen):
if len(chosen) <= n:
break
if i not in pinned:
chosen.discard(i)
return [self.facts[i]["line"] for i in sorted(chosen)[-n:]]