Rule sources
Status: decided; built in part, as
The command and the first version
says. This part of the design says which kinds of
source a rule set draws on, which may cite which, how a rule set
replaces one rule with its own (an override), how domains nest, and how
the hand-written guide is moved into rules and retired. It builds on
Rule system: the reference forms (R42, L12,
P7, team:7) are those of Sources and references,
and the tree, one-ofs and packs those of
Dependencies, one-ofs and packs.
The other parts of the design that this one changes already describe it,
each marking what is not built yet; What this changes
lists them, and what the tools do today that building the rest
replaces.
Contents
- Four kinds of source
- Public or not
- Which rules may cite which
- Private rules in a public repository
- Overrides
- Subdomains
- Conflicting practices as one-ofs
- Cutover from the hand-written guide
- What this changes
- Open questions
Four kinds of source
A rule has two properties that matter here: how far it reaches, and whether anyone may read it. How far it reaches is its scope: global, for every repository of a person or a team, or local, for one repository. Whether anyone may read it is its visibility: public or private. The two give four kinds:
| Public | Private | |
|---|---|---|
| Global | This repo’s rules, written R42 |
A source of the person’s or team’s own, such as a private repository: the names of their bots and machines, how their secret store is laid out, where directories go on their machines |
| Local | The .statute/rules/ of a public repository, written L12 |
The .statute/rules/ of a private repository, written L12; or, for a public repository, a source outside it (below) |
- Global public is the first-party source,
R, and any public source of another team,team:7. - Global private is a source the rule set names in
[sources], withpublic = false: a private git repository, or a directory on disk. - Local public is the repository’s own rules, in
.statute/rules/(The directory of local rules), when the repository is public. - Local private is the repository’s own rules when the repository
is private. A public repository keeps its private rules in a source
outside it, named with
scope = "local", as in Private rules in a public repository.
A source and a repository’s own rules are two different things, and a repository may have both:
- A source publishes rules for other repositories to use. Its rules are
in
rules/at its top, or in the directory its entry names withrules-dir(Sources and references), and a rule set that wants them names the source in[sources], by a git address or a path, and cites them asR42orteam:7. - A repository’s own rules bind that repository alone. They are in
.statute/rules/, cited asL12, and compiled into that repository’s output only. No other repository can name them: there is no reference form for another repository’s own rules, andrules-dirmay not lead into.statute/.
This repo is both: it publishes the first-party rules in rules/, and
keeps rules for its own development in .statute/rules/. A rule that
another repository should follow belongs in a source; one that only
makes sense here is a local rule.
Every rule, of whichever kind, is self-contained: it cites other rules
only through parent, requires, conflicts, overrides and
{@rule:...}, and
the constitution only through authority and {@constitution:...}. A
rule that has to point to the hand-written guide, or to any text that is
not a rule or the constitution, has not been migrated yet
(Cutover).
In statute.toml, the rule set gains one field and a source’s entry
two:
public = true
[sources]
R = { git = "https://github.com/Luolc/agent-constitution", tag = "<tag>" }
team = { git = "https://example.test/our-team/rules.git", branch = "main", public = true }publicat the top of the rule set: whether the repository that holds it is public. It is required; there is no default. It sets the visibility of the local rules and decides what the committed rule set may name (Private rules in a public repository).publicon a source: required on every source butR, which is always public;R = { ..., public = false }fails.scopeon a source:"global", the default, or"local". It matters only for overrides (Overrides).
Public or not
Visibility is declared, not looked up when the rule set is read: it says public = true
or public = false, for itself and for each source. Reading it from the host at build time (GitHub’s visibility of
the repository) would make the build need the network and an account,
and give two machines different results for the same inputs; guessing
from where a source lives (R public, everything else private) would
make a public team source private and forbid its rules to be cited by a
public one.
A wrong declaration is dangerous in one direction only. A private
repository that declares public = true gets stricter checks than it
needs, and nothing leaks. A public repository that declares
public = false could write private rules into files anyone can read.
So a built-in check of statute check compares the declaration with the
host where it can, through gh as the built-in checks of
Checks do: it fails when the rule set says
public = false and the repository’s visibility is PUBLIC, and says it
could not tell when gh cannot answer.
The declaration is filled in once, when it is written, and then read
only from statute.toml. statute init asks gh for the visibility of
the repository it writes the rule set in, unless --public or
--private decides, and takes the side that cannot leak where GitHub
gives no clear answer:
| GitHub shows | public written |
|---|---|
PUBLIC |
true |
PRIVATE |
false |
INTERNAL, which everyone in the enterprise can read |
true, with a warning that says how to make it private |
no answer (no gh, no login, no GitHub remote) |
true, with a warning that names why and says how to make it private |
When a source is added, statute source add asks gh in the same
way, with the safe side reversed: INTERNAL, no answer and a directory
in no GitHub repository count as private, and a private source of a
public repository is written to the private rule set rather than
stopping the command
(Adding a source).
Which rules may cite which
A private rule may cite a public one; a public rule may not cite a private one. A public rule’s text is published, and a citation of a rule nobody can read is a dangling link at best and a leak at worst (its source’s name and address).
The build fails when a rule of a public source (R, a public source, or
the local rules of a public repository) names a rule of a private source
in any of these places:
requiresorconflicts;overrides(Overrides);parent, where it may name a domain of another source (Subdomains);- a
{@rule:...}citation in its title or any part of its text.
The message names the rule, the field, the kind of node it names and both sources:
rules/12.toml: error: `requires` names "me:4", a rule of the private source `me`; a public rule may name only rules of public sources
rules/21.toml: error: `parent` names "me:1", a domain of the private source `me`; a public rule may name only rules of public sourcesThe check reads the sources’ declarations; it does not need the private source’s files, so it runs in CI on a public repository, where the private source cannot be read.
Private rules in a public repository
A public repository’s committed files are public, and they include the
rule set, the lock file and the compiled AGENTS.md. A private source
named in statute.toml would publish its address there, and its rules
compiled into AGENTS.md would publish their text. So, in a rule set
with public = true:
-
statute.tomlnames only public sources; a source withpublic = falsefails, with a note to name it in the private rule set. -
A private source holds only what is private. It copies no public rule: it cites one, as any rule cites another.
-
Private sources go in the private rule set,
private.toml, which lives in git’s own directory, not in the work tree:$(git rev-parse --git-path common/statute)/ private.toml the private rule set private.lock the main worktree's lock file $(git rev-parse --git-path statute)/ private.lock a linked worktree's lock fileIn a clone the first is
.git/common/statute/, from the main checkout and from each linked worktree alike, and the second, in a linked worktree, is.git/worktrees/<name>/statute/. The private rule set builds on thestatute.tomlof the worktree statute runs in, which it inherits as Rule sets and the lock file describes, adds sources, and turns rules on or off:rules = ["me:4", "here:2"] [sources] me = { path = "/home/me/my-rules", public = false } here = { path = "~/my-rules/repos/example", public = false, scope = "local" }It may list
packsasstatute.tomldoes, rooted in a node of any source of either layer, so that a private source’s new rules are enabled with it; a pack may enable public rules, which the private layer alone then enables, as a rule it lists may. It has no[compile], since its output’s place is fixed (below), and nobase, since its base is always thestatute.tomlbeside which the command runs. Apathin it is absolute or starts with~/; a relative one fails, since the file serves every worktree and a relative path would lead somewhere else from each.statute source addwrites the absolute path. Its sources’ names may not repeat those ofstatute.toml, nor each of its lists the same list ofstatute.toml. It may listexcludetoo, which turns off, in the private output alone, a node the defaults orstatute.tomlenable (In the rule set). In a private repository (public = false) the file fails: therestatute.tomlnames everything. Outside a git repository there is no private layer, and a command with--privatefails.statute add --privateandstatute remove --privatechange it, writing a temporary file in the same directory first and renaming it into place. -
This private layer changes the private output alone. It may turn a rule of the public layer off there, or turn on there one that
statute.tomlexcludes, but it may not override a rule of the public layer (Overrides): the committedAGENTS.mdholds that rule whatever the private layer does, and an agent that read both files would find two rules that disagree. A rule it turns off is left out of the full text, so an agent that reads the full text alone no longer has it; Grok, which readsAGENTS.mdas well (below), still has it. -
It has a lock file,
private.lock, one for each worktree, which pins the private layer’s own sources and nothing else: each asstatute.lockrecords a source, a git source by its address, its branch or tag and the commit, withpublicandscope. It records no rule and nothing of the public layer.statute lockwrites it withstatute.lock, and the commands that change the private rule set or its sources write it again; each writes the lock file of the worktree it runs in, and no other. The two layers together are resolved in memory each time a command needs them, from thestatute.lockand theprivate.lockof the worktree, and that resolution is never written down. A linked worktree with no lock file of its own reads the main worktree’s, so a new worktree starts from the commits the main worktree pins, andstatute upgradein one worktree moves the private sources of that worktree alone.statute upgrade --privatemoves them and nothing else: it reads the private layer’s own sources at their newest commits and the public sources at the commitsstatute.lockrecords, and writes the worktree’sprivate.lockand no other file, so a new worktree can take the newest private rules without changing a tracked file. Likeupgrade, it prints what changed against the lock file the worktree read, the main worktree’s when it had none of its own: each private git source’s old and new commit, or that it stayed, and each rule whose revision or content moved, brought in or dropped, which it finds by resolving the private layer at the old commits too. The rule set stays shared, so a command in one worktree that changes its sources,statute source addor an edit by hand, leaves the lock files of the others stale: theirstatute compilefails with a note to runstatute lock, andcompile --private-onlywrites no private output and says the same. A change to its lists alone, such asstatute add --private, leaves the other worktrees’ lock files current, since none records a rule. -
git never tracks a file in its own directory, so the private rule set and its lock files cannot be committed, and need no
.gitignoreand no check. What the private layer writes in the work tree is the private output under.statute/and two links at the top (below); before writing the file under.statute/, statute checks withgit check-ignorethat git ignores it, and the links are checked as below. A path whose last matching pattern is a negation (!) counts as not ignored. It writes no file at all, public or private, when one is not ignored or when git cannot tell. -
The skills and the
check = "command"checks of the rules only the private layer enables are left out of the committed files,.agents/skills/andstatute.lock(Compilation and the site);statute checkruns those checks all the same. Those of a public rule the private layer turns off stay in the committed files, andstatute checkdoes not run its check. How a private rule’s skills are installed is an open question.
The place in git’s directory is chosen so that every worktree of a
clone shares one private rule set, and each keeps its own lock file.
git shares everything under common/ of its common directory between
the worktrees of a clone (gitrepository-layout(5)), and
git rev-parse --git-path common/... names that place from any
worktree, while a path git does not know, such as
--git-path statute, names a directory of each worktree alone, which
git worktree remove deletes with the worktree. A lock file shared
by every worktree would let a command in any of them move the commits
all the others read, and jobs that lock in parallel would overwrite
each other’s. The main worktree’s lock file stays beside the private
rule set, where every existing clone already has it, so no clone needs
a file moved. A file in the work tree does not come with
git worktree add, which checks out only what git tracks, so each new
worktree would need a copy that then drifts. A
directory in the home directory keyed by the repository’s path would
also be shared, but it is orphaned when the clone moves or is deleted,
and needs an encoding of paths into names; one keyed by the remote’s
address would join two clones of one remote that are meant to differ,
and has no key for a repository without one. The cost of git’s
directory is that the files are out of sight: the commands that write
them print their full path. A clone made anew, or copied without git,
starts without them.
The names stay private. local already means a scope in statute
(scope = "local", L12 and the local kinds of source), so a name
such as statute.local.toml, as other tools name a machine’s own
settings, would read as the configuration of the local rules. What
sets these files apart is that they must not be published, which
private says.
The private output is one file, .statute/AGENTS.full.md: the
committed AGENTS.md with the rules only the private layer brings in
(its own rules and the public rules that only it enables), each at its
place in the tree, and without the rules its exclude turns off. Two
links lead to the file:
.statute/
.gitignore written by statute, committed: the generated files below
rules/ the repository's own rules, committed
AGENTS.full.md the public rules and the private ones
site/ the local site
CLAUDE.local.md -> .statute/AGENTS.full.md
AGENTS.override.md -> .statute/AGENTS.full.md- Claude Code reads
CLAUDE.local.md, and where it exists no longer readsAGENTS.md, so it reads the full text alone. Nor does it read theAGENTS.mdof a subdirectory, below. This holds with its default setting; with the setting that readsAGENTS.mdbesideCLAUDE.md, it reads both. - Codex and Pi read
AGENTS.override.mdin place of theAGENTS.mdof the same directory, so they read the full text alone. - Grok reads both
AGENTS.mdandCLAUDE.local.md, so it reads the public rules twice. They are the same rules and do not contradict each other; the repetition is accepted. - A repository with a
CLAUDE.mdmakes Claude Code read it as well asCLAUDE.local.md, so its content comes on top of the full text: the public rules twice when it is a link toAGENTS.mdor a copy of it, and otherwise text that may not agree with the rules. Grok counts aCLAUDE.mdand anAGENTS.mdthat lead to the same file as one, so it reads the public rules twice with such a link as without it.statute compilewarns of aCLAUDE.md(Compilation and the site). - OpenCode is not supported yet.
- The committed
AGENTS.mddoes not point to.statute/AGENTS.full.md: an agent that reads a link would read the full text twice, and one that finds neither link gets the public rules.
The two links are ignored through .git/info/exclude, never through a
.gitignore: Grok skips an instruction file that a .gitignore
matches, judging by the link’s own path, and does not read
.git/info/exclude. So when statute compile or statute compile --private-only is to write a private output, it asks
git check-ignore --verbose which pattern decides each link. A link no
pattern ignores, or one whose last matching pattern is a negation
outside every .gitignore, gets its line, /<link> below the
directory of statute.toml, appended to the file
git rev-parse --git-path info/exclude names, the common directory’s
in a worktree; the file and its directory are made when missing, and
nothing in the file is changed. The command prints the file and the
lines it added, and then asks git again; when git still does not ignore
a link, the lines added stay and nothing private is written. When a
.gitignore decides a link, whether it ignores it or takes it out with
a negation, a line in the exclude file would change nothing, since a
.gitignore comes before it; so then, and when the exclude file has
the line of a link git does not ignore, as with a negation after that
line, nothing private is written, the exclude file neither. A command with no private
output to write leaves the exclude file as it is. A file at either path
that is not such a link is left as it is, and the compile fails before
it writes AGENTS.md or the exclude file.
.statute/ holds what is committed and what is not. The
repository’s own rules in .statute/rules/ are committed; the
private output and the local site
(The local site) are not. So the
repository’s .gitignore does not name .statute/: statute writes
.statute/.gitignore itself, as uv does in the .venv it creates and
ruff in its .ruff_cache, and it lists the generated files by name:
# written by statute
/AGENTS.full.md
/site/A file statute adds later is then tracked until the list names it,
which is seen in git status, where a pattern of * with exceptions
would hide it. Every command that writes a generated file into
.statute/ writes .statute/.gitignore first when it is missing, and
rewrites it when it starts with statute’s line and differs; a
.statute/.gitignore that does not start with that line is the
repository’s own, and the command writes nothing and fails. The file is
committed, so that a fresh clone ignores the generated files before
statute first runs there. The check with git check-ignore above
still runs on each file before it is written.
Codex reads a project’s instruction files, from the repository’s root
down to the working directory, up to the number of bytes set in its
own configuration, project_doc_max_bytes, and cuts off the rest;
statute sets no limit on the full text.
Where CLAUDE.local.md exists, Claude Code loads no AGENTS.md of a
subdirectory either, neither at the start in that subdirectory nor when
it touches a file there, as it does without it. The rules of a
subdirectory are lost to it, unless the model happens to read the file.
So with the private output, a repository keeps such rules in its rule
set, not in AGENTS.md files of subdirectories. When it compiles the
private layer, statute compile warns of each AGENTS.md that git
tracks below the directory of statute.toml (the top of the
repository, as a rule, and where the links are written), saying that
Claude Code does not load it and that its rules belong in the rule
set. statute does not compile their content into
the full text.
A new worktree. The private rule set, the main worktree’s lock
file, which a new worktree reads until it locks, and
.git/info/exclude are shared by the worktrees of a clone, but the
private output and the two links are files of one work tree, and
git worktree add checks out only what git tracks. A git
post-checkout hook writes them. git runs it after git worktree add
(unless with --no-checkout) and after each
git switch or git checkout of a branch, in the top of the work tree
(githooks(5)); the hooks are in the common directory, so one hook
serves every worktree of the clone. The hook runs one command,
statute compile --private-only:
#!/bin/sh
# written by `statute hooks install`, which rewrites this file
[ "$3" = 1 ] && statute compile --private-only || true$3 is 1 for a checkout of a branch and 0 for one of files, so the
private output follows the branch, whose statute.toml may differ.
|| true keeps the hook’s exit status 0, which becomes that of the
checkout, without ending the hook, so the same line serves in a hook
that runs other commands too.
A merge moves a branch without a checkout. A main checkout that is
only ever brought up to date with git merge --ff-only runs no
post-checkout hook, and its private output would keep what its first
checkout wrote, or never be written. A post-merge hook runs the same
command after a merge, with no condition. git merge invokes it, but
not when the merge failed due to conflicts (githooks(5));
as observed with git 2.43.0 on 2026-10-15, that includes a
fast-forward, and a merge that finds nothing to do does not run it.
#!/bin/sh
# written by `statute hooks install`, which rewrites this file
statute compile --private-only || trueThe hooks’ paths are what git rev-parse --git-path hooks/post-checkout
and git rev-parse --git-path hooks/post-merge print, which follow
core.hooksPath. statute hooks install, run once per clone at the
top of a work tree that has a statute.toml, writes both there,
executable, and makes their directory when it is missing; no other
command touches the hooks, compile included. Each hook is decided on
its own, and what was done with each is printed. A hook whose second
line is the comment above is statute’s, and a line added to it is lost
when it is written again: one as it is now is left as it is, an older
one is written again. A file that is exactly the hook this design gave
before the command existed, #!/bin/sh and the same command ending in
; exit 0, is an older one of statute’s too. Any other file at that path, one
a hook manager wrote or a hand-written one, is left exactly as it is:
the command prints its path and that hook’s third line, shown above,
to add where it runs before the hook exits, and a note that pre-commit can run the
command from a local hook of either type, which pre-commit install --hook-type post-checkout or post-merge installs, and exits with
status 1 after the other hook. Without a statute.toml in the
directory it runs in, outside a git repository and below the top of a
work tree, where git does not run the hooks, it writes nothing and exits
with status 1. The hooks’ text is fixed; nothing of the repository goes
into it.
--private-only:
- writes only
.statute/.gitignore,.statute/AGENTS.full.mdand the two links, neverAGENTS.mdor the skills; - reads
statute.tomlandstatute.lockof the worktree, the private rule set and the worktree’s private lock file, and needs no network: a git source is read from statute’s cache (The statute directories), and nothing is fetched; - does nothing and exits 0, silently, when there is no
statute.toml; - when there is no private rule set, the global configuration turns
nothing on and no person’s own value differs from the committed one,
rewrites
.statute/AGENTS.full.mdto say whatAGENTS.mdsays if it is there, keeping the links (Values in the lock file and the outputs), and otherwise does nothing and exits 0, silently; - otherwise writes no private output, prints an error that names the
cause and the command to run, and exits 1, whenever the plain
statute compilewould fail or need the network: a lock file that is stale, a commit missing from the cache, a link that a.gitignoredecides, a rule set that does not resolve. Astatute.lockof an older statute that is otherwise current is not stale here (Rule sets and the lock file). The last line it prints isstatute: error: the private output is not written; …. A hook that fails would makegit worktree addandgit switchexit with its status (githooks(5)), so both hook lines above end with|| true, and a checkout succeeds whatever the command does.
A failed compile leaves no private rule behind. A private output
already on disk would otherwise keep giving the agents, through the
links, what the last compile that succeeded wrote: private rules that
may no longer hold. So when statute compile or statute compile --private-only fails, except on a lock file of another version
(below), it rewrites a .statute/AGENTS.full.md that is there to what the AGENTS.md on disk says, under one paragraph: statute
could not write the private output, the file leaves out the private
rules, statute compile --private-only names the cause and statute compile writes the private output or says what to fix. The links are
kept, so an agent reads the public rules and that paragraph, not old
private rules, and no link leads nowhere. The paragraph names no
cause, since a cause can name a private source or rule. What the file
then holds is public, so it is written whether git ignores it or not,
as when the links are not ignored. The AGENTS.md on disk is read, not
compiled, since the public layer may be what fails to load. Where there
is no full text, as in a new worktree, the command writes nothing and
makes no link; it never writes at a link’s path, so a file there that
is not statute’s link is left as it is. Nor does it rewrite a full text
that is the repository’s own: one that git tracks, or one beside a
.statute/.gitignore that does not start with statute’s line.
A lock file of another version leaves the private output as it
was. While statute.lock is of a version the command does not take,
any version but its own for compile, and for --private-only a newer
one or one that does not read as major.minor.patch, a failed compile
does not rewrite the full text, whatever else failed with the version:
a statute older than the lock file may not read the rule set at all.
The version says nothing of whether the private rules still hold, and
rewriting would take them from every agent on a machine at each
release: on the machines that install the new statute before a
repository locks again with it, and on those that have not installed
the statute a repository locked with. The command prints a note that
the file is left as it was and what writes it: the statute that wrote
the lock file, or for an older one, statute lock and then statute compile. Any other failure, such as a lock file of an older statute
that --private-only finds stale, still rewrites it.
The links are relative and lead to the worktree’s own .statute/.
The private layer overrides no public rule (above), so that a private
rule does not stand in a public rule’s place while Grok reads both
files: Grok reads the public rules apart from the full text, and an
agent that read two files in addition gave no reliable priority to
either when they disagreed. For the same reason, a public rule that
exclude in private.toml turns off still reaches Grok through
AGENTS.md; the private layer turns it off for the agents that read the
full text alone.
Known issue, not settled: exclude and a contradicting private
rule. private.toml can turn a public rule off with exclude and
turn on a private rule that contradicts it, unless an enabled rule
requires the public rule, which the build refuses. The build allows the
pair today. It checks only the conflicts that rules declare, and the
excluded public rule is not in force in the private layer, so even a
declared conflict with it is not reported; it reads no other
contradiction. Grok then reads both, the public rule through
AGENTS.md and the private one through the full text, which is the
disagreement the ban on overrides above is meant to prevent. What the
private rule lacks is what an override keeps: the public
rule’s place in the tree, the requirements on that rule counted as
satisfied, and the notice on statute upgrade when the public rule
changes. The behavior stays as it is for now; whether to forbid the
pair, to detect it or to leave it is open.
The agents’ behavior was measured on 2026-10-14 in non-interactive mode
on Claude Code 2.1.296, Codex 0.159.3 and Grok 1.0.50, with Grok’s
folder-trust check turned off for each run (without it, Grok loads no
project instructions in non-interactive mode), and on Pi 1.2.0 in one
run per case; Codex’s project_doc_max_bytes is from
its documentation and source. In runs of one small task, Codex and Grok
read the file a fallback line with an @ path names, two runs each,
and Claude Code loaded it as an import; with a line of the same kind
but other wording than statute’s, the path in backticks and no @,
Claude Code read the full text in two runs when nothing else loaded
it, each time the model’s own read. Every run had
the user’s own instruction files and skills in place, which also urge
an agent to find its instructions. The layout itself, with a stand-in
for the full text:
- Grok loaded the link
CLAUDE.local.mdignored through.git/info/excludein 2 runs of 2, and skipped it ignored through a.gitignorein 2 runs of 2. - With
CLAUDE.local.mdat the root, Claude Code loaded nosub/AGENTS.mdin 4 runs of 4, two with the working directory insub/and two at the root changing a file insub/; without it, it loaded the file in both control runs, once at the start and once after reading a file insub/. In one of the four runs the model read the file itself. - With
CLAUDE.md -> AGENTS.mdandCLAUDE.local.md, Claude Code loaded the public rules twice in one run, against once withCLAUDE.md -> AGENTS.mdalone. That Grok counts the two as one comes from the filesgrok inspectlists, with no model run. - Pi loaded the full text alone through
AGENTS.override.md, the link ignored through.git/info/excludeor through a.gitignore, and notAGENTS.md. - Claude Code, in the full layout with its default setting, loaded the
full text alone, and neither the root’s nor a subdirectory’s
AGENTS.md.
Not measured: interactive mode; the fallback line where no user-level
instructions or skills are present; a
CLAUDE.md -> AGENTS.md in a subdirectory, and whether it
brings that subdirectory’s rules back to Claude Code; Claude Code’s
setting that reads AGENTS.md beside CLAUDE.md, for subdirectories;
and Grok’s reading of a subdirectory’s AGENTS.md under this layout.
Each negative result holds only for the runs counted; the others are
one run each.
The private layer is built as described here, except what this section marks as not built yet.
In a private repository (public = false) there is no private rule
set, and a private.toml fails: the one statute.toml names every
source, and its outputs are committed as they are. Its private output
holds only what is the person’s own, from the global configuration:
the values of personal parameters
(Values in the lock file and the outputs)
and the rules the configuration turns on
(What the configuration turns on).
It is written, linked and ignored as in a public repository, and the
post-checkout hook writes it in a new worktree the same way. Global private rules belong at the user level once it is
built (Rule sets and the lock file,
Where it lives); until then they reach a repository
this way, their source named once in the global configuration
(Global configuration and git sources).
Enabling a private rule
A public repository enables a rule of a private source in its private
rule set: statute add --private <rule> lists the rule there, and the
source is named there too, as this section describes above. It never
copies the rule into its own rules. A copy writes one fact in two places
(Art. VIII §5), keeps the text of the revision it was copied from while
the private source moves on, and publishes in the repository’s
committed files the private assets the rule rests on. A rule with no
private asset in it belongs in a public source (R126), moved there
through that source’s review, where every repository that needs it can
enable it; a copy in one repository is not that move.
private.toml binds the agents that work in the clone, so a change to
it is a change to instructions, proposed and reviewed as a change of its
own (Art. X §4, R42). git never tracks it, so no pull request can carry the
change, and none of it goes into the public repository’s pull requests,
which name no private resource (R259). The change is recorded, reviewed
and then made:
- The author writes into a private record of the work, such as its
work item, the commands it will run and
private.tomlbefore and after them. - Another agent reviews that record against the constitution and the rules in force, and its verdict goes into the same record. What the author runs is exactly what was reviewed (Art. VII §3).
- A competent principal approves this change, and the same record
holds the yes, when the change enables a rule that declares a
relaxation needing a principal’s approval on the change that adds
it (Art. IX §1(2) or (3)), such as a private rule that moves
releases of the project out of Art. V §1, or when it turns off,
with
statute remove --private, a rule that is a guard (Art. II §5), which loosens that guard (Art. V §1(6)). A relayed yes counts only as R319, R320 and R40 provide, with its reference and checks in the record. - The author runs the commands, and pastes the resulting
private.tomlandprivate.lockinto the record, where the reviewer checks thatprivate.tomlis the version it passed.
Work that the newly enabled rule governs, such as a release it allows, starts only after the last step (Art. X §4).
Overrides
A rule set may put a rule of its own in place of a rule of another
source. Most departures need none. A public rule states the principle
and leaves the concrete values to the layers below, which add them as
rules of their own: a public rule says that worktrees live outside the
main checkout, in a directory of their own, and a global private rule
names the directories, ~/dev for main checkouts and ~/wt for
worktrees. The two rules hold together, so the second adds to the first
and overrides nothing. A public rule is written so that it can be added
to this way.
An override is for a rule that cannot hold together with what a rule set
needs. A public rule says that pull request descriptions are written in
English, a value the source chose rather than leaving it to the layers
below; a repository whose readers all read Chinese writes a local rule
that its descriptions are in Chinese, which overrides the public one.
The lasting fix is to propose to the source the rule in its
principle-only form.
The compiled file then has only the local rule, at the place of the one
it overrides, and no line about the override, in AGENTS.md and in the
private full text alike
(Compilation and the site).
The local site lists the rule it overrides on its page
(The local site). The
public rule is not superseded: it stays in force in every other rule
set.
Declaring it. The overriding rule names the rule it replaces, in one field:
id = 3
kind = "rule"
overrides = "R200"overrides names exactly one rule, written as requires writes it. A
rule that replaces two rules is two requirements, so it is two rules. A
domain or a one-of cannot be overridden: a rule set picks another child
of a one-of instead, and a child the source lacks is proposed to the
source (Conflicting practices as one-ofs). A rule with
overrides has no parent, since its place is that of the rule it
overrides; the build fails when it has one.
Who may override whom. A source has one of three ranks, and a rule may override only a rule of a lower rank:
- the first-party source,
R, which overrides nothing; - every other global source, public or private: a team’s or a person’s own rules may replace a first-party rule for all of their repositories (a private source’s rules, in a public repository, only a rule that the private layer alone enables, below);
- local rules: the repository’s own, in
.statute/rules/, and any source withscope = "local".
Two rules of the same rank cannot override each other, and within one
source a rule is changed in place or superseded, never overridden. A
chain is allowed: a local rule may override team:7, which overrides
R200; the compiled file then shows the local rule alone, the local
site gives each link of the chain on the page of the rule that makes it,
and statute explain gives the whole chain, “it overrides team:7, which
overrides R200”. The reference direction
(Which rules may cite which) applies as well: a public rule
cannot override a private one.
Only within one output. An override is made only between rules
compiled into the same output. In a private repository every source
statute.toml names is compiled into one file, so any rule it enables
may override one of a lower rank: the overridden rule does not appear,
and the overriding rule stands in its place. A rule that the global
configuration alone turns on there overrides none of them, as in a
public repository: its entry is left out with a note
(What the configuration turns on). In a public repository, the private layer overrides
no rule of the public layer
(Private rules in a public repository):
a rule it enables fails when it overrides a rule of the public layer,
one that statute.toml enables, directly or through a requirement:
error: `here:2` overrides "R200", a rule of the public rule set `statute.toml`; in a public repository (`public = true`), a rule `private.toml` enables overrides no rule of the public layerTurning a public rule off with exclude and enabling a private rule
that contradicts it is not an override, and the build does not stop it
(the known issue).
Within the private layer, a rule may override any rule of a lower rank that only the private layer enables, since both are compiled into the private output; within the public layer, a rule may override a public rule of a lower rank. Both work as in a private repository. A rule of the public layer may also override a rule that only the private layer enables: the public output has the overriding rule where its target would stand, with the warning below that nothing else enables the target, and the private output has it in the target’s place.
What the build does. An override takes effect when the overriding rule is enabled:
- The overridden rule counts as enabled for every requirement on it and
for its one-of, so a rule that requires
R200is satisfied, andR200’s siblings under a one-of stay excluded. Its own requirements are not brought in; the overriding rule’s are. Its parent is the exception: when that is a rule, directly or through a one-of, it still counts as a requirement of the overriding rule, which stands in its place. - Conflicts declared on the overridden rule, or by other rules against it, do not apply; the overriding rule’s conflicts do.
- Its children stay as they are.
- Its check does not run; the overriding rule’s does.
- An override applies where the overriding rule is enabled: in a rule set split into path segments, in the segments that enable it, and nowhere else.
- Two enabled rules that override the same rule fail the build, naming both.
- An overriding rule whose target is not enabled by anything is compiled where its target would stand, with a warning that the target is not in the rule set.
- An overriding rule has no
default, so it comes in only when the rule set enables it: lists it inrules, takes it in a pack, or enables a rule that requires it. One of the repository’s own rules that nothing enables gets a warning (The directory of local rules).
The lock file records the overridden rule as it records any other, with one more field:
[[rules]]
rule = "R200"
revision = 2
sha256 = "<SHA-256 of rules/200.toml>"
original-sha256 = "<SHA-256 of rule 200 without its translations>"
overridden-by = "L3"So the source’s later changes to R200 still show on statute upgrade,
which adds to each such line that L3 overrides it, for the user to
check that the override still holds.
Not the same as.
- Superseding: a source replaces its own rule for every rule set, for good (IDs and revisions); an override replaces another source’s rule in one rule set.
conflicts: two rules that cannot both be enabled, with nothing taking either’s place (Dependencies, one-ofs and packs); an override puts one rule in the other’s place.- A one-of: alternatives the source foresaw, each a rule of its own, of which each rule set picks one; an override is a departure the source did not foresee. When two rule sets override the same rule the same way, the departure is proposed to the source as a child of a one-of.
- Leaving a rule out and adding one: the rule set loses the tie to the original. An override keeps it: its place in the tree, the requirements on it, and the notice when the original changes.
- A relaxation (Relaxation declarations):
a relaxation lifts part of a rule under a permission of the
constitution; an override is a choice of which rules a jurisdiction
adopts (
division-of-instructions.rules), and needs no permission.
Subdomains
A domain may sit under another domain, as a subdomain: Git under
Workflow, say, or Rust under Languages. It is a domain with a parent
that names a domain:
id = 105
kind = "domain"
parent = 104- A domain’s
parent, when present, is a domain, at any depth: of the same source, written as its number, or of another source, written asrequireswrites one ("R78"). It may also be a one-of of the same source, of which the domain is an option (No rule under a rule). Domains nest to any depth; a domain whose parent is a rule fails the build, as do parents that form a cycle, within one source or across sources. The reference direction applies: a domain of a public source hangs only under a public domain. - A rule or a one-of may have a subdomain as its parent, as it may a domain; a rule’s parent is never a rule.
- A rule’s
parentmay also name a domain or a subdomain of another source, never a rule or a one-of of another source, so that the local rules of a repository about Git appear under the general Git heading rather than under one of their own. The reference direction applies: a public rule’s parent is a public domain. - A domain of one source may hang under a domain of another for the
same reason: a private source’s domain about the user’s fleet of
agents appears as a subdomain of the first-party domain about agents,
with its rules below it. The first-party source’s own domains are the
roots: in it, a
parentin another source is accepted on a rule only (Checkers). - Enabling a domain as a pack enables its subdomains’ rules; a subdomain
may be the root of a pack of its own. A pack is a subtree of one
source: it does not reach the rules or subdomains of another source
hung under its domains, which a rule set enables by listing them in
rules, or a subdomain of another source as a pack of its own.
Rendering. In the compiled AGENTS.md, each domain or subdomain
with a rule in the file is a heading of its title, a subdomain one level
below its domain, and its rules are items in the order of the tree, as
in Compilation and the site,
which gives the order and the levels: a subdomain’s rules come after the rules and
one-ofs directly under its domain, and in each part the domain’s own
source comes first, then the other sources by their names, as the
domains themselves are ordered. On the site, a subdomain heads the rules
below it as a domain does, nested under its domain’s heading, and its
page lists the nodes below it (Static site).
Conflicting practices as one-ofs
When repositories have good reasons to work in incompatible ways, the ways are written as children of a one-of, and each rule set picks one. No rule is written as “do A, except when …” and patched each time a repository needs the exception.
How the design keeps up with the code is such a pair. A one-of “Keep
the design in step with the code”, under a documentation domain, has two
children (the IDs are placeholders here; the rules are written in
rules/, not in this design):
<A>: the design changes in the same pull request as the code it describes.<B>: the code may land before or after the design, and every mismatch is marked: a part of the design not built yet says so, and a pull request that leaves the design behind says so in its description and leaves a follow-up.
The reasons for B: designing before writing code is normal; a project
that wants to move fast lets code go first; and when the design is in
one place, parallel changes to it conflict on merge. A rule set enables
one of them in rules, as with any one-of; one that enables <B> has
nothing to relax and nothing to override, and a monorepo may pick
differently per path segment. The rules that a design is descriptive,
not an instruction, and that it is split into files by topic so
parallel changes rarely meet, are separate rules beside the one-of, not
conditions inside either child.
Cutover from the hand-written guide
The hand-written guide is replaced repository by repository. Since
2026-10-15 the guide says of itself that an agent working in a
repository whose root has a statute.toml ignores the guide entirely
and follows only that repository’s AGENTS.md. This one sentence is
the only transition clause: a repository switches when the change that
adds its rule set is merged, and it switches as a whole, with no topic
(credentials, say) moving before the others. What is specific to one
environment was never a candidate for the first-party source and does
not wait in the guide either: it is a global private or a local rule
from the start.
The inventory. Each item of the guide gets exactly one destination, recorded in a mapping on the private side, as in Migrating from the current hand-written guide, step 3, with its “private rule” split three ways:
- the constitution;
- a first-party rule (
R), when any repository could use it as written; - a global private rule, when it holds for all of the person’s repositories but names their machines, accounts, bots or layout;
- a local rule of one repository, public or private as the repository is;
- a parameter, a skill (a procedure), provenance (to the private casebook), or removal.
A repository’s own departure from the guide (that guide’s step 6) becomes an override, a child of a one-of, or is removed.
Retiring the guide. Once every repository in which agents still work has switched, one change on the private side retires the guide. It installs nothing in its place: no compiled output goes into the home directory, which afterwards holds no rule text (whether it keeps a short pointer is an open question). The user-level compiler of Compilation is planned, not built, and the retirement does not wait for it. The change may be made when all of these hold, checked on the private side:
- Every item of the guide has a destination in the mapping, and each
destination that is a rule gives its reference (
R42,me:4,L12). No item is pending. - No rule of any kind names the guide, its file or the numbers of its items. The private-term scan (Checkers) runs with the guide’s file name and the pattern of its item numbers as terms, each pattern first run on a line that must match.
- Every repository in which agents still work has a
statute.tomlat its root and passesstatute compile --check, the private rule set included where it has one, and the change that added its rule set recorded what its compiled output keeps, changes and drops of the instructions it replaced. A repository in which no agent works any more is listed as such on the private side instead.
Checking the retirement. A load check stands in for
Load verification, which is planned,
not built. On each machine, once the retiring change is applied there,
Claude Code, Codex and Grok each start one session in a repository that
has switched, and what each loaded is read through the harness’s own
read-only entry point, the ones Load verification lists, never by
asking the model. The check passes when what was loaded holds a line of
that repository’s AGENTS.md that the guide does not hold, such as the
heading of the constitution’s edition, and does not hold the opening
paragraph of the guide. The generated-file line at the top of
AGENTS.md is an HTML comment, which Claude Code strips before loading,
so it is not the line to look for. Each arm has its control: run before
the change is applied, the second arm fails, since the guide is still
loaded; run in a repository without an AGENTS.md, the first arm finds
no such line. On a machine where the check fails, the change is reverted
there, so that the guide is back, until the cause is found and fixed.
What this changes
The parts of the design this one changes describe it already, each marking what is not built:
- Rule file format: a rule’s
parentmay name a domain of another source, a domain may have aparent, in its own source or another, and a rule may haveoverridesin place ofparent. - Rule sets and the lock file:
public,scope, the private rule set andoverridden-byin the lock file. - Dependencies, one-ofs and packs: domains nested to any depth.
- Compilation and the site: where a subdomain’s heading and rules come in the compiled file.
- The command and the first version: what is built so far, and moving over by the cutover above.
- Checkers: what
statute validatechecks of the new fields within one source and what statute checks across sources. - Choosing rules: a rule is changed by an override.
Open questions
- What the home directory holds once the guide is retired: nothing, the
user-level instruction files and their links removed, or a pointer of
a few lines saying that the rules are in each repository’s
AGENTS.mdand that an agent working outside any repository first stops and asks whoever delegated the work. The person decides this in the change that retires the guide; a pointer is easy to remove later. - How the skills of a rule that only the private layer enables are installed (Private rules in a public repository).