Part 3 of 16 · 2 min read
Pin what must never be dropped, and let newer facts replace older ones
A rule that can be crowded out by a long log breaks exactly when the agent is working hardest, which is the worst possible time.
Think of a rule taped to the inside of a locker door, where it can never be buried under whatever gets thrown in on top of it. Compare that with a rule written on a loose sheet of paper at the bottom of a messy backpack.
In plain words: a budget is the number of tokens allowed this step. Pinned items are paid for first and kept even if that means the context goes over budget. Supersede means replacing an outdated fact with its newer version instead of showing both side by side. A model shown a corrected value next to the stale one it replaced has no way to know which one you meant.
A worked example. In the 60-step session, the rule "never delete the bucket backup-prod-7" is pinned, so every policy answers the rule question correctly 100% of the time no matter the budget. Separately, eight items each state a fact, and three later items correct one of those facts, sharing the same key. Without supersede, keep_all shows the correct answer with no stale value beside it in only 76% of cases -- in 24 of 100 questions, the old and new values sit in the window together, and which one the model trusts is out of anyone's control.
The key lines. From code/mini-window/assemble.py:
# from code/mini-window/assemble.py
def latest_only(items: list[Item]) -> list[Item]:
"""Drop an item when a later item has the same key: the older value is out of date."""
last: dict[str, int] = {}
for i, it in enumerate(items):
if it.key is not None:
last[it.key] = i
return [it for i, it in enumerate(items) if it.key is None or last[it.key] == i]
Read it as: the function keeps only the item at the index each key last appeared at, dropping every earlier one with the same key. Supersede isn't a smarter ranking of old versus new. It's a rule that the newest item with a given key always wins, and every older one is simply never shown. That is what removes the ambiguity keep_all leaves in.
Budget, pinned, supersede, trim
Budget is the number of tokens allowed this step, usually well below the window limit. A pinned item must always be present, paid for first. Supersede means replacing a fact with its newer version instead of showing both. Trim means shortening one item by keeping its useful lines.
Example: the rule's 100% presence score across every policy and every budget is pinning doing its one job -- if that same rule had to compete for space on equal footing with a 30-line deploy log, a tight budget would sometimes drop it, which is exactly the failure pinning exists to rule out.