Agent Harness Auditor
Make the repository itself a reliable operating environment for coding agents. Optimize for a fresh agent finding the right context, making a scoped change, and proving it without relying on chat history or unwritten team knowledge.
An audit is read-only. Do not add instructions, dependencies, CI jobs, linters, or architecture changes unless the user explicitly asks to improve the harness.
Choose the mode
- Audit: inspect current evidence and return prioritized gaps. Do not modify the repository.
- Improve: implement only the authorized harness changes, preserving existing project choices and unrelated work.
- Diagnose: trace a repeated agent failure to a harness gap before proposing a repository-level fix.
Do not turn a one-off model mistake into a permanent rule without evidence that the repository makes the same error likely to recur.
Establish representative work
Select one to three real task shapes that matter in this repository, such as a localized bug fix, a cross-module feature, or a dependency-sensitive change. For each, trace the path available from a clean checkout and repository-local information:
- Where should the agent start?
- How does it identify the owning module and relevant constraints?
- How does it reproduce or define the expected behavior?
- What is the smallest authoritative command that validates the change?
- What evidence proves completion, and what requires escalation?
Record dead ends, contradictory sources, guessed commands, hidden prerequisites, and unnecessarily slow feedback. Distinguish observed friction from hypothetical risk.
Build the agent reachability map
Map each information class to its authoritative source and enforcement mechanism:
| Information class |
Evidence to locate |
| Product and domain intent |
Versioned principles, terminology, acceptance examples, decision records |
| Repository topology |
Entry points, module ownership, dependency direction, generated-code boundaries |
| Setup and commands |
Runtime versions, package manager, bootstrap, build, test, lint, and targeted checks |
| Change constraints |
Public APIs, schemas, migrations, compatibility promises, security or privacy rules |
| Verification |
Fast checks, integration paths, fixtures, test data, expected artifacts, CI parity |
| Operations |
External effects, credentials, deployment boundaries, rollback, observability |
Classify each item as:
- Reachable: a fresh agent can find one current source from the repository root.
- Ambiguous: multiple sources disagree or ownership is unclear.
- Invisible: the rule exists only in a person, chat, external document, or prior session.
- Unenforced: the rule is documented but drift can pass automated checks.
- Stale: the source conflicts with executable reality or current configuration.
Do not copy sensitive or fast-changing external data into the repository. Add a maintained pointer, retrieval step, or explicit escalation when the source cannot safely live in version control.
Prefer executable constraints over more prose
Match the remedy to the kind of knowledge:
- Encode stable, machine-checkable rules as schemas, types, linters, structural tests, dependency checks, or CI assertions.
- Expose repeatable operations through project-native scripts or task-runner commands with explicit working directories and prerequisites.
- Keep judgment-heavy guidance as short principles with a valid example and a counterexample.
- Put root guidance in a compact routing layer; keep module-specific rules next to the module they govern.
- Link to one source of truth instead of duplicating instructions across README, AGENTS.md, package scripts, and CI.
Never invent an architectural invariant from directory aesthetics alone. Confirm it through code, tests, configuration, history, or user-provided policy before recommending enforcement.
Design the feedback ladder
Give agents the cheapest discriminating check first and widen only as risk requires:
- Syntax, formatting, type, schema, or structural checks relevant to the touched surface
- The smallest targeted behavioral test that can fail for the proposed change
- Module or integration validation across affected boundaries
- Full build, end-to-end, deployment, or production-path verification when scope and risk justify it
For every rung, record the exact command, working directory, prerequisites, expected artifact, and what a failure means. If local and CI behavior differ, expose the difference instead of claiming parity.
Fast feedback is useful only when it is decision-relevant. Do not add a quick check that can pass while the important contract remains untested.
Make state and failures legible
Agents need to distinguish source state, generated state, cached state, external state, and user-owned work.
- Identify generated files and the command that regenerates them.
- Make destructive, networked, privileged, and externally visible commands explicit.
- Preserve the earliest actionable error and stable evidence paths in logs or artifacts.
- Document how to detect dirty worktrees, stale dependencies, missing services, and partially completed operations.
- Define when the agent should stop and ask rather than repair, clean, retry, or broaden scope.
Do not expose secrets in repository guidance, examples, fixtures, logs, or generated artifacts.
Prioritize improvements
Rank gaps by observed task frequency, cost of a wrong change, ambiguity for a fresh agent, and maintenance cost of the remedy. Favor the smallest change that removes a recurring decision bottleneck.
Return a gap table with:
- evidence and affected task shape
- current failure or ambiguity
- recommended repository-native remedy
- authorization and ownership needed
- verification method
- priority and expected maintenance burden
Avoid a generic checklist with every item marked high priority.
Verify an improved harness
Re-run the representative task paths from repository-local sources. The harness is improved only when current evidence shows that a fresh agent can:
- locate the owning area and authoritative constraints without chat history
- choose reproducible setup and validation commands without guessing
- receive a mechanical failure when violating a confirmed invariant
- distinguish no-op, success, blocked, and unsafe-to-proceed states
- produce evidence tied to the exact revision and touched scope
Report what was audited, what was changed, which paths were exercised, and what remains unverified. Do not claim the repository is “agent-ready” from the presence of AGENTS.md alone.
1---2name: agent-harness-auditor3description: Audit or improve a code repository's AI-agent harness by making project knowledge discoverable, commands reproducible, architectural invariants executable, and feedback loops fast. Use when preparing a codebase for Codex or other coding agents, investigating inconsistent agent changes, or reviewing AGENTS.md and repository guidance; do not use for ordinary code review or a one-off task with no repository-level issue.4license: MIT5---67# Agent Harness Auditor89Make the repository itself a reliable operating environment for coding agents. Optimize for a fresh agent finding the right context, making a scoped change, and proving it without relying on chat history or unwritten team knowledge.1011An audit is read-only. Do not add instructions, dependencies, CI jobs, linters, or architecture changes unless the user explicitly asks to improve the harness.1213## Choose the mode1415- **Audit:** inspect current evidence and return prioritized gaps. Do not modify the repository.16- **Improve:** implement only the authorized harness changes, preserving existing project choices and unrelated work.17- **Diagnose:** trace a repeated agent failure to a harness gap before proposing a repository-level fix.1819Do not turn a one-off model mistake into a permanent rule without evidence that the repository makes the same error likely to recur.2021## Establish representative work2223Select one to three real task shapes that matter in this repository, such as a localized bug fix, a cross-module feature, or a dependency-sensitive change. For each, trace the path available from a clean checkout and repository-local information:24251. Where should the agent start?262. How does it identify the owning module and relevant constraints?273. How does it reproduce or define the expected behavior?284. What is the smallest authoritative command that validates the change?295. What evidence proves completion, and what requires escalation?3031Record dead ends, contradictory sources, guessed commands, hidden prerequisites, and unnecessarily slow feedback. Distinguish observed friction from hypothetical risk.3233## Build the agent reachability map3435Map each information class to its authoritative source and enforcement mechanism:3637| Information class | Evidence to locate |38| --- | --- |39| Product and domain intent | Versioned principles, terminology, acceptance examples, decision records |40| Repository topology | Entry points, module ownership, dependency direction, generated-code boundaries |41| Setup and commands | Runtime versions, package manager, bootstrap, build, test, lint, and targeted checks |42| Change constraints | Public APIs, schemas, migrations, compatibility promises, security or privacy rules |43| Verification | Fast checks, integration paths, fixtures, test data, expected artifacts, CI parity |44| Operations | External effects, credentials, deployment boundaries, rollback, observability |4546Classify each item as:4748- **Reachable:** a fresh agent can find one current source from the repository root.49- **Ambiguous:** multiple sources disagree or ownership is unclear.50- **Invisible:** the rule exists only in a person, chat, external document, or prior session.51- **Unenforced:** the rule is documented but drift can pass automated checks.52- **Stale:** the source conflicts with executable reality or current configuration.5354Do not copy sensitive or fast-changing external data into the repository. Add a maintained pointer, retrieval step, or explicit escalation when the source cannot safely live in version control.5556## Prefer executable constraints over more prose5758Match the remedy to the kind of knowledge:5960- Encode stable, machine-checkable rules as schemas, types, linters, structural tests, dependency checks, or CI assertions.61- Expose repeatable operations through project-native scripts or task-runner commands with explicit working directories and prerequisites.62- Keep judgment-heavy guidance as short principles with a valid example and a counterexample.63- Put root guidance in a compact routing layer; keep module-specific rules next to the module they govern.64- Link to one source of truth instead of duplicating instructions across README, AGENTS.md, package scripts, and CI.6566Never invent an architectural invariant from directory aesthetics alone. Confirm it through code, tests, configuration, history, or user-provided policy before recommending enforcement.6768## Design the feedback ladder6970Give agents the cheapest discriminating check first and widen only as risk requires:71721. Syntax, formatting, type, schema, or structural checks relevant to the touched surface732. The smallest targeted behavioral test that can fail for the proposed change743. Module or integration validation across affected boundaries754. Full build, end-to-end, deployment, or production-path verification when scope and risk justify it7677For every rung, record the exact command, working directory, prerequisites, expected artifact, and what a failure means. If local and CI behavior differ, expose the difference instead of claiming parity.7879Fast feedback is useful only when it is decision-relevant. Do not add a quick check that can pass while the important contract remains untested.8081## Make state and failures legible8283Agents need to distinguish source state, generated state, cached state, external state, and user-owned work.8485- Identify generated files and the command that regenerates them.86- Make destructive, networked, privileged, and externally visible commands explicit.87- Preserve the earliest actionable error and stable evidence paths in logs or artifacts.88- Document how to detect dirty worktrees, stale dependencies, missing services, and partially completed operations.89- Define when the agent should stop and ask rather than repair, clean, retry, or broaden scope.9091Do not expose secrets in repository guidance, examples, fixtures, logs, or generated artifacts.9293## Prioritize improvements9495Rank gaps by observed task frequency, cost of a wrong change, ambiguity for a fresh agent, and maintenance cost of the remedy. Favor the smallest change that removes a recurring decision bottleneck.9697Return a gap table with:9899- evidence and affected task shape100- current failure or ambiguity101- recommended repository-native remedy102- authorization and ownership needed103- verification method104- priority and expected maintenance burden105106Avoid a generic checklist with every item marked high priority.107108## Verify an improved harness109110Re-run the representative task paths from repository-local sources. The harness is improved only when current evidence shows that a fresh agent can:111112- locate the owning area and authoritative constraints without chat history113- choose reproducible setup and validation commands without guessing114- receive a mechanical failure when violating a confirmed invariant115- distinguish no-op, success, blocked, and unsafe-to-proceed states116- produce evidence tied to the exact revision and touched scope117118Report what was audited, what was changed, which paths were exercised, and what remains unverified. Do not claim the repository is “agent-ready” from the presence of AGENTS.md alone.