Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: drop good-first-issue and help-wanted labels at claim time
[._.]/ Adam Eivydcb461141351
diff --git a/server/lib/README.md b/server/lib/README.mdindex b004e1a761..f0ca23b68e 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -401,7 +401,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `assetRoutePrefixes.js` | Import-free leaf holding the URL prefixes the server owns: `ASSET_ROUTE_PREFIXES` (every `/data/**` static mount) and `SERVER_OWNED_PREFIXES` (what must never reach the SPA fallback, each with the exact `spaPaths` that ARE client routes). `scripts/dev-proxy-drift.test.js` checks the dev proxy's `^/data/` wildcard against the mounts, pins the route-registration order in `server/index.js` (a router added below the terminators is shadowed), and fails if a client route — from `NAV_COMMANDS` or `App.jsx`'s nested `<Route>` tree — is ever added under a server-owned prefix without being declared. || `asyncMutex.js` | Promise-based async mutex. || `concurrencyGate.js` | `createConcurrencyGate(limit)` → `run(fn)` — cap on simultaneous async work for ONE module-scoped budget, released FIFO. Sibling to `mapWithConcurrency.js`, which caps in-flight work *within one array map*; a gate is shared state, so several call sites fanning out at the same remote respect one budget instead of each respecting its own while the host sees the sum. `createMutex` (`asyncMutex.js`) is this with `limit` fixed at 1 — prefer it for mutual exclusion. Note the budget is per-MODULE, not per-host: two modules calling one host each get their own gate. Used by `huggingFaceCatalog.js` (4) and `ollamaRegistryCatalog.js` (16), whose cold catalog-enrichment bursts otherwise arrive at a free public API as a thundering herd — which the Hub answers with an HTTP/2 GOAWAY that surfaces as a bare `fetch failed`. |-| `dispatchLabels.js` | slashdo dispatch-hint contract: `model:light/medium/heavy` + `effort:low/medium/high/xhigh/max` vocabulary, prescribed forge colors, validation (`normalizeDispatchModel` / `normalizeDispatchEffort`), GitHub/GitLab vs Jira label formatting, optional contributor labels (`good first issue` / `help wanted`, never implied by `model:light`), the `decomposed` epic workflow marker (`EPIC_DECOMPOSED_LABEL`, shared with perpetualWork.js#isActionableIssue and the claim prompts), lazy-create command text, and shared dispatch plus issue-quality guidance (`ISSUE_QUALITY_GUIDANCE`, `DISPATCH_HINT_GUIDANCE`, `JIRA_DISPATCH_HINT_GUIDANCE`). Omit an unjustified axis; never invent `medium`; reject future-only/speculative work while keeping useful current refactors claimable. Consumed by work-tracker instructions, quota-burn audits, Layered Intelligence filing, and claim follow-up prompts. |+| `dispatchLabels.js` | slashdo dispatch-hint contract: `model:light/medium/heavy` + `effort:low/medium/high/xhigh/max` vocabulary, prescribed forge colors, validation (`normalizeDispatchModel` / `normalizeDispatchEffort`), GitHub/GitLab vs Jira label formatting, optional contributor labels (`good first issue` / `help wanted`, never implied by `model:light`, and released at claim time by `formatContributorLabelReleaseCommands` — one best-effort command per label, since a forge fails the whole edit when a named label is absent), the `decomposed` epic workflow marker (`EPIC_DECOMPOSED_LABEL`, shared with perpetualWork.js#isActionableIssue and the claim prompts), lazy-create command text, and shared dispatch plus issue-quality guidance (`ISSUE_QUALITY_GUIDANCE`, `DISPATCH_HINT_GUIDANCE`, `JIRA_DISPATCH_HINT_GUIDANCE`). Omit an unjustified axis; never invent `medium`; reject future-only/speculative work while keeping useful current refactors claimable. Consumed by work-tracker instructions, quota-burn audits, Layered Intelligence filing, and claim follow-up prompts. || `domainAutonomy.js` | Per-domain autonomy guardrails (pure). `AUTONOMY_DOMAINS`/`DOMAIN_IDS`/`DOMAIN_MODES` (`off`/`dry-run`/`execute`), `getDomainMode(config, id)`, and `normalizeDomainAutonomy(raw)` to coerce a hand-edited/partial map. Default per domain is `execute` (reproduces pre-#711 behavior, so no migration needed). Also `CREATIVE_DOMAIN`/`getCreativeAutonomyMode(config)` (#2183) — the Creative Director orchestrator domain, kept out of `DOMAIN_IDS` and defaulting to mirror the `cos` mode. || `domainBudgets.js` | Per-domain daily autonomy budgets (pure). `BUDGET_LIMIT_FIELDS` (`maxActionsPerDay`/`maxMinutesPerDay`), `getDomainBudget(config, id)`, `normalizeDomainBudgets(raw)`, `hasBudget(budget)`, and `evaluateBudget(budget, usage)` → `{ withinBudget, exceeded }`. A `null`/non-positive cap means unlimited (default per domain, so no migration needed). Token/$ caps are intentionally absent — CLI subscription providers expose no per-run metering. Usage ledger + gate wiring live in `services/domainUsage.js`. || `errorHandler.js` | `ServerError` + `asyncHandler` middleware, plus `sendErrorResponse`/`buildErrorEnvelope` for the standard `{ error, code, timestamp }` body outside a handler's catch. |diff --git a/server/lib/dispatchLabels.js b/server/lib/dispatchLabels.jsindex 85f6bd6f1e..a30f60ae09 100644--- a/server/lib/dispatchLabels.js+++ b/server/lib/dispatchLabels.js@@ -170,6 +170,36 @@ export function jiraContributorLabels({ goodFirstIssue, helpWanted } = {}) {return labels;}+/** Both forge contributor labels, in the order they are applied and released. */+export const CONTRIBUTOR_LABELS = Object.freeze([GOOD_FIRST_ISSUE_LABEL, HELP_WANTED_LABEL]);++/** Jira-safe equivalents of `CONTRIBUTOR_LABELS`. */+export const JIRA_CONTRIBUTOR_LABELS = Object.freeze([+ JIRA_GOOD_FIRST_ISSUE_LABEL,+ JIRA_HELP_WANTED_LABEL,+]);++/**+ * Forge commands that retire an issue's contributor invitations at claim time.+ * `good first issue` / `help wanted` advertise work to a *human* who might pick+ * it up; once an autonomous claim holds the issue that invitation is stale, so+ * the claim flows release both labels alongside setting the assignee and+ * `in-progress`.+ *+ * ONE command per label, never a single combined edit: both `gh issue edit+ * --remove-label` and `glab issue update --unlabel` fail the WHOLE call when any+ * named label is absent from the issue, so a combined call on an issue carrying+ * only `help wanted` would remove neither. Each is best-effort (`2>/dev/null`) —+ * an issue carrying neither label is the common case and must never abort a claim.+ *+ * `issueRef` is inserted verbatim as shell text (e.g. `"${NUM}"`).+ */+export function formatContributorLabelReleaseCommands(issueRef, { cli = 'gh' } = {}) {+ return CONTRIBUTOR_LABELS.map((label) => (cli === 'glab'+ ? `glab issue update ${issueRef} --unlabel ${shellQuote(label)} 2>/dev/null`+ : `gh issue edit ${issueRef} --remove-label ${shellQuote(label)} 2>/dev/null`));+}+/** Dispatch hints + contributor labels for one GitHub/GitLab issue. */export function forgeIssueLabels({ model, effort, goodFirstIssue, helpWanted } = {}) {return [diff --git a/server/lib/dispatchLabels.test.js b/server/lib/dispatchLabels.test.jsindex edab71ce85..62482297fd 100644--- a/server/lib/dispatchLabels.test.js+++ b/server/lib/dispatchLabels.test.js@@ -29,6 +29,9 @@ import {allDispatchLabelSpecs,formatLabelCreateCommand,formatRepeatedLabelFlags,+ CONTRIBUTOR_LABELS,+ JIRA_CONTRIBUTOR_LABELS,+ formatContributorLabelReleaseCommands,} from './dispatchLabels.js';describe('dispatch label vocabulary', () => {@@ -141,6 +144,24 @@ describe('label specs and CLI formatting', () => {.toEqual(['effort-low', JIRA_HELP_WANTED_LABEL]);});+ // A claim holds the issue, so the invitation to a human contributor is stale.+ // The commands must stay SEPARATE and best-effort: a forge fails the whole edit+ // when any named label is absent, so one combined call on an issue carrying+ // only `help wanted` would remove neither — and an issue carrying neither is+ // the common case, which must never abort a claim.+ it('releases both contributor labels one best-effort command at a time', () => {+ expect(CONTRIBUTOR_LABELS).toEqual([GOOD_FIRST_ISSUE_LABEL, HELP_WANTED_LABEL]);+ expect(JIRA_CONTRIBUTOR_LABELS).toEqual([JIRA_GOOD_FIRST_ISSUE_LABEL, JIRA_HELP_WANTED_LABEL]);+ expect(formatContributorLabelReleaseCommands('"${NUM}"')).toEqual([+ `gh issue edit "\${NUM}" --remove-label 'good first issue' 2>/dev/null`,+ `gh issue edit "\${NUM}" --remove-label 'help wanted' 2>/dev/null`,+ ]);+ expect(formatContributorLabelReleaseCommands('"${NUM}"', { cli: 'glab' })).toEqual([+ `glab issue update "\${NUM}" --unlabel 'good first issue' 2>/dev/null`,+ `glab issue update "\${NUM}" --unlabel 'help wanted' 2>/dev/null`,+ ]);+ });+it('emits repeated --label flags, never a comma list', () => {expect(formatRepeatedLabelFlags(['plan', 'model:light', 'effort:max'])).toBe('--label plan --label model:light --label effort:max');diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.jsindex 04569628da..63e98cfb7f 100644--- a/server/services/taskPromptDefaults.test.js+++ b/server/services/taskPromptDefaults.test.js@@ -10,6 +10,9 @@ import {} from './taskPromptDefaults.js';import { hashPromptBody, buildPromptIntegritySnapshot } from './taskPromptDefaults/integrityHash.js';import { EPIC_DECOMPOSED_LABEL } from './perpetualWork.js';+// The claim prompts build their contributor-label release from this helper, so the+// test asserts against the same source rather than re-typing the command text.+import { formatContributorLabelReleaseCommands } from '../lib/dispatchLabels.js';// Hash snapshot of every exported prompt body and version. This pins the// cross-install prompt-upgrade contract (see AGENTS.md "Distribution model"):@@ -660,13 +663,15 @@ describe('taskPromptDefaults integrity snapshot', () => {expect(current).not.toContain('Leave epics for a human to split');expect(current).not.toContain("don't claim it wholesale here");- // The outgoing body stays recognizable so an install storing it auto-upgrades- // rather than being pinned to the skip-the-epic flow forever. One entry per- // shipped version, in ship order, is what makes .at(-1) the outgoing one.+ // The body outgoing at THIS revision stays recognizable so an install+ // storing it auto-upgrades rather than being pinned to the skip-the-epic+ // flow forever. One entry per shipped version, in ship order, so the body+ // the epic bump replaced is index `floor - 2` — addressed positionally+ // rather than as .at(-1), which moves to a newer body on every later bump.const previous = PREVIOUS_DEFAULT_PROMPTS[key];expect(previous).toHaveLength(PROMPT_VERSIONS[key] - 1);- expect(previous.at(-1)).not.toBe(current);- expect(previous.at(-1)).not.toContain('Phase 1b');+ expect(previous[floors[key] - 2]).not.toBe(current);+ expect(previous[floors[key] - 2]).not.toContain('Phase 1b');}// A slice references its parent without closing it, and the parent keeps the@@ -678,6 +683,51 @@ describe('taskPromptDefaults integrity snapshot', () => {expect(DEFAULT_TASK_PROMPTS['claim-issue-jira']).toContain('Leave epics for a human to split');});+ // Contributor labels advertise work to a HUMAN who might pick it up. Once a+ // claim run holds the issue that invitation is stale, so Phase 2 releases both+ // where it stamps the assignee + `in-progress` markers. Pinned here because two+ // details are load-bearing and easy to "tidy" into a break: the commands must+ // stay SEPARATE (a forge fails the whole edit when any named label is absent,+ // so a combined call on an issue carrying only one would remove neither) and+ // best-effort (an issue carrying neither is the common case and must never+ // abort a claim). The literals come from the shared registry, so the labels the+ // claim releases are by construction the ones the filing flows apply.+ //+ // JIRA is deliberately absent: its reads expose no labels at all+ // (jira.js#getIssue / #fetchMyCurrentSprintTickets), and its update replaces the+ // WHOLE label array — so a release there could only be a blind write that erased+ // every other label on the ticket. Same API gap as the epic skip, tracked in #5042.+ it('claim flows release the contributor invitations at claim time, preserving the outgoing defaults', () => {+ const floors = { 'claim-issue': 22, 'claim-issue-gitlab': 20 };+ const releases = {+ 'claim-issue': formatContributorLabelReleaseCommands('"${NUM}"'),+ 'claim-issue-gitlab': formatContributorLabelReleaseCommands('"${NUM}"', { cli: 'glab' }),+ };++ for (const [key, floor] of Object.entries(floors)) {+ const current = DEFAULT_TASK_PROMPTS[key];+ expect(PROMPT_VERSIONS[key]).toBeGreaterThanOrEqual(floor);+ expect(releases[key]).toHaveLength(2);+ for (const command of releases[key]) expect(current).toContain(command);+ // Both labels released in one command would silently no-op on the common+ // single-label issue, so ban the combined spellings outright.+ expect(current).not.toContain("--remove-label 'good first issue' --remove-label");+ expect(current).not.toContain("--unlabel 'good first issue' --unlabel");+ expect(current).toContain('Do NOT restore them when Phase 3 or Phase 7 releases the claim');++ // The outgoing body stays recognizable so an install storing it auto-upgrades+ // instead of being flagged promptCustomized and pinned to the old flow.+ const previous = PREVIOUS_DEFAULT_PROMPTS[key];+ expect(previous).toHaveLength(PROMPT_VERSIONS[key] - 1);+ expect(previous.at(-1)).not.toBe(current);+ for (const command of releases[key]) expect(previous.at(-1)).not.toContain(command);+ // …and it is the body that ONLY lacks the release: everything else the+ // outgoing version shipped (Phase 1b) is still there, which is what makes it+ // the immediately-previous body rather than some older one.+ expect(previous.at(-1)).toContain('Phase 1b');+ }+ });+// #4685: `glab issue list -F json` is accepted, IGNORED, and answers with the// human table at exit 0 (`-F` is `--output-format` there, a different flag from// `--output`), and `glab mr list --state <x>` does not exist at all. The treediff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.jsonindex 3e3ad92687..abca5f5819 100644--- a/server/services/taskPromptDefaults/integrity.snapshot.json+++ b/server/services/taskPromptDefaults/integrity.snapshot.json@@ -16,8 +16,8 @@"feature-ideas": "d3282f16da29efe2d53595b3b34778bc","plan-feature": "b20980c8eda2256060d09d4bca397244","plan-task": "b85fe92999aa4ee4a8910320457c4242",- "claim-issue": "af99e76b4881d1a18234eff0d58d49a4",- "claim-issue-gitlab": "b5e24d2caefba4acc6fb09f6c09f2afd",+ "claim-issue": "9bf278ab141120625cd6faf854622f91",+ "claim-issue-gitlab": "745672581d766edff0ec585dd5b1ef5d","claim-issue-jira": "d5e2b6cf39c2acfebef9ee8e826a7e42","code-reviewer-review": "27ded42013f28e7d327d8f1cc624aac1","code-reviewer-implement": "2e10cac7c1e1cd021d06bfddb5c1eaf2",@@ -42,8 +42,8 @@"do-replan": 2,"feature-ideas": 10,"plan-task": 18,- "claim-issue": 21,- "claim-issue-gitlab": 19,+ "claim-issue": 22,+ "claim-issue-gitlab": 20,"claim-issue-jira": 14,"pr-reviewer": 3,"code-reviewer-a": 1,@@ -143,7 +143,8 @@"eed428fc96a8a58ee94d38e6e4896932","ed2c2c9c8cd6297340b3a92666cb2c5a","348ed6348b90dcc6eead03e06df049e9",- "1f9ec476dce71d04e588d17e72cd46c9"+ "1f9ec476dce71d04e588d17e72cd46c9",+ "b5e24d2caefba4acc6fb09f6c09f2afd"],"claim-issue": ["37949d1b1fa8d461a15658f8f4192d97",@@ -165,7 +166,8 @@"542ce3673abbdee93e895f9df660aaf7","a91b3df45864cf1aeaea7b326a7717ae","a6f069d7276c9f31fdca3b50666324e2",- "6a9bebb3f31b7c1b0a0728def0fe5b3c"+ "6a9bebb3f31b7c1b0a0728def0fe5b3c",+ "af99e76b4881d1a18234eff0d58d49a4"],"security": ["d0f54c1fbe62d067b1a23ee0a9f3528c"diff --git a/server/services/taskPromptDefaults/previousDefaults.js b/server/services/taskPromptDefaults/previousDefaults.jsindex d6f7d2fe7f..7a257a8fff 100644--- a/server/services/taskPromptDefaults/previousDefaults.js+++ b/server/services/taskPromptDefaults/previousDefaults.js@@ -11445,3 +11445,15 @@ The local reviewers already ran in Phase 5, so only the reviewers that need an o## Phase 7 — ReportGenerate a short summary: the ticket KEY + summary worked, the MR/PR URL, the ticket's FINAL JIRA status (confirm it is "In Review"), reviewers run, and any status transition that failed and why.`);+++// The claim bodies shipped BEFORE the contributor-label release (claim-issue+// v21, claim-issue-gitlab v19). In those, claiming an issue set the assignee and+// the `in-progress` label but left `good first issue` / `help wanted` on it, so+// the tracker kept advertising work to human contributors that an autonomous run+// already held. Preserved as frozen rendered strings so an install still storing+// one auto-upgrades to the releasing body instead of being flagged promptCustomized.++PREVIOUS_DEFAULT_PROMPTS['claim-issue'].push("[Claim Issue: {appName}] Claim and ship the next open GitHub issue\n\nPick the next available unclaimed open GitHub issue, **create your own worktree at `claim/issue-<num>`**, implement the fix, ship a PR that closes the issue, and clean up. This is the `/claim --issues` flow — same in-flight scan, same branch naming, same no-local-merge cleanup, but the work source is the repo's GitHub issue tracker instead of PLAN.md. **YOU pick the issue in Phase 1 — the scheduler does not reserve one for you.** Picking at execution time and immediately claiming (worktree + assignee + label) **narrows** the window for two concurrent runs to collide on the same issue — it does NOT eliminate it. Do NOT modify files in the source repo directly; ALL editing happens inside the worktree you create.\n\n{issueAuthorFilter}\n\n**How claiming works.** An issue is \"in flight\" when its number appears as the issue-position segment in either a `claim/issue-<num>` ref (the human/TUI pattern) or a `cos/<task>/issue-<num>/<agent>` ref (the CoS sub-agent pattern) across local branches, remote branches, or open PR head refs — OR the issue is assigned to another account OR carries an `in-progress` label. An issue already assigned to the authenticated account remains eligible for a retry. The `claim/issue-<num>` branch + the assignee/`in-progress` markers you set ARE the claim, visible to every other agent (including parallel machines) and to the human running `/claim --issues` in a TUI.\n\n## Phase 1 — Pick the target issue\n\nRun steps 1–5 in order.\n\n1. cd into the repo root ({repoPath}) and confirm GitHub is the forge: `gh repo view --json nameWithOwner -q .nameWithOwner`. If `gh` is not authenticated or the remote is not GitHub, exit cleanly — this task only works against GitHub issue trackers.\n2. List candidate open issues **oldest-first**, honoring the author filter described above. `gh issue list` defaults to newest-first, so order on the SERVER with `--search \"sort:created-asc\"` — a client-side `jq` sort would only reorder the already-truncated newest page, dropping the true oldest issues on repos with more than `--limit` open issues:\n ```bash\n git fetch --prune 2>/dev/null\n # Author filter (see the block above). Pass --author as a QUOTED single token —\n # do NOT pack flag+value into one variable: a bare `$VAR` holding \"--author x\"\n # is a single argv token in zsh (no word-splitting) and gh rejects it.\n # Owner-only mode (default): resolve the owner, then add --author \"$OWNER\"\n # --limit 500 (not 100): the blocking-label filter below runs on this\n # fetched page, so a small cap risks missing eligible work further down\n # a busy queue when the first page is full of excluded/in-flight issues.\n # Keep an issue assigned to this authenticated account eligible for retry;\n # if this lookup fails, leave ME empty and skip all assigned issues.\n GH_HOST=\"$(git remote get-url origin 2>/dev/null | sed -E -e 's#^[^:]+://([^@/]+@)?([^/:]+)(:[0-9]+)?/.*#\\2#' -e 's#^([^@]+@)?([^:]+):.*#\\2#')\"\nif [ \"$GH_HOST\" = \"ssh.github.com\" ]; then GH_HOST=\"github.com\"; fi\n ME=\"$(gh api --hostname \"$GH_HOST\" user -q .login 2>/dev/null || true)\"\n OWNER=\"$(gh repo view --json owner -q .owner.login)\"\n gh issue list --state open --author \"$OWNER\" --search \"sort:created-asc\" --json number,title,author,assignees,labels,createdAt --limit 500\n # Any-author mode: run the SAME command WITHOUT the --author \"$OWNER\" flag.\n ```\n3. Build the in-flight set. Collect every branch/PR ref:\n ```bash\n git branch -a --no-color --format='%(refname:short)'\n gh pr list --state open --json headRefName -q '.[].headRefName' 2>/dev/null\n ```\n For each ref (after stripping any leading `origin/` / `upstream/` prefix), extract the issue number **only when the ref matches** `claim/issue-<num>` (number after `claim/issue-`) or `cos/<task>/issue-<num>/<agent>` (the `issue-<num>` third segment). Do NOT flag an issue just because its bare number appears elsewhere in a ref.\n4. **Pick the target issue:** walk the candidate list oldest-first in TWO passes. First pass, consider only NON-epic issues and take the first that satisfies every rule below — atomic work always outranks an epic, whatever their relative age. Only if that pass finds nothing do you make a second pass for an undecomposed epic (same rules), and an epic you pick goes to **Phase 1b**, not Phase 2. A single oldest-first pass would enter a decomposition the moment an epic happened to be older than claimable work, which is exactly backwards. The rules:\n - Its number is NOT in the in-flight set.\n - It has no assignees, or at least one assignee's login matches `$ME` (an issue assigned only to another account is already claimed). If `$ME` is empty, skip every assigned issue.\n - It does NOT carry any of these blocking labels: {issueExcludeLabels}.\n - It is NOT an ALREADY-DECOMPOSED tracking/umbrella **epic**. An epic is recognized by an `epic` label, a title ending in \"(epic)\", OR a title beginning with an `[epic]` bracket or `Epic:` tag (e.g. \"[Epic] …\" / \"Epic: …\", case-insensitive); it counts as decomposed once it ALSO carries the `decomposed` label. Skip a decomposed epic — its child slices are ordinary claimable issues in this very list, so claiming the parent would duplicate them. An undecomposed epic is eligible only in the second pass above. **The bare `plan` label is NOT a skip signal.** `do-replan --issues` (and `/do:replan --issues`) labels EVERY migrated backlog item `plan` — atomic bug-fixes included — so `plan` marks the *claimable* queue exactly as `/do:next --issues` treats it (it is that flow's required candidate label). Skipping all `plan` issues would discard the entire actionable backlog and falsely report an empty queue.\n5. **If no eligible issue exists**, exit cleanly — an empty actionable queue is a healthy state, not a failure. **But an open, undecomposed epic is NOT an empty queue**: never report \"no work available\" while one is unclaimed. Splitting it is the work — go to Phase 1b.\n\nCapture the issue number as `NUM`, its title, and its full body — you'll reuse them in the PR and the `Closes #<num>` trailer.\n\n## Phase 1b — Decompose an epic (only when Phase 1 landed on one)\n\nYou reach this phase two ways: Phase 1 found no eligible atomic issue and fell through to an undecomposed epic, or the user pinned this run to an epic. **Never end a run reporting \"nothing to do\" while an undecomposed epic is open** — turning it into shippable slices IS this round's work, and it is what refills the queue for every later run.\n\nCapture the epic's number as `EPIC`. This phase writes ONLY to the issue tracker: no worktree, no branch, no PR, no edits in the source repo.\n\n1. Read it in full, comments included: `gh issue view \"${EPIC}\" --comments`.\n2. **Find the children it already has** — an epic a human (or an earlier run) already split must never be re-split:\n ```bash\n gh issue view \"${EPIC}\" --json body -q .body\n gh issue list --state all --search \"in:body \\\"Part of #${EPIC}\\\"\" --json number,title,state,labels,assignees --limit 200\n ```\n Union that with every `#<num>` the epic's own body checklist references.\n3. **If children already exist, do NOT file more.**\n - **Some child still OPEN** → the epic is already decomposed. Make sure it carries the `decomposed` label and that its body checklist lists every child (step 6), then set `NUM` to the FIRST open child that passes Phase 1 step 4's eligibility rules (oldest-first) and continue at **Phase 2** with that child. If every open child is in flight, assigned elsewhere, or blocked, exit cleanly — that queue is busy, not empty.\n - **Every child CLOSED** → the epic's work is done. Post a comment naming the children that delivered it, close it (`gh issue close \"${EPIC}\" --reason completed`), and return to Phase 1 to look for other work.\n - **Labeled `decomposed` but NO children exist** → an earlier split claimed the epic and died before filing anything. Treat it as undecomposed and continue at step 4; the marker is already in place, so nothing needs re-claiming. (Auto-pick can't reach this state — the marker is exactly what makes Phase 1 skip the epic — so it is recovered only when a human or the work-item picker aims a claim straight at that epic. That is the deliberate trade: a stalled split waits for a human, rather than every marker-write failure re-splitting the same epic on every drain tick.)\n4. **Otherwise, plan the split.** Read the code the epic actually names before slicing — a split that never met the repo is worthless. Produce 2–8 slices, each of them independently shippable in ONE PR, valuable on its own, and written with concrete scope + acceptance criteria + the files/areas involved. Slice by user-visible behavior or subsystem; never one-issue-per-file, and never invent scope the epic doesn't ask for. Decide the boundaries yourself — an ambiguous epic is decided, not deferred (same rule as Phase 3). Only an epic so vague that no split survives contact with the code is a `needs-input` case: comment what is missing, `gh issue edit \"${EPIC}\" --add-label needs-input`, and exit.\n5. **Claim the epic, THEN file the slices.** Stamp the marker before the first `gh issue create` — the label IS this phase's claim (Phase 1 skips a `decomposed` epic). Like every other marker in this flow it **narrows** the window for two concurrent runs to collide — it does NOT eliminate it, since a label edit is an idempotent write, not a compare-and-set — so re-run step 2's child query immediately before the first create and abandon the split if children now exist. Marking last instead of first would leave the epic actionable forever whenever that final edit failed, and let a crashed run be re-split from scratch on the next tick:\n ```bash\n gh label create decomposed --color BFD4F2 --description 'Epic already split into per-slice child issues' 2>/dev/null || true\n gh issue edit \"${EPIC}\" --add-label decomposed\n gh issue comment \"${EPIC}\" --body \"Decomposing into per-slice issues — <one line on how you sliced it>\"\n # The queue label the slices carry must exist before the first create, or every\n # `gh issue create` below fails on a repo that has never used it.\n gh label create plan --color 0E8A16 --description \"Claimable backlog item\" 2>/dev/null || true\n ```\n Then file each slice, in the order you want them worked:\n ```bash\n gh issue create --title \"<specific, human-readable>\" --label plan \\\n --body \"<what + why + acceptance criteria + files/areas>\n\nPart of #${EPIC}\"\n ```\n Use `Part of #${EPIC}` — NEVER `Closes #${EPIC}`, which would close the whole epic on the first slice that merges. **Give every slice body the epic-closure instruction too** — a line telling the agent that ships it to check its box in #${EPIC} and, when it was the LAST open child, close #${EPIC} with a summarizing comment. That is what closes the epic: once it carries the marker, Phase 1 and the work detector both skip it, so no later claim run will revisit the parent on its own. Carry over the epic's `area:*` labels, and add dispatch hints (`model:light|medium|heavy`, `effort:low|medium|high|xhigh|max`) or contributor labels (`good first issue`, `help wanted`) only where that slice genuinely justifies them; create a missing label immediately before applying it.\n6. **Write the checklist back to the epic** so the next run can follow it — keep the original body and append a `## Decomposed into` list naming every child:\n ```bash\n EPIC_BODY=$(mktemp)\n gh issue view \"${EPIC}\" --json body -q .body > \"${EPIC_BODY}\"\n printf '\\n\\n## Decomposed into\\n\\n- [ ] #<a> — <title>\\n- [ ] #<b> — <title>\\n' >> \"${EPIC_BODY}\"\n gh issue edit \"${EPIC}\" --body-file \"${EPIC_BODY}\"\n rm -f \"${EPIC_BODY}\"\n ```\n The marker from step 5 is what stops the next run from splitting the same epic again; this checklist is what lets a claim aimed at the epic resolve the next available child. Leave the epic OPEN, unassigned, and WITHOUT `in-progress` — it closes when its last child closes.\n7. **Then claim the first slice you filed** — set `NUM` to it and continue at **Phase 2**, shipping that ONE slice normally (its PR closes the slice, never the epic). If claiming it fails because another run won the race, exit cleanly: the decomposition alone is a successful round, and the next claim run picks up the next linked child.\n\n## Phase 2 — Claim (worktree + markers)\n\nCreate the worktree on a branch named `claim/issue-<num>`, then set the cross-machine claim markers. Do all editing inside the worktree, NEVER in the source repo's working tree.\n\n```bash\nNUM=<picked-number>\nWORKTREE=\"{worktreesRoot}/claim-issue-${NUM}\"\nmkdir -p {worktreesRoot}\ngit fetch origin main\ngit worktree add --no-track -b \"claim/issue-${NUM}\" \"${WORKTREE}\" origin/main\n# Cross-machine claim markers (best-effort — do not abort the run if these fail):\ngh issue edit \"${NUM}\" --add-assignee @me 2>/dev/null\ngh issue edit \"${NUM}\" --add-label in-progress 2>/dev/null\ncd \"${WORKTREE}\"\n```\n\n(If the repo's default branch is not `main`, detect it with `gh repo view --json defaultBranchRef -q .defaultBranchRef.name` and substitute it for `main` above.)\n\n**If `git worktree add` fails because the `claim/issue-<num>` branch already exists** (a concurrent run won the race, or a remote claim branch is now visible), do NOT force or reuse it — that branch IS another run's claim. Treat the issue as in-flight, return to Phase 1, and pick the next eligible issue; if nothing else is eligible, exit cleanly. Stash `WORKTREE` — you'll need it for Phase 7 cleanup.\n\n## Phase 3 — Verify still valid\n\nRead the full issue (`gh issue view \"${NUM}\" --comments`) before writing any code. **Every exit from this phase must leave a CONVERGING outcome on the issue — closed, or labeled `needs-input`.** Phase 1 step 4 skips both, so an autonomous drain stops re-picking the item. Releasing an issue OPEN and unlabeled is NOT an exit: the work detector still reports it actionable, so the next pass re-picks it and burns another no-op agent — every pass, forever.\n\n- **Already fixed, superseded, or closed-then-reopened-for-tracking** — a comment says so, or the change it asks for is already on the default branch. **Close it:** post a comment naming the PR/commit (or issue) that already delivered it (`gh issue comment \"${NUM}\" --body \"...\"`), then `gh issue close \"${NUM}\" --reason completed` (use `--reason \"not planned\"` when it was superseded rather than delivered) and clear the markers (`gh issue edit \"${NUM}\" --remove-assignee @me --remove-label in-progress`). Remove the worktree and return to Phase 1. **Evidence gate: if you cannot name the PR, commit, or issue that delivered it, this branch does NOT apply** — closing on a hunch destroys live work, which is far worse than one wasted pass. Treat the issue as real work and continue to Phase 4.\n- **Stale reference** — the request names a function, file, or component that no longer exists (`grep -rn` the named identifiers; if they're gone, the issue is stale). Post a comment naming what you searched for and what you found instead, **tag it `needs-input`** (`gh issue edit \"${NUM}\" --add-label needs-input`), release the claim markers (`gh issue edit \"${NUM}\" --remove-assignee @me --remove-label in-progress`), remove the worktree, and return to Phase 1. Re-scoping a stale issue against today's code is a human call — and the label is what keeps the drain off it in the meantime.\n\n(A too-large scope is NOT in this list — it has its own park path below.)\n\n**A genuinely too-large issue gets SPLIT, not parked.** If the work is bigger than one coherent claim — it would touch files far outside the issue's scope (>5 unrelated files) — and you can't carve a valuable standalone slice to partial-ship via Phase 6's `Refs` path, promote it to an epic and decompose it: file the slices and rewrite the parent exactly as **Phase 1b** steps 4–6 describe (each slice carrying `Part of #${NUM}`). **Promote it on BOTH axes, creating the umbrella label first** — the queue skips a parent only when it is epic-shaped AND marked, so an issue left carrying only `decomposed` stays claimable and gets re-split every pass:\n```bash\ngh label create epic --color B60205 --description 'Umbrella/tracking issue — shipped as per-slice children, never as one PR' 2>/dev/null || true\ngh issue edit \"${NUM}\" --add-label epic --add-label decomposed\n```\nVerify BOTH labels are actually on the issue afterwards (`gh issue view \"${NUM}\" --json labels`); if the `epic` label still won't stick, append \" (epic)\" to the title instead (`gh issue edit \"${NUM}\" --title \"… (epic)\"`) — the title convention marks an epic with no label at all. Then release its claim markers (`gh issue edit \"${NUM}\" --remove-assignee @me --remove-label in-progress`), remove the worktree, and continue at Phase 2 with the first slice you filed. Splitting an omnibus issue is work you do, not a hand-off. Park to `needs-input` (`gh issue edit \"${NUM}\" --add-label needs-input`, release the markers, remove the worktree, exit) ONLY when the issue is too vague to slice against the code at all — that park is what stops a perpetual drain from re-picking an un-shippable issue every pass (Phase 1 step 4 skips `needs-input`).\n\n**Ambiguity is NOT a release trigger — decide, don't defer.** If the issue is merely open to more than one reasonable reading, or leaves a design choice unstated, do NOT bail to `needs-input`. Pick the most reasonable interpretation, record the approach you chose in a brief issue comment (`gh issue comment \"${NUM}\" --body \"...\"`) so the decision is on the record, and implement it. The user would rather iterate on top of a shipped best-guess than have the issue parked waiting on a decision they didn't ask to make. Reserve `needs-input` — which pulls the issue out of the autonomous queue — for the narrow cases where proceeding would be **destructive or irreversible**, or genuinely requires the human: specific hardware/credentials you don't have, or a judgment only they can make. In those cases only, post the explaining comment, **tag it `needs-input`** (`gh issue edit \"${NUM}\" --add-label needs-input`), release the claim markers (`gh issue edit \"${NUM}\" --remove-assignee @me --remove-label in-progress`), remove the worktree, and exit cleanly. **That label is what lets an autonomous drain converge** — Phase 1 step 4 skips `needs-input` issues. Never leave a half-claimed issue.\n\n## Phase 4 — Implement\n\nWrite the code, tests, and any docs the issue requires. Follow the repo conventions in AGENTS.md / CLAUDE.md (no try/catch in route handlers, functional programming, Zod validation, Tailwind tokens, reactive UI updates). Run the relevant test suite as you go.\n\n**Roll discovered backbone work INTO this PR** — small supporting helpers, refactors, and tests that the fix depends on belong here, not a follow-up. Only defer genuinely-large adjacent work; when you do, file a NEW issue (`gh issue create`) tagged `plan` that references this one (`Related to #<num>`) rather than appending to PLAN.md. Choose independent dispatch hints (`model:light|medium|heavy`, `effort:low|medium|high|xhigh|max`) and contributor labels (`good first issue`, `help wanted`) only when justified; omit an axis rather than guessing; create each missing label immediately before applying it; use repeated `--label` flags; do not prefix the title with `[category]` / `[model:…]`.\n\nCommit with a conventional message referencing the issue so the trail is grep-able:\n\n```\n<type>: <one-line description> (#<num>)\n```\n\n## Phase 5 — Review locally (BEFORE any PR exists)\n\n**Every reviewer that can read the working tree runs HERE, while there is still no PR.** Open the PR only once the branch is already review-clean: the PR then carries the finished diff, and the only things left to satisfy are CI and the reviewers that genuinely cannot start until a PR is open.\n\nThe configured reviewers for this task, in order, are `{reviewers}`. Split that list in two, preserving its order:\n\n- **LOCAL reviewers — every token that is NOT an `@<login>`.** `claude` / `codex` / `antigravity` (CLI binary: `agy`) / `grok` / `cursor` invoke a local-CLI critique; `lmstudio` / `ollama` use the appended Local Reviewer Procedure. They read this branch's own diff and need no PR — run them in THIS phase.\n- **PR-SIDE reviewers — every `@<login>` token**, plus any review bot the repo requests automatically when a PR opens. They review cloud-side and cannot start before the PR exists — they run in Phase 6.\n\n1. **Write the changelog entry now, not after the reviewers run** — every commit the reviewers are about to read must already be on the branch, or the PR carries work nobody reviewed. If the repo maintains a changelog, record a one-line entry **following the convention that repo documents** — read its `AGENTS.md` (or `CLAUDE.md`) and changelog README (e.g. `.changelog/README.md`) first. Some repos collect per-branch fragments in a directory (e.g. `.changelog/next/`) via a helper script rather than appending to one shared file, precisely so parallel agents don't conflict on every merge; use that flow when it's documented. Fall back to appending to the unreleased section (`.changelog/NEXT.md`, or `## Unreleased` in `CHANGELOG.md`) in the repo's existing prose style only when no convention is documented. If the repo has no changelog, skip this — the PR + commit history is the record.\n2. **Self-review your diff for reuse, quality, and efficiency** (DRY, dead code, naming, simpler equivalents, missed edge cases) and fix the findings in the same diff, before any reviewer runs. Claude Code runs this as the three-agent `/simplify` pass; on other CLIs, do the equivalent review by hand.\n3. **Run each LOCAL reviewer in the listed order against the BRANCH diff, not a PR diff.** No PR exists yet, so `gh pr diff` has nothing to read — use the CLI's own base-diff mode or `git diff origin/main...HEAD` (substitute the repo's default branch when it isn't `main`). Apply the findings, run the tests, and commit the fixes — capped at 3 rounds per reviewer — then advance to the next reviewer. A missing CLI, timeout, transport failure, malformed response, or empty response is UNSATISFIED, not clean. Do NOT substitute your own self-review, and do NOT open a PR on the strength of it.\n4. **If the branch cannot be brought to a shippable state here, do NOT open a PR** — that is a local reviewer still unsatisfied after 3 rounds, or fixes that leave the build/tests red. Comment on the ISSUE naming the reviewer and the failure (`gh issue comment \"${NUM}\" --body \"...\"`), leave the assignee and the `in-progress` label in place, remove ONLY the worktree (`cd {repoPath} && git worktree remove \"${WORKTREE}\"`), and stop. The branch stays for a human to pick up cold. Do NOT run Phase 7.\n\n## Phase 6 — Open the PR, satisfy PR-side review + CI, and merge\n\nEvery local reviewer's fixes are already committed, so the PR opens against finished work. This flow ships GitHub issues — it does NOT touch PLAN.md. The audit trail is the merged PR + `git log`.\n\n1. Push the branch: `git push -u origin \"claim/issue-${NUM}\"`. Then confirm `git log --oneline @{u}..HEAD` is empty — if it isn't, a Phase 5 review fix never left the machine and the PR would be opened against a stale diff; push again before continuing.\n2. Open the PR with `gh pr create`. Summarize what shipped + a short test plan. **Choose the issue trailer deliberately:** if this PR FULLY satisfies the issue's scope, the body MUST contain `Closes #${NUM}` so the merge auto-closes it. If you deliberately shipped only PART of the issue (a valuable slice, with real scope still remaining), use `Refs #${NUM}` instead (NOT `Closes`) and add a `## Remaining` section listing what's left — Phase 7 reconciles the issue so it is never stranded.\n3. **Satisfy the PR-SIDE reviewers.** For each `@<login>` from the Phase 5 split, request the review now (`gh pr edit <pr-number> --add-reviewer <login>`, drop the `@`), poll every 5–15s for it, and address the findings — push fixes, capped at 3 rounds per reviewer. Their approval gates the merge. If the repo auto-requests a review bot when the PR opens, wait that round out and address it the same way. With no `@<login>` configured and no bot review appearing, this step is a no-op.\n\n **Review-stuck cleanup** (a PR-side reviewer still unsatisfied after 3 rounds): post one summarizing PR comment (`gh pr comment`), then run the worktree-only cleanup (`cd {repoPath} && git worktree remove \"${WORKTREE}\"`). Leave the local branch, the open PR, the assignee, and the `in-progress` label in place so the human picks up cold. Do NOT run Phase 7.\n4. **Let required CI finish and go green** — `gh pr checks <pr-number> --required --watch --fail-fast` (scope the wait to REQUIRED checks so an optional job can't stall a merge branch protection would allow). A red required check is not merge-eligible: fix it and re-push (same 3-round cap), or, if it stays red, stop exactly as the review-stuck cleanup above does.\n5. **Merge immediately via `gh pr merge`** — NEVER a local `git merge` and NEVER `--auto`, which can return successfully while leaving the PR queued and OPEN. Prefer a true merge commit, with squash/rebase fallbacks for repositories that disallow it:\n ```bash\n PR_URL=$(gh pr view --json url -q .url) # no number: resolves the PR from the checked-out branch\n gh pr merge \"$PR_URL\" --merge --delete-branch || {\n [ \"$(gh pr view \"$PR_URL\" --json state -q .state)\" = \"MERGED\" ] || gh pr merge \"$PR_URL\" --squash --delete-branch || gh pr merge \"$PR_URL\" --rebase --delete-branch\n }\n STATE=$(gh pr view \"$PR_URL\" --json state -q .state)\n [ \"$STATE\" = \"MERGED\" ] || { echo \"Expected MERGED, got $STATE\" >&2; exit 1; }\n ```\n The exact comparison MUST succeed. `OPEN` means CI, review, or branch protection still blocks the merge; investigate, fix, and retry. `CLOSED` is also not success. Do not enter Phase 7 until remote GitHub state is exactly `MERGED`.\n\n## Phase 7 — Clean up (post-merge ONLY)\n\nThis phase runs only after the PR merged via Phase 6. From the **source repo** (cd back to {repoPath} first):\n\n```bash\ncd {repoPath}\ngit worktree remove \"${WORKTREE}\"\ngit branch -d \"claim/issue-${NUM}\"\n```\n\nIf `git branch -d` refuses, fetch the default branch and re-check the PR's remote `MERGED` state. Retry `-d` only when Git can prove the branch is integrated; otherwise leave the local branch for the reconciliation task. Never force-delete with `-D`.\n\n**Reconcile the issue — did this PR FULLY satisfy its scope?**\n- **Yes (full)** — the `Closes #${NUM}` trailer already auto-closed it; if it's somehow still open, close it (`gh issue close \"${NUM}\"`) and remove the label (`gh issue edit \"${NUM}\" --remove-label in-progress`).\n- **No — the remainder is a clean, separable chunk** — close THIS issue with a summarizing comment (shipped ✓ / moved to #NEW), remove `in-progress`, and file ONE tightly-scoped follow-up for the remainder: `gh issue create --title \"…\" --label plan [--label model:<tier>] [--label effort:<level>] [--label \"good first issue\"] [--label \"help wanted\"] --body \"…\\n\\nRefs #${NUM}\"` (carry over any `area:*` labels the issue had; choose the optional labels independently and only when justified — a leftover mechanical sweep is not a good first issue).\n- **No — the remainder is a continuation of the same scope** — keep the issue OPEN, post a `Done ✓ / Remaining ▢` comment, and release the claim so the queue re-picks it. Remove the label and every current assignee, not only the authenticated account:\n `ASSIGNEES=\"$(gh issue view \"${NUM}\" --json assignees -q '[.assignees[].login] | join(\",\")')\"`\n `gh issue edit \"${NUM}\" --remove-label in-progress --remove-assignee \"${ASSIGNEES:-@me}\"`.\n\nNEVER leave the issue OPEN with `in-progress` still on it — that strands it as a zombie (the claim queue skips `in-progress`, so the remaining scope is never re-picked). **Do NOT `git pull`** from inside this phase — the work is already integrated on GitHub via `gh pr merge`; leave the user's working tree alone.");++PREVIOUS_DEFAULT_PROMPTS['claim-issue-gitlab'].push("[Claim Issue: {appName}] Claim and ship the next open GitLab issue\n\nPick the next available unclaimed open GitLab issue, **create your own worktree at `claim/issue-<num>`**, implement the fix, ship a merge request (MR) that closes the issue, and clean up. This is the `/claim --issues` flow for GitLab — same in-flight scan, same branch naming, same no-local-merge cleanup, but the work source is the repo's **GitLab** issue tracker and the forge CLI is `glab` (not `gh`). **YOU pick the issue in Phase 1 — the scheduler does not reserve one for you.** Picking at execution time and immediately claiming (worktree + assignee + label) **narrows** the window for two concurrent runs to collide on the same issue — it does NOT eliminate it. Do NOT modify files in the source repo directly; ALL editing happens inside the worktree you create.\n\n{issueAuthorFilter}\n\n**How claiming works.** An issue is \"in flight\" when its number appears as the issue-position segment in either a `claim/issue-<num>` ref (the human/TUI pattern) or a `cos/<task>/issue-<num>/<agent>` ref (the CoS sub-agent pattern) across local branches, remote branches, or open MR source-branch refs — OR the issue is assigned to another account OR carries an `in-progress` label. An issue already assigned to the authenticated account remains eligible for a retry. The `claim/issue-<num>` branch + the assignee/`in-progress` markers you set ARE the claim, visible to every other agent (including parallel machines).\n\n## Phase 1 — Pick the target issue\n\nRun steps 1–5 in order.\n\n1. cd into the repo root ({repoPath}) and confirm GitLab is the forge and `glab` is authenticated: `glab auth status` and `glab repo view`. If `glab` is not authenticated or the remote is not GitLab, exit cleanly — this task only works against GitLab issue trackers.\n2. List candidate open issues, honoring the author filter described above. Fetch a JSON page and order **oldest-first** (GitLab returns newest-first by default; sort client-side by `created_at` since the page is bounded):\n ```bash\n git fetch --prune 2>/dev/null\n # Owner-only mode (default): add --author <owner> (resolve <owner> from the project namespace).\n # Keep an issue assigned to this authenticated account eligible for retry;\n # if this lookup fails, leave ME empty and skip all assigned issues.\n ME=\"$(glab api user -q .username 2>/dev/null || true)\"\n glab issue list --per-page 100 --output json\n # Any-author mode: run the SAME command WITHOUT --author.\n ```\n3. Build the in-flight set. Collect every branch/MR source ref:\n ```bash\n git branch -a --no-color --format='%(refname:short)'\n glab mr list --per-page 100 --output json # read each MR's source_branch\n ```\n For each ref (after stripping any leading `origin/` prefix), extract the issue number **only when the ref matches** `claim/issue-<num>` (number after `claim/issue-`) or `cos/<task>/issue-<num>/<agent>` (the `issue-<num>` third segment). Do NOT flag an issue just because its bare number appears elsewhere in a ref.\n4. **Pick the target issue:** walk the candidate list oldest-first in TWO passes. First pass, consider only NON-epic issues and take the first that satisfies every rule below — atomic work always outranks an epic, whatever their relative age. Only if that pass finds nothing do you make a second pass for an undecomposed epic (same rules), and an epic you pick goes to **Phase 1b**, not Phase 2. A single oldest-first pass would enter a decomposition the moment an epic happened to be older than claimable work, which is exactly backwards. The rules:\n - Its number (`iid`) is NOT in the in-flight set.\n - It has no assignees, or at least one assignee's username matches `$ME` (an issue assigned only to another account is already claimed). If `$ME` is empty, skip every assigned issue.\n - It does NOT carry any of these blocking labels: {issueExcludeLabels}.\n - It is NOT an ALREADY-DECOMPOSED tracking/umbrella **epic**. An epic is recognized by an `epic` label, a title ending in \"(epic)\", OR a title beginning with an `[epic]` bracket or `Epic:` tag (e.g. \"[Epic] …\" / \"Epic: …\", case-insensitive); it counts as decomposed once it ALSO carries the `decomposed` label. Skip a decomposed epic — its child slices are ordinary claimable issues in this very list. An undecomposed epic is eligible only in the second pass above. **The bare `plan` label is NOT a skip signal** — it marks the claimable queue, not a blocker.\n5. **If no eligible issue exists**, exit cleanly — an empty actionable queue is a healthy state, not a failure. **But an open, undecomposed epic is NOT an empty queue** — go to Phase 1b instead of reporting \"no work available\".\n\nCapture the issue number (GitLab `iid`) as `NUM`, its title, and its full description — you'll reuse them in the MR and the `Closes #<num>` line.\n\n## Phase 1b — Decompose an epic (only when Phase 1 landed on one)\n\nSame contract as the GitHub flow: an undecomposed epic is work, not a dead end. Capture its `iid` as `EPIC`. This phase writes ONLY to the issue tracker — no worktree, no branch, no MR.\n\n1. Read it in full: `glab issue view \"${EPIC}\" --comments`.\n2. **Find the children it already has** — never re-split an epic somebody already split. Union the `#<num>` refs in its own description checklist with `glab issue list --all --search \"Part of #${EPIC}\" --output json --per-page 100`.\n3. **If children already exist, do NOT file more.** Some child still OPEN → make sure the epic carries the `decomposed` label and a complete checklist (step 6), set `NUM` to the FIRST open child passing Phase 1 step 4's rules (oldest-first), and continue at **Phase 2** with that child; if every open child is in flight/assigned/blocked, exit cleanly. Every child CLOSED → comment naming what delivered it, `glab issue close \"${EPIC}\"`, and return to Phase 1.\n4. **Otherwise, plan the split** against the actual code the epic names: 2–8 slices, each independently shippable in ONE MR, valuable on its own, each with concrete scope + acceptance criteria + the files/areas involved. Slice by user-visible behavior, never one-issue-per-file, never invent scope. Decide the boundaries yourself; only an epic too vague to slice against the code is a `needs-input` case (comment why, `glab issue update \"${EPIC}\" --label needs-input`, exit).\n5. **Claim the epic, THEN file the slices.** Stamp the marker before the first create — the label IS this phase's claim. Like every other marker in this flow it **narrows** the concurrent-collision window rather than closing it (a label write is idempotent, not a compare-and-set), so re-run step 2's child query immediately before the first create and abandon the split if children now exist. Marking last would instead leave the epic actionable forever whenever that final write failed: `glab label create --name decomposed --color '#BFD4F2' --description 'Epic already split into per-slice child issues' 2>/dev/null || true`, then `glab issue update \"${EPIC}\" --label decomposed`, then post a comment saying a split is under way. Create the `plan` queue label the same way if the project lacks it, or every create below fails. Then file each slice in the order you want them worked: `glab issue create --title \"<specific>\" --label plan --description \"<what + why + acceptance criteria + files/areas>\n\nPart of #${EPIC}\"`. Use `Part of #${EPIC}`, NEVER `Closes #${EPIC}`. Give every slice the epic-closure instruction too — check its box in #${EPIC}, and close #${EPIC} when it was the LAST open child; once the parent carries the marker, nothing else will revisit it. Carry over the epic's `area:*` labels; add `model:*`/`effort:*` or contributor labels only where justified.\n6. **Write the checklist back to the epic**: keep its description and append a `## Decomposed into` checklist (`- [ ] #<num> — <title>`) via `glab issue update \"${EPIC}\" --description \"<full text>\"`. Leave the epic OPEN, unassigned, and without `in-progress` — it closes when its last child closes. The step-5 marker is what stops the next run from re-splitting it; the checklist is what lets a claim aimed at the epic resolve the next available child. An epic already labeled `decomposed` with NO children is a split that died before filing — treat it as undecomposed and resume at step 4.\n7. **Then claim the first slice you filed** — set `NUM` to it and continue at **Phase 2**. If another run won the race, exit cleanly: the decomposition itself is a successful round.\n\n## Phase 2 — Claim (worktree + markers)\n\nDetect the default branch first (forge-agnostic), then create the worktree on `claim/issue-<num>` and set the cross-machine claim markers. Do all editing inside the worktree, NEVER in the source repo's working tree.\n\n```bash\nNUM=<picked-number>\nDEFAULT_BRANCH=\"$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's@^origin/@@')\"\nDEFAULT_BRANCH=\"${DEFAULT_BRANCH:-main}\"\nWORKTREE=\"{worktreesRoot}/claim-issue-${NUM}\"\nmkdir -p {worktreesRoot}\ngit fetch origin \"${DEFAULT_BRANCH}\"\ngit worktree add --no-track -b \"claim/issue-${NUM}\" \"${WORKTREE}\" \"origin/${DEFAULT_BRANCH}\"\n# Cross-machine claim markers (best-effort — do not abort the run if these fail).\n# Resolve your own username first — glab's --assignee wants a username (the\n# `@me` gh-ism isn't universally supported), falling back to @me if the lookup fails:\nME=\"$(glab api user 2>/dev/null | sed -n 's/.*\"username\":\"\\([^\"]*\\)\".*/\\1/p')\"\nglab issue update \"${NUM}\" --assignee \"${ME:-@me}\" 2>/dev/null\nglab issue update \"${NUM}\" --label in-progress 2>/dev/null\ncd \"${WORKTREE}\"\n```\n\n**If `git worktree add` fails because the `claim/issue-<num>` branch already exists** (a concurrent run won the race), do NOT force or reuse it — that branch IS another run's claim. Treat the issue as in-flight, return to Phase 1, and pick the next eligible issue; if nothing else is eligible, exit cleanly. Stash `WORKTREE` — you'll need it for Phase 7 cleanup.\n\n## Phase 3 — Verify still valid\n\nRead the full issue (`glab issue view \"${NUM}\"`) before writing any code. **Every exit from this phase must leave a CONVERGING outcome on the issue — closed, or labeled `needs-input`.** Phase 1 step 4 skips both, so an autonomous drain stops re-picking the item. Releasing an issue OPEN and unlabeled is NOT an exit: the work detector still reports it actionable, so the next pass re-picks it and burns another no-op agent — every pass, forever.\n\n- **Already fixed, superseded, or closed-then-reopened-for-tracking** — a note says so, or the change it asks for is already on the default branch. **Close it:** post a note naming the MR/commit (or issue) that already delivered it (`glab issue note \"${NUM}\" -m \"...\"`), then `glab issue close \"${NUM}\"` and clear the markers (`glab issue update \"${NUM}\" --unassign --unlabel in-progress`). Remove the worktree and return to Phase 1. **Evidence gate: if you cannot name the MR, commit, or issue that delivered it, this branch does NOT apply** — closing on a hunch destroys live work, which is far worse than one wasted pass. Treat the issue as real work and continue to Phase 4.\n- **Stale reference** — the request names a function, file, or component that no longer exists (`grep -rn` the named identifiers; if they're gone, the issue is stale). Post a note naming what you searched for and what you found instead, **tag it `needs-input`** (`glab issue update \"${NUM}\" --label needs-input`), release the claim markers (`glab issue update \"${NUM}\" --unassign --unlabel in-progress`), remove the worktree, and return to Phase 1. Re-scoping a stale issue against today's code is a human call — and the label is what keeps the drain off it in the meantime.\n\n(A too-large scope is NOT in this list — it has its own park path below.)\n\n**A genuinely too-large issue gets SPLIT, not parked.** If the work is bigger than one coherent claim — it would touch files far outside the issue's scope (>5 unrelated files) — and you can't carve a valuable standalone slice to partial-ship via Phase 6's `Refs` path, promote it to an epic and decompose it exactly as **Phase 1b** steps 4–6 describe (each slice carrying `Part of #${NUM}`). **Promote it on BOTH axes, creating the umbrella label first** — the queue skips a parent only when it is epic-shaped AND marked, so an issue left carrying only `decomposed` stays claimable and gets re-split every pass: `glab label create --name epic --color '#B60205' --description 'Umbrella/tracking issue — shipped as per-slice children, never as one PR' 2>/dev/null || true`, then `glab issue update \"${NUM}\" --label epic --label decomposed`. Confirm both landed (`glab issue view \"${NUM}\" --output json`); if the `epic` label won't stick, append \" (epic)\" to the title instead — the title convention marks an epic with no label at all. Then release its claim markers (`glab issue update \"${NUM}\" --unassign --unlabel in-progress`), remove the worktree, and continue at Phase 2 with the first slice you filed. Splitting an omnibus issue is work you do, not a hand-off. Park to `needs-input` (`glab issue update \"${NUM}\" --label needs-input`, release the markers, remove the worktree, exit) ONLY when the issue is too vague to slice against the code at all — that park stops a perpetual drain from re-picking an un-shippable issue every pass (Phase 1 step 4 skips `needs-input`).\n\n**Ambiguity is NOT a release trigger — decide, don't defer.** If the issue is merely open to more than one reasonable reading, or leaves a design choice unstated, do NOT bail to `needs-input`. Pick the most reasonable interpretation, record the approach you chose in a brief issue note (`glab issue note \"${NUM}\" -m \"...\"`) so the decision is on the record, and implement it. The user would rather iterate on top of a shipped best-guess than have the issue parked waiting on a decision they didn't ask to make. Reserve `needs-input` — which pulls the issue out of the autonomous queue — for the narrow cases where proceeding would be **destructive or irreversible**, or genuinely requires the human: specific hardware/credentials you don't have, or a judgment only they can make. In those cases only, post the explaining note, **tag it `needs-input`** (`glab issue update \"${NUM}\" --label needs-input`), release the claim markers (`glab issue update \"${NUM}\" --unassign --unlabel in-progress`), remove the worktree, and exit cleanly. **That label is what lets an autonomous drain converge** — Phase 1 step 4 skips `needs-input` issues. Never leave a half-claimed issue.\n\n## Phase 4 — Implement\n\nWrite the code, tests, and any docs the issue requires. Follow the repo conventions in AGENTS.md (or CLAUDE.md). Run the relevant test suite as you go.\n\n**Roll discovered backbone work INTO this MR** — small supporting helpers, refactors, and tests that the fix depends on belong here, not a follow-up. Only defer genuinely-large adjacent work; when you do, file a NEW issue (`glab issue create`) tagged `plan` that references this one (`Related to #<num>`). Choose independent dispatch hints (`model:light|medium|heavy`, `effort:low|medium|high|xhigh|max`) and contributor labels (`good first issue`, `help wanted`) only when justified; omit an axis rather than guessing; create each missing label immediately before applying it; use repeated `--label` flags; do not prefix the title with `[category]` / `[model:…]`.\n\nCommit with a conventional message referencing the issue:\n\n```\n<type>: <one-line description> (#<num>)\n```\n\n## Phase 5 — Review locally (BEFORE any MR exists)\n\n**Every reviewer that can read the working tree runs HERE, while there is still no MR.** Open the MR only once the branch is already review-clean: the MR then carries the finished diff, and the only things left to satisfy are CI and the reviewers that genuinely cannot start until an MR is open.\n\nThe configured reviewers for this task, in order, are `{reviewers}`. Split that list in two, preserving its order:\n\n- **LOCAL reviewers — every token that is NOT an `@<login>`.** `claude` / `codex` / `antigravity` (CLI binary: `agy`) / `grok` / `cursor` invoke a local-CLI critique; `lmstudio` / `ollama` use the appended Local Reviewer Procedure. They read this branch's own diff and need no MR — run them in THIS phase.\n- **MR-SIDE reviewers — every `@<login>` token**, plus any review bot the project requests automatically when an MR opens. They review server-side and cannot start before the MR exists — they run in Phase 6.\n\n1. **Write the changelog entry now, not after the reviewers run** — every commit the reviewers are about to read must already be on the branch, or the MR carries work nobody reviewed. If the repo maintains a changelog, record a one-line entry **following the convention that repo documents** — read its `AGENTS.md` (or `CLAUDE.md`) and changelog README (e.g. `.changelog/README.md`) first. Some repos collect per-branch fragments in a directory (e.g. `.changelog/next/`) via a helper script rather than appending to one shared file, precisely so parallel agents don't conflict on every merge; use that flow when it's documented. Fall back to appending to the unreleased section (`.changelog/NEXT.md`, or `## Unreleased` in `CHANGELOG.md`) in the repo's existing prose style only when no convention is documented. If the repo has no changelog, skip this.\n2. **Self-review your diff for reuse, quality, and efficiency** (DRY, dead code, naming, simpler equivalents, missed edge cases) and fix the findings in the same diff, before any reviewer runs. Claude Code runs this as the three-agent `/simplify` pass; on other CLIs, do the equivalent review by hand.\n3. **Run each LOCAL reviewer in the listed order against the BRANCH diff, not an MR diff.** No MR exists yet, so `glab mr diff` has nothing to read — use the CLI's own base-diff mode or `git diff \"origin/${DEFAULT_BRANCH}...HEAD\"`. Apply the findings, run the tests, and commit the fixes — capped at 3 rounds per reviewer — then advance to the next reviewer. A missing CLI, timeout, transport failure, malformed response, or empty response is UNSATISFIED, not clean. Do NOT substitute your own self-review, and do NOT open an MR on the strength of it.\n4. **If the branch cannot be brought to a shippable state here, do NOT open an MR** — that is a local reviewer still unsatisfied after 3 rounds, or fixes that leave the build/tests red. Post a note on the ISSUE naming the reviewer and the failure (`glab issue note \"${NUM}\" -m \"...\"`), leave the assignee and the `in-progress` label in place, remove ONLY the worktree (`cd {repoPath} && git worktree remove \"${WORKTREE}\"`), and stop. The branch stays for a human to pick up cold. Do NOT run Phase 7.\n\n## Phase 6 — Open the merge request, satisfy MR-side review + CI, and merge\n\nEvery local reviewer's fixes are already committed, so the MR opens against finished work. This flow ships GitLab issues — it does NOT touch PLAN.md. The audit trail is the merged MR + `git log`.\n\n1. Push the branch: `git push -u origin \"claim/issue-${NUM}\"`. Then confirm `git log --oneline @{u}..HEAD` is empty — if it isn't, a Phase 5 review fix never left the machine and the MR would be opened against a stale diff; push again before continuing.\n2. Open the MR with `glab mr create --fill --source-branch \"claim/issue-${NUM}\" --target-branch \"${DEFAULT_BRANCH}\" --yes`. **Choose the issue trailer deliberately:** if this MR FULLY satisfies the issue's scope, the description MUST contain `Closes #${NUM}` so the merge auto-closes it; if you deliberately shipped only PART of the issue (a valuable slice with real scope remaining), use `Refs #${NUM}` instead (NOT `Closes`) and add a `## Remaining` section listing what's left — Phase 7 reconciles the issue so it is never stranded. Summarize what shipped + a short test plan (pass `--description` if `--fill` didn't capture it).\n3. **Satisfy the MR-SIDE reviewers.** For each `@<login>` from the Phase 5 split, request the review now (resolve `MR_IID` from the source branch exactly as step 5 does, then `glab mr update \"${MR_IID}\" --reviewer <login>`, dropping the `@`; if glab rejects the flag, run `glab mr update --help` rather than guessing), poll every 5–15s, and address the findings — push fixes, capped at 3 rounds per reviewer. Their approval gates the merge. If the project auto-requests a review bot when the MR opens, wait that round out and address it the same way. With no `@<login>` configured and no bot review appearing, this step is a no-op.\n\n **Review-stuck cleanup** (an MR-side reviewer still unsatisfied after 3 rounds): post one summarizing MR note (`glab mr note`), then run the worktree-only cleanup (`cd {repoPath} && git worktree remove \"${WORKTREE}\"`). Leave the local branch, the open MR, the assignee, and the `in-progress` label in place so the human picks up cold. Do NOT run Phase 7.\n4. **Let required CI finish and go green** — inspect the MR's pipeline (`glab ci status` on the branch, or `glab mr view \"${MR_IID}\"`). A red required pipeline is not merge-eligible: fix it and re-push (same 3-round cap), or, if it stays red, stop exactly as the review-stuck cleanup above does.\n5. **Merge immediately via `glab mr merge`** — NEVER a local `git merge`. `glab mr merge` takes the **MR IID**, which is NOT the issue number — resolve it from the source branch first, merge, then verify remote state:\n ```bash\n MR_IID=\"$(glab mr list --source-branch \"claim/issue-${NUM}\" --output json | sed -n 's/.*\"iid\":\\([0-9]\\{1,\\}\\).*/\\1/p' | head -1)\"\n glab mr merge \"${MR_IID}\" --yes --remove-source-branch || {\n glab mr view \"${MR_IID}\" --output json | jq -e 'select((.state | ascii_downcase) == \"merged\")' >/dev/null || glab mr merge \"${MR_IID}\" --yes --squash --remove-source-branch\n }\n glab mr view \"${MR_IID}\" --output json | jq -er 'select((.state | ascii_downcase) == \"merged\") | .state'\n ```\n The verification command must succeed and print a merged state. An opened/closed state or missing value is not success; investigate CI, review, and branch protection, then retry. Do not enter Phase 7 until the forge confirms the MR is merged.\n\n## Phase 7 — Clean up (post-merge ONLY)\n\nThis phase runs only after the MR merged via Phase 6. From the **source repo** (cd back to {repoPath} first):\n\n```bash\ncd {repoPath}\ngit worktree remove \"${WORKTREE}\"\ngit branch -d \"claim/issue-${NUM}\"\n```\n\nIf `git branch -d` refuses, fetch the default branch and re-check the MR's merged state. Retry `-d` only when Git proves the branch integrated; otherwise leave it for reconciliation. Never force-delete with `-D`.\n\n**Reconcile the issue — did this MR FULLY satisfy its scope?**\n- **Yes (full)** — the `Closes #${NUM}` line already auto-closed it on merge to the default branch; if it's somehow still open, close it (`glab issue close \"${NUM}\"`) and remove the label (`glab issue update \"${NUM}\" --unlabel in-progress`).\n- **No — the remainder is a clean, separable chunk** — close THIS issue with a summarizing note (shipped ✓ / moved to #NEW), remove `in-progress`, and file ONE tightly-scoped follow-up for the remainder: `glab issue create --title \"…\" --label plan [--label model:<tier>] [--label effort:<level>] [--label \"good first issue\"] [--label \"help wanted\"] --description \"…\\n\\nRefs #${NUM}\"` (carry over any `area:*` labels the issue had; choose the optional labels independently and only when justified — a leftover mechanical sweep is not a good first issue).\n+ **No — the remainder is a continuation of the same scope** — keep the issue OPEN, post a `Done ✓ / Remaining ▢` note, and release the claim so the queue re-picks it: `glab issue update \"${NUM}\" --unassign --unlabel in-progress` (`--unassign` clears every current assignee).\n\nNEVER leave the issue OPEN with `in-progress` still on it — that strands it as a zombie (the claim queue skips `in-progress`, so the remaining scope is never re-picked). **Do NOT `git pull`** from inside this phase — the work is already integrated on GitLab via `glab mr merge`; leave the user's working tree alone.");diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.jsindex 83c1fe1f63..e63d987a2f 100644--- a/server/services/taskPromptDefaults/prompts.js+++ b/server/services/taskPromptDefaults/prompts.js@@ -11,7 +11,13 @@// PORTOS_API_URL is interpolated into the jira-status-report default prompt below.import { PORTOS_API_URL } from '../../lib/ports.js';-import { EPIC_DECOMPOSED_LABEL, EPIC_LABEL, ISSUE_QUALITY_GUIDANCE, formatLabelCreateCommand } from '../../lib/dispatchLabels.js';+import {+ EPIC_DECOMPOSED_LABEL,+ EPIC_LABEL,+ ISSUE_QUALITY_GUIDANCE,+ formatContributorLabelReleaseCommands,+ formatLabelCreateCommand,+} from '../../lib/dispatchLabels.js';// The epic marker and its idempotent `label create` line come from the shared// label registry, so the label the claim agent stamps is by construction the one@@ -25,6 +31,11 @@ const EPIC_LABEL_CREATE_GLAB = formatLabelCreateCommand(EPIC_DECOMPOSED_LABEL, {// actionable and it gets re-split every pass.const UMBRELLA_LABEL_CREATE_GH = formatLabelCreateCommand(EPIC_LABEL);const UMBRELLA_LABEL_CREATE_GLAB = formatLabelCreateCommand(EPIC_LABEL, { cli: 'glab' });+// Claiming an issue retires its human-contributor invitations. The `${NUM}` here+// is SHELL text, not a JS interpolation — these are single-quoted so the claim+// agent gets the literal `"${NUM}"` its own script sets.+const CONTRIBUTOR_RELEASE_GH = formatContributorLabelReleaseCommands('"${NUM}"').join('\n');+const CONTRIBUTOR_RELEASE_GLAB = formatContributorLabelReleaseCommands('"${NUM}"', { cli: 'glab' }).join('\n');const SCHEDULED_ISSUE_QUALITY_GATE = `## Scheduled issue-quality gate@@ -960,11 +971,18 @@ git worktree add --no-track -b "claim/issue-\${NUM}" "\${WORKTREE}" origin/main# Cross-machine claim markers (best-effort — do not abort the run if these fail):gh issue edit "\${NUM}" --add-assignee @me 2>/dev/nullgh issue edit "\${NUM}" --add-label in-progress 2>/dev/null+# Retire the contributor invitations — this issue is taken now, so it must stop+# advertising itself to a human looking for something to pick up. One edit per+# label: \`--remove-label\` fails the WHOLE call when a named label is absent, so+# a combined call on an issue carrying only one of them would remove neither.+${CONTRIBUTOR_RELEASE_GH}cd "\${WORKTREE}"\`\`\`(If the repo's default branch is not \`main\`, detect it with \`gh repo view --json defaultBranchRef -q .defaultBranchRef.name\` and substitute it for \`main\` above.)+Releasing \`good first issue\` / \`help wanted\` is deliberate and one-way: they invite a human contributor, and every path out of this flow either closes the issue or returns it to the AUTONOMOUS queue, where those labels mean nothing. Do NOT restore them when Phase 3 or Phase 7 releases the claim — re-advertising the issue to humans is a call for the human who wants it re-advertised.+**If \`git worktree add\` fails because the \`claim/issue-<num>\` branch already exists** (a concurrent run won the race, or a remote claim branch is now visible), do NOT force or reuse it — that branch IS another run's claim. Treat the issue as in-flight, return to Phase 1, and pick the next eligible issue; if nothing else is eligible, exit cleanly. Stash \`WORKTREE\` — you'll need it for Phase 7 cleanup.## Phase 3 — Verify still valid@@ -1132,9 +1150,16 @@ git worktree add --no-track -b "claim/issue-\${NUM}" "\${WORKTREE}" "origin/\${DME="$(glab api user 2>/dev/null | sed -n 's/.*"username":"\\([^"]*\\)".*/\\1/p')"glab issue update "\${NUM}" --assignee "\${ME:-@me}" 2>/dev/nullglab issue update "\${NUM}" --label in-progress 2>/dev/null+# Retire the contributor invitations — this issue is taken now, so it must stop+# advertising itself to a human looking for something to pick up. One update per+# label: \`--unlabel\` fails the WHOLE call when a named label is absent, so a+# combined call on an issue carrying only one of them would remove neither.+${CONTRIBUTOR_RELEASE_GLAB}cd "\${WORKTREE}"\`\`\`+Releasing \`good first issue\` / \`help wanted\` is deliberate and one-way: they invite a human contributor, and every path out of this flow either closes the issue or returns it to the AUTONOMOUS queue, where those labels mean nothing. Do NOT restore them when Phase 3 or Phase 7 releases the claim — re-advertising the issue to humans is a call for the human who wants it re-advertised.+**If \`git worktree add\` fails because the \`claim/issue-<num>\` branch already exists** (a concurrent run won the race), do NOT force or reuse it — that branch IS another run's claim. Treat the issue as in-flight, return to Phase 1, and pick the next eligible issue; if nothing else is eligible, exit cleanly. Stash \`WORKTREE\` — you'll need it for Phase 7 cleanup.## Phase 3 — Verify still validdiff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.jsindex 1569904dd4..7895f47c15 100644--- a/server/services/taskPromptDefaults/versions.js+++ b/server/services/taskPromptDefaults/versions.js@@ -12,8 +12,8 @@ export const PROMPT_VERSIONS = {'do-replan': 2, // v2: scheduled issue-quality gate rejects speculative/future-only work and keeps valid current refactors claimable'feature-ideas': 10, // v10: Phase 4 (Brainstorm) consults the repo's REJECTED.md and recently closed-unmerged PRs before proposing, so ideas the user already declined aren't re-proposed (mirrors idle-review's REJECTED.md contract). v9: drop DONE.md reads — use `.changelog/` + `git log` (last 50) as the completed-work signal'plan-task': 18, // v18: scheduled plan-task no longer instructs a code-review loop; v17: the implement + changelog steps name `AGENTS.md` (or `CLAUDE.md`) as the repo-conventions file (#4852 made AGENTS.md canonical; the dual naming keeps a managed app that still carries only the old name discoverable). v16: every reviewer that can read the working tree runs BEFORE the PR is opened — Phase 6 splits the configured list into LOCAL reviewers (every non-`@<login>` token, reviewed against `git diff origin/main...HEAD`) and PR-SIDE reviewers (`@<login>` plus any auto-requested review bot), opens the PR only once the branch is review-clean, and then waits on those PR-side reviewers plus required CI. Previously the PR was opened first and every reviewer ran against its diff, so each round of findings landed as follow-up commits on an already-public PR. v14: claim worktree creation passes `--no-track`, so a branch based on `origin/main` cannot inherit `main` as its upstream and make a config-derived push write directly to the default branch; the later `git push -u` sets the intended branch upstream. v13: Phase 5's changelog step reads the repo's documented convention FIRST (per-branch fragment directory + helper script, as PortOS now uses) and only falls back to detect-and-append when none is documented; the Phase 6 review-stuck note no longer names `.changelog/NEXT.md` as the file it wrote. v12: the reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — the bare `antigravity` slug is a command that exists nowhere, and a review-loop agent that probed for it concluded no reviewer was available and merged on its own self-review. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v11: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of a repo-relative `data/cos/worktrees/` path, so the agent's checkout no longer lands inside the managed app's working tree. v10: Phase 3 "decide, don't defer" — an *ambiguous* PLAN.md item no longer jumps to the Phase 3b clarification PR; the agent picks the most reasonable reading, notes it, and implements. Phase 3b is reserved for destructive/irreversible or genuinely-human-gated items. Mirrors claim-issue v7 + CLAUDE.md. v9: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v8: Phase-6 merge fallback prefers --merge over --squash (after --auto), matching the /do:pr + review-loop default and PortOS's merge-only policy- 'claim-issue': 21, // v21: an epic is no longer a dead end — Phase 1 treats an UNdecomposed epic as eligible (last-resort, after every atomic issue) and routes it to the new Phase 1b, which reuses an existing child split or files one (2–8 independently shippable slices, each `Part of #<epic>`), rewrites the epic body with a `## Decomposed into` checklist, stamps the `decomposed` label, and then claims the first slice. Phase 3's too-large branch decomposes instead of parking to `needs-input`. Before this, a queue holding only epics ended every run with nothing done. `decomposed` is the convergence marker the perpetualWork detector reads (isActionableIssue). v20: canonicalize GitHub's ssh.github.com SSH-over-443 alias before host-aware identity probes. v19: host-aware GitHub identity probes use the repository origin, and probe failures stay transient instead of parking an assigned-only queue. v18: explicit issue-page claims ignore existing assignees; auto-pick resolves the authenticated login so self-assigned issues remain retryable; open continuation handoffs clear in-progress and all assignees. v17: mirrors plan-task v17 — Phase 4 and Phase 5 name `AGENTS.md` (or `CLAUDE.md`) as the repo-conventions file (#4852). v16: Phase 1 step 4's blocking-label check is now the `{issueExcludeLabels}` placeholder (resolveIssueExcludeLabelsBlock, cosTaskGenerator.js) — the fixed NON_ACTIONABLE_ISSUE_LABELS set plus any app-configured `taskMetadata.issueExcludeLabels` extras (e.g. `good first issue`), so the live claim agent honors the same per-app exclusions the perpetual-drain detector applies, not just the hardcoded set. The pinned-target constraint (`/do:next <num>` / the work-item picker) also re-checks that resolved list, not just the fixed 3, so a target that gained an excluded label after the picker snapshot still isn't force-claimed. Phase 1's candidate fetch widened to `--limit 500` (was 100), matching perpetualWork.js's detector — the label filter runs on the fetched page, so a small cap risked missing eligible work further down a busy queue. v15: Phase 5 is now the pre-PR local review (LOCAL reviewers = every non-`@<login>` token, run against the branch diff; an unsatisfied one blocks PR creation entirely) and Phase 6 opens the PR, satisfies the PR-SIDE reviewers (`@<login>` plus any auto-requested review bot) and required CI, then merges. v13: follow-up issue recipes choose independent slashdo dispatch hints (`model:`/`effort:`) and contributor labels (`good first issue`/`help wanted`) instead of only `plan`. v12: claim worktree creation passes `--no-track`, so a branch based on `origin/main` cannot inherit `main` as its upstream and make a config-derived push write directly to the default branch; the later `git push -u` sets the intended branch upstream. v11: EVERY Phase-3 release now converges — the "already fixed / superseded" case CLOSES the issue (with a comment naming what delivered it) and the "stale reference" case tags `needs-input`, instead of both releasing the issue open and unlabeled. `isActionableIssue` (perpetualWork.js) can only see labels/assignees/epic/in-flight, so a body-or-comment-driven release left the issue looking actionable and the perpetual drain re-spawned a no-op agent on it every tick. v10: Phase 5's changelog step defers to the convention the repo documents (per-branch fragment directory + helper script when present) instead of prescribing an append to `.changelog/NEXT.md`. v9: reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — mirrors plan-task v12. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v8: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of a repo-relative `data/cos/worktrees/` path, so the agent's checkout no longer lands inside the managed app's working tree. v7: Phase 3 no longer releases/parks an *ambiguous* issue to `needs-input` — the agent decides (picks the most reasonable reading, records it in an issue comment, ships) rather than punting the choice back to a human; `needs-input` is reserved for destructive/irreversible or genuinely-human-gated (hardware/credentials) cases. Mirrors the "Decide, don't defer" policy in CLAUDE.md. v6: Phase 1 epic skip also recognizes a leading `[epic]` bracket or `Epic:` colon title tag (e.g. "[Epic] …" / "Epic: …"), not just an `epic` label or a "(epic)" suffix — mirrors the perpetualWork detector so a `[Epic]`-titled issue with no `epic` label stops re-spawning a claim agent that always skips it (perpetual drain now converges/parks). v5: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v4: Phase 5 chooses the issue trailer deliberately (Closes for a full ship, Refs + a `## Remaining` section for a partial one) and Phase 7 reconciles the issue with the partial-ship hybrid — close + file a scoped follow-up when the remainder is separable, else comment "done/remaining" + release the `in-progress` claim — so a partial ship is never left OPEN + `in-progress` (a zombie the claim queue skips forever). v3: Phase 3 tags an ambiguous/too-large issue `needs-input` (not just a comment) so it's excluded from future autonomous claims — required for `perpetual` (drain-until-done) mode to converge instead of re-picking the same un-actionable issue. v2: stop treating the bare `plan` label as a skip — `plan` is the claimable-queue label (do-replan --issues labels every migrated backlog item `plan`), so v1's exclusion emptied the whole actionable queue; now skip only true epics (`epic` label or "(epic)" title)- 'claim-issue-gitlab': 19, // v19: mirrors claim-issue v21 — Phase 1b decomposes an undecomposed epic into per-slice issues (`Part of #<epic>`, `decomposed` marker label on the parent) and claims the first slice, and the too-large branch splits rather than parking. v18: explicit issue-page claims ignore existing assignees; auto-pick resolves the authenticated login so self-assigned issues remain retryable; open continuation handoffs clear in-progress and all assignees. v17: mirrors claim-issue v17 — the repo-conventions file is named `AGENTS.md` (or `CLAUDE.md`) (#4852). v16: the Phase 1 and Phase 6 glab recipes use `--output json` instead of `-F json`. On `glab issue list`, `-F` is `--output-format` (details|ids|urls) — a DIFFERENT flag from `--output` (text|json) — so that spelling was accepted, ignored, and answered with the human table at exit 0; an agent piping that to `jq` got nothing and could not distinguish it from "no issues". `--output json` is correct on every glab subcommand, so the mr recipes are normalized to the same spelling in this bump. v15: mirrors claim-issue v16 — Phase 1 step 4's blocking-label check is now the `{issueExcludeLabels}` placeholder. v14: mirrors claim-issue v15 — Phase 5 runs the LOCAL reviewers against the branch diff before any MR exists, Phase 6 opens the MR and satisfies the MR-SIDE reviewers + pipeline before merging. v12: follow-up issue recipes choose independent slashdo dispatch hints (`model:`/`effort:`) and contributor labels (`good first issue`/`help wanted`) instead of only `plan`. v11: claim worktree creation passes `--no-track`, so a branch based on the default-branch remote ref does not inherit it as an upstream; the later `git push -u` sets the intended branch upstream. v10: mirrors claim-issue v11 — every Phase-3 release converges (close the already-fixed/superseded issue, tag the stale-reference one `needs-input`) so the perpetual drain stops re-picking it. v9: mirrors claim-issue v10 — Phase 5's changelog step defers to the repo's documented convention (per-branch fragments) rather than prescribing a `.changelog/NEXT.md` append. v8: reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — mirrors plan-task v12. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v7: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of a repo-relative `data/cos/worktrees/` path, so the agent's checkout no longer lands inside the managed app's working tree (mirrors claim-issue v8). v6: mirrors claim-issue v7 — Phase 3 decides an *ambiguous* issue (record the chosen reading in an issue note, ship) instead of parking it to `needs-input`, which is reserved for destructive/irreversible or genuinely-human-gated (hardware/credentials) cases. v5: mirrors claim-issue v6 — Phase 1 epic skip also recognizes a leading `[epic]` bracket or `Epic:` colon title tag (e.g. "[Epic] …" / "Epic: …"), not just an `epic` label or a "(epic)" suffix, so the GitLab detector/agent converge on epic-titled issues too. v4: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v3: mirrors claim-issue v4 — Phase 5 chooses Closes-vs-Refs deliberately and Phase 7 reconciles the issue with the partial-ship hybrid (close + scoped follow-up when separable, else "done/remaining" note + release the `in-progress` claim) so a partial ship is never stranded. v2: Phase 3 tags an ambiguous/too-large issue `needs-input` (mirrors claim-issue v3) so it's excluded from future autonomous claims — required for `perpetual` (drain-until-done) mode to converge. v1: GitLab sibling of claim-issue — same 7-phase /claim --issues flow over `glab` issues + merge requests. Reached via the claim-work router when an app's resolved workTracker is 'gitlab'.+ 'claim-issue': 22, // v22: Phase 2 releases `good first issue` / `help wanted` (one best-effort `--remove-label` per label, since a combined edit fails the whole call when either label is absent) alongside the assignee + `in-progress` markers, and does not restore them when the claim is later released. v21: an epic is no longer a dead end — Phase 1 treats an UNdecomposed epic as eligible (last-resort, after every atomic issue) and routes it to the new Phase 1b, which reuses an existing child split or files one (2–8 independently shippable slices, each `Part of #<epic>`), rewrites the epic body with a `## Decomposed into` checklist, stamps the `decomposed` label, and then claims the first slice. Phase 3's too-large branch decomposes instead of parking to `needs-input`. Before this, a queue holding only epics ended every run with nothing done. `decomposed` is the convergence marker the perpetualWork detector reads (isActionableIssue). v20: canonicalize GitHub's ssh.github.com SSH-over-443 alias before host-aware identity probes. v19: host-aware GitHub identity probes use the repository origin, and probe failures stay transient instead of parking an assigned-only queue. v18: explicit issue-page claims ignore existing assignees; auto-pick resolves the authenticated login so self-assigned issues remain retryable; open continuation handoffs clear in-progress and all assignees. v17: mirrors plan-task v17 — Phase 4 and Phase 5 name `AGENTS.md` (or `CLAUDE.md`) as the repo-conventions file (#4852). v16: Phase 1 step 4's blocking-label check is now the `{issueExcludeLabels}` placeholder (resolveIssueExcludeLabelsBlock, cosTaskGenerator.js) — the fixed NON_ACTIONABLE_ISSUE_LABELS set plus any app-configured `taskMetadata.issueExcludeLabels` extras (e.g. `good first issue`), so the live claim agent honors the same per-app exclusions the perpetual-drain detector applies, not just the hardcoded set. The pinned-target constraint (`/do:next <num>` / the work-item picker) also re-checks that resolved list, not just the fixed 3, so a target that gained an excluded label after the picker snapshot still isn't force-claimed. Phase 1's candidate fetch widened to `--limit 500` (was 100), matching perpetualWork.js's detector — the label filter runs on the fetched page, so a small cap risked missing eligible work further down a busy queue. v15: Phase 5 is now the pre-PR local review (LOCAL reviewers = every non-`@<login>` token, run against the branch diff; an unsatisfied one blocks PR creation entirely) and Phase 6 opens the PR, satisfies the PR-SIDE reviewers (`@<login>` plus any auto-requested review bot) and required CI, then merges. v13: follow-up issue recipes choose independent slashdo dispatch hints (`model:`/`effort:`) and contributor labels (`good first issue`/`help wanted`) instead of only `plan`. v12: claim worktree creation passes `--no-track`, so a branch based on `origin/main` cannot inherit `main` as its upstream and make a config-derived push write directly to the default branch; the later `git push -u` sets the intended branch upstream. v11: EVERY Phase-3 release now converges — the "already fixed / superseded" case CLOSES the issue (with a comment naming what delivered it) and the "stale reference" case tags `needs-input`, instead of both releasing the issue open and unlabeled. `isActionableIssue` (perpetualWork.js) can only see labels/assignees/epic/in-flight, so a body-or-comment-driven release left the issue looking actionable and the perpetual drain re-spawned a no-op agent on it every tick. v10: Phase 5's changelog step defers to the convention the repo documents (per-branch fragment directory + helper script when present) instead of prescribing an append to `.changelog/NEXT.md`. v9: reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — mirrors plan-task v12. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v8: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of a repo-relative `data/cos/worktrees/` path, so the agent's checkout no longer lands inside the managed app's working tree. v7: Phase 3 no longer releases/parks an *ambiguous* issue to `needs-input` — the agent decides (picks the most reasonable reading, records it in an issue comment, ships) rather than punting the choice back to a human; `needs-input` is reserved for destructive/irreversible or genuinely-human-gated (hardware/credentials) cases. Mirrors the "Decide, don't defer" policy in CLAUDE.md. v6: Phase 1 epic skip also recognizes a leading `[epic]` bracket or `Epic:` colon title tag (e.g. "[Epic] …" / "Epic: …"), not just an `epic` label or a "(epic)" suffix — mirrors the perpetualWork detector so a `[Epic]`-titled issue with no `epic` label stops re-spawning a claim agent that always skips it (perpetual drain now converges/parks). v5: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v4: Phase 5 chooses the issue trailer deliberately (Closes for a full ship, Refs + a `## Remaining` section for a partial one) and Phase 7 reconciles the issue with the partial-ship hybrid — close + file a scoped follow-up when the remainder is separable, else comment "done/remaining" + release the `in-progress` claim — so a partial ship is never left OPEN + `in-progress` (a zombie the claim queue skips forever). v3: Phase 3 tags an ambiguous/too-large issue `needs-input` (not just a comment) so it's excluded from future autonomous claims — required for `perpetual` (drain-until-done) mode to converge instead of re-picking the same un-actionable issue. v2: stop treating the bare `plan` label as a skip — `plan` is the claimable-queue label (do-replan --issues labels every migrated backlog item `plan`), so v1's exclusion emptied the whole actionable queue; now skip only true epics (`epic` label or "(epic)" title)+ 'claim-issue-gitlab': 20, // v20: mirrors claim-issue v22 — Phase 2 releases `good first issue` / `help wanted` (one best-effort `--unlabel` per label) alongside the assignee + `in-progress` markers. v19: mirrors claim-issue v21 — Phase 1b decomposes an undecomposed epic into per-slice issues (`Part of #<epic>`, `decomposed` marker label on the parent) and claims the first slice, and the too-large branch splits rather than parking. v18: explicit issue-page claims ignore existing assignees; auto-pick resolves the authenticated login so self-assigned issues remain retryable; open continuation handoffs clear in-progress and all assignees. v17: mirrors claim-issue v17 — the repo-conventions file is named `AGENTS.md` (or `CLAUDE.md`) (#4852). v16: the Phase 1 and Phase 6 glab recipes use `--output json` instead of `-F json`. On `glab issue list`, `-F` is `--output-format` (details|ids|urls) — a DIFFERENT flag from `--output` (text|json) — so that spelling was accepted, ignored, and answered with the human table at exit 0; an agent piping that to `jq` got nothing and could not distinguish it from "no issues". `--output json` is correct on every glab subcommand, so the mr recipes are normalized to the same spelling in this bump. v15: mirrors claim-issue v16 — Phase 1 step 4's blocking-label check is now the `{issueExcludeLabels}` placeholder. v14: mirrors claim-issue v15 — Phase 5 runs the LOCAL reviewers against the branch diff before any MR exists, Phase 6 opens the MR and satisfies the MR-SIDE reviewers + pipeline before merging. v12: follow-up issue recipes choose independent slashdo dispatch hints (`model:`/`effort:`) and contributor labels (`good first issue`/`help wanted`) instead of only `plan`. v11: claim worktree creation passes `--no-track`, so a branch based on the default-branch remote ref does not inherit it as an upstream; the later `git push -u` sets the intended branch upstream. v10: mirrors claim-issue v11 — every Phase-3 release converges (close the already-fixed/superseded issue, tag the stale-reference one `needs-input`) so the perpetual drain stops re-picking it. v9: mirrors claim-issue v10 — Phase 5's changelog step defers to the repo's documented convention (per-branch fragments) rather than prescribing a `.changelog/NEXT.md` append. v8: reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — mirrors plan-task v12. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v7: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of a repo-relative `data/cos/worktrees/` path, so the agent's checkout no longer lands inside the managed app's working tree (mirrors claim-issue v8). v6: mirrors claim-issue v7 — Phase 3 decides an *ambiguous* issue (record the chosen reading in an issue note, ship) instead of parking it to `needs-input`, which is reserved for destructive/irreversible or genuinely-human-gated (hardware/credentials) cases. v5: mirrors claim-issue v6 — Phase 1 epic skip also recognizes a leading `[epic]` bracket or `Epic:` colon title tag (e.g. "[Epic] …" / "Epic: …"), not just an `epic` label or a "(epic)" suffix, so the GitLab detector/agent converge on epic-titled issues too. v4: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v3: mirrors claim-issue v4 — Phase 5 chooses Closes-vs-Refs deliberately and Phase 7 reconciles the issue with the partial-ship hybrid (close + scoped follow-up when separable, else "done/remaining" note + release the `in-progress` claim) so a partial ship is never stranded. v2: Phase 3 tags an ambiguous/too-large issue `needs-input` (mirrors claim-issue v3) so it's excluded from future autonomous claims — required for `perpetual` (drain-until-done) mode to converge. v1: GitLab sibling of claim-issue — same 7-phase /claim --issues flow over `glab` issues + merge requests. Reached via the claim-work router when an app's resolved workTracker is 'gitlab'.'claim-issue-jira': 14, // v14: Phase 1 states WHY this flow leaves an epic for a human while claim-issue v21 / claim-issue-gitlab v19 now decompose one — the JIRA reads PortOS exposes (jira.js#getIssue, #fetchMyCurrentSprintTickets) return neither a ticket's labels nor its epic links, so an agent here can see no decomposition marker and cannot find an epic's existing children. Doc-only; the flow is unchanged, and porting Phase 1b here is tracked in #5042. v13: mirrors claim-issue v17 — the repo-conventions file is named `AGENTS.md` (or `CLAUDE.md`) (#4852). v12: mirrors claim-issue v15 in the JIRA flow — Phase 5 runs the LOCAL reviewers against the branch diff before the MR/PR is opened (and before the In Review transition), Phase 6 keeps only the PR-side reviewers plus the worktree cleanup. v10: follow-up tickets receive equivalent hyphenated dispatch (`model-*`/`effort-*`) and contributor (`good-first-issue`/`help-wanted`) labels when independently justified. v9: claim worktree creation passes `--no-track`, so a branch based on the default-branch remote ref does not inherit it as an upstream; the later `git push -u` sets the intended branch upstream. v8: mirrors claim-issue v11 in JIRA's status vocabulary — an already-fixed/superseded ticket transitions to Done/Closed and a stale-reference ticket parks on a Blocked/On Hold status behind a Review Hub todo, instead of transitioning back to a not-started status that Phase 1 immediately re-picks. v7: mirrors claim-issue v10 — Phase 5's changelog step defers to the repo's documented convention (per-branch fragments) rather than prescribing a `.changelog/NEXT.md` append. v6: reviewer bullets name the antigravity reviewer's actual PATH binary (`agy`) — mirrors plan-task v12. The same bump adds the missing-binary guard: a reviewer whose CLI is not on PATH is UNSATISFIED, never a clean review the agent substitutes its own self-review for. v5: worktree is created under PortOS's shared worktrees dir (`{worktreesRoot}` → data/cos/worktrees) instead of `{repoPath}/data/cos/worktrees/`, so the agent's checkout no longer lands inside the managed app's working tree (mirrors claim-issue v8). v4: mirrors claim-issue v7 — Phase 3 decides an *ambiguous* ticket (record the chosen reading in a ticket comment, ship) instead of parking it to a "Needs clarification" Review Hub todo, and Phase 1 no longer skips a merely-underspecified ticket; the todo is reserved for destructive/irreversible or genuinely-human-gated cases. v3: per-kind reviewer bullets name `grok` alongside `claude`/`codex`/`antigravity` as a local-CLI reviewer (grok is now a selectable Review Loop reviewer). v2: Phase 5 records remaining scope in the ticket (Done/Remaining comment) and files a follow-up ticket when a partial ship's remainder is separable, so remaining work isn't lost when a human lands the MR/PR. v1: JIRA sibling of claim-issue — claim ONE ready sprint ticket, move it To Do→In Progress→In Review around a self-managed worktree + MR/PR. Reached via the claim-work router when an app's resolved workTracker is 'jira' (replaces the prior jira→jira-sprint-manager route).'pr-reviewer': 3, // v3: multi-stage pipeline (security scan → code review + merge)'code-reviewer-a': 1, // v1: 2-stage pipeline (codebase review → triage & implement)