Facet
DeutschInstall
Work with AI agents

How FACET gives coding agents the rules of your product

Coding agents help enormously with development, but there's always something they get wrong. This guide shows how FACET helps keep those mistakes to a minimum.

  • 5 min read
  • Claude CodeCodexMCP serverMCP is the standard way AI assistants call outside tools. FACET runs an MCP server from your project with facet mcp, so an assistant can look up records and the code anchored to them.In the glossary
  • Your coding agent

Can anything good come of letting a coding agent rework a critical feature on its own? You ask yourself that at the latest once you've been in this situation: the shop's return window is to drop from 30 to 14 days. The agent's pull request changes the window in a dozen files, tests included, and CI is green. Two weeks later the shop starts refusing returns on day 20, for orders that were sold with a 30-day return policy.

The agent didn't break anything. It did exactly what it was asked to do. It just missed something everyone in customer service knows: an order keeps the return window it was sold with.

Why agents miss things like this

Coding agents are a huge help. They find every place a window is used within minutes and change it cleanly. What they can't find are rules that aren't written down anywhere. The shop's code had one constant for all orders. That older orders keep their old window wasn't in the code or in any test. It was in the heads of the people running the shop.

Plenty of teams do write rules like this down, just not next to the code. A comment above the constant helps until someone refactors the code. A line in CLAUDE.md helps until the file is so long that nobody checks whether everything in it is still true. And an agent that looks things up in the wiki finds the rule on day one. A month later the wiki token has expired. Or someone wrote in the prompt that anything outside the spec is out of scope, and the agent applied that to the product docs in the wiki too. Situations like these are real. The rule lives somewhere nobody checks when the code changes.

You're not the only one running into this. In the Stack Overflow Developer Survey 2025, 66% of more than 31,000 developers name AI solutions that are almost right, but not quite, as their biggest frustration. This is exactly that kind of case: the change is right, just not for every order.

And reviewing carefully is hard when the agent changes a dozen files at once. A Sonar survey found that only 48% of developers always check AI-assisted code before committing it. Whoever reads the pull request sees a lot of 30 turning into 14. A missing rule doesn't show up in that.

How FACET makes the change visible

FACET keeps a short description of each feature of your product in the repository, which it calls a FACET recordA FACET record is a short, checkable description of one feature, kept as a YAML file next to the code. It states why the feature exists, the behaviour it promises as scenarios, and the tests that check it.In the glossary. It says in plain words what the feature promises, with examples as ScenarioA scenario is one behaviour a feature promises, written in a record as Given/When/Then steps. Each scenario has an id that tests and other records can refer to.Read more here and the team that owns it. A comment in the code links the function to its record:

ts
// @facet: orders/refunds/request-refund

When the agent now opens refund.ts, the Agent pluginThe agent plugin, also called the FACET plugin, installs FACET into your coding agent in one step, today or Codex. It connects your records to every agent session through hooks, skills and an MCP server.Read more here for speaks up:

text
src/orders/refund.ts implements FACET feature(s): orders/refunds/request-refund.orders/refunds/request-refund  promises: Customers can return an order up to 30 days after delivery and get their money back.  contract: refund-within-window, refund-after-windowIf this edit changes observable behaviour, update the matching record in thissame change — intent, contract scenarios, and any Knowledge slot it invalidates(FACET spec 12.1). If the change is behaviour-preserving, no record edit is needed.

Now the agent knows the 30 days are a promise to customers, not just a number, and it is asked to update the record in the same pull request. If it forgets, facet drift reports the gap, at the end of its turn and in CI:

sh
  • npx facet-framework drift
text
drift: orders/refunds/request-refund — changed: src/orders/refund.ts1 drifted anchor(s), 0 reference change(s), 0 stale reference(s)

So next to the twelve changed files, the pull request also contains one sentence anyone can read:

diff
 intent:-  summary: Customers can return an order up to 30 days after delivery and get their money back.+  summary: Customers can return an order up to 14 days after delivery and get their money back.

That sentence is where people stop and think, not at the twelfth constant. Whoever reads it is far more likely to ask: “Does this apply to orders we've already sold?” And because the record names team orders as the owner, the agent or the reviewer knows who to ask. The answer becomes a new scenario in the record, and from then on every agent that opens the file knows it.

To set up the plugin, follow Make Claude Code check your business rules with the FACET plugin. Cursor, Codex and other assistants get the same records over MCP: Give your AI assistant your product rules over MCP.

What FACET can't do

In this example, FACET wouldn't have found the forgotten rule by itself. What it does is put the change to the promise into one sentence in the pull request. A person still has to read it and ask. Skim the record diff, and you'll miss the question just as you would in the code.

If a rule is already in the record, FACET helps more: the agent is shown it before it starts. For existing projects, the plugin's adopt skill drafts records from the code. But what isn't in the code won't be in the draft either. Rules like that you have to add yourself.

And for a single task, a good prompt that states the rule gets pretty close. FACET pays off mostly when several people and agents work on the same code for weeks, and nobody can keep every rule in their head.

If you want to try it, start with the feature where a mistake like this would hurt the most.