Do issue solo

From thermiteau/maverick · View interactive version

Do issue solo is an AI agent skill from the GitHub repository thermiteau/maverick. Work on a GitHub issue end-to-end autonomously, only pausing when blocked or when clarification is needed.

How to use this skill

Skill file

Work on GitHub Issue (Autonomous)

Work on GitHub issue $ARGUMENTS autonomously, coordinating safely

with any other Maverick instance that might also hold a claim on this

issue. Follow every phase in order. Only pause to ask the user when you

are blocked or need clarification.

Preflight (mandatory)

Preflight output, captured when this skill was invoked (dynamic-content

pilot — the command ran before you read this):

!uv run maverick preflight do-issue-solo 2>&1 && echo PREFLIGHT_OK

not proceed, do not work around missing prerequisites.

disabled via disableSkillShellExecution) → run it manually first and

apply the same rules:

```bash

uv run maverick preflight do-issue-solo

```

The check verifies: the project is initialised, the Maverick GitHub

App is configured (maverick gh-app status reports configured: true),

and required tools (gh, git, uv) are on PATH.

Before You Begin

If $ARGUMENTS is empty or not a valid issue number, ask the user

for the issue number before proceeding.

Determine the repo (via gh repo view --json nameWithOwner) — you will

pass it to every maverick coord command below.

PR code review runs locally during Phase 9 as the

agent-code-reviewer subagent — its binary PASS/FAIL

verdict is the gate. Some projects also opt into a CI-side re-run via

mav-bp-remote-code-review (independent verification for

multi-machine fleets or audit needs); when present it adds a status

check the auto-merge in Phase 10 will wait on, but its absence is not

a blocker.

Dispatching agents

You are the story agent. Your context is re-read on every call you make,

so keep it for coordination: claims, checkpoints, verdicts, task

bookkeeping. The work that reads code and runs commands — design,

planning, implementation, fixes, docs, reviews — goes to subagents, and

you keep only what they return.

```bash

uv run maverick agent-model <agent-name>

```

A non-empty result is the project's agent_models choice for that

agent: pass it as the dispatch's model override. An empty line means

no route: dispatch without an override, so the agent keeps its own

pinned model or inherits yours. Look the routes up once (run it with no

argument for the full list) and reuse them for the rest of the story.

foreground and you wait for its result. A story agent that ends its

turn while a subagent runs in the background is never woken, and the

story stalls.

stop reading files and command output yourself: hand anything that

needs them to agent-implementer (or the relevant agent)

and keep only its summary.

lint or build command yourself, send its output to a log under

.maverick/tmp/ in the worktree and read back only the exit status,

the summary lines and the failures (tail, grep), never the whole

log.

Phase 0: Coordination + cold-start

Before any other phase.

  1. Run uv run maverick coord read <repo> $ARGUMENTS and inspect

the snapshot. Decide which of the four branches in

mav-multi-instance-coordination applies:

  1. Claim the issue: uv run maverick coord claim <repo> $ARGUMENTS.

The command exits non-zero if the claim is rejected — treat that as

abort.

  1. Start the workflow report (writes a run-start row that later

report calls inherit maverick_skill from):

```bash

uv run maverick report run-start do-issue-solo --issue $ARGUMENTS --phase claimed

```

From here, agent-dispatch intervals are recorded automatically by

the plugin's hooks (open on dispatch, closed on return), and

invoking a tracked inner skill auto-opens its skill-dispatch

interval. Your only bookkeeping obligation is the one-line

report end --auto --outcome <…> after each inner skill returns —

everything else is hooks. Anything left open is flushed as

outcome=unknown by report generate.

Attribution marker (mandatory). Every agent you dispatch and every

inner skill you invoke from here on must carry the line

maverick-issue: $ARGUMENTS — at the end of the agent prompt, or

appended to the skill's arguments. When this run is one story of an

epic, the session holds several claims at once and the marker is how

the hooks know which story's report a dispatch belongs to. Without

it, the dispatch is not recorded.

  1. Start the heartbeat daemon. It refreshes the lease every

HEARTBEAT_INTERVAL_MINUTES minutes for as long as you hold the

claim and exits on its own when the claim is released:

```bash

uv run maverick coord heartbeat-loop <repo> $ARGUMENTS --daemonize

```

Never background the foreground loop with & — a process

backgrounded from a tool shell dies with the shell or leaks

unobservably. Liveness is checked in the task loop with

coord heartbeat-status.

  1. Release is handled on every exit path without any action from you:

the plugin's SessionEnd hook runs coord release-all when the session

ends (normal exit, user interrupt, crash-caught), and lease expiry

(10-minute TTL) covers machine death. Your only release obligations

are the explicit ones at workflow boundaries: --reason merged

after auto-merge lands, --reason ejected on eject. Do not attempt

trap-on-exit wrappers — each Bash call is a fresh shell, so a trap

cannot survive to session end.

  1. Authorization scopes (only when needed): if the issue explicitly

authorizes infrastructure changes — the maverick-authorize-infra

label or a Maverick-Authorize: infra line in the issue body — record

it so the scope-guard hook permits those edits in autonomous mode:

```bash

uv run maverick coord authorize <repo> $ARGUMENTS infra

```

If the command exits non-zero, the issue does not authorize the

scope: do not make infrastructure changes; note the gap in the

solution design instead. Never write .maverick/session-auth.json by

any other means — the hook blocks it, and self-granting defeats the

authorization model.

  1. Cold-start hydrate per mav-durability-on-gh. The

skill is fully resumable — a fresh agent re-entering after a crash,

stop, or context-exhaustion must skip phases that already completed

rather than re-running them against an in-flight or merged PR (#41).

Do not reconstruct the resume position by hand:

```bash

uv run maverick coord resume-point <repo> $ARGUMENTS

```

The command reads the task-progress marker, finds the PR via the

recorded branch, inspects CI and the review verdict, and returns

{next, instruction, evidence} — follow the instruction. Also check

for an existing worktree under .maverick/worktrees/ before creating

one. Each phase below ends with a task-progress set write so

re-entry advances one boundary at a time without re-running anything.

Phase 1-2: Understand the Issue and Solution Design (subagent)

Run Phases 1 and 2 as a subagent to keep the main context window clean for

implementation.

  1. Refresh the local base branch before the analyst reads anything.

The analyst runs against the main checkout — Phase 4 hasn't created

the worktree yet — so a stale local base lets pre-resolved

ambiguities slip into the design pass and surface as phantom

blockers (#102). Follow the "Base Branch Freshness" rule in

mav-git-workflow:

```bash

STORY_BASE=$(uv run maverick git-workflow story-base)

git fetch origin "$STORY_BASE"

CURRENT=$(git rev-parse --abbrev-ref HEAD)

if [ "$CURRENT" = "$STORY_BASE" ]; then

git pull --ff-only origin "$STORY_BASE"

else

git fetch origin "$STORY_BASE:$STORY_BASE"

fi

```

If either form refuses a non-fast-forward, halt and report to the

user — there are local commits on $STORY_BASE that have not been

pushed, which violates trunk-based discipline.

  1. Dispatch the agent-issue-analyst agent with:

(The dispatch interval is recorded by the plugin hooks — no

report calls needed.)

  1. When the agent returns, verify the design landed durably —

uv run maverick task-progress read <repo> $ARGUMENTS shows

comments.design set to a comment ID (the analyst posts it via

uv run maverick issue comment post --kind design).

  1. If the agent flagged ambiguities it could not resolve:

Otherwise continue.

  1. Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS design.

Phase 3: Create Tasks (subagent)

Run Phase 3 as a subagent.

  1. Dispatch the agent-github-issue-planner agent with:
  1. When the agent returns, verify the tasks landed durably —

uv run maverick task-progress read <repo> $ARGUMENTS shows:

uv run maverick issue comment post --kind tasks)

  1. If the agent flagged scope concerns:
  1. Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS tasks

(append --has-sub-issues when the >= 5 tasks path was taken).

Phase 4: Create Worktree + Branch

The branch is created inside a dedicated worktree, not in the main

checkout.

  1. Derive the branch name per the mav-github-issue-workflow skill.
  2. Resolve the base branch from the project config:

```bash

STORY_BASE=$(uv run maverick git-workflow story-base)

```

merged, stack per mav-stacked-prs — base = sibling branch.

  1. Create the worktree: uv run maverick worktree create <branch> [--base <sibling-branch>].

From this point on, all file edits happen inside the worktree path.

  1. Note the current directory as the main checkout path (Phase 10

returns there before destroying the worktree), then cd into the

worktree path for the rest of the story.

  1. Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS branch --branch <branch>

(recording the branch is what lets coord resume-point find the PR later).

Phase 5: Execute Tasks (push after every task)

Push after every task, not at the end. See

mav-durability-on-gh.

Each task is implemented by a **fresh agent-implementer

subagent**, not in your own context. The implementer reads the code,

runs /do-code, verifies, commits and pushes; you keep

only its summary and the per-task bookkeeping. Do not read the task's

source files or its test output yourself.

For each task (sub-issue or checklist item), in order:

Each step below is its own obligation. When the implementer returns in

step 1, do not stop — continue with step 2. Its return is a

hand-back, not a task-complete signal (#106).

  1. Dispatch agent-implementer in the foreground (with

its agent-model route, if any) with:

sub-issue states it

The agent-dispatch interval is recorded by the plugin hooks, and the

implementer closes the skill-dispatch interval its

/do-code call opened, so there is no report end for you

here.

  1. Read the result block (## Implementer result).

pushed: no — halt the per-task loop (the implementer never

commits red). Record it, then decide: re-dispatch once in fix

mode with the reported failure, or surface it to the user if the

cause is outside the issue's scope:

```bash

uv run maverick report note --issue $ARGUMENTS --phase implement \

--text "task <n>: <status> — <one line from the result>"

```

note it the same way, and carry follow-ups to "Follow-up Issues".

  1. Log the commit to the workflow report, from the result's commit

and subject (the timestamp is wall-clock at this call):

```bash

uv run maverick report commit --issue $ARGUMENTS \

--phase implement --sha "<commit>" --subject "<subject>"

```

  1. Check the task off durably — uv run maverick tasks check <repo> $ARGUMENTS <n>

(or close the sub-issue). Never PATCH the comment body by hand.

  1. Verify the heartbeat daemon is alive:

uv run maverick coord heartbeat-status <repo> $ARGUMENTS — if it

reports not running, treat it as claim-lost: stop pushing, re-run the

Phase 0 entry check before continuing.

After the last task, run the full verification suite once more, output

to a log and read back failures only (see "Dispatching agents"). If it

fails, dispatch the implementer in fix mode with the failing lines

only, then run the suite again.

Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS implement.

Follow mav-plan-execution for the broader execution loop,

verification discipline, failure handling, and crash recovery.

Phase 6: Documentation Review (mandatory)

This phase always runs before the PR is opened. There is no skip

path — the heuristic-gated version used to let stale docs ship when

Claude's affected-or-not call was wrong. The agent decides whether

work is needed; the workflow decides whether the agent runs.

The agent is dispatched with a pre-filtered shortlist of docs the

change plausibly touches, not the open-ended "audit every doc" brief

that made this phase the longest single subagent cost on prior issues.

Docs that belong to someone else (configured in docs.owners) are

never edited by the docs writer: drift in them is routed to their

owner in step 4, not left as a PR note nobody acts on.

  1. Build the diff and candidate-doc shortlist in one deterministic step:

```bash

uv run maverick docs shortlist \

--base "$(uv run maverick git-workflow story-base)" --issue $ARGUMENTS

```

The JSON output names the files it wrote (diff, shortlist,

detail) in a per-worktree directory, so parallel stories never

overwrite each other's — always use the paths it prints, never a

fixed /tmp path. Candidates come from three sources: words from the

diff, docs/ paths the issue cites, and the repo's own

docs.shortlist_commands (e.g. a route → help-topic map). owned

lists shortlisted docs that belong to a docs.owners entry. Print

any warning: lines in the run notes. An empty shortlist is a valid

input to step 2.

  1. Dispatch agent-tech-docs-writer with (interval

recorded automatically by the plugin hooks):

empty, pass the literal string

<empty — scan only for gaps requiring new coverage>.

step 1, if any.

the diff; do not refactor unrelated content.

editable: true. Report what is stale in it instead.

change with no coverage anywhere in docs/, create the new

document.

believe is impacted, **list its path in your return payload —

do not edit it.** One-pass dispatch: no widen-and-retry.

what is stale), other impacted docs not edited. Returning "no doc

changes required" is a valid outcome and must be stated

explicitly (not silently inferred).

  1. Commit any doc changes with a docs: conventional commit and push

per the push-per-task rule. If a commit was made, log it so the

docs phase row gets its own sub-row in the report:

```bash

SHA=$(git rev-parse HEAD)

SUBJECT=$(git log -1 --pretty=%s)

uv run maverick report commit --issue $ARGUMENTS \

--phase docs --sha "$SHA" --subject "$SUBJECT"

```

  1. Route drift the writer could not fix. Look up owners for every

path the writer reported but did not edit:

```bash

uv run maverick docs owners <path> [<path> ...]

```

product-owner agent) with the diff path, the stale docs and what

the writer said is stale, plus maverick-issue: $ARGUMENTS.

Commit and push whatever it changes as in step 3.

issue listing the docs and what is stale, labelled with the

entry's label (default docs-drift), referencing this issue:

uv run maverick gh-app gh -- issue create --title "Docs drift from #$ARGUMENTS" --label <label> --body-file <file>.

Create the label first if it doesn't exist.

A PR-body note alone is not enough: nobody acts on those.

  1. Record the outcome in the PR body draft so the gate is auditable

(`Docs review: <n> updated, <n> routed to owners, <n> follow-up

issue(s) or Docs review: no changes required.`), and as evidence

in the report — the evidence note is what distinguishes a genuine

no-op from a skipped step:

```bash

uv run maverick report note --issue $ARGUMENTS --phase docs \

--text "shortlist=<n> (terms <n>, issue <n>, command <n>) updated=<n> owned-drift=<n> followups=<links or none>"

```

  1. The PR cannot proceed to Phase 7 until this phase has produced

either committed doc changes or the auditable no-op record.

  1. Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS docs.

Phase 7: Pre-PR Security Review (mandatory, independent)

This phase always runs before the PR is opened. There is no skip

path. The review is done by agent-security-reviewer — a

read-only agent with a fresh context — not by you. You wrote the code;

reviewing it yourself is the author checking their own work. The agent

applies the project's security checklist from docs/maverick/skills/,

runs the project's invariant checks, and reviews the changed code plus

its impact set.

  1. Refresh the diff (Phase 6 may have added doc commits):

```bash

uv run maverick docs shortlist \

--base "$(uv run maverick git-workflow story-base)"

```

and use the diff path it prints.

  1. Dispatch agent-security-reviewer with (interval

recorded automatically by the plugin hooks):

Do not tell it what you think is safe or explain your design

choices; it must reach its own conclusions from the code.

  1. Parse the verdict from the marker line only. The reply must end

with exactly one MAVERICK_SECURITY_VERDICT: PASS|FINDINGS|BLOCKING

line. Missing, ambiguous or repeated with conflicting values → treat

as BLOCKING.

  1. Record the evidence (verdict, files reviewed, checklist and

checks counts, from the agent's JSON):

```bash

uv run maverick report note --issue $ARGUMENTS --phase security \

--text "verdict=<V> files=<n> checklist=<n pass>/<n> checks=<n failed>/<n> findings=<n by severity>"

```

  1. Act on the verdict:

dispatching agent-implementer in fix mode with that

finding only (severity, location, description, recommendation),

then handle its result as in Phase 5 steps 2–3 and re-run this phase

from step 1. If a finding cannot be fixed within the issue's

scope (it needs an auth or infrastructure change the issue does not

authorise, or a product decision), halt and surface the findings to

the user verbatim.

(a sanitiser, a parser, a key scheme). After two rounds on the

same one, stop refining it: a third finding there means

point-patches are chasing edge cases. Either switch it to a

fail-closed design (refuse, redact or withhold anything it cannot

classify with certainty) and run this phase once more, or halt and

surface the remaining findings to the user. Never start a third

narrower regex or parser rule for the same mechanism. Record the

count in the step 4 note as rounds=<n>.

body draft listing each finding (severity, location, description,

recommendation). The PR may proceed to Phase 8 with these items

visible to the human reviewer and to agent-code-reviewer.

Any finding the PR leaves unfixed gets a follow-up issue per

"Follow-up Issues" below.

summary>).` in the PR body draft so the gate is auditable.

  1. The PR cannot proceed to Phase 8 until this phase has returned a

non-BLOCKING verdict and the outcome has been folded into the PR

body draft.

  1. Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS security.

Phase 8: Open PR + Monitor CI

  1. Pre-push verification per mav-local-verification — a final

green check before asking for review. Output to a log, failures only;

a failure goes to agent-implementer in fix mode.

  1. Stacked-PR retarget check per mav-stacked-prs if the branch

stacks on a sibling. Retarget before opening the PR if the sibling is now

merged.

  1. Resolve the PR target from config:

```bash

PR_TARGET=$(uv run maverick git-workflow pr-target)

```

Open the PR as a draft. Phases 8–10 still have gates to run, and

an open, non-draft PR looks finished: a human can't tell "an agent is

still working on this" from "ready for you", and GitHub will merge

either. GitHub refuses to merge a draft, from the button and from

gh pr merge. The PR is marked ready only in Phase 10, once it is

settled, or in Phase 11 when it is handed to a human.

The body must end with a literal Closes #$ARGUMENTS

line (capitalised; not Refs, Related to, or any other phrasing).

gh pr merge --squash carries the PR body verbatim into the squash

commit body; GitHub only auto-closes the linked issue when one of

Closes/Fixes/Resolves appears in a commit on the default

branch. If multiple PRs land via a non-squash promotion (Gitflow:

develop → main), each squash commit's body is what GitHub scans

— so omitting the keyword on a single PR leaves that story open

even after promotion (#56). Use Refs #N only for cross-references

to other issues, never for the primary story:

```bash

gh pr create --draft --base "$PR_TARGET" --head <branch> \

--title "<conventional title referencing #$ARGUMENTS>" \

--body "$(cat <<'PR_EOF'

## Summary

<1-3 bullet points>

Closes #$ARGUMENTS

PR_EOF

)"

```

  1. Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS pr_open.
  2. Monitor CI with a bounded wait:

```bash

uv run maverick pr wait <repo> <pr-num> --checks --timeout 30m

```

per mav-bp-cicd (read the failures, not the whole

log: gh run view <run-id> --log-failed | tail -n 60), dispatch

agent-implementer in fix mode with those lines only,

handle its result as in Phase 5 steps 2–3, then re-run the wait.

that never reports blocks auto-merge too); report to the user if

it cannot be resolved.

Do not proceed to Phase 9 until the wait exits 0. The PR stays a

draft through these fixes. If the project's CI skips draft PRs, the

wait finds no checks and exits 0, so CI is checked again after

Phase 10 marks the PR ready. That only works if the CI workflow

triggers on the ready_for_review event as well as the defaults.

  1. Browser/UI verification is non-blocking. If the change touches UI

and Claude's global instructions or a project skill ask for browser

verification, run it with a strict timeout (e.g. 5 min total). On

hang, timeout, or failure, post the outcome as a non-blocking PR

comment and proceed to Phase 9 — do not wait indefinitely (#41).

Phase 9's reviewer is the binding gate; CI is the binding regression

check; ad-hoc browser runs are advisory.

  1. Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS ci_green.

Phase 9: Code Review (binary, hard gate)

The local agent-code-reviewer subagent's verdict is the

review gate the auto-merge path trusts. This is a binary verdict against

the open PR, not a local-diff advisory loop.

  1. Dispatch agent-code-reviewer with (interval

recorded automatically by the plugin hooks):

  1. Parse the verdict from the marker line only. The agent's reply

must end with exactly one MAVERICK_VERDICT: PASS or

MAVERICK_VERDICT: FAIL line — that line is the verdict; do not

infer it from the prose above it.

attempt to auto-fix.

conflicting values** — treat as FAIL and eject. Do not re-dispatch

the reviewer to "get a cleaner answer", and never substitute your

own reading of the review body for a missing marker.

  1. Record the evidence:

```bash

uv run maverick report note --issue $ARGUMENTS --phase review --text "verdict=<PASS|FAIL> <one-line reason>"

```

  1. Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS review.

There is no fix-and-re-review loop. If the reviewer FAILs the PR, the

next step is eject-to-human, not iterate.

Phase 10: Auto-merge (on PASS)

  1. Verify the PR body still carries the closing keyword. The body

becomes the squash commit body, and the closing keyword must survive

into the commit that lands on the default branch (#56). If the body

was edited after Phase 8 — by a reviewer, by another subagent, or by

a force-push — re-add the line before merging:

```bash

uv run maverick gh-app gh -- pr view <pr-url> --json body -q .body \

| grep -Eq '(Closes|Fixes|Resolves) #$ARGUMENTS\b' \

|| { echo "PR body missing 'Closes #$ARGUMENTS' — re-add before merging"; exit 1; }

```

  1. Auth-path gate (hard). Never auto-merge a PR that touches

authentication/authorization surfaces or CI workflow definitions —

those require human review regardless of the code-review verdict:

```bash

uv run maverick pr auth-scan <repo> <pr-num> --security-verdict <PASS|FINDINGS|BLOCKING>

```

Pass the verdict Phase 7 recorded for this diff, exactly as the

marker gave it. Test files and comment-only changes are cleared by

the scan itself. Only a project that set `scope_guards.auth_scan:

"advisory"` treats auth-path hits as advisory, and then only with

PASS; CI workflow definitions always gate.

like a review FAIL: follow the eject path (apply needs-human,

post the scan output as a comment, release the claim) and stop.

than merging unverified.

  1. Settle, then mark the PR ready. Ready is the handoff: it tells a

human the agent is done, and it is the last step before approval and

auto-merge (GitHub can't enable auto-merge on a draft). Before it:

browser check, a background job, a subagent, a migration

regeneration;

commit Phases 8 and 9 checked.

Then let the CLI confirm the pushed head has passed its checks and

flip the PR:

```bash

uv run maverick pr ready <repo> <pr-num> --expect-head "$(git rev-parse HEAD)"

```

uv run maverick pr wait <repo> <pr-num> --checks --timeout 30m,

then re-run.

that was reviewed (push any local commits first). The PR is still a

draft and is not settled: go back to Phase 8 step 5 for the pushed

head, then re-run Phase 9 against it.

Then wait for checks once more, before approving. A project whose CI

skips drafts only starts it now, and auto-merge waits only for

required checks:

```bash

uv run maverick pr wait <repo> <pr-num> --checks --timeout 30m

```

Exit 0 continues. Exit 5 (failed) or 3 (timed out): put the PR back

to draft (uv run maverick pr ready <repo> <pr-num> --undo), then

handle it as in Phase 8 step 5 and re-run Phase 9.

Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS settled.

Re-entry. Once the PR is ready, any change to the branch — a

conflict resolution, a base-branch merge, a migration regeneration —

first puts it back to draft, before its first commit:

```bash

uv run maverick pr ready <repo> <pr-num> --undo

```

This also turns auto-merge off, so an approval left from the last

pass cannot merge the new head. Then go back through Phase 8 step 5,

Phase 9 and this step. Dispatch a fresh

agent-code-reviewer for the re-run of Phase 9, and tell it

which commits are new since its last PASS: it may narrow its review

to those commits, because that PASS completed both stages. The

commonest case is auto-merge stalling because branch protection

requires the branch to be up to date with its base.

  1. The Maverick GitHub App posts the approval:

```bash

uv run maverick gh-app gh -- pr review <pr-url> --approve \

--body "Approved by agent-code-reviewer at $(date -u +%FT%TZ)"

```

  1. Enable auto-merge (squash):

```bash

uv run maverick gh-app gh -- pr merge <pr-url> --auto --squash

```

The merge waits on whatever required status checks the project's

branch protection enforces — typically lint, tests, build, and (if

the optional mav-bp-remote-code-review workflow is

adopted) the CI-side re-run of agent-code-reviewer. If all required

checks were already green, GitHub merges immediately; otherwise it

merges when they pass.

  1. Wait for the merge to land with a bounded wait — cleanup steps

below assume the PR is no longer in flight:

```bash

uv run maverick pr wait <repo> <pr-num> --timeout 30m

```

Exit 3 (timeout) usually means a required check never reported, or

the branch must be brought up to date with its base (a re-entry, per

step 3) — investigate rather than looping; exit 4 (closed without

merge) means a human intervened — stop and report; exit 6 means the

PR is a draft again — someone converted it, so stop and report

rather than marking it ready over them.

  1. Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS merged.
  2. Post the completion comment on the issue per

mav-github-issue-workflow, and file any reviewer notes

the PR left unfixed per "Follow-up Issues" below.

  1. Run the post-merge issue-lifecycle step. This always posts an

audit comment ("Resolved in PR #<P>; merged to <branch>.") and

applies a merged-to-<branch> label, then closes the issue per the

per-project policy in .maverick/config.json's

issue_lifecycle.close_policy (#52). The default policy

(on_pr_merge) closes the issue immediately, which is right for

trunk-based and GitHub Flow repos. Repos using Gitflow or custom

promotion gates can set the policy to on_default_branch_merge or

manual to keep the issue open until promotion — the audit comment

and label still surface the merge so gh issue list -l merged-to-develop

finds work pending promotion. The CLI is idempotent (re-running it

on a closed issue is a no-op), so it is safe to retry:

```bash

uv run maverick issue close-on-merge <repo> $ARGUMENTS \

--pr <pr-num> --target <target-branch>

```

  1. Emit per-phase narrative notes so the report's Analysis section

has context for what happened. The JSONL is the authoritative

record; the report is a pure render of it, so notes must land in

the JSONL — do not edit the rendered Markdown by hand:

```bash

uv run maverick report note --issue $ARGUMENTS --phase design \

--text "<one-sentence summary of what the analyst returned>"

uv run maverick report note --issue $ARGUMENTS --phase implement \

--text "<one-sentence summary of what landed in Phase 5>"

# ... one report note per phase that produced work worth narrating

```

  1. Checkpoint: uv run maverick task-progress set <repo> $ARGUMENTS completed.

Spell it completed: Claude Code's worktree guard refuses any

command containing the bare name of the shell's completion builtin,

so that spelling can never run from an isolated story (#160). The CLI

records it as the complete phase. Run it before releasing the

claim and destroying the worktree: once the worktree is gone the

shell's working directory no longer exists, so any later

uv run maverick … fails. The checkpoint is a merge-set, so

re-running it is safe.

  1. Release the claim: uv run maverick coord release <repo> $ARGUMENTS --reason merged.

Releasing also writes the workflow report to the main repo's

.maverick/reports/ (it prints report: <path>), so the report

exists on every exit path — including halts and crashes, where the

SessionEnd hook does the release. Because the complete checkpoint

landed first, this report already includes it.

  1. Destroy the worktree — always the last step. Leave the worktree

first, then remove it from the main checkout:

```bash

cd <main-checkout-path>

uv run maverick worktree destroy <worktree-path>

```

Run nothing from inside the worktree after this. If a step after the

destroy is ever refused or fails because the directory is gone, cd

to the main checkout and re-run it there — every command in this

phase is idempotent.

Phase 11: Eject (on FAIL)

  1. Post the reviewer's verdict as a PR comment (App identity, per

mav-github-issue-workflow):

```bash

uv run maverick gh-app gh -- pr comment <pr-url> --body-file - <<'EOF'

<reviewer verdict>

This PR is now waiting on a person: the agent has stopped work on it

and marked it ready for review.

EOF

```

Pass the body on stdin (--body-file -) or, if it is long, write it

with the Write tool to .maverick/tmp/review-verdict-$ARGUMENTS.md

in the story's checkout and pass that path. Never use a shared

/tmp or scratchpad file — concurrent stories would post each other's

(#159).

  1. Apply the needs-human label to both the PR and the issue, and mark

the PR ready, so its draft/ready state says whose turn it is (draft:

the agent's; ready: a person's). Turn auto-merge off first: a

re-entry may have left it enabled with an approval from an earlier

pass, and marking ready would then merge the FAILed head. The

disable fails harmlessly when auto-merge is already off. Use plain

gh pr ready here, not maverick pr ready, which refuses while

checks are failing:

```bash

gh pr edit <pr-url> --add-label needs-human

gh issue edit $ARGUMENTS --add-label needs-human

uv run maverick gh-app gh -- pr merge <pr-url> --disable-auto || true

uv run maverick gh-app gh -- pr ready <pr-url>

```

  1. Request human review on the PR:

```bash

gh pr edit <pr-url> --add-reviewer <human-handle>

```

  1. If this story belongs to an epic (look for a parent epic reference on

the issue, or uv run maverick state show <repo> <epic>):

uv run maverick state set <repo> <epic> $ARGUMENTS ejected.

uv run maverick bprop run <repo> <epic> --ejected $ARGUMENTS.

set, per mav-block-propagation.

  1. Checkpoint the eject (#83): uv run maverick task-progress set <repo> $ARGUMENTS ejected.
  2. Emit per-phase narrative notes so the eject report has context

for the human reviewer:

```bash

uv run maverick report note --issue $ARGUMENTS --phase review \

--text "<one-sentence summary of what the reviewer flagged>"

# ... one report note per phase that produced work worth narrating

```

  1. Release the claim: uv run maverick coord release <repo> $ARGUMENTS --reason ejected.

Releasing also writes the workflow report (it prints report: <path>).

If the release errors, generate it directly:

uv run maverick report generate <repo> $ARGUMENTS.

  1. Do not destroy the worktree — the human may want to inspect it.

Log the worktree path so the user can find it.

Follow-up Issues

Reviewers return low and informational notes on every story. Opening an

issue per note buries the backlog in one-liners and duplicates. When

the run ends (Phase 10 or 11):

notes: a checklist in one body, the area in the title

(Review notes from #$ARGUMENTS: <area>), labelled

review-notes (create the label if it doesn't exist).

finding, or for a distinct defect in code this story didn't change.

one that covers it

(gh issue list --state open --search "<file path or key term>").

If one exists, comment on it instead of opening another.

File with the Maverick GitHub App identity

(uv run maverick gh-app gh -- issue create …), with a body file under

.maverick/tmp/ in the story's checkout. Docs drift from Phase 6 keeps

its own single issue.

Rules

the feature branch → PR.

a fresh agent-implementer in the foreground. You keep its

summary, never the code or the logs it read.

only by Phase 10 step 3 or by an eject. Any later push to the branch

first puts it back to draft with maverick pr ready --undo.

same file or mechanism — security, docs accuracy or any other — stop

point-patching. Security switches to a fail-closed design or ejects

(Phase 7). For other reviews, the next round covers only the lines

changed since the last one, not a fresh sample.

all of them must release. Release is also what writes the report.

runs inside an epic record no dispatches.

agent-security-reviewer's verdict, not yours.

human may clear a block.

<!-- maverick-plugin-version: 5.3.1 -->

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.