AGENTS.md structure and what happens to CLAUDE.md's content #101

Closed
opened 2026-11-11 22:02:58 +00:00 by Claude · 5 comments
Owner

Part of #87

Question

What goes in the root AGENTS.md, which directories get a nested AGENTS.md and what does each hold, and what moves to documents read on demand, now that CLAUDE.md is removed?

Also decide the repository-structure guidance: what lives where, and where a new thing goes (a short tree with one line per directory).

And establish the oldest Claude Code version that reads AGENTS.md without a CLAUDE.md, so the contributor setup can state it.

Context

  • Decided in Guiding principles for agents and humans:
    • No CLAUDE.md. Tested on Claude Code 2.1.323: a root CLAUDE.md importing AGENTS.md stops nested AGENTS.md from loading; with no CLAUDE.md, root and nested both load.
    • A line is always loaded only if it applies to nearly every task, an agent would get it wrong without it, and no control already holds it.
    • Root AGENTS.md holds the seven principles and five code-style rules at one line each, the commands to verify a change, and pointers. Pointers carry a trigger ("before changing X, read <file>").
    • Nested AGENTS.md candidates: roles/, scripts/, .gitea/workflows/, images/.
    • No .claude/rules, no hook injection for guidance; a skill never carries a rule.
  • CLAUDE.md is 129 lines today; its Images and Renovate sections are maintainer runbook material more than every-session rules.
  • Tool guidance: keep each file short (under 200 lines for Claude Code; another tool caps the concatenated files at 32 KiB).
  • The agentsmd-author and agentsmd-audit skills exist for the implementation.
  • Repository structure is one of the five areas the guidance set must cover and has no other ticket.
Part of #87 ## Question What goes in the root `AGENTS.md`, which directories get a nested `AGENTS.md` and what does each hold, and what moves to documents read on demand, now that `CLAUDE.md` is removed? Also decide the repository-structure guidance: what lives where, and where a new thing goes (a short tree with one line per directory). And establish the oldest Claude Code version that reads `AGENTS.md` without a `CLAUDE.md`, so the contributor setup can state it. ## Context - Decided in [Guiding principles for agents and humans](https://git.rkdr.net/Mortis/Kamino/issues/91): - No `CLAUDE.md`. Tested on Claude Code 2.1.323: a root `CLAUDE.md` importing `AGENTS.md` stops nested `AGENTS.md` from loading; with no `CLAUDE.md`, root and nested both load. - A line is always loaded only if it applies to nearly every task, an agent would get it wrong without it, and no control already holds it. - Root `AGENTS.md` holds the seven principles and five code-style rules at one line each, the commands to verify a change, and pointers. Pointers carry a trigger ("before changing X, read `<file>`"). - Nested `AGENTS.md` candidates: `roles/`, `scripts/`, `.gitea/workflows/`, `images/`. - No `.claude/rules`, no hook injection for guidance; a skill never carries a rule. - `CLAUDE.md` is 129 lines today; its Images and Renovate sections are maintainer runbook material more than every-session rules. - Tool guidance: keep each file short (under 200 lines for Claude Code; another tool caps the concatenated files at 32 KiB). - The `agentsmd-author` and `agentsmd-audit` skills exist for the implementation. - Repository structure is one of the five areas the guidance set must cover and has no other ticket.
Claude added the
Wayfinder
Grilling
label 2026-11-11 22:02:58 +00:00
Claude added a new dependency 2026-11-11 22:03:14 +00:00
Claude changed title from AGENTS.md structure and what leaves CLAUDE.md to AGENTS.md structure and what happens to CLAUDE.md's content 2026-11-13 22:26:42 +00:00
Author
Owner

Input from Resolve stale and contradictory claims:

  • "No CLAUDE.md" was reaffirmed. A CLAUDE.md that only imports AGENTS.md was considered and rejected on the recorded test (it stops nested AGENTS.md loading). If a newer Claude Code behaves differently, re-test here alongside the oldest-version question.
  • CLAUDE.md:78 (as of 967fb34) says every scenario runs "for every push to main", but the push trigger in molecule.yml has a paths: filter. Whatever replaces that text must say so.
  • CLAUDE.md:11-19 (the Roadmap paragraph added in #162) describes the private environment and its epic. The README Roadmap keeps such references until the migration is done (maintainer's exception); whether any of it belongs in always-loaded agent context is this ticket's call.
Input from [Resolve stale and contradictory claims](https://git.rkdr.net/Mortis/Kamino/issues/95): - "No `CLAUDE.md`" was reaffirmed. A `CLAUDE.md` that only imports `AGENTS.md` was considered and rejected on the recorded test (it stops nested `AGENTS.md` loading). If a newer Claude Code behaves differently, re-test here alongside the oldest-version question. - `CLAUDE.md:78` (as of 967fb34) says every scenario runs "for every push to `main`", but the `push` trigger in `molecule.yml` has a `paths:` filter. Whatever replaces that text must say so. - `CLAUDE.md:11-19` (the Roadmap paragraph added in #162) describes the private environment and its epic. The README Roadmap keeps such references until the migration is done (maintainer's exception); whether any of it belongs in always-loaded agent context is this ticket's call.
Defame1297 was assigned by Claude 2026-11-15 19:03:27 +00:00
Author
Owner

Resolution

1. Nested AGENTS.md: five directories

roles/, scripts/, .gitea/workflows/, images/, docs/adr/. Each one holds that directory's rules in full (rule, one-sentence reason, how it is held). The contributor docs point to them and do not repeat them: the guidance is written once, for humans and agents.

  • A nested file loads only when the agent reads a file in its directory; creating a new file does not load it. So a nested file goes only where an agent reads existing files before it writes.
  • roles/AGENTS.md: the rules from Role standard, plus "the pull request that adds a role removes it from the README Roadmap".
  • scripts/AGENTS.md: script rules; a script change comes with its test in tests/scripts/; a line in tests/sanity/ignore-common.txt is a last resort and carries its reason.
  • .gitea/workflows/AGENTS.md: today's "Workflows" section of CLAUDE.md, describing molecule.yml as it stands when written (including that pushes to main are path-filtered or diff-selected, whichever is true by then).
  • images/AGENTS.md: the image rules (a published version is never moved, bump version: in the PR that changes an image, job_image release equals FROM, the label block, the 100 MB layer cap, the two-PR loop), the "bake in" and "recorded speed" rules from CI image pipeline: keep, simplify or replace; covers extensions/molecule/ (the image-smoke scenarios).
  • docs/adr/AGENTS.md: the ADR rules from Public design contract replacing the ADR 0004 references.
  • No nested file for changelogs/ (fragments are written without reading the directory; the format is held by the changelog-lint hook), docs/agents/ (skill configuration), docs/images/ (moving next to the images), tests/ (covered by scripts/), LICENSES/ and meta/ (held by hooks), .claude/ (gitignored, deployed by apm). .gitea/ beyond workflows/ is open until the templates from Contributor doc set exist.

2. Root AGENTS.md

  • The seven principles and five code-style rules, one line each (from Guiding principles for agents and humans).
  • Two lines from today's "Working here", the only ones that pass the always-loaded test:
    • Never install molecule or a container runtime; Molecule runs in CI.
    • Every change a consumer can see needs a changelog fragment.
  • Dropped, because a control holds them or they are already said: commit with git, not the Gitea API (Lint runs every hook); the first hook run is slow (dev-setup.sh runs pre-commit install --install-hooks); feature branch, never push to main (branch protection); don't change settings, protection or tags (principle 2); Conventional Commits and REUSE (hooks).
  • Verify commands: pre-commit run --all-files; python -m pytest tests/scripts when a script changed; git push runs ansible-test sanity; Molecule runs only in CI.
  • Repository structure: a tree of about 15 lines, one line per top-level directory, plus one "where a new thing goes" line: a new role goes in roles/<role>/ with its molecule scenario; a new script goes in scripts/ with its test; a new file outside roles/ runs every Molecule scenario until it is added to the selector's IGNORED list, and it belongs there only if no scenario reads it. It is not repeated in CONTRIBUTING.md.
  • Pointers, each with a trigger:
    • before your first commit in a clone, set up as the contributor docs say (dev-setup.sh, apm install move there);
    • before filing, labelling or closing an issue: docs/agents/issue-tracker.md and docs/agents/triage-labels.md;
    • before naming a domain concept or writing an ADR: docs/agents/domain.md;
    • before changing renovate.json: read its rule descriptions and test with renovate --platform=local.

3. What leaves agent context

  • "What this is" and the Roadmap paragraph: the README says what the Collection is; agent context carries no private-environment references (the README Roadmap stays the only exception).
  • Renovate section: no separate document. Each rule's reason lives in its renovate.json description (already in the Renovate push-trigger issue); the bot-diff gate is explained in its script header.
  • Dropped as history (code-style rule 4): the automerge "open item", the prHourlyLimit account and the --newline=LF note.

4. Controls

  • New: lychee --offline on *.md, as a hook and in CI, so a pointer to a moved or deleted file fails.
  • New: a CI check that fails a pull request changing roles/, meta/ or galaxy.yml without a changelog fragment, unless a skip-changelog label is set. No standard tool fits, so it is a small script. The root line stays either way.
  • File length (200 lines) stays held by review, as decided for code style.

5. Claude Code version

Not stated anywhere: a contributor's tool is their own business. For the record, the facts found: per the Claude Code memory docs and changelog, 2.1.277 is the first version that reads AGENTS.md without a CLAUDE.md, and nested loading is shown working by 2.1.290; any root CLAUDE.md suppresses all AGENTS.md loading, which is consistent with the 2.1.323 test.

6. No ADR, no glossary terms

Easy to reverse and not surprising given Guiding principles for agents and humans; the AGENTS.md files are the record.

Still waiting on Contributor doc set

The full code-style document, the threat-model rules, the AI-assistance rules, the Renovate, release and fork rules: their home in the contributor docs is that ticket's call. Rules tied to one directory follow the pattern above (full text in that directory's AGENTS.md).

## Resolution ### 1. Nested `AGENTS.md`: five directories `roles/`, `scripts/`, `.gitea/workflows/`, `images/`, `docs/adr/`. Each one holds that directory's rules **in full** (rule, one-sentence reason, how it is held). The contributor docs point to them and do not repeat them: the guidance is written once, for humans and agents. - A nested file loads only when the agent **reads** a file in its directory; creating a new file does not load it. So a nested file goes only where an agent reads existing files before it writes. - `roles/AGENTS.md`: the rules from [Role standard](https://git.rkdr.net/Mortis/Kamino/issues/93), plus "the pull request that adds a role removes it from the README Roadmap". - `scripts/AGENTS.md`: script rules; a script change comes with its test in `tests/scripts/`; a line in `tests/sanity/ignore-common.txt` is a last resort and carries its reason. - `.gitea/workflows/AGENTS.md`: today's "Workflows" section of `CLAUDE.md`, describing `molecule.yml` as it stands when written (including that pushes to `main` are path-filtered or diff-selected, whichever is true by then). - `images/AGENTS.md`: the image rules (a published version is never moved, bump `version:` in the PR that changes an image, `job_image` release equals `FROM`, the label block, the 100 MB layer cap, the two-PR loop), the "bake in" and "recorded speed" rules from [CI image pipeline: keep, simplify or replace](https://git.rkdr.net/Mortis/Kamino/issues/96); covers `extensions/molecule/` (the image-smoke scenarios). - `docs/adr/AGENTS.md`: the ADR rules from [Public design contract replacing the ADR 0004 references](https://git.rkdr.net/Mortis/Kamino/issues/92). - **No nested file** for `changelogs/` (fragments are written without reading the directory; the format is held by the changelog-lint hook), `docs/agents/` (skill configuration), `docs/images/` (moving next to the images), `tests/` (covered by `scripts/`), `LICENSES/` and `meta/` (held by hooks), `.claude/` (gitignored, deployed by apm). `.gitea/` beyond `workflows/` is open until the templates from [Contributor doc set](https://git.rkdr.net/Mortis/Kamino/issues/103) exist. ### 2. Root `AGENTS.md` - The seven principles and five code-style rules, one line each (from [Guiding principles for agents and humans](https://git.rkdr.net/Mortis/Kamino/issues/91)). - Two lines from today's "Working here", the only ones that pass the always-loaded test: - Never install molecule or a container runtime; Molecule runs in CI. - Every change a consumer can see needs a changelog fragment. - **Dropped**, because a control holds them or they are already said: commit with git, not the Gitea API (Lint runs every hook); the first hook run is slow (`dev-setup.sh` runs `pre-commit install --install-hooks`); feature branch, never push to `main` (branch protection); don't change settings, protection or tags (principle 2); Conventional Commits and REUSE (hooks). - **Verify commands**: `pre-commit run --all-files`; `python -m pytest tests/scripts` when a script changed; `git push` runs `ansible-test sanity`; Molecule runs only in CI. - **Repository structure**: a tree of about 15 lines, one line per top-level directory, plus one "where a new thing goes" line: a new role goes in `roles/<role>/` with its molecule scenario; a new script goes in `scripts/` with its test; a new file outside `roles/` runs every Molecule scenario until it is added to the selector's IGNORED list, and it belongs there only if no scenario reads it. It is not repeated in `CONTRIBUTING.md`. - **Pointers, each with a trigger**: - before your first commit in a clone, set up as the contributor docs say (`dev-setup.sh`, `apm install` move there); - before filing, labelling or closing an issue: `docs/agents/issue-tracker.md` and `docs/agents/triage-labels.md`; - before naming a domain concept or writing an ADR: `docs/agents/domain.md`; - before changing `renovate.json`: read its rule descriptions and test with `renovate --platform=local`. ### 3. What leaves agent context - "What this is" and the Roadmap paragraph: the README says what the Collection is; agent context carries no private-environment references (the README Roadmap stays the only exception). - Renovate section: no separate document. Each rule's reason lives in its `renovate.json` description (already in [the Renovate push-trigger issue](https://git.rkdr.net/Mortis/Kamino/issues/172)); the bot-diff gate is explained in its script header. - Dropped as history (code-style rule 4): the automerge "open item", the `prHourlyLimit` account and the `--newline=LF` note. ### 4. Controls - **New**: lychee `--offline` on `*.md`, as a hook and in CI, so a pointer to a moved or deleted file fails. - **New**: a CI check that fails a pull request changing `roles/`, `meta/` or `galaxy.yml` without a changelog fragment, unless a `skip-changelog` label is set. No standard tool fits, so it is a small script. The root line stays either way. - File length (200 lines) stays held by review, as decided for code style. ### 5. Claude Code version Not stated anywhere: a contributor's tool is their own business. For the record, the facts found: per the [Claude Code memory docs](https://code.claude.com/docs/en/memory) and changelog, 2.1.277 is the first version that reads `AGENTS.md` without a `CLAUDE.md`, and nested loading is shown working by 2.1.290; any root `CLAUDE.md` suppresses all `AGENTS.md` loading, which is consistent with the 2.1.323 test. ### 6. No ADR, no glossary terms Easy to reverse and not surprising given [Guiding principles for agents and humans](https://git.rkdr.net/Mortis/Kamino/issues/91); the `AGENTS.md` files are the record. ## Still waiting on Contributor doc set The full code-style document, the threat-model rules, the AI-assistance rules, the Renovate, release and fork rules: their home in the contributor docs is that ticket's call. Rules tied to one directory follow the pattern above (full text in that directory's `AGENTS.md`).
Author
Owner

Amendment to section 4, agreed with the maintainer after closing: the fragment-presence check has no skip-changelog label. A change consumers cannot see adds a trivial: fragment instead, the mechanism CONTRIBUTING.md already uses; the check then needs no API call and works the same on fork runs. Updated in the fragment check issue.

Amendment to section 4, agreed with the maintainer after closing: the fragment-presence check has no `skip-changelog` label. A change consumers cannot see adds a `trivial:` fragment instead, the mechanism `CONTRIBUTING.md` already uses; the check then needs no API call and works the same on fork runs. Updated in [the fragment check issue](https://git.rkdr.net/Mortis/Kamino/issues/183).
Author
Owner

Review of the map (2026-11-15): corrections to this issue.

Review of the map (2026-11-15): corrections to this issue. - **Section 1, `.claude/`, is superseded by [Shared agent primitives through apm](https://git.rkdr.net/Mortis/Kamino/issues/104).** Section 1 lists `.claude/` as "gitignored, deployed by apm". The later decision commits the deployed `.claude/skills/` and `.claude/agents/`. - **Section 2's verify command is superseded by [Enforcement map for each prose-only rule](https://git.rkdr.net/Mortis/Kamino/issues/102).** Section 2 says `python -m pytest tests/scripts`. `pytest` is not installed (`requirements-dev.txt`), and the later decision runs `python -m unittest discover -s tests/scripts`, as Lint does today (`.gitea/workflows/lint.yml:124`). - **Section 1's image rule conflicts with the earlier [CI image pipeline: keep, simplify or replace](https://git.rkdr.net/Mortis/Kamino/issues/96).** Section 1 puts "bump `version:` in the PR that changes an image" and the two-PR loop into `images/AGENTS.md`. Section 3 of that earlier resolution removes the manual bump: CI assigns image versions. The earlier decision stands; the rule lasts only until [ci(images): assign image versions in CI and open the pin PR right after a push](https://git.rkdr.net/Mortis/Kamino/issues/165) lands. - The Claude Code version (section 5), triggered pointers to nested files, and `.claude/rules/` are open again in [Making sure an agent actually loads the guidance](https://git.rkdr.net/Mortis/Kamino/issues/213).
Author
Owner

Partly superseded by Making sure an agent actually loads the guidance: the contributor docs now state Claude Code v2.1.281 or later (aspirational), and "no CLAUDE.md" is held by a pre-commit fail hook instead of a one-time check.

Partly superseded by [Making sure an agent actually loads the guidance](https://git.rkdr.net/Mortis/Kamino/issues/213): the contributor docs now state Claude Code v2.1.281 or later (aspirational), and "no `CLAUDE.md`" is held by a pre-commit `fail` hook instead of a one-time check.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#101