Skip to content

feat(loop): adversarial review rung, reviewer profile, and a learning reflect - #32

Merged
Ardnived merged 4 commits into
mainfrom
claude/feat-adversarial-review-rung
Sep 2, 2026
Merged

Ardnived merged 4 commits into
mainfrom
claude/feat-adversarial-review-rung

Conversation

@Ardnived

@Ardnived Ardnived commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New rung 5 — adversarial review: leftover-budget-only critic pass on every green-CI, loop-authored PR before Ardnived reads it; Survey→6, Journal→7.
  • New /workflow:adversarial-review skill: holistic, profile-driven, COMMENT-only, always in a fresh subagent; findings hand the PR back to the bot, rung 2 gains the author filter's one structural exception.
  • reflect now reads Ardnived's actual review comments weekly and refines the seeded reviewer-profile.md on recurrence — intent, not incident — and carries small lessons out to product repos as ticketless doc PRs or proposal issues.

Test results

  • Lean gate: ✓ claude plugin validate ./workflow --strict
  • JSON: ✓ loop-config.json, .claude/workflow.json parse
  • Rung-5 census query run live: ✓ returns 3 real candidates today (SahajCloud#676, #675, WeMeditateWeb#72)
  • Renumbering swept: no stale rung 5/6 references outside the new meanings

Manual verification

  1. Before merge — MCP probe (blocking): from a cloud session, in a Task subagent, confirm create_pending_pull_request_review / add_comment_to_pending… / submit_pending… resolve and can submit event:COMMENT on a scratch claude/probe-review PR, and that thread resolution works. If absent, the skill's issue-comment fallback becomes the primary path — say so in the skill before merging.
  2. /workflow:loop-run --dry-run locally: rung 5 prints its two-group worklist and stops.
  3. After merge: fire sydevs-loop manually, read journal and transcript — review ran in a spawned subagent, one review, correct verdict path, 🧐 journal line. Second run confirms idempotency; first Sunday confirms reflect's new queries ran and the signal gate held.

Notes for reviewer

  • The reviewer profile is a portrait of you (workflow/skills/adversarial-review/reviewer-profile.md), seeded from your full review history (55 inline comments, 32 reviews, 33 PR comments). Correcting it in this review is its first calibration pass.
  • Merge-order warning: claude/branch-alias-and-journal-title rewrites loop-run/SKILL.md, loop-config.json, why.md and routine-setup.md. Whichever lands second must be re-merged carefully — in particular the rung renumbering and its scripted merge gate (rung 5's "green by rung 1's definition" should switch to workflow/lib/merge-gate.mjs once that lands).
  • The one attended edit: .claude/workflow.json securityReview pattern widened so reviewer-profile.md (an instruction surface) triggers the branch security review.
  • Judgement call to check: rung-5 findings can block rung 1's merge until threads resolve even after your approval — treated as a feature (findings get dispositioned); you can resolve any thread yourself to unblock.
Detail
  • Structural key over marker string: the rung-2 carve-out and the once-ever idempotency both rest on "the loop starts review threads in exactly one place", so inline review comments are rung 5's exclusive channel; review.bodyHeader matters only in the no-MCP-tools fallback, where an issue comment is invisible to get_reviews.
  • Why leftover-budget-only: a reserved slot would tax merge/revise/implement, which serve the reviewer more directly; starving on busy days is accepted (why.md#the-adversarial-review-runs-last-and-may-starve).
  • Why a fresh subagent even for older PRs: waiting a run was only a proxy for fresh eyes; the empty-context subagent is the real thing, so same-run PRs are eligible.
  • Profile corpus caveats recorded in the file: claude-workflow PRs merge without formal reviews; pre-2026-08-29 comments under your login include loop-written text and were excluded by voice.
  • Alternatives rejected: a distinct reviewMarker string (drifts, leaks, forgettable), a nightly review sweep and a reserved slot (both re-tax the budget), re-reviews after revisions (a bot arguing with itself doubles your reading).

Ardnived and others added 4 commits September 2, 2026 11:03
…er profile

A critic-side pass on loop-authored PRs, distinct in kind from finalize-pr's
author-side six-lens review: that pass asks "is this code good", this one asks
"should this PR exist in this shape". Two lenses carry the weight - simplicity
and scope measured against the linked ticket, and cross-repo contract surfaces
read from the consumer side - because those are what the human reviewer's own
history shows they care about most.

The skill is holistic on purpose. Its only criteria are a short stance and the
sibling reviewer-profile.md, a model of how Ardnived actually reviews, seeded
from the full backfilled history of their review activity across the five
repos (55 inline comments, 32 reviews, 33 PR comments). The profile is data,
not a checklist: the Sunday reflect rung refines it on recurring evidence, so
the review learns the reviewer's intent rather than accumulating DO/DONTs.

Reviews are always COMMENT-event (GitHub forbids stronger self-reviews, and
approval authority stays with the reviewer), always in a fresh context (the
skill carries context:fork, and rung 5 spawns it in a clean subagent - a
critic that inherits the builder's reasoning inherits its blind spots), and
once ever per PR. No Edit or Write in allowed-tools: a critic with a keyboard
is an author.

The failure this prevents: every loop PR today waits on the reviewer for its
first genuinely critical read, so scope creep and contract breaks are found at
the most expensive moment - by the human, at approval time.

Co-Authored-By: Claude Fable 5 <[email protected]>
New last-priority rung in loop runs, renumbering Survey 5->6 and Journal 6->7.
It spends only leftover maxWorkItemsPerRun budget - no reserved slot, no new
ceiling - so on a saturated day it starves, and that is the design: every rung
above it serves the reviewer more directly, and a pre-filter is worth exactly
the budget nothing else claimed.

Worklist is one server-side query (is:pr author:<bot> -reviewed-by:<bot>,
green CI by rung 1's definition), prioritising PRs already handed to the
reviewer over bot-assigned ones, deferring PRs mid-revision. One review per
PR ever, keyed on an own-login review read from get_reviews just before
writing - search is a derived index and lags. Each review runs in a fresh
Task subagent handed only the PR's coordinates, never inline: the review must
not share the implementer's context.

Rung 2 gains the author filter's one exception, keyed structurally rather
than by marker string: an unresolved review thread whose root comment is the
own login can only be the adversarial review, because starting review threads
is rung 5's exclusive privilege - bot replies inside a human's thread keep a
human root and stay excluded. The review block in loop-config carries the
body header (the fallback-only idempotency key) and the profile path.

Stories for all six new rules live in docs/why.md; README and routine-setup
pick up the renumbering and the new supervised-bootstrap case.

Co-Authored-By: Claude Fable 5 <[email protected]>
…e, reach product repos

Reflect's friction table has always carried "the same review comment
recurring" as a signal, but nothing in its Evidence section could produce
that observation - it never read review-comment text at all. Now it does: one
reviewed-by:<reviewer> query over the window (previous reflection PR's merge
date, else seven days), then the review bodies and inline comments, read as
text rather than counted.

Three new signal rows close the review-rung feedback circuit: a reviewer
theme recurring across 2+ PRs, a substantive catch on a PR the adversarial
review passed clean (a profile gap), and bot findings the reviewer overrode
(over-flagging - trim the profile, not the code). Profile edits are gated on
recurrence and written at the level of intent, not incident: the question is
what value made the reviewer write those comments, so the review generalises
to cases the week never showed. One comment is weather.

Lessons that belong to a product repo follow the evidence out: small doc and
CLAUDE.md corrections as direct ticketless PRs (their allowlists already
cover **/*.md; never under .claude/, which stalls unattended runs), anything
structural as a proposal issue under the existing ceiling.

Also fixes the hard-coded repo:sydevs/claude-workflow journal query - org and
repo now come from loop-config like everywhere else - and states the
skill-vs-ceiling PR split as a hard rule reflect itself must honour.

Co-Authored-By: Claude Fable 5 <[email protected]>
… review

The trigger pattern covered SKILL.md alone, but sibling files are instruction
surfaces too: the new reviewer-profile.md steers what the adversarial review
flags and ignores, and pr-template.md shapes every PR body. An injection into
either reaches an agent holding write access to five repos just as surely as
one into a SKILL.md. Widened workflow/skills/<name>/SKILL.md to
workflow/skills/<name>/<any>.md.

Co-Authored-By: Claude Fable 5 <[email protected]>
@Ardnived
Ardnived merged commit dcd6986 into main Sep 2, 2026
Ardnived added a commit that referenced this pull request Sep 2, 2026
Both sides were largely additive; four files conflicted and three of the
resolutions were judgement calls worth recording.

**The CI-green rule now has one home.** #28 landed the same fix as this branch,
as prose, with its own `why.md` anchor — so main and this branch each carried a
statement of what "green" means, plus `merge-gate.mjs` implementing it. Deleted
my anchor in favour of main's `#ci-truth-lives-in-check-runs`, which is the
better write-up (it also reasons about `skipped`/`neutral` and about why the
mirror-image status clause is deliberately absent), repointed the citations, and
cut rung 1's restatement down to a pointer at the script. The implementation was
checked against main's prose clause by clause: they agree.

**Kept #32's `review` block, dropped its essay.** A four-sentence `$comment`
explaining the fallback idempotency key is a rule, and rules live in the skill
that enforces it — `adversarial-review/SKILL.md` already says all of it.

**Fixed a bug #32 inherited rather than introduced.** Its rung-5 census, its
proposal-ceiling check, its dropped-baton sweep and reflect's new review query
all scope `org:$ORG`. The org still holds retired repositories, and that scope
put seven-year-old Atlas and WeMeditate issues into the reviewer's queue the
first time it was run as a real query. Every search in both skills now uses
`$SCOPE`, built from `repos`, and the rule is stated once at rung 0.

**Rung 5 no longer restates the green rule or hardcodes a repo fact.** It said
"claude-workflow is the one exception: it has no CI" — which `merge-gate.mjs`
derives from the workflow count, so it cannot go stale the day someone adds a
workflow.

Two more things this pass found, neither from #32:

- The journal body still carried a `## This month` table from the era of monthly
  journal issues. The journal has been one issue per day since the baton work; a
  day's body cannot summarise a month, and the Sunday reflect rung is what reads
  across issues.
- The awaiting-you table went into the per-run comment while the BODY — the
  surface the reviewer actually reads, and the one the rules single out as
  "never leave stale" — kept bullets. Both are tables now.

`identity.mentionQuery` removed: nothing reads it since rung 0 spells the query
out, and a config key no code reads is exactly what the values-only rule exists
to prevent.

Co-Authored-By: Claude Opus 5 <[email protected]>
Ardnived added a commit that referenced this pull request Sep 2, 2026
Same audit as loop-config.json, applied to the five `.claude/workflow.json`
files. Every key was checked against what actually reads it: the hooks read
`packageManager` and `generatedFiles`; the skills read `leanGate`,
`securityReview`, `prAllowlistGlobs`, `devServer`, `worktreeSetup`,
`contractStep` and `deployTarget`. Nothing read any `*Note` key.

Dropped, all five repos: `prAllowlistNote` — a restatement of a rule
`implement-issue` already carries. Plus, in claude-workflow, `packageManagerNote`,
`selfModificationNote` and `journalNote`, each of which duplicates a section of
AGENTS.md, and in SahajCloud `worktreeSetupNote`, whose story is in
`docs/rules/testing-reqs.md`.

**The duplication had already gone wrong.** `approved` was renamed to
`ready-to-implement` some time ago; four repos' `prAllowlistNote` were updated
and SahajCloud's was not, so it has been describing a label that does not exist.
That is the whole argument for values-only, in one key.

AGENTS.md carried "`selfModificationNote` states the same rule; keep the two in
agreement if you change either" — an instruction to maintain a copy by hand, in
the repo whose failure history is copies drifting. The copy is gone.

`worktreeNotes` stays. It is one line of per-repo operational fact (which env
file a fresh worktree needs), it qualifies the `worktreeSetup` value it sits
beside, and two of the three repos document it nowhere else — a bare value that
is ambiguous on sight is exactly what a one-line comment is for.

claude-workflow's securityReview rationale, three sentences after #32, is back to
one.

Co-authored-by: Claude Opus 5 <[email protected]>
Ardnived added a commit that referenced this pull request Sep 2, 2026
…ne over shared bookends (#35)

* refactor(loop): rung means one thing — split the two routines into two run skills

The survey routine and the working-day loop diverged long ago — the survey was
split out precisely so a busy queue could not starve it — but both kept
sharing one skill file and one rung numbering. That numbering described a
ladder no run ever descended: the nightly run executed "rung 6" without
climbing 1-5, the loop run stepped over 6 on its way to 7, and preflight and
journal wore rung numbers despite being every run's bookends rather than
priority steps of anything. The costs were concrete: adding one loop rung
(#32) forced a renumbering sweep across four files for a nightly run that had
not changed, and the nightly run's spec formally omitted preflight - auth,
identity, ceilings - because "rung 0" read as the ladder's business.

Now: two run skills over shared bookends.

- preflight - ground rules (prompt-not-spec, writing style, non-negotiables,
  never-subscribe) plus run start (auth, identity, capability limits, census).
  Explicitly both runs': the nightly run's missing preflight is fixed by
  construction.
- journal - the whole journal spec and the run's ending, shared verbatim.
- loop-run - the ladder alone, rungs 1-5 keeping their numbers, so every
  existing rung citation (docs/why.md#rung-2-competes-for-the-same-budget,
  finalize-pr's "rung 1", adversarial-review's "rung 5") stays true. Keeps a
  redirect: a prompt still carrying RUN_KIND=nightly is sent to nightly-run,
  so the stored nightly prompt cannot silently lose its survey while it
  awaits updating.
- nightly-run - survey dispatch and the reconciliation sweeps, stated as what
  it is: a fixed set of once-a-day tasks, not a ladder, no rungs.

In passing: deduplicates rung 1's verdict table and mergePolicy paragraphs
(a #30/#32 merge artifact stated everything twice), removes the duplicated
"GitHub metadata" heading in routine-setup, and corrects surveyCalendar's
comment - surveys are dispatched by the nightly run, not "morning runs".

The nightly routine's stored prompt should be repointed at
nightly-run/SKILL.md after this merges; routine-setup documents that, and the
redirect covers the gap.

Co-Authored-By: Claude Fable 5 <[email protected]>

* refactor(loop): name the run skills for what they do — queue-routine and survey-routine

loop-run and nightly-run named when and how the skills ran, not what they
did — and "loop-run" doubly so once the nightly routine stopped being part
of any loop pass. The queue routine advances the work queue (the assignee
field IS the worklist): merge, revise, implement, review. The survey routine
surveys: the day's calendar survey plus the reconciliation sweeps that keep
the queue honest.

Directory renames carry merge-verdict.mjs along; frontmatter names, the
${CLAUDE_PLUGIN_ROOT} script path, the nightly-prompt redirect, loop-config
comments, README, routine-setup, AGENTS.md, and the why.md section heading
(now covering all four run-adjacent skills) all follow. The system-level
name — "the loop", loop-config.json, the identity marker — stays: that names
the whole machine, not a skill.

Co-Authored-By: Claude Fable 5 <[email protected]>

* chore(loop): keep a transition pointer at the old loop-run path

Both stored routine prompts name the path workflow/skills/loop-run/SKILL.md,
and routines clone main fresh each run - so the moment the rename merges,
every run would open a path that no longer exists, hourly, until someone
updates the prompts. The stub redirects each routine to its new skill,
journals that it was used (the signal the prompts still need updating), and
says to delete itself once both prompts point at the new paths.

Co-Authored-By: Claude Fable 5 <[email protected]>

* refactor(loop): work-routine replaces queue-routine; new routines replace the prompt shim

Renamed the working-day skill to work-routine and removed the loop-run
transition stub: instead of shimming the old path, the cutover is two new
cloud routines created alongside the old ones - sydevs-work-hourly
(trig_01BUwH4WjazMXjG2bnC3TVRL) and sydevs-survey-nightly
(trig_01WzJ2EnTKEk9BJ2Xf6AQ4x6) - same schedules, same environment, same
tool set, created paused. Their prompts point straight at the new skills and
enumerate no rungs; the old routines' prompts had drifted ("rungs 0 through
4, then rung 6"), which is the staleness their own text warns about. The
reviewer enables the new pair and deletes the old pair, so no run ever reads
a path that does not exist.

routine-setup now records the real stored prompt verbatim, the new ids, and
which predecessors to delete; the RUN_KIND redirect is gone from
work-routine along with the rest of the shim.

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
@Ardnived
Ardnived deleted the claude/feat-adversarial-review-rung branch November 13, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant