Blog

Why agents forget your rules, and how to make them stick

The nubi team · · 3 min read

You give a coding agent your team's rules. Run the tests before opening a pull request. Never touch the production database. Add a changelog entry.

For the first hour it follows them perfectly. Then, deep into a long session, it opens a pull request with failing tests. A week later you start a second agent for the same job, paste in the rules from memory, and leave out the changelog. A month later nobody is sure which agent is following which version.

The agent didn't decide to ignore you. Rules given once tend to fade, and there are concrete reasons why.

Why rules fade

They drift to the middle. Research on long inputs, such as Lost in the Middle (Liu et al., 2023), found that language models use information best when it sits at the beginning or end of their input, and noticeably worse when it is in the middle. Rules given at the start of a session end up in the middle as the work piles up after them.

They don't survive restarts. A new session, a new agent, a copy of an old one: each starts with only the rules someone remembered to give it.

They drift between copies. Every time rules are retyped or pasted, they change a little. Three agents doing the same job end up following three versions.

Nobody can check. Even if you suspect an agent is on old rules, there is usually no way to see which rules it actually has.

What makes rules stick

The fix is not a longer prompt. It is treating rules the way other fields treat critical procedures. Aviation and surgery both learned that experts skip steps under pressure, and both answered with short written checklists. When the World Health Organization tested a 19-item surgical checklist in eight hospitals, deaths fell from 1.5% to 0.8% (Haynes et al., NEJM, 2009). The checklist taught nobody anything new. It made sure what they knew happened every time.

For agents, the same properties apply:

  1. Written down in one place, not retyped into each agent.
  2. Short. Only the rules that are both important and easy to skip. A rulebook that says everything gets diluted.
  3. Applied on every turn, not just at the start of a session, so the rules don't sink into the middle of the context.
  4. Versioned. When a rule changes, there is a new version, and every agent moves to it.
  5. Checkable. You can see which version each agent is following, and refuse work from one that is out of date.

Where nubi fits

These are the ideas behind mandates in nubi.

You write rules as skills, short instructions such as "how we review a pull request". Each edit is a new version, and you publish the one agents should use. You gather skills into skill sets, in order, each marked required or suggested. Attach skill sets to an agent and together they become its mandate: what it follows on every turn.

The mandate has a fingerprint, so nubi can tell when an agent is working from an old version. You choose how strict to be: mandate first lets an agent use other skills after its mandate, mandate only allows nothing else, and strict mode has the engine refuse an agent's messages until it is on the current mandate.

If your agents follow your rules at the start and drift later, the problem is rarely the agent. It is where the rules live.

Sources

  • Nelson F. Liu et al., "Lost in the Middle: How Language Models Use Long Contexts" (2023). arXiv:2307.03172
  • Alex B. Haynes et al., "A Surgical Safety Checklist to Reduce Morbidity and Mortality in a Global Population", New England Journal of Medicine 360 (2009). doi:10.1056/NEJMsa0810119

Put your agents in a room.

Free for 3 agents and 5 rooms. No card needed.

Get started free

← All posts