You want to know whether writing feature behaviour down next to the code would actually help on your ten-year-old codebase. To find out, you need 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 and a few marker comments in real source files. But the architecture meeting is in three weeks, and until then nobody will approve new comments in shared code, let alone new folders in the repository.
FACET is a command-line tool that keeps a short, checkable description of each feature, called a record, next to your code, and links the code to it with marker comments called 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. By the end of this guide FACET runs on your own clone with real records and real anchors, while every commit and push you make stays exactly as it would have been. The anchors live only in your working copy: FACET's Private anchorA private anchor is an anchor that exists only in your own working copy. A Git filter removes it on the way into a commit and puts it back on checkout.In the glossary are a Git filter that takes them out on the way into a commit and puts them back on checkout.
The commands below use a small example shop written in TypeScript, in a clone that has never seen FACET. In your own project, run them in the root of your clone and pick one feature you know well.
Step 1Install FACET outside the repository
A dev dependency would change package.json, so install FACET into a folder in your home directory instead:
npm install --prefix ~/.facet facet-framework
Put its facet command on your PATH for this terminal session, and check that it runs:
export PATH="$HOME/.facet/node_modules/.bin:$PATH"facet version
The first line starts with facet core. Add the export line to your shell profile if you want facet in every new terminal. The Git filter from step 3 calls the binary inside ~/.facet directly, so keep that folder where it is.
Step 2Set up FACET without leaving a trace in Git
Change into the root of your clone. Create FACET's files there:
facet init
init writes the record folder docs/facets/, a LintLint is FACET's check that records and code still point at each other: every record matches its schema, every anchor names an existing record, and every active record has an anchor. It runs locally and in CI on every pull request.In the glossary suite in tools/facet-lint/, an empty .facetignore and a CI workflow. Keep all four out of Git with your clone's own exclude file, .git/info/exclude. It works like .gitignore, but it is never committed:
printf 'docs/facets/\n.facetignore\n.github/workflows/facet-lint.yml\ntools/facet-lint/\n' >> .git/info/exclude
Tell the scan to skip the lint suite, so its own self-test is not reported as a test file without a record:
printf 'tools/facet-lint/\n' >> .facetignore
Check what Git sees:
git status --short
It prints nothing. The files exist on your disk and nowhere else.
Step 3Turn on private anchors for this clone
facet filter install


The command writes two things, both inside .git: the filter in .git/config and a line in .git/info/attributes. The sidecar folder .git/facet/anchors/ named in the output remembers where each private anchor stands; it appears only with your first private anchor. Nothing in the repository changes.
Step 4Write a record and anchor it privately
Write one record for a feature you know. In the example shop it is redeeming a discount code. Create the folder:
mkdir -p docs/facets/features/checkout/discounts
Save this as docs/facets/features/checkout/discounts/redeem-code.yaml:
schema_version: "0.1"id: checkout/discounts/redeem-codelifecycle: activeintent: summary: A customer enters a discount code in the cart and gets its discount, or a reason why not.contract: scenarios: - id: expired-code-is-refused statement: | Given the code SPRING5, whose last day is 2026-05-31 When a customer redeems it after 23:59:59 UTC on that day Then the shop refuses it with E2002 and the cart keeps its price - id: last-day-ends-in-utc statement: | Given a code whose last day is today When a customer redeems it at 23:30 UTC, in any time zone Then the discount is applied - id: minimum-order-value statement: | Given a code with a minimum order value When the cart subtotal is below that value Then the shop refuses the code with E2003 - id: one-code-per-order statement: | Given a cart that already has a code When the customer enters a second code Then the shop refuses it with E2004verification: unit_tests: - id: tests/discount.test.ts proves: [expired-code-is-refused, last-day-ends-in-utc, minimum-order-value, one-code-per-order]lineage: owner: team: checkout created_at: "2026-11-22"
Add the anchor, two comment lines on their own, directly above the function in src/checkout/discount.ts:
// @facet: checkout/discounts/redeem-code// @facet-role: primary/** Redeems a code on a cart. Returns the new cart; throws a ShopError and leaves the cart unchanged otherwise. */export function redeemDiscountCode(cart: Cart, input: string, now = new Date()): Cart {
Git may now list the file as modified while git diff shows nothing, because Git compares sizes before it asks the filter. Clear that, then run the check:
facet filter refreshfacet lint
git status --short prints nothing again, and facet lint ends with 1 record(s), 1 anchor(s) checked — 0 error(s). FACET sees the anchor; Git does not.
Step 5Work and commit as usual
Make a normal change in the same file and commit it the way you always do. In the example, add a discount code:
git add src/checkout/discount.tsgit commit -m "Add the WINTER20 discount code"
Look at what the commit contains, and at what your editor still shows:
git show --format=%s HEADgrep -n '@facet' src/checkout/discount.ts


The commit adds one line and nothing else. Your reviewers, CI and git blame see the file as it was. Line numbers in CI output and stack traces refer to the committed file, which has two lines fewer above the function than your editor shows.
Step 6Put an anchor back when a pull moves its line
A private anchor sits above a particular line and follows that line when other changes move it. When a colleague rewrites the line itself, the anchor has nowhere to go. git pull says so:
git pullfacet filter statusfacet lint


FACET does not move the anchor to a nearby line on its own. facet filter status quotes the line it used to stand above, so you can find the spot. Add the two comment lines again above the reworded comment, then:
facet filter refreshfacet lint
facet filter status shows the anchor above its new line, and facet lint is back to 0 error(s).
Step 7Share it, or remove every trace
Before you turn the filter off, note which files carry private anchors. facet filter status lists them. Then:
facet filter uninstall
Your private anchors stay in the working copy and become ordinary lines. Git may still report the files as unchanged, because it remembers them as clean from the time the filter ran. Make Git read them again:
git add --renormalize .git status --short
Now the files with anchors appear as staged changes. When the team adopts FACET, delete the four lines you added to .git/info/exclude, add the records and FACET's files, and commit everything in one pull request.
If the answer is no, remove the anchor lines from the files facet filter status listed, delete the four lines from .git/info/exclude, and delete the files init created. uninstall leaves the sidecar in .git/facet/ in case you turn the filter on again; delete that folder as well.
Step 8If Git or the check says something else
fatal: src/checkout/discount.ts: clean filter 'facet' failed, together withfacet: not found: the filter calls the binary at the exact path it was installed from, and that path is gone. Install FACET to~/.facetagain, or runfacet filter installwith the new binary. The filter refuses to run without it on purpose: skipping it once would commit your private anchors.git statuslists a file as modified,git diffshows nothing: you added or edited a private anchor. Runfacet filter refresh.1 private anchor(s) have no place in this version and were kept aside: a pull or checkout changed the line the anchor stood above. Follow step 6.active record "…" has no @facet: anchor in source: the anchor is missing from the working copy.facet filter statuslists the private anchors the filter keeps and where each one stands.warning: : no schema directory at docs/facets/schema — schema validation skipped:facet inithas not run in this clone. Run it as in step 2.
For more on bringing an old codebase under control one feature at a time, read Nobody wants to touch the pricing logic. And everyone has to, eventually.