Skip to content

Review on done: an independent agent checks the exact commits #102

Open

Description

@androidand
Proposal

Parent: autonomous-swarm (F5). Inspired by Claude Code peer-programming plugins: when the
implementing agent says done, a hook calls another agent — preferably a different model —
to review exactly what changed.

Why

The queue loop's verify gate already runs a reviewer subagent over git status --porcelain
and git diff HEAD with an LGTM/NEEDS_WORK token (loop/loop.ts ~L1005–1060). Its
limits for the operator's goal:

  • the reviewer shares the author's model family unless a persona pins one — same blind spots;
  • it reviews the working tree, not a named commit range, so it cannot attest to a head SHA;
  • it exists only inside a queue loop — plain opencode and Claude Code sessions get nothing;
  • the verdict is not recorded where a merge decision can require it.

What Changes

  1. Review trigger on done for any session: loop completion (via loop-done-handoff's
    hook point) and, for Claude Code, a Stop hook running skein review-on-done.
    Triggers only when the session produced commits or a diff since its base and the change
    or branch is not already approved at that SHA.
  2. Reviewer selection that differs from the author: prefer a different harness, else a
    different model family, else a different model; routed with the same warm-capacity logic
    as crew work (peer-capacity-subagents, crew-loop 2a). If no independent reviewer is
    available, the review is marked same-model and the policy decides whether that suffices.
  3. Exact range, pointers not paste: the request carries base..head SHAs, the worktree
    path, the change slug and acceptance criteria locations. The reviewer reads the range
    itself in a detached worktree at head (no mutation of the author's tree).
  4. Verdict as evidence: LGTM/NEEDS_WORK plus findings, written to
    .skein/review.json as {headSHA, base, reviewer{harness,model}, verdict, findings, round}. standing-publish-authority's merge requires LGTM for the current head;
    skein's ReviewVerdict gate evidence reads the same file.
  5. Bounded rounds: NEEDS_WORK reopens implement with the findings; at most 3 rounds,
    then the ladder (escalate-before-idle) sends it to the lead. A re-review happens only
    for a new head SHA.
  6. Findings rules: the reviewer must cite file and line for each finding and separate
    blocking from advisory; a review with no verdict token is "no verdict", not a pass.

Non-goals

  • Not a replacement for CI or the verify gate's test run.
  • No auto-fix by the reviewer; it reports.
  • No review of a SHA already approved.

Impact

loop/loop.ts (generalise the verify reviewer to the commit range, add selection),
new review/on-done.ts, peer/delegate.ts request type, cli/cmd (review subcommand),
Claude Code hook config fragment, .skein/review.json schema, tests.

Tasks

Phase 0: Baseline

  • 0.1 Record on a real run: which model the verify reviewer used vs. the author, its
    input, whether anything persisted (autonomous-swarm 0.5).
  • 0.2 Failing test: reviewer input for a committed change (clean tree) is empty today,
    so a committed-but-unreviewed change reviews as "(empty)".

Phase 1: Range-based review

  • 1.1 review/range.ts: resolve base..head for a change/branch/worktree; detached
    worktree at head for the reviewer; cleanup.
  • 1.2 Generalise the verify gate to the range; keep the token verdict and the
    "no token = no verdict" rule.
  • 1.3 .skein/review.json schema (closed, validated at read) and writer.

Phase 2: Independent reviewer

  • 2.1 Selection function over roster + models (different harness > different family >
    different model > same-model flagged); unit tests per branch including "none available".
  • 2.2 Request/reply over the peer envelope with deadline; reviewer answers once.
  • 2.3 Round counter, max 3, then hand to the ladder.

Phase 3: Triggers

  • 3.1 Loop completion hook (after loop-done-handoff 1.2).
  • 3.2 skein review-on-done CLI + Claude Code Stop hook fragment; no-op when no new
    commits or head already approved; guard against hook re-entrancy (the reviewer's own
    Stop must not trigger a review).

Phase 4: Consumers

  • 4.1 Merge driver (standing-publish-authority 3.3) requires LGTM for current head.
  • 4.2 Skein ReviewVerdict evidence mapping (cross-repo, Phase 6.3 of the epic).

Phase 5: Live and controls

  • 5.1 Real change reviewed by a different-family model; findings fed back; second round passes.
  • 5.2 Negative controls: a seeded defect is caught; a stale review (new commit) is not
    accepted by merge; a reviewer reply with no token fails the gate; the review hook does
    not recurse.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions