carlos / platform Public

AGENTS.md: the census covers only code root runs (C2)

How root's entry points are found, what the graph reaches, which files and
directories are in scope today, what the census cannot see (what the agent
writes into a root-read path is the reviewer's job), the left class, the
new base and the archive, and J4 narrowed to rows in scope.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 3b50a5ab8246a39555986f19a0b8b1cce9a6697b parent 3e63432
1 file changed, +129 −42
  • AGENTS.md +129 −42

CI passed — run details

diff --git a/AGENTS.md b/AGENTS.md
index 2991abc7f..852e944b0 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -285,35 +285,101 @@ anything.
GOPROXY=off`; go commands may need the sandbox disabled ("read-only file
system" from the toolchain is the tell).
-## The census: an approval, not a decision (Paul, 2026-10-24, #369; reviewer, 2026-10-25)
+## The census: an approval, not a decision (Paul, 2026-10-24, #369; reviewer, 2026-10-25; code root runs, 2026-10-26)
`TestPlan14RootReadCensus` (`internal/provision`) fails when a branch
-changes a unit that reads root-owned state, or a package inside the
-census envelope. Every such change needs an approval on #280 before the
-merge. Most are approvals: the same reads in an edited body, or an
-envelope fingerprint that moved. An independent reviewer gives those;
-the census owner (Paul) sees only decisions and escalations. Get them
-approved like this:
+changes code that root runs and that reads root-owned state, or a
+directory envelope of code root runs. Every such change needs an
+approval on #280 before the merge. Most are approvals: the same reads in
+an edited body, or an envelope fingerprint that moved. An independent
+reviewer gives those; the census owner (Paul) sees only decisions and
+escalations.
+
+### What the census covers (C2, Paul's ruling 2 on #280)
+
+Only code root runs. Agent-only, console-only and template edits do not
+need a card.
+
+- **Root's entry points** come from the units in `internal/host/units`.
+ A unit with no `User=` and no `DynamicUser=` runs as root, and each
+ `/opt/carlos/carlos <verb>` in its `Exec` lines names a verb. Today
+ that is `adopt` (with `--config-only`, `--stage-only` and
+ `-restart-only`), `instance-control`, and `system` `apply`,
+ `guard-exec`, `floor-allows-prev` and `join`. The boot verbs user_data
+ runs as root are added by hand (`rootBootVerbs`): `bootstrap`,
+ `system install-channel` and `system host-env`. A root unit that names
+ a verb `main` or `runSystem` has no case for fails the census.
+- **What they reach** is J4's reference graph for linux (`censusGraph`),
+ walked from `main.go:main`. In `main` and `runSystem` it follows only
+ the cases of root's verbs. It also starts from every `init` and every
+ call in a package-level `var` initializer of the carlos binary, and a
+ reached type reaches its methods the standard library calls by name
+ (`Error`, `String`, `Read`, `ServeHTTP` and the rest in
+ `rootCallbackMethods`). The graph is conservative: a call through an
+ interface reaches every method of that name that implements it.
+- **A Go unit** is in scope when its declaration is reached. **A non-Go
+ file** is in scope when a reached declaration embeds it (the units),
+ when it is under `infra/` (user_data and its units run as root at boot,
+ and its IAM decides who writes what root reads), or when it sits beside
+ a reached declaration. `scripts/` and test tooling are out.
+- **An envelope** is one per directory holding anything in scope. It
+ hashes the reached declarations there, doc comments included, and the
+ in-scope files, plus `go.mod` and `go.sum` for `.`. An edit to code
+ root does not reach leaves it alone, even in the same file.
+
+In scope today (106 envelopes, 2269 units): the units, `.`
+(`main`, `runSystem`, `systemVerb`), `infra/modules/*`, and in
+`internal/` most of `host`, `hostbox`, `hostguard`, `hostexec`,
+`hostfloor`, `hostfence`, `hostfiles`, `instancectl`, `instancefs`,
+`activator`, `release`, `registry`, `rootstate`, `rootparticipation`,
+`rootfsimage`, `safefile`, `cgroup`, `caps`, `appconfig`, `schedule`,
+`rollout`, `park`, `lease` and `layout`, the parts of `edge` and `gate`
+that `http.Handler` dispatch reaches, 225 of `console`'s 3879
+declarations, and a few declarations each in about 70 more packages. The
+claim code is still in the tree and root's verbs still reach much of
+it. The edge's request path is in only because a claim wrapper in root
+`instance-control` calls `ServeHTTP` through the interface. Read the
+`@coverage` lines of `testdata/census-base.tsv` for the exact list.
+
+What the census does not see:
+
+- **What the agent writes into a path root reads.** Root's read is in
+ scope, so a change to how root reads it needs a card. A change to what
+ the agent writes there is out of the census. On root-facing paths (a
+ file root opens, a record root acts on), checking that is the
+ reviewer's job.
+- **Calls the graph cannot see**: reflection by name, `go:linkname`, a
+ function value or interface implementation set up by code root does
+ not run.
+
+An agent-side edit can still bring code into scope. A new method with
+the name of an interface method root calls (`Close`, `Error`, `Read`)
+is reached by the graph's rule, and shows as a new unit or an envelope
+change.
+
+### Getting a change approved
1. `make census-card` prints what changed and writes nothing. Each change
has a class:
- `body`: the digest moved and the reads did not;
- `sites`: more or fewer reads of kinds the unit already makes;
- - `envelope`: a package was re-pinned;
+ - `envelope`: a directory was re-pinned;
- `removed`: the scan finds neither the unit's declaration nor any of
its sites, or an envelope's directory is gone. A path counts as gone
only if it is absent by Lstat: no file, directory or symlink there,
and no symlink above it;
- - `reads` (a kind of read the unit did not make before), `new`,
- `quiet` (a unit still declared that reads nothing now, a directory
- still there with no source the census scans, or a path replaced by a
- symlink) or `other` (any census
- discrepancy none of these explains, shown with the census's own
- message): a decision.
+ - `left`: the unit or directory is still in the tree, but root's
+ verbs no longer reach it;
+ - `reads` (a kind of read the unit did not make before), `new` (a
+ unit root reaches that has no row, including one that came back
+ into scope), `quiet` (a unit still in scope that reads nothing now,
+ a directory still there with no source the census scans, or a path
+ replaced by a symlink) or `other` (any census discrepancy none of
+ these explains, shown with the census's own message): a decision.
2. Write a CLAIMS file with one line per changed unit:
`<file>:<unit><TAB><what changed, and that no read was added or which one was>`.
- A claim for a removed unit is optional. A branch that only deletes
- code can pass an empty file.
+ A claim for a removed or left unit is optional. A branch that only
+ deletes code can pass an empty file.
3. `make census-propose NAME=<branch> CLAIMS=<file>` writes the rest:
- the overlay (`testdata/plan14-root-reads-<NAME>.tsv`), each unit
re-frozen at its existing disposition with the claim appended;
@@ -322,9 +388,14 @@ approved like this:
`census-ruling-<NAME>;absent;basis=<claim>`. That removal holds only
while the declaration stays out of the tree, even one that reads
nothing;
+ - for each unit that left scope, the same with `;left;` in place of
+ `;absent;`. It holds while root does not reach the unit. If root
+ reaches it again it is `new`, and a hand row re-admits it;
- for each deleted directory, `@coverage <dir> -`, which retires its
envelope. The census fails while anything is at that path, even a
- directory of tests or a symlink;
+ directory of tests or a symlink. A directory that left scope gets
+ `@coverage <dir> left`; back in scope it is an envelope nobody
+ pinned;
- the `@legacy` fingerprints, the envelope re-pins and the new seal (a
deletion alone leaves the seal as it was);
- its line in `testdata/plan14-root-reads-chain.tsv`;
@@ -342,12 +413,15 @@ approved like this:
every unit and every re-pinned envelope, citing the lines it read:
- a unit is compared with its recorded disposition and basis, which
the card lists;
- - an envelope means every changed function in that package and what
- it reaches, since an envelope re-pin is how the census sees reads its
- scanner cannot attribute to a unit;
+ - an envelope means every changed declaration root reaches in that
+ directory and what it reaches, since an envelope re-pin is how the
+ census sees reads its scanner cannot attribute to a unit;
- a removed unit or a retired envelope means confirming the code is
deleted, not moved, and that no check root relies on goes with it
- unless its callers' changes on the card account for that.
+ unless its callers' changes on the card account for that;
+ - a unit or directory that left scope means confirming that the
+ reference that reached it was deleted or changed in code on the
+ card, not hidden from the graph.
It escalates if the change lets root open, run, query or follow
anything it did not before from a path or input a tenant, an app or a
@@ -366,35 +440,48 @@ read the diff, but it need not be the owner.
A deletion is an approval, not a decision (Paul, 2026-10-25, ruling 1 on
#280): a deletion cannot add a read, and the scan, not the claim, proves
-the unit absent. Code that moved is not a deletion. A unit moved whole
+the unit absent. Leaving scope is an approval for the same reason: root
+runs less. Code that moved is not a deletion. A unit moved whole
shows as `new`, and a read that moved shows as a change to the unit that
took it.
+### The base and the archive
+
+The census starts from `testdata/census-base.tsv`, sealed by
+`rootReadBaseSeal`. It is the old chain's effective inventory narrowed
+to code root runs on 2026-10-26: rows and frozen declarations byte for
+byte, envelopes pinned afresh (`TestCensusRebaseCarriesDispositions`
+checks it). The old base, its 117 overlays and their manifest are in
+`testdata/archive`. Nothing new goes there. J4's inventory and the
+re-base's own check read it.
+
J4 (`TestPlan14RootInputInventoryCoverage`) checks its own inventory,
-the 27 overlays up to `activation-tools`, and its caller check covers
+the 27 archived overlays up to `activation-tools`. Only its rows still
+in the census's scope are checked; a row root no longer runs is reported
+as `left-scope` in its report and not checked. Its caller check covers
those rows only. A row a later overlay added is never caller-checked. A
-row of J4's inventory is retired when the full chain no longer carries
-it and the tree no longer declares its unit. J4 skips a retired row. A
-row the chain removed whose unit is still declared is still checked. A
-family's witness tests stay required while any authority row in the full
-chain names the family and its unit is still declared. That includes a
-row only a later overlay added. Rows outside J4's scope do not count:
-those tagged only E4 or J1 to J4, and the relocation and activator
-worker files. Once no such
-row names the family, its witnesses may go in the same change. A
-surviving row of J4's inventory with no production caller still fails,
-so a deleting branch removes the row or keeps the caller. An exemption
-for a retired unit fails until it is deleted with the unit.
+row of J4's inventory is retired when the chain no longer carries it and
+the tree no longer declares its unit. J4 skips a retired row. A row the
+chain removed whose unit is still declared and in scope is still
+checked. A family's witness tests stay required while any authority row
+in the chain names the family and its unit is still declared. That
+includes a row only a later overlay added. Rows outside J4's scope do
+not count: those tagged only E4 or J1 to J4, and the relocation and
+activator worker files. Once no such row names the family, its
+witnesses may go in the same change. A surviving row in scope with no
+production caller still fails, so a deleting branch removes the row or
+keeps the caller. An exemption for a retired unit fails until it is
+deleted with the unit.
The tool refuses decisions (`reads`, `new`, `quiet`, `other`): a new
kind of read can make a unit's disposition wrong, so it is the owner's
-call, not an approval. Write those rows by hand, following the overlays in the
-chain, and ask on #280 with the card attached; the census owner decides
-those. Nothing about the census's strength changes: every changed read is
-still named, digested and read by someone other than its author before
-merge. The record-write
-census (9B8, the `*_census_test.go` inventories) still takes hand-written
-entries.
+call, not an approval. Write those rows by hand, following the overlays
+in the archive, and ask on #280 with the card attached; the census owner
+decides those. Within its scope, nothing about the census's strength
+changes: every changed read root runs is still named, digested and read
+by someone other than its author before merge. The record-write census
+(9B8, the `*_census_test.go` inventories) is unchanged and still takes
+hand-written entries.
## Rules this repo has paid for