You ask Claude Code to tidy up the discount module. The diff looks reasonable: among other things, the expiry check now compares against the end of the day in local time instead of UTC. Tests pass on the CI runner, which runs in UTC. What the diff does not tell you is that this exact comparison was a bug the team fixed in August, because codes expired a day early for customers west of UTC. Claude had no way to know.
FACET keeps a short, checkable description of each feature and its business rules, called a record, next to your code. By the end of this guide Claude Code reads the rule before it edits the file, and when it changes the code behind a rule anyway, it is asked to check the record before it finishes. Both come from the FACET plugin for Claude Code, which connects your records to every session through HookA hook is a script a tool runs automatically at a fixed point, such as at the start of a session or Git before a commit. FACET's hooks bring the matching record into the session and stop commits that break records or anchors.In the glossary, scripts Claude Code runs at fixed points of a session, and an MCP server, the standard way for AI assistants to look things up in other tools.
The commands below use a small example shop written in TypeScript; FACET has to be set up as in One answer instead of three. In your own project, use a feature that already has a record and an AnchorAn anchor is a comment in the source code, starting with @facet:, that names the record the code belongs to. FACET reads these comments to know where each feature is implemented.In the glossary.
Step 1Install the FACET plugin
The plugin comes from the FACET marketplace on GitHub. Add the marketplace, then install the plugin:
claude plugin marketplace add facet-framework/coreclaude plugin install facet@facet-framework
Check that it is installed and enabled:
claude plugin list


The plugin is installed once per user and works in every project that has FACET records.
Step 2Start the registry server once
In the project root, ask Claude Code to start its MCP servers:
claude mcp list


.facetrc.yaml, each with its own source folders.In the glossary server starts from the project and connects.The first start takes a few seconds longer: the plugin downloads FACET CoreFACET Core is FACET's command-line tool, the facet binary: it checks records and anchors, reports drift and serves the registry to agents, with the same logic in CI, a shell and an agent session.Read more here from the GitHub release and checks it against the release's checksums. The hooks in the next steps use that copy, so run this once before the first session.
Step 3Mark where the session starts
Before you start the session, record the current state of the code as reviewed:
npx facet drift accept
It prints Accepted baseline with a commit hash. From now on, FACET compares against this point. Without it, FACET compares against the last commit, and a change Claude commits during the session would no longer show up at the end.
Step 4See what Claude reads along with the file
Start a session in the project with claude and ask for the change, for example “Tidy up src/checkout/discount.ts”. At the start of the session the plugin gives Claude the list of records, so it knows where the rules are. When Claude opens src/checkout/discount.ts, the plugin adds this note right after the file:
FACET claims for src/checkout/discount.ts, before editing:checkout/discounts/redeem-code promises: A customer enters a discount code in the cart and gets its discount, or a reason why not. contract: expired-code-is-refused, last-day-ends-in-utc, minimum-order-value, one-code-per-orderCheck these existing claims before changing observable behaviour. Use read_facet for the full intent or contract; update the record when its claims change.
last-day-ends-in-utc is the rule from the introduction. Claude can read its full text through the registry server's read_facet tool, without searching the repository.
Step 5See what happens when Claude changes the rule anyway
A note can be overlooked. When Claude finishes its answer and has changed code that a record describes, but not the record, the plugin holds its answer once and asks for a review with this request:
FACET: source implementing these features changed, but their records did not:- checkout/discounts/redeem-code — changed: src/checkout/discount.tsIf any of these changes observable behaviour, the record belongs in the samechange (FACET spec 12.1). If they are behaviour-preserving, explain that review outcome.Once that review is complete, 'facet drift accept' records the outcome.
Claude then has to say whether the change alters behaviour. A change to the expiry comparison does, so the honest answers are to undo it or to change the record in the same change, where a reviewer sees it.
A commit is checked too. When Claude runs git commit and the staged change breaks the link between records and code, for example by deleting the @facet: comment, the plugin refuses the command:
FACET lint found new errors compared with HEAD in the staged commit: docs/facets/features/checkout/discounts/redeem-code.yaml: active record "checkout/discounts/redeem-code" has no @facet: anchor in sourceFix the records or the anchors, then commit again.
Step 6Check the result after the session
You do not have to read the session to know whether a rule's code changed. In the project root, run:
npx facet drift


The record Claude was asked to review appears in your terminal too, even after Claude committed the change. Decide what happens to it:
- The change was wrong: revert it with git, for example
git revertfor a commit. - The change was intended: update the record's 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 in the same branch, then mark the review as done:
npx facet drift accept --outcome record-updated
npx facet drift then reports No drift found.
Step 7If the plugin says something else
FACET Read context is unavailable without the facet binary: the plugin has not downloaded FACET Core yet. Runclaude mcp listin the project once, as in step 2, then start a new session.claude mcp listshows noplugin:facet:registry: the plugin is not enabled. Checkclaude plugin list; iffacet@facet-frameworkis missing, repeat step 1.To commit anyway, FACET_SKIP_COMMIT_GATE=1 must be set: the commit check refused the commit. Fix the record or the anchor it names. Only set the variable in your own shell before startingclaudewhen you deliberately want to commit past the check; Claude cannot set it.Baseline: HEAD … no review recorded: no starting point was recorded, so only uncommitted changes are compared. Runnpx facet drift acceptbefore the next session, as in step 3.
For what changes when agents build features against written rules, read The agent built it. Who checked it?.