[{"data":1,"prerenderedAt":656},["ShallowReactive",2],{"docs-nav":3,"docs-\u002Fdocs\u002Fcompaction":78},[4,9,13,16,21,26,30,34,38,42,46,50,53,58,62,66,69,74],{"path":5,"title":6,"navTitle":6,"group":7,"order":8},"\u002Fdocs\u002Fcommands","Other commands","Guide",999,{"path":10,"title":11,"navTitle":12,"group":7,"order":8},"\u002Fdocs\u002Fcompaction","Context and compaction","Context & compaction",{"path":14,"title":15,"navTitle":15,"group":7,"order":8},"\u002Fdocs\u002Fconfiguration","Configuration",{"path":17,"title":18,"navTitle":18,"group":19,"order":20},"\u002Fdocs\u002Fenvironment","Environment variables","Reference",11,{"path":22,"title":23,"navTitle":23,"group":24,"order":25},"\u002Fdocs\u002Fflags","Flag reference","CLI",8,{"path":27,"title":28,"navTitle":28,"group":7,"order":29},"\u002Fdocs","Introduction",1,{"path":31,"title":32,"navTitle":32,"group":7,"order":33},"\u002Fdocs\u002Finstallation","Installation",2,{"path":35,"title":36,"navTitle":36,"group":19,"order":37},"\u002Fdocs\u002Fproviders","Providers",10,{"path":39,"title":40,"navTitle":40,"group":7,"order":41},"\u002Fdocs\u002Fquickstart","Quickstart",3,{"path":43,"title":44,"navTitle":45,"group":7,"order":8},"\u002Fdocs\u002Freleases","Releases and upgrading","Releases",{"path":47,"title":48,"navTitle":49,"group":7,"order":8},"\u002Fdocs\u002Frun","The run command","Running an audit",{"path":51,"title":52,"navTitle":52,"group":7,"order":8},"\u002Fdocs\u002Fsecurity","Security model",{"path":54,"title":55,"navTitle":56,"group":24,"order":57},"\u002Fdocs\u002Fsessions","Sessions and forking","Sessions",6,{"path":59,"title":60,"navTitle":61,"group":7,"order":8},"\u002Fdocs\u002Fskills-roles","Skills and roles","Skills & roles",{"path":63,"title":64,"navTitle":64,"group":19,"order":65},"\u002Fdocs\u002Ftools","Tool reference",12,{"path":67,"title":68,"navTitle":68,"group":7,"order":8},"\u002Fdocs\u002Ftroubleshooting","Troubleshooting",{"path":70,"title":71,"navTitle":72,"group":24,"order":73},"\u002Fdocs\u002Ftui","The interactive TUI","Interactive TUI",9,{"path":75,"title":76,"navTitle":77,"group":7,"order":8},"\u002Fdocs\u002Fweb-eval","Dashboard and evaluation","Dashboard & evaluation",{"id":79,"title":11,"body":80,"description":646,"extension":647,"group":7,"meta":648,"navTitle":12,"navigation":649,"order":8,"path":10,"seo":650,"stem":654,"__hash__":655},"docs\u002Fdocs\u002Fcompaction.md",{"type":81,"value":82,"toc":632},"minimark",[83,87,91,99,104,111,119,123,183,190,193,244,369,381,385,388,412,419,430,435,438,452,462,466,469,477,488,494,500,505,528,532,535,570,577,581,584,591,595,615,618,622,628],[84,85,11],"h1",{"id":86},"context-and-compaction",[88,89,90],"p",{},"A real audit outruns any context window. Compaction is what lets a run keep going, and it is the\npart of the harness with the most ways to go quietly wrong: drop the wrong message and the agent\nre-derives work it already did, or worse, forgets the sink it was about to prove.",[88,92,93,94,98],{},"locac's answer is deliberately boring. ",[95,96,97],"strong",{},"No model is involved."," Compaction is a rule-based elision\npass over the transcript, so the same history compacts identically on every machine, every time.",[100,101,103],"h2",{"id":102},"what-gets-elided","What gets elided",[88,105,106,107,110],{},"Only ",[95,108,109],{},"tool result bodies",". Assistant text and user text are never touched, and the final message is\nnever elided.",[88,112,113,114,118],{},"Elision is also non-destructive: the full body stays in the session's transcript store. Only the\ncopy sent to the provider is shortened, and the agent can pull the original back with ",[115,116,117],"code",{},"recall",".",[100,120,122],{"id":121},"when-it-runs","When it runs",[124,125,126,139],"table",{},[127,128,129],"thead",{},[130,131,132,136],"tr",{},[133,134,135],"th",{},"Quantity",[133,137,138],{},"Default",[140,141,142,153,163,173],"tbody",{},[130,143,144,150],{},[145,146,147],"td",{},[115,148,149],{},"reserve",[145,151,152],{},"20% of the context window",[130,154,155,160],{},[145,156,157],{},[115,158,159],{},"threshold",[145,161,162],{},"context window − reserve",[130,164,165,170],{},[145,166,167],{},[115,168,169],{},"keepRecent",[145,171,172],{},"the 8 trailing messages, kept verbatim",[130,174,175,180],{},[145,176,177],{},[115,178,179],{},"evidenceBudget",[145,181,182],{},"half the reserve",[88,184,185,186,189],{},"A pass runs when the estimated token count crosses the threshold. The count includes\n",[95,187,188],{},"overhead",", the system prompt plus roughly thirty tool schemas, because that overhead is sent on\nevery request and a budget that ignores it is a budget that overflows.",[88,191,192],{},"Every knob is settable, on the command line and in the config file:",[194,195,200],"pre",{"className":196,"code":197,"language":198,"meta":199,"style":199},"language-bash shiki shiki-themes vitesse-dark","locac run \"…\" --reserve-tokens 60000 --keep-recent 12 --evidence-budget-tokens 30000\n","bash","",[115,201,202],{"__ignoreMap":199},[203,204,206,210,214,218,221,224,228,232,235,238,241],"span",{"class":205,"line":29},"line",[203,207,209],{"class":208},"sCK9x","locac",[203,211,213],{"class":212},"s7rlk"," run",[203,215,217],{"class":216},"sNJcY"," \"",[203,219,220],{"class":212},"…",[203,222,223],{"class":216},"\"",[203,225,227],{"class":226},"sXjYR"," --reserve-tokens",[203,229,231],{"class":230},"sxA9i"," 60000",[203,233,234],{"class":226}," --keep-recent",[203,236,237],{"class":230}," 12",[203,239,240],{"class":226}," --evidence-budget-tokens",[203,242,243],{"class":230}," 30000\n",[194,245,249],{"className":246,"code":247,"language":248,"meta":199,"style":199},"language-json shiki shiki-themes vitesse-dark","{\n  \"compaction\": {\n    \"enabled\": true,\n    \"mode\": \"elide\",\n    \"reserveTokens\": 60000,\n    \"keepRecent\": 12,\n    \"evidenceBudgetTokens\": 30000\n  }\n}\n","json",[115,250,251,257,275,294,315,331,345,359,364],{"__ignoreMap":199},[203,252,253],{"class":205,"line":29},[203,254,256],{"class":255},"s_pn2","{\n",[203,258,259,263,267,269,272],{"class":205,"line":33},[203,260,262],{"class":261},"s6USN","  \"",[203,264,266],{"class":265},"sm68I","compaction",[203,268,223],{"class":261},[203,270,271],{"class":255},":",[203,273,274],{"class":255}," {\n",[203,276,277,280,283,285,287,291],{"class":205,"line":41},[203,278,279],{"class":261},"    \"",[203,281,282],{"class":265},"enabled",[203,284,223],{"class":261},[203,286,271],{"class":255},[203,288,290],{"class":289},"s3QIE"," true",[203,292,293],{"class":255},",\n",[203,295,297,299,302,304,306,308,311,313],{"class":205,"line":296},4,[203,298,279],{"class":261},[203,300,301],{"class":265},"mode",[203,303,223],{"class":261},[203,305,271],{"class":255},[203,307,217],{"class":216},[203,309,310],{"class":212},"elide",[203,312,223],{"class":216},[203,314,293],{"class":255},[203,316,318,320,323,325,327,329],{"class":205,"line":317},5,[203,319,279],{"class":261},[203,321,322],{"class":265},"reserveTokens",[203,324,223],{"class":261},[203,326,271],{"class":255},[203,328,231],{"class":230},[203,330,293],{"class":255},[203,332,333,335,337,339,341,343],{"class":205,"line":57},[203,334,279],{"class":261},[203,336,169],{"class":265},[203,338,223],{"class":261},[203,340,271],{"class":255},[203,342,237],{"class":230},[203,344,293],{"class":255},[203,346,348,350,353,355,357],{"class":205,"line":347},7,[203,349,279],{"class":261},[203,351,352],{"class":265},"evidenceBudgetTokens",[203,354,223],{"class":261},[203,356,271],{"class":255},[203,358,243],{"class":230},[203,360,361],{"class":205,"line":25},[203,362,363],{"class":255},"  }\n",[203,365,366],{"class":205,"line":73},[203,367,368],{"class":255},"}\n",[88,370,371,373,374,376,377,380],{},[115,372,301],{}," has one implemented value, ",[115,375,310],{},". ",[115,378,379],{},"summarize"," is reserved and does nothing today.",[100,382,384],{"id":383},"the-evidence-budget","The evidence budget",[88,386,387],{},"Not all old tool output is equally worth keeping. Four tools produce the material a finding is\nactually built out of:",[389,390,391,397,402,407],"ul",{},[392,393,394],"li",{},[115,395,396],{},"grok_sink",[392,398,399],{},[115,400,401],{},"scan_sinks",[392,403,404],{},[115,405,406],{},"trace_callers",[392,408,409],{},[115,410,411],{},"record_finding",[88,413,414,415,418],{},"Their results are ",[95,416,417],{},"security evidence",", and old evidence is preserved verbatim while the evidence\nbudget lasts. Everything else in the old region is elided outright.",[88,420,421,422,425,426,429],{},"One more thing counts as evidence: ",[95,423,424],{},"a tool call that failed",". A failing call is high signal, since it is\nusually the moment a hypothesis died or a PoC misfired, so ",[115,427,428],{},"isError"," results are protected on the\nsame budget.",[431,432,434],"h3",{"id":433},"two-invariants","Two invariants",[88,436,437],{},"These are the rules that make the pass safe to run repeatedly on a growing transcript.",[88,439,440,443,444,448,449,451],{},[95,441,442],{},"MONOTONE."," The budget is spent in transcript order, oldest first. That means message ",[445,446,447],"em",{},"i","'s fate\ndepends only on messages 0..",[445,450,447],{},", never on anything that arrives later. So the prefix of the\ntranscript that has already been sent renders byte-identically on the next request, and the\nprovider's cached prefix stays valid. Spending the budget newest-first (the obvious implementation)\nkept rewriting the front of the transcript and invalidated the cache on every turn.",[88,453,454,457,458,461],{},[95,455,456],{},"EVIDENCE FLOOR."," The single newest piece of ",[445,459,460],{},"old"," evidence is always kept verbatim and is not\ncharged to the budget. Whatever the budget is set to, zero included, the most recent evidence the agent\nwas working from survives the pass.",[100,463,465],{"id":464},"the-marker","The marker",[88,467,468],{},"An elided result is replaced by a line that says what was removed and how to get it back:",[194,470,475],{"className":471,"code":473,"language":474,"meta":199},[472],"language-text","[elided 48213 chars of scan_sinks output — recall seq=61][ artifact ids cited in it: ev_3a91f0c2, ev_5b0d77ae]\n","text",[115,476,473],{"__ignoreMap":199},[88,478,479,480,483,484,487],{},"Artifact ids are salvaged out of the elided body so a later ",[115,481,482],{},"score_finding"," can still cite the\nartifact the run minted, without re-running the command that produced it. The list is capped at\neight ids: an uncapped join let a target repository turn a 680,000-character tool result into a\n260,000-character marker that the model would have read as ",[445,485,486],{},"trusted"," harness text.",[100,489,491,492],{"id":490},"getting-it-back-recall","Getting it back: ",[115,493,117],{},[194,495,498],{"className":496,"code":497,"language":474,"meta":199},[472],"recall(seq: 61)                      # the exact message, verbatim\nrecall(query: \"extract path join\")   # ranked snippets across the full transcript\n",[115,499,497],{"__ignoreMap":199},[88,501,502,504],{},[115,503,117],{}," searches the stored transcript, everything compaction has elided out of the live\ncontext included, so an elided result is a deferred read, not a loss.",[88,506,507,508,511,512,515,516,519,520,523,524,527],{},"The ",[115,509,510],{},"seq="," marker only works because sequence numbers are contiguous per session. That is a real\nconstraint rather than an assumption: recallability is ",[95,513,514],{},"opt-in",", and the TUI turns it off\none-way for the rest of the session when ",[115,517,518],{},"\u002Fnew"," or ",[115,521,522],{},"\u002Fresume"," swaps to a different session\nunderneath. A marker that promises ",[115,525,526],{},"seq=61"," must never resolve to some other session's message 61.",[100,529,531],{"id":530},"when-eliding-is-not-enough","When eliding is not enough",[88,533,534],{},"If the context still overflows after a pass, compaction escalates one tier:",[124,536,537,547],{},[127,538,539],{},[130,540,541,544],{},[133,542,543],{},"Tier",[133,545,546],{},"Behaviour",[140,548,549,558],{},[130,550,551,555],{},[145,552,553],{},[115,554,310],{},[145,556,557],{},"The defaults above",[130,559,560,565],{},[145,561,562],{},[115,563,564],{},"aggressive",[145,566,567,569],{},[115,568,169],{}," drops to at most 2, the recent-token allowance halves, and the evidence budget halves",[88,571,572,573,576],{},"The escalation is ",[95,574,575],{},"sticky for the session",", so a run that has hit the wall once stays aggressive\nrather than oscillating, and it survives a resume, because the tier is recorded in the session\njournal and read back on load. There is no third tier: once aggressive, an overflow is an overflow.",[100,578,580],{"id":579},"what-a-pass-reports","What a pass reports",[88,582,583],{},"Each pass that actually elided something is recorded with its before\u002Fafter token counts, how many\nresults were elided, how many evidence bodies were protected, and where the cutoff fell. A pass that\nchanged nothing is not journalled, or a long run's journal would fill with no-ops.",[88,585,586,587,590],{},"The TUI's ",[115,588,589],{},"\u002Fcontext"," view reads the same numbers.",[100,592,594],{"id":593},"turning-it-off","Turning it off",[194,596,598],{"className":196,"code":597,"language":198,"meta":199,"style":199},"locac run \"…\" --no-compaction\n",[115,599,600],{"__ignoreMap":199},[203,601,602,604,606,608,610,612],{"class":205,"line":29},[203,603,209],{"class":208},[203,605,213],{"class":212},[203,607,217],{"class":216},[203,609,220],{"class":212},[203,611,223],{"class":216},[203,613,614],{"class":226}," --no-compaction\n",[88,616,617],{},"Useful for reproducing a context-window bug and for nothing else. A long audit with compaction off\nwill overflow, and the overflow arrives as a provider error mid-turn rather than as a graceful\ndegradation.",[100,619,621],{"id":620},"next","Next",[88,623,624,627],{},[625,626,60],"a",{"href":59}," covers the other half of what shapes a run's context: the\nplaybooks injected into the system prompt, and the typed subagents that get their own.",[629,630,631],"style",{},"html pre.shiki code .sCK9x, html code.shiki .sCK9x{--shiki-default:#80A665}html pre.shiki code .s7rlk, html code.shiki .s7rlk{--shiki-default:#C98A7D}html pre.shiki code .sNJcY, html code.shiki .sNJcY{--shiki-default:#C98A7D77}html pre.shiki code .sXjYR, html code.shiki .sXjYR{--shiki-default:#C99076}html pre.shiki code .sxA9i, html code.shiki .sxA9i{--shiki-default:#4C9A91}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .s_pn2, html code.shiki .s_pn2{--shiki-default:#666666}html pre.shiki code .s6USN, html code.shiki .s6USN{--shiki-default:#B8A96577}html pre.shiki code .sm68I, html code.shiki .sm68I{--shiki-default:#B8A965}html pre.shiki code .s3QIE, html code.shiki .s3QIE{--shiki-default:#4D9375}",{"title":199,"searchDepth":41,"depth":41,"links":633},[634,635,636,639,640,642,643,644,645],{"id":102,"depth":33,"text":103},{"id":121,"depth":33,"text":122},{"id":383,"depth":33,"text":384,"children":637},[638],{"id":433,"depth":41,"text":434},{"id":464,"depth":33,"text":465},{"id":490,"depth":33,"text":641},"Getting it back: recall",{"id":530,"depth":33,"text":531},{"id":579,"depth":33,"text":580},{"id":593,"depth":33,"text":594},{"id":620,"depth":33,"text":621},"[object Object]","md",{},true,{"title":11,"description":651},{"How locac keeps a long audit inside the context window without losing evidence":652,"group":19,"order":653},"deterministic elision, the evidence budget, the two invariants that keep it cache-friendly, and the recall tool that undoes it.",14,"docs\u002Fcompaction","zB1YbFe1PUbY7ZOxlSol7lGvrlMEdbtVIKUVYDvW6ok",1786794387501]