Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions .agents/skills/dual-review/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
name: dual-review
description: Review a PR with two independent reviewers (this session and a fresh Codex gpt-6.1-sol at high effort), merge and verify their findings, fix, and repeat until the PR is ready for merge; minor points are recorded, not fixed. Ends with the merge verdict, the changes made and every unresolved finding with its reason. Invoke with /dual-review <PR number | URL | branch> [repo].
user-invocable: true
---

# dual-review

Two reviewers that do not see each other's work catch more than either alone. This skill runs that loop on a PR:
each round, this session reviews the change while a fresh Codex session reviews it independently; this session
merges the two lists, verifies every finding against the code, fixes what is real, and starts the next round on the
result. The goal is a PR that is ready for merge, not a PR with no findings left: minor points are recorded and
left alone, since fixing them costs rounds and tends to break real paths. It stops when a round turns up nothing new
that blocks the merge.

Run it in a Claude Opus 5.5 session at high effort (`/model`, `/effort`); say so at the start if the session is on
something else. The independent reviewer is always Codex with `gpt-6.1-sol` at `model_reasoning_effort="high"`.

## Inputs

ARGUMENTS: a PR number or URL, or a branch; optionally the repository (`OWNER/NAME`). Without a repository, use the
one the current checkout's `gh repo view` names; if that is not the PR's repository, ask.

## Step 0 — set up

1. Fetch the PR head into a fresh worktree: `W=$(mktemp -d /tmp/dualrev.XXXX)` and `git worktree add` the PR head
there on a local branch `<pr>-dualrev`. Never reuse or `rm` an existing directory; never work in the user's main
checkout.
2. Record the base (`gh pr view --json baseRefName,headRefOid`) and the diff scope: `git diff <merge-base>...HEAD`.
3. Create the ledger in the session scratchpad, `dual-review-<pr>.md`: the PR, the head commit, the base, and an empty
findings table (columns: id, round, source (self / codex / both), file:line, finding, verdict, action, status).
The ledger is the state of the loop; every finding goes in it, whatever happens to it.
4. Find the tests that cover the changed files and run them once on the untouched head, so that a later failure can
be told from one that was already there. Note any failure that predates the review in the ledger.

## Step 1 — one round

Start both reviews in the same turn so they run in parallel.

**The Codex review (background).** Write the prompt to `scratchpad/dual-review-<pr>-r<N>-prompt.md` from
`codex-prompt.md` in this skill's directory, filled in with: the repository and PR, the diff scope (the PR's diff
on round 1; on later rounds the PR's diff plus the fixes so far, `git diff <merge-base>`), what the PR intends (from
its description, in your own words), and on rounds after the first the findings already settled (id, one line,
status) so it does not re-report them. Then run, with `run_in_background: true` (`S` is the session scratchpad,
`W` the worktree):

```bash
codex exec --skip-git-repo-check -C "$W" -s read-only -m gpt-6.1-sol -c model_reasoning_effort="high" \
-o "$S/dual-review-<pr>-r<N>-codex.md" - < "$S/dual-review-<pr>-r<N>-prompt.md" \
> "$S/dual-review-<pr>-r<N>-codex.log" 2>&1
```

Every round starts a new `codex exec`: no `resume`, no shared session, so each review is independent of the last.
Codex is read-only: it reviews, it never edits.

**The self review (this session, at the same time).** Review the same scope without reading the Codex output:
read every changed file in full and the code it calls, then look for correctness bugs, regressions, races and edge
cases, docs and docstrings that the change made false, places elsewhere in the repo that still assume the old
behaviour (grep `docs/`, `examples/`, `tests/`), and tests that do not test what they claim. Write the findings to
the ledger before opening the Codex result.

**Merge and verify.** When the Codex result arrives, add its findings to the ledger, mark findings both reviewers
made as `both`, and verify each one yourself before acting: read the code it points at, and reproduce it when it can
be reproduced (a short script or a test). A finding is never fixed, or reported as real, on the reviewer's word
alone. If its Coverage section marks a changed file "not reviewed", review that file yourself this round. Give each
a verdict:

| verdict | meaning | action |
|---|---|---|
| confirmed | reproduced or plainly true in the code | fix |
| not a problem | the code is right; say why, with the line that shows it | none |
| disputed | real but the fix is a design choice the PR author or the user should make | record, ask at the end |
| uncertain | cannot be settled from the code or a reproduction (needs a host, a model, data) | record what would settle it |
| minor | real, but normal use does not reach it (see below) | record, do not fix |
| not worth it | real but the fix costs more than the problem (say both) | record |
| out of scope | real but predates the PR and is not made worse by it | record |

Minor means one of: it needs a contrived input (a secret inside a file name or link target, non-UTF-8 or over-long
names, IPv6-literal hosts, modules imported from zip archives, a caller who passes a symlink where the code makes
the path itself, rename collisions, a malformed value no real producer emits); it only changes a log line, a status
label or a test's wording; or it is a P3 nit with no effect on results, cost or safety. Not minor, whatever the
reviewer's severity: a regression on a path that worked before the PR, a plausible configuration that breaks (a CLI
in `~/.local`, an editable install, an option the docs offer), a secret reaching somewhere it should not in normal
use, money or results counted wrong, and docs the change made false.

Give each finding a severity of your own after verifying it (P1 breaks normal use, P2 goes wrong under a specific
configuration or event, P3 a rare combination, a dropped setting or a docs error), and note in the ledger where it
differs from the reviewer's and why. Report your severities, not the reviewer's.

**Fix.** For each confirmed finding: the smallest change that fixes the cause, in the style of the surrounding code;
a regression test that fails without the fix whenever one can be written; the affected tests run. Then self-audit
the round's fixes (read the diff again, line lengths, lint, stale docs). Record each fix in the ledger as one line:
before -> after -> what it solved.

Text that an agent reads at run time (prompts, learner-facing docs, templates' instructions) is changed only with
its exact new wording shown to the user before it lands; list such changes for the user's review at the end of the
round.

## Step 2 — the next round, and when to stop

Start the next round on the fixed code (Step 1 again, a new Codex session). Stop when a round's merged findings
contain no new confirmed finding (minor ones do not count), or after 10 rounds (say which). A finding re-reported
after it was settled is not new; a finding about a fix made in an earlier round is. Do not start a round only to
chase minor points.

## Step 3 — the report

Run the tests the change needs once on the final tree (in the background): `python -m pytest --changed --base
<base ref>` where the repository has it (hermit does, `tests/selection.py`; it runs every group when the change
touches shared code), the full suite where it does not. Use an environment with the dependency groups the selected
tests need, and compare the collected count with the selection so that skipped groups are not read as a pass.
Check whether the branch still merges into its base cleanly (`git merge-tree --write-tree <base> HEAD`; name
conflicting files, do not resolve them without the user), and report, in the chat language, with tables:

0. Merge verdict: ready for merge or not, and if not, each blocker in one line.
1. Rounds: per round, the findings from each reviewer, how many were confirmed, fixed, or left.
2. Changes: one line per fix, before -> after -> what it solved, with the test that covers it.
3. Unresolved findings: each disputed / uncertain / not-worth-it / out-of-scope one, with its reason and what would
change the verdict; minor ones as a short list, one line each.
4. Tests: the command, the groups it selected, the result, and failures that predate the review named as such.
5. Text changes that need the user's review, quoted in full.

## Rules

- Nothing leaves the worktree on the skill's own initiative: no commit, push, PR comment, review or merge unless the
user says so in this conversation. Show the commit message before committing.
- Never print or copy secrets (tokens, `auth.json`, API keys).
- Long waits (Codex, test suites) run in the background; the chat gets a short status, not a blocking wait.
- Codex is a reviewer, not an authority: its findings are verified like the session's own, and its `Checked, no
issue` list is not a substitute for reading the code.
- No temporary file outside the scratchpad, `/tmp` or `/dev/shm`; no `rm -rf`.
46 changes: 46 additions & 0 deletions .agents/skills/dual-review/codex-prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
You are reviewing a pull request in this checkout. Read-only: do not modify, create or delete any file.

Repository and PR: {{REPO}} #{{PR}} (head {{HEAD}}, base {{BASE}}).

Scope: `{{DIFF_COMMAND}}`. Read every changed file in full, and the code the changes call or are called by, before
judging anything.

What the change intends (the PR author's goal, as the orchestrating reviewer understands it):
{{INTENT}}

Already settled in earlier rounds (do not report these again unless the current code shows the fix is wrong or
incomplete):
{{SETTLED}}

The goal is to decide whether this PR is ready for merge. Report every problem that should block the merge; there
is no limit on the number, and a short list is only right if the code really has few problems. Do not stop after
the first few findings: work through every changed file, hunk by hunk, before writing the output. Anything you
leave out now costs another full review round later.

Minor points are not worth your effort: something only a contrived input reaches (a secret in a file name, non-UTF-8
names, IPv6-literal hosts, a malformed value no real producer emits), something that only changes a log line, a
status label or a test's wording, or a nit with no effect on results, cost or safety. Do not probe them; list them
at the end, one line each. A regression on a path that worked before, a plausible configuration that breaks, a
secret leaking in normal use, money or results counted wrong, and docs made false are never minor.

Look for:
- correctness bugs, regressions to existing behaviour, races and ordering problems, edge cases (empty, None, odd
types, malformed input, timeouts, cancellation);
- docs, docstrings and comments that the change made false;
- places elsewhere in the repository that still assume the old behaviour (search docs/, examples/, tests/);
- tests that do not exercise what they claim, or that would pass without the fix they protect.
Do not report style preferences or naming taste.

Verify before reporting: where a finding can be shown with a small in-memory probe or by reading a specific line,
do that, and say which. A finding you believe but could not verify cheaply is still reported, marked
"unverified", with what would settle it; never drop a finding only because verifying it would take long.

Output, in this order:
1. Findings that block the merge, most severe first, numbered, each with a severity (P1 breaks normal use, P2 goes
wrong under a specific configuration or event, P3 a rare combination or a docs error): file:line, what is wrong,
a concrete input or scenario that shows it, and the minimal fix.
2. Minor points: one line each, file:line and what it is.
3. Coverage: every changed file, one line each, with what you checked in it. A changed file you did not review
is listed as "not reviewed" with the reason.
4. "Checked, no issue": what you examined and found correct, one line each.
If there are no findings, say so plainly.
122 changes: 122 additions & 0 deletions .agents/skills/solve-issue/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
name: solve-issue
description: Take a GitHub issue to a merged fix - verify the issue against the code, fix it in a fresh worktree with tests that fail without the fix, open a PR that follows the repository's PR rules, run /dual-review on it, push the review fixes once the final tests pass, then squash-merge after CI and the user's go-ahead and clean up. Invoke with /solve-issue <issue number | URL> [repo].
user-invocable: true
---

# solve-issue

This skill takes an issue from a report to a merged pull request. It is the order of work that has held up in
practice: check the report, fix it, open the PR, get an independent review, then merge. It produces a PR that is
ready for merge, not a long one: fix what the issue says, record the rest.

## Inputs

ARGUMENTS: an issue number or URL; optionally the repository (`OWNER/NAME`). Without a repository, use the one the
current checkout's `gh repo view` names.

## Step 1 — read the issue, then check it against the code

1. Read the issue and its comments (`gh issue view <n> --comments`).
2. Verify every claim in it against the current code on the default branch, by reading the code it names, its callers,
and anything that shares it (grep for the function across the repository, docs and tests). An issue is a starting
point, not a specification.
- Check who is affected; it is often fewer callers than the issue lists, because some already work around it.
- Look for a pattern the codebase already uses for the same problem (a neighbouring function doing the same job for
another kind of file, a record that already holds what is needed). Following it beats inventing a new one.
3. Where it can be reproduced cheaply, reproduce it (a short script in the scratchpad against the real code).
4. If the issue is wrong or the fix needs a design choice that is the user's to make, say so and ask before writing
code. Otherwise state the plan in two or three lines and go on.

## Step 2 — fix it in a fresh worktree

1. `git fetch origin`, then `W=$(mktemp -d /tmp/<short-name>.XXXX)` and `git worktree add -b <branch> "$W" origin/<default>`.
Never work in the user's main checkout, and never switch its branch.
2. Read the repository's own rules first: AGENTS.md / CLAUDE.md, CONTRIBUTING.md, and any PR-preparation skill or
checklist they name (for hermit: `.agents/skills/prepare-pr`, the general and test checklists).
3. Make the smallest change that fixes the cause, in the style of the surrounding code.
4. Write a regression test for each behaviour the fix adds, in the test group of the code it covers. It goes through
the entry point users call, with stand-ins only at the edge.
5. Show each test fails without the fix. Copy the test file into a throwaway worktree of `origin/<default>` and run
it there, then remove that worktree. Do not `git stash` in a worktree where a test run is going.
6. Update every document the change makes false (user docs, docstrings, the changelog under Unreleased).
7. Check the real entry point once (for a CLI change, the CLI itself on a scratch workspace), not only the unit tests.

## Step 3 — check the whole change

- Run the related tests, then the repository's change-selected suite once, with `run_in_background: true` (for
hermit: `python -m pytest --changed --base origin/<default>`, which runs every group when shared code changed). Do
not start a long run with `&` inside a foreground command: the harness does not track it.
- Compare the collected count with what was selected; name the groups that were skipped for a missing dependency.
- Build the docs if any doc changed (with warnings as errors where the repository does), and lint the changed files.
Report only problems on lines this change touched; name existing ones as existing.
- Re-run the affected tests after any later edit. A run that started before the edit does not cover it.

## Step 4 — open the PR

1. Commit with a message that says what was wrong and what the code does now; end it with the attribution lines the
session gives.
2. Push the branch and open the PR against the default branch with `gh pr create --body-file`. The body follows the
repository's template and checklists:
- the problem and the behaviour now;
- the interfaces and files touched, and what is deliberately unchanged;
- the commands actually run, with their results;
- what was not verified;
- "Fixes #<n>".
Mark the independent review as pending.
3. Read the body back against the final diff: every path, name, number and claim.

Invoking this skill authorizes the branch push and the PR. It does not authorize a merge.

## Step 5 — /dual-review the PR

Run `/dual-review <pr>` and follow it as written, including its rules. Its fixes stay in its worktree until the
user says to push them. Once the user has said so (for example "push once the tests pass"):

1. Wait for its final test run to pass.
2. Commit the fixes as one commit, show its message, and push to the PR branch. Use a normal push, never a force
push; to bring in a newer default branch, merge it in, since the PR will be squash-merged.
3. Update the PR body:
- the final test result;
- each new test, and the fact that it fails without its fix;
- the independent review's rounds, what it found, what was fixed, and what was left and why.

## Step 6 — merge, after CI and the user's go-ahead

1. Wait for CI with a background until-loop on `gh pr checks <pr>`, not by polling in the chat. If CI fails, do not
merge: report the failing job and its cause.
2. Merge only when the user says so:
`gh pr merge <pr> --squash --match-head-commit <tested head sha>`. Pinning the head means a commit pushed after
the tests does not get merged untested. Use `--admin` only when the one thing blocking is a required review and
the user has asked for the merge.
3. Confirm the PR is merged and the issue closed (it closes on "Fixes #<n>"; close it by hand otherwise).

## Step 7 — clean up, when the user says so

For each worktree this work created (the fix's, /dual-review's, any throwaway one):

1. Check `git -C <w> status --short` is clean.
2. Remove it with `git worktree remove`.
3. Delete its local branch.

Delete the PR's remote branch, then `git worktree prune`. Never delete a directory you did not create; look at it
first.

## Reporting

Report in the chat language, short and plain. At each pause say:
- where things stand;
- what is running, and how long it should take;
- what the user has to decide.

When the user asks for it simpler, give fewer lines, not the same lines in other words. At the end, give a table:
the PR and merge commit, the fixes, what was left and why, the tests, and the cleanup done.

## Rules

- Merging, pushing review fixes and deleting things each wait for the user's word. That word covers the step it
names, not the next one.
- Never print or copy secrets.
- Temporary files go only in the scratchpad, `/tmp` or `/dev/shm`; no `rm -rf`.
- Do not switch `gh` accounts without asking.
- Long waits run in the background, with a one-line status in the chat.
Loading