What Survives Compaction Is Not What Your Agent Obeys In ARCBench's main study of 17 task cases across four models, compacted agent runs that retained a rule still violated it 21.1% of the time, versus 8.1% for runs with full history — about 2.6 times as often — according to the ARCBench analysis. A separate study of 44 real Claude Code sessions found do-not-touch and process rules were dropped 36.8% and 35.9% of the time respectively, while rules about what to build were kept about 94% of the time, because Claude Code re-injects the root CLAUDE.md from disk but summarizes away path-scoped rules, nested files and earlier hook output. The analysis recommends grading agent behavior after a forced /compact rather than the summary's contents, and enforcing must-never rules in the harness as a permissions deny rule plus a blocking PreToolUse hook, since the summarizer cannot rewrite settings. Agent Runtime What Survives Compaction Is Not What Your Agent Obeys 1. A rule that survives compaction is no guarantee the agent obeys it: in ARCBench’s main study 17 cases, four models , compacted runs that kept a rule broke it 21.1% of the time against 8.1% with full history, about 2.6x as often. 2. Do-not-touch and process rules are the ones compaction drops most 36.8% and 35.9% in 44 real Claude Code sessions , though dropped is not the same as violated, and what comes back depends on where the rule lives: Claude Code re-injects the root CLAUDE.md from disk but summarizes away path-scoped rules, nested files, and earlier hook output. 3. So grade what the agent does after a forced /compact, not what the summary says, and put every must-never rule in the harness, as a permissions deny rule plus a blocking PreToolUse hook, because the summarizer cannot rewrite your settings; steering the summary is the last tier, not the enforcement. The plain-language edition for readers outside AI engineering no background needed · 8 min An AI coding assistant sometimes has to shrink its own memory, and the rules you gave it can get lost or ignored along the way. This is about how to make the important ones hold anyway. The big idea Imagine a worker whose notebook fills up, so they rewrite everything into a short summary and carry on from that. You taped a sticky note on page one: “Never do X.” Even if the summary copies the sticky note word for word, the worker may still do X. The only thing that reliably stops X is a locked door the worker cannot open, however they remember or misremember the note. So for rules that must never be broken, build the lock. Treat the summary as a helpful extra. Check what the agent does, not what the summary says When the agent shrinks its memory the field calls this “compaction” , people who see a broken rule usually open the summary to ask, “Did my rule make it in?” The post says to skip that step. The answer doesn’t change what you should do. One study measured why. Among runs where the summary kept the rule, the agent still broke it about 2.6 times as often as an agent that had its full, unshrunk history: roughly one run in five, against about one in twelve. Keeping the rule helped less than you would hope. Two limits on that number. The study was small 17 task cases, four AI models, one memory shrink per run , and the 2.6 times comes from one condition in the study, not from every test. Also, better summary instructions do help. In that study, one summary method that specifically protected rules did better than the full-history baseline. The point is that a summary prompt is being asked to do a lock’s job. One other study found no broken rules when the summary kept the constraint, but that rests on a small sample, so the author leans on the first study for this point. A second paper adds a useful phrase: a summary can leave something that looks like a rule without acting like one, and “a presence check is not a safety check.” So the test is simple. Force the memory shrink, ask the agent to do the forbidden thing, and see what happens. The author notes that grading by behavior rather than by what the summary kept is his own inference from these studies. The “never touch this” rules go first One real example runs through the post. A user told a coding assistant never to save certain files into the project’s history and never to use a command that forces them in. After its memory shrank, the assistant reasoned its way toward doing both anyway. A human who was approving every command caught it. The people in the discussion disagreed about why: some said the rules were lost, others said the assistant rebuilt its picture from a paraphrase. Nobody could see inside to settle it. A study of 44 real coding sessions found that rules about how to work and about what not to touch were dropped more than a third of the time. Rules about what to build were kept about 94% of the time. Two honest limits: the loss rate shifted depending on which AI judged it, and the authors say plainly that a dropped rule does not prove a rule was then broken. Shrinking again and again makes it worse. In one harsh test, where each round cut the history in half, the share of safety rules the agent could still recall fell from 53% after one round to 10% after five. The post itself calls that schedule harsher than a normal long session, though the direction matches what the tool maker’s own documents admit: early detailed instructions may be lost. Softer rules “prefer,” “usually” faded even more than hard safety rules. Where a rule lives decides whether it comes back The same sentence can survive in one place and vanish in another. In the main tool the post studies, the instructions file at the top of your project is reloaded from disk after the memory shrinks. Instructions in deeper folders, and anything you only said in the chat, are summarized away like everything else. A reminder that a helper program printed in the middle of a session is no more durable than you typing it. For several other tools, the post found that the documents either do not say what survives or hint that it may not. It marks those honestly as “undocumented” rather than guessing. The practical advice: put a must-return rule in the top-level file, then force a memory shrink and check it is still there. Don’t pile every rule in that file, though; that has its own costs, which the author covers in another post. Block the must-never things outside the AI’s memory A tool maker’s own guidance puts it plainly: when something absolutely must not happen, an instruction is the wrong tool. The program running the agent can enforce settings that the AI never gets to rewrite. Two kinds matter: a list of commands that are flatly refused, and a small checking script that runs before each command and can stop it. The summarizer can rewrite everything the AI reads. It cannot rewrite those settings. The post shows this for the real example: refuse the forced-add command in the settings, and add a script that catches sneakier ways of typing it. The two layers cover different ground. In the original report, a human approving each command was the only protection. This replaces that human, which matters more as agents run unattended. It is not a perfect wall, and the post lists the gaps: - A refused command is not a seal around the whole program. A cleverly wrapped command can slip past it, so pair it with the checking script, and add a sandbox a fenced-off area where the agent can only do limited things when the rule really must hold. - Blocking one way of editing files does not stop the agent from changing them through other commands. - If a checking script times out, the action can go through unless you set it to block instead. - Some checks are mechanical, and some ask the AI to judge, which puts you back in its hands. - Setups without company-managed settings have an extra gap involving add-on tools. Steering the summary comes last, not first You can tell the tool what to keep when it shrinks its memory, and you can have it re-add key information afterward. This works, and in some tests it worked very well. That is exactly why it gets over-trusted. Every one of these fixes still ends with the AI reading text and choosing to follow it. Use summary steering for working notes “which batch of files is mid-move, and why” and for “usually” rules. Keep that kind of information in a plain file on disk, which survives every shrink, and have the agent re-read it. One more trap: you can stop the memory shrink from happening, but if it was needed to avoid hitting the limit, the request simply fails. That is not a guardrail. The post ends with a four-question route for placing any standing rule. Would one violation be unacceptable? Build the lock. Is it only in chat or a deep folder? Move it to the top-level file. Does it carry working state? Put that in a file on disk. Did anything change? Force a memory shrink and test. The author flags this route as his own synthesis, not something any source states. What this means for you If an agent works on your projects, sort its rules into two piles. Rules where one slip is unacceptable should be locked in the settings, because the AI’s memory cannot be trusted to hold them. Everything else can live in the top-level instructions file and in notes on disk. Then test by forcing a memory shrink and asking for the forbidden thing. Don’t judge by what the summary says. The technical terms, in plain words - Agent = an AI program that takes actions on its own, like running commands and editing files - Compaction /compact = the agent rewriting its long history as a shorter summary when its working memory fills up - Guardrail = a protection meant to stop a bad action - AGENTS.md / CLAUDE.md = a plain-text instructions file the agent reads for a project - Root file = the instructions file at the top level of the project - Re-injected from disk = put back from the saved file after the memory shrink - Hook = a small script the tool runs automatically at set moments, such as before each command - PreToolUse hook = a hook that runs before the agent uses a tool, and can block it by exiting with code 2 - SessionStart compact hook = a hook that re-adds information right after a memory shrink - Permission deny rule = a setting that makes the program refuse a certain command - Harness = the program around the AI that runs its commands and enforces settings - Managed settings = company-wide settings that individual users cannot override - Sandboxing = restricting where the agent’s commands can run and write - Fail open = when a check breaks, the action is allowed through - git add -f = a command that forces files into the project’s history even though the project ignores them - ARCBench = the benchmark study of rule-breaking after memory shrinks that the post leans on most Keep reading: the full version, with the research and sources ↓ essay A rule that survives compaction is no guarantee the agent obeys it. In ARCBench’s main study, compacted runs that kept a rule broke it 2.6 times as often as runs with the full history: 21.1% against 8.1% Zha et al.: ARCBench https://arxiv.org/html/2611.03223v1