Why A six-agent review of the two preceding commits found their code sound -- the differential claim holds, the published hook contract is byte-unchanged -- but their prose drifted from it in three ways: statements of fact the code contradicts, markers in a convention this repo does not use, and figures that went stale when the merge changed what they counted. Implementation Notes ADR-0025's edge-path table is rewritten around one stated doctrine: exit 0 is audited and clean, exit 1 is audited with findings or a target present but unreadable, exit 2 is that nothing was audited. Its old row 1 promised "one generic matches-neither message" for three different inputs; there are three distinct messages, and the missing-path case exited 1 until the preceding commit fixed it. Rows are added for the preflight and CDPATH changes, because a table claiming to enumerate every entry-point behaviour change reproduces its own "an earlier revision of this ADR said they were behaviour-neutral" failure if it omits any. ADR-0025 also gains a Consequences supersession record in ADR-0016's form: partially-superseded entries for 0008, 0014, 0020 and 0021, and explicit "is not superseded" entries with reasoning for the rest. Twelve ADRs are amended and it previously listed none. ADR-0008 moves from an amendment note to partially superseded. Its contract genuinely narrowed -- an agent .md outside an agents/ directory was audited before the merge and is refused now -- and ADR-0020 already recorded that the merge "reopens ADR-0008". Its detector description said "a path under .apm/agents/", the phrasing ADR-0025 rejects as wider than the script and circular; the shipped rule is a .md whose immediate parent is named agents/, at any scope. ADR-0020's amendment claimed the boundary resolver is sourced by validate-provenance.sh. It is not, and never was; only validate.sh sources it, once per mode branch. Three Home-column entries pointed at reference filenames the merge renamed, one of which now resolves to two files because its row covers skills and agents. Five ADRs opened with "Skill renamed per ADR-0025", a form this repo does not use, in the same commit that used the conventional "Amended by ADR-0025" twice. They are normalized. "Renamed" was also wrong: the BREAKING-CHANGE trailer says the skills were removed and their flows merged. SIMPLIFICATION-AUDIT.md had 2026-09-15 notes attached to headlines that were never updated, against its own convention of correcting in place with strikethrough. Every figure here was re-derived at HEAD by command, and several differed from the review's own numbers, so the notes record the basis rather than the result alone. LESSONS.md asserted the two review-time suite failures were the SIGPIPE race. The commit that fixed that race explicitly declined to claim it -- the suite was running while agents edited live config files -- so the hedge is restored. Impact No code, test or configuration change; documentation only. Suites stay 20/20 strict with 0 skipped and 374/374 bats. No gate parses ADR or gates.md content, so nothing here is load-bearing for a hook. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YR2CjVumUbEGWcMikcoXBD
36 lines
3.2 KiB
Markdown
36 lines
3.2 KiB
Markdown
# agent-audit takes a single file path and derives the counterpart by scope detection
|
|
|
|
**Partially superseded by ADR-0025 (2026-09-15).** `agent-audit` merged with `skill-audit` into
|
|
`factory-audit`. Read `agent-audit` below as `factory-audit`'s agent flow. The single-file
|
|
invocation contract this ADR sets survives — `factory-audit` dispatches at Step 0 on the target
|
|
path, so the caller still names one file and the script still derives the rest — but the set of
|
|
paths that contract accepts is **narrower**. The agent flow is taken by an `*.agent.md` file, or by
|
|
a `.md` file whose *immediate* parent directory is named `agents/`, at any scope:
|
|
`.claude/agents/x.md` is accepted, `.apm/agents/sub/x.md` is refused. "A path under `.apm/agents/`"
|
|
is not the rule — ADR-0025 rejects that phrasing as both wider than the script and circular. An
|
|
agent `.md` outside an `agents/` directory was audited before the merge and now stops at exit 2,
|
|
the never-ran tier, because a single auto-detecting entry point classifies on the path alone and
|
|
detection never guesses.
|
|
ADR-0020 recorded the merge as reopening this ADR; that is the clause it reopened.
|
|
|
|
`agent-audit` validates agent definition file pairs (Claude Code `.md` + Copilot `.agent.md`). The skill accepts a path to either file and derives the counterpart using scope detection rather than requiring the caller to name both files or supply a root directory.
|
|
|
|
## Considered options
|
|
|
|
**Directory input (rejected)** — analogous to `skill-audit <skill-dir>`. Rejected because agents have no per-agent directory. At plugin scope both files are flat in `agents/`; at project scope they are in completely different directories (`.claude/agents/` and `.github/agents/`). No single directory contains both files across all scopes.
|
|
|
|
**`<name> <root>` signature (rejected)** — mirrors `new-agent.sh <name> <root>`. Rejected because it requires the caller to supply two pieces of information when one (the file path) is sufficient. The file path already implies the agent name (filename stem) and the root (found by walking up). Forcing the caller to re-supply what the script can infer is the kind of convention knowledge the script exists to encapsulate.
|
|
|
|
## Consequences
|
|
|
|
- The unit of validation is the pair. A missing counterpart is always a FAIL — an orphan file is incomplete by definition.
|
|
- Scope detection walks up from the input file: first directory containing `plugin.json` → plugin scope; first directory containing `.git` without `plugin.json` → project scope; path under `~` with neither → user scope.
|
|
- At user scope the derivation crosses filesystem locations (`~/.claude/agents/` ↔ `~/.copilot/agents/`); the script must handle the home directory case explicitly.
|
|
- The invocation signature is the public contract. Changing it is a breaking change to any caller — treat it as such.
|
|
|
|
**Update (ADR-0016):** the plugin-scope clause above is superseded. Plugin scope is no longer
|
|
detected via `plugin.json`, and there is no counterpart to derive — a directory containing
|
|
`apm.yml` produces a single `.apm/agents/<name>.agent.md` file, and `agent-audit` validates it
|
|
directly with no pair-consistency check. Project scope and user scope keep the pair-derivation
|
|
mechanism described above unchanged. See ADR-0016.
|