Agent Runtime
- 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.
- 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.
- 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
compacthook = 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 ↓ 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<sup>1</sup>).
That makes “did the summary keep my constraint?” the wrong question after context compaction. The summarizer can do one of three things with a rule: drop it, keep it, or keep something that only looks like it. The agent’s next tool call does not care which.
The question that predicts behavior is a different one: does anything outside the summary enforce the rule?
Test Compliance, Not Whether the Rule Survived #
Grade what the agent does, not what the summary says. Force a /compact, ask for the forbidden action, and watch the result.
The usual post-mortem goes the other way. A compacted agent breaks a rule, so someone opens the summary to check whether the rule made it through. Skip that step. The line between “dropped” and “kept but ignored” feels diagnostic, but it changes nothing about the outcome.
The running example comes from an open Codex bug report titled “Context compaction forgets AGENTS rules” (openai/codex #25792<sup>2</sup>). On 2026-07-03, a commenter named jamfor999 added this:
In my AGENTS.md I explicitly state to never commit assets and NEVER use git add -f.
After compaction, the agent reasoned its way toward committing the asset files anyway. Then it reasoned its way toward git add -f, the flag that stages files git ignores.
The AGENTS.md line did not catch it. The commenter’s permission setup made them approve every command, so a human saw the attempt and re-steered the agent.
The thread disagrees on the cause:
- jamfor999’s reading: AGENTS.md was lost after compaction.
- Other commenters’ reading: in discussing the issue’s progress regression, they blame paraphrase. The agent rebuilt its state from a summary instead of the source.
Nobody in the thread can settle it. Nobody can see whether the rule was in context when the agent reached for the flag.
ARCBench says the answer would not have helped:
Finally, retaining a rule does not guarantee compliance: compacted runs that retain the rule violate more than twice as often as runs with the full history.
The breakdown: 70.1% of compacted runs retain the rule. 21.1% of those still violate it, against 8.1% with the full history.
Scope it honestly. The benchmark is 17 task cases across four models, with one compaction per run, built on the open-source pi agent harness. The 2.6x comes from one study condition. It is not a benchmark-wide constant.
Better summaries do help. In the paper’s comparison of compaction strategies, Pi with rule preservation was the only one below that comparison’s full-context baseline: 9.0% against 11.9% (Zha et al.: ARCBench<sup>1</sup>). That is a real result. It is also a summary prompt doing a guardrail’s job.
A second paper names the failure shape. Kwartler, Aqrawi and Abbasi found that compaction often leaves a residue that looks like a rule and does not act like one. Their central finding is that “a presence check is not a safety check” (Kwartler et al.: Guardrail Survival<sup>3</sup>).
One study disagrees. Governance Decay reports 0% violation when the constraint survives the summary. But that figure rests on 90 retained contexts (Chen: Governance Decay<sup>4</sup>). I lean on ARCBench for the retained-rule point, and on Governance Decay only for what happens when the rule is dropped.
So the test you run is behavioral, and it fits in a few lines:
(Grading by enforcement rather than retention is my inference from these results. ARCBench tests defenses on the compactor side, not enforcement outside the context.)
Expect the Do-Not-Touch Rules to Go First #
If a constraint starts with “never” and you said it in chat, assume it is the kind of rule compaction drops most. Salle et al. checked 269 constraints across 44 real Claude Code sessions from SWE-chat (Salle et al.: Compaction-Friendly<sup>5</sup>). Rules about how to work and what not to touch were dropped most often:
- Process instructions (how to work) were dropped 35.9% of the time.
- Scope exclusions (what not to touch) were dropped 36.8% of the time.
- Feature requirements , the largest category, were preserved 93.8% of the time.
Two caveats bound those numbers:
- The loss rate depends on the judge. It was 19% overall, and 24.5% under a judge from a different model family.
- Dropped does not mean violated. The authors state plainly, “we don’t claim that dropped rules cause violations” (Salle et al.: Compaction-Friendly<sup>5</sup> ).
So the finding is about what the summary keeps. That is the half of the problem the first section said not to trust alone.
Repeated compaction compounds the loss. The Compaction Cliff study ran a /compact-style pass on Sonnet 4.6, with a prompt to keep every safety rule and procedural command verbatim. Safety-rule recall still fell from 53% after one round to 10% after five (Zerhoudi et al.: Compaction Cliff<sup>6</sup>).
That schedule was harsh. Each round compressed the history by 50%, more than a normal long session would. The direction still matches what Anthropic’s docs concede: “detailed instructions from early in the conversation may be lost” (Claude Code Docs: How Claude Code works<sup>7</sup>).
Soft rules fare worst. Governance Decay measured decay 8.3x larger for soft organizational policies than for hard safety norms (Chen: Governance Decay<sup>4</sup>).
| When you see | Why it is at risk | Move it today |
|---|---|---|
| A rule that opens with “never”, “don’t touch”, “do not commit”, stated only in chat | Scope exclusions were dropped 36.8% of the time | Deny rule if one violation is unacceptable, root instructions file otherwise |
| “Always run X before Y”, stated only in chat | Process instructions were dropped 35.9% of the time | Root instructions file, or a hook that runs X itself |
| “Prefer”, “usually”, “check with the team first” | Soft policies decayed 8.3x more than hard safety norms | Root file, and never rely on it for anything you would audit |
| A session that has compacted more than once | Recall compounds down (53% to 10% over five rounds at 50% compression) | Re-supply from disk after each compaction, never from the last summary |
“Never commit assets, never git add -f” is a textbook scope exclusion. The uncomfortable part of #25792 is where it lived. It was not said in chat. It lived in AGENTS.md, the supposedly safe place. Whether that file comes back after compaction depends on the agent runtime.
Map What Your Runtime Re-Injects After Compaction #
The same sentence can survive compaction in one location and disappear in another. So before deciding where a rule lives, map what your runtime puts back.
Claude Code documents this precisely. The project-root CLAUDE.md and unscoped rules are “Re-injected from disk.” Path-scoped rules and nested CLAUDE.md files are different. They load when Claude touches their trigger file, “so compaction summarizes them away with everything else” (Claude Code Docs: Context window<sup>8</sup>).
A rule that sits one directory too deep behaves like a chat message.
| Surface | Claude Code | Claude API (on-demand compaction) | Codex CLI | Cursor | Gemini CLI |
|---|---|---|---|---|---|
| System prompt | Still applies | Yours to resend on every request | Initial context rebuilt by the harness | Undocumented | Undocumented |
| Root instructions file | Root CLAUDE.md re-injected from disk | n/a | AGENTS.md re-supply undocumented; #25792 reports it lost | alwaysApply rules start the context; survival undocumented |
GEMINI.md not referenced in the compression code |
| Path-scoped or nested rules | Summarized away; reload when the trigger file is touched again | n/a | Undocumented | Undocumented | Undocumented |
| Instructions given in chat | Summarized; early detail may be lost | Summarized, including in-range role: "system" messages |
Summarized | Summarized, which Cursor calls lossy | Newest 30% of history kept; the rest compressed |
| Context a hook added earlier | Summarized with the rest | n/a | Undocumented | Undocumented | Undocumented |
| Post-compaction hook | SessionStart compact output added |
n/a; your code decides what follows the block | Undocumented; a #25792 commenter reports late delivery | Undocumented | Undocumented |
The non-Claude columns come from source code and docs. Every “undocumented” cell is deliberate.
Codex’s compaction code strips the initial context and re-inserts a fresh copy, with the comment “Re-inject canonical context from the current session since we stripped it.” That file never mentions AGENTS.md (openai/codex: compact.rs<sup>9</sup>). The bug report says the rules went missing in practice (openai/codex #25792<sup>2</sup>).
Cursor says applied rule contents “are included at the start of the model context” (Cursor: Rules<sup>10</sup>). Its blog also warns that “the agent’s knowledge can degrade after summarization since it’s a lossy compression of the context” (Cursor: Dynamic context discovery<sup>11</sup>). Neither page says whether rules at the start of the context survive that summarization.
Gemini CLI keeps only the newest 30% of chat history after compression (gemini-cli: chatCompressionService.ts<sup>12</sup>).
The API column has one footgun. On-demand compaction summarizes role: "system" messages inside the summarized range, “so their text instructions stop applying once the block replaces them.” The docs tell you to send the same system prompt and tools you use for the rest of the conversation (Claude API Docs: Compaction on demand<sup>13</sup>). So a guardrail you injected mid-conversation is one compaction away from becoming a paraphrase.
Now place the #25792 rule on the map. In Codex it sat in AGENTS.md, a cell nobody documents.
Claude Code can read AGENTS.md in place of CLAUDE.md (Claude Code Docs: Memory<sup>14</sup>), so put the rule in the project-root file, not a path-scoped rule under .claude/rules/. Then check it: force a /compact and confirm the rule with /context.
If the rule is missing, the memory docs’ troubleshooting list names three causes: chat-only, an unreloaded nested file, or an unmatched path-scoped rule (Claude Code Docs: Memory<sup>14</sup>). Don’t overcorrect. The root file is for rules that must come back, not for everything. Moving every rule into it has its own cost, covered in the CLAUDE.md instruction ceiling post.
Hook Output Is Not Durable
Context a hook injected mid-session is not a standing rule, however authoritative it looked when it arrived.
Claude Code summarizes earlier hook context “with the rest of the conversation” and re-adds only SessionStart hooks that match compact (Claude Code Docs: Context window<sup>8</sup>). So a PostToolUse hook that printed “do not touch assets/” after an edit is exactly as durable as you typing it.
Where the rule goes depends on what it guards:
- If the reminder must come back, move it to a SessionStart
compacthook. - If the action must never happen, it does not belong in a reminder at all.
Block What Must Never Happen in the Harness #
Put every must-never rule where the summarizer cannot reach it: a permission deny rule, a blocking PreToolUse hook, or both. Anthropic’s own guidance on steering Claude Code gives the reason in one line:
When there’s something that absolutely must not happen, an instruction is the wrong tool.
The docs spell out the mechanics. Permission rules sit outside the model: “Permission rules are enforced by Claude Code, not by the model.” Instructions in a prompt or CLAUDE.md “don’t change these rules” (Claude Code Docs: Permissions<sup>16</sup>).
CLAUDE.md and auto memory are different. They are context: “They aren’t enforced configuration. To block an action regardless of what Claude decides, use a PreToolUse hook instead” (Claude Code Docs: Memory<sup>14</sup>).
Segner’s comparison table describes hooks as bypassing compaction entirely (Segner (Anthropic): Steering Claude Code<sup>15</sup>).
The summarizer can rewrite everything the model reads. It cannot rewrite .claude/settings.json.
Here is the #25792 rule moved out of prose and into the harness, as a deny rule plus a blocking hook:
The two layers cover different ground. The deny rules catch the form the agent usually writes. The hook catches the forms the deny rules miss, like git -C . add -f or git add assets/logo.png -f, because it reads the full command text instead of matching a prefix.
When the hook fires, exit code 2 blocks the call. The stderr line goes back to the agent as the reason (Claude Code Docs: Hooks reference<sup>17</sup>).
Deny rules also win on precedence. They are evaluated first (“deny, then ask, then allow”), and a deny at any settings level cannot be allowed back by another level (Claude Code Docs: Permissions<sup>16</sup>).
For an organization, put the deny in managed settings. That is the top of the stack: “managed settings, command line, project local, shared project, user” (Claude Code Docs: Settings<sup>18</sup>). Now run the first section’s compliance test against this config. The #25792 failure no longer reaches the repo, whatever the summary did.
The config also replaces the human who approved commands in the original report. That matters more as sessions run unattended. The always-on agents post covers what goes missing when nobody is watching.
The block tier has real limits. Name them up front, alongside the config:
- A Bash rule is not a boundary around the program. The docs say a deny rule “covers the invocation Claude usually produces and isn’t a security boundary around the program” (Claude Code Docs: Permissions<sup>16</sup> ).
sh -c '...'or a full binary path gets past it. Pair it with a hook, and add sandboxing when the rule must hold. - An
Editdeny does not stop shell writes. The hooks guide notes Claude “can still change the protected files with shell commands” and points to sandboxing to limit where commands write (Claude Code Docs: Hooks guide<sup>19</sup> ). - Timed-out hooks fail open. On
PreToolUse, a timed-out command, http, or mcp_tool hook “doesn’t block the tool call” unless you setonFailure: "block"(Claude Code Docs: Hooks reference<sup>17</sup> ). - Only some hook types are deterministic. Command, http, and mcp_tool hooks execute deterministically. Prompt and agent hooks use Claude’s judgment, which puts you back in the model’s hands (Segner (Anthropic): Steering Claude Code<sup>15</sup> ).
- Unmanaged setups have a mod gap. It applies when a setup has no managed settings, no
managed-mcp.jsonfile, and no Team or Enterprise login. In that case an installed mod “can approve a call that aPreToolUsehook blocked, and some calls that a deny rule refuses” (Claude Code Docs: Permissions<sup>16</sup> ).
This section has one job: move the must-never rules into the harness. Two related jobs live elsewhere:
-
Inventory. Listing what your hooks, settings, and permissions enforce today is covered in theagent harness audit .
-
Deny versus ask. Choosing between them by blast radius belongs toagent permission tiering .
Steer the Summary as the Last Tier, Not the First #
Summary steering works. That is exactly why it gets over-trusted. Use it for working state and “usually” rules, never as the enforcement for a must-never rule.
Claude Code gives you three levers, and any runtime gives you a fourth:
- PreCompact hook output. When the hook exits 0, Claude Code uses its stdout “as instructions for the compaction summary” (Claude Code Docs: Hooks reference<sup>17</sup> ).
- Compact Instructions or a focused
/compact. A “Compact Instructions” section in CLAUDE.md, or a focused/compact, steers the summary from the instruction side (Claude Code Docs: How Claude Code works<sup>7</sup> ). - A SessionStart
compacthook. A SessionStart hook with acompactmatcher re-adds context after compaction (Claude Code Docs: Hooks guide<sup>19</sup> ). - A working file on disk. It survives every round.
Bad: a PreCompact hook that echoes Preserve this rule: never commit assets, never use git add -f. It improves the odds that the summary carries the sentence. It still depends on the model obeying text it reads after the summary.
Good: the deny rule and block-force-add.sh from the previous section enforce the rule. A SessionStart compact hook re-adds only the working state: which asset batch is mid-migration, and why those files stay out of git.
ARCBench’s rule-preservation result is not the only steering gain (Zha et al.: ARCBench<sup>1</sup>):
- TypeCompact (Compaction Cliff). This type-aware pass held constraint recall at 0.96 from the second round onward. The
/compact-style pass fell to 0.10 by round five (Zerhoudi et al.: Compaction Cliff<sup>6</sup> ). - Constraint Pinning (Governance Decay). A buffer exempt from compaction is re-injected verbatim after every compaction step. In that benchmark, it brought violations back down to 0% (Chen: Governance Decay<sup>4</sup> ).
Every one of those fixes still ends with the model reading text and choosing to follow it. They raise the floor for the steer tier. They do not replace the block tier.
OpenAI’s cookbook states the working-file half most bluntly: “Keep cited facts in generated artifacts, not only in compacted conversation state” (OpenAI Cookbook: Memory and Compaction<sup>20</sup>). For the #25792 case, .agent/asset-migration.md is that artifact. It lives on disk, so it survives every compaction. The agent re-reads it instead of reconstructing it from a summary.
One tempting misuse: PreCompact can also block compaction outright with exit code 2. If that compaction was triggered to recover from a context-limit error, “the underlying error surfaces and the current request fails” (Claude Code Docs: Hooks reference<sup>17</sup>). Blocking compaction fails the request. It is not a guardrail.
Place Any Standing Rule With One Route #
Author’s judgment. This route is my own synthesis, not a procedure any source states. It follows from the premises above: retained rules still get broken (ARCBench), do-not-touch rules drop first (Salle et al., Compaction Cliff), runtimes re-supply only specific surfaces (Claude Code, Codex, Cursor, Gemini sources), and only harness enforcement sits outside the model’s context (Claude Code permissions and hooks docs).
Before your next long session, run every standing rule through the same four gates. Then re-test after a forced /compact. The highlighted path below is the #25792 rule.
Follow the git add -f rule through it. At gate 1 it gets a deny rule and block-force-add.sh. It skips gate 2, because it already sits in a root file. At gate 3, its working state goes to .agent/asset-migration.md.
A rule like “prefer small commits” takes the other path. One violation is fine, so it skips gate 1. If it was said in chat, gate 2 moves it to the root file. There it stays a “usually” rule, one the summary may carry.
To run the route across a whole repo at once, compaction-placement-check<sup>21</sup> lists every must-never rule in your instruction files, shows which ones sit on a surface compaction summarizes away, and exits non-zero for any rule that nothing in the harness enforces.
The route only works if you know what your harness enforces today. So inventory that before you move a single rule. Start with the agent harness audit.
Sources #
- Zha, Meng, Bos, Chen: Do Agents Still Follow the Rules? Benchmarking Rule Compliance under Agent Context Compaction arxiv.org/html/2611.03223v1
- openai/codex issue #25792: Context compaction forgets AGENTS rules github.com/openai/codex/issues/25792
- Kwartler, Aqrawi, Abbasi: AI Guardrail Survival under Single-Cycle Agentic Self-Summarization arxiv.org/abs/2608.11392
- Chen: Governance Decay: How Context Compaction Silently Erases Safety Constraints in Long-Horizon LLM Agents arxiv.org/html/2606.22528
- Salle, Bhatnagar, Bethge, Abdelnabi, Andriushchenko: Benchmarks Are Surprisingly Compaction-Friendly arxiv.org/html/2610.31778
- Zerhoudi, Mitrovic, Granitzer: The Compaction Cliff in Long-Running AI Agent Memory arxiv.org/html/2608.22752
7. [Claude Code Docs: How Claude Code works](https://code.claude.com/docs/en/how-claude-code-works) code.claude.com/docs/en/how-claude-code-works
8. [Claude Code Docs: Explore the context window](https://code.claude.com/docs/en/context-window) code.claude.com/docs/en/context-window
- openai/codex: codex-rs/core/src/compact.rs github.com/openai/codex/blob/main/codex-rs/core/src/compact.rs
10. [Cursor: Rules](https://cursor.com/docs/rules) cursor.com/docs/rules
11. [Cursor: Dynamic context discovery](https://cursor.com/blog/dynamic-context-discovery) cursor.com/blog/dynamic-context-discovery
- google-gemini/gemini-cli: chatCompressionService.ts github.com/google-gemini/gemini-cli/blob/main/packages/core/src/context/chatCompressionService.ts
- Claude API Docs: Compaction on demand platform.claude.com/docs/en/build-with-claude/compaction-on-demand
- Claude Code Docs: How Claude remembers your project code.claude.com/docs/en/memory
- Segner (Anthropic): Steering Claude Code: when to use CLAUDE.md, skills, hooks, and subagents claude.com/resources/articles/steering-claude-code-skills-hooks-rules-subagents-and-more
- Claude Code Docs: Configure permissions code.claude.com/docs/en/permissions
- Claude Code Docs: Hooks reference code.claude.com/docs/en/hooks
- Claude Code Docs: Settings files and precedence code.claude.com/docs/en/settings
- Claude Code Docs: Automate actions with hooks code.claude.com/docs/en/hooks-guide
- OpenAI Cookbook: Building Reliable Agents with Memory and Compaction developers.openai.com/cookbook/examples/agents_sdk/building_reliable_agents_memory_compaction
- agent-engineering-toolkit: compaction-placement-check github.com/johnayoung/agent-engineering-toolkit