Files
holocron/docs/adr/0009-agent-audit-field-inventory-reference.md
Defame1297 69119f4754 docs: reconcile the ADRs, gates and audit log with the shipped behaviour
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
2026-09-16 09:14:01 +00:00

2.1 KiB

agent-audit reads field lists from a reference file, not hardcoded script arrays

Amended by ADR-0025 (2026-09-15). agent-audit was removed and its flow merged with skill-audit's into factory-audit. Read agent-audit below as factory-audit's agent flow; the reference file this ADR is about is now factory-audit/references/agent-field-inventory.md. The decision is unchanged — the field lists still live in a reference file read at runtime, not in script arrays.

agent-audit's validate.sh checks for Claude Code-only fields in Copilot files and silently-ignored fields in plugin agents. Rather than hardcoding those field lists in the script, the script reads references/field-inventory.md at runtime. This keeps field list maintenance decoupled from script logic and preserves a provenance chain back to the research corpus that sourced the lists.

Considered options

Hardcode in validate.sh (rejected) — field lists live as literal arrays in the bash/python script. Rejected because: (1) the lists came from research docs (claude-code-plugins/agent-definition.md and github-copilot-plugins/agent-definition.md) and should maintain a provenance chain back to those sources via source_keys frontmatter; (2) both provider APIs evolve — updating a structured markdown file is lower friction than editing a script and less likely to introduce bugs; (3) it breaks the bidirectional reference principle already established for this repo, where research-derived content carries explicit source attribution.

Consequences

  • validate.sh must parse references/field-inventory.md to extract field lists — the file format must be machine-parseable (section headings the script can grep, or a simple list structure).
  • field-inventory.md carries source_keys frontmatter referencing claude-code-plugins-docs and github-custom-agents-configuration slugs.
  • The script exits with a clear error if references/field-inventory.md is not found — fail-fast, not silent.
  • Field list updates (new provider field, deprecated field) require only editing field-inventory.md; no script change needed.