docs: write down trust boundaries, security review scope, and startup-path gates
Summary
#4584 took many review rounds because three things were not written down: who is trusted for which filesystem decision, where a security PR's scope ends, and which gates fire on import shape. This PR writes them down. It is docs only and touches 13 files.
- New
docs/agents/security.md, routed from AGENTS.md. It states trust boundaries (script publication takes no path from the daemon; capture delivery still can, open in #4518), what applies today (ADR 0016 judges caller-named script destinations on POSIX against the writing process's uid; both script publishers stage and commit inside the judged directory; remote script delivery caps bytes), and the rules proposed in #4669, which apply once approved: the ADR 0016 walk for caller output and name validation for peer-named entries, with ADR 0016 staging and byte caps as migration candidates. It names the write sites that do not follow them yet. - The elevated-writer, descriptor, and path-dialect rules are not in the guide. They are proposed for approval in this #4669 comment.
review.md: a design-review trigger for a new trust boundary, plus a scope rule.gates.md: one pointer sentence to ADR 0027 andtest/wire-compat/README.md, which now carry the commands.- ADR 0016: a corrected caller-named destination section, smaller than on main.
Why a separate guide, not a section in ADR 0016: ADR 0016 decides script publication only. The guide routes any task that writes at a path another party chooses, including the sites #4669 still has to decide, so its home is the agent-doc router.
Removed agent-doc lines (the minimum the 40,000-byte budget needs) and where each rule still lives
Every other unrelated agent doc is identical to main.
| Removed | Still lives in |
|---|---|
| review: "never replace with text matching" | AGENTS.md working rules |
| gates: "For execution, read validation"; test-audit: validation and isolated-experiments links; issue-tracker: triage-labels link | AGENTS.md task router |
| selector-capture: repeated stabilization line | first bullet of the same file |
| test-authoring: split files beside module | code-ownership.md |
cli-flags: projectConfig/recorded meanings and requirement | flag-types.ts types and JSDoc |
| cli-flags: CLI input readers line | step 2 of the same file |
| cli-flags: schema derivation line | Partial prose loss: the authoring route survives in step 1; how command metadata and family schemas combine now lives only in command-schema.ts and command-overrides.ts |
web-backend: Windows .cmd and CVE detail; Windows npm setup detail | agent-browser-tool.ts and agent-browser-install.ts comments |
web-backend: Node 24, --state-dir, first-run flow | website installation and commands docs |
AGENTS.md keeps every rule; its wording is tightened in six places to fit the new row.
ADR 0016 migration ledger
| Old paragraph | Outcome |
|---|---|
| Intro (routes, relative refusal, one call, POSIX-only) | Intro, Path input, Walk, Platform limits |
| Acceptance rule; "So the guarantee is" | Guarantee, corrected for the shared-sticky exception |
Walk emulation, lstat, hop limit | Walk; realpath and stat are under Rejected |
| Creation, concurrency, 0700, 0600 files | Creation, with what a refusal can leave; modes under Answer and staging; recursive mkdir and refusing concurrent directories are under Rejected |
Answer used as it stands, staging beside the spelling, dev:ino, openat | Answer and staging, with the two remote refusal reasons; openat is under Rejected |
| Sticky bit, link judging, aliases | Sticky directories, with the link-owner rule and the subdirectory a walk may create |
| Group-writable, systemd membership | Group-writable directories, with the exposure order; also Rejected |
| "Shapes this closes" list | Case table of accepted and refused invariants; the owning tests are atomic-file-ancestry.test.ts, atomic-file-parent.test.ts, atomic-file-decisions.test.ts, and daemon-artifacts-script-ancestry.test.ts (#4671 trims the last) |
| State directory out of scope | Kept, links fixed |
| ACLs, network filesystems, mounts | Kept; the Linux ACL mask, and when remote confirmation notices a mount |
| Typed failures, batch receipt, Rejected | Unchanged |
Validation
Head 8d14fe0196. pnpm check:agent-guidance (5 pass), pnpm check:adr-citations (2 pass), and pnpm check:doc-prose (clean) pass, and pnpm format gives no diff. docs/agents is at 39,961 of 40,000 bytes and AGENTS.md at 3,999 of 4,000. The ADR 0016 subsection is 11,164 bytes from its heading to the next heading (11,214 on main). Runtime tests do not apply because no code changed. The base comparison and host checks are posted as a PR comment.
š¤ Generated with Claude Code