docs(agents): write roles/AGENTS.md with the role rules #181

Closed
opened 2026-11-15 19:24:01 +00:00 by Claude · 8 comments
Owner

Spec: AGENTS.md structure and what happens to CLAUDE.md's content (resolution, section 1) and Role standard (resolution comment, for the rules themselves). Rules added by What a role's platform declaration means, and supported entry points, Role standard gaps found in review, Making sure an agent actually loads the guidance, Role interface and semver: output facts, handler names, dropped platforms and internal roles and Where the last unplaced rules live: architecture, the two positions and the trailer rule.

What to build

roles/AGENTS.md holding the role rules in full: each rule, a one-sentence reason, and how it is held (control naming the hook or check, review, or aspirational). The contributor docs will point here and not repeat them.

Every rule decided in Role standard and its later scope comments, as in force:

  • Layout and README headings. The fixed README heading set binds public roles only. An internal role's README opens with the internal-role statement and otherwise keeps its own headings.
  • argument_specs repeat defaults, with the drift check. The role applies suboption defaults itself (rule 5).
  • Internal variables (rule 1): __<role>_ for vars/ constants, register and set_fact. Held by ansible-lint for the prefix, review for the __. Output facts documented under "Variables set by the role" keep <role>_; everything else a role sets is __<role>_ (review).
  • Validation (rule 2): a rule between role variables is an assert in tasks/validate.yml; cross-input spec keys (required_if, mutually_exclusive and the like) are used only inside a dict input's suboptions. Validation runs before any host change, loaded with import_tasks and tags: always, with only fact-computing tasks before it. This replaces "validate first" as worded. Held by ansible-lint for the misuse, review for the rest.
  • noqa (rule 3): prefer fixing over noqa; a noqa names one rule and has a reason. This replaces "noqa only in test fixtures".
  • verify (rule 4) asserts the effect on the host.
  • Input changes (rule 6): renaming or removing an input is breaking_changes and a major, with no alias.
  • Secrets (rule 7): never in plaintext in the repository, defaults, output or controller files; no_log on every task carrying one; a required input with no default; generate only into a consumer-named store.
  • Platforms. A platform in meta/main.yml means the role passes Molecule on it in CI. A platform that is used but not tested goes only in a README "Untested platforms" line. Held by review. A role declares the releases of the hosts it targets: Ubuntu-targeting roles declare exactly noble and resolute, Proxmox-targeting roles declare Debian trixie. Each profile is tested on its own OS. Held by review. Aspirational: all three releases; fewer needs a one-line README reason. Removing or narrowing a declared platform is breaking_changes, tested or not (control: the fragment-presence check, #183; "held by review until it lands").
  • Supported entry points. A supported entry point has an argument_specs key, a README "Entry points" entry and a Molecule test. Every other tasks/*.yml is internal. Held by the spec-defaults drift check (#135, extended in #227).
  • Role interface. Inputs, supported entry points, documented output facts and documented tags are the interface. Renaming or removing any of them is breaking_changes; adding one is minor_changes.
  • Handlers are internal. A caller never notifies a role's handler, and a README names one only to explain behaviour (review).
  • Internal roles. A leading _; called only by roles of this Collection, by FQCN; refuses to run without a parent role (control); argument_specs, a README opening with the internal-role statement, Molecule scenarios and the platform rule; outside semver (a change confined to it takes a trivial fragment, the caller writes the fragment for any visible effect); no __ split (it keeps its own _<role>_ variable names); one role-name line per internal role in .ansible-lint-ignore (review).
  • Role-to-role dependencies (rule 11): only by FQCN include_role or import_role, listed in the README, with meta dependencies empty. A role calls a public role only on a supported entry point of a role in this Collection, and an internal role on any entry point in its argument_specs.
  • Check mode. Molecule runs check before and after converge. The allowed guards are check_mode: false on read-only probes and when: not ansible_check_mode; --check is the supported preview.
  • Negative tests match the error message.
  • complexity.
  • "The pull request that adds a role removes it from the README Roadmap section" (moved from CLAUDE.md; held by review). No private-environment references.
  • Where a Role standard control has not landed yet (its backlog issues), say "held by review until lands", not that the control exists.

Not stated here: the rule that the Collection holds roles only (rule 9, held by a plugins/ hook, see #258) and the rule on a new Collection dependency (rule 10, in docs/contributing/making-a-change.md).

roles/AGENTS.md must not ship in the Collection tarball. #244 adds it to build_ignore and makes check_tarball.py refuse AGENTS.md at any depth; if this issue lands first, add the build_ignore entry here.

Under 200 lines; aim for under 80.

Acceptance

  • Every rule has its reason and its held-by.
  • A fresh Claude Code session that reads a file under roles/ (with no CLAUDE.md in the tree, e.g. a throwaway clone) sees the file's content.
  • The PR says what was verified and what was not.

Not in scope

Removing CLAUDE.md and writing the root AGENTS.md: separate issue, which lands after this one.

Spec: [AGENTS.md structure and what happens to CLAUDE.md's content](https://git.rkdr.net/Mortis/Kamino/issues/101) (resolution, section 1) and [Role standard](https://git.rkdr.net/Mortis/Kamino/issues/93) (resolution comment, for the rules themselves). Rules added by [What a role's platform declaration means, and supported entry points](https://git.rkdr.net/Mortis/Kamino/issues/207), [Role standard gaps found in review](https://git.rkdr.net/Mortis/Kamino/issues/214), [Making sure an agent actually loads the guidance](https://git.rkdr.net/Mortis/Kamino/issues/213), [Role interface and semver: output facts, handler names, dropped platforms and internal roles](https://git.rkdr.net/Mortis/Kamino/issues/257) and [Where the last unplaced rules live: architecture, the two positions and the trailer rule](https://git.rkdr.net/Mortis/Kamino/issues/258). ## What to build `roles/AGENTS.md` holding the role rules **in full**: each rule, a one-sentence reason, and how it is held (control naming the hook or check, review, or aspirational). The contributor docs will point here and not repeat them. Every rule decided in Role standard and its later scope comments, as in force: - **Layout and README headings.** The fixed README heading set binds public roles only. An internal role's README opens with the internal-role statement and otherwise keeps its own headings. - **argument_specs** repeat defaults, with the drift check. The role applies suboption defaults itself (rule 5). - **Internal variables** (rule 1): `__<role>_` for `vars/` constants, `register` and `set_fact`. Held by ansible-lint for the prefix, review for the `__`. Output facts documented under "Variables set by the role" keep `<role>_`; everything else a role sets is `__<role>_` (review). - **Validation** (rule 2): a rule between role variables is an assert in `tasks/validate.yml`; cross-input spec keys (`required_if`, `mutually_exclusive` and the like) are used only inside a dict input's suboptions. Validation runs before any host change, loaded with `import_tasks` and `tags: always`, with only fact-computing tasks before it. This replaces "validate first" as worded. Held by ansible-lint for the misuse, review for the rest. - **`noqa`** (rule 3): prefer fixing over `noqa`; a `noqa` names one rule and has a reason. This replaces "`noqa` only in test fixtures". - **verify** (rule 4) asserts the effect on the host. - **Input changes** (rule 6): renaming or removing an input is `breaking_changes` and a major, with no alias. - **Secrets** (rule 7): never in plaintext in the repository, defaults, output or controller files; `no_log` on every task carrying one; a required input with no default; generate only into a consumer-named store. - **Platforms.** A platform in `meta/main.yml` means the role passes Molecule on it in CI. A platform that is used but not tested goes only in a README "Untested platforms" line. Held by review. A role declares the releases of the hosts it targets: Ubuntu-targeting roles declare exactly `noble` and `resolute`, Proxmox-targeting roles declare Debian `trixie`. Each profile is tested on its own OS. Held by review. Aspirational: all three releases; fewer needs a one-line README reason. Removing or narrowing a declared platform is `breaking_changes`, tested or not (control: the fragment-presence check, #183; "held by review until it lands"). - **Supported entry points.** A supported entry point has an argument_specs key, a README "Entry points" entry and a Molecule test. Every other `tasks/*.yml` is internal. Held by the spec-defaults drift check (#135, extended in #227). - **Role interface.** Inputs, supported entry points, documented output facts and documented tags are the interface. Renaming or removing any of them is `breaking_changes`; adding one is `minor_changes`. - **Handlers are internal.** A caller never notifies a role's handler, and a README names one only to explain behaviour (review). - **Internal roles.** A leading `_`; called only by roles of this Collection, by FQCN; refuses to run without a parent role (control); argument_specs, a README opening with the internal-role statement, Molecule scenarios and the platform rule; outside semver (a change confined to it takes a `trivial` fragment, the caller writes the fragment for any visible effect); no `__` split (it keeps its own `_<role>_` variable names); one `role-name` line per internal role in `.ansible-lint-ignore` (review). - **Role-to-role dependencies** (rule 11): only by FQCN `include_role` or `import_role`, listed in the README, with `meta` `dependencies` empty. A role calls a public role only on a supported entry point of a role in this Collection, and an internal role on any entry point in its argument_specs. - **Check mode.** Molecule runs `check` before and after converge. The allowed guards are `check_mode: false` on read-only probes and `when: not ansible_check_mode`; `--check` is the supported preview. - **Negative tests** match the error message. - **`complexity`.** - "The pull request that adds a role removes it from the README Roadmap section" (moved from `CLAUDE.md`; held by review). No private-environment references. - Where a Role standard control has not landed yet (its backlog issues), say "held by review until <check> lands", not that the control exists. Not stated here: the rule that the Collection holds roles only (rule 9, held by a `plugins/` hook, see #258) and the rule on a new Collection dependency (rule 10, in `docs/contributing/making-a-change.md`). `roles/AGENTS.md` must not ship in the Collection tarball. [#244](https://git.rkdr.net/Mortis/Kamino/issues/244) adds it to `build_ignore` and makes `check_tarball.py` refuse `AGENTS.md` at any depth; if this issue lands first, add the `build_ignore` entry here. Under 200 lines; aim for under 80. ## Acceptance - [ ] Every rule has its reason and its held-by. - [ ] A fresh Claude Code session that reads a file under `roles/` (with no `CLAUDE.md` in the tree, e.g. a throwaway clone) sees the file's content. - [ ] The PR says what was verified and what was not. ## Not in scope Removing `CLAUDE.md` and writing the root `AGENTS.md`: separate issue, which lands after this one.
Claude added the
Status
Ready for Agent
label 2026-11-15 19:24:01 +00:00
Claude added a new dependency 2026-11-15 19:24:26 +00:00
Claude added a new dependency 2026-11-15 22:20:38 +00:00
Claude added a new dependency 2026-11-15 22:20:38 +00:00
Claude added this to the Open to contributors milestone 2026-11-15 22:21:19 +00:00
Author
Owner

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

Waiting on another decision: how nested AGENTS.md files are reached from the root, and whether roles/AGENTS.md may ship in the Collection tarball, wait on Making sure an agent actually loads the guidance. The rules on validation order, noqa, verify and suboption defaults wait on Role standard gaps found in review.

Review of the map (2026-11-15): corrections to this issue. - **The named skill will not exist.** "Use the `agentsmd-author` skill." `apm.lock.yaml` deploys it from the `core` plugin, which [chore: commit the deployed agent skills, trim the apm plugins and pin apm-cli](https://git.rkdr.net/Mortis/Kamino/issues/193) removes, and `.claude/skills/` is gitignored today (`.gitignore:19`), so a contributor's clone does not have it. Change: "if available", or drop the line. Waiting on another decision: how nested `AGENTS.md` files are reached from the root, and whether `roles/AGENTS.md` may ship in the Collection tarball, wait on [Making sure an agent actually loads the guidance](https://git.rkdr.net/Mortis/Kamino/issues/213). The rules on validation order, `noqa`, verify and suboption defaults wait on [Role standard gaps found in review](https://git.rkdr.net/Mortis/Kamino/issues/214).
Author
Owner

Scope added from What a role's platform declaration means, and supported entry points (resolution comment). Add these rules to roles/AGENTS.md, each in the map's rule form:

  • A platform in meta/main.yml means the role passes Molecule on it in CI. A platform that is used but not tested goes only in a README "Untested platforms" line. Held by review.
  • A role declares the releases of the hosts it targets: Ubuntu targets declare exactly noble and resolute, Proxmox targets declare Debian trixie. Each profile is tested on its own OS. Held by review. Aspirational: all three releases; fewer needs a one-line README reason.
  • A supported entry point has an argument_specs key, a README "Entry points" entry and a Molecule test. Every other tasks/*.yml is internal. Held by the spec-defaults drift check (#135, extended in #227).

This replaces "every role passes on noble and resolute" from the Role standard.

Scope added from [What a role's platform declaration means, and supported entry points](https://git.rkdr.net/Mortis/Kamino/issues/207) (resolution comment). Add these rules to `roles/AGENTS.md`, each in the map's rule form: - A platform in `meta/main.yml` means the role passes Molecule on it in CI. A platform that is used but not tested goes only in a README "Untested platforms" line. Held by review. - A role declares the releases of the hosts it targets: Ubuntu targets declare exactly `noble` and `resolute`, Proxmox targets declare Debian `trixie`. Each profile is tested on its own OS. Held by review. Aspirational: all three releases; fewer needs a one-line README reason. - A supported entry point has an argument_specs key, a README "Entry points" entry and a Molecule test. Every other `tasks/*.yml` is internal. Held by the spec-defaults drift check (#135, extended in #227). This replaces "every role passes on noble and resolute" from the Role standard.
Author
Owner

Note from Making sure an agent actually loads the guidance (decision 7): roles/AGENTS.md must not ship in the Collection tarball. #244 adds it to build_ignore and makes check_tarball.py refuse AGENTS.md at any depth; if this issue lands first, add the build_ignore entry here.

Note from [Making sure an agent actually loads the guidance](https://git.rkdr.net/Mortis/Kamino/issues/213) (decision 7): `roles/AGENTS.md` must not ship in the Collection tarball. [#244](https://git.rkdr.net/Mortis/Kamino/issues/244) adds it to `build_ignore` and makes `check_tarball.py` refuse `AGENTS.md` at any depth; if this issue lands first, add the `build_ignore` entry here.
Author
Owner

Scope added by Role standard gaps found in review: roles/AGENTS.md states these rules from its resolution comment, each with its reason and how it is held:

  • rule 1: __<role>_ for internal variables (lint for the prefix, review for __);
  • rule 2: validation before any host change, import_tasks with tags: always, only fact-computing tasks before it (replaces "validate first" as worded);
  • rule 3: prefer fixing over noqa; a noqa names one rule and has a reason (replaces "noqa only in test fixtures");
  • rule 4: verify asserts the effect on the host;
  • rule 5: the role applies suboption defaults itself;
  • rule 6: renaming or removing an input is breaking_changes and a major, no alias;
  • rule 7: the secrets rule (never in plaintext in repo, defaults, output or controller files; no_log on every task carrying one; required input with no default; generate only into a consumer-named store);
  • rules 9–11: roles only (a plugin needs an ADR); a new Collection dependency needs a reason and a floor; role-to-role dependencies only by FQCN include_role/import_role on a supported entry point of a role in this Collection, listed in the README, meta dependencies empty.
Scope added by [Role standard gaps found in review](https://git.rkdr.net/Mortis/Kamino/issues/214): `roles/AGENTS.md` states these rules from its resolution comment, each with its reason and how it is held: - rule 1: `__<role>_` for internal variables (lint for the prefix, review for `__`); - rule 2: validation before any host change, `import_tasks` with `tags: always`, only fact-computing tasks before it (replaces "validate first" as worded); - rule 3: prefer fixing over `noqa`; a `noqa` names one rule and has a reason (replaces "`noqa` only in test fixtures"); - rule 4: verify asserts the effect on the host; - rule 5: the role applies suboption defaults itself; - rule 6: renaming or removing an input is `breaking_changes` and a major, no alias; - rule 7: the secrets rule (never in plaintext in repo, defaults, output or controller files; `no_log` on every task carrying one; required input with no default; generate only into a consumer-named store); - rules 9–11: roles only (a plugin needs an ADR); a new Collection dependency needs a reason and a floor; role-to-role dependencies only by FQCN `include_role`/`import_role` on a supported entry point of a role in this Collection, listed in the README, `meta` `dependencies` empty.
Author
Owner

Review of the map (2026-11-17).

  • Validation rule. Use the corrected wording from the note on Role standard: cross-input keys only inside a dict input's suboptions; rules between role variables are asserts in tasks/validate.yml. Held: ansible-lint for the misuse, review for the rest.
  • Rule 9 ("the Collection holds roles only; a plugin needs an ADR first") is stated in the root AGENTS.md, in its "where a new thing goes" line, because an agent adding a plugin reads nothing under roles/. This file keeps rules 10 and 11 and does not restate rule 9.
  • Internal variables. Whether a documented output fact keeps <role>_ is open in Role interface and semver: output facts, handler names, dropped platforms and internal roles. Write the __<role>_ rule for vars/ and register: now and leave the set_fact clause until that ticket closes.
Review of the map (2026-11-17). - **Validation rule.** Use the corrected wording from the note on [Role standard](https://git.rkdr.net/Mortis/Kamino/issues/93): cross-input keys only inside a dict input's suboptions; rules between role variables are asserts in `tasks/validate.yml`. Held: ansible-lint for the misuse, review for the rest. - **Rule 9** ("the Collection holds roles only; a plugin needs an ADR first") is stated in the root `AGENTS.md`, in its "where a new thing goes" line, because an agent adding a plugin reads nothing under `roles/`. This file keeps rules 10 and 11 and does not restate rule 9. - **Internal variables.** Whether a documented output fact keeps `<role>_` is open in [Role interface and semver: output facts, handler names, dropped platforms and internal roles](https://git.rkdr.net/Mortis/Kamino/issues/257). Write the `__<role>_` rule for `vars/` and `register:` now and leave the `set_fact` clause until that ticket closes.
Author
Owner

Scope added by Role interface and semver: output facts, handler names, dropped platforms and internal roles (2026-11-20)

Rules to add, each with its reason and held-by (detail in that ticket's resolution comment):

  • Role interface: inputs, supported entry points, documented output facts and documented tags. Renaming or removing any of them is breaking_changes; adding one is minor_changes.
  • Output facts documented under "Variables set by the role" keep <role>_; everything else a role sets is __<role>_ (review).
  • Handlers are internal: a caller never notifies a role's handler, and a README names one only to explain behaviour (review).
  • Platforms: removing or narrowing a declared platform is breaking_changes, tested or not (control: the fragment-presence check, #183; "held by review until it lands").
  • Internal roles: a leading _; called only by roles of this Collection, by FQCN; refuses to run without a parent role (control); argument_specs, a README opening with the internal-role statement, Molecule scenarios and the platform rule; outside semver (a change confined to it takes a trivial fragment, the caller writes the fragment for any visible effect); no __ split; one role-name line per internal role in .ansible-lint-ignore (review).
  • Rule 11 extended: a role calls a public role only on a supported entry point, an internal role on any entry point in its argument_specs.
  • Check mode: the allowed guards are check_mode: false on read-only probes and when: not ansible_check_mode; --check is the supported preview.
## Scope added by [Role interface and semver: output facts, handler names, dropped platforms and internal roles](https://git.rkdr.net/Mortis/Kamino/issues/257) (2026-11-20) Rules to add, each with its reason and held-by (detail in that ticket's resolution comment): - **Role interface**: inputs, supported entry points, documented output facts and documented tags. Renaming or removing any of them is `breaking_changes`; adding one is `minor_changes`. - **Output facts** documented under "Variables set by the role" keep `<role>_`; everything else a role sets is `__<role>_` (review). - **Handlers are internal**: a caller never notifies a role's handler, and a README names one only to explain behaviour (review). - **Platforms**: removing or narrowing a declared platform is `breaking_changes`, tested or not (control: the fragment-presence check, #183; "held by review until it lands"). - **Internal roles**: a leading `_`; called only by roles of this Collection, by FQCN; refuses to run without a parent role (control); argument_specs, a README opening with the internal-role statement, Molecule scenarios and the platform rule; outside semver (a change confined to it takes a `trivial` fragment, the caller writes the fragment for any visible effect); no `__` split; one `role-name` line per internal role in `.ansible-lint-ignore` (review). - **Rule 11 extended**: a role calls a public role only on a supported entry point, an internal role on any entry point in its argument_specs. - **Check mode**: the allowed guards are `check_mode: false` on read-only probes and `when: not ansible_check_mode`; `--check` is the supported preview.
Author
Owner

Correction from Where the last unplaced rules live: architecture, the two positions and the trailer rule (2026-11-20)

  • Rule 10 (a new Collection dependency needs a reason and a version floor) moves to docs/contributing/making-a-change.md: an agent editing galaxy.yml reads nothing under roles/. Do not state it here.
  • Rule 9 is held by a plugins/ hook (new issue, linked from #258), not by a root line. Still not restated here.
  • Rule 11 stays here as already scoped (with the extension from #257).
## Correction from [Where the last unplaced rules live: architecture, the two positions and the trailer rule](https://git.rkdr.net/Mortis/Kamino/issues/258) (2026-11-20) - **Rule 10** (a new Collection dependency needs a reason and a version floor) moves to `docs/contributing/making-a-change.md`: an agent editing `galaxy.yml` reads nothing under `roles/`. Do not state it here. - **Rule 9** is held by a `plugins/` hook (new issue, linked from #258), not by a root line. Still not restated here. - **Rule 11** stays here as already scoped (with the extension from #257).
Author
Owner

Final validation round, second pass (2026-11-20): body edited.

  • Removed the line telling the implementer to use the agentsmd-author skill (it will not exist).
  • Replaced "noble and resolute" with the platform rule in force (declared means passes Molecule in CI; Ubuntu targets declare noble and resolute, Proxmox targets trixie).
  • Rule list is now the list in force: rules 1 to 7 and 11 with their corrected wording, the platform, entry point, interface, handler, internal-role and check-mode rules, the build_ignore note.
  • Added the decision that the fixed README heading set binds public roles only.
  • Rules 9 and 10 stay out, with one line saying where they live.

The comments above stay as history.

Final validation round, second pass (2026-11-20): body edited. - Removed the line telling the implementer to use the `agentsmd-author` skill (it will not exist). - Replaced "noble and resolute" with the platform rule in force (declared means passes Molecule in CI; Ubuntu targets declare `noble` and `resolute`, Proxmox targets `trixie`). - Rule list is now the list in force: rules 1 to 7 and 11 with their corrected wording, the platform, entry point, interface, handler, internal-role and check-mode rules, the `build_ignore` note. - Added the decision that the fixed README heading set binds public roles only. - Rules 9 and 10 stay out, with one line saying where they live. The comments above stay as history.
Defame1297 was assigned by Claude 2026-11-21 21:12:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#181