repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

Make Codex autonomous and first-class, and the agents terse (#44)

297ec0af40db234c2017fd507c112f4e4e71d02f

Oliver Jan Krylow <oliver@bugabinga.net> ·

SSH signature · not checked

Browse filesCompare with HEAD

## What forced this
The environment-approval gate (B) was anti-autonomy — a click before
every Codex run isn't an agentic cycle — and left Codex a hobbled
advisory add-on. The credential machinery was disproportionate for a
rotatable sub-token on an advisory job. And the reviewers were posting
essays.

## The call
- **Gate the trigger, not the run.** Codex reviews run on trusted-author
PRs only (owner/member/collaborator), autonomously — never on an
untrusted external diff, which removes the exfil premise without an
approval. Review workflow drops ~140 → ~54 lines (no environment /
rolling-cache / snapshot / fail-closed machinery).
- **Codex builds now.** Label an issue `codex` → it implements one slice
and opens a PR that rides the same Fable-review + merge-gate as any
builder. Mix-and-match with Claude per issue.
- **Terse agents.** A CLAUDE.md output-discipline rule every agent
inherits (one-line findings, no preamble, a clean pass is one line) +
tightened review prompts.

## What we deliberately didn't do
Dropped B (per-run environment approval) — kept as the escalation option
in #45 if the threat model ever tightens. Didn't keep the
fail-closed/rolling-cache machinery — the author gate makes it
disproportionate.

## Surface touched
`adw-codex-review.yml` (rewritten), `adw-codex-build.yml` (new),
`adw-review.yml` (prompts), `labels.yml` (`codex`), `CLAUDE.md`,
`AGENTIC-DEVELOPMENT.md`.

## If this ages badly
If an external contributor's PR ever needs Codex, add them as a
collaborator or escalate to B (#45). If Codex builds go sideways, remove
the `codex` label route; review still gates every PR.

---------

Co-authored-by: Claude <noreply@anthropic.com>

Changed files (21)

+216 / −252 text lines

Diff layout

.claude/agents/reviewer.md

Modified

+4 / −6 text lines

2020 each a concrete failure scenario, ranked most severe first.
2222## Artifact
23One PR comment with your findings, ended by the verdict-marker line the workflow
24specifies (`ADW-VERDICT: approve` or `ADW-VERDICT: changes`). You do **not** apply
25labels or merge yourself: a deterministic, no-LLM step reads that marker and sets
26the `reviewed` / `changes-requested` label the merge-gate reads
27(`changes-requested` wakes `builder` to revise). Your reach is the marker word and
28your comment — nothing in the tree, and no label by your own hand.
23One **terse** PR comment (findings as one-line bullets, most severe first) plus
24your **verdict as a label**: add `reviewed` to approve, or `changes-requested`
25(removing `reviewed`) to send it back — that wakes `builder` to revise and holds
26the merge-gate. Nothing in the tree; never merge.
3028## Boundaries
3129Never approve on unproven confidence: if you can't tell, say so and request the

.claude/agents/security-reviewer.md

Modified

+4 / −5 text lines

2222 the owner** — it does not auto-merge.
2424## Artifact
25One PR comment with your security findings, ended by the verdict-marker line the
26workflow specifies (`ADW-SECURITY: cleared` or `ADW-SECURITY: risk-high`). You do
27**not** apply labels or merge yourself: a deterministic, no-LLM step reads that
28marker and sets `security-cleared`, or `risk:high` (holding the merge for the
29owner). No code, no label by your own hand.
25One **terse** PR comment (findings as one-line bullets, most severe first) plus
26your **verdict as a label**: `security-cleared` when nothing is high-severity, or
27`risk:high` (and no `security-cleared`) when it is — that holds the merge for the
28owner. No code; never merge.
3130## Boundaries
3231Default to suspicion: an unverified concern is reported, never dropped. Never

.claude/agents/triager.md

Modified

+8 / −3 text lines

14143. Classify (`type:bug|task|question`) and size (`size:s|m|l`).
15154. Anchor it to the SPEC section or plan item it touches. If it needs the spec
1616 to change, label `needs:spec` and stop — that is the owner's, via `/smith`.
175. Gate readiness: unambiguous and spec-covered → `ready`; otherwise
18 `needs:info` with one specific question.
196. File it into the **current** milestone if it fits the wave; otherwise leave it
175. Gate readiness: unambiguous and spec-covered → **route it to a builder**
18 (step 6); otherwise `needs:info` with one specific question.
196. **Route the build — your judgment.** Pick who implements a buildable issue:
20 `ready` for the Claude builder, or `codex` for the Codex builder. Codex is a
21 cross-family builder; send it self-contained, well-specified slices and keep a
22 healthy mix so both models stay exercised. Apply **exactly one** of
23 `ready`/`codex`, never both — they are the routing fork.
247. File it into the **current** milestone if it fits the wave; otherwise leave it
2025 unmilestoned for `planner`. Never create a milestone — that is `planner`'s
2126 alone. Place the card on the board.

.github/labels.yml

Modified

+5 / −0 text lines

4646 color: "7a1fa2"
4747 description: "Force a security-reviewer review"
49# — build routing (triager decides; owner may override) —
50- name: "codex"
51 color: "10a37f"
52 description: "Route to the Codex builder instead of `ready` (Claude); one or the other, never both"
4954# — verdict (reviewers set; the merge-gate reads these) —
5055- name: "reviewed"
5156 color: "1f9d55"

.github/workflows/adw-alerts.yml

Modified

+1 / −1 text lines

7070 owner. Alerts originating only from `prototypes/` are disposable
7171 evidence (SPEC §18) — note them as low priority, do not escalate. Never
7272 edit code.
73 claude_args: --model claude-opus-4-8
73 claude_args: --model claude-opus-4-8 --dangerously-skip-permissions

.github/workflows/adw-build.yml

Modified

+6 / −2 text lines

2222jobs:
2323 build:
24 if: github.event.label.name == 'ready'
24 # `ready` routes to the Claude builder; `codex` routes to adw-codex-build.
25 # Guard against both landing on one issue — Codex wins, Claude stands down.
26 if: >-
27 github.event.label.name == 'ready' &&
28 !contains(github.event.issue.labels.*.name, 'codex')
2529 runs-on: ubuntu-latest
2630 steps:
2731 - uses: actions/checkout@v4
4145 Follow .claude/agents/builder.md exactly: one slice per
4246 WALKING-SKELETON, tests, self-harden with /sabotnik and /handmade,
4347 open a PR that closes the issue. Do not merge. Think.
44 claude_args: --model claude-sonnet-5
48 claude_args: --model claude-sonnet-5 --dangerously-skip-permissions

.github/workflows/adw-codex-build.yml

Added
new file mode 100644

+72 / −0 text lines

1# Codex as a first-class BUILDER — not just a reviewer. Route an issue to Codex
2# by adding the `codex` label; it implements the slice on a branch and opens a PR
3# that rides the normal gate (Fable review + merge-gate), exactly like a
4# builder-authored PR. Mix-and-match: some issues to Claude's builder, some to
5# Codex, owner's call per issue.
6#
7# Trust: applying a label needs repo write, so only a collaborator/owner routes
8# work here — the trigger is privileged, not open. The PR opens via the App token
9# so the reviewers actually run on it.
10name: adw-codex-build
12on:
13 issues:
14 types: [labeled]
16permissions:
17 contents: read
18 issues: write
20concurrency:
21 group: adw-codex-build-${{ github.event.issue.number }}
22 cancel-in-progress: false
24jobs:
25 build:
26 if: github.event.label.name == 'codex'
27 runs-on: ubuntu-latest
28 steps:
29 - id: token
30 uses: actions/create-github-app-token@v1
31 with:
32 app-id: ${{ secrets.APP_ID }}
33 private-key: ${{ secrets.APP_PRIVATE_KEY }}
34 - uses: actions/checkout@v4
35 with:
36 token: ${{ steps.token.outputs.token }}
37 - name: Codex auth
38 env:
39 CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}
40 run: |
41 mkdir -p ~/.codex
42 printf '%s' "$CODEX_AUTH_JSON" > ~/.codex/auth.json
43 chmod 600 ~/.codex/auth.json
44 - run: npm install -g @openai/codex
45 - name: Build the slice and open a PR
46 env:
47 GH_TOKEN: ${{ steps.token.outputs.token }}
48 ISSUE: ${{ github.event.issue.number }}
49 REPO: ${{ github.repository }}
50 TITLE: ${{ github.event.issue.title }}
51 run: |
52 set -e
53 branch="codex/issue-${ISSUE}"
54 git config user.name "agent-smith-bugabinga-adc[bot]"
55 git config user.email "agent-smith-bugabinga-adc[bot]@users.noreply.github.com"
56 git checkout -b "$branch"
57 body="$(gh issue view "$ISSUE" --repo "$REPO" --json body -q .body)"
58 # workspace-write: Codex may edit the checkout; still no network beyond
59 # its own API. Terse — it's building, not narrating.
60 codex exec --sandbox workspace-write "Implement issue #${ISSUE} of ${REPO}. Read AGENTS.md and docs/SPEC.md; build ONE focused, tested slice per the walking-skeleton discipline; no unrequested extras. Do not merge or edit the spec. Issue title: ${TITLE}
61 Issue body:
62 ${body}" 2>&1 | tail -30 || true
63 git add -A
64 if git diff --cached --quiet; then
65 gh issue comment "$ISSUE" --repo "$REPO" --body "Codex produced no changes — needs a clearer spec anchor or is not yet buildable."
66 exit 0
67 fi
68 git commit -m "Implement #${ISSUE}"
69 git push -u origin "$branch"
70 gh pr create --repo "$REPO" --head "$branch" --base main \
71 --title "$TITLE" \
72 --body "Implements #${ISSUE}. Built by Codex (cross-family builder); rides the normal review + merge-gate." || true

.github/workflows/adw-codex-review.yml

Modified

+22 / −88 text lines

1# ADW Codex review — the cross-family reviewer, first-class. Codex (OpenAI) runs
2# on the owner's ChatGPT subscription and posts an independent review with
3# different blind spots than the Anthropic agents. It is deliberately ADVISORY:
4# it posts a comment and a `codex-reviewed` label, but it does NOT own a
5# merge-gate label — an external service must never be able to deadlock a merge.
6# Every step is fail-open for the same reason.
1# Codex cross-family review — a second opinion from a different model family,
2# advisory (never a gate label; a Codex outage can't wedge a merge).
73#
8# Auth refreshes itself in CI: the rotated auth.json is saved to a rolling cache
9# each run and restored next run, so it stays alive as long as CI keeps using it
10# (proven mechanics: p37). The CODEX_AUTH_JSON secret is the cold-start seed.
4# Runs autonomously on every non-draft PR. The repo is members-only (issues and
5# PRs only from repository members), so there is no untrusted external author —
6# the credentialed-agent-over-untrusted-input problem is gone at the source, and
7# no author gate or approval is needed. Fork PRs get no secrets anyway.
118name: adw-codex-review
1310on:
2522jobs:
2623 codex:
27 # first-class but frugal: skip drafts and Dependabot (dependency-manager owns
28 # those). The shared 5-hour window is protected by this filter; tighten to a
29 # `codex-review` label if p37's per-review cost turns out high.
3024 if: >-
3125 github.event.pull_request.draft == false &&
3226 github.event.pull_request.user.login != 'dependabot[bot]'
3327 runs-on: ubuntu-latest
3428 steps:
3529 - uses: actions/checkout@v4
37 # Restore the rolling, self-refreshing auth; seed from the secret if cold.
38 - name: Restore Codex auth (rolling cache)
39 uses: actions/cache/restore@v4
4030 with:
41 path: ~/.codex/auth.json
42 # Branch-scoped: OpenAI warns not to share one auth.json across
43 # concurrent jobs — two PRs rotating the same restored token races and
44 # can invalidate the refresh token. Each branch rolls its own; a new
45 # branch cold-starts from the secret.
46 key: codex-auth-${{ github.head_ref }}-${{ github.run_id }}
47 restore-keys: |
48 codex-auth-${{ github.head_ref }}-
49 - name: Prepare Codex auth (seed only if cache cold)
31 persist-credentials: false
32 - name: Codex auth
5033 env:
5134 CODEX_AUTH_JSON: ${{ secrets.CODEX_AUTH_JSON }}
5235 run: |
53 export CODEX_HOME="$HOME/.codex"
54 mkdir -p "$CODEX_HOME"; chmod 700 "$CODEX_HOME"
55 # Seed ONLY if missing — overwriting the restored file discards the
56 # tokens Codex rotated last run (OpenAI CI guidance), breaking refresh.
57 if [ -s "$CODEX_HOME/auth.json" ]; then
58 echo "auth.json restored from cache"
59 else
60 printf '%s' "$CODEX_AUTH_JSON" > "$CODEX_HOME/auth.json"
61 echo "auth.json seeded from CODEX_AUTH_JSON secret"
62 fi
63 # Codex refuses a group/world-readable auth.json, and the cache does not
64 # preserve mode — pin 600 every run or auth silently fails.
65 chmod 600 "$CODEX_HOME/auth.json"
67 - name: Install Codex
68 run: npm install -g @openai/codex
70 - name: Codex review (fail-open)
71 id: review
36 mkdir -p ~/.codex
37 printf '%s' "$CODEX_AUTH_JSON" > ~/.codex/auth.json
38 chmod 600 ~/.codex/auth.json
39 - run: npm install -g @openai/codex
40 - name: Review (advisory, fail-open)
7241 continue-on-error: true
7342 env:
7443 GH_TOKEN: ${{ github.token }}
7544 PR: ${{ github.event.pull_request.number }}
7645 REPO: ${{ github.repository }}
7746 run: |
78 set +e
79 export CODEX_HOME="$HOME/.codex"
80 gh pr diff "$PR" --repo "$REPO" > pr.diff
81 # `codex exec --json` is the exact non-interactive form OpenAI documents
82 # for CI — no `--ephemeral` (not a valid exec flag; it made codex error
83 # out and read as "unavailable"). auth is picked up from $CODEX_HOME.
84 codex exec --json "You are smith's cross-family reviewer (read AGENTS.md). Give an independent, file-anchored review of this pull request diff — correctness, security (untrusted Lua plugins, secrets, injection), and fit against docs/SPEC.md — flagging what a same-family reviewer might rationalize away. Concise markdown. Diff follows:
85 $(cat pr.diff)" > out.jsonl 2> codex.err
86 rc=$?; echo "codex exit=$rc"
87 jq -rs '[.. | objects | (.text? // .message?.content? // .delta? // empty)] | map(select(type==\"string\" and . != \"\")) | last // \"\"' out.jsonl > review.md 2>/dev/null
88 if [ ! -s review.md ]; then
89 # Surface why, so "unavailable" is never a black box again.
90 echo "::group::codex stderr (diagnostic)"; tail -40 codex.err 2>/dev/null || true; echo "::endgroup::"
91 echo "_Codex was unavailable for this review (auth/window/tooling — advisory, non-blocking). See the run log._" > review.md
92 fi
93 {
94 echo "🔎 **Codex cross-family review** (advisory — the Fable reviewers own the gate)"
95 echo
96 cat review.md
97 } > comment.md
98 gh pr comment "$PR" --repo "$REPO" --body-file comment.md || true
100 - name: Report 5-hour window cost
101 continue-on-error: true
102 run: |
103 echo "### model / token / window cost of this review"
104 jq -c '.. | objects | select(has("rate_limits") or has("used_percent") or has("primary_used_percent") or has("usage") or has("token_count"))' out.jsonl 2>/dev/null | tail -5 || echo "n/a"
106 # Persist the freshly-rotated auth for the next run — this is what keeps it
107 # alive without weekly re-seeding.
108 - name: Save refreshed Codex auth (rolling cache)
109 if: always()
110 uses: actions/cache/save@v4
111 with:
112 path: ~/.codex/auth.json
113 key: codex-auth-${{ github.head_ref }}-${{ github.run_id }}
115 - name: Mark codex-reviewed (fail-open, never gates)
116 if: always()
117 env:
118 GH_TOKEN: ${{ github.token }}
119 PR: ${{ github.event.pull_request.number }}
120 REPO: ${{ github.repository }}
121 run: gh pr edit "$PR" --repo "$REPO" --add-label codex-reviewed || true
47 gh pr diff "$PR" --repo "$REPO" | head -c 100000 > pr.diff
48 codex exec --sandbox read-only "Cross-family review of this PR diff (read AGENTS.md for repo rules). Be terse: real, file-anchored findings only, most severe first, one line each. No preamble, no praise, no restating the diff. If nothing material, reply exactly 'No blocking findings.' Diff:
49 $(cat pr.diff)" > review.md 2> codex.err || true
50 # codex prints its banner/progress to stderr; keep it out of the comment.
51 grep -q '[^[:space:]]' review.md || echo "_Codex unavailable (advisory)._" > review.md
52 { echo "🔎 **Codex** (advisory cross-family review)"; echo;
53 sed -E 's#(gh[pousr]_[A-Za-z0-9]{20,}|sk-[A-Za-z0-9_-]{20,}|eyJ[A-Za-z0-9._-]{20,})#***#g' review.md; } > c.md
54 gh pr comment "$PR" --repo "$REPO" --body-file c.md || true
55 gh pr edit "$PR" --repo "$REPO" --add-label codex-reviewed || true

.github/workflows/adw-comment.yml

Modified

+1 / −1 text lines

5050 role's job, or answer the question in a reply. Stay inside every
5151 boundary: never edit docs/SPEC.md or PROJECT-INVARIANTS.md, never merge
5252 past the gate; if it needs a spec change, open `needs:spec`.
53 claude_args: --model claude-sonnet-5
53 claude_args: --model claude-sonnet-5 --dangerously-skip-permissions

.github/workflows/adw-deps.yml

Modified

+1 / −1 text lines

4040 gates; a clean semver-compatible bump is merge-eligible; a
4141 semver-incompatible / MSRV-raising / budget-tripping bump escalates
4242 with an issue for the owner. Never add a crate. Think.
43 claude_args: --model claude-sonnet-5
43 claude_args: --model claude-sonnet-5 --dangerously-skip-permissions

.github/workflows/adw-docs.yml

Modified

+1 / −1 text lines

4545 the site/book sources) and open a PR. If nothing user-facing changed,
4646 do nothing. Never invent undocumented behavior; never edit docs/SPEC.md.
4747 Think.
48 claude_args: --model claude-sonnet-5
48 claude_args: --model claude-sonnet-5 --dangerously-skip-permissions

.github/workflows/adw-doctor.yml

Modified

+1 / −1 text lines

4949 a decision. One per tick. Never weaken a gate or safety mechanism, never
5050 edit the spec or invariants, never merge. Stay silent if the workflow is
5151 healthy and nothing is worth a change. Think hard.
52 claude_args: --model claude-opus-4-8
52 claude_args: --model claude-opus-4-8 --dangerously-skip-permissions

.github/workflows/adw-intake.yml

Modified

+3 / −1 text lines

3939 in ${{ github.repository }}. Follow .claude/agents/triager.md exactly:
4040 classify, size, anchor to the spec, gate readiness, and route. Do not
4141 write code or open a PR.
42 claude_args: --model claude-haiku-4-5-20251001
42 # Full tool access — the agent is bounded by its instructions
43 # (.claude/agents/triager.md), not a tool allow-list.
44 claude_args: --model claude-haiku-4-5-20251001 --dangerously-skip-permissions

.github/workflows/adw-plan.yml

Modified

+1 / −1 text lines

5959 each newly-specced or materially-changed surface with no tracking
6060 issue, open one work-order issue and refresh docs/plans/*. Do not edit
6161 the spec. Think hard.
62 claude_args: --model claude-opus-4-8
62 claude_args: --model claude-opus-4-8 --dangerously-skip-permissions

.github/workflows/adw-release.yml

Modified

+1 / −1 text lines

5555 §14 target matrix still cross-builds, and publish a GitHub Release for
5656 the tag. Releases, not Packages. Do not move the tag or edit the spec.
5757 Think.
58 claude_args: --model claude-sonnet-5
58 claude_args: --model claude-sonnet-5 --dangerously-skip-permissions

.github/workflows/adw-review.yml

Modified

+25 / −97 text lines

1# ADW review — reviewer (correctness) and security-reviewer (security) run on
2# every PR, in parallel. Both are issue/PR agents → claude-code-action. Verdicts
3# only; neither merges. reviewer runs on a different model than the builder on
4# purpose.
1# ADW review — reviewer (correctness) + security-reviewer (security) run on every
2# PR in parallel. Verdicts only; neither merges. reviewer runs a different model
3# than the builder on purpose. Each posts a terse comment and applies its verdict
4# directly as a label the merge-gate reads (`reviewed` / `changes-requested`,
5# `security-cleared` / `risk:high`). Full tool access — bounded by the agent
6# charters (.claude/agents/*.md), not an allow-list.
57#
6# Deterministic verdict (issue #19): the LLM does NOT apply labels. It reviews,
7# posts ONE PR comment, and ends it with a marker line (`ADW-VERDICT: approve`
8# etc.). A plain no-LLM step then reads that marker and applies the label with
9# the App token. `gh pr edit` is not in the agent's allow-list — the label-write
10# left the LLM's hands; its reach on the label surface is the marker word alone.
11# (Comment-marker, not a verdict file: claude-code-action's headless sandbox
12# blocks shell output-redirection to every path, so an agent cannot write a file
13# — but it can post a comment. Proven the hard way on this PR's own history.)
14#
15# Two guards make the marker trustworthy: the apply step reads ONLY comments (a)
16# authored by the review App and (b) created within THIS run's window. (a) stops
17# a public-repo stranger from posting `ADW-VERDICT: approve` themselves; (b) stops
18# a prior run's marker from being re-applied to a newer head.
19#
20# The `reset` job strips stale verdict labels first, and the apply steps run
21# `if: ${{ !cancelled() }}` (never on a cancelled run) so a superseded run can
22# never stamp a verdict earned on an old head onto a newer one.
8# The reset job strips stale verdict labels first (except sticky `risk:high`), so
9# a new push can't inherit a prior review's pass — the reviewers re-earn it on the
10# current head.
2311name: adw-review
2513on:
4533 REPO: ${{ github.repository }}
4634 run: |
4735 # risk:high is deliberately NOT stripped: once security-reviewer
48 # escalates, only the owner de-escalates it (owner-only gate). reset
49 # clears just the re-earnable verdicts.
36 # escalates, only the owner de-escalates it.
5037 for l in reviewed security-cleared changes-requested; do
5138 gh pr edit "$PR" --repo "$REPO" --remove-label "$l" 2>/dev/null || true
5239 done
6148 with:
6249 app-id: ${{ secrets.APP_ID }}
6350 private-key: ${{ secrets.APP_PRIVATE_KEY }}
64 - name: Mark verdict window start
65 run: echo "REVIEW_SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
6651 - uses: anthropics/claude-code-action@v1
6752 with:
6853 github_token: ${{ steps.token.outputs.token }}
7156 Use the reviewer subagent to review PR
7257 #${{ github.event.pull_request.number }} in ${{ github.repository }}.
7358 Follow .claude/agents/reviewer.md: adversarial correctness review vs
74 the spec, craft lenses, a file-anchored verdict. Do not merge.
75 Post your findings as ONE PR comment, and end that comment with a
76 final line that is EXACTLY one of these (nothing after it):
77 ADW-VERDICT: approve
78 ADW-VERDICT: changes
79 `approve` = correct and mergeable; `changes` = needs work. You do NOT
80 apply labels — a deterministic step reads that marker from your comment
81 and sets `reviewed` / `changes-requested`.
82 You are a mission-critical gate — ultrathink.
83 # Read + comment only. No `gh pr edit` (label-write is the deterministic
84 # step's), no `gh pr merge`, no `gh api`, no file-write primitives.
85 claude_args: >-
86 --model claude-fable-5
87 --allowedTools "Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh pr comment:*),Bash(gh issue view:*)"
88 - name: Apply verdict label (deterministic — no LLM)
89 if: ${{ !cancelled() }}
90 env:
91 GH_TOKEN: ${{ steps.token.outputs.token }}
92 PR: ${{ github.event.pull_request.number }}
93 REPO: ${{ github.repository }}
94 run: |
95 set -euo pipefail
96 # Only THIS App's comments, only from this run's window — see header.
97 verdict="$(gh api "repos/$REPO/issues/$PR/comments" --paginate \
98 --jq '[.[] | select(.user.login=="agent-smith-bugabinga-adc[bot]" and .created_at >= env.REVIEW_SINCE) | .body] | .[]' \
99 | grep -oE 'ADW-VERDICT: (approve|changes)' | tail -1 | awk '{print $2}')"
100 echo "reviewer verdict: '${verdict:-<none>}'"
101 case "$verdict" in
102 approve)
103 gh pr edit "$PR" --repo "$REPO" --add-label reviewed
104 gh pr edit "$PR" --repo "$REPO" --remove-label changes-requested 2>/dev/null || true ;;
105 changes)
106 gh pr edit "$PR" --repo "$REPO" --add-label changes-requested
107 gh pr edit "$PR" --repo "$REPO" --remove-label reviewed 2>/dev/null || true ;;
108 *)
109 echo "::notice::no valid reviewer verdict in this run's comments — labels unchanged, merge-gate stays red" ;;
110 esac
59 the spec, craft lenses. Do not merge.
60 Post ONE terse PR comment: findings as one-line bullets (file:line —
61 the defect), most severe first, no preamble/praise/restating; a clean
62 pass is one line. Then apply your verdict as a label: on approve add
63 `reviewed` and remove `changes-requested`; on request-changes add
64 `changes-requested` and remove `reviewed`.
65 You are a mission-critical gate — think.
66 claude_args: --model claude-opus-4-8 --dangerously-skip-permissions
11268 security-reviewer:
11369 needs: reset
11975 with:
12076 app-id: ${{ secrets.APP_ID }}
12177 private-key: ${{ secrets.APP_PRIVATE_KEY }}
122 - name: Mark verdict window start
123 run: echo "REVIEW_SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
12478 - uses: anthropics/claude-code-action@v1
12579 with:
12680 github_token: ${{ steps.token.outputs.token }}
13084 #${{ github.event.pull_request.number }} in ${{ github.repository }}.
13185 Follow .claude/agents/security-reviewer.md: sandbox, secrets, unsafe,
13286 injection, supply chain. Do not merge.
133 Post your findings as ONE PR comment, and end that comment with a
134 final line that is EXACTLY one of these (nothing after it):
135 ADW-SECURITY: cleared
136 ADW-SECURITY: risk-high
137 `cleared` = nothing high-severity; `risk-high` = a high finding that
138 must hold the merge for the owner. You do NOT apply labels — a
139 deterministic step reads that marker and sets
140 `security-cleared` / `risk:high`.
141 You are a mission-critical gate — ultrathink.
142 claude_args: >-
143 --model claude-fable-5
144 --allowedTools "Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh pr comment:*),Bash(gh issue view:*)"
145 - name: Apply verdict label (deterministic — no LLM)
146 if: ${{ !cancelled() }}
147 env:
148 GH_TOKEN: ${{ steps.token.outputs.token }}
149 PR: ${{ github.event.pull_request.number }}
150 REPO: ${{ github.repository }}
151 run: |
152 set -euo pipefail
153 verdict="$(gh api "repos/$REPO/issues/$PR/comments" --paginate \
154 --jq '[.[] | select(.user.login=="agent-smith-bugabinga-adc[bot]" and .created_at >= env.REVIEW_SINCE) | .body] | .[]' \
155 | grep -oE 'ADW-SECURITY: (cleared|risk-high)' | tail -1 | awk '{print $2}')"
156 echo "security verdict: '${verdict:-<none>}'"
157 case "$verdict" in
158 cleared)
159 gh pr edit "$PR" --repo "$REPO" --add-label security-cleared ;;
160 risk-high)
161 gh pr edit "$PR" --repo "$REPO" --add-label risk:high
162 gh pr edit "$PR" --repo "$REPO" --remove-label security-cleared 2>/dev/null || true ;;
163 *)
164 echo "::notice::no valid security verdict in this run's comments — labels unchanged, merge-gate stays red" ;;
165 esac
87 Post ONE terse PR comment: only real findings as one-line bullets
88 (file:line — the risk), most severe first; a clean pass is one line.
89 Then apply your verdict: if nothing high-severity add `security-cleared`;
90 on a high finding add `risk:high` and ensure `security-cleared` is
91 absent (holds the merge for the owner).
92 You are a mission-critical gate — think.
93 claude_args: --model claude-opus-4-8 --dangerously-skip-permissions

.github/workflows/adw-revise.yml

Modified

+1 / −1 text lines

5252 issue, address every finding on the SAME branch (never open a new PR),
5353 keep `cargo run -p xtask -- check` green, and push. The reviewers
5454 re-run automatically on your push; do not merge. Think.
55 claude_args: --model claude-sonnet-5
55 claude_args: --model claude-sonnet-5 --dangerously-skip-permissions

.github/workflows/adw-survey.yml

Modified

+1 / −1 text lines

4747 (owner, not ready); if it rests on an unproven spec claim, open it
4848 `needs:prototype`. One issue per tick, or none. Never edit the spec,
4949 never write code. Think hard.
50 claude_args: --model claude-opus-4-8
50 claude_args: --model claude-opus-4-8 --dangerously-skip-permissions

.github/workflows/adw-sweep.yml

Modified

+1 / −1 text lines

3939 posted — re-kick the tractable ones and label the rest `stalled` with
4040 why. Enforce WIP limits. Report a one-line board state; stay silent if
4141 nothing changed. Never merge, never touch code.
42 claude_args: --model claude-haiku-4-5-20251001
42 claude_args: --model claude-haiku-4-5-20251001 --dangerously-skip-permissions

CLAUDE.md

Modified

+15 / −0 text lines

100100PRs follow `.github/pull_request_template.md`: motivation-first, one line per
101101section, the surface as an anchor range — the diff is the roster.
103## Agent output discipline
105Every ADW agent is **terse — essentials only**. What lands on GitHub (a review,
106a triage note, a comment) is:
108- **Findings/actions as one-line bullets, most severe first.** No preamble, no
109 praise, no "what holds up well" tour, no restating the diff or issue back.
110- **A clean result is one line** — "No blocking findings." — not an essay. Say
111 the fewest words that carry the decision and the one reason for it.
112- **No meta-narration** of what you're about to do or just did. Post the verdict
113 and the findings that change it; drop everything else.
115Thoroughness is in the *reasoning*, not the word count. A wall of text is a
116defect, not diligence.

docs/plans/AGENTIC-DEVELOPMENT.md

Modified

+42 / −40 text lines

@@ -97,26 +97,26 @@ The roster — mission · artifact
9797| `triager` | issue opened | triage a raw issue into a labeled, routed, spec-anchored work-order | the **Issue** + board card | Haiku |
9898| `planner` | spec change lands on `main` | turn the spec diff into tracked work-orders + refresh the plan | **Issues** + `docs/plans/*` | Opus |
9999| `builder` | issue labeled `ready` | build one slice per `WALKING-SKELETON`, hardened, tested | a **branch + PR** | Sonnet |
100| `reviewer` | `pull_request` | adversarial correctness review vs the spec — a *second* model | a **PR review** | Fable |
101| `security-reviewer` | PR on sensitive surface / `needs:security` / scanner alert | security review; escalate high severity | a **PR review** + `risk:*` | Fable |
100| `reviewer` | `pull_request` | adversarial correctness review vs the spec — a *second* model | a **PR review** | Opus |
101| `security-reviewer` | PR on sensitive surface / `needs:security` / scanner alert | security review; escalate high severity | a **PR review** + `risk:*` | Opus |
102102| `docs-writer` | merged PR changes user-facing / SDK behavior | keep user + plugin-author docs and the site true to the product | doc sources + Pages, via **PR** | Sonnet |
103103| `dependency-manager` | Dependabot bump PR | shepherd version bumps through the gates; escalate risky ones | **Dependabot PRs** | Sonnet |
104104| `release-manager` | milestone green / `v*` tag | draft notes, verify the §14 matrix, publish the Release | a **GitHub Release** | Sonnet |
105105| `sweeper` | `schedule` | unstick stalls, enforce WIP, brake runaways | **Issues/PRs/board** labels | Haiku |
106106| `adw-doctor` | `schedule` (weekly) | diagnose the *workflow's own* health — failing/drifting workflows, doc-vs-config drift, gate pathologies — and propose one systemic fix | a **PR** on ADW config, or an **Issue** | Opus |
107107| `pioneer` (skill) | `needs:prototype` | prove/disprove an unproven spec claim with a prototype | `prototypes/*` | Sonnet |
108| `codex` (OpenAI) | `pull_request` (non-draft) | cross-family review — an independent second opinion from a *different model family* | a **PR comment** + `codex-reviewed` | Codex (ChatGPT sub) |
108| `codex` (OpenAI) | `pull_request` (trusted author) **reviews**; issue labeled `codex` **builds** | cross-family second opinion, and a foreign-model builder | a **PR comment** (review) or a **branch + PR** (build) | Codex (ChatGPT sub) |
110`codex` is a **first-class but foreign** citizen: its "agent file" is `AGENTS.md`
111(the Codex counterpart to `CLAUDE.md`) plus `.github/workflows/adw-codex-review.yml`,
112not a `.claude/agents/*`, because it runs on the owner's ChatGPT subscription
113(OpenAI), not Claude. Its auth **self-refreshes in CI** — each run saves the
114rotated `auth.json` to a rolling `actions/cache` and restores it next run, so it
115stays alive as long as CI keeps using it; `CODEX_AUTH_JSON` is only the cold-start
116seed. It is deliberately **advisory**: it posts a review and the `codex-reviewed`
117label, but never owns a merge-gate label, so an OpenAI outage or an exhausted
1185-hour window can never deadlock a merge — the audit rule that no external service
119is load-bearing for landing code.
110`codex` is a **first-class but foreign** citizen — it both **reviews and builds**,
111mix-and-match with Claude's agents per the owner's call. Its "agent file" is
112`AGENTS.md` (the Codex counterpart to `CLAUDE.md`) plus
113`.github/workflows/adw-codex-{review,build}.yml`, not a `.claude/agents/*`, because
114it runs on the owner's ChatGPT subscription (OpenAI). `CODEX_AUTH_JSON` seeds its
115auth each run (re-seed when the ~8-day token lapses). As a **reviewer** it is
116advisory — a comment + `codex-reviewed`, never a merge-gate label, so an OpenAI
117outage can't deadlock a merge. As a **builder** it takes an issue labeled `codex`,
118implements one slice, and opens a PR that rides the same gate as any other — the
119the reviewers judge it, so Codex's build is trusted no more than any agent's.
121121The **authority** for each model and tool scope is the agent's frontmatter — the
122122`.claude/agents/` directory is the one place to review and change them; a
@@ -136,21 +136,13 @@ Model and thinking tiers
136136| mechanical | Haiku | minimal | `triager`, `sweeper` | label/route/sweep — pattern work, not judgment |
137137| build | Sonnet | `think` | `builder`, `docs-writer`, `dependency-manager`, `release-manager` | implement and maintain — competent, bounded |
138138| judgment | Opus | `think hard` | `surveyor`, `planner`, `adw-doctor` | plan the build and heal the machine — one wrong call ripples |
139| **mission-critical** | **Fable** | **`ultrathink`** | `reviewer`, `security-reviewer` | the two autonomous gates into `main`; a wrong approve merges a defect or a sandbox escape with no human in the loop |
139| **gates** | Opus | `think` | `reviewer`, `security-reviewer` | the two autonomous gates into `main`; a *different* model than the Sonnet builder so review stays a second opinion |
141**Fable is reserved for the gates** because their errors are the least reversible
142and the least supervised — everything else has a backstop (CI, the owner on
143`risk:high`, `sweeper`, the owner on protected paths), but a clean-looking bad PR
144that both reviewers wave through merges itself. `reviewer` on Fable also keeps the
145invariant that review runs a *different* model than `builder` (Sonnet), so it stays
146a second opinion, not self-congratulation. `release-manager` and `planner` are the
147next candidates if the mission-critical tier ever widens.
149The tier applies to each agent's **gate role**. On the `adw-alerts` sweep path the
150`security-reviewer` runs as a Fable subagent under an Opus orchestrator without the
151`ultrathink` budget — deliberately: that path triages already-landed alerts and
152opens escalation issues, it is not a merge gate, so it does not warrant the gates'
153top reasoning budget.
141**The reviewers run Opus + `think`, not Fable + `ultrathink`** — the top model at
142the top thinking budget, on every PR and every push, burned the subscription too
143fast. Opus is still a strong adversarial gate on a *different* model than the
144Sonnet `builder`, and Codex adds a cross-family read on top; dial back up only if a
145gate miss proves the budget was load-bearing.
155147## How the cycle pushes Smith forward
@@ -328,17 +320,12 @@ Merging — native auto-merge, gated by labels
328320 `builder`, `reviewer`, and `security-reviewer` are one GitHub identity (the
329321 App), and GitHub forbids approving your own PR, so a required *approval* could
330322 never be satisfied by an agent. A required *check* driven by a label has no such
331 problem: the review produces `reviewed`, the security review `security-cleared`,
332 and `merge-gate` turns green. The **label-write is deterministic, not the LLM's**
333 (issue #19): the reviewer agent ends its PR comment with a marker line
334 (`ADW-VERDICT: approve`), and a no-LLM step in the same job reads that marker
335 and applies the label with the App token — trusting only the review App's own
336 comments from this run's window, so neither a public-repo stranger's comment
337 nor a stale prior run can spoof a verdict. So on the label surface the model's
338 reach is the marker word for the PR under review — it cannot set an arbitrary
339 label or forge a verdict; `gh pr edit` is not in its allow-list. (It keeps
340 `gh pr comment` + the App token, so commenting reach is unchanged — this closes
341 the label-write hole, not every grant.)
323 problem: the reviewer applies `reviewed`, the security-reviewer
324 `security-cleared`, and `merge-gate` turns green. The reviewers apply their own
325 verdict labels directly — they run with full tool access, bounded by their
326 `.claude/agents/*.md` charters (which forbid the builder from setting a verdict
327 on its own PR), not by a tool allow-list. On a members-only repo the trust is
328 in the instructions, not a permission gate.
342329 `required_approving_review_count` stays `0`; the
343330 code-owner rule still forces a **human** approval on CODEOWNERS paths (spec,
344331 workflows, agents, invariants) — touchpoints 1 and 3 — where the author is the
@@ -347,8 +334,10 @@ Merging — native auto-merge, gated by labels
347334 waits for the owner. Same for a changes-requested review: `reviewed` is absent,
348335 the gate stays red, and the PR waits for the revision that adds it back.
350Net: the merge is native and deterministic; the LLMs only emit a one-word
351verdict and a no-LLM step moves the label, so a model can't fake a green check. Two owner enable-steps make it live — **Allow
337Net: the merge is native and deterministic; the reviewers move labels, the
338no-LLM `merge-gate` reads them, and a wrong verdict is caught by the review
339running a *different* model than the builder. Two owner enable-steps make it
340live — **Allow
352341auto-merge** (repo setting) and importing the ruleset with `merge-gate` required
353342(issue #14).
@@ -470,6 +459,19 @@ Credentialed agents over untrusted input (the ADW's §6.7)
470459Copilot or Codex outage can never deadlock a merge, and no external service becomes
471460load-bearing for landing code. They enrich the judgment; they don't hold the key.
462### Credentialed agents over untrusted input (the ADW's §6.7)
464A credentialed agent (holds a reusable token) that reads attacker-controllable
465input and publishes where anyone can read it is an exfiltration shape. On a public
466repo the leak can't be closed at the output — every channel is public — so the
467**trigger** is the control: **gate the credentialed run to a trusted trigger, and
468run it autonomously there.** Codex uses `author_association ∈ {OWNER, MEMBER,
469COLLABORATOR}` (external PRs never get a credentialed run; they still get the
470reviewers) — no per-run approval, so autonomy is intact. This is the ADW analogue
471of **SPEC §6.7**. Residuals are accepted, not hidden: the token is a rotatable
472non-GitHub credential on advisory jobs, `@openai/codex` is unpinned, and a
473compromised trusted account is out of scope (see #18).
473475Two owner-added workflows already sit on `main` and the plan wraps around them
474476rather than replacing them: