gaia: Agent for Claude Code

.claude/agents/audit-loop-unit.md

audit-loop-unit is an agent for Claude Code from gaia-react/gaia. It costs 31 tokens per session (4,981 once invoked), scanned A, original, MIT.

A specialised agent that runs repeated audit-and-fix rounds for a pull request. A pull request is a proposed set of code changes awaiting review and merging.

In plain words
What is it for?
It is for checking pull-request changes, coordinating fixes and verification, and recording whether each audit unit passed or stopped.
Why use it?
It moves lengthy audit work off the main conversation and records a small result report, while stopping when required tools or inputs are missing.

Agent for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: model in frontmatter; mentions subagents; mentions Claude Code.

This is gaia-react/gaia's own configuration. It tells Claude Code how to work on gaia itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything gaia configures →

Reuse

Borrowing it

Nothing to install: this file belongs to gaia-react/gaia. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/gaia-react/gaia/main/.claude/agents/audit-loop-unit.md
Clone the repo
git clone --depth 1 https://github.com/gaia-react/gaia

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for audit-loop-unit

README.md
[![agentmods](https://agentmods.dev/badge/agents/gaia-react/gaia/audit-loop-unit/github.svg)](https://agentmods.dev/agents/gaia-react/gaia/audit-loop-unit)
Your own site
<a href="https://agentmods.dev/agents/gaia-react/gaia/audit-loop-unit"><img src="https://agentmods.dev/badge/agents/gaia-react/gaia/audit-loop-unit/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for audit-loop-unit

Your own site · 80×15
<a href="https://agentmods.dev/agents/gaia-react/gaia/audit-loop-unit"><img src="https://agentmods.dev/badge/agents/gaia-react/gaia/audit-loop-unit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,981 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.04981
Opus 5.5 $0.00012 $0.01992
Sonnet 5.5 $0.00006 $0.00996
Haiku 4.5 $0.00003 $0.00498

Measured 7d ago against content hash 0ca181efaf4f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

audit-loop-unit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/audit-loop-unit.md · 118 lines

How it starts

The opening of the file, as written. The whole thing — 118 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You run one audit-to-fix unit for the main thread: up to K audit rounds, off the main thread, then a thin report. You are an orchestrator, not an auditor. The procedure lives on wiki/concepts/Audit Round Procedure.md; this brief names the sections to follow and states only what is specific to running as the unit. Read each named section when you reach it, not from memory.

Brief you receive

The dispatch prompt carries, verbatim: Working root: <absolute path>, the PR number, the run folder absolute path (written <run> below), Start round: <s>, Unit: <u>, and Vetoes: <run>/vetoes.json. K is never in the brief. When any field is missing, or Working root: is not an absolute path, write the unit file with stop_reason: "failure" and return.

Writing into <run>. It lies in the main checkout, so from a worktree the runtime refuses an Edit or Write there and refuses a heredoc, pipe or compound Bash command. Write every run-folder file you author (dispositions, the unit file) with Write into your session scratchpad, copy it in with one plain cp <scratch file> <run>/<file>, and read it back. Scripts that take <run> paths as arguments write there themselves.

Pass Working root: <abs> verbatim into every member dispatch, with the expected-tree self-check the page describes.

First actions

  1. Confirm the Agent tool is available to you before round 1. Absent: write the unit file with stop_reason: "needs-human" and a stop_detail that names the missing Agent tool, Claude Code 2.1.287 or later, and the upgrade step (claude update, then relaunch the session), and return.
  2. Read K from .gaia/scripts/context-checkpoint-lib.sh (GAIA_CONTEXT_UNIT_ROUNDS). Never hard-code it.
  3. Recovery checks before opening a round: a dirty tree, an unpushed commit, and a baseline-<r>.json in <run> with no fixer-<r>-audit.json. For the last, run the pinned verifier's drift from <run>/verifier-bin-<r>/ and stop needs-human when it exits 1; otherwise follow the page's resume rule.
  4. Republish the ## Audit rounds record (audit-loop-eval.sh record-values into audit-loop-record.sh) before round 1.

Read the full file on GitHub · 118 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago Changed · -1 lines 0ca181efaf4f
  2. 8d ago Changed · +3 lines 2ea143e7eceb
  3. 9d ago Changed · +9 lines f72c66dfc570
  4. 10d ago Changed · +2 lines deaa423d0a8d
  5. 11d ago Changed · +1 lines · -23 tokens per session fc0bfdd97176
  6. 15d ago Changed c7308cf0481f
  7. 16d ago Changed b0049ef932c7
  8. 20d ago Changed · +6 lines f2968d4a9ef6
  9. 21d ago Changed 1c3785c83572
  10. 22d ago First seen · 98 lines · 54 tokens per session scan A 23e535cd1501

Subscribe to this mod's changes

audit-loop-unit is an agent published in the GitHub repository gaia-react/gaia (26 stars, last pushed 4d ago), licensed MIT. It adds 31 tokens to every session and 4,981 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-03.

Related

Other agents, from other repositories

claude-md-compliance-checker

Use after completing implementation tasks to verify changes comply with CLAUDE.md project rules — file boundaries (src/, e2e/ only), path alias usage (@/), feature-slice architecture, AIDEV-NOTE comments, scope creep, and forbidden actions (unauthorized commits, API contract changes). NOT for general code quality …

bartstc/vite-ts-react-template · 85 tokens

architecture-guard

Audits PR diffs for architecture boundary violations, design simplicity, dependency drift, and established-pattern mismatches. Use during code review when architecture, layering, or framework conventions may be affected.

HoangNguyen0403/agent-skills-standard · 42 tokens

pr-reviewer

Summarizes GitHub PR, GitLab MR, or Azure DevOps PR metadata, review threads, changed files, and template completeness. Use during review-ticket or code-review workflows when PR/MR context exists.

HoangNguyen0403/agent-skills-standard · 47 tokens

test-gap-finder

Finds missing, weak, or stale test coverage in a diff. Use during review when production logic, user flows, error paths, or acceptance criteria changed.

HoangNguyen0403/agent-skills-standard · 37 tokens

check

Code quality auditor for the Trellis channel runtime. Reviews uncommitted diffs against task artifacts and specs, self-fixes issues, and reports verification results.

yuqie6/ProductFlow · 34 tokens

react-software-architect-review

Expert React software architect that provides frontend architecture, component design patterns, state management strategies, and performance optimization guidance. Reviews React codebases for architectural integrity, proper component composition, and best practices across React 19, Next.js, Remix, and modern frontend…

giuseppe-trisciuoglio/developer-kit · 79 tokens