A root CLAUDE.md stops Claude Code loading the nested AGENTS.md files, so it goes, with no adapter. The root AGENTS.md holds the seven principles, the five code-style rules, the working rules, the verify commands, the repository structure and one triggered pointer per contributor doc and nested AGENTS.md. AGENTS.md replaces CLAUDE.md in galaxy.yml build_ignore (the tarball check allows no AGENTS.md) and on the Molecule selector's IGNORED list (no scenario reads it). The setup and issue-tracker docs stop naming CLAUDE.md. Closes #185 Assisted-by: Claude Code:claude-opus-5-5
109 lines
7.2 KiB
Markdown
109 lines
7.2 KiB
Markdown
# Agent guidance
|
|
|
|
`mortis.kamino` is an Ansible Collection of hardened roles ([README.md](README.md)). This file is
|
|
always loaded; it holds what applies to nearly every task. Rules tied to one directory live in that
|
|
directory's `AGENTS.md`, and the pointers below say when to read them. Each rule gives how it is
|
|
held: by a control (a named hook or check), by review, or aspirational (checked by nothing).
|
|
|
|
## Principles
|
|
|
|
1. **Accountability**: every change has a human author who understands it and answers for it; an agent is a tool.
|
|
2. **A human decides what is irreversible or shared**: settings, protection, tags, releases, credentials, merges to `main`; a merge is decided case by case or by a standing rule a human reviewed, such as Renovate's automerge policy in `renovate.json`.
|
|
3. **Secrets and supply chain**: no secret in the repository, a prompt or a log; dependencies and images are pinned and change through review.
|
|
4. **Enforced, not trusted**: a rule that matters gets a control; one without is labelled as such.
|
|
5. **Honest reporting**: a pull request says what was verified and what was not.
|
|
6. **Simple enough to review**: see the code-style rules below.
|
|
7. **Openness and licence**: AI assistance is disclosed; contributions are GPL-compatible and REUSE-clean.
|
|
|
|
## Code style
|
|
|
|
1. **Existing tool first**: an Ansible module, a lint rule or a tool's own setting before a script.
|
|
2. **One job per file, readable in one sitting.**
|
|
3. **A comment gives the reason, in a line or two.**
|
|
4. **Write for the next reader, not the record**: no incident history, change narration or session notes in code, comments or agent context.
|
|
5. **Change only what the task needs**: unrelated cleanup is a separate pull request.
|
|
|
|
## Working rules
|
|
|
|
- **Do not install a container runtime to run molecule; molecule runs in CI.**
|
|
*Reason:* the scenarios run on the repository's own runner; a local runtime is setup nobody maintains.
|
|
*Held by:* aspirational, by the maintainer's choice.
|
|
- **Every change a consumer can see needs a changelog fragment in `changelogs/fragments/`.**
|
|
*Reason:* the changelog and the next version are built from the fragments.
|
|
*Held by:* review; the `antsibull-changelog-lint` hook checks a fragment's format, not its presence.
|
|
- **Content for a public place stands alone: no tracked file, issue or pull request text or
|
|
comment, release note or job output refers to another repository of the maintainer's, its
|
|
documents, hosts, network or namespaces, or states host sizing** ([making-a-change.md](docs/contributing/making-a-change.md)).
|
|
*Reason:* this repository is public, and a reader without an account must not learn the private
|
|
environment from it.
|
|
*Held by:* aspirational (no check is cheap for issue text or job logs).
|
|
- **Without write access you are an outsider: file an issue from a template in `.gitea/`; a fork or
|
|
AGit pull request is closed unmerged and its runs are never approved** ([CONTRIBUTING.md](CONTRIBUTING.md),
|
|
[reviewing.md](docs/contributing/reviewing.md)).
|
|
*Reason:* a fork controls its own workflow files, so an approved run executes its code here.
|
|
*Held by:* aspirational.
|
|
- **Agent-written commits and pull requests carry `Assisted-by: <tool>[:<model>]`, never
|
|
`Co-Authored-By:` for an agent, a session link or any other AI trailer**
|
|
([ai-assistance.md](docs/contributing/ai-assistance.md)).
|
|
*Reason:* AI assistance is disclosed (principle 7), and an agent is not an author (principle 1).
|
|
*Held by:* review; the exclusion becomes a control when the commit-msg hook that refuses these
|
|
trailers lands (#272).
|
|
- **On conflict with a shared rule delivered by apm, this repository's `AGENTS.md` wins.**
|
|
*Reason:* this repository's rules are reviewed here, for this repository.
|
|
*Held by:* aspirational.
|
|
|
|
## Verify a change
|
|
|
|
- Commit with git, not through the forge's API, so the hooks give feedback before the push (advice:
|
|
Lint re-runs the commit-stage hooks, the commit-msg check and gitleaks).
|
|
- `pre-commit run --all-files`: the commit-stage hooks on every file.
|
|
- `python3 -m unittest discover -s tests/scripts`: when a script changed.
|
|
- `git push` runs `ansible-test sanity` on HEAD (the pre-push hook).
|
|
- Molecule runs only in CI.
|
|
|
|
## Repository structure
|
|
|
|
```text
|
|
.gitea/ workflows, issue and pull request templates, actionlint config
|
|
changelogs/ antsibull-changelog config and fragments
|
|
docs/ contributor docs, agent docs, ADRs, image docs
|
|
extensions/ image-smoke molecule scenarios for the test images
|
|
images/ Dockerfiles of the CI and molecule images
|
|
LICENSES/ licence texts (REUSE)
|
|
meta/ runtime.yml: the ansible-core floor
|
|
roles/ the Collection's roles, each with its molecule scenarios
|
|
scripts/ CI and developer scripts
|
|
tests/ sanity ignores and the scripts' unit tests
|
|
galaxy.yml Collection metadata and build_ignore
|
|
renovate.json dependency automation
|
|
```
|
|
|
|
- A new role goes in `roles/<role>/` with its molecule scenario.
|
|
- A new script goes in `scripts/` with its test in `tests/scripts/`.
|
|
- A new file outside `roles/<role>/` runs every Molecule scenario until it is added to the IGNORED list of
|
|
`scripts/select_molecule_scenarios.py`; it belongs there only if no scenario reads it.
|
|
|
|
## Before you start
|
|
|
|
- Before your first commit in a clone: [docs/contributing/setup.md](docs/contributing/setup.md).
|
|
- Before filing an issue or opening a pull request: use the headings of the matching template in
|
|
`.gitea/`, never your tool's built-in body; read [docs/contributing/making-a-change.md](docs/contributing/making-a-change.md).
|
|
- Before bringing content in from another repository: [docs/contributing/making-a-change.md](docs/contributing/making-a-change.md).
|
|
- Before committing or opening a pull request as an agent: [docs/contributing/ai-assistance.md](docs/contributing/ai-assistance.md).
|
|
- Before writing code outside `roles/`: [docs/contributing/code-style.md](docs/contributing/code-style.md).
|
|
- Before closing a fork pull request, merging someone else's pull request, or running an unmerged
|
|
branch you did not write: [docs/contributing/reviewing.md](docs/contributing/reviewing.md).
|
|
- Before reading an issue, and before filing, labelling or closing one:
|
|
[docs/agents/issue-tracker.md](docs/agents/issue-tracker.md) and [docs/agents/triage-labels.md](docs/agents/triage-labels.md).
|
|
- Before naming a domain concept or writing an ADR: [GLOSSARY.md](GLOSSARY.md) and [docs/agents/domain.md](docs/agents/domain.md).
|
|
- Before adding a new kind of thing (a plugin, a Collection dependency, a workflow, an image, a
|
|
secret) or changing how CI, releases or access work: read the file names in [docs/adr/](docs/adr/)
|
|
and the Accepted risks in [SECURITY.md](SECURITY.md).
|
|
- Changing a role: read [roles/AGENTS.md](roles/AGENTS.md) first.
|
|
- Changing a script or its test: read [scripts/AGENTS.md](scripts/AGENTS.md) first.
|
|
- Changing a workflow: read [.gitea/workflows/AGENTS.md](.gitea/workflows/AGENTS.md) first.
|
|
- Changing an image or an image-smoke scenario: read [images/AGENTS.md](images/AGENTS.md) first.
|
|
- Before writing an ADR: read [docs/adr/AGENTS.md](docs/adr/AGENTS.md) first.
|
|
- Before changing `renovate.json`: read its rule descriptions, and test with `renovate --platform=local`
|
|
at the version in `.gitea/workflows/renovate.yml`.
|