@mmerterden/multi-agent-pipeline 17.6.0 → 19.0.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.
- package/CHANGELOG.md +310 -0
- package/README.md +76 -18
- package/README.tr.md +55 -16
- package/docs/adr/0002-instruction-driven-flag.md +1 -0
- package/docs/adr/0005-lazy-phase-docs.md +11 -1
- package/docs/adr/0008-installer-modularization-and-secret-leak-defense.md +1 -0
- package/docs/adr/0010-own-code-graph.md +1 -0
- package/docs/adr/0011-dormant-ci.md +25 -1
- package/docs/adr/0014-six-phase-consolidation.md +134 -0
- package/docs/adr/README.md +2 -1
- package/docs/architecture.md +37 -38
- package/docs/best-practices.md +1 -1
- package/docs/ecosystem.md +37 -26
- package/docs/engineering.md +1 -1
- package/docs/facts.json +45 -0
- package/docs/features.md +54 -53
- package/docs/performance.md +5 -5
- package/docs/recovery-guide.md +9 -9
- package/docs/server-readiness.md +188 -0
- package/docs/token-budget-history.md +3 -1
- package/index.js +18 -3
- package/install/_codex-agents.mjs +1 -1
- package/install/_common.mjs +42 -17
- package/install/_dev-only-files.mjs +8 -0
- package/install/_unattended-profile.mjs +113 -0
- package/install/index.mjs +48 -0
- package/install/templates/claude-hooks.json +1 -1
- package/install/templates/codex-instructions.md +1 -1
- package/install/templates/copilot-instructions.md +28 -28
- package/manifest.json +1065 -0
- package/package.json +6 -3
- package/pipeline/agents/dev-critic.md +3 -3
- package/pipeline/commands/figma-to-swiftui.md +1 -1
- package/pipeline/commands/multi-agent/SKILL.md +8 -8
- package/pipeline/commands/multi-agent/analysis/SKILL.md +9 -9
- package/pipeline/commands/multi-agent/autopilot/SKILL.md +7 -7
- package/pipeline/commands/multi-agent/channels/SKILL.md +15 -15
- package/pipeline/commands/multi-agent/diff-explain/SKILL.md +6 -6
- package/pipeline/commands/multi-agent/garbage-collect/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/graph/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/help/SKILL.md +62 -62
- package/pipeline/commands/multi-agent/language/SKILL.md +2 -2
- package/pipeline/commands/multi-agent/local/SKILL.md +11 -11
- package/pipeline/commands/multi-agent/local-autopilot/SKILL.md +13 -13
- package/pipeline/commands/multi-agent/log/SKILL.md +2 -2
- package/pipeline/commands/multi-agent/manual-test/SKILL.md +9 -9
- package/pipeline/commands/multi-agent/model/SKILL.md +69 -0
- package/pipeline/commands/multi-agent/refactor/SKILL.md +3 -3
- package/pipeline/commands/multi-agent/resume/SKILL.md +4 -4
- package/pipeline/commands/multi-agent/resume-local/SKILL.md +19 -17
- package/pipeline/commands/multi-agent/review/SKILL.md +1 -1
- package/pipeline/commands/multi-agent/route-off/SKILL.md +36 -0
- package/pipeline/commands/multi-agent/route-on/SKILL.md +74 -0
- package/pipeline/commands/multi-agent/route-status/SKILL.md +56 -0
- package/pipeline/commands/multi-agent/setup/SKILL.md +2 -2
- package/pipeline/commands/multi-agent/status/SKILL.md +54 -23
- package/pipeline/commands/multi-agent/steer/SKILL.md +2 -2
- package/pipeline/commands/multi-agent/sync/SKILL.md +12 -13
- package/pipeline/commands/multi-agent/test/SKILL.md +1 -1
- package/pipeline/lib/_jira-auth.sh +8 -0
- package/pipeline/lib/analysis-jira-write.sh +32 -0
- package/pipeline/lib/ask-choice.sh +13 -2
- package/pipeline/lib/autopilot-state.sh +8 -0
- package/pipeline/lib/credential-inventory.sh +1 -1
- package/pipeline/lib/fatal.mjs +129 -0
- package/pipeline/lib/fetch-fortify.sh +1 -1
- package/pipeline/lib/figma-mcp-refresh.sh +18 -0
- package/pipeline/lib/figma-screenshot.sh +18 -0
- package/pipeline/lib/invoked-directly.mjs +43 -0
- package/pipeline/lib/jira-publish.sh +42 -0
- package/pipeline/lib/md2confluence-v3.py +47 -0
- package/pipeline/lib/model-rung.sh +142 -0
- package/pipeline/lib/outbound-gate.mjs +175 -0
- package/pipeline/lib/phase-schema.mjs +88 -0
- package/pipeline/lib/plan-todos.sh +32 -11
- package/pipeline/lib/post-pr-review.sh +77 -8
- package/pipeline/lib/repo-hygiene.sh +8 -3
- package/pipeline/lib/require-jq.sh +40 -0
- package/pipeline/lib/route-state.sh +161 -0
- package/pipeline/lib/run-paths.sh +335 -0
- package/pipeline/multi-agent-refs/_account-picker.md +1 -1
- package/pipeline/multi-agent-refs/_dev-context.md +1 -1
- package/pipeline/multi-agent-refs/_input-parser.md +1 -1
- package/pipeline/multi-agent-refs/analysis/evidence.md +0 -9
- package/pipeline/multi-agent-refs/analysis/intake.md +1 -1
- package/pipeline/multi-agent-refs/analysis/locked.md +21 -22
- package/pipeline/multi-agent-refs/analysis/render.md +1 -1
- package/pipeline/multi-agent-refs/analysis/synthesis.md +12 -6
- package/pipeline/multi-agent-refs/android-guide.md +1 -1
- package/pipeline/multi-agent-refs/audit-guide.md +13 -13
- package/pipeline/multi-agent-refs/channels/issue-comment.md +2 -2
- package/pipeline/multi-agent-refs/channels/jira.md +3 -3
- package/pipeline/multi-agent-refs/channels/pr.md +4 -4
- package/pipeline/multi-agent-refs/channels/wiki.md +1 -1
- package/pipeline/multi-agent-refs/component-dispatch.md +3 -3
- package/pipeline/multi-agent-refs/cross-cli-contract.md +31 -6
- package/pipeline/multi-agent-refs/features/autopilot-circuit-breaker.md +74 -4
- package/pipeline/multi-agent-refs/features/code-graph.md +5 -5
- package/pipeline/multi-agent-refs/features/cost-analysis.md +93 -0
- package/pipeline/multi-agent-refs/features/design-conformance.md +1 -1
- package/pipeline/multi-agent-refs/features/dev-critic.md +3 -3
- package/pipeline/multi-agent-refs/features/doctor.md +47 -2
- package/pipeline/multi-agent-refs/features/external-context-injection.md +3 -3
- package/pipeline/multi-agent-refs/features/maturity-followup.md +3 -3
- package/pipeline/multi-agent-refs/features/model-fallback.md +5 -5
- package/pipeline/multi-agent-refs/features/plan-todos.md +1 -1
- package/pipeline/multi-agent-refs/features/repo-map.md +1 -1
- package/pipeline/multi-agent-refs/features/review-delta.md +3 -3
- package/pipeline/multi-agent-refs/features/review-multi-repo.md +1 -1
- package/pipeline/multi-agent-refs/features/scope-check.md +4 -4
- package/pipeline/multi-agent-refs/features/skill-conformance.md +2 -2
- package/pipeline/multi-agent-refs/features/stack-skill-routing.md +1 -1
- package/pipeline/multi-agent-refs/features/verify-by-test.md +4 -4
- package/pipeline/multi-agent-refs/features/verify.md +83 -0
- package/pipeline/multi-agent-refs/features/visual-evidence.md +19 -19
- package/pipeline/multi-agent-refs/features/worktree-finalize.md +6 -6
- package/pipeline/multi-agent-refs/issue-jira-triad.md +10 -10
- package/pipeline/multi-agent-refs/knowledge.md +11 -11
- package/pipeline/multi-agent-refs/multi-repo-integration-build.md +13 -13
- package/pipeline/multi-agent-refs/payload-contracts.md +8 -8
- package/pipeline/multi-agent-refs/phases/log-format.md +10 -10
- package/pipeline/multi-agent-refs/phases/modes.md +30 -30
- package/pipeline/multi-agent-refs/phases/operations.md +21 -10
- package/pipeline/multi-agent-refs/phases/phase-0-init.md +25 -25
- package/pipeline/multi-agent-refs/phases/phase-1-plan.md +599 -0
- package/pipeline/multi-agent-refs/phases/{phase-3-dev.md → phase-2-dev.md} +129 -49
- package/pipeline/multi-agent-refs/phases/{phase-4-review.md → phase-3-review.md} +225 -107
- package/pipeline/multi-agent-refs/phases/{phase-6-commit.md → phase-4-commit.md} +23 -23
- package/pipeline/multi-agent-refs/phases/{phase-7-report.md → phase-5-report.md} +29 -29
- package/pipeline/multi-agent-refs/phases.md +44 -48
- package/pipeline/multi-agent-refs/picker-contract.md +1 -1
- package/pipeline/multi-agent-refs/progress-contract.md +6 -6
- package/pipeline/multi-agent-refs/readiness-review.md +1 -1
- package/pipeline/multi-agent-refs/rules.md +7 -7
- package/pipeline/multi-agent-refs/swiftui-guide.md +2 -2
- package/pipeline/multi-agent-refs/tracker-contract.md +31 -32
- package/pipeline/multi-agent-refs/unattended-contract.md +129 -0
- package/pipeline/multi-agent-refs/wiki-capture.md +14 -14
- package/pipeline/preferences-template.json +9 -1
- package/pipeline/rules/outside-the-pipeline.md +1 -1
- package/pipeline/schemas/agent-state.schema.json +50 -50
- package/pipeline/schemas/analysis-output.schema.json +2 -2
- package/pipeline/schemas/autopilot-config.schema.json +1 -1
- package/pipeline/schemas/code-graph.schema.json +1 -1
- package/pipeline/schemas/criteria-manifest.schema.json +1 -1
- package/pipeline/schemas/dev-critic-output.schema.json +1 -1
- package/pipeline/schemas/diff-risk.schema.json +1 -1
- package/pipeline/schemas/migrations/prefs-2.4.0-to-2.5.0.mjs +2 -2
- package/pipeline/schemas/migrations/prefs-2.6.0-to-2.7.0.mjs +31 -0
- package/pipeline/schemas/migrations/state-2.1.0-to-2.2.0.mjs +129 -0
- package/pipeline/schemas/phases.json +105 -0
- package/pipeline/schemas/plan-todos.schema.json +5 -5
- package/pipeline/schemas/planning-output.schema.json +1 -1
- package/pipeline/schemas/prefs.schema.json +100 -56
- package/pipeline/schemas/reviewer-output.schema.json +3 -3
- package/pipeline/schemas/route-config.schema.json +74 -0
- package/pipeline/schemas/scope-check.schema.json +1 -1
- package/pipeline/schemas/test-gap.schema.json +1 -1
- package/pipeline/schemas/token-budget.json +12 -18
- package/pipeline/schemas/triage-output.schema.json +6 -6
- package/pipeline/scripts/README.md +3 -3
- package/pipeline/scripts/_code-graph.mjs +2 -2
- package/pipeline/scripts/_run-paths.mjs +372 -0
- package/pipeline/scripts/_smoke-root.sh +1 -1
- package/pipeline/scripts/aggregate-metrics.mjs +65 -65
- package/pipeline/scripts/autopilot-arming.mjs +2 -1
- package/pipeline/scripts/autopilot-intake.mjs +2 -1
- package/pipeline/scripts/autopilot-runner.mjs +206 -2
- package/pipeline/scripts/build-references.mjs +2 -1
- package/pipeline/scripts/build-stack-plugins.mjs +10 -2
- package/pipeline/scripts/capture-evidence.sh +7 -2
- package/pipeline/scripts/capture-flush.sh +8 -8
- package/pipeline/scripts/capture-resume.sh +3 -3
- package/pipeline/scripts/classify-plan-safety.mjs +3 -2
- package/pipeline/scripts/cost-analyze.mjs +600 -0
- package/pipeline/scripts/cost-budget-check.mjs +4 -12
- package/pipeline/scripts/council-view.mjs +2 -1
- package/pipeline/scripts/crush-json.mjs +2 -1
- package/pipeline/scripts/diff-explain.mjs +7 -10
- package/pipeline/scripts/diff-risk-score.mjs +2 -1
- package/pipeline/scripts/doctor.mjs +140 -6
- package/pipeline/scripts/evidence-gate.mjs +9 -3
- package/pipeline/scripts/feedback-send.mjs +12 -2
- package/pipeline/scripts/gc-abandoned.sh +32 -16
- package/pipeline/scripts/gc-tmp.sh +1 -1
- package/pipeline/scripts/gc-worktrees.sh +12 -5
- package/pipeline/scripts/gen-facts.mjs +175 -0
- package/pipeline/scripts/gen-mode-dispatch.mjs +32 -37
- package/pipeline/scripts/gen-ref-toc.mjs +1 -1
- package/pipeline/scripts/github-ssh-setup.sh +64 -7
- package/pipeline/scripts/graph-mermaid.mjs +4 -2
- package/pipeline/scripts/graph-report.mjs +1 -1
- package/pipeline/scripts/jira-attach.sh +1 -1
- package/pipeline/scripts/keychain-save.sh +101 -30
- package/pipeline/scripts/learn-from-transcripts.mjs +3 -2
- package/pipeline/scripts/learning-curve.mjs +36 -31
- package/pipeline/scripts/log-metric.sh +17 -4
- package/pipeline/scripts/make-manifest.mjs +199 -0
- package/pipeline/scripts/memory-save.sh +1 -1
- package/pipeline/scripts/migrate-prefs.mjs +24 -6
- package/pipeline/scripts/migrate-state.mjs +94 -4
- package/pipeline/scripts/phase-banner.sh +26 -22
- package/pipeline/scripts/phase-tracker.sh +48 -10
- package/pipeline/scripts/plan-coverage-gate.mjs +8 -4
- package/pipeline/scripts/pre-commit-check.sh +7 -0
- package/pipeline/scripts/pre-push-check.sh +7 -0
- package/pipeline/scripts/purge.sh +23 -6
- package/pipeline/scripts/render-agent-log-cost.sh +10 -3
- package/pipeline/scripts/render-cost-summary.sh +9 -2
- package/pipeline/scripts/render-work-summary.sh +14 -7
- package/pipeline/scripts/review-file-filter.mjs +5 -3
- package/pipeline/scripts/review-scope.mjs +2 -1
- package/pipeline/scripts/routine-registry.mjs +2 -1
- package/pipeline/scripts/run-aggregator.mjs +26 -20
- package/pipeline/scripts/run-metrics.mjs +4 -2
- package/pipeline/scripts/runs-index.mjs +353 -0
- package/pipeline/scripts/scorecard-snapshot.mjs +178 -0
- package/pipeline/scripts/search-logs.sh +18 -0
- package/pipeline/scripts/smoke-cross-cli-behavior.sh +6 -6
- package/pipeline/scripts/smoke-schema-validation.sh +26 -7
- package/pipeline/scripts/test-gap-scan.mjs +2 -1
- package/pipeline/scripts/test-integrity-gate.mjs +2 -1
- package/pipeline/scripts/token-budget-report.mjs +13 -2
- package/pipeline/scripts/triage-memory.mjs +2 -2
- package/pipeline/scripts/update-issue-progress.sh +56 -7
- package/pipeline/scripts/usage-report.mjs +12 -1
- package/pipeline/scripts/validate-analysis-doc.mjs +75 -18
- package/pipeline/scripts/validate-code-graph.mjs +6 -3
- package/pipeline/scripts/validate-complaint-doc.mjs +2 -1
- package/pipeline/scripts/validate-diff-risk.mjs +6 -3
- package/pipeline/scripts/validate-planning.mjs +1 -1
- package/pipeline/scripts/validate-reviewer.mjs +1 -1
- package/pipeline/scripts/validate-state.mjs +45 -5
- package/pipeline/scripts/validate-test-gap.mjs +6 -3
- package/pipeline/scripts/validate-triage.mjs +6 -4
- package/pipeline/scripts/verify-citations.mjs +4 -2
- package/pipeline/scripts/verify.mjs +327 -0
- package/pipeline/scripts/worktree-finalize.sh +18 -9
- package/pipeline/scripts/write-state.mjs +154 -15
- package/pipeline/skills/.skill-manifest.json +37 -21
- package/pipeline/skills/.skills-index.json +104 -5
- package/pipeline/skills/shared/README.md +15 -6
- package/pipeline/skills/shared/core/apple-archive-compliance/SKILL.md +2 -2
- package/pipeline/skills/shared/core/google-play-compliance/SKILL.md +2 -2
- package/pipeline/skills/shared/core/multi-agent/SKILL.md +69 -71
- package/pipeline/skills/shared/core/multi-agent-autopilot/SKILL.md +3 -3
- package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +14 -14
- package/pipeline/skills/shared/core/multi-agent-diff-explain/SKILL.md +5 -5
- package/pipeline/skills/shared/core/multi-agent-graph/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-help/SKILL.md +25 -23
- package/pipeline/skills/shared/core/multi-agent-language/SKILL.md +2 -2
- package/pipeline/skills/shared/core/multi-agent-local/SKILL.md +2 -2
- package/pipeline/skills/shared/core/multi-agent-local-autopilot/SKILL.md +8 -8
- package/pipeline/skills/shared/core/multi-agent-manual-test/SKILL.md +6 -6
- package/pipeline/skills/shared/core/multi-agent-model/SKILL.md +71 -0
- package/pipeline/skills/shared/core/multi-agent-refactor/SKILL.md +3 -3
- package/pipeline/skills/shared/core/multi-agent-resume/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-resume-local/SKILL.md +7 -7
- package/pipeline/skills/shared/core/multi-agent-route-off/SKILL.md +39 -0
- package/pipeline/skills/shared/core/multi-agent-route-on/SKILL.md +76 -0
- package/pipeline/skills/shared/core/multi-agent-route-status/SKILL.md +59 -0
- package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +1 -1
- package/pipeline/skills/shared/core/multi-agent-status/SKILL.md +35 -11
- package/pipeline/skills/shared/core/multi-agent-steer/SKILL.md +2 -2
- package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +6 -5
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/package_app.sh +4 -1
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/setup_dev_signing.sh +4 -1
- package/pipeline/skills/shared/external/macos-spm-app-packaging/assets/templates/sign-and-notarize.sh +2 -1
- package/pipeline/skills/skills-index.md +13 -4
- package/pipeline/multi-agent-refs/phases/phase-1-analysis.md +0 -263
- package/pipeline/multi-agent-refs/phases/phase-2-planning.md +0 -344
- package/pipeline/multi-agent-refs/phases/phase-5-test.md +0 -182
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- [Auto-run steps (when host is learned)](#auto-run-steps-when-host-is-learned)
|
|
8
8
|
- [Error evaluation contract](#error-evaluation-contract)
|
|
9
9
|
- [Autopilot behavior](#autopilot-behavior)
|
|
10
|
-
- [Phase
|
|
10
|
+
- [Phase 5 knowledge capture](#phase-5-knowledge-capture)
|
|
11
11
|
- [Generic rule (for copilot-instructions.md)](#generic-rule-for-copilot-instructionsmd)
|
|
12
12
|
- [Schema](#schema)
|
|
13
13
|
- [Smoke coverage](#smoke-coverage)
|
|
@@ -27,7 +27,7 @@ Codegen outputs (identifiers, localization keys, tokens) in Repo A get reference
|
|
|
27
27
|
|
|
28
28
|
## When this rule fires
|
|
29
29
|
|
|
30
|
-
In Phase
|
|
30
|
+
In Phase 4 (Commit & PR), **before** the pre-commit local checkout prompt, if `state.projects.length >= 2`:
|
|
31
31
|
|
|
32
32
|
1. Compute `repoSet` = sorted array of touched repo names.
|
|
33
33
|
2. Look up `prefs.global.multiRepoIntegrationHosts` for an entry whose `repoSet` (sorted) equals this combo.
|
|
@@ -100,7 +100,7 @@ Persist to `prefs.global.multiRepoIntegrationHosts[]`:
|
|
|
100
100
|
|
|
101
101
|
## Auto-run steps (when host is learned)
|
|
102
102
|
|
|
103
|
-
Progress-contract line `→ integrating <host-scheme> with <N> submodules`. Tracker sub-step on Phase
|
|
103
|
+
Progress-contract line `→ integrating <host-scheme> with <N> submodules`. Tracker sub-step on Phase 4 to show live status: `phase-tracker.sh sub 4 0 "Integration build" in_progress`.
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
106
|
HOST="$(jq -r --arg key "$repoSet_sorted_joined" \
|
|
@@ -126,12 +126,12 @@ BUILD_ERRORS=$(eval "$BUILD_CMD" 2>&1 | grep -E "error:|FAILURE:|error FS" || tr
|
|
|
126
126
|
|
|
127
127
|
# 4. Evaluate + decide
|
|
128
128
|
if [ -z "$BUILD_ERRORS" ]; then
|
|
129
|
-
phase-tracker.sh sub
|
|
130
|
-
log "Phase
|
|
129
|
+
phase-tracker.sh sub 4 0 "Integration build" completed
|
|
130
|
+
log "Phase 4.0: Integration build - clean"
|
|
131
131
|
# proceed to pre-commit checkout prompt + commit
|
|
132
132
|
else
|
|
133
|
-
phase-tracker.sh sub
|
|
134
|
-
log "Phase
|
|
133
|
+
phase-tracker.sh sub 4 0 "Integration build" failed
|
|
134
|
+
log "Phase 4.0: Integration build - NEW errors detected"
|
|
135
135
|
# show errors, ask user
|
|
136
136
|
fi
|
|
137
137
|
```
|
|
@@ -150,13 +150,13 @@ Three outcomes after the build:
|
|
|
150
150
|
Integration build failed with N new errors. Pipeline can go back to
|
|
151
151
|
Phase 3 to fix, or you can fix manually and tell the pipeline to retry.
|
|
152
152
|
|
|
153
|
-
[1] Return to Phase
|
|
153
|
+
[1] Return to Phase 2: Dev with these errors as input (auto-fix attempt)
|
|
154
154
|
[2] Pause - I'll fix manually, then /multi-agent resume
|
|
155
|
-
[3] Override - proceed to commit anyway (logs a warning in Phase
|
|
155
|
+
[3] Override - proceed to commit anyway (logs a warning in Phase 5 report)
|
|
156
156
|
|
|
157
157
|
Select [1-3]:
|
|
158
158
|
```
|
|
159
|
-
3. **Pre-existing errors (unrelated to this task)** → if the pipeline has a baseline error count (from a clean pre-change build), compare deltas. When `current_errors <= baseline`, treat as **no new errors** and proceed; log the pre-existing count in Phase
|
|
159
|
+
3. **Pre-existing errors (unrelated to this task)** → if the pipeline has a baseline error count (from a clean pre-change build), compare deltas. When `current_errors <= baseline`, treat as **no new errors** and proceed; log the pre-existing count in Phase 5 Report.
|
|
160
160
|
|
|
161
161
|
---
|
|
162
162
|
|
|
@@ -164,13 +164,13 @@ Three outcomes after the build:
|
|
|
164
164
|
|
|
165
165
|
Autopilot skips the "Override / pause" prompt. If `count` < 3 on this combo (new / low-confidence), autopilot treats a build failure as BLOCKING and returns to Phase 3 automatically (option 1). If `count >= 3` and `lastResult == success`, a new failure is treated as blocking the same way - but with lower surprise since we've seen this combo succeed before.
|
|
166
166
|
|
|
167
|
-
The learn-once prompt itself also skips under autopilot: instead, autopilot logs `"Phase
|
|
167
|
+
The learn-once prompt itself also skips under autopilot: instead, autopilot logs `"Phase 4.0: SKIPPED - no learned host for this combo, autopilot refuses to prompt. Run in normal mode once to teach."` and proceeds. This is explicit and recoverable.
|
|
168
168
|
|
|
169
169
|
---
|
|
170
170
|
|
|
171
|
-
## Phase
|
|
171
|
+
## Phase 5 knowledge capture
|
|
172
172
|
|
|
173
|
-
When a learn-once prompt writes a new entry, Phase
|
|
173
|
+
When a learn-once prompt writes a new entry, Phase 5 Step 5 (knowledge + memory) ALSO writes a project-scoped memory:
|
|
174
174
|
|
|
175
175
|
```
|
|
176
176
|
Type: reference
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Canonical required-reading list for outward-facing payloads (PR body, Jira comment, closing report) plus the markup dialect per surface. Loaded by every mode that runs Phase
|
|
2
|
+
description: "Canonical required-reading list for outward-facing payloads (PR body, Jira comment, closing report) plus the markup dialect per surface. Loaded by every mode that runs Phase 4 or Phase 5."
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Outward-facing payload contracts
|
|
6
6
|
|
|
7
7
|
> Every mode that opens a PR, comments on a tracker, or closes out a run reads this file first. It does not restate the contracts - it names them, so no mode has to carry its own copy and drift from the others.
|
|
8
8
|
|
|
9
|
-
## Read before Phase
|
|
9
|
+
## Read before Phase 4
|
|
10
10
|
|
|
11
11
|
| Read | Before | Governs |
|
|
12
12
|
|---|---|---|
|
|
13
13
|
| [`channels/pr.md`]($HOME/.claude/multi-agent-refs/channels/pr.md) | assembling the PR body | fixed section set (`summary` → `changes` → `architecture` cond. → `verification` → `risk` cond. → `dependencies` cond. → `related`), Markdown-only rule, reviewer-preserving Bitbucket PUT payload |
|
|
14
|
-
| [`phases/phase-
|
|
14
|
+
| [`phases/phase-4-commit.md`]($HOME/.claude/multi-agent-refs/phases/phase-4-commit.md) | committing | commit convention, default-reviewer fetch, draft/ready prompt, push-must-succeed loop |
|
|
15
15
|
| [`rules.md`]($HOME/.claude/multi-agent-refs/rules.md) "External System Outputs" | any REST payload | real newlines, no HTML entities, no hand-rolled JSON, markup dialect per surface |
|
|
16
16
|
|
|
17
|
-
## Read before Phase
|
|
17
|
+
## Read before Phase 5
|
|
18
18
|
|
|
19
19
|
| Read | Before | Governs |
|
|
20
20
|
|---|---|---|
|
|
21
21
|
| [`channels/jira.md`]($HOME/.claude/multi-agent-refs/channels/jira.md) | posting the Jira comment | fixed section set incl. **Test Scenarios** (Given/When/Then, always present), markdown→wiki conversion table |
|
|
22
22
|
| [`channels/confluence.md`]($HOME/.claude/multi-agent-refs/channels/confluence.md) | writing a Confluence page | storage-format conversion, endpoint flavor |
|
|
23
|
-
| [`phases/phase-
|
|
23
|
+
| [`phases/phase-5-report.md`]($HOME/.claude/multi-agent-refs/phases/phase-5-report.md) | closing out | Timeline + Agent Activity + Cost Breakdown tables, missing-telemetry disclosure |
|
|
24
24
|
| [`tracker-contract.md`]($HOME/.claude/multi-agent-refs/tracker-contract.md) | every phase boundary | per-phase token narration, completion tile suffix |
|
|
25
25
|
|
|
26
26
|
## Markup dialect per surface
|
|
@@ -44,12 +44,12 @@ A payload that is in the right language but the wrong dialect is a defect of the
|
|
|
44
44
|
|
|
45
45
|
The run ends with the phase tracker glyph block **and** the numbers behind it - per-phase duration and token spend, plus totals.
|
|
46
46
|
|
|
47
|
-
- Record spend as you go: `phase-tracker.sh tokens <N> <in> <out> [cached]` after **every** LLM call, including each Phase
|
|
47
|
+
- Record spend as you go: `phase-tracker.sh tokens <N> <in> <out> [cached]` after **every** LLM call, including each Phase 3 reviewer subagent and each Phase 3 chunk. Counts are additive and nothing reconstructs them after the fact.
|
|
48
48
|
- Tag the model once per phase (`phase-tracker.sh model <N> <name>`) or the cost helper cannot price it and prints `-`.
|
|
49
49
|
- Durations come from the phase timestamps and survive a missed `tokens` call; token spend does not.
|
|
50
50
|
- If any phase has no token data, name those phases and say their cost is unavailable. Never print a report whose cost section is simply absent - the reader cannot tell "cheap run" from "nobody recorded it".
|
|
51
51
|
|
|
52
|
-
### Missing-telemetry disclosure (Phase
|
|
52
|
+
### Missing-telemetry disclosure (Phase 5, required)
|
|
53
53
|
|
|
54
54
|
Before composing the report, compute which phases carry no token data:
|
|
55
55
|
|
|
@@ -64,4 +64,4 @@ Non-empty `UNTRACKED` → both the agent-log report and the closing chat summary
|
|
|
64
64
|
|
|
65
65
|
## Fast modes are not exempt
|
|
66
66
|
|
|
67
|
-
A Short run skips Analysis and Planning, and the autopilot and local entries skip the interactive test gate. They run Phase
|
|
67
|
+
A Short run skips Analysis and Planning, and the autopilot and local entries skip the interactive test gate. They run Phase 4 and Phase 5 **unchanged**. A short pipeline is not a licence for an improvised payload shape, a missing Test Scenarios section, or a report without numbers.
|
|
@@ -33,13 +33,13 @@ Create at `$HOME/.claude/logs/multi-agent/{project}/{task-id}/agent-log.md`:
|
|
|
33
33
|
## Phase Duration Distribution
|
|
34
34
|
|
|
35
35
|
Phase 0: Init ████░░░░░░░░░░░░ 5s
|
|
36
|
-
Phase 1:
|
|
37
|
-
Phase
|
|
38
|
-
Phase
|
|
39
|
-
Phase
|
|
40
|
-
Phase
|
|
41
|
-
Phase
|
|
42
|
-
Phase
|
|
36
|
+
Phase 1: Plan (analysis) ██████░░░░░░░░░░ 12s
|
|
37
|
+
Phase 1: Plan █████░░░░░░░░░░░ 8s
|
|
38
|
+
Phase 2: Dev ████████████████ 2m 35s
|
|
39
|
+
Phase 3: Review ████████░░░░░░░░ 37s
|
|
40
|
+
Phase 3: Review (user test) ██░░░░░░░░░░░░░░ (user wait)
|
|
41
|
+
Phase 4: Commit ██░░░░░░░░░░░░░░ 3s
|
|
42
|
+
Phase 5: Report █░░░░░░░░░░░░░░░ 2s
|
|
43
43
|
|
|
44
44
|
## Review Iterations
|
|
45
45
|
|
|
@@ -62,7 +62,7 @@ Verdict: unverified (3 reviewers)
|
|
|
62
62
|
|
|
63
63
|
## Cost Breakdown
|
|
64
64
|
|
|
65
|
-
(emit by Phase
|
|
65
|
+
(emit by Phase 5 via `$HOME/.claude/scripts/render-agent-log-cost.sh <task-id>`. Renders unconditionally on every run. If the renderer exits 2 (no tracker data + no OTel spans), Phase 5 omits this section without failing the run.)
|
|
66
66
|
|
|
67
67
|
| Phase | Model | Tokens in | Tokens out | Est. USD |
|
|
68
68
|
| ----- | ----- | --------- | ---------- | -------- |
|
|
@@ -86,7 +86,7 @@ Verdict: unverified (3 reviewers)
|
|
|
86
86
|
|
|
87
87
|
### Cost Breakdown - emission contract
|
|
88
88
|
|
|
89
|
-
Phase
|
|
89
|
+
Phase 5 MUST attempt to render the Cost Breakdown section as part of the agent-log compose step:
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
92
|
COST_BLOCK=$(bash $HOME/.claude/scripts/render-agent-log-cost.sh "$TASK_ID" 2>/dev/null) && \
|
|
@@ -97,7 +97,7 @@ Emission is best-effort - exit 2 (no data) is silently skipped. Never fail the
|
|
|
97
97
|
|
|
98
98
|
### Tokens telemetry - phase responsibility
|
|
99
99
|
|
|
100
|
-
Every phase that dispatches a billable LLM agent MUST forward its token totals to the tracker. The minimal contract (already enforced via `smoke-tracker-contract.sh` for Phase
|
|
100
|
+
Every phase that dispatches a billable LLM agent MUST forward its token totals to the tracker. The minimal contract (already enforced via `smoke-tracker-contract.sh` for Phase 3):
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
103
|
$HOME/.claude/scripts/log-metric.sh "$TASK_ID" <phase-id> <event> \
|
|
@@ -31,27 +31,27 @@ Autopilot mode skips interactive confirmations and runs the pipeline end-to-end
|
|
|
31
31
|
|
|
32
32
|
| Phase | Normal (full) | autopilot (full) | local (full) | local autopilot (full) |
|
|
33
33
|
| ------------------- | ------------------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- |
|
|
34
|
-
| Phase
|
|
35
|
-
| Phase
|
|
36
|
-
| Phase
|
|
37
|
-
| Phase
|
|
38
|
-
| **Phase
|
|
34
|
+
| Phase 1 (Plan Approval Gate) | Clarification (max 2 rounds) + approval loop - user: approve/abort/free-text edit | **Gate skip** - log the plan, proceed directly to Phase 2 (autopilot contract: zero interaction) | Same as Normal | Same as autopilot |
|
|
35
|
+
| Phase 3 (User Test) | Interactive prompt ("Want to test?" -> wait) | Skip (autopilot suppresses interactive prompts) -> proceed directly to Phase 4 | **Not in the phase set** (the gate checks the change out of a worktree; local has none) | Not in the phase set |
|
|
36
|
+
| Phase 4 (Commit) | "Want to commit?" -> wait | Auto commit + push | "Want to commit?" -> wait | Auto commit + push |
|
|
37
|
+
| Phase 4 (PR) | "Want to open a PR?" -> wait | Auto create PR | "Want to open a PR?" -> wait | Auto create PR |
|
|
38
|
+
| **Phase 5 (Channels)** | Multi-select channel + content menu | **STILL PAUSES** - see "Phase 5 autopilot exception" below | Multi-select (same as Normal) | **STILL PAUSES** (same as autopilot) |
|
|
39
39
|
|
|
40
40
|
**What NEVER skips (even in autopilot):**
|
|
41
41
|
|
|
42
|
-
- Phase
|
|
42
|
+
- Phase 3 Review -> if blocking finding, returns to Phase 2, auto fix + rebuild (safety)
|
|
43
43
|
- Kill/Purge confirmations -> destructive operations always ask
|
|
44
44
|
- Build fail -> auto fix + rebuild (max 3 retries). After 3 retries still failing -> pause, ask user
|
|
45
45
|
- **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: `$HOME/.claude/multi-agent-refs/features/autopilot-circuit-breaker.md`. This is the sanctioned autopilot pause - continuing unattended off the happy path is the less safe choice.
|
|
46
|
-
- **Phase
|
|
46
|
+
- **Phase 5 channels dispatch** -> always pauses for multi-select. Rationale: Jira/Confluence are externally visible; silently posting wrong-tone content leaks team-visible artifacts. See below.
|
|
47
47
|
|
|
48
48
|
**State tracking**: `agent-state.json` gets `"autopilot": true`. Autopilot continues on resume as well.
|
|
49
49
|
|
|
50
|
-
### Phase
|
|
50
|
+
### Phase 5 autopilot exception
|
|
51
51
|
|
|
52
|
-
The generic "zero-interaction" contract covers Phases 0-
|
|
52
|
+
The generic "zero-interaction" contract covers Phases 0-4 only. Phase 5 channels dispatch is the **single exception**:
|
|
53
53
|
|
|
54
|
-
- ALL modes (`autopilot`, `--local autopilot`, and a Short run reaching Phase
|
|
54
|
+
- ALL modes (`autopilot`, `--local autopilot`, and a Short run reaching Phase 5) pause at the channels multi-select menu.
|
|
55
55
|
- Menu pre-ticks from `prefs.global.reportChannels` + `prefs.global.reportContent` - user can accept with one keypress if prefs are stable.
|
|
56
56
|
- **30-minute timeout** - if user does not respond, session ends cleanly:
|
|
57
57
|
- External delivery aborted (no silent apply - prevents accidental Jira comments / Confluence pages).
|
|
@@ -60,13 +60,13 @@ The generic "zero-interaction" contract covers Phases 0-6 only. Phase 7 channels
|
|
|
60
60
|
- Resume: `/multi-agent:resume <task-id>` re-opens menu with same inputs.
|
|
61
61
|
- Post-hoc `/multi-agent:channels <task>` never times out - user invoked it explicitly.
|
|
62
62
|
|
|
63
|
-
Full contract: `$HOME/.claude/multi-agent-refs/phases/phase-
|
|
63
|
+
Full contract: `$HOME/.claude/multi-agent-refs/phases/phase-5-report.md` (Autopilot pause contract) + `commands/multi-agent/channels/SKILL.md`.
|
|
64
64
|
|
|
65
65
|
---
|
|
66
66
|
|
|
67
67
|
## Pipeline depth (Full / Short)
|
|
68
68
|
|
|
69
|
-
Short strips the pipeline to what an already-scoped task needs: no deep analysis, no planning phase. The **Opus** dev agent reads the task scope and implements, and Phase
|
|
69
|
+
Short strips the pipeline to what an already-scoped task needs: no deep analysis, no planning phase. The **Opus** dev agent reads the task scope and implements, and Phase 3 then reviews what it produced. Review is deliberately NOT part of the strip: analysis and planning shape work that has not happened yet, so a task the user has already scoped can skip them, while review judges work that now exists and has no substitute.
|
|
70
70
|
|
|
71
71
|
**How it is chosen.** Phase 0 Step 7.5, after `taskType` is known:
|
|
72
72
|
|
|
@@ -85,7 +85,7 @@ Bu is icin hangi pipeline? / Which pipeline for this task?
|
|
|
85
85
|
**Pipeline in a Short run:**
|
|
86
86
|
|
|
87
87
|
```
|
|
88
|
-
Phase 0: Init -> Phase
|
|
88
|
+
Phase 0: Init -> Phase 2: Dev (self-contained) -> Phase 3: Review -> Phase 3: Review (user test) -> Phase 4: Commit -> Phase 5: Report
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
**What changes (Tablo 2 - Short runs):**
|
|
@@ -94,14 +94,14 @@ Phase 0: Init -> Phase 3: Dev (self-contained) -> Phase 4: Review -> Phase 5: Te
|
|
|
94
94
|
| ------------------- | ----------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------- |
|
|
95
95
|
| Phase 0 (Init) | Full setup | Same - worktree, branch, state, and the depth question itself | Same - no worktree, branch on `$PROJECT_ROOT` |
|
|
96
96
|
| Phase 1 (Analysis) | Parallel Explore agents + analysis document | **SKIP** - no tile is ever drawn for it (registration is deferred to Step 7.5) | **SKIP** |
|
|
97
|
-
| Phase
|
|
98
|
-
| Phase
|
|
99
|
-
| Phase
|
|
100
|
-
| Phase
|
|
101
|
-
| Phase
|
|
102
|
-
| Phase
|
|
97
|
+
| Phase 1 (Planning) | TaskCreate + architecture review + **Plan Approval Gate** | **SKIP** (no plan means no plan gate) | **SKIP** |
|
|
98
|
+
| Phase 2 (Dev) | Follows the Phase 1 plan, TDD cycle (Sonnet) | **Self-contained** (Opus): agent scans relevant files, implements with TDD, builds | Same, on the local branch |
|
|
99
|
+
| Phase 3 (Review) | Parallel review + Fable triage (3 reviewers on every host: Claude Code Fable + Opus + Sonnet, Copilot GPT-5.4 + Opus + Sonnet) | **Same** - gates, parallel review, triage; blocking findings return to Phase 2 (cap 3) | **Same**, on the local branch diff |
|
|
100
|
+
| Phase 3 (User Test) | Interactive prompt | **Interactive prompt** | Not in the set - no worktree to check out |
|
|
101
|
+
| Phase 4 (Commit) | Commit + PR | Same - still asks | Same |
|
|
102
|
+
| Phase 5 (Report) | Full report + channels multi-select | Simplified - no analysis section, review section IS present, channels menu still pauses | Same |
|
|
103
103
|
|
|
104
|
-
**Phase
|
|
104
|
+
**Phase 2 in a Short run (self-contained):**
|
|
105
105
|
|
|
106
106
|
The **Opus** agent receives the task description (from Jira, GitHub issue, or free-text) and:
|
|
107
107
|
|
|
@@ -115,7 +115,7 @@ No separate task breakdown - the agent handles scope autonomously.
|
|
|
115
115
|
|
|
116
116
|
### Intake warnings for a Short run
|
|
117
117
|
|
|
118
|
-
**An analysis document was supplied.** Because Phase 1 and Phase
|
|
118
|
+
**An analysis document was supplied.** Because Phase 1 and Phase 1 are skipped, no phase turns that document into a task breakdown. The doc becomes raw context for one Dev pass, and work comes out ordered by whatever the model read first: the bottom of the dependency chain lands, the screen wiring does not.
|
|
119
119
|
|
|
120
120
|
The depth picker is where this is caught. When the intake carried an analysis document or a Figma reference, say so in the question itself rather than after the choice:
|
|
121
121
|
|
|
@@ -134,10 +134,10 @@ Autopilot never sees this: it runs Full.
|
|
|
134
134
|
|
|
135
135
|
## Analysis Mode (`/multi-agent:analysis`)
|
|
136
136
|
|
|
137
|
-
Not a depth permutation - a different **output kind**. It produces the analysis document and stops; no code, no branch, no PR. The
|
|
137
|
+
Not a depth permutation - a different **output kind**. It produces the analysis document and stops; no code, no branch, no PR. The 6-phase contract holds, with four phases reinterpreted the same way a Short run reinterprets Phase 2.
|
|
138
138
|
|
|
139
139
|
```
|
|
140
|
-
Phase 0: Init -> Phase 1:
|
|
140
|
+
Phase 0: Init -> Phase 1: Plan (analysis) -> Phase 1: Plan -> Phase 3: Review -> Phase 4: Publish -> Phase 5: Report
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
| Phase | Analysis mode |
|
|
@@ -153,7 +153,7 @@ Phase 0: Init -> Phase 1: Analysis -> Phase 2: Planning -> Phase 4: Review -> Ph
|
|
|
153
153
|
|
|
154
154
|
**No `local` or `autopilot` variant.** Worktree isolation buys nothing when no code is written, and the intake, the Pass B convention preview and the open-question resolution are interactive by nature; a zero-interaction analysis would be a document nobody agreed to.
|
|
155
155
|
|
|
156
|
-
**Where the document lands.** Drafts go to `/tmp/analysis-<slug>-<ts>/` first, then the Phase
|
|
156
|
+
**Where the document lands.** Drafts go to `/tmp/analysis-<slug>-<ts>/` first, then the Phase 4 picker decides: Local writes `<repo>/analysis/<feature>-<platform>.md` uncommitted, Confluence posts the page, Jira updates the description. In the full pipeline the same engine writes into the worktree instead and `prefs.global.analysisPhase.commitDoc` decides whether it rides along with the commit.
|
|
157
157
|
|
|
158
158
|
---
|
|
159
159
|
|
|
@@ -167,11 +167,11 @@ front so the question resolves without being asked.
|
|
|
167
167
|
```
|
|
168
168
|
Bu is nerede kossun? / Where should this task run?
|
|
169
169
|
1. Worktree .worktrees/{id}/ - your current checkout stays untouched
|
|
170
|
-
2. Lokal / Local the project root, on a new branch - no Phase
|
|
170
|
+
2. Lokal / Local the project root, on a new branch - no Phase 3
|
|
171
171
|
```
|
|
172
172
|
|
|
173
173
|
Two genuine options, so it meets the two-option floor in `picker-contract.md` on
|
|
174
|
-
its own. **Say what local costs inside the question**: Phase
|
|
174
|
+
its own. **Say what local costs inside the question**: Phase 3 is not in a local
|
|
175
175
|
run's set (the user-test gate checks the change out of a worktree, and there is
|
|
176
176
|
none), and uncommitted work in the project root is in the way of the checkout. A
|
|
177
177
|
user choosing local should learn both before choosing, not after.
|
|
@@ -196,9 +196,9 @@ and doing that in the user's own checkout is what worktrees exist to prevent.
|
|
|
196
196
|
| Phase | Normal (worktree) | Local |
|
|
197
197
|
| -------------- | ------------------------------------------------ | -------------------------------------------------------------- |
|
|
198
198
|
| Phase 0 Step 8 | Creates worktree at `.worktrees/{id}/` | `git checkout -b {branch}` directly in `$PROJECT_ROOT` |
|
|
199
|
-
| Phase
|
|
200
|
-
| Phase
|
|
201
|
-
| Phase
|
|
199
|
+
| Phase 2 | Works in worktree path | Works in `$PROJECT_ROOT` |
|
|
200
|
+
| Phase 3 | WIP commit -> remove worktree -> checkout branch | **Not in the phase set** - nothing to check out, nothing to remove |
|
|
201
|
+
| Phase 4 | Commit in worktree, push | Commit in project root, push |
|
|
202
202
|
| All paths | `{worktreePath}` references | All paths use `$PROJECT_ROOT` directly |
|
|
203
203
|
|
|
204
204
|
**Phase 0 Step 8 in local mode:**
|
|
@@ -211,7 +211,7 @@ git -C $PROJECT_ROOT config user.name "{identity.name}"
|
|
|
211
211
|
git -C $PROJECT_ROOT config user.email "{identity.email}"
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
-
**Phase
|
|
214
|
+
**Phase 3 in local mode:** it is not in the phase set. The gate exists to hand the user a change checked out of a worktree, and in local mode the code is already on the branch in `$PROJECT_ROOT` with nothing to check out or remove. `gen-mode-dispatch.mjs --mode=local` is the enforced statement of this; the row above mirrors it.
|
|
215
215
|
|
|
216
216
|
**State tracking**: `agent-state.json` gets `"localMode": true`, `"worktreePath": null`. All path references resolve to `$PROJECT_ROOT`.
|
|
217
217
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
>
|
|
3
3
|
> - **Task IDs** auto-increment from `$HOME/.claude/logs/multi-agent/{project}/.counter` (persistent).
|
|
4
4
|
> - **Kill/Purge/Clear-logs** require explicit user confirm; destructive ops never chain.
|
|
5
|
-
> - **Resume** re-enters at `currentPhase + 1`; always re-runs Phase
|
|
5
|
+
> - **Resume** re-enters at `currentPhase + 1`; always re-runs Phase 5 for knowledge capture.
|
|
6
6
|
> - **3-iteration hard kill**: any retry loop stops after 3 attempts and hands off to the user.
|
|
7
7
|
> - Subagents return JSON (not prose), get only the diff + relevant files, and must reflect before each retry.
|
|
8
8
|
|
|
@@ -61,11 +61,11 @@ Every task gets an auto-incremented short ID. Counter stored at `$HOME/.claude/l
|
|
|
61
61
|
|
|
62
62
|
1. Find state file: `$HOME/.claude/logs/multi-agent/{project}/{task-id}/agent-state.json`
|
|
63
63
|
2. **Validate before re-entry** (required - a half-written or corrupt state silently resumes at the wrong phase):
|
|
64
|
-
- `node $HOME/.claude/scripts/validate-state.mjs <state-file>` (resume-safety check: parseable JSON + `currentPhase` in 0..
|
|
64
|
+
- `node $HOME/.claude/scripts/validate-state.mjs <state-file>` (resume-safety check: parseable JSON + `currentPhase` in 0..5 + well-formed `phases`; tolerant of legacy shapes, not a strict schema match). On non-zero exit, do NOT guess a phase: surface the error and stop with `ERR: agent-state.json is unsafe to resume; inspect it or 'kill #N' and restart.`
|
|
65
65
|
- Confirm the worktree path on `state.worktreePath` / `state.projects[].worktreePath` exists and `git -C <wt> status` is clean-or-known. If the worktree is missing or locked, run the Phase 0 "Worktree stale-lock heal" before continuing.
|
|
66
66
|
3. Read `agent-log.md` for previous findings
|
|
67
67
|
4. Resume from `currentPhase + 1`. If `state.phases[currentPhase+1].subStep` is set, re-enter that phase and skip already-recorded sub-steps (see "Sub-step checkpoints").
|
|
68
|
-
5. **Always run Phase
|
|
68
|
+
5. **Always run Phase 5** on resume completion - ensures knowledge capture even if task was paused mid-pipeline
|
|
69
69
|
6. Log: "Resumed {jiraId} from Phase {N}"
|
|
70
70
|
|
|
71
71
|
---
|
|
@@ -78,8 +78,9 @@ Update `agent-state.json` at EVERY phase transition.
|
|
|
78
78
|
|
|
79
79
|
### Writing `agent-state.json` (required mechanism)
|
|
80
80
|
|
|
81
|
-
Every state
|
|
82
|
-
plain read-modify-write (`jq ... > tmp &&
|
|
81
|
+
Every state write goes through `write-state.mjs`, **including the first one in
|
|
82
|
+
Phase 0**. Never write the file with a plain read-modify-write (`jq ... > tmp &&
|
|
83
|
+
mv`, an editor tool, `cat >`):
|
|
83
84
|
|
|
84
85
|
```bash
|
|
85
86
|
# Merge a patch into the current state (the normal case).
|
|
@@ -97,6 +98,16 @@ the first landed. `write-state.mjs` does tmpfile + rename (atomic on POSIX) unde
|
|
|
97
98
|
an advisory `.lock`, reclaims a lock whose holder PID is dead, and releases the
|
|
98
99
|
lock on every error path.
|
|
99
100
|
|
|
101
|
+
Why the CREATE matters as much as the updates: the writer stamps `rev` on every
|
|
102
|
+
write and `schemaVersion` on the first one. A document written by hand in Phase 0
|
|
103
|
+
starts with neither, so every later writer compares against an absent revision
|
|
104
|
+
and `migrate-state.mjs` can never place the file on a migration path. Measured on
|
|
105
|
+
a real install before this was fixed: 39 of 43 `agent-state.json` files carried no
|
|
106
|
+
`rev` and 43 of 43 carried no `schemaVersion`, which is the whole of
|
|
107
|
+
`$HOME/.claude/schemas/migrations/` sitting unreachable. `migrate-state.mjs --all`
|
|
108
|
+
reports the legacy ones; it does not stamp them, because a stamp would assert a
|
|
109
|
+
conformance nothing checked.
|
|
110
|
+
|
|
100
111
|
Exit codes the caller must handle: `0` written, `1` invalid JSON on stdin, `2`
|
|
101
112
|
lock timeout (another writer held it past the acquire window - retry once, then
|
|
102
113
|
halt per the halt-visibility rule), `3` I/O error.
|
|
@@ -127,13 +138,13 @@ lose the update behind it. `WRITE_STATE_LOCK_STALE_MS` now applies only to a
|
|
|
127
138
|
lock with no readable PID, and `WRITE_STATE_LOCK_ABANDON_MS` (default ten times
|
|
128
139
|
that) is the last-resort ceiling for a PID that has been recycled.
|
|
129
140
|
|
|
130
|
-
**Halt visibility (required, autopilot included).** A halt is never silent. Whenever a phase halts on a hard error (validator failed twice, no subagent returned, dispatch error past fallback, lock irrecoverable), in addition to the `agent-log.md` line: (a) write `state.status = "paused"` and `state.haltReason = "<phase>:<cause>"`; (b) record the cause on the tracker via `phase-tracker.sh meta <phase> halt "<cause>"` and `phase-tracker.sh update <phase> failed`; (c) emit one `>&2` alert line `HALT phase <N>: <cause> - resume with /multi-agent:resume #<id>`; (d) if `prefs.global.usageLog.enabled` is true, emit the end-of-run report so a run that never reaches Phase
|
|
141
|
+
**Halt visibility (required, autopilot included).** A halt is never silent. Whenever a phase halts on a hard error (validator failed twice, no subagent returned, dispatch error past fallback, lock irrecoverable), in addition to the `agent-log.md` line: (a) write `state.status = "paused"` and `state.haltReason = "<phase>:<cause>"`; (b) record the cause on the tracker via `phase-tracker.sh meta <phase> halt "<cause>"` and `phase-tracker.sh update <phase> failed`; (c) emit one `>&2` alert line `HALT phase <N>: <cause> - resume with /multi-agent:resume #<id>`; (d) if `prefs.global.usageLog.enabled` is true, emit the end-of-run report so a run that never reaches Phase 5 is still recorded with the phase it stopped at (`state.currentPhase` + `haltReason`) - the emitter no-ops when it is off or unconfigured:
|
|
131
142
|
|
|
132
143
|
```bash
|
|
133
144
|
node $HOME/.claude/scripts/usage-report.mjs --state "$STATE_FILE" >/dev/null 2>&1 || true
|
|
134
145
|
```
|
|
135
146
|
|
|
136
|
-
Autopilot suppresses *confirmations*, not *halts* - the user must always be able to see why an unattended run stopped without reading the log. The endpoint upserts by run id, so this halt record and a later Phase
|
|
147
|
+
Autopilot suppresses *confirmations*, not *halts* - the user must always be able to see why an unattended run stopped without reading the log. The endpoint upserts by run id, so this halt record and a later Phase 5 record (after resume) collapse into one.
|
|
137
148
|
|
|
138
149
|
### Pipeline Best Practices
|
|
139
150
|
|
|
@@ -149,7 +160,7 @@ This keeps orchestrator context lean and enables programmatic routing.
|
|
|
149
160
|
|
|
150
161
|
**Retry reflection**: Before each retry, force reflection: "What failed? What specific change fixes it? Am I repeating the same approach?" - prevents infinite loops on broken strategies.
|
|
151
162
|
|
|
152
|
-
**Semantic revert**: Track which files each phase produces in `agent-state.json`. If Phase
|
|
163
|
+
**Semantic revert**: Track which files each phase produces in `agent-state.json`. If Phase 3 (testing) fails, revert only Phase 3 (implementation) outputs, not Phase 1 (artifacts):
|
|
153
164
|
|
|
154
165
|
```json
|
|
155
166
|
"phases": {
|
|
@@ -165,7 +176,7 @@ This keeps orchestrator context lean and enables programmatic routing.
|
|
|
165
176
|
bash $HOME/.claude/scripts/capture-flush.sh --state "$STATE_FILE" --quiet
|
|
166
177
|
```
|
|
167
178
|
|
|
168
|
-
The durable stores used to be written only in Phase
|
|
179
|
+
The durable stores used to be written only in Phase 5, which is the phase a run is LEAST likely to reach: a run killed in Phase 2 threw away every finding it had established, and the next run on the same repo paid to rediscover it. The flush is idempotent (the second call through writes 0 rows), costs no API tokens, calls no model, and never fails the transition. Phase 5 is now the LAST flush rather than the only one. The trigger is deliberately mechanical - a phase transition, not a model noticing that a moment qualifies.
|
|
169
180
|
- *Compaction trigger.* If conversation context exceeds ~50%, run `/compact` preserving "modified files, plan, open review findings, current phase + sub-step" before continuing. Don't wait for auto-compaction near the limit - it triggers exactly when context is worst and is lossy. After compaction, re-read `agent-state.json` AND the latest `## Handoff` block in `agent-log.md` to re-ground.
|
|
170
181
|
|
|
171
182
|
**Handoff block (v10.8.0)**: the structured artifact the phase-boundary checkpoint appends to `agent-log.md`. Written by the orchestrator from state it already holds - no agent dispatch, no extra LLM call. Cap at ~15 lines; the latest block is authoritative (earlier ones are history). This is the fresh-context re-entry contract: a resume or post-compaction session rebuilds working context from the latest handoff + `agent-state.json` + git log, never from conversation memory.
|
|
@@ -181,6 +192,6 @@ This keeps orchestrator context lean and enables programmatic routing.
|
|
|
181
192
|
|
|
182
193
|
Full `agent-log.md` shape: `$HOME/.claude/multi-agent-refs/phases/log-format.md`. Resume-side consumption: `resume.md` Step 3 reads the latest handoff FIRST, then falls back to per-phase findings for logs written before v10.8.
|
|
183
194
|
|
|
184
|
-
**Sub-step checkpoints (long phases)**: Phase
|
|
195
|
+
**Sub-step checkpoints (long phases)**: Phase 2 (dev/TDD cycles) and Phase 5 (report/channels) can run many minutes; a crash mid-phase loses everything since the last phase boundary and forces a full phase re-run on resume. For these phases, also record `state.phases[<n>].subStep` (a short token: `red`, `green`, `build`, `pr-opened`, `confluence-synced`, ...) and the `files[]` written so far after each meaningful unit of work. On resume, re-enter the phase but skip units whose `subStep` is already recorded and whose `files[]` exist in the worktree - re-do only the unfinished tail, never the whole phase.
|
|
185
196
|
|
|
186
197
|
**3-iteration hard kill**: Any retry loop (build fix, review fix) MUST stop after 3 attempts. On 4th failure -> pause, ask user. No exceptions.
|