anchors code
Generate a unique identity code for a new unit.
Generates the scenario code (the identity, TRACEABILITY §3) of a unit,GUARANTEEING uniqueness against the codes already in use in the map. Use it BEFORE writing thespec, so as not to collide with another unit (which would generate wrong cross propagation).
anchors code Spacer → suggests a free code for "Spacer" anchors code --check SPCR → says whether SPCR is free or already belongs to someone anchors code list → lists ALL the codes in use, with who uses them anchors code list --in apps/mobile → only those of the workspace
The "code list" reads the identity field of the MAP, it does not search for a pattern in the text: a grep forABCDX-X01 matches a mention in prose, a comment and a file name, and depends on the length of thecode (which varies per project, see code_lengths). The output is "code<TAB>where", one perline; the summary goes to stderr, so "anchors code list | ..." pipes without dirt.
The algorithm (Layer 2 of the SPEC_GUIDE: name compression; Layer 3: collisionresolution) is agnostic. Module prefixes (Layer 1) are project dialect — if yoursuses them, choose the code by hand and validate it with --check.anchors code <name> [flags]| Flag | Default | What it does |
|---|---|---|
--check |
validate whether a proposed code is free | |
--map |
path to the map | |
--root |
. |
project root |
Subcommands
Section titled “Subcommands”anchors code list
Section titled “anchors code list”List the identity codes IN USE in the project (from the map, not by regex).
Enumerates the codes the map knows, with each unit's folder.
Reads the identity field of the MAP — it does not search for a pattern in the text. A grep for ABCDX-X01 matchesa mention in prose, a comment and a file name, and depends on the length of the code, whichvaries per project (see code_lengths in anchors.yaml). Here the answer is exact.
anchors code list every code in use anchors code list --in apps/mobile only those of one workspace of the monorepo
Output: "code<TAB>where", one per line; the summary goes to stderr, so the list pipeswithout dirt. A code with SEVERAL folders is an identity collision — the doctorreports it, and here it becomes visible for free.anchors code list [flags]| Flag | Default | What it does |
|---|---|---|
--check |
check the LENGTH of each code against code_lengths and show the fix | |
--in |
only the codes under this path prefix (e.g.: apps/mobile) | |
--json |
emit the list as JSON (for script/pipeline consumption) | |
--map |
path to the map | |
--root |
. |
project root |
Setup and artifacts — family
Section titled “Setup and artifacts — family”Commands of the same family — what tells each apart:
| Command | What it does |
|---|---|
anchors init |
Configure the project (anchors.yaml) through questions and answers |
anchors new |
Emit the skeleton of an artifact (spec, feature, test, plan…) per the ruler |
anchors code |
Generate a unique identity code for a new unit |
anchors guide |
Print the Anchors guides for AI agents |
anchors docs |
Compile the documentation from the templates in doct/ |
anchors install-hooks |
Install the git pre-commit that runs the gates over staged files |
anchors migrate |
Bring the Anchors files up to the current format |
anchors settings |
This agent’s LOCAL configuration — what is its own, not the project’s |
anchors touch |
Bump updated_at in the @anchors header of the files that changed |