all-for-claudecode 2.10.0 → 2.12.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/MIGRATION.md +2 -2
- package/README.md +12 -4
- package/bin/cli.mjs +1 -0
- package/package.json +1 -1
- package/scripts/afc-consistency-check.sh +8 -6
- package/scripts/afc-doctor.sh +18 -4
- package/scripts/session-start-context.sh +1 -1
- package/skills/analyze/SKILL.md +10 -8
- package/skills/architect/SKILL.md +4 -4
- package/skills/auto/SKILL.md +664 -93
- package/skills/clarify/SKILL.md +4 -3
- package/skills/clean/SKILL.md +17 -16
- package/skills/consult/SKILL.md +19 -18
- package/skills/debug/SKILL.md +1 -1
- package/skills/doctor/SKILL.md +23 -19
- package/skills/implement/SKILL.md +36 -23
- package/skills/init/SKILL.md +24 -177
- package/skills/learner/SKILL.md +4 -4
- package/skills/plan/SKILL.md +1 -1
- package/skills/pr-comment/SKILL.md +4 -4
- package/skills/principles/SKILL.md +1 -1
- package/skills/qa/SKILL.md +2 -2
- package/skills/release-notes/SKILL.md +8 -4
- package/skills/review/SKILL.md +12 -12
- package/skills/security/SKILL.md +19 -4
- package/skills/setup/SKILL.md +217 -0
- package/skills/spec/SKILL.md +2 -2
- package/skills/tasks/SKILL.md +4 -4
- package/skills/test/SKILL.md +1 -1
- package/skills/triage/SKILL.md +7 -8
package/skills/clarify/SKILL.md
CHANGED
|
@@ -50,10 +50,11 @@ Scan across 10 categories:
|
|
|
50
50
|
| 9 | Completion criteria | Success criteria that cannot be measured |
|
|
51
51
|
| 10 | Residual placeholders | TODO/TBD/??? |
|
|
52
52
|
|
|
53
|
+
These categories serve as a comprehensive checklist, not a rigid classification. Adapt to the project's domain — skip categories irrelevant to the project type (e.g., skip 'UX flow' for CLI tools) and add domain-specific categories if needed (e.g., 'regulatory compliance' for healthcare/fintech projects).
|
|
54
|
+
|
|
53
55
|
### 3. Generate and Present Questions
|
|
54
56
|
|
|
55
|
-
- Generate
|
|
56
|
-
- Priority: scope > security/privacy > UX > technical
|
|
57
|
+
- Generate questions ranked by their impact on spec quality — how much would the answer change the spec's direction or completeness? Present the most impactful questions first. The number of questions should match the actual ambiguity level: deeply ambiguous specs may need more questions, while mostly-clear specs need fewer. Do not artificially cap at a fixed number, but keep the set focused and avoid overwhelming the user (aim for the minimum needed to resolve critical ambiguities).
|
|
57
58
|
- Present **one at a time** via AskUserQuestion:
|
|
58
59
|
- Use multiple choice when possible (2-4 options)
|
|
59
60
|
- Include the meaning/impact of each option
|
|
@@ -79,7 +80,7 @@ Clarification complete
|
|
|
79
80
|
|
|
80
81
|
## Notes
|
|
81
82
|
|
|
82
|
-
- **
|
|
83
|
+
- **Question focus**: Ask only what is needed to resolve critical ambiguities. Defer lower-priority questions to the plan phase rather than overwhelming the user.
|
|
83
84
|
- **Modify spec only**: Do not touch plan.md or tasks.md.
|
|
84
85
|
- **Avoid redundancy**: Do not ask about items already clearly stated in spec.
|
|
85
86
|
- **If `$ARGUMENTS` is provided**: Focus the scan on that area.
|
package/skills/clean/SKILL.md
CHANGED
|
@@ -24,7 +24,7 @@ model: sonnet
|
|
|
24
24
|
### 1. Resolve Feature
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
"${
|
|
27
|
+
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" phase clean
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
- If pipeline is active: read feature from state
|
|
@@ -60,23 +60,24 @@ Set `PIPELINE_ARTIFACT_DIR` = `.claude/afc/specs/{feature}/`
|
|
|
60
60
|
- **If retrospective.md exists** -> record as patterns missed by the Plan phase Critic Loop in `.claude/afc/memory/retrospectives/` (reuse as RISK checklist items in future runs)
|
|
61
61
|
- **If review-report.md exists** -> copy to `.claude/afc/memory/reviews/{feature}-{date}.md` before .claude/afc/specs/ deletion
|
|
62
62
|
- **If research.md exists** and was not already persisted in Plan phase -> copy to `.claude/afc/memory/research/{feature}.md`
|
|
63
|
-
- **Agent memory consolidation**:
|
|
63
|
+
- **Agent memory consolidation**: Check each agent's MEMORY.md for bloat — if it contains redundant, obsolete, or superseded entries that reduce signal-to-noise ratio, invoke the agent to self-prune:
|
|
64
64
|
```
|
|
65
65
|
Task("Memory cleanup: afc-architect", subagent_type: "afc:afc-architect",
|
|
66
|
-
prompt: "
|
|
66
|
+
prompt: "Review your MEMORY.md. Read it, identify and prune old/redundant/obsolete entries, and rewrite it keeping only entries that are still relevant and non-overlapping.")
|
|
67
67
|
```
|
|
68
|
-
(Same pattern for afc-security if needed.
|
|
69
|
-
- **Memory rotation**:
|
|
70
|
-
| Directory |
|
|
71
|
-
|
|
72
|
-
| `quality-history/` |
|
|
73
|
-
| `reviews/` |
|
|
74
|
-
| `retrospectives/` |
|
|
75
|
-
| `research/` |
|
|
76
|
-
| `decisions/` |
|
|
77
|
-
-
|
|
68
|
+
Use semantic assessment (are entries still relevant? do entries overlap?) rather than a line-count threshold. (Same pattern for afc-security if needed.)
|
|
69
|
+
- **Memory rotation**: For each memory subdirectory, assess whether the oldest files still provide value. Prune files that are superseded by newer entries, reference features/code that no longer exists, or overlap with other files. As a practical guideline, keep the most recent and relevant entries — if a directory has grown large enough that scanning it would be slow (roughly 30+ files), prioritize pruning the least relevant entries:
|
|
70
|
+
| Directory | Pruning Intent | Soft Guideline |
|
|
71
|
+
|-----------|---------------|----------------|
|
|
72
|
+
| `quality-history/` | Remove superseded or redundant quality records | ~30 files |
|
|
73
|
+
| `reviews/` | Remove reviews for features no longer in the codebase | ~40 files |
|
|
74
|
+
| `retrospectives/` | Remove retrospectives whose learnings are already captured elsewhere | ~30 files |
|
|
75
|
+
| `research/` | Remove research for libraries/patterns no longer used | ~50 files |
|
|
76
|
+
| `decisions/` | Remove decisions that have been reversed or are no longer relevant | ~60 files |
|
|
77
|
+
- These numbers are soft guidelines, not hard cutoffs — use judgment based on relevance
|
|
78
|
+
- Sort by filename ascending (oldest first) when pruning by recency
|
|
78
79
|
- Log: `"Memory rotation: {dir} pruned {N} files"`
|
|
79
|
-
- Skip directories that do not exist or
|
|
80
|
+
- Skip directories that do not exist or clearly do not need pruning
|
|
80
81
|
|
|
81
82
|
### 6. Quality Report
|
|
82
83
|
|
|
@@ -97,13 +98,13 @@ Clear `.claude/afc/memory/checkpoint.md` **and** `~/.claude/projects/{ENCODED_PA
|
|
|
97
98
|
### 8. Timeline Finalize
|
|
98
99
|
|
|
99
100
|
```bash
|
|
100
|
-
"${
|
|
101
|
+
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" log pipeline-end "Pipeline complete: {feature}"
|
|
101
102
|
```
|
|
102
103
|
|
|
103
104
|
### 9. Release Pipeline Flag
|
|
104
105
|
|
|
105
106
|
```bash
|
|
106
|
-
"${
|
|
107
|
+
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" end
|
|
107
108
|
```
|
|
108
109
|
|
|
109
110
|
- Stop Gate Hook deactivated
|
package/skills/consult/SKILL.md
CHANGED
|
@@ -33,24 +33,25 @@ If `$ARGUMENTS` is empty → go to Step 2 (domain selection).
|
|
|
33
33
|
|
|
34
34
|
**A. Explicit domain provided** → use it directly.
|
|
35
35
|
|
|
36
|
-
**B. No domain, but question provided** →
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
|
41
|
-
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
36
|
+
**B. No domain, but question provided** → intent-based evaluation:
|
|
37
|
+
|
|
38
|
+
Read the user's question and determine which domain's expertise would provide the most value. Consider the actual intent, not keyword presence.
|
|
39
|
+
|
|
40
|
+
| Domain | When to route |
|
|
41
|
+
|--------|---------------|
|
|
42
|
+
| backend | User needs help with server-side logic, data modeling, API design, authentication flows, database decisions, or how application code processes and stores data |
|
|
43
|
+
| infra | User needs help with how the application is deployed, operated, or monitored — infrastructure topology, CI/CD pipelines, cloud services, scaling, reliability |
|
|
44
|
+
| pm | User needs help with product decisions: what to build, for whom, when, how to measure success, how to prioritize competing features, or how to define scope |
|
|
45
|
+
| design | User needs help with how something looks or feels to a user — visual hierarchy, interaction patterns, accessibility, component design, or user flow |
|
|
46
|
+
| marketing | User needs help reaching or retaining users outside the product: SEO, content strategy, acquisition funnels, analytics tracking, or growth tactics |
|
|
47
|
+
| legal | User needs help understanding regulatory obligations, license compatibility, privacy requirements, or the legal implications of a design or data practice |
|
|
48
|
+
| security | User needs help identifying or mitigating threats, vulnerabilities, or attack surfaces — secure coding, threat modeling, or compliance with security standards |
|
|
49
|
+
| advisor | User is choosing between technologies, frameworks, libraries, or architectural approaches and wants an informed recommendation with trade-off analysis |
|
|
50
|
+
| peer | User wants to think through a problem collaboratively, explore directions, weigh trade-offs, or have a structured dialogue rather than receive an answer |
|
|
51
|
+
|
|
52
|
+
Evaluation rules:
|
|
53
|
+
- Identify what specialized knowledge the user actually needs, not which domain's jargon appears in the text
|
|
54
|
+
- If multiple domains seem relevant, identify the PRIMARY expertise gap — what specialized knowledge does the user need most?
|
|
54
55
|
|
|
55
56
|
**C. No domain, no question, or no keyword match** → ask user:
|
|
56
57
|
|
package/skills/debug/SKILL.md
CHANGED
|
@@ -86,7 +86,7 @@ If hypothesis 0 is rejected: verify remaining hypotheses starting from highest p
|
|
|
86
86
|
|
|
87
87
|
### 5. Critic Loop
|
|
88
88
|
|
|
89
|
-
> **Always** read `${
|
|
89
|
+
> **Always** read `${CLAUDE_SKILL_DIR}/../../docs/critic-loop-rules.md` first and follow it.
|
|
90
90
|
|
|
91
91
|
Run the critic loop until convergence. Safety cap: 5 passes.
|
|
92
92
|
|
package/skills/doctor/SKILL.md
CHANGED
|
@@ -16,7 +16,7 @@ model: sonnet
|
|
|
16
16
|
> Like `brew doctor` or `flutter doctor` — verifies the **tool's setup**, NOT the project's code quality.
|
|
17
17
|
> Read-only — never modifies files. Reports issues with actionable fix commands.
|
|
18
18
|
>
|
|
19
|
-
> **IMPORTANT: Do NOT analyze project source code, architecture, or code quality. Only check afc plugin configuration, hooks, state, and environment
|
|
19
|
+
> **IMPORTANT: Do NOT analyze project source code, architecture, or code quality. Only check afc plugin configuration, hooks, state, and environment. All checks are handled by the bash script — just run it and print the output.**
|
|
20
20
|
|
|
21
21
|
## Arguments
|
|
22
22
|
|
|
@@ -39,7 +39,7 @@ Each failing check includes a **Fix:** line with the exact command to resolve it
|
|
|
39
39
|
|
|
40
40
|
1. Run the health check script (covers ALL categories — no manual checks needed):
|
|
41
41
|
```
|
|
42
|
-
"${
|
|
42
|
+
"${CLAUDE_SKILL_DIR}/../../scripts/afc-doctor.sh" $ARGUMENTS
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
2. Print the script's stdout output as-is. Do not reformat, summarize, or interpret.
|
|
@@ -54,8 +54,8 @@ Each failing check includes a **Fix:** line with the exact command to resolve it
|
|
|
54
54
|
## Example Output
|
|
55
55
|
|
|
56
56
|
```
|
|
57
|
-
all-for-claudecode Doctor
|
|
58
|
-
|
|
57
|
+
all-for-claudecode Doctor (v2.11.0)
|
|
58
|
+
Plugin root: /path/to/plugin
|
|
59
59
|
|
|
60
60
|
Environment
|
|
61
61
|
✓ git installed (2.43.0)
|
|
@@ -64,34 +64,38 @@ Environment
|
|
|
64
64
|
|
|
65
65
|
Project Config
|
|
66
66
|
✓ .claude/afc.config.md exists
|
|
67
|
-
✓ Required sections
|
|
68
|
-
✓
|
|
69
|
-
✓ Gate command runnable
|
|
67
|
+
✓ Required sections present
|
|
68
|
+
✓ Gate command defined
|
|
70
69
|
|
|
71
70
|
CLAUDE.md Integration
|
|
72
71
|
✓ Global ~/.claude/CLAUDE.md exists
|
|
73
72
|
✓ all-for-claudecode block present
|
|
74
|
-
⚠ all-for-claudecode block
|
|
75
|
-
Fix: /afc:
|
|
76
|
-
|
|
73
|
+
⚠ all-for-claudecode block outdated (block: 1.0.0, plugin: 1.1.0)
|
|
74
|
+
Fix: run /afc:setup to update
|
|
75
|
+
|
|
76
|
+
Legacy Migration
|
|
77
|
+
✓ No legacy artifacts found
|
|
77
78
|
|
|
78
79
|
Pipeline State
|
|
79
|
-
✓ No stale pipeline
|
|
80
|
+
✓ No stale pipeline state
|
|
80
81
|
✓ No orphaned artifacts
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
|
|
83
|
+
Memory Health
|
|
83
84
|
|
|
84
85
|
Hook Health
|
|
85
86
|
✓ hooks.json valid
|
|
86
|
-
✓ All scripts exist
|
|
87
|
+
✓ All hook scripts exist
|
|
87
88
|
✓ All scripts executable
|
|
88
89
|
|
|
90
|
+
Learner Health
|
|
91
|
+
✓ Learner not enabled (opt-in via /afc:learner enable)
|
|
92
|
+
|
|
89
93
|
Version Sync (dev)
|
|
90
|
-
✓ Version triple match
|
|
94
|
+
✓ Version triple match (1.1.0)
|
|
91
95
|
✓ Cache in sync
|
|
92
96
|
|
|
93
|
-
|
|
94
|
-
✓ Frontmatter exists (
|
|
97
|
+
Skill Definitions (dev)
|
|
98
|
+
✓ Frontmatter exists (29 files)
|
|
95
99
|
✓ Required fields present
|
|
96
100
|
✓ Name-filename match
|
|
97
101
|
✓ Fork-agent references valid
|
|
@@ -108,7 +112,7 @@ Doc References (dev)
|
|
|
108
112
|
✓ Domain adapters exist (3 files)
|
|
109
113
|
|
|
110
114
|
─────────────────────────
|
|
111
|
-
Results:
|
|
115
|
+
Results: 26 passed, 2 warnings, 0 failures
|
|
112
116
|
2 warnings found. Non-blocking but review recommended.
|
|
113
117
|
```
|
|
114
118
|
|
|
@@ -119,4 +123,4 @@ Results: 28 passed, 2 warnings, 0 failures
|
|
|
119
123
|
- **Always run all checks**: do not stop on first failure. The full picture is the value.
|
|
120
124
|
- **Actionable fixes**: every non-pass result must include a Fix line. Never report a problem without a solution.
|
|
121
125
|
- **Fast execution**: skip CI/gate command checks if `--fast` is in arguments (these are the slowest checks).
|
|
122
|
-
- **Development checks**:
|
|
126
|
+
- **Development checks**: Version Sync, Skill Definitions, Agent Definitions, Doc References only run when inside the all-for-claudecode source repo.
|
|
@@ -43,8 +43,8 @@ git tag -f afc/pre-implement
|
|
|
43
43
|
**Standalone safety activation** (skip if inside `/afc:auto`):
|
|
44
44
|
If no active pipeline state exists, activate it for the duration of this command:
|
|
45
45
|
```bash
|
|
46
|
-
"${
|
|
47
|
-
"${
|
|
46
|
+
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" start {feature-name-from-plan.md}
|
|
47
|
+
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" phase implement
|
|
48
48
|
```
|
|
49
49
|
This enables Stop Gate and CI Gate hooks during standalone implementation. Release on completion (Step 7) or failure rollback.
|
|
50
50
|
|
|
@@ -81,8 +81,8 @@ If `.claude/afc/specs/{feature}/tasks.md` does not exist, generate it from plan.
|
|
|
81
81
|
- Constraint → tasks (every spec Constraint is addressed by at least one task)
|
|
82
82
|
3. **Validate** (script-based, no critic loop):
|
|
83
83
|
```bash
|
|
84
|
-
"${
|
|
85
|
-
"${
|
|
84
|
+
"${CLAUDE_SKILL_DIR}/../../scripts/afc-dag-validate.sh" .claude/afc/specs/{feature}/tasks.md
|
|
85
|
+
"${CLAUDE_SKILL_DIR}/../../scripts/afc-parallel-validate.sh" .claude/afc/specs/{feature}/tasks.md
|
|
86
86
|
```
|
|
87
87
|
4. If validation fails → fix tasks.md and re-validate (max 2 attempts)
|
|
88
88
|
5. Save to `.claude/afc/specs/{feature}/tasks.md`
|
|
@@ -116,7 +116,7 @@ If `.claude/afc/memory/retrospectives/` exists, load the **most recent 10 files*
|
|
|
116
116
|
|
|
117
117
|
### 3. Phase-by-Phase Execution
|
|
118
118
|
|
|
119
|
-
Execute each phase in order. Choose the orchestration mode
|
|
119
|
+
Execute each phase in order. Choose the orchestration mode by evaluating whether multi-agent coordination overhead would be justified given the tasks' characteristics:
|
|
120
120
|
|
|
121
121
|
#### Mode Selection
|
|
122
122
|
|
|
@@ -126,12 +126,17 @@ Execute each phase in order. Choose the orchestration mode based on the number o
|
|
|
126
126
|
|-----------|------|----------|
|
|
127
127
|
| No [P] markers | Sequential | Main agent executes tasks one by one |
|
|
128
128
|
| [P] tasks but delegation criteria NOT met | Sequential | Main agent executes directly (preserves full context) |
|
|
129
|
-
| [P] tasks, delegation criteria ALL met,
|
|
130
|
-
| [P] tasks, delegation criteria ALL met,
|
|
129
|
+
| [P] tasks, delegation criteria ALL met, coordination overhead justified, moderate parallelism | Parallel Batch | Launch Task() calls in parallel |
|
|
130
|
+
| [P] tasks, delegation criteria ALL met, coordination overhead clearly justified, high parallelism | Swarm | Create task pool → orchestrator pre-assigns tasks to worker agents |
|
|
131
|
+
|
|
132
|
+
**Mode judgment**: Ask — "Given these N tasks with their complexity, file scope, and interdependencies, would spawning multiple agents and merging their results be faster and safer than executing sequentially?" If the answer is not clearly yes, default to Sequential.
|
|
133
|
+
|
|
134
|
+
- **Parallel Batch** is appropriate when there are enough independent tasks that parallel execution provides meaningful speed gain, but the total count is manageable enough that a single orchestrator round-trip suffices.
|
|
135
|
+
- **Swarm** is appropriate when the number of independent tasks is large enough that a single batch of Task() calls would saturate the concurrent agent limit, requiring multiple orchestrator rounds.
|
|
131
136
|
|
|
132
137
|
**Parallel delegation criteria** (ALL must be satisfied):
|
|
133
138
|
1. Tasks have **no `depends:` edges** between them in the DAG (no ordering constraint)
|
|
134
|
-
2.
|
|
139
|
+
2. **Enough parallelizable tasks** that multi-agent overhead is worth it (a very small number of short tasks → sequential is cheaper)
|
|
135
140
|
3. Each task is **self-contained** (does not require runtime results from other tasks in the same batch)
|
|
136
141
|
4. Each task's **target files do not overlap** with any other task in the batch (no shared file writes)
|
|
137
142
|
|
|
@@ -143,7 +148,7 @@ If ANY criterion fails → main agent sequential execution (context preservation
|
|
|
143
148
|
- On task start: `▶ {ID}: {description}`
|
|
144
149
|
- On completion: `✓ {ID} complete`
|
|
145
150
|
|
|
146
|
-
#### Parallel Batch Mode (
|
|
151
|
+
#### Parallel Batch Mode (moderate [P] tasks)
|
|
147
152
|
|
|
148
153
|
**Pre-validation**: Verify no file overlap (downgrade to sequential if overlapping).
|
|
149
154
|
|
|
@@ -203,14 +208,18 @@ Task("T004: Create AuthService", subagent_type: "afc:afc-impl-worker", isolation
|
|
|
203
208
|
2. Capture the `agentId` from the failed agent's result (returned in Task tool output)
|
|
204
209
|
3. Reset: `TaskUpdate(taskId, status: "pending")`
|
|
205
210
|
4. Track: `TaskUpdate(taskId, metadata: { retryCount: N, lastAgentId: agentId })`
|
|
206
|
-
5.
|
|
211
|
+
5. **Classify the error before deciding to retry**:
|
|
212
|
+
- **First failure** (no `metadata.lastError` exists): store `metadata.lastError = {current error message}`. Classify as transient (no prior error to compare) and proceed with retry.
|
|
213
|
+
- **Subsequent failures** (`metadata.lastError` exists): Compare the current error with `metadata.lastError`. If the error is **the same** (deterministic failure — same message, same stack location) → stop immediately and mark as failed. Retrying a deterministic failure wastes cycles.
|
|
214
|
+
- If the error **differs** from the previous attempt (transient/flaky — different message, network blip, lock contention) → re-launch with `resume: lastAgentId`. The resumed agent retains full context from the previous attempt (what it tried, what failed, partial progress), enabling more targeted retry.
|
|
207
215
|
- **Worktree caveat**: if the failed worker made no file changes, its worktree is auto-cleaned and `resume` will fail. In this case, fall back to a fresh launch (omit `resume`) for the retry.
|
|
208
|
-
|
|
216
|
+
- Update `metadata.lastError` with the current error on each attempt.
|
|
217
|
+
6. If retryCount >= 5 (absolute safety cap) → mark as failed, report: `"T{ID} failed after {retryCount} attempts: {last error}"`
|
|
209
218
|
7. Continue with remaining tasks — a single failure does not block the entire phase
|
|
210
219
|
|
|
211
|
-
#### Swarm Mode (
|
|
220
|
+
#### Swarm Mode (high [P] task count)
|
|
212
221
|
|
|
213
|
-
When a phase has
|
|
222
|
+
When a phase has enough parallelizable tasks that a single batch of Task() calls would saturate the concurrent agent limit and require multiple orchestrator rounds, use the **orchestrator-managed swarm pattern**.
|
|
214
223
|
|
|
215
224
|
> **Key constraint**: Claude Code's TaskUpdate uses **last-write-wins** with local file locking only. Multiple sub-agents calling TaskUpdate on the same task simultaneously can cause lost writes. The orchestrator must mediate task assignment to prevent collisions.
|
|
216
225
|
|
|
@@ -268,7 +277,7 @@ Task("Worker 2: T008, T010, T012", subagent_type: "afc:afc-impl-worker", isolati
|
|
|
268
277
|
5. If unblocked tasks remain → assign to new worker batch (repeat Step 2)
|
|
269
278
|
6. If all tasks complete → phase done
|
|
270
279
|
|
|
271
|
-
**Worker count**: N = min(5, unblocked task count). Max 5 concurrent sub-agents per phase.
|
|
280
|
+
**Worker count**: N = min(5, unblocked task count). Max 5 concurrent sub-agents per phase (5 is the Claude Code platform limit for concurrent agents — not a semantic preference).
|
|
272
281
|
|
|
273
282
|
**Task assignment strategy**: Round-robin by file path — each worker gets tasks targeting different files to maximize isolation. If a worker has multiple tasks, order them by `depends:` topology.
|
|
274
283
|
|
|
@@ -280,9 +289,13 @@ When a worker agent returns an error:
|
|
|
280
289
|
3. Capture the `agentId` from the failed worker's result
|
|
281
290
|
4. Reset uncompleted tasks: `TaskUpdate(taskId, status: "pending")`
|
|
282
291
|
5. Track retry count: `TaskUpdate(taskId, metadata: { retryCount: N, lastAgentId: agentId })`
|
|
283
|
-
6.
|
|
292
|
+
6. **Classify the error before deciding to retry**:
|
|
293
|
+
- **First failure** (no `metadata.lastError` exists): store `metadata.lastError = {current error message}`. Classify as transient (no prior error to compare) and proceed with retry.
|
|
294
|
+
- **Subsequent failures** (`metadata.lastError` exists): Compare the current error with `metadata.lastError`. If the error is **the same** (deterministic failure — same message, same stack location) → stop immediately and mark as failed. Retrying a deterministic failure wastes cycles.
|
|
295
|
+
- If the error **differs** from the previous attempt (transient/flaky — different message, network blip, lock contention) → re-launch with `resume: lastAgentId`. The resumed agent retains its full conversation history (files read, changes attempted, errors encountered), enabling targeted retry.
|
|
284
296
|
- **Worktree caveat**: if the failed worker made no file changes, its worktree is auto-cleaned and `resume` will fail. In this case, fall back to a fresh launch (omit `resume`) for the retry.
|
|
285
|
-
|
|
297
|
+
- Update `metadata.lastError` with the current error on each attempt.
|
|
298
|
+
7. If retryCount >= 5 (absolute safety cap) → mark as failed, report: `"T{ID} failed after {retryCount} attempts: {last error}"`
|
|
286
299
|
8. Continue with remaining tasks
|
|
287
300
|
|
|
288
301
|
> Single task failure does not block the phase. The orchestrator reassigns failed tasks to subsequent batches.
|
|
@@ -299,12 +312,12 @@ When a worker agent returns an error:
|
|
|
299
312
|
|
|
300
313
|
#### Phase Completion Gate (3 steps)
|
|
301
314
|
|
|
302
|
-
> **Always** read `${
|
|
315
|
+
> **Always** read `${CLAUDE_SKILL_DIR}/../../docs/phase-gate-protocol.md` first and perform the 3–4 steps (CI gate → Mini-Review → Integration/E2E Gate (conditional) → Auto-Checkpoint) in order.
|
|
303
316
|
> Cannot advance to the next phase without passing the gate. Abort and report to user after 3 consecutive CI failures.
|
|
304
317
|
|
|
305
318
|
After passing the gate, create a phase rollback point:
|
|
306
319
|
```bash
|
|
307
|
-
"${
|
|
320
|
+
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" phase-tag {phase_number}
|
|
308
321
|
```
|
|
309
322
|
This enables granular rollback: `git reset --hard afc/phase-{N}` restores state after Phase N completed.
|
|
310
323
|
|
|
@@ -346,11 +359,11 @@ After all tasks are complete:
|
|
|
346
359
|
|
|
347
360
|
After CI passes, run a convergence-based Critic Loop to verify design alignment before reporting completion.
|
|
348
361
|
|
|
349
|
-
> **Always** read `${
|
|
362
|
+
> **Always** read `${CLAUDE_SKILL_DIR}/../../docs/critic-loop-rules.md` first and follow it.
|
|
350
363
|
|
|
351
364
|
**Critic Loop until convergence** (safety cap: 5):
|
|
352
365
|
|
|
353
|
-
- **SCOPE_ADHERENCE**: Compare `git diff` changed files against plan.md File Change
|
|
366
|
+
- **SCOPE_ADHERENCE**: Compare `git diff` changed files against plan.md File Change Map. Flag any file modified that is NOT in the plan. Flag any planned file NOT modified. Provide "M of N files match" count.
|
|
354
367
|
- **ARCHITECTURE**: Validate changed files against `{config.architecture}` rules (layer boundaries, naming conventions, import paths). Provide "N of M rules checked" count.
|
|
355
368
|
- **CORRECTNESS**: Cross-check implemented changes against spec.md acceptance criteria (AC). Verify each AC has corresponding code. Provide "N of M AC verified" count.
|
|
356
369
|
- **SIDE_EFFECT_SAFETY**: For tasks that changed call order, error handling, or state flow: verify that callee behavior is compatible with the new call pattern. Provide "{M} of {N} behavioral changes verified" count.
|
|
@@ -365,7 +378,7 @@ After CI passes, run a convergence-based Critic Loop to verify design alignment
|
|
|
365
378
|
|
|
366
379
|
**Standalone cleanup** (if pipeline was activated in Step 0):
|
|
367
380
|
```bash
|
|
368
|
-
"${
|
|
381
|
+
"${CLAUDE_SKILL_DIR}/../../scripts/afc-pipeline-manage.sh" end
|
|
369
382
|
```
|
|
370
383
|
|
|
371
384
|
```
|
|
@@ -384,10 +397,10 @@ Implementation complete
|
|
|
384
397
|
- **Architecture compliance**: follow {config.architecture} rules.
|
|
385
398
|
- **{config.ci} gate**: must pass on phase completion. Do not bypass.
|
|
386
399
|
- **Swarm workers**: max 5 concurrent. File overlap is strictly prohibited between parallel tasks.
|
|
387
|
-
- **On error**:
|
|
400
|
+
- **On error**: classify errors before retrying. Stop immediately on deterministic (same) errors. Allow additional attempts for transient (different) errors. Hard cap at 5 retries total.
|
|
388
401
|
- **Real-time tasks.md updates**: mark checkbox on each task completion.
|
|
389
402
|
- **Default is direct execution**: main agent executes tasks directly unless all 4 parallel delegation criteria are met. This preserves full context and avoids multi-agent context loss.
|
|
390
|
-
- **Mode selection is automatic**: do not manually override. Sequential (default), batch
|
|
403
|
+
- **Mode selection is automatic**: do not manually override. Sequential (default), batch when moderate independent parallelism justifies coordination overhead, swarm when high task count requires multiple orchestrator rounds.
|
|
391
404
|
- **NEVER use `run_in_background: true` on Task calls**: agents must run in foreground so results are returned before the next step.
|
|
392
405
|
- **No worker self-claiming**: In swarm mode, the orchestrator pre-assigns tasks to workers. Workers do NOT call TaskList/TaskUpdate to claim tasks — this avoids last-write-wins race conditions on TaskUpdate.
|
|
393
406
|
- **Phase-locked registration**: Only register (TaskCreate) the current phase's tasks. Never pre-register future phases. This is the primary mechanism for phase boundary enforcement.
|