Support asks for a longer refund window. A developer searches the repository for "refund", finds REFUND_WINDOW_DAYS = 30, changes it to 45 and opens a pull request. The request was about the back office, the internal tool where support staff refund orders. The constant belongs to the customer shop, which lives in the same repository. Two products, one word, and nobody in the review noticed which product the change hit.
FACET keeps a short, checkable description of each feature, called a record, next to your code and checks that the two still match. By the end of this guide each product has its own set of records, and FACET tells you which product's rule a change touches before you commit it. The FACET feature behind it is registries: a registry is one product's set of records, declared in .facetrc.yaml, FACET's configuration file, and each registry owns its own source folders.
The commands below use a small example shop written in TypeScript, set up as in “One answer instead of three”. Its repository holds a second product: a back office for the support team in apps/admin/. In your own monorepo, use your apps' folders instead.
Step 1Check that you really have two products
Ask one question about a feature: "does this exist over there yet?" If the question makes sense, you have one product built twice, such as a web app and a native app, or an old system and its rewrite. That is a different case; FACET calls it VariantA variant is an independently deployable place where a feature can exist or not, such as a web app and an iOS app. One record then has its own lifecycle state per variant.In the glossary. If the question makes no sense, because nobody asks whether the back office has the shop's checkout, you have two products. Then each product gets its own registry.
In the example, the shop has a cart, discount codes and checkout. The back office has staff refunds and, planned, discount-code management. Both have something called refunds, with different rules.
Step 2Declare one registry per product
Create .facetrc.yaml in the repository root:
registries: shop: records: docs/facets sources: [src, tests] description: the customer-facing web shop admin: records: apps/admin/docs/facets sources: [apps/admin] schema: docs/facets/schema description: the internal back office for the support team
recordsis where the product's records live. The shop keeps the folder it already has.sourceslists the folders that belong to the product. Code there is checked against this registry's records only.schemapoints the back office at the schemasfacet initalready wrote, so its records are validated too.descriptionsays in a few words what the product is, for people and coding agents reading the configuration.
Create the back office's record folders:
mkdir -p apps/admin/docs/facets/features/orders/refunds apps/admin/docs/facets/features/checkout/discounts
Step 3Write down each product's rule under the same id
The refund feature exists in both products, so it gets the same id in both: orders/refunds/refund-order. Ids are shared across registries. Each product writes its own record for it.
Save the shop's rule as docs/facets/features/orders/refunds/refund-order.yaml (create the folder with mkdir -p docs/facets/features/orders/refunds):
schema_version: "0.1"id: orders/refunds/refund-orderlifecycle: activeintent: summary: A customer asks for a full or partial refund within 30 days of delivery and gets the money back the way they paid.contract: scenarios: - id: within-30-days statement: | Given an order delivered 20 days ago When the customer asks for a refund Then the refund is accepted - id: after-30-days-is-refused statement: | Given an order delivered 31 days ago When the customer asks for a refund Then the shop refuses it with E3001 - id: gift-card-as-store-credit statement: | Given an order paid with a gift card When the customer gets a refund Then the money comes back as store creditlineage: owner: team: checkout created_at: "2026-11-22"
Save the back office's rule as apps/admin/docs/facets/features/orders/refunds/refund-order.yaml:
schema_version: "0.1"id: orders/refunds/refund-orderlifecycle: activeintent: summary: Support staff refund an order at any time, with a reason, up to the amount the customer paid.contract: scenarios: - id: late-refund-with-reason statement: | Given an order delivered 45 days ago When a staff member refunds it and gives a reason Then the refund is recorded with the reason and the staff member's name - id: reason-is-required statement: | Given any order When a staff member refunds it without a reason Then no refund is recorded - id: never-more-than-paid statement: | Given an order with refunds that already add up to the amount paid When a staff member refunds any further amount Then no refund is recordedlineage: owner: team: support-tools created_at: "2026-11-22"
Add what the back office does not have yet as a planned record, apps/admin/docs/facets/features/checkout/discounts/create-code.yaml:
schema_version: "0.1"id: checkout/discounts/create-codelifecycle: plannedintent: summary: Marketing staff create a discount code with a value, a last day and an optional minimum order value.contract: scenarios: - id: code-names-are-unique statement: | Given a discount code SPRING5 exists When a staff member creates another code named spring5 Then the back office refuses itlineage: owner: team: support-tools created_at: "2026-11-22"
Anchor each product's code to its record. In src/orders/refund.ts, directly above export function requestRefund, and in apps/admin/src/refunds.ts, directly above the comment of staffRefund, add:
// @facet: orders/refunds/refund-order// @facet-role: primary
The comment is identical in both files. Which record it belongs to follows from the folder: src/ is the shop's, apps/admin/ is the back office's.
Step 4See both products side by side
npx facet registries


The refund row says both products have the feature, each with its own record and its own rule. npx facet registries --gaps shows only the rows where a product is missing a feature.
Check both registries:
npx facet lint
The summary reads 4 record(s), 3 anchor(s) checked across 2 registries (admin, shop) — 0 error(s). Every message in the output starts with the registry it belongs to, [shop] or [admin].
Commit the setup:
git add .facetrc.yaml docs apps srcgit commit -m "Describe the shop and the back office in two registries"
Step 5Ask which product a change touches, before you commit
Back to the support request. Change the constant the search found, in src/orders/refund.ts:
export const REFUND_WINDOW_DAYS = 45;Then ask FACET which records your uncommitted change touches:
npx facet drift


shop:orders/refunds/refund-order is the answer: this edit changes what customers get, and the shop's record still says 30 days. The support request was about the back office. Undo the change:
git checkout src/orders/refund.ts
Make the change in apps/admin/src/refunds.ts instead and run npx facet drift again. It reports admin:orders/refunds/refund-order. Update that 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 commit. facet drift reports and never fails a run, so it fits before every commit and into review.
Step 6Let the check catch code that claims the other product's feature
Code gets copied between apps. Say someone builds discount-code management in the back office and copies the shop's expiry check into apps/admin/src/codes.ts, 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 included:
// @facet: checkout/discounts/redeem-code// The expiry day ends in UTC for every customer.export function isExpired(expiresOn: string, now: Date): boolean { return now.getTime() > Date.parse(`${expiresOn}T23:59:59.999Z`);}
Check the back office alone:
npx facet lint --registry admin


The shop has a record with that id, but apps/admin/ belongs to the back office alone. The error offers both fixes: give the back office its own record for the feature, or move the code into a folder both registries list in sources. Here the right id is the planned checkout/discounts/create-code; change the anchor to it, or remove it until the feature is built.
Step 7If the check says something else
registry "admin" points at "apps/admin/docs/facets", which does not exist: create the records folder from step 2, or fix the path underrecords.declares both top-level records/schema/sources/runners and a registries block: move the top-levelrecords:line into one of the registries. A file withregistrieshas no top-level layout.registry name "Admin" must be lowercase letters, digits and hyphens: registry names appear in front of ids, as inadmin:orders/refunds/refund-order. Use lower case.@facet: tag names registry "backoffice", which is not declared: an anchor uses a prefix that.facetrc.yamldoes not declare. Use a declared name, or the bare id.no schema directory at apps/admin/docs/facets/schema — schema validation skipped: addschema: docs/facets/schemato that registry.
For more on keeping teams that share a repository from breaking each other's features, read Your release was green. Ours is broken now.