@mmerterden/multi-agent-pipeline 10.12.0 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/install/templates/claude-hooks.json +18 -1
  3. package/package.json +1 -1
  4. package/pipeline/commands/multi-agent/generate.md +34 -0
  5. package/pipeline/commands/multi-agent/help.md +6 -8
  6. package/pipeline/commands/multi-agent/refs/cross-cli-contract.md +5 -5
  7. package/pipeline/commands/multi-agent/refs/features/autopilot-circuit-breaker.md +32 -0
  8. package/pipeline/commands/multi-agent/refs/generate-issue.md +123 -53
  9. package/pipeline/commands/multi-agent/refs/phases/modes.md +1 -0
  10. package/pipeline/commands/multi-agent/refs/picker-contract.md +1 -1
  11. package/pipeline/commands/multi-agent/sync.md +9 -9
  12. package/pipeline/commands/multi-agent.md +2 -4
  13. package/pipeline/scripts/agent-guard.py +74 -0
  14. package/pipeline/scripts/agent-guard.sh +48 -0
  15. package/pipeline/scripts/build-stack-plugins.mjs +1 -1
  16. package/pipeline/scripts/fixtures/install-layout.tsv +4 -4
  17. package/pipeline/scripts/scan-agent-config.sh +107 -0
  18. package/pipeline/scripts/smoke-agent-guard.sh +74 -0
  19. package/pipeline/scripts/smoke-autopilot-circuit-breaker.sh +36 -0
  20. package/pipeline/scripts/smoke-config-hygiene.sh +58 -0
  21. package/pipeline/scripts/smoke-gate-hooks.sh +18 -0
  22. package/pipeline/scripts/smoke-generate-issue.sh +44 -39
  23. package/pipeline/skills/.skills-index.json +32 -14
  24. package/pipeline/skills/shared/core/multi-agent-generate/SKILL.md +51 -0
  25. package/pipeline/skills/shared/core/multi-agent-help/SKILL.md +2 -4
  26. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +2 -2
  27. package/pipeline/skills/shared/external/agent-introspection-debugging/SKILL.md +69 -0
  28. package/pipeline/skills/shared/external/council/SKILL.md +69 -0
  29. package/pipeline/skills/shared/external/search-first/SKILL.md +76 -0
  30. package/pipeline/skills/skills-index.md +5 -3
  31. package/pipeline/commands/multi-agent/generate-bug.md +0 -33
  32. package/pipeline/commands/multi-agent/generate-task.md +0 -33
  33. package/pipeline/skills/shared/core/multi-agent-generate-bug/SKILL.md +0 -39
  34. package/pipeline/skills/shared/core/multi-agent-generate-task/SKILL.md +0 -39
package/CHANGELOG.md CHANGED
@@ -14,6 +14,64 @@ Internal file-layout changes that don't affect the slash-command surface are sti
14
14
 
15
15
  ---
16
16
 
17
+ ## [11.1.0] - 2026-07-07
18
+
19
+ Harness-hardening pass: four techniques adapted from studying cross-harness agent
20
+ operating systems, all additive and opt-in.
21
+
22
+ - **Guard hooks (`agent-guard.sh`)** — a new PreToolUse Bash gate that turns two
23
+ prompt-level rules into deterministic, OS-enforced blocks: AI/assistant
24
+ attribution in a commit message, and force-push to a protected branch
25
+ (main/master/develop). Fail-open on any internal error, never executes the
26
+ inspected command (decision core is `agent-guard.py`, shlex-tokenized only),
27
+ no network, no secret output. Wired into `install/templates/claude-hooks.json`
28
+ alongside the existing secret scan; `multi-agent:setup` offers to merge it.
29
+ Backed by `smoke-agent-guard.sh` (19 behavioral cases incl. injection safety).
30
+ - **Config-hygiene gate (`scan-agent-config.sh`)** — a dependency-free, read-only
31
+ audit of the shipped config surface (hook templates, preferences template,
32
+ agent defs, MCP helper scripts) for hardcoded secrets, permission-bypass flags,
33
+ eval-bearing hook commands, blanket `Bash(*)` allows, and pipe-to-shell /
34
+ unpinned-npx install patterns. Runs in the release VERIFY step; blocks on any
35
+ HIGH finding. Backed by `smoke-config-hygiene.sh` (real surface clean +
36
+ planted-bad detection).
37
+ - **Autopilot circuit-breaker** — `refs/features/autopilot-circuit-breaker.md`
38
+ defines the sanctioned autopilot pause: halt and hand back to the user on a
39
+ no-progress stall, an identical repeated failure, a rework storm, cost drift
40
+ past the `costBudget` ceiling, or a merge/rebase conflict. Continuing
41
+ unattended off the happy path is the less safe choice.
42
+ - **Three technique skills** added to `ai-common-engineering-toolkit`
43
+ (v0.1.1): `council` (multi-voice adversarial decision), `search-first`
44
+ (research-before-coding with an adopt/extend/compose/build matrix), and
45
+ `agent-introspection-debugging` (capture -> diagnose -> contained-recovery ->
46
+ report, with an honesty guard against fake auto-heal claims).
47
+
48
+ ## [11.0.0] - 2026-07-07
49
+
50
+ Breaking: the two issue creators `generate-task` and `generate-bug` are merged
51
+ into a single `generate` command. The command surface shrinks from 37 to 36
52
+ commands, so this is a major bump per the versioning policy (a renamed/removed
53
+ command is a breaking surface change).
54
+
55
+ - **New `/multi-agent:generate`** asks the issue type (Task / Bug / Story) at the
56
+ start of every run, then mines the project's recent same-type issues for
57
+ conventions and drafts the issue.
58
+ - **Standard template baseline with auto-sizing.** Each type has a fixed section
59
+ skeleton (Task/Story: Detailed Description, Scope, Acceptance Criteria, Test
60
+ Scenarios; Bug: Detailed Description, Steps to Reproduce, Expected/Actual
61
+ Result, Environment). Conditional sections (Design Reference, API Contract /
62
+ Swagger, Screenshots, Notes) render only when their trigger is present - no
63
+ empty placeholder headings, nothing invented.
64
+ - **Test Scenarios pulled from Jira convention.** Detects linked Xray/Zephyr test
65
+ issues or a dominant test-scenario heading style and reuses it; falls back to an
66
+ AC-derived skeleton the user edits.
67
+ - **Swagger / API Contract section.** When a Swagger/OpenAPI URL or contract is
68
+ given, fetches only the referenced endpoints (method + path + key fields) and
69
+ links the spec. No full-spec crawl; failures degrade to link-only.
70
+ - **Removed** `generate-task` and `generate-bug` on both CLIs (Claude Code +
71
+ Copilot) and the plugin skill set. The shared `refs/generate-issue.md` flow is
72
+ now 12 steps with a dedicated type-selection step; the hard approval gate is
73
+ unchanged.
74
+
17
75
  ## [10.12.0] - 2026-07-06
18
76
 
19
77
  Two trust upgrades: every external channel post now shows a plan-mode-style
@@ -1,5 +1,5 @@
1
1
  {
2
- "_readme": "Recommended Claude Code hooks for multi-agent-pipeline. Merge the `hooks` object into your ~/.claude/settings.json to make the secret scan a HARD pre-commit gate (exit 2 blocks the commit) rather than an advisory step. This is the one gate that is naturally a PreToolUse hook: it scans the staged diff with no extra arguments. The other deterministic gates (evidence, consensus, intent, learnings) are invoked by the pipeline phases with run-specific arguments (a build-log path, the triage JSON, the free-text input), so they are phase-enforced by contract, not OS-hookable. multi-agent:setup offers to merge this block.",
2
+ "_readme": "Recommended Claude Code hooks for multi-agent-pipeline. Merge the `hooks` object into your ~/.claude/settings.json to make these deterministic, OS-enforced PreToolUse gates real (exit 2 blocks the tool call) rather than prompt-level hopes. Two gates ship here: (1) a staged-diff secret scan on git commit (pre-commit-check.sh); (2) an agent-guard on git commit + git push (agent-guard.sh) that blocks AI/assistant attribution in commit messages and force-push to a protected branch (main/master/develop). Both scripts are self-contained, fail-open on internal error, never execute the inspected command, and need no run-specific arguments, which is why they are naturally PreToolUse hooks. The other deterministic gates (evidence, consensus, intent, learnings) take run-specific arguments and are phase-enforced by the pipeline instead. multi-agent:setup offers to merge this block.",
3
3
  "hooks": {
4
4
  "PreToolUse": [
5
5
  {
@@ -10,6 +10,23 @@
10
10
  "command": "bash $HOME/.claude/scripts/pre-commit-check.sh",
11
11
  "timeout": 15,
12
12
  "statusMessage": "Scanning staged changes for secrets..."
13
+ },
14
+ {
15
+ "type": "command",
16
+ "command": "bash $HOME/.claude/scripts/agent-guard.sh",
17
+ "timeout": 10,
18
+ "statusMessage": "Checking commit for attribution..."
19
+ }
20
+ ]
21
+ },
22
+ {
23
+ "matcher": "Bash(git push:*)",
24
+ "hooks": [
25
+ {
26
+ "type": "command",
27
+ "command": "bash $HOME/.claude/scripts/agent-guard.sh",
28
+ "timeout": 10,
29
+ "statusMessage": "Checking push safety..."
13
30
  }
14
31
  ]
15
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmerterden/multi-agent-pipeline",
3
- "version": "10.12.0",
3
+ "version": "11.1.0",
4
4
  "description": "8-phase AI development pipeline with full orchestration on Claude Code and Copilot CLI. Analysis, planning, TDD, CLI-aware parallel review with consensus surfacing + Fable triage, default-FAIL evidence gates, secret + intent guards, per-phase cost ledger, persistent learnings memory, wiki generation, commit automation. Token-preserving uninstall.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -0,0 +1,34 @@
1
+ ---
2
+ description: "Create a standards-compliant Jira issue (Task / Bug / Story): asks the type, mines project conventions, drafts from a standard template with auto-sizing sections, full preview + explicit approval before create."
3
+ argument-hint: "[\"<free-text description>\"] [figma-url] [swagger-url] - all optional, asked interactively when missing"
4
+ ---
5
+
6
+ # multi-agent generate - Standards-Compliant Jira Issue Creator
7
+
8
+ **Input**: $ARGUMENTS
9
+
10
+ Creates exactly one Jira issue, and only after explicit approval. The issue type (Task / Bug / Story) is asked at the start of every run. No branches, no commits, no worktrees, no pipeline chaining. The draft learns the target project's conventions from its recent same-type issues (summary format, labels, components, priority norms, test-scenario style) and offers active-sprint placement when a sprint is running.
11
+
12
+ > **Language**: instruction prose here is English. AskUserQuestion `question`/`description` and the issue content (summary + description) follow `prefs.global.outputLanguage` - an intentional exception to the "external payloads stay English" default, because the issue is authored for the user's team. `label`/`header` stay English.
13
+
14
+ ## Issue types
15
+
16
+ Type is chosen at step [3/11] via AskUserQuestion (never inferred silently). Each type has a standard template baseline; sections auto-size (see `refs/generate-issue.md` for the full A/C matrix and inclusion rules).
17
+
18
+ | Type | Always-present sections | Conditional sections (included only when their trigger is present) |
19
+ |---|---|---|
20
+ | `Task` | Detailed Description, Scope, Acceptance Criteria, Test Scenarios | API Contract / Swagger, Design Reference, Screenshots, Notes |
21
+ | `Bug` | Detailed Description, Steps to Reproduce, Expected Result, Actual Result, Environment | Screenshots / Logs, Regression / Test Scenario, API Contract, Design Reference, Notes |
22
+ | `Story` | User Story, Detailed Description, Scope, Acceptance Criteria, Test Scenarios | API Contract / Swagger, Design Reference, Screenshots, Dependencies / Notes |
23
+
24
+ ## Flow
25
+
26
+ Read `$HOME/.claude/commands/multi-agent/refs/generate-issue.md` and execute the 11-step shared flow. Non-negotiables restated:
27
+
28
+ - Ask the user (AskUserQuestion) for the issue type first, then about every genuinely unknown field - component, epic, priority, labels, assignee, sprint vs backlog, required custom fields.
29
+ - A conditional section renders only when its trigger is present (Figma URL, pasted screenshot/log, Swagger URL/contract, real Notes content). No empty placeholder headings; content the user did not supply and mining could not derive is never invented.
30
+ - Step [8/11] full preview + approval gate always runs. `Approve` / `Edit` (loop) / `Cancel`. No bypass exists.
31
+
32
+ ## Error paths
33
+
34
+ See `refs/generate-issue.md` Error paths. No command-specific additions.
@@ -111,8 +111,7 @@ Post-Hoc & Side-Channel:
111
111
  /multi-agent:analysis ["analysis-name"] Feature-spec analysis (Figma + Swagger + Confluence + repos) → per-platform v3 doc (23-section Full / 7-section Lite)
112
112
  /multi-agent:analysis-resolve [doc] Resolve Section 20 open questions of an analysis doc, one at a time with source-labeled candidates
113
113
  /multi-agent:build-optimize iOS-only Xcode build perf wrapper → benchmark + analyze + recommend-first .build-benchmark/optimization-plan.md
114
- /multi-agent:generate-task ["desc"] [figma-url] Create a Jira Task matching team conventions (mining + active sprint + preview & approval)
115
- /multi-agent:generate-bug ["desc"] [figma-url] Create a Jira Bug matching team conventions (mining + active sprint + preview & approval)
114
+ /multi-agent:generate ["desc"] [figma-url] [swagger-url] Create a Jira Task/Bug/Story matching team conventions (asks type + mining + active sprint + auto-sizing sections + preview & approval)
116
115
  /multi-agent:diff-explain Map a Phase 4 triage finding back to specific diff lines
117
116
  /multi-agent:search Cross-task log search with smart ranking; --semantic queries triage corpus
118
117
  /multi-agent:scan Skill security scan against tiered pattern catalog
@@ -223,8 +222,8 @@ Examples:
223
222
  /multi-agent:review
224
223
 
225
224
  # Create a Jira issue that matches team conventions (preview + approval before create)
226
- /multi-agent:generate-task "Profile screen empty state" https://figma.com/design/abc?node-id=1-2
227
- /multi-agent:generate-bug "Login crash on iOS 17, see attached log"
225
+ /multi-agent:generate "Profile screen empty state" https://figma.com/design/abc?node-id=1-2
226
+ /multi-agent:generate "Login crash on iOS 17, see attached log"
228
227
 
229
228
  ------------------------------------------------------------
230
229
 
@@ -324,8 +323,7 @@ Post-Hoc & Side-Channel:
324
323
  /multi-agent:analysis ["analysis-name"] Feature-spec analizi (Figma + Swagger + Confluence + repolar) → platform başına v3 doküman (23 bölüm Full / 7 bölüm Lite)
325
324
  /multi-agent:analysis-resolve [doc] Analiz dokümanının Bölüm 20 açık sorularını kaynak etiketli adaylarla teker teker çözer
326
325
  /multi-agent:build-optimize iOS-only Xcode build performance wrapper → benchmark + analiz + recommend-first .build-benchmark/optimization-plan.md
327
- /multi-agent:generate-task ["açıklama"] [figma-url] Takım standartlarına uygun Jira Task oluştur (convention mining + aktif sprint + önizleme & onay)
328
- /multi-agent:generate-bug ["açıklama"] [figma-url] Takım standartlarına uygun Jira Bug oluştur (convention mining + aktif sprint + önizleme & onay)
326
+ /multi-agent:generate ["açıklama"] [figma-url] [swagger-url] Takım standartlarına uygun Jira Task/Bug/Story oluştur (tip sorar + convention mining + aktif sprint + auto-sizing bölümler + önizleme & onay)
329
327
  /multi-agent:diff-explain Phase 4 triage bulgusunu diff satırlarına eşle
330
328
  /multi-agent:search Task log'larında akıllı arama; --semantic triage corpus'unu sorgular
331
329
  /multi-agent:scan Skill güvenlik taraması (tiered pattern catalog)
@@ -436,8 +434,8 @@ Quality & Telemetry (advisory, default açık - prefs.global.* ile kapatılabi
436
434
  /multi-agent:review
437
435
 
438
436
  # Takım standartlarına uygun Jira issue oluştur (oluşturmadan önce önizleme + onay)
439
- /multi-agent:generate-task "Profil ekranı empty state" https://figma.com/design/abc?node-id=1-2
440
- /multi-agent:generate-bug "iOS 17'de login crash, log ekte"
437
+ /multi-agent:generate "Profil ekranı empty state" https://figma.com/design/abc?node-id=1-2
438
+ /multi-agent:generate "iOS 17'de login crash, log ekte"
441
439
 
442
440
  ------------------------------------------------------------
443
441
 
@@ -6,12 +6,12 @@
6
6
 
7
7
  ---
8
8
 
9
- ## 1. Command Inventory (37 commands)
9
+ ## 1. Command Inventory (36 commands)
10
10
 
11
11
  ```
12
12
  analysis, analysis-resolve, autopilot, build-optimize, channels, delete, dev,
13
13
  dev-autopilot, dev-local, dev-local-autopilot, diff-explain, finish, garbage-collect,
14
- generate-bug, generate-task, help, issue, jira, kill, language, local,
14
+ generate, help, issue, jira, kill, language, local,
15
15
  local-autopilot, log, manual-test, prune-logs, purge, refactor, resume, review,
16
16
  scan, search, setup, stack, status, sync, test, update
17
17
  ```
@@ -19,7 +19,7 @@ scan, search, setup, stack, status, sync, test, update
19
19
  Categories:
20
20
 
21
21
  - **Interactive pickers** (single-purpose, not modes): `jira`, `issue`
22
- - **Issue generators** (one-shot, no worktree, hard approval gate before create): `generate-task`, `generate-bug`
22
+ - **Issue generator** (one-shot, no worktree, asks type Task/Bug/Story, hard approval gate before create): `generate`
23
23
  - **Full 8-phase modes**: `autopilot`, `local`, `local-autopilot`
24
24
  - **Fast modes** (Init -> Dev(Opus) -> Commit -> Report): `dev`, `dev-autopilot`, `dev-local`, `dev-local-autopilot`
25
25
  - **Tail modes** (run the pipeline tail over already-done local work): `finish`
@@ -30,7 +30,7 @@ Categories:
30
30
 
31
31
  ### 1.1 Figma component subphase skills
32
32
 
33
- In addition to the 37 top-level multi-agent commands, the figma-to-component pipeline ships platform-specific skills that multi-agent dispatches from Phase 3 (see `refs/component-dispatch.md`). The structure is **platform-parallel iOS + Android with a shared common pool**:
33
+ In addition to the 36 top-level multi-agent commands, the figma-to-component pipeline ships platform-specific skills that multi-agent dispatches from Phase 3 (see `refs/component-dispatch.md`). The structure is **platform-parallel iOS + Android with a shared common pool**:
34
34
 
35
35
  | Location | Skill count | Purpose |
36
36
  |---|---|---|
@@ -312,7 +312,7 @@ For clipboard ops, callers still gate with `if command -v pbpaste >/dev/null; th
312
312
 
313
313
  This contract is validated by:
314
314
 
315
- - `smoke-cross-cli-behavior.sh` - asserts all 37 commands behave identically, pulls from Section 2 (placeholder vocab), Section 5 (argument parsing), Section 6 (output formats); also regression-locks the 6-persona agent deployment
315
+ - `smoke-cross-cli-behavior.sh` - asserts all 36 commands behave identically, pulls from Section 2 (placeholder vocab), Section 5 (argument parsing), Section 6 (output formats); also regression-locks the 6-persona agent deployment
316
316
  - `smoke-commands-skills-parity.sh` (50 assertions) - enforces colon-form command ↔ dash-form skill directory parity
317
317
  - `smoke-compliance-skills.sh` (45 assertions) - enforces store-compliance skill catalog + 4 consumer wiring
318
318
  - `smoke-personal-data.sh` - extended in 0.5.5 to treat deprecated placeholders (`{github-username}`, `{your-website}`, `{website-repo}`) as leaks; adds `mmerterden` to public-handle blocklist for generic docs
@@ -0,0 +1,32 @@
1
+ # Feature: Autopilot Circuit-Breaker
2
+
3
+ **Pattern**: autopilot runs with zero interaction, which is exactly when a silent failure loop is most expensive - an agent can burn a budget re-attempting the same broken fix, or thrash between two phases, with nobody watching. A circuit-breaker converts "keep going no matter what" into "keep going until a defined unsafe condition, then halt and hand back to the user." This is the sanctioned autopilot pause (same class as the Phase 7 channels pause): the run stops, records why, and waits for an explicit `resume`.
4
+
5
+ **Gated by `prefs.global.autopilotCircuitBreaker`** (default: enabled; thresholds tunable). Halting is always safe, so the breaker itself defaults on. Disable per-run only with an explicit override. Complements, does not replace, the existing autopilot safety rules (build-fail max 3 retries, Phase 4 blocking-finding rework, destructive-op confirmations).
6
+
7
+ ## Trip conditions
8
+
9
+ Any one trips the breaker. All are evaluated from `agent-state.json` + telemetry, no extra model calls.
10
+
11
+ | # | Trigger | Detection | Default threshold |
12
+ |---|---|---|---|
13
+ | 1 | **No-progress stall** | two consecutive phase checkpoints with no forward transition (same `phase` + `step` + `reworkCount`, no new artifact/commit) | 2 checkpoints |
14
+ | 2 | **Identical repeated failure** | same normalized build-error signature, or the same Phase 4 finding fingerprint, recurs across consecutive Phase 3 rework cycles | 2 cycles |
15
+ | 3 | **Rework storm** | Phase 4 -> Phase 3 rework cycles exceed the cap (distinct from the build-retry cap) | `maxReworkCycles` = 3 |
16
+ | 4 | **Cost drift** | cumulative spend crosses the `costBudget` ceiling, or the projected next-phase spend would exceed it, after model-fallback has already downgraded | `costBudget` ceiling |
17
+ | 5 | **Merge/rebase conflict** | Phase 6 push blocked by a conflict that requires history reconciliation | any conflict |
18
+
19
+ Trigger 2 is the key addition over the plain build-retry cap: a build can "fail differently" three times (legitimate iteration) or "fail identically" twice (stuck). Only the identical-failure case is a stall; the retry cap catches the rest.
20
+
21
+ ## Action on trip
22
+
23
+ 1. Set `agent-state.json.circuitBreaker = {tripped: true, trigger: <#>, detail, checkpoint}` and flip `autopilot` handling to paused (the run does not continue unattended).
24
+ 2. Emit one actionable line per the progress contract: what tripped, the evidence (error signature / cycle count / spend vs ceiling), and the single next action (`resume #N` after a fix, or `kill #N`).
25
+ 3. Never auto-resolve the underlying cause - no force-anything, no conflict auto-merge, no budget self-raise. The breaker hands control back; it does not paper over the problem.
26
+ 4. `resume #N` clears the tripped flag and continues from the recorded checkpoint. If the same trigger fires again immediately, the breaker re-trips (no silent bypass).
27
+
28
+ ## Why this is the right autopilot exception
29
+
30
+ Autopilot's contract is "no interaction on the happy path." The circuit-breaker fires only off the happy path, where continuing unattended is the *less* safe choice: repeating a proven-broken action, or spending past a ceiling the user set, is not autonomy, it is a runaway. Halting with a precise reason is cheaper than the tokens (and trust) a silent loop burns.
31
+
32
+ Inspired by autonomous-loop operators that gate on explicit stop conditions (no-progress, identical-stack-trace repetition, cost drift, conflict blocking), adapted to this pipeline's phase/rework/state model.
@@ -1,21 +1,59 @@
1
- # Generate Issue - Shared Flow (generate-task / generate-bug)
1
+ # Generate Issue - Shared Flow (generate)
2
2
 
3
- > **TLDR** - Shared 11-step flow for `/multi-agent:generate-task` and `/multi-agent:generate-bug`. Mines the target project's existing issues to learn team conventions, detects the active sprint, drafts a standards-compliant issue, asks the user about every genuinely unknown field, renders a full preview, and creates the Jira issue only after explicit approval. Creates exactly one Jira issue per run - no branches, no commits, no worktrees.
3
+ > **TLDR** - Shared 12-step flow for `/multi-agent:generate`. Asks the issue type (Task / Bug / Story), mines the target project's existing same-type issues to learn team conventions, detects the active sprint, drafts a standards-compliant issue from a fixed standard template with auto-sizing sections, asks the user about every genuinely unknown field, renders a full preview, and creates the Jira issue only after explicit approval. Creates exactly one Jira issue per run - no branches, no commits, no worktrees.
4
4
 
5
- Consumed by `generate-task.md` and `generate-bug.md` via their profile blocks (`ISSUE_TYPE`, default description sections, JQL sample filter). This ref is never invoked directly.
5
+ Consumed by `generate.md`. This ref is never invoked directly.
6
6
 
7
7
  ## Hard rules (must not regress)
8
8
 
9
- - **Approval gate is absolute.** Step [8/11] (full preview + explicit approval) runs on every invocation. There is no autopilot variant of these commands and no preference that skips the gate. `Cancel` means nothing was created.
10
- - **Never invent content.** Anything the user did not supply and mining could not derive stays an open question (step [7/11]) or an explicitly empty section - never fabricated repro steps, environments, or acceptance criteria.
9
+ - **Approval gate is absolute.** Step [9/12] (full preview + explicit approval) runs on every invocation. There is no autopilot variant of this command and no preference that skips the gate. `Cancel` means nothing was created.
10
+ - **Never invent content.** Anything the user did not supply and mining could not derive stays an open question (step [8/12]) or is omitted entirely - never fabricated repro steps, environments, acceptance criteria, or test pass/fail results.
11
+ - **Standard template is the baseline.** The description structure comes from the type's standard template (see [7/12]), not from a mined heading set. Mining informs summary prefix, labels, components, priority norm, sprint placement, and test-scenario style - never replaces the standard section skeleton.
12
+ - **Auto-sizing.** A conditional section renders only when its trigger is present. No empty placeholder headings - if there is nothing to put in a conditional section, it does not appear.
11
13
  - **Issue content language follows `prefs.global.outputLanguage`.** Summary and description are written in the user's output language (intentional exception to the "external payloads stay English" default - the issue is authored FOR the user's team). Code identifiers, file paths, and URLs stay verbatim. AskUserQuestion `question`/`description` also follow `outputLanguage`; `label`/`header` stay English.
12
14
  - **UTF-8 verbatim POST path** (same as `refs/channels/jira.md`): description body goes to a file, `jq -n --rawfile` builds the payload, `curl --data-binary @file` ships it. Never round-trip through `unicode_escape`/`latin-1`, never hand-roll a re-encoding helper. Jira wiki markup (`h3.` headings, `[text|url]` links), real newlines, no HTML entities.
13
15
  - **Humanizer pass** on the description body after composition, before the preview render.
14
- - **Read-only until approval.** Steps 1-8 perform only GET requests. The first write of any kind is the `POST /rest/api/2/issue` in step [9/11].
16
+ - **Read-only until approval.** Steps 1-9 perform only GET requests. The first write of any kind is the `POST /rest/api/2/issue` in step [10/12].
17
+
18
+ ## Standard templates
19
+
20
+ Each type has a standard section skeleton. `A` = always present. `C` = conditional (renders only when its trigger fires).
21
+
22
+ | Type | Section | Presence | Trigger (for `C`) |
23
+ |---|---|---|---|
24
+ | **Task** | Detailed Description | A | |
25
+ | | Scope | A | |
26
+ | | Acceptance Criteria | A | |
27
+ | | Test Scenarios | A | populated from mined test-scenario style; skeleton derived from AC when the project has no prior style |
28
+ | | API Contract / Swagger | C | Swagger URL, OpenAPI/contract snippet, or explicit endpoint mention in input |
29
+ | | Design Reference | C | Figma URL given |
30
+ | | Screenshots | C | user pasted image(s) or a Figma screenshot was fetched |
31
+ | | Notes | C | real content only |
32
+ | **Bug** | Detailed Description | A | |
33
+ | | Steps to Reproduce | A | |
34
+ | | Expected Result | A | |
35
+ | | Actual Result | A | |
36
+ | | Environment | A | |
37
+ | | Screenshots / Logs | C | user pasted image(s) or log/stack-trace text |
38
+ | | Regression / Test Scenario | C | derivable from the repro; else omitted |
39
+ | | API Contract | C | API-related bug + Swagger/contract/endpoint given |
40
+ | | Design Reference | C | Figma URL given |
41
+ | | Notes | C | real content only |
42
+ | **Story** | User Story (`As a ... I want ... so that ...`) | A | |
43
+ | | Detailed Description | A | |
44
+ | | Scope | A | |
45
+ | | Acceptance Criteria | A | |
46
+ | | Test Scenarios | A | same as Task |
47
+ | | API Contract / Swagger | C | Swagger URL / contract / endpoint mention |
48
+ | | Design Reference | C | Figma URL given |
49
+ | | Screenshots | C | user pasted image(s) or Figma screenshot fetched |
50
+ | | Dependencies / Notes | C | real content only |
51
+
52
+ Section headings render in `outputLanguage` (e.g. tr: "Detaylı Açıklama", "Kapsam", "Kabul Kriterleri", "Test Senaryoları", "Adımlar", "Beklenen Sonuç", "Gerçekleşen Sonuç", "Ortam", "Ekran Görüntüleri", "API Contract", "Design Reference", "Notlar").
15
53
 
16
54
  ## Flow
17
55
 
18
- ### [1/11] Pick account (`_account-picker`)
56
+ ### [1/12] Pick account (`_account-picker`)
19
57
 
20
58
  ```bash
21
59
  ACCOUNTS=$(~/.claude/lib/account-resolver.sh --providers jira)
@@ -25,7 +63,7 @@ TOKEN=$(~/.claude/lib/credential-store.sh get "$ACCOUNT_JIRA_TOKEN_KEY")
25
63
  - Output: `ACCOUNT_JIRA_TOKEN_KEY`, `ACCOUNT_JIRA_HOST`.
26
64
  - Token missing/expired → Token Save Flow from `setup.md` inline; user skips → abort, nothing created.
27
65
 
28
- ### [2/11] Resolve project key
66
+ ### [2/12] Resolve project key
29
67
 
30
68
  Fallback chain (same as `refs/issue-jira-triad.md` Create path):
31
69
  1. `figmaConfig.jira.projectKey` (per-project config, when running inside a configured repo)
@@ -39,44 +77,55 @@ curl -s -H "Authorization: Bearer $TOKEN" \
39
77
  AskUserQuestion (single-select) → cache the choice to `prefs.global.defaultJiraKey`.
40
78
  - Output: `PROJECT_KEY`.
41
79
 
42
- ### [3/11] Parse input
80
+ ### [3/12] Pick issue type
81
+
82
+ AskUserQuestion (single-select, `question` in `outputLanguage`, e.g. tr: "Ne oluşturmak istiyorsun?"): `Task` / `Bug` / `Story`. Never inferred silently.
83
+ - Output: `ISSUE_TYPE`. Selects the standard template from the table above.
84
+ - The chosen type drives the mining JQL in [5/12], the required-field discovery in [5/12], and the section skeleton in [7/12].
85
+
86
+ ### [4/12] Parse input
43
87
 
44
88
  - Any `figma.com` URL in `$ARGUMENTS` → `FIGMA_URL`. Node-id normalization: `-` → `:`. Branch URLs use `branchKey` as effective `fileKey` (see `rules/figma-pipeline.md` URL parsing).
89
+ - Any OpenAPI/Swagger URL (path or query contains `swagger`, `openapi`, `/v2/api-docs`, `/v3/api-docs`, or a `.json`/`.yaml` spec) → `SWAGGER_URL`.
90
+ - Pasted images (chat attachments) → `USER_SCREENSHOTS[]`. Pasted log/stack-trace text → kept with `FREE_TEXT` and later mapped to the Screenshots / Logs section (Bug) or Notes.
45
91
  - Everything else → `FREE_TEXT`.
46
- - Both empty → AskUserQuestion (free-text, in `outputLanguage`): "Describe the {task|bug} you want to open."
47
- - `FIGMA_URL` is always optional. Never ask for one; only use it when given.
92
+ - All of `FREE_TEXT`/`FIGMA_URL`/`SWAGGER_URL`/`USER_SCREENSHOTS` empty → AskUserQuestion (free-text, in `outputLanguage`): "Describe the {type} you want to open."
93
+ - `FIGMA_URL`, `SWAGGER_URL`, and screenshots are always optional. Never ask for them; only use them when given.
48
94
 
49
- ### [4/11] Convention mining + field discovery + sprint detection (read-only)
95
+ ### [5/12] Convention mining + field discovery + sprint detection (read-only)
50
96
 
51
97
  Three GET groups. Run them before drafting anything.
52
98
 
53
- **4a. Sample recent same-type issues:**
99
+ **5a. Sample recent same-type issues:**
54
100
  ```bash
55
101
  JQL="project = ${PROJECT_KEY} AND issuetype = ${ISSUE_TYPE} ORDER BY created DESC"
56
102
  curl -s -H "Authorization: Bearer $TOKEN" \
57
- "https://$ACCOUNT_JIRA_HOST/rest/api/2/search?jql=$(printf '%s' "$JQL" | python3 -c 'import sys,urllib.parse; print(urllib.parse.quote(sys.stdin.read()))')&fields=summary,description,labels,components,priority,fixVersions&maxResults=30"
103
+ "https://$ACCOUNT_JIRA_HOST/rest/api/2/search?jql=$(printf '%s' "$JQL" | python3 -c 'import sys,urllib.parse; print(urllib.parse.quote(sys.stdin.read()))')&fields=summary,description,labels,components,priority,fixVersions,issuelinks&maxResults=30"
58
104
  ```
59
105
  Extract from the sample (thresholds are guidance, not hard gates):
60
- - **Summary prefix pattern**: leading `[...]` or `AREA:` token frequency. Appears in >= 40% of samples → adopt as suggested prefix; top 2-3 prefixes become AskUserQuestion options in step 7 when ambiguous.
61
- - **Description heading set**: lines matching `h[1-4]\.` or `*bold*` header style, frequency-ranked. A heading set shared by >= 50% of samples overrides the profile's default sections - the team template wins.
62
- - **Top labels / components**: top 5 each by frequencyoption lists for step 7.
63
- - **Priority norm**: modal priority for this issuetypepre-filled default, editable in preview.
64
- - **Epic usage rate**: share of sampled issues carrying an epic link decides whether step 7 asks for an epic.
65
-
66
- **4b. Field discovery (createmeta):**
106
+ - **Summary prefix pattern**: leading `[...]` or `AREA:` token frequency. Appears in >= 40% of samples → adopt as suggested prefix; top 2-3 prefixes become AskUserQuestion options in step 8 when ambiguous.
107
+ - **Top labels / components**: top 5 each by frequency option lists for step 8.
108
+ - **Priority norm**: modal priority for this issuetypepre-filled default, editable in preview. (Bug priorities often skew higher - respect the project's own norm.)
109
+ - **Epic usage rate**: share of sampled issues carrying an epic link decides whether step 8 asks for an epic.
110
+ - **Test-scenario style** (Task / Story, and Bug regression): detect how the project expresses test scenarios in the sampled descriptions and links, in priority order:
111
+ 1. Linked test issues - `issuelinks` pointing at a `Test`-family issuetype (Xray / Zephyr). If present, the standard Test Scenarios section references those linked tests rather than inlining steps.
112
+ 2. A dedicated description heading (`Test Scenarios`, `Test Cases`, `QA`, `Senaryolar`, checklist blocks). If a style is shared by >= 40% of samples, reuse that exact format (heading name + bullet/checklist/table shape).
113
+ 3. No prior style → inline a Test Scenarios skeleton derived from the Acceptance Criteria (one scenario per criterion, Given/When/Then or the project's dominant shape). Skeleton only - the user edits it in preview; pass/fail data is never fabricated.
114
+
115
+ **5b. Field discovery (createmeta):**
67
116
  ```bash
68
117
  curl -s -H "Authorization: Bearer $TOKEN" \
69
118
  "https://$ACCOUNT_JIRA_HOST/rest/api/2/issue/createmeta?projectKeys=${PROJECT_KEY}&issuetypeNames=${ISSUE_TYPE}&expand=projects.issuetypes.fields"
70
119
  ```
71
120
  - 404 or empty `projects[]` (newer Jira DC deprecates the classic form) → fall back to the paged endpoint: `GET /rest/api/2/issue/createmeta/{PROJECT_KEY}/issuetypes` then `GET /rest/api/2/issue/createmeta/{PROJECT_KEY}/issuetypes/{issuetypeId}`.
72
- - Every field with `required: true` beyond project/issuetype/summary/description/reporter → step 7 question (options from `allowedValues` when present, free-text fallback).
121
+ - Every field with `required: true` beyond project/issuetype/summary/description/reporter → step 8 question (options from `allowedValues` when present, free-text fallback).
73
122
  - Generic custom-field detection by `schema.custom` id - never assume field ids:
74
123
  - Sprint: `com.pyxis.greenhopper.jira:gh-sprint`
75
124
  - Epic Link: `com.pyxis.greenhopper.jira:gh-epic-link`
76
125
  - Team-like fields: case-insensitive name match on `Team`
77
- - 403 → warn "cannot read project field metadata", continue with profile defaults; required fields surface reactively via the 400 path in step 9.
126
+ - 403 → warn "cannot read project field metadata", continue with template defaults; required fields surface reactively via the 400 path in step 10.
78
127
 
79
- **4c. Board + active sprint (Agile REST):**
128
+ **5c. Board + active sprint (Agile REST):**
80
129
  ```bash
81
130
  curl -s -H "Authorization: Bearer $TOKEN" \
82
131
  "https://$ACCOUNT_JIRA_HOST/rest/agile/1.0/board?projectKeyOrId=${PROJECT_KEY}"
@@ -84,58 +133,72 @@ curl -s -H "Authorization: Bearer $TOKEN" \
84
133
  "https://$ACCOUNT_JIRA_HOST/rest/agile/1.0/board/${BOARD_ID}/sprint?state=active"
85
134
  ```
86
135
  - Multiple boards → AskUserQuestion (board name + type). One board → silent. Zero boards or Agile API 404 → the sprint option is silently omitted; the preview notes "backlog only (no board found)".
87
- - Active sprint found → remember `SPRINT_ID` + name for the step 7 placement choice. None → backlog only; if a `state=future` sprint exists, mention it in the preview as information.
136
+ - Active sprint found → remember `SPRINT_ID` + name for the step 8 placement choice. None → backlog only; if a `state=future` sprint exists, mention it in the preview as information.
88
137
 
89
- ### [5/11] Figma context (only when `FIGMA_URL` is set)
138
+ ### [6/12] External context (only for the sources actually provided)
90
139
 
140
+ Each source is failure-isolated and never blocks issue creation.
141
+
142
+ **6a. Figma** (only when `FIGMA_URL` is set):
91
143
  Follow the 3-tier chain from `rules/figma-pipeline.md`: Tier 1 MCP (`get_design_context` / `get_screenshot`, one re-auth retry) → Tier 2 REST (`keychainMapping.figma_pat`) → Tier 3 ask the user for a screenshot or proceed link-only.
92
144
 
93
145
  > This command is standalone (same class as `/multi-agent:analysis`), so Figma MCP use here is allowed - it is not a dev-phase violation under the "No MCP outside analysis phase" rule.
94
146
 
95
- - Output: frame name, node id, optional screenshot PNG in `/tmp/generate-issue-$$-figma.png` for the step 10 attachment opt-in.
96
- - Any tier failure degrades gracefully; Figma never blocks issue creation. Link-only is always acceptable.
147
+ - Output: frame name, node id, optional screenshot PNG in `/tmp/generate-issue-$$-figma.png` for the step 11 attachment opt-in.
148
+ - Any tier failure degrades gracefully; link-only is always acceptable.
149
+
150
+ **6b. Swagger / API contract** (only when `SWAGGER_URL` is set or a contract snippet was pasted):
151
+ - `SWAGGER_URL` set → fetch the spec, then extract **only the referenced endpoints**: if `FREE_TEXT` names specific paths / operationIds / tags, extract those; otherwise summarize the single tag or path group the user pointed at. Never crawl or dump the whole spec.
152
+ ```bash
153
+ curl -s "$SWAGGER_URL" -o /tmp/generate-issue-$$-swagger.json # add auth header only if the user supplied one
154
+ ```
155
+ Parse with `python3`/`jq` to pull, per referenced endpoint: HTTP method + path, a one-line summary, and the key request/response fields (names + types, not the full schema).
156
+ - Only a pasted contract snippet → summarize that snippet (endpoints + key fields).
157
+ - Output: an `API Contract` section body: `{METHOD} {path}` + summary + key request/response fields, plus `[Swagger|{SWAGGER_URL}]` when a URL was given.
158
+ - Fetch failure / unreachable / no matching endpoint → degrade to link-only (or omit the section if nothing usable) and note it in the preview. Never block issue creation.
159
+
160
+ **6c. Screenshots**: `USER_SCREENSHOTS[]` from step 4 are staged for the step 11 attachment opt-in; each attached image is referenced inline in the relevant section with Jira wiki `!filename|thumbnail!` markup.
97
161
 
98
- ### [6/11] Compose draft
162
+ ### [7/12] Compose draft
99
163
 
100
- Write summary + description in `outputLanguage`:
164
+ Write summary + description in `outputLanguage` from the type's **standard template** (baseline, not mined headings):
101
165
  - **Summary**: `{minedPrefix} {concise title}`, truncated to 255 chars.
102
- - **Description**: mined heading set from 4a (or the profile's default sections when mining found no dominant template), in Jira wiki markup (`h3.` headings).
103
- - Task profile fills: Goal, Scope, Acceptance Criteria, Notes from `FREE_TEXT`.
104
- - Bug profile fills: Steps to Reproduce, Expected Result, Actual Result, Environment, Notes from `FREE_TEXT`.
105
- - Missing information stays an open question for step 7 - never invented.
106
- - `FIGMA_URL` set → add `h3. Design Reference` with `[Figma|{FIGMA_URL}]` + frame name + node id.
166
+ - **Description**: render the type's standard section skeleton in Jira wiki markup (`h3.` headings), applying auto-sizing:
167
+ - **Always-present** sections are filled from `FREE_TEXT` (+ mining for Test Scenarios style). If an always-present section has no user content and cannot be derived, it stays an explicit open question for step 8 - it is not fabricated.
168
+ - **Conditional** sections render only when their trigger fired (see the Standard templates table): Design Reference when `FIGMA_URL` set (`[Figma|{FIGMA_URL}]` + frame name + node id); API Contract when 6b produced a body; Screenshots when images were staged; Notes/Dependencies only with real content. Otherwise the heading is omitted entirely.
169
+ - Bug: logs / stack traces / device+OS mentions from `FREE_TEXT` map into Environment and Screenshots / Logs; anything underivable becomes a step-8 question.
107
170
  - Run the humanizer skill on the description body.
108
171
  - Write the final body to `/tmp/generate-issue-$$.txt` (UTF-8, real newlines) for the `--rawfile` POST.
109
172
 
110
- ### [7/11] Clarifying questions (only genuinely unknown fields)
173
+ ### [8/12] Clarifying questions (only genuinely unknown fields)
111
174
 
112
175
  Batched AskUserQuestion(s), each with a "Skip / leave unset" option where Jira allows it:
113
176
  - **Component**: mined top components + "none" - only when the project uses components.
114
- - **Epic link**: only when 4a epic usage rate is high. Options from `project = {KEY} AND issuetype = Epic AND statusCategory != Done`.
177
+ - **Epic link**: only when 5a epic usage rate is high. Options from `project = {KEY} AND issuetype = Epic AND statusCategory != Done`.
115
178
  - **Priority**: only when the mined norm is ambiguous; otherwise pre-fill the norm and let the preview edit change it.
116
179
  - **Labels**: mined top labels, multiSelect.
117
180
  - **Assignee**: "me / unassigned / someone else".
118
181
  - **Sprint placement**: "Active sprint: {name}" vs "Backlog" - only when an active sprint exists.
119
- - **Required custom fields** from 4b not yet resolved (allowedValues as options).
120
- - **Bug profile**: Steps to Reproduce or Environment underivable from `FREE_TEXT` → ask here.
182
+ - **Required custom fields** from 5b not yet resolved (allowedValues as options).
183
+ - **Always-present sections still empty**: Bug Steps to Reproduce / Environment, or a Task/Story with no derivable Scope / Acceptance Criteria → ask here.
121
184
 
122
- Rule: never ask about anything already answerable from mining or the input. Regardless of how complete the draft looks, step 8 always runs.
185
+ Rule: never ask about anything already answerable from mining or the input. Regardless of how complete the draft looks, step 9 always runs.
123
186
 
124
- ### [8/11] Full preview + approval gate (never skipped)
187
+ ### [9/12] Full preview + approval gate (never skipped)
125
188
 
126
- Render the complete issue in chat: project, issuetype, summary, the full description body, priority, labels, components, epic, assignee, sprint/backlog placement, attachment plan (Figma screenshot upload - default off, opt-in).
189
+ Render the complete issue in chat: project, issuetype, summary, the full description body, priority, labels, components, epic, assignee, sprint/backlog placement, attachment plan (Figma + user screenshots upload - default off, opt-in).
127
190
 
128
191
  Then AskUserQuestion (`question` in `outputLanguage`, e.g. tr: "Bu sekilde olusturuyorum, onayliyor musun?"):
129
192
 
130
193
  | Option | Behavior |
131
194
  |---|---|
132
- | `Approve` | Proceed to step 9 |
195
+ | `Approve` | Proceed to step 10 |
133
196
  | `Edit` | Free-text "what should change?" → apply → re-render the FULL preview → re-ask. Loop, no iteration cap |
134
197
  | `Cancel` | Stop. Nothing was created; say so explicitly |
135
198
 
136
199
  This gate has no bypass. No flag, mode, or preference suppresses it.
137
200
 
138
- ### [9/11] Create
201
+ ### [10/12] Create
139
202
 
140
203
  ```bash
141
204
  jq -n --rawfile desc /tmp/generate-issue-$$.txt \
@@ -148,13 +211,13 @@ curl -sS -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application
148
211
  "https://$ACCOUNT_JIRA_HOST/rest/api/2/issue"
149
212
  ```
150
213
  - Parse `key` from the response → `NEW_KEY`.
151
- - 400 with field errors → show Jira's per-field error verbatim, return to step 7 for exactly those fields, then re-run step 8 (full preview again).
214
+ - 400 with field errors → show Jira's per-field error verbatim, return to step 8 for exactly those fields, then re-run step 9 (full preview again).
152
215
 
153
- ### [10/11] Post-create steps
216
+ ### [11/12] Post-create steps
154
217
 
155
218
  Each step is failure-isolated: on error, warn + continue - the issue already exists.
156
219
 
157
- 1. **Sprint** (when chosen in step 7/8):
220
+ 1. **Sprint** (when chosen in step 8/9):
158
221
  ```bash
159
222
  jq -n --arg key "$NEW_KEY" '{issues: [$key]}' > /tmp/generate-issue-$$-sprint.json
160
223
  curl -sS -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
@@ -168,30 +231,37 @@ curl -sS -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application
168
231
  -d '{"object":{"url":"'"$FIGMA_URL"'","title":"Figma design"}}' \
169
232
  "https://$ACCOUNT_JIRA_HOST/rest/api/2/issue/${NEW_KEY}/remotelink"
170
233
  ```
171
- 3. **Screenshot attachment** (only when opted in during preview):
234
+ 3. **Swagger remote link** (when `SWAGGER_URL` set):
235
+ ```bash
236
+ curl -sS -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
237
+ -d '{"object":{"url":"'"$SWAGGER_URL"'","title":"API contract"}}' \
238
+ "https://$ACCOUNT_JIRA_HOST/rest/api/2/issue/${NEW_KEY}/remotelink"
239
+ ```
240
+ 4. **Screenshot / image attachments** (only when opted in during preview - Figma render and/or user-pasted images):
172
241
  ```bash
173
242
  curl -sS -X POST -H "Authorization: Bearer $TOKEN" -H "X-Atlassian-Token: no-check" \
174
243
  -F "file=@/tmp/generate-issue-$$-figma.png" \
175
244
  "https://$ACCOUNT_JIRA_HOST/rest/api/2/issue/${NEW_KEY}/attachments"
176
245
  ```
177
246
 
178
- ### [11/11] Report
247
+ ### [12/12] Report
179
248
 
180
249
  ```
181
250
  Created {NEW_KEY}: https://{ACCOUNT_JIRA_HOST}/browse/{NEW_KEY}
182
251
  ```
183
- Plus one line per post-create step that ran (sprint placement, remote link, attachment) and any that were skipped with reason.
252
+ Plus one line per post-create step that ran (sprint placement, remote links, attachments) and any that were skipped with reason.
184
253
 
185
254
  ## Error paths
186
255
 
187
256
  | Condition | Behavior |
188
257
  |---|---|
189
258
  | Token missing/expired (401) | Token Save Flow from `setup.md` inline; user skips → abort with message, nothing created |
190
- | Search 403 / createmeta denied | Warn "cannot read project conventions/fields"; continue with profile-default template; required fields asked reactively on 400 |
191
- | Zero sampled issues (new project) | Skip mining, use profile defaults, note in preview "no prior issues to learn from" |
259
+ | Search 403 / createmeta denied | Warn "cannot read project conventions/fields"; continue with standard-template defaults; required fields asked reactively on 400 |
260
+ | Zero sampled issues (new project) | Skip mining, use standard template + AC-derived test-scenario skeleton, note in preview "no prior issues to learn from" |
192
261
  | Agile API 404 / no boards | Omit sprint choice, backlog implied, say so in preview |
193
262
  | No active sprint | Offer backlog only; mention the next `state=future` sprint when one exists |
194
263
  | Figma Tier 1 fails | Tier 2; Tier 2 fails → Tier 3 (ask screenshot or link-only). Never block issue creation on Figma |
195
- | Create 400 (field errors) | Show per-field errors, loop back to step 7 for those fields, re-preview |
264
+ | Swagger fetch fails / unreachable | Degrade to link-only, or omit the API Contract section if nothing usable; note in preview. Never block issue creation |
265
+ | Create 400 (field errors) | Show per-field errors, loop back to step 8 for those fields, re-preview |
196
266
  | Create 5xx / network | Show the error, offer one retry, then abort - keep `/tmp/generate-issue-$$.txt` and print its path so the draft survives |
197
267
  | Post-create step failure | Warn + continue (issue exists); print a manual-fix hint |
@@ -35,6 +35,7 @@ Autopilot mode skips interactive confirmations and runs the pipeline end-to-end
35
35
  - Phase 4 Review -> if blocking finding, returns to Phase 3, auto fix + rebuild (safety)
36
36
  - Kill/Purge confirmations -> destructive operations always ask
37
37
  - Build fail -> auto fix + rebuild (max 3 retries). After 3 retries still failing -> pause, ask user
38
+ - **Circuit-breaker** -> autopilot halts (records reason, waits for `resume`) on a no-progress stall, an identical repeated failure, a rework storm, cost drift past the `costBudget` ceiling, or a merge/rebase conflict. Full wiring: `refs/features/autopilot-circuit-breaker.md`. This is the sanctioned autopilot pause - continuing unattended off the happy path is the less safe choice.
38
39
  - **Phase 7 channels dispatch** -> always pauses for multi-select. Rationale: Jira/Confluence are externally visible; silently posting wrong-tone content leaks team-visible artifacts. See below.
39
40
 
40
41
  **State tracking**: `agent-state.json` gets `"autopilot": true`. Autopilot continues on resume as well.
@@ -56,6 +56,6 @@ In autopilot, `ask_choice` resolves to `default` (or the safe first option) with
56
56
 
57
57
  ## Deterministic gates note
58
58
 
59
- Claude Code's `PreToolUse` exit-2 hook is the one HARD blocking gate: the secret scan runs on every `git commit` and a non-zero exit blocks it. The recommended hook block ships at `install/templates/claude-hooks.json`; `multi-agent:setup` offers to merge it into `~/.claude/settings.json`. Only the secret scan is naturally a PreToolUse hook (it needs no run-specific arguments) - the other deterministic gates (evidence, consensus, intent, learnings) are invoked by the pipeline phases with per-run arguments (a build-log path, the triage JSON, the free-text input), so they are phase-enforced by contract, not OS-hookable.
59
+ Claude Code's `PreToolUse` exit-2 hooks are the HARD blocking gates. Two ship, both needing no run-specific arguments so they are naturally hookable: (1) `pre-commit-check.sh` scans the staged diff on every `git commit` and blocks on a detected secret; (2) `agent-guard.sh` runs on `git commit` + `git push` and blocks AI/assistant attribution in a commit message and force-push to a protected branch (main/master/develop). Both are self-contained, fail-open on internal error, and never execute the inspected command. The recommended hook block ships at `install/templates/claude-hooks.json`; `multi-agent:setup` offers to merge it into `~/.claude/settings.json`. The other deterministic gates (evidence, consensus, intent, learnings) are invoked by the pipeline phases with per-run arguments (a build-log path, the triage JSON, the free-text input), so they are phase-enforced by contract, not OS-hookable.
60
60
 
61
61
  Copilot CLI has no `PreToolUse` equivalent, so the secret scan there is workflow-enforced (run as a phase step, not OS-blocked) plus a CI smoke-gate step.