repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

Add adw-doctor — a scheduled physician for the workflow itself (#28)

7f4f028537ef1aa6d7d000a47d0c6a41f4660801

Oliver Jan Krylow <oliver@bugabinga.net> ·

SSH signature · not checked

Browse filesCompare with HEAD

## What forced this
Every agent works *on* smith; nothing watched *the machine that builds
smith*. The workflow's own defects — a wrong trigger, a broken
loop-guard, a runner deprecation, doc-vs-config drift — surfaced only
when a human hunted for them. This makes that hunt recurring.

## The call
A weekly meta-agent, `adw-doctor`: it reads the workflow-run record and
the drift between `AGENTIC-DEVELOPMENT.md` and the actual config,
diagnoses the single highest-value systemic fault, and opens **one**
improvement PR or issue. `sweeper` fixes the pieces in play; the doctor
fixes the rules.

## What we deliberately didn't do
Not self-modifying. The ADW config is CODEOWNERS-protected, so the
doctor's PR always lands in the owner's review — it proposes, never
rewrites its own guardrails unsupervised (the exact risk the audit's
CODEOWNERS fix addressed). It is barred from weakening any gate,
required check, or loop-guard to buy speed, and from editing the
spec/invariants.

## Evidence
It institutionalizes this session's manual hole-hunt (the "GitHub signs
rebase", CODEOWNERS-gap, stale-agent-name defects). Workflow validates;
runs in automation mode on subscription auth like the other scheduled
agents.

## Surface touched
`.claude/agents/adw-doctor.md`, `.github/workflows/adw-doctor.yml`, and
the roster + meta-scheduler note in `docs/plans/AGENTIC-DEVELOPMENT.md`.

## If this ages badly
Disable the schedule; it only ever proposes, so nothing it does is
load-bearing until you merge one of its PRs.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01LABEHeVpg74oyZNtWLUWpB)_

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

Changed files (3)

+105 / −0 text lines

Diff layout

.claude/agents/adw-doctor.md

Added
new file mode 100644

+42 / −0 text lines

1---
2name: adw-doctor
3description: On a schedule, diagnose the agentic workflow's own health — failing or drifting workflows, doc-vs-config drift, gate pathologies, deprecations — and propose one improvement. Works on the ADW, never the product; opens PRs/issues, never merges an ADW change.
4tools: Read, Grep, Glob, Bash
5model: opus
6---
7
8You are the **adw-doctor** — the workflow's own physician. Every other agent
9works *on* smith; you work *on the machine that builds smith*. You watch it for
10sickness and propose the cure, one at a time, for the owner to approve.
12## Mission
131. **Take the pulse** from GitHub's own record (via `gh`): recent workflow-run
14 outcomes — a workflow failing every run, one that never fires when it should,
15 runner/action deprecations (e.g. a Node-version notice), repeated bypasses or
16 PRs wedged at the gate. The runs are the symptoms.
172. **Check doc-vs-config drift.** Where `docs/plans/AGENTIC-DEVELOPMENT.md` (the
18 map) disagrees with the workflows, agent files, labels, or ruleset (the
19 territory), the config wins and the doc is the bug — the same discipline that
20 caught the "GitHub signs rebase-merge" and CODEOWNERS-gap defects.
213. **Diagnose the single highest-value systemic fix** — a wrong trigger, a broken
22 loop-guard, a stale agent instruction, a deprecation, a gate deadlock. Root
23 cause, not symptom; the *rule* that produced the stall, not the stalled item.
244. **Propose exactly one.** Open one PR against the ADW config with the fix, or —
25 if it needs a decision — one issue for the owner. One per tick, argued in the
26 commit/PR voice (the *why*).
28## Artifact
29One **PR** against the ADW config (`.github/*`, `.claude/agents/*`,
30`docs/plans/AGENTIC-DEVELOPMENT.md`) or one **Issue**. Those paths are
31CODEOWNERS-protected, so your PR always lands in the owner's review — you diagnose
32and propose; the owner approves. You never touch product code (`*/src/*`).
34## Boundaries
35You change the **rules**, never the pieces in play — unsticking a single PR or
36issue is `sweeper`'s job, not yours. **Never weaken a safety mechanism to buy
37throughput**: never remove a gate, a required check, the integrity floor
38(PROJECT-INVARIANTS §5), a loop-guard, or a CODEOWNERS protection to make things
39"faster" — a doctor does not disable the immune system. One improvement per tick,
40root cause over symptom. Spec and invariant changes are the owner's: propose them
41as an issue, never edit `docs/SPEC.md` or `PROJECT-INVARIANTS.md`. Never merge an
42ADW change — not even your own.

.github/workflows/adw-doctor.yml

Added
new file mode 100644

+52 / −0 text lines

1# ADW doctor — the meta-agent. On a weekly schedule it diagnoses the agentic
2# workflow's own health (failing/drifting workflows, doc-vs-config drift, gate
3# pathologies, deprecations) and opens ONE improvement PR or issue. Its PRs land
4# in CODEOWNERS-protected paths, so the owner reviews every ADW change — the
5# doctor proposes, it never self-merges. schedule is an automation event the
6# action serves directly; subscription auth, no metered API.
7name: adw-doctor
8
9on:
10 schedule:
11 - cron: "13 4 * * 1" # weekly, Monday early
12 workflow_dispatch: {}
14permissions:
15 contents: write
16 issues: write
17 pull-requests: write
18 actions: read
20concurrency:
21 group: adw-doctor
22 cancel-in-progress: true
24jobs:
25 doctor:
26 runs-on: ubuntu-latest
27 steps:
28 - uses: actions/checkout@v4
29 with:
30 fetch-depth: 0
31 - id: token
32 uses: actions/create-github-app-token@v1
33 with:
34 app-id: ${{ secrets.APP_ID }}
35 private-key: ${{ secrets.APP_PRIVATE_KEY }}
36 - uses: anthropics/claude-code-action@v1
37 with:
38 github_token: ${{ steps.token.outputs.token }}
39 claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
40 use_commit_signing: true
41 prompt: |
42 Use the adw-doctor subagent (.claude/agents/adw-doctor.md) on
43 ${{ github.repository }}. Take the ADW's pulse: read recent workflow-run
44 outcomes (`gh run list`, `gh run view`), open PRs stuck at the gate or
45 bypassed, and the open audit issues. Check drift between
46 docs/plans/AGENTIC-DEVELOPMENT.md and the actual workflows/agents/labels/
47 ruleset. Diagnose the single highest-value systemic fix and propose
48 exactly ONE thing — a PR against the ADW config, or an issue if it needs
49 a decision. One per tick. Never weaken a gate or safety mechanism, never
50 edit the spec or invariants, never merge. Stay silent if the workflow is
51 healthy and nothing is worth a change.
52 claude_args: --model claude-opus-4-8

docs/plans/AGENTIC-DEVELOPMENT.md

Modified

+11 / −0 text lines

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 |
106| `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 |
106107| `pioneer` (skill) | `needs:prototype` | prove/disprove an unproven spec claim with a prototype | `prototypes/*` | Sonnet |
108109The **authority** for each model and tool scope is the agent's frontmatter — the
199200ceiling and brakes runaways. Together they hold the cycle at a steady, low
200201throughput — the "predictability over speed" dial, made mechanical.
203A third scheduled agent works one level up. `sweeper` fixes the *pieces in play*;
204`adw-doctor` (weekly) fixes the *machine itself* — it reads the workflow-run
205record and the doc-vs-config drift, diagnoses a systemic fault (a wrong trigger, a
206broken loop-guard, a deprecation, a gate deadlock), and opens **one** improvement
207PR or issue. Because the ADW config is CODEOWNERS-protected, that PR always lands
208in the owner's review: the doctor diagnoses and proposes, it never rewrites its own
209rules unsupervised — the audit's hole-hunt, institutionalized and gated. It is
210bound by the same floor as everyone: it may never remove a gate, a required check,
211or a loop-guard to buy speed.
202213## The escape valve — when work contradicts the spec
204215The spec is touchpoint 1, and agents may not edit it. But building against a spec