Making sure an agent actually loads the guidance #213

Closed
opened 2026-11-16 06:10:53 +00:00 by Claude · 2 comments
Owner

Part of #87

Question

AGENTS.md structure and what happens to CLAUDE.md's content makes AGENTS.md canonical with no CLAUDE.md. A review confirmed that against Claude Code's documented behaviour, and found ways a contributor's agent still ends up with no guidance and no warning. Decide:

  • Any CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md switches off all AGENTS.md loading, and apm compile, a tool's project init or a skill can each create one. A control that refuses such a file (a pre-commit fail hook, also in Lint)?
  • An older Claude Code version reads no AGENTS.md at all. The decision states no version on purpose. State a minimum version and a way to check that the file loaded?
  • Nested AGENTS.md files load only when a file in that directory is read with the Read tool, and some agents started at the root never read them. One triggered pointer per nested file in the root AGENTS.md?
  • apm instructions in .claude/rules/ reverse the earlier "no .claude/rules", reach one agent only, skip the always-loaded test and have no precedence against AGENTS.md. Allowed before the managed-section issue (#197) lands? Which wins on conflict, and must shared rules take the map's rule form?
  • "Never permissions" in the tracked settings also excludes deny and ask rules, which only restrict. Narrow it to "never permissions.allow"?
  • Where does attribution live if apm treats .claude/settings.json as its own file? Does apm install keep keys it does not know?
  • The default trailers of the common tool are the ones the AI policy excludes. The maintainer chose review only; a one-line commit-msg check would hold it. Reopen that choice?
  • roles/AGENTS.md would ship in the Collection tarball and load into consumers' agents.

From the review

Part of #87 ## Question [AGENTS.md structure and what happens to CLAUDE.md's content](https://git.rkdr.net/Mortis/Kamino/issues/101) makes `AGENTS.md` canonical with no `CLAUDE.md`. A review confirmed that against Claude Code's documented behaviour, and found ways a contributor's agent still ends up with no guidance and no warning. Decide: - Any `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` switches off all `AGENTS.md` loading, and `apm compile`, a tool's project init or a skill can each create one. A control that refuses such a file (a pre-commit `fail` hook, also in Lint)? - An older Claude Code version reads no `AGENTS.md` at all. The decision states no version on purpose. State a minimum version and a way to check that the file loaded? - Nested `AGENTS.md` files load only when a file in that directory is read with the Read tool, and some agents started at the root never read them. One triggered pointer per nested file in the root `AGENTS.md`? - apm instructions in `.claude/rules/` reverse the earlier "no `.claude/rules`", reach one agent only, skip the always-loaded test and have no precedence against `AGENTS.md`. Allowed before the managed-section issue (#197) lands? Which wins on conflict, and must shared rules take the map's rule form? - "Never `permissions`" in the tracked settings also excludes `deny` and `ask` rules, which only restrict. Narrow it to "never `permissions.allow`"? - Where does `attribution` live if apm treats `.claude/settings.json` as its own file? Does `apm install` keep keys it does not know? - The default trailers of the common tool are the ones the AI policy excludes. The maintainer chose review only; a one-line commit-msg check would hold it. Reopen that choice? - `roles/AGENTS.md` would ship in the Collection tarball and load into consumers' agents. ## From the review - Amends, depending on the answer: the root and nested `AGENTS.md` issues (#185, #182, #181), the contributor docs issue (#189), the attribution issue (#152), the local settings and hooks issue (#196), the managed-section issue (#197), a supersede note on [Guiding principles for agents and humans](https://git.rkdr.net/Mortis/Kamino/issues/91).
Claude added the
Wayfinder
Grilling
label 2026-11-16 06:10:53 +00:00
Author
Owner

Evidence from the review of the map (2026-11-15). Claude Code behaviour is from its memory, settings and permissions docs; nothing was tested in a session.

A control that keeps CLAUDE.md out

  • Memory docs: an AGENTS.md and a CLAUDE.md or CLAUDE.local.md in the working directory or above means "Your CLAUDE.md files only"; .claude/CLAUDE.md and CLAUDE.local.md "Count, so Claude reads them instead of AGENTS.md". The user-level instructionFiles setting changes this, but Claude Code "ignores it in project and local settings files", so the repository cannot opt in.
  • Tools that create one: apm compile for target claude writes CLAUDE.md; rtk's project-level init writes into one (inferred from its marker block; confidence medium); the deployed skill setup-matt-pocock-skills/SKILL.md:78 edits CLAUDE.md if present.
  • docs(agents): replace CLAUDE.md with a root AGENTS.md checks "No CLAUDE.md anywhere" once. The failure is silent: zero guidance, no error.
  • Recommendation: a pre-commit hook with language: fail and files: (^|/)(\.claude/)?CLAUDE(\.local)?\.md$, also run in Lint. No custom script.

Minimum version and a load check

  • Memory docs: "Reading AGENTS.md directly requires Claude Code v2.1.277 or later"; "Before v2.1.281, some sessions, such as those on Amazon Bedrock or with telemetry disabled, read CLAUDE.md files only". The docs name a check: the line "no CLAUDE.md found; AGENTS.md loaded: ...".
  • Recommendation: setup.md states 2.1.281, says not to create CLAUDE.local.md (use ~/.claude/CLAUDE.md), and asks to confirm that line.

Nested AGENTS.md and root pointers

  • Memory docs: a subdirectory's AGENTS.md loads "when Claude opens a file there with the Read tool". A session that explores with cat or rg through Bash never loads it.
  • Codex AGENTS.md guide: Codex walks from the project root "down to your current working directory", once per run, so a session started at the root never sees roles/AGENTS.md. Guiding principles for agents and humans says Codex reads nested files; that is wrong for this case. Cursor and Copilot were not checked.
  • Recommendation: one triggered pointer per nested file in the root (about five lines), and point the ADR trigger at docs/adr/AGENTS.md.

.claude/rules/

  • The principles decision: "No CLAUDE.md, no .claude/rules, no hook injection for guidance". Agent guard hook and permission allowlist lets apm instructions land in .claude/rules/ and records the disagreement: "Claude-only delivery cuts against 'Standing alone'". The principles decision has no superseding note.
  • Rules without paths: load at launch beside AGENTS.md, skipping the always-loaded test. For other tools apm instructions are compile-only.
  • No decision says which wins on conflict, or whether shared rules take the map's rule form.
  • Recommendation: deploy no apm instruction until Move apm instructions from .claude/rules/ into a managed section of the root AGENTS.md lands, and compile that without the claude target.

"Never permissions"

  • Permissions docs: project allow rules wait for workspace trust; "deny and ask rules aren't affected, since they only restrict."
  • Option seen: "never permissions.allow", and consider an ask rule on Bash(git push *) instead of the apm guard hook. Both are bypassable by spelling; branch protection is the real control.

Where attribution lives

  • The settings reference documents attribution.commit and attribution.pr (fixed text) in any settings file.
  • Two readings disagree. The skills source documents that apm treats .claude/settings.json as its own deployed file, so a hand-added key is permanent drift in apm audit --ci. Current apm docs say hooks are merged into the file and drift compares only apm-owned hook entries. Version-dependent; not tested.
  • Recommendation: after adding the key, run apm install and confirm it survives. If not, keep it in the ignored local file and rely on a commit-msg check.

A commit-msg check for trailers

  • Claude Code's default commit attribution is Co-Authored-By: <name> <[email protected]>; sessionUrl defaults to true. Of the last 50 commits on main, 14 carry Co-Authored-By:, 12 Claude-Session:, 3 Assisted-by:. The deployed git-commits skill teaches Co-authored-by:.
  • A commit-msg hook already runs (.pre-commit-config.yaml:13-14). The findings disagree on weight: one calls a pygrep entry there cheap and a real control; the other notes the maintainer chose review only and suggests no action unless reopened.

roles/AGENTS.md in the tarball

  • galaxy.yml:44 lists CLAUDE.md in build_ignore, no AGENTS.md; scripts/check_tarball.py allows roles. A consumer's agent reading an installed role would load contributor rules.
  • Recommendation: add roles/AGENTS.md to build_ignore and to FORBIDDEN in check_tarball.py.
Evidence from the review of the map (2026-11-15). Claude Code behaviour is from its [memory](https://code.claude.com/docs/en/memory), [settings](https://code.claude.com/docs/en/settings) and [permissions](https://code.claude.com/docs/en/permissions) docs; nothing was tested in a session. ### A control that keeps `CLAUDE.md` out - Memory docs: an `AGENTS.md` and a `CLAUDE.md` or `CLAUDE.local.md` in the working directory or above means "Your `CLAUDE.md` files only"; `.claude/CLAUDE.md` and `CLAUDE.local.md` "Count, so Claude reads them instead of `AGENTS.md`". The user-level `instructionFiles` setting changes this, but Claude Code "ignores it in project and local settings files", so the repository cannot opt in. - Tools that create one: `apm compile` for target `claude` writes `CLAUDE.md`; rtk's project-level init writes into one (inferred from its marker block; confidence medium); the deployed skill `setup-matt-pocock-skills/SKILL.md:78` edits `CLAUDE.md` if present. - [docs(agents): replace CLAUDE.md with a root AGENTS.md](https://git.rkdr.net/Mortis/Kamino/issues/185) checks "No `CLAUDE.md` anywhere" once. The failure is silent: zero guidance, no error. - Recommendation: a pre-commit hook with `language: fail` and `files: (^|/)(\.claude/)?CLAUDE(\.local)?\.md$`, also run in Lint. No custom script. ### Minimum version and a load check - Memory docs: "Reading `AGENTS.md` directly requires Claude Code v2.1.277 or later"; "Before v2.1.281, some sessions, such as those on Amazon Bedrock or with telemetry disabled, read `CLAUDE.md` files only". The docs name a check: the line "no CLAUDE.md found; AGENTS.md loaded: ...". - Recommendation: `setup.md` states 2.1.281, says not to create `CLAUDE.local.md` (use `~/.claude/CLAUDE.md`), and asks to confirm that line. ### Nested `AGENTS.md` and root pointers - Memory docs: a subdirectory's `AGENTS.md` loads "when Claude opens a file there with the Read tool". A session that explores with `cat` or `rg` through Bash never loads it. - [Codex AGENTS.md guide](https://developers.openai.com/codex/guides/agents-md): Codex walks from the project root "down to your current working directory", once per run, so a session started at the root never sees `roles/AGENTS.md`. [Guiding principles for agents and humans](https://git.rkdr.net/Mortis/Kamino/issues/91) says Codex reads nested files; that is wrong for this case. Cursor and Copilot were not checked. - Recommendation: one triggered pointer per nested file in the root (about five lines), and point the ADR trigger at `docs/adr/AGENTS.md`. ### `.claude/rules/` - The principles decision: "No `CLAUDE.md`, no `.claude/rules`, no hook injection for guidance". [Agent guard hook and permission allowlist](https://git.rkdr.net/Mortis/Kamino/issues/195) lets apm instructions land in `.claude/rules/` and records the disagreement: "Claude-only delivery cuts against 'Standing alone'". The principles decision has no superseding note. - Rules without `paths:` load at launch beside `AGENTS.md`, skipping the always-loaded test. For other tools apm instructions are compile-only. - No decision says which wins on conflict, or whether shared rules take the map's rule form. - Recommendation: deploy no apm instruction until [Move apm instructions from .claude/rules/ into a managed section of the root AGENTS.md](https://git.rkdr.net/Mortis/Kamino/issues/197) lands, and compile that without the `claude` target. ### "Never `permissions`" - Permissions docs: project `allow` rules wait for workspace trust; "`deny` and `ask` rules aren't affected, since they only restrict." - Option seen: "never `permissions.allow`", and consider an `ask` rule on `Bash(git push *)` instead of the apm guard hook. Both are bypassable by spelling; branch protection is the real control. ### Where `attribution` lives - The settings reference documents `attribution.commit` and `attribution.pr` (fixed text) in any settings file. - Two readings disagree. The skills source documents that apm treats `.claude/settings.json` as its own deployed file, so a hand-added key is permanent drift in `apm audit --ci`. Current [apm docs](https://github.com/microsoft/apm) say hooks are merged into the file and drift compares only apm-owned hook entries. Version-dependent; not tested. - Recommendation: after adding the key, run `apm install` and confirm it survives. If not, keep it in the ignored local file and rely on a commit-msg check. ### A commit-msg check for trailers - Claude Code's default commit attribution is `Co-Authored-By: <name> <[email protected]>`; `sessionUrl` defaults to true. Of the last 50 commits on `main`, 14 carry `Co-Authored-By:`, 12 `Claude-Session:`, 3 `Assisted-by:`. The deployed `git-commits` skill teaches `Co-authored-by:`. - A commit-msg hook already runs (`.pre-commit-config.yaml:13-14`). The findings disagree on weight: one calls a `pygrep` entry there cheap and a real control; the other notes the maintainer chose review only and suggests no action unless reopened. ### `roles/AGENTS.md` in the tarball - `galaxy.yml:44` lists `CLAUDE.md` in `build_ignore`, no `AGENTS.md`; `scripts/check_tarball.py` allows `roles`. A consumer's agent reading an installed role would load contributor rules. - Recommendation: add `roles/AGENTS.md` to `build_ignore` and to `FORBIDDEN` in `check_tarball.py`.
Defame1297 was assigned by Claude 2026-11-17 11:27:09 +00:00
Author
Owner

Resolution (2026-11-17)

Decided with the maintainer. Evidence is in the review comment above; the apm behaviour in decision 8 was tested locally on apm 0.28.0 (below).

  1. Refuse CLAUDE.md by control. A pre-commit hook with language: fail refuses CLAUDE.md, .claude/CLAUDE.md and CLAUDE.local.md at any depth; Lint runs it with the other hooks. Reason: any of them silently switches off all AGENTS.md loading, and tools create them unasked. Held by: control (the hook). The CLAUDE.md entry leaves galaxy.yml build_ignore.
  2. Minimum Claude Code version. docs/contributing/setup.md states Claude Code v2.1.281 or later, says personal notes go in ~/.claude/CLAUDE.md (never CLAUDE.local.md), and asks the contributor to confirm the startup line no CLAUDE.md found; AGENTS.md loaded: .... Reason: older versions read no AGENTS.md, or only CLAUDE.md in some sessions. Held by: aspirational (the repository cannot see a contributor's tool). Supersedes "no Claude Code version stated" in AGENTS.md structure and what happens to CLAUDE.md's content.
  3. One triggered pointer per nested AGENTS.md in the root. About five lines ("changing a role: read roles/AGENTS.md first"); the ADR pointer aims at docs/adr/AGENTS.md. Reason: Claude Code loads a nested file only when its Read tool opens a file in that directory, and Codex started at the root never reads nested files. Held by: review. Guiding principles for agents and humans is corrected: Codex does not read nested files from a session started at the root.
  4. No apm instruction is deployed until Move apm instructions from .claude/rules/ into a managed section of the root AGENTS.md lands; that section is compiled for a non-claude target only (target claude writes CLAUDE.md, refused by decision 1). On conflict this repository's AGENTS.md wins. Shared rules take the map's rule form (rule, reason, how held). Reason: .claude/rules/ reaches Claude only, against Standing alone, and skips the always-loaded test. Held by: review. Partly supersedes Agent guard hook and permission allowlist (apm instructions in .claude/rules/); the map's Notes clause "in .claude/rules/ for now" is struck.
  5. "Never permissions" becomes "never permissions.allow" in the tracked .claude/settings.json. deny and ask only restrict, so they are allowed; none is added now (the apm guard hook and branch protection already hold pushes to main). Held by: review (CODEOWNERS on .claude/).
  6. AI trailers stay review-only. The maintainer re-confirmed the choice of AI-assistance policy and commit trailer with the data in front of them (14 of the last 50 commits carry Co-Authored-By:); no commit-msg check.
  7. No AGENTS.md in the Collection tarball. AGENTS.md and roles/AGENTS.md go into build_ignore; scripts/check_tarball.py refuses AGENTS.md at any depth. Reason: a consumer's agent reading an installed role would load contributor rules. Held by: control (the tarball check).
  8. Tracked settings keys against apm's drift audit. Tested on apm 0.28.0: apm install keeps hand-added keys in .claude/settings.json (ownership lives in .claude/apm-hooks.json), but apm audit --ci compares the whole file with a replayed install and fails ("drift: modified", exit 1) on any hand-added key, attribution and permissions.deny alike; re-installing does not clear it; only --no-drift does, which drops drift detection for every deployed file. Decision: chore(agents): ignore local Claude settings and commit apm-deployed hooks first retests on the newest apm and pins apm-cli there if its audit --ci ignores keys apm does not own; then attribution and disableSkillShellExecution stay tracked as decided. Otherwise both move to per-user settings named in setup.md (aspirational), an upstream apm issue is filed for the full-file comparison, and Lint never uses --no-drift. Accepted gap in that case: skill shell execution and the trailer default rest on a personal setting, and the trailer rule on review alone.

No ADR: each decision is cheap to reverse. No new glossary terms.

Backlog: ci: refuse CLAUDE.md files by hook and keep every AGENTS.md out of the Collection tarball (decisions 1, 7). Scope added to #185 (3, 4), #181 (7), #189 (2, 8), #196 (5, 8), #197 (4).

## Resolution (2026-11-17) Decided with the maintainer. Evidence is in the review comment above; the apm behaviour in decision 8 was tested locally on apm 0.28.0 (below). 1. **Refuse `CLAUDE.md` by control.** A pre-commit hook with `language: fail` refuses `CLAUDE.md`, `.claude/CLAUDE.md` and `CLAUDE.local.md` at any depth; Lint runs it with the other hooks. Reason: any of them silently switches off all `AGENTS.md` loading, and tools create them unasked. Held by: control (the hook). The `CLAUDE.md` entry leaves `galaxy.yml` `build_ignore`. 2. **Minimum Claude Code version.** `docs/contributing/setup.md` states Claude Code v2.1.281 or later, says personal notes go in `~/.claude/CLAUDE.md` (never `CLAUDE.local.md`), and asks the contributor to confirm the startup line `no CLAUDE.md found; AGENTS.md loaded: ...`. Reason: older versions read no `AGENTS.md`, or only `CLAUDE.md` in some sessions. Held by: aspirational (the repository cannot see a contributor's tool). Supersedes "no Claude Code version stated" in [AGENTS.md structure and what happens to CLAUDE.md's content](https://git.rkdr.net/Mortis/Kamino/issues/101). 3. **One triggered pointer per nested `AGENTS.md` in the root.** About five lines ("changing a role: read `roles/AGENTS.md` first"); the ADR pointer aims at `docs/adr/AGENTS.md`. Reason: Claude Code loads a nested file only when its Read tool opens a file in that directory, and Codex started at the root never reads nested files. Held by: review. [Guiding principles for agents and humans](https://git.rkdr.net/Mortis/Kamino/issues/91) is corrected: Codex does not read nested files from a session started at the root. 4. **No apm instruction is deployed** until [Move apm instructions from .claude/rules/ into a managed section of the root AGENTS.md](https://git.rkdr.net/Mortis/Kamino/issues/197) lands; that section is compiled for a non-`claude` target only (target `claude` writes `CLAUDE.md`, refused by decision 1). On conflict this repository's `AGENTS.md` wins. Shared rules take the map's rule form (rule, reason, how held). Reason: `.claude/rules/` reaches Claude only, against *Standing alone*, and skips the always-loaded test. Held by: review. Partly supersedes [Agent guard hook and permission allowlist](https://git.rkdr.net/Mortis/Kamino/issues/195) (apm instructions in `.claude/rules/`); the map's Notes clause "in `.claude/rules/` for now" is struck. 5. **"Never `permissions`" becomes "never `permissions.allow`"** in the tracked `.claude/settings.json`. `deny` and `ask` only restrict, so they are allowed; none is added now (the apm guard hook and branch protection already hold pushes to `main`). Held by: review (CODEOWNERS on `.claude/`). 6. **AI trailers stay review-only.** The maintainer re-confirmed the choice of [AI-assistance policy and commit trailer](https://git.rkdr.net/Mortis/Kamino/issues/94) with the data in front of them (14 of the last 50 commits carry `Co-Authored-By:`); no commit-msg check. 7. **No `AGENTS.md` in the Collection tarball.** `AGENTS.md` and `roles/AGENTS.md` go into `build_ignore`; `scripts/check_tarball.py` refuses `AGENTS.md` at any depth. Reason: a consumer's agent reading an installed role would load contributor rules. Held by: control (the tarball check). 8. **Tracked settings keys against apm's drift audit.** Tested on apm 0.28.0: `apm install` keeps hand-added keys in `.claude/settings.json` (ownership lives in `.claude/apm-hooks.json`), but `apm audit --ci` compares the whole file with a replayed install and fails ("drift: modified", exit 1) on any hand-added key, `attribution` and `permissions.deny` alike; re-installing does not clear it; only `--no-drift` does, which drops drift detection for every deployed file. Decision: [chore(agents): ignore local Claude settings and commit apm-deployed hooks](https://git.rkdr.net/Mortis/Kamino/issues/196) first retests on the newest apm and pins `apm-cli` there if its `audit --ci` ignores keys apm does not own; then `attribution` and `disableSkillShellExecution` stay tracked as decided. Otherwise both move to per-user settings named in `setup.md` (aspirational), an upstream apm issue is filed for the full-file comparison, and Lint never uses `--no-drift`. Accepted gap in that case: skill shell execution and the trailer default rest on a personal setting, and the trailer rule on review alone. No ADR: each decision is cheap to reverse. No new glossary terms. **Backlog:** [ci: refuse CLAUDE.md files by hook and keep every AGENTS.md out of the Collection tarball](https://git.rkdr.net/Mortis/Kamino/issues/244) (decisions 1, 7). Scope added to [#185](https://git.rkdr.net/Mortis/Kamino/issues/185) (3, 4), [#181](https://git.rkdr.net/Mortis/Kamino/issues/181) (7), [#189](https://git.rkdr.net/Mortis/Kamino/issues/189) (2, 8), [#196](https://git.rkdr.net/Mortis/Kamino/issues/196) (5, 8), [#197](https://git.rkdr.net/Mortis/Kamino/issues/197) (4).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#213