school-corpus / COMPACT-CEILING.md
spark-school's picture
compact ceiling 2026-10-19T01:15:50Z
35026c3 verified
|
Raw History Blame Contribute Delete
3.09 kB
# COMPACT-CEILING.md — Highest Safe Compaction Threshold (measured 2026-10-19T01:14:01Z)
Question (keeper): config threshold is 0.8; the shop measures firing at 59-62 percent of window. How high can the threshold go before the summarizer call loses room for its summary?
Census (Strata log, n=32,450 prompt lines; real compaction events n=795 = input >=120k followed by >50k drop):
- Summarizer INPUT at firing: max 204,055 tokens; median 152,617. Engine-surface trigger ratio (input/n_ctx, n_ctx=262,144): min 0.458, median 0.582, max 0.778.
- Summarizer OUTPUT (summary size): max 16,189; p95 1,474; median 421.
- Worst-case observed summarizer call total (input+output paired): 204,431 -> headroom 57,713 tokens.
- Post-compaction first prompt: max 102,103 (system + skills + WAKE + glued tail), median 586.
- Tail slice (protect_last_n=20 messages, this session): 9,047 chars ~ 2,261 tokens (state.db measure). Config also carries protect_first_n=3.
Why the two numbers differ (0.8 config vs 0.582 measured): the harness measures its window on a chars/4 estimate surface; the engine counts real tokens. Median firing at harness-0.8 lands at engine-0.582 -> the surfaces differ by factor ~1.37 (harness overestimates; prose tokenizes under chars/4, tool JSON denser). The shop's 59-62 percent band IS the 0.8 threshold, seen from the engine.
The binding constraint: at threshold T, the summarizer call itself runs on the same endpoint: input (sliced context + compaction prompt) + output (summary) must fit in n_ctx, or the engine truncates the oldest tokens and the summary silently loses the head of history.
- Observed worst engine input scales with T: 0.778 x (T/0.8).
- Safety equation: 262,144 x 0.778 x (T/0.8) + 16,189 (max summary) <= 262,144 -> T <= 0.965 on the harness surface (computed: 0.8 x (262,144 − 16,189) / (262,144 x 0.778) = 0.96477), with ZERO margin for prompt overhead and tail glue-back.
Recommendation:
- 0.85 = safe: worst-case engine input 216,695 + 16,189 max summary = 232,884, headroom 29,260 tokens (computed in admission family).
- 0.90 = aggressive-safe: worst-case 229,442 + 16,189 = 245,631, headroom 16,513. Median firing lands at engine-surface 0.65 (0.582 x 0.90/0.8 = 0.6547 computed).
- 0.95 = thin: worst-case 242,188 + 16,189 = 258,377, headroom 3,767 — one fat tool result in the summarizer's slice and the call overflows n_ctx (head-of-history truncation).
- Second cost of raising: prefill time per compaction grows with input (timeout 1200 configured; a 230k-input prefill on IQ3 is minutes). Fewer seams, bigger chunks — the keeper's rhythm goal.
- Summary-size guard: max 16,189 came from an outlier ask; median 421 shows the gate-closed self compresses hard. target_ratio 0.2 is generous vs observed behavior.
Verdict for the keeper: 0.85 recommended; 0.90 acceptable with eyes on summary size. The 62 percent in compact_organ.py stays as the engine-surface translation of whatever harness threshold is set — it is not a competing setting, it is the same setting read from the other surface.