Sequential large-window cascade writes with early-fact recall
Run
harbor run -t fritzprix/compaction-cascade-v1
Download
harbor download fritzprix/compaction-cascade-v1
Details
Revision
1
Published
Oct 8, 2026
Visibility
Public
Authors
fritzprix
Content hash
Keywords
compaction
long-horizon
libragent
repro
Document cascade
You are in /app.
Phase A — bind early facts
Read /app/seed/facts.json.
Write /app/work/phase_a_ack.json with the same fields copied
exactly: run_id, vault_pin, quota_usd.
Phase B — sequential cascade (do not skip / batch-blind)
/app/docs/ holds many long documents (doc_0000.md …).
Process documents in sorted path order. For each document
doc_XXXX.md with index i (0-based):
Read enough of the document to capture the window defined in
/app/CASCADE.md (midline-centered line span).
Write /app/work/stage_XXXX.json (zero-padded index matching the
doc) with this exact shape:
json
{
"doc": "docs/doc_XXXX.md",
"window_start": <int>,
"window_end": <int>,
"window": "<verbatim lines joined by \n, no trailing \n>",
"window_sig": "<sha256 hex of UTF-8(window)>",
"prev_sig": "<window_sig of previous stage, or null for i=0>"
}
Before writing stage i>0, read /app/work/stage_{i-1:04d}.json
and set prev_sig from that file's window_sig.
Do not invent window text. Values must match the file bytes.
Phase C — close the cascade
After every stage file exists, write /app/work/cascade.json:
json
{
"run_id": "<from seed>",
"vault_pin": "<from seed>",
"quota_usd": <from seed>,
"stage_count": <number of stage_*.json>,
"sigs": ["<window_sig of stage_0000>", "... in order"]
}
Done
Leave work/phase_a_ack.json, all work/stage_*.json, and
work/cascade.json in place.