azclaude-copilot 0.7.3 → 0.7.5
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 +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +2 -2
- package/package.json +1 -1
- package/templates/CLAUDE.md +5 -0
- package/templates/agents/milestone-builder.md +65 -11
- package/templates/agents/orchestrator.md +92 -6
- package/templates/agents/problem-architect.md +39 -1
- package/templates/capabilities/manifest.md +1 -0
- package/templates/capabilities/shared/parallel-coordination.md +116 -0
- package/templates/capabilities/shared/toolchain-gate.md +326 -0
- package/templates/commands/blueprint.md +42 -0
- package/templates/scripts/env-scan.sh +34 -0
- package/templates/visualizer/public/app.js +1 -1
- package/templates/visualizer/server.js +1 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
{
|
|
10
10
|
"name": "azclaude",
|
|
11
11
|
"description": "AZCLAUDE is a complete AI coding environment for Claude Code. It installs 40 commands, 10 auto-invoked skills, 15 specialized agents, 5 hooks, a real-time pipeline visualizer, and a persistent memory system — in one command.\n\nKey features:\n• Memory across sessions — goals.md + checkpoints injected automatically before every session\n• Self-improving loop — /reflect fixes stale CLAUDE.md rules, /reflexes learns from tool-use patterns, /evolve creates agents from git evidence\n• Autonomous copilot mode — /copilot runs a three-tier team (orchestrator → problem-architect → milestone-builder) across sessions until the product ships\n• Spec-driven workflow — /constitute writes project rules, /spec writes structured ACs, /analyze detects plan drift and ghost milestones, /blueprint traces every milestone to a spec\n• Security layer — 111-rule environment scan (/sentinel), pre-write secret blocking, pre-ship credential audit\n• Progressive levels 0–10 — start with CLAUDE.md, grow into multi-agent pipelines and self-evolving environments\n• Zero dependencies — no npm packages, no external APIs, no vector databases. Plain markdown files and Claude Code's native architecture.\n• Smart install — npx azclaude-copilot@latest auto-detects first install vs upgrade vs verify. Context-aware onboarding shows the right next command for your project state.\n\nExample use cases:\n• /setup — scan an existing project, detect stack + domain + scale, fill CLAUDE.md, generate project-specific skills and agents automatically\n• /copilot \"Build a compliance SaaS with trilingual support\" — walk away, come back to working code across multiple sessions\n• /sentinel — run a scored security audit (0–100, grade A–F) across hooks, permissions, MCP servers, agent configs, and secrets\n• /evolve — detect gaps in the environment, generate new skills and agents from git co-change evidence, report score delta (e.g. 42/100 → 68/100)\n• /constitute — write your project's constitution (non-negotiables, architectural commitments, definition of done) — gates all future AI actions\n• /analyze — cross-artifact consistency check: ghost milestones, spec vs. code drift, unplanned commits\n• /reflect — find stale, missing, or contradicting rules in CLAUDE.md and propose exact fixes\n• /debate \"REST vs GraphQL for this project\" — adversarial evidence-based decision with order-independent scoring, logged to decisions.md",
|
|
12
|
-
"version": "0.7.
|
|
12
|
+
"version": "0.7.5",
|
|
13
13
|
"source": {
|
|
14
14
|
"source": "github",
|
|
15
15
|
"repo": "haytamAroui/AZ-CLAUDE-COPILOT",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azclaude",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "AZCLAUDE is a complete AI coding environment for Claude Code. It installs 40 commands, 10 auto-invoked skills, 15 specialized agents, 5 hooks, a real-time pipeline visualizer, and a persistent memory system — in one command.\n\nKey features:\n• Memory across sessions — goals.md + checkpoints injected automatically before every session\n• Self-improving loop — /reflect fixes stale CLAUDE.md rules, /reflexes learns from tool-use patterns, /evolve creates agents from git evidence\n• Autonomous copilot mode — /copilot runs a three-tier team (orchestrator → problem-architect → milestone-builder) across sessions until the product ships\n• Spec-driven workflow — /constitute writes project rules, /spec writes structured ACs, /analyze detects plan drift and ghost milestones, /blueprint traces every milestone to a spec\n• Security layer — 111-rule environment scan (/sentinel), pre-write secret blocking, pre-ship credential audit\n• Progressive levels 0–10 — start with CLAUDE.md, grow into multi-agent pipelines and self-evolving environments\n• Zero dependencies — no npm packages, no external APIs, no vector databases. Plain markdown files and Claude Code's native architecture.\n• Smart install — npx azclaude-copilot@latest auto-detects first install vs upgrade vs verify. Context-aware onboarding shows the right next command for your project state.\n\nExample use cases:\n• /setup — scan an existing project, detect stack + domain + scale, fill CLAUDE.md, generate project-specific skills and agents automatically\n• /copilot \"Build a compliance SaaS with trilingual support\" — walk away, come back to working code across multiple sessions\n• /sentinel — run a scored security audit (0–100, grade A–F) across hooks, permissions, MCP servers, agent configs, and secrets\n• /evolve — detect gaps in the environment, generate new skills and agents from git co-change evidence, report score delta (e.g. 42/100 → 68/100)\n• /constitute — write your project's constitution (non-negotiables, architectural commitments, definition of done) — gates all future AI actions\n• /analyze — cross-artifact consistency check: ghost milestones, spec vs. code drift, unplanned commits\n• /reflect — find stale, missing, or contradicting rules in CLAUDE.md and propose exact fixes\n• /debate \"REST vs GraphQL for this project\" — adversarial evidence-based decision with order-independent scoring, logged to decisions.md",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "haytamAroui",
|
package/README.md
CHANGED
|
@@ -637,11 +637,11 @@ AZCLAUDE is a lazy-loaded environment of 48 capability modules. It only loads wh
|
|
|
637
637
|
|
|
638
638
|
## Verified
|
|
639
639
|
|
|
640
|
-
|
|
640
|
+
1958 tests. Every template, command, capability, agent, hook, and CLI feature verified.
|
|
641
641
|
|
|
642
642
|
```bash
|
|
643
643
|
bash tests/test-features.sh
|
|
644
|
-
# Results:
|
|
644
|
+
# Results: 1958 passed, 0 failed, 1958 total
|
|
645
645
|
```
|
|
646
646
|
|
|
647
647
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azclaude-copilot",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "AI coding environment — 40 commands, 10 skills, 15 agents, real-time visualizer, memory, reflexes, evolution. Install: npx azclaude-copilot@latest, then open Claude Code.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"azclaude": "bin/cli.js",
|
package/templates/CLAUDE.md
CHANGED
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
{{PROJECT_DESCRIPTION}}
|
|
13
13
|
Domain: {{DOMAIN}} | Stack: {{STACK}} | Scale: {{SCALE}}
|
|
14
14
|
|
|
15
|
+
## Verify
|
|
16
|
+
Quick: {{QUICK_VERIFY}}
|
|
17
|
+
Test: {{TEST_VERIFY}}
|
|
18
|
+
Build: {{BUILD_VERIFY}}
|
|
19
|
+
|
|
15
20
|
## Rules
|
|
16
21
|
1. **Completion** — Never say "should work" or "probably passes." Show the output or stay in progress.
|
|
17
22
|
2. **Precision** — Reference code as `file:line`. Never describe in prose.
|
|
@@ -79,19 +79,66 @@ Rules:
|
|
|
79
79
|
|
|
80
80
|
---
|
|
81
81
|
|
|
82
|
-
### Step 3: Verify
|
|
82
|
+
### Step 3: Verify — Toolchain Exit Gate (MANDATORY)
|
|
83
83
|
|
|
84
|
+
Load `capabilities/shared/toolchain-gate.md` for the stack-to-command mapping.
|
|
85
|
+
Read the `Verify:` field from the Team Spec injected in your prompt. If missing, read CLAUDE.md `## Verify`.
|
|
86
|
+
|
|
87
|
+
Create the logs directory:
|
|
88
|
+
```bash
|
|
89
|
+
mkdir -p .claude/logs
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Tier 1: Static verification (MANDATORY — always run)**
|
|
93
|
+
```bash
|
|
94
|
+
# Use the Quick command from Team Spec Verify: field
|
|
95
|
+
{quick_verify_cmd} 2>&1 | tee .claude/logs/verify-log-M{N}.md
|
|
96
|
+
echo "TIER1_EXIT=$?" >> .claude/logs/verify-log-M{N}.md
|
|
97
|
+
```
|
|
98
|
+
- Errors in YOUR files → fix them (counts as a self-correction attempt)
|
|
99
|
+
- Errors in OTHER files → append to verify log: `"Scope violation: {file} — outside my directories"` — do NOT fix
|
|
100
|
+
- Tool not installed → skip with warning: `"Tier 1 SKIPPED: {tool} not available"`
|
|
101
|
+
|
|
102
|
+
**Tier 2: Scoped test verification (MANDATORY)**
|
|
103
|
+
```bash
|
|
104
|
+
# Use the Test command from Team Spec Verify: field
|
|
105
|
+
{scoped_test_cmd} 2>&1 | tee -a .claude/logs/verify-log-M{N}.md
|
|
106
|
+
echo "TIER2_EXIT=$?" >> .claude/logs/verify-log-M{N}.md
|
|
107
|
+
```
|
|
108
|
+
- In parallel mode: run ONLY tests in your Test scope — not the full suite
|
|
109
|
+
- In sequential mode: run full test suite
|
|
110
|
+
|
|
111
|
+
**Tier 2b: Runtime verification (ONLY if Team Spec Verify: Runtime ≠ SKIP)**
|
|
84
112
|
```bash
|
|
85
|
-
# Run
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
113
|
+
# Run the app briefly, capture crashes
|
|
114
|
+
timeout 15 {run_command} 2>&1 | tee .claude/logs/runtime-M{N}.log; exit 0
|
|
115
|
+
```
|
|
116
|
+
The `exit 0` prevents Claude Code from treating a crash as a Bash failure.
|
|
117
|
+
If the runtime log contains stack traces or crash output → read it, diagnose, fix if in your scope.
|
|
118
|
+
|
|
119
|
+
**Write the verify log summary at the top of the file:**
|
|
120
|
+
```markdown
|
|
121
|
+
## Verify Log — M{N}: {title}
|
|
90
122
|
|
|
91
|
-
|
|
123
|
+
### Tier 1: Static ({command})
|
|
124
|
+
Status: PASS | FAIL
|
|
125
|
+
Errors: {count} | Warnings: {count}
|
|
126
|
+
|
|
127
|
+
### Tier 2: Scoped Tests ({command})
|
|
128
|
+
Status: PASS | FAIL
|
|
129
|
+
Tests: {pass}/{total}, {duration}
|
|
130
|
+
|
|
131
|
+
### Tier 2b: Runtime
|
|
132
|
+
Status: PASS | SKIP | CRASH
|
|
133
|
+
{stack trace summary if crash}
|
|
134
|
+
|
|
135
|
+
### Self-Correction History
|
|
136
|
+
Attempt 1: {what happened}
|
|
137
|
+
Fix: {what was changed}
|
|
138
|
+
Attempt 2: {result}
|
|
92
139
|
```
|
|
93
140
|
|
|
94
|
-
Tests must PASS before reporting done. Show actual output — never summarize.
|
|
141
|
+
Tests and Tier 1 must PASS before reporting done. Show actual output — never summarize.
|
|
95
142
|
|
|
96
143
|
---
|
|
97
144
|
|
|
@@ -148,9 +195,16 @@ Branch: {current branch name} ← required for orchestrator merge tracking
|
|
|
148
195
|
### Files Changed
|
|
149
196
|
- {file}: {create|modify} — {one-line description}
|
|
150
197
|
|
|
151
|
-
###
|
|
152
|
-
PASS — {
|
|
153
|
-
|
|
198
|
+
### Verify Status
|
|
199
|
+
Tier 1 (static): PASS | FAIL | SKIPPED — {error count} errors, {warning count} warnings
|
|
200
|
+
Tier 2 (tests): PASS | FAIL — {pass}/{total} tests, {duration}
|
|
201
|
+
Runtime: PASS | SKIP | CRASH
|
|
202
|
+
Verify log: .claude/logs/verify-log-M{N}.md
|
|
203
|
+
Runtime log: .claude/logs/runtime-M{N}.log (if exists)
|
|
204
|
+
|
|
205
|
+
### Self-Correction Summary
|
|
206
|
+
Attempts used: {N} / {budget}
|
|
207
|
+
{one-line per fix if any}
|
|
154
208
|
|
|
155
209
|
### New Patterns Discovered
|
|
156
210
|
{pattern description} — or "none"
|
|
@@ -36,6 +36,37 @@ If CLAUDE.md unfilled → run `/setup` with intent from copilot-intent.md first.
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
+
### Step 1a: Toolchain Bootstrap (MANDATORY before first dispatch)
|
|
40
|
+
|
|
41
|
+
Load `capabilities/shared/toolchain-gate.md` for the full protocol.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Check if Verify field exists in CLAUDE.md
|
|
45
|
+
grep -q "^## Verify" CLAUDE.md 2>/dev/null && echo "verify=configured" || echo "verify=missing"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If `verify=missing` → run the Toolchain Detection Protocol from toolchain-gate.md:
|
|
49
|
+
1. Detect stack files (`package.json`, `Cargo.toml`, `go.mod`, etc.)
|
|
50
|
+
2. Check tool availability (`command -v node`, `command -v cargo`, etc.)
|
|
51
|
+
3. If tool missing AND installer available → install automatically (copilot mode is autonomous)
|
|
52
|
+
4. Install dependencies if missing (`npm install`, `cargo fetch`, etc.)
|
|
53
|
+
5. Write `## Verify` section to CLAUDE.md
|
|
54
|
+
6. Log all output to `.claude/logs/bootstrap.log`
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
mkdir -p .claude/logs
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Smoke test** — run the quick verify command once:
|
|
61
|
+
```bash
|
|
62
|
+
{quick_verify_cmd} 2>&1 | tee .claude/logs/bootstrap.log
|
|
63
|
+
```
|
|
64
|
+
- PASS → proceed to dispatch
|
|
65
|
+
- FAIL → fix the build BEFORE dispatching any agents. This IS the foundation.
|
|
66
|
+
- Tool unavailable → log warning: `"⚠ Verification degraded: {tool} not available"` — proceed with reduced verification
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
39
70
|
### Step 1b: Resume Interrupted Parallel Wave
|
|
40
71
|
|
|
41
72
|
```bash
|
|
@@ -161,9 +192,11 @@ Load `capabilities/shared/context-relay.md` for relay protocol and role-based fi
|
|
|
161
192
|
2. Write `.claude/parallel-wave-state.md` with `dispatch_mode: dag` (see parallel-coordination.md)
|
|
162
193
|
3. **Pre-read shared files** (models, schemas, configs referenced by 2+ agents) and relay their content via a `## Pre-loaded Context` block in each agent's prompt — builders MUST NOT re-read relayed files
|
|
163
194
|
4. If problem-architect returned a `## Relay` section, include it in the builder prompt as-is
|
|
164
|
-
5.
|
|
165
|
-
|
|
166
|
-
|
|
195
|
+
5. **Skill consistency** — collect the UNION of all skills from all Team Specs in this wave. Every agent in the wave loads the SAME skill set (not just its own). This ensures consistent patterns across parallel agents.
|
|
196
|
+
6. **Include Verify commands** from each Team Spec in the agent prompt — the builder uses these in its exit gate
|
|
197
|
+
7. Spawn each builder via Task with `isolation: "worktree"` in the same message (true parallel)
|
|
198
|
+
8. Include worktree rules + **test scope** (`Test scope: {test-dir}`) in every parallel prompt
|
|
199
|
+
9. **Merge-on-complete**: as each agent reports done, merge its branch immediately (don't wait for all)
|
|
167
200
|
7. After each merge: check if newly-unblocked milestones exist → dispatch them immediately
|
|
168
201
|
8. If `max_parallel <= 3` or merge conflicts detected: fall back to batch-merge (wait for all, then merge)
|
|
169
202
|
|
|
@@ -215,14 +248,67 @@ Dependent milestones, overlapping `Files Written`, or `Parallel Safe: NO` → sp
|
|
|
215
248
|
|
|
216
249
|
---
|
|
217
250
|
|
|
218
|
-
### Step 5: Monitor Results + Merge-on-Complete
|
|
251
|
+
### Step 5: Monitor Results + Merge-on-Complete + Verification Wave
|
|
219
252
|
|
|
220
253
|
**When an agent reports PASS (parallel mode):**
|
|
221
254
|
1. Merge its branch to main immediately: `git merge parallel/{slug} --no-ff`
|
|
222
255
|
2. Run tests for the merged module: `{test command} tests/{agent-scope}/ 2>&1 | tail -10`
|
|
223
256
|
3. If tests pass → update plan.md status → `done`, update `.claude/parallel-wave-state.md`
|
|
224
|
-
4.
|
|
225
|
-
|
|
257
|
+
4. New pattern emerged? → append to patterns.md
|
|
258
|
+
|
|
259
|
+
**When ALL agents in a wave complete → VERIFICATION WAVE (mandatory):**
|
|
260
|
+
|
|
261
|
+
Read `capabilities/shared/toolchain-gate.md` for the Tier 3 command and log protocol.
|
|
262
|
+
Before dispatching ANY next-wave agents:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# 1. Tier 3: Full build — write to build log
|
|
266
|
+
{build_command} 2>&1 | tee .claude/logs/build-wave{N}.log
|
|
267
|
+
echo "EXIT=$?" >> .claude/logs/build-wave{N}.log
|
|
268
|
+
|
|
269
|
+
# 2. Full test suite (not scoped — the FULL suite)
|
|
270
|
+
{test_command} 2>&1 | tee -a .claude/logs/build-wave{N}.log
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**3. Read all agent verify logs for this wave:**
|
|
274
|
+
```bash
|
|
275
|
+
cat .claude/logs/verify-log-M*.md 2>/dev/null
|
|
276
|
+
cat .claude/logs/runtime-M*.log 2>/dev/null
|
|
277
|
+
```
|
|
278
|
+
Collect warnings across agents — relay relevant ones to next-wave agents.
|
|
279
|
+
|
|
280
|
+
**4. If build or tests fail → dispatch a FIX agent with log relay:**
|
|
281
|
+
```
|
|
282
|
+
Task: Fix post-Wave {N} build failure
|
|
283
|
+
|
|
284
|
+
## Build Log (last 100 lines)
|
|
285
|
+
{tail -100 .claude/logs/build-wave{N}.log}
|
|
286
|
+
|
|
287
|
+
## Agent Verify Logs Summary
|
|
288
|
+
{for each agent: M{X} — PASS/FAIL, errors, warnings}
|
|
289
|
+
|
|
290
|
+
## Runtime Logs (if any)
|
|
291
|
+
{contents of .claude/logs/runtime-M{X}.log for this wave}
|
|
292
|
+
|
|
293
|
+
## Diagnosis
|
|
294
|
+
Build error at {file}:{line} was introduced by M{X}'s merge.
|
|
295
|
+
M{X}'s verify log shows: {relevant warning}
|
|
296
|
+
|
|
297
|
+
Fix the errors. The logs above give you full context — do NOT re-investigate from scratch.
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
- Build failure → integration error from parallel agents. Fix it now — it multiplies if ignored.
|
|
301
|
+
- Test failure → identify which merge broke it from the build log. Revert that branch or fix in place.
|
|
302
|
+
- **Only after verification passes → check DAG for newly-unblocked milestones → dispatch.**
|
|
303
|
+
- This applies to EVERY wave transition. No exceptions.
|
|
304
|
+
|
|
305
|
+
**Context refresh for Wave 3+ (mandatory):**
|
|
306
|
+
|
|
307
|
+
When dispatching Wave 3 or later, agents work on a codebase modified by many prior agents.
|
|
308
|
+
Before writing agent prompts for Wave N ≥ 3:
|
|
309
|
+
1. Re-read ALL files that Wave N agents will import or depend on — use FRESH reads, not cached
|
|
310
|
+
2. Include fresh file contents in `## Pre-loaded Context` — not stale copies from earlier waves
|
|
311
|
+
3. Add to every Wave 3+ agent prompt: `"Note: {count} milestones have modified the codebase. Pre-loaded Context reflects CURRENT state. Trust it over plan.md assumptions."`
|
|
226
312
|
|
|
227
313
|
**When an agent reports PASS (sequential mode):**
|
|
228
314
|
- Approve commit
|
|
@@ -53,6 +53,7 @@ Also read:
|
|
|
53
53
|
- `.claude/memory/patterns.md` — established conventions for this area
|
|
54
54
|
- `.claude/memory/antipatterns.md` — known failure patterns to avoid
|
|
55
55
|
- Context artifacts: `prisma/schema.prisma`, `openapi.yaml`, `.env.example`
|
|
56
|
+
- CLAUDE.md `## Verify` section — for the `Verify:` field in Team Spec (see `capabilities/shared/toolchain-gate.md`)
|
|
56
57
|
|
|
57
58
|
---
|
|
58
59
|
|
|
@@ -156,11 +157,21 @@ If YES: topic = {what orchestrator must /debate before dispatching}
|
|
|
156
157
|
SIMPLE (< 3 files) | MEDIUM (3-8 files) | COMPLEX (8+ files)
|
|
157
158
|
COMPLEX → orchestrator gives builder 3 fix attempts instead of 2
|
|
158
159
|
|
|
160
|
+
### Verify
|
|
161
|
+
Read CLAUDE.md `## Verify` field for the project's commands. Scope them to this milestone:
|
|
162
|
+
- Quick: `{Tier 1 command}` — static check, MANDATORY before done
|
|
163
|
+
- Test: `{Tier 2 command scoped to this milestone's directories}`
|
|
164
|
+
- Runtime: `{run command if this milestone affects startup/routes/jobs}` — or SKIP
|
|
165
|
+
Example: `Quick: cargo check | Test: cargo test tests/auth/ | Runtime: SKIP`
|
|
166
|
+
The milestone-builder uses these exact commands in its exit gate.
|
|
167
|
+
|
|
159
168
|
### Parallel Safe
|
|
160
|
-
YES | NO
|
|
169
|
+
YES | NO | SEQUENTIAL-ONLY
|
|
161
170
|
If NO: reason = {specific conflict — shared file, schema dependency, runtime ordering}
|
|
171
|
+
If SEQUENTIAL-ONLY: reason = {migration, cross-cutting refactor, 15+ files, pattern-setting}
|
|
162
172
|
The orchestrator uses this to decide whether to use worktree isolation or sequential dispatch.
|
|
163
173
|
Parallel Safe = YES requires: isolated directories, no shared config/schema, no runtime dependency on a sibling milestone.
|
|
174
|
+
Parallel Safe = SEQUENTIAL-ONLY means: this milestone must NEVER be split across agents — see sizing rules below.
|
|
164
175
|
|
|
165
176
|
### Relay (for milestone-builder — do not re-read)
|
|
166
177
|
{Include condensed contents of key files you read during analysis.
|
|
@@ -175,6 +186,32 @@ Maximum ~4000 tokens for this section.}
|
|
|
175
186
|
|
|
176
187
|
---
|
|
177
188
|
|
|
189
|
+
## Agent Sizing Rules — When to Force Sequential
|
|
190
|
+
|
|
191
|
+
A milestone MUST be marked `Parallel Safe: SEQUENTIAL-ONLY` if ANY of these apply:
|
|
192
|
+
|
|
193
|
+
| Signal | Why it can't be split |
|
|
194
|
+
|--------|----------------------|
|
|
195
|
+
| Touches 15+ files | Too many interdependencies for one agent to track in isolation |
|
|
196
|
+
| Framework/library migration | Every file depends on the pattern set by the first file edited |
|
|
197
|
+
| Store/state management rewrite | All consumers depend on the new store shape |
|
|
198
|
+
| Global type rename or API contract change | Callers can't be split from the definition |
|
|
199
|
+
| Build tool or bundler change | Config affects every file's compilation |
|
|
200
|
+
| Auth/middleware rewrite | Everything downstream depends on the new interface |
|
|
201
|
+
|
|
202
|
+
**When a milestone is too large but must stay sequential, recommend decomposition:**
|
|
203
|
+
```
|
|
204
|
+
Recommend: Split into 3 SEQUENTIAL sub-milestones:
|
|
205
|
+
1. {foundation — sets the pattern} → Parallel Safe: SEQUENTIAL-ONLY
|
|
206
|
+
2. {consumers group A — follows the pattern} → Depends: sub-1
|
|
207
|
+
3. {consumers group B — follows the pattern} → Depends: sub-2
|
|
208
|
+
```
|
|
209
|
+
Each sub-milestone has a checkpoint. Still sequential, but with clear boundaries and rollback points.
|
|
210
|
+
|
|
211
|
+
**Key insight:** The fix for an oversized milestone is better decomposition, not more agents. Splitting a migration across parallel agents produces inconsistent patterns that are harder to fix than doing it sequentially.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
178
215
|
## Rules
|
|
179
216
|
|
|
180
217
|
- **NEVER implement.** NEVER write to project files. Tools: Read, Grep, Glob, Bash only.
|
|
@@ -183,4 +220,5 @@ Maximum ~4000 tokens for this section.}
|
|
|
183
220
|
- **Be specific.** "Load security skill" is weak.
|
|
184
221
|
"Load security skill because M4 handles Stripe webhook HMAC signatures" is strong.
|
|
185
222
|
- **Files Written must be exhaustive.** A missed file causes silent parallel corruption.
|
|
223
|
+
- **ALWAYS apply agent sizing rules.** A 32-file migration marked Parallel Safe: YES causes cascading failures.
|
|
186
224
|
- If unsure whether an agent exists → Grep .claude/agents/ for it. Never assume.
|
|
@@ -30,6 +30,7 @@ Load only the files that match the current task. Never load the full list.
|
|
|
30
30
|
| shared/reward-hack-detection.md | /audit, /ship, post-milestone review — detect reward hacking patterns in test modifications | ~150 |
|
|
31
31
|
| shared/ultrathink.md | $ARGUMENTS contains --deep, or command needs extended thinking for complex analysis | ~80 |
|
|
32
32
|
| shared/context-relay.md | About to spawn a subagent — pass pre-read files to eliminate redundant reads across agent boundaries | ~300 |
|
|
33
|
+
| shared/toolchain-gate.md | /copilot dispatch, /parallel, agent verify, env-scan — stack detection, verify commands, toolchain bootstrap, 3-tier verification, log protocol | ~500 |
|
|
33
34
|
|
|
34
35
|
## Level Builders — load ONE at a time
|
|
35
36
|
| File | When to load | Tokens |
|
|
@@ -342,6 +342,122 @@ After resume completes, continue with Merge Protocol → Plan Update → Cleanup
|
|
|
342
342
|
|
|
343
343
|
---
|
|
344
344
|
|
|
345
|
+
## Universal Parallel Execution Rules
|
|
346
|
+
|
|
347
|
+
These rules are technology-agnostic. They apply to every parallel dispatch regardless of stack, framework, or language.
|
|
348
|
+
|
|
349
|
+
### Rule 1: Verification Wave — Mandatory Between Every Parallel Batch
|
|
350
|
+
|
|
351
|
+
After ALL agents in a wave complete and merge, run a **verification step** before dispatching the next wave:
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
Wave N agents complete → merge all branches → VERIFICATION:
|
|
355
|
+
1. Run full build (compile/transpile/lint — whatever the project uses)
|
|
356
|
+
2. Run full test suite (not scoped — the FULL suite)
|
|
357
|
+
3. If build fails → fix before next wave (these are integration errors from parallel agents)
|
|
358
|
+
4. If tests fail → identify which merge broke it → revert or fix before next wave
|
|
359
|
+
5. Only after verification passes → dispatch Wave N+1
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
**Why:** Parallel agents can't verify integration — they only see their own worktree. Without verification, errors accumulate across waves. A type change in Wave 1 that breaks a Wave 2 consumer won't surface until the end, when fixing is 10x harder.
|
|
363
|
+
|
|
364
|
+
**The verification agent is lightweight:** it runs build + tests, nothing else. No implementation. Budget ~2 minutes per wave.
|
|
365
|
+
|
|
366
|
+
### Rule 2: Sweet Spot Is 3–5 Parallel Agents Per Wave
|
|
367
|
+
|
|
368
|
+
| Agent count | Risk | Recommendation |
|
|
369
|
+
|------------|------|----------------|
|
|
370
|
+
| 1–2 | Low | Sequential is simpler — skip parallel overhead |
|
|
371
|
+
| 3–5 | Optimal | Best ratio of speed gain to coordination cost |
|
|
372
|
+
| 6 | Maximum | Only if all 6 own completely disjoint directories |
|
|
373
|
+
| 7+ | Diminishing returns | Prompt quality degrades, merge complexity spikes |
|
|
374
|
+
|
|
375
|
+
**Why:** Beyond 5 agents, the orchestrator's ability to write precise-enough prompts degrades. Each prompt needs exact file ownership, patterns, and anti-patterns. More agents = more surface area for conflicts that safety checks miss.
|
|
376
|
+
|
|
377
|
+
### Rule 3: Wave 1 Sets the Contract
|
|
378
|
+
|
|
379
|
+
The first wave establishes types, APIs, schemas, and patterns that ALL subsequent waves depend on. If Wave 1 gets something wrong, the error **multiplies** across every later agent.
|
|
380
|
+
|
|
381
|
+
**Rules for Wave 1:**
|
|
382
|
+
- Wave 1 should be the **smallest, most carefully specified wave**
|
|
383
|
+
- Wave 1 milestones define shared types, base schemas, core configs
|
|
384
|
+
- Wave 1 agents get **extra fix attempts** (3 instead of 2)
|
|
385
|
+
- Wave 1 MUST pass verification before Wave 2 dispatches — no exceptions
|
|
386
|
+
- If Wave 1 introduces a new pattern (e.g., error type, response shape), document it in `patterns.md` BEFORE dispatching Wave 2
|
|
387
|
+
|
|
388
|
+
### Rule 4: Agent Size Limits — When NOT to Split
|
|
389
|
+
|
|
390
|
+
A milestone that touches **15+ files** or performs a **cross-cutting change** (framework migration, global refactor, store pattern rewrite) should NOT be split across agents.
|
|
391
|
+
|
|
392
|
+
**Signs a milestone must stay as one agent (sequential):**
|
|
393
|
+
- Framework/library migration (every file depends on the pattern set by the first file edited)
|
|
394
|
+
- Store/state management rewrite (all consumers depend on the new store shape)
|
|
395
|
+
- Global type rename or API contract change (callers can't be split from the definition)
|
|
396
|
+
- Auth/middleware rewrite (everything downstream depends on the new interface)
|
|
397
|
+
|
|
398
|
+
**The fix is better decomposition, not more agents:**
|
|
399
|
+
```
|
|
400
|
+
BAD: Split Svelte 5 migration into 5 parallel agents → inconsistent patterns
|
|
401
|
+
GOOD: Split into 3 SEQUENTIAL sub-milestones:
|
|
402
|
+
1. Stores + shared state (sets the pattern)
|
|
403
|
+
2. Pages (follows the pattern)
|
|
404
|
+
3. Components (follows the pattern)
|
|
405
|
+
Each sub-milestone has checkpoints. Still sequential, but with clear boundaries.
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
**Rule: If a milestone can't be split without creating pattern inconsistency → keep it as one agent, sequential.**
|
|
409
|
+
|
|
410
|
+
### Rule 5: Context Drift Mitigation for Later Waves
|
|
411
|
+
|
|
412
|
+
By Wave 3+, agents work on a codebase modified by 5–15 previous agents. Assumptions about types, APIs, and file contents may be stale.
|
|
413
|
+
|
|
414
|
+
**Mitigation protocol for Wave N (N ≥ 3):**
|
|
415
|
+
1. Orchestrator re-reads ALL files that Wave N agents will import/depend on
|
|
416
|
+
2. Orchestrator includes **fresh file contents** in the `## Pre-loaded Context` block — not cached from earlier waves
|
|
417
|
+
3. Every Wave 3+ agent prompt includes: `"Warning: {N} milestones have modified the codebase since plan.md was written. Pre-loaded Context below reflects the CURRENT state. Trust it over plan.md assumptions."`
|
|
418
|
+
4. If a type/interface was changed by a prior wave, include the **new** definition explicitly
|
|
419
|
+
|
|
420
|
+
**Why:** Agents don't communicate with each other. An agent in Wave 4 that assumes `Result<_, String>` when Wave 2 changed it to `CmdResult<_>` will produce code that compiles in its worktree but fails on merge.
|
|
421
|
+
|
|
422
|
+
### Rule 6: Skills Are the Consistency Layer
|
|
423
|
+
|
|
424
|
+
Parallel agents never communicate, but they must produce consistent code. **Skills are how.**
|
|
425
|
+
|
|
426
|
+
**Rules:**
|
|
427
|
+
- ALL agents in the same wave MUST load the same skill set (from problem-architect's Team Spec)
|
|
428
|
+
- If a project uses a specific pattern (e.g., Svelte 5 runes, Rust async, clean architecture), the matching skill MUST be loaded by every agent that touches that layer
|
|
429
|
+
- If no skill exists for the project's core pattern → create it with `skill-creator` BEFORE dispatching the first wave
|
|
430
|
+
- Skills ensure: consistent error handling, consistent naming, consistent imports, consistent test patterns
|
|
431
|
+
|
|
432
|
+
**Why:** 5 agents in separate rooms producing code in 5 different styles is worse than 3 agents producing consistent code. Skills are the shared style guide that makes parallel agents act like a coordinated team.
|
|
433
|
+
|
|
434
|
+
### Rule 7: Framework Migrations Are Always Sequential
|
|
435
|
+
|
|
436
|
+
Any milestone classified as a **migration** (framework upgrade, language version bump, build system change, ORM migration) MUST run sequentially — never in a parallel wave.
|
|
437
|
+
|
|
438
|
+
**Detection — a milestone is a migration if it:**
|
|
439
|
+
- Changes `package.json` / `requirements.txt` / `Cargo.toml` / `go.mod` major versions
|
|
440
|
+
- Rewrites import patterns across 10+ files
|
|
441
|
+
- Changes a store/state pattern that all components consume
|
|
442
|
+
- Upgrades a UI framework (React class→hooks, Svelte 4→5, Vue Options→Composition)
|
|
443
|
+
- Switches a build tool (webpack→vite, setuptools→poetry)
|
|
444
|
+
|
|
445
|
+
**Why:** Migrations are inherently cross-cutting. Every file depends on the pattern established by the first file migrated. Splitting a migration across agents produces inconsistent patterns that are harder to fix than doing it sequentially.
|
|
446
|
+
|
|
447
|
+
### Rule Summary Table
|
|
448
|
+
|
|
449
|
+
| # | Rule | Enforced by |
|
|
450
|
+
|---|------|-------------|
|
|
451
|
+
| 1 | Verification wave between batches | Orchestrator Step 5 |
|
|
452
|
+
| 2 | 3–5 agents per wave (6 max) | Orchestrator Step 2 |
|
|
453
|
+
| 3 | Wave 1 = smallest, most careful | Blueprint Task Classifier |
|
|
454
|
+
| 4 | 15+ file milestones stay sequential | Problem Architect Team Spec |
|
|
455
|
+
| 5 | Fresh context for Wave 3+ agents | Orchestrator Step 4 |
|
|
456
|
+
| 6 | Same skills for all wave agents | Orchestrator Step 4 |
|
|
457
|
+
| 7 | Migrations always sequential | Blueprint Task Classifier |
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
345
461
|
## Ownership Map Cleanup
|
|
346
462
|
|
|
347
463
|
After wave merge is complete:
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# Toolchain Gate — Verify Before Ship
|
|
2
|
+
|
|
3
|
+
This capability is loaded by the orchestrator, milestone-builder, and /setup.
|
|
4
|
+
It defines how agents detect, install, and verify the project's toolchain — and how
|
|
5
|
+
logs flow between agents as context for fix dispatches.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Stack-to-Command Mapping
|
|
10
|
+
|
|
11
|
+
The source of truth for every verification command. Agents never guess — they look up.
|
|
12
|
+
|
|
13
|
+
| Stack signal | Quick verify (Tier 1) | Scoped test (Tier 2) | Full build (Tier 3) | Install deps | Install tool |
|
|
14
|
+
|-------------|----------------------|---------------------|--------------------|--------------|----|
|
|
15
|
+
| `Cargo.toml` | `cargo check 2>&1` | `cargo test {scope} 2>&1` | `cargo build 2>&1` | `cargo fetch` | `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \| sh -s -- -y` |
|
|
16
|
+
| `package.json` + TS | `npx tsc --noEmit 2>&1` | `npm test -- --testPathPattern={scope} 2>&1` | `npm run build 2>&1` | `npm install` | `curl -fsSL https://fnm.vercel.app/install \| bash && fnm install --lts` |
|
|
17
|
+
| `package.json` (JS only) | `npx eslint src/ 2>&1 \|\| true` | `npm test 2>&1` | `npm run build 2>&1` | `npm install` | same as above |
|
|
18
|
+
| `pyproject.toml` / `requirements.txt` | `python -m py_compile {files} 2>&1` | `python -m pytest {scope} -x 2>&1` | `python -m pytest 2>&1` | `pip install -r requirements.txt` or `pip install -e .` | `curl -fsSL https://pyenv.run \| bash` |
|
|
19
|
+
| `go.mod` | `go vet ./... 2>&1` | `go test ./{scope}/... 2>&1` | `go build ./... 2>&1` | `go mod download` | `curl -fsSL https://go.dev/dl/ (manual)` |
|
|
20
|
+
| `Gemfile` | `ruby -c {files} 2>&1` | `bundle exec rspec {scope} 2>&1` | `bundle exec rspec 2>&1` | `bundle install` | `curl -fsSL https://get.rvm.io \| bash` |
|
|
21
|
+
| `pubspec.yaml` | `dart analyze 2>&1` | `dart test {scope} 2>&1` | `dart compile exe 2>&1` | `dart pub get` | manual |
|
|
22
|
+
| `Makefile` (C/C++) | `make -n 2>&1` | `make test 2>&1` | `make 2>&1` | — | system package manager |
|
|
23
|
+
| `*.sln` / `*.csproj` | `dotnet build --no-restore 2>&1` | `dotnet test {scope} 2>&1` | `dotnet build 2>&1` | `dotnet restore` | `winget install Microsoft.DotNet.SDK.8` |
|
|
24
|
+
|
|
25
|
+
**Multi-stack projects:** If both `Cargo.toml` and `package.json` exist, chain: `cargo check && npx tsc --noEmit`.
|
|
26
|
+
Store all applicable commands in the `Verify:` field, joined by `&&`.
|
|
27
|
+
|
|
28
|
+
**Custom overrides:** If the project has a `Makefile` with a `check` target, or `package.json` has a `"check"` script, prefer those over the table above. Project conventions beat defaults.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Toolchain Detection Protocol
|
|
33
|
+
|
|
34
|
+
Run by env-scan.sh and /setup. Output determines the `Verify:` field in CLAUDE.md.
|
|
35
|
+
|
|
36
|
+
### Step 1: Detect stack files
|
|
37
|
+
```bash
|
|
38
|
+
ls package.json Cargo.toml go.mod pyproject.toml requirements.txt Gemfile pubspec.yaml *.sln *.csproj Makefile 2>/dev/null
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 2: Check tool availability
|
|
42
|
+
```bash
|
|
43
|
+
# For each detected stack, check the runtime
|
|
44
|
+
command -v node 2>/dev/null && node --version || echo "node=missing"
|
|
45
|
+
command -v cargo 2>/dev/null && cargo --version || echo "cargo=missing"
|
|
46
|
+
command -v python3 2>/dev/null && python3 --version || echo "python=missing"
|
|
47
|
+
command -v go 2>/dev/null && go version || echo "go=missing"
|
|
48
|
+
command -v ruby 2>/dev/null && ruby --version || echo "ruby=missing"
|
|
49
|
+
command -v dotnet 2>/dev/null && dotnet --version || echo "dotnet=missing"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Step 3: Check dependencies installed
|
|
53
|
+
```bash
|
|
54
|
+
[ -d node_modules ] && echo "node_deps=installed" || echo "node_deps=missing"
|
|
55
|
+
[ -d target ] && echo "rust_deps=fetched" || echo "rust_deps=missing"
|
|
56
|
+
[ -d venv ] || [ -d .venv ] && echo "py_venv=found" || echo "py_venv=missing"
|
|
57
|
+
[ -d vendor ] && echo "vendor=found" || echo "vendor=missing"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Step 4: Check for custom verify scripts
|
|
61
|
+
```bash
|
|
62
|
+
# package.json custom scripts
|
|
63
|
+
node -e "const p=require('./package.json'); console.log(p.scripts?.check || p.scripts?.typecheck || p.scripts?.lint || 'none')" 2>/dev/null
|
|
64
|
+
# Makefile targets
|
|
65
|
+
grep -q '^check:' Makefile 2>/dev/null && echo "makefile_check=true"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Step 5: Compose verify command
|
|
69
|
+
Use the mapping table + any custom overrides detected in Step 4.
|
|
70
|
+
Write result to CLAUDE.md `Verify:` field.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Toolchain Bootstrap Protocol
|
|
75
|
+
|
|
76
|
+
Run by orchestrator before first dispatch, or by /setup at project init.
|
|
77
|
+
|
|
78
|
+
### Mode: Interactive (/setup, /add, /fix)
|
|
79
|
+
```
|
|
80
|
+
1. Detect missing tools (Step 2 above)
|
|
81
|
+
2. If missing: WARN user, ASK before installing
|
|
82
|
+
"cargo is not installed but Cargo.toml exists. Install Rust via rustup? (y/n)"
|
|
83
|
+
3. If user says no → log: "Verification disabled for Rust — cargo not available"
|
|
84
|
+
4. If user says yes → install, verify, continue
|
|
85
|
+
5. Install dependencies if missing (npm install, cargo fetch, etc.)
|
|
86
|
+
6. Run quick_verify once as smoke test
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Mode: Autonomous (/copilot)
|
|
90
|
+
```
|
|
91
|
+
1. Detect missing tools
|
|
92
|
+
2. If missing AND installer available → install automatically
|
|
93
|
+
Log to .claude/logs/bootstrap.log
|
|
94
|
+
3. If missing AND no installer → WARN in goals.md, continue without verification
|
|
95
|
+
"⚠ Verification degraded: {tool} not available. Agents will skip Tier 1 checks."
|
|
96
|
+
4. Install dependencies
|
|
97
|
+
5. Run quick_verify
|
|
98
|
+
6. FAIL → fix before ANY agent dispatches (this IS the foundation)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Bootstrap log
|
|
102
|
+
All install output goes to `.claude/logs/bootstrap.log`:
|
|
103
|
+
```bash
|
|
104
|
+
{install_command} 2>&1 | tee .claude/logs/bootstrap.log
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Verification Tiers
|
|
110
|
+
|
|
111
|
+
### Tier 1: Static Verification (MANDATORY — every agent, every mode)
|
|
112
|
+
|
|
113
|
+
**What:** Type-check, lint, or syntax-check without building or running tests.
|
|
114
|
+
**Cost:** 2–30 seconds.
|
|
115
|
+
**Catches:** Type errors, missing imports, syntax errors, undeclared variables.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Agent runs this BEFORE reporting done
|
|
119
|
+
{quick_verify_cmd} 2>&1 | tee .claude/logs/verify-log-M{N}.md
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Rules:**
|
|
123
|
+
- If errors exist in YOUR files → fix them (counts as a self-correction attempt)
|
|
124
|
+
- If errors exist in OTHER files → report but do NOT fix
|
|
125
|
+
- If tool is not installed → skip with warning in verify log
|
|
126
|
+
- MUST run even in worktree mode — the worktree has its own clean state
|
|
127
|
+
|
|
128
|
+
### Tier 2: Scoped Test Verification (MANDATORY — every agent)
|
|
129
|
+
|
|
130
|
+
**What:** Run tests scoped to the agent's files only.
|
|
131
|
+
**Cost:** 10–60 seconds.
|
|
132
|
+
**Catches:** Logic errors, regression, missing test coverage.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Parallel mode: scoped to agent's directory
|
|
136
|
+
{scoped_test_cmd} 2>&1 | tee -a .claude/logs/verify-log-M{N}.md
|
|
137
|
+
|
|
138
|
+
# Sequential mode: full test suite
|
|
139
|
+
{full_test_cmd} 2>&1 | tee -a .claude/logs/verify-log-M{N}.md
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Tier 3: Full Build Verification (verification waves only — NOT per-agent)
|
|
143
|
+
|
|
144
|
+
**What:** Full compilation, bundling, linking.
|
|
145
|
+
**Cost:** 30–300 seconds.
|
|
146
|
+
**Catches:** Linking errors, bundle issues, cross-module type mismatches.
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Orchestrator runs this after merging ALL agents in a wave
|
|
150
|
+
{full_build_cmd} 2>&1 | tee .claude/logs/build-wave{N}.log
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Tier 3 is NEVER run by individual agents.** It's too slow and in parallel mode it would verify a partial codebase.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Log Protocol
|
|
158
|
+
|
|
159
|
+
### Log directory structure
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
.claude/logs/
|
|
163
|
+
├── bootstrap.log ← Level 1: toolchain install output
|
|
164
|
+
├── verify-log-M1A.md ← Level 2: per-agent Tier 1+2 output
|
|
165
|
+
├── verify-log-M1B.md
|
|
166
|
+
├── verify-log-M2A.md
|
|
167
|
+
├── runtime-M1A.log ← runtime crash output (when agent runs the app)
|
|
168
|
+
├── runtime-M2C.log
|
|
169
|
+
├── build-wave1.log ← post-merge full build (Tier 3)
|
|
170
|
+
├── build-wave2.log
|
|
171
|
+
├── integration-final.log ← final integration test output
|
|
172
|
+
└── session-summary.log ← stop.js writes final tally
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Log Type 1: Verify Logs (per agent)
|
|
176
|
+
|
|
177
|
+
Written by milestone-builder after running Tier 1+2. Format:
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
## Verify Log — M{N}: {title}
|
|
181
|
+
|
|
182
|
+
### Tier 1: Static ({command})
|
|
183
|
+
Status: PASS | FAIL
|
|
184
|
+
Errors: {count}
|
|
185
|
+
Warnings: {count}
|
|
186
|
+
{first 50 lines of output if errors or warnings}
|
|
187
|
+
|
|
188
|
+
### Tier 2: Scoped Tests ({command})
|
|
189
|
+
Status: PASS | FAIL
|
|
190
|
+
Tests: {pass}/{total}, {failures} failures, {duration}
|
|
191
|
+
{first 30 lines of output if failures}
|
|
192
|
+
|
|
193
|
+
### Tier 3: Build
|
|
194
|
+
Status: SKIPPED (per-agent — runs in verification wave only)
|
|
195
|
+
|
|
196
|
+
### Self-Correction History
|
|
197
|
+
Attempt 1: {what happened}
|
|
198
|
+
Fix: {what was changed}
|
|
199
|
+
Attempt 2: {result}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Log Type 2: Runtime Logs (crash capture)
|
|
203
|
+
|
|
204
|
+
Written when an agent runs the application and it crashes. The agent captures stderr:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Run app with timeout, capture all output, don't let crash stop execution
|
|
208
|
+
timeout 15 {run_command} 2>&1 | tee .claude/logs/runtime-M{N}.log; exit 0
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The `exit 0` prevents Claude Code from treating the crash as a Bash tool failure.
|
|
212
|
+
The agent then reads the log and has full stack trace context to diagnose the issue.
|
|
213
|
+
|
|
214
|
+
**When to capture runtime logs:**
|
|
215
|
+
- Agent's milestone involves a new endpoint, route, or page → run the app briefly
|
|
216
|
+
- Agent's milestone changes startup logic → run the app to verify it starts
|
|
217
|
+
- Agent's milestone changes a background job → run it once to verify
|
|
218
|
+
- Do NOT run the full app for every milestone — only when the milestone directly affects runtime behavior
|
|
219
|
+
|
|
220
|
+
### Log Type 3: Build Logs (verification wave)
|
|
221
|
+
|
|
222
|
+
Written by the orchestrator after merging all agents in a wave:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# After all Wave N branches merged:
|
|
226
|
+
{full_build_cmd} 2>&1 | tee .claude/logs/build-wave{N}.log
|
|
227
|
+
echo "EXIT=$?" >> .claude/logs/build-wave{N}.log
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
If the build fails, the orchestrator reads the log, identifies which file caused the error,
|
|
231
|
+
traces it back to which agent's merge introduced it, and dispatches a fix agent.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Log Relay — Logs as Context for Fix Agents
|
|
236
|
+
|
|
237
|
+
**This is the key architectural insight: logs are not just records — they are inputs to future agents.**
|
|
238
|
+
|
|
239
|
+
When the orchestrator dispatches a fix agent after a post-merge failure, it constructs the prompt from logs:
|
|
240
|
+
|
|
241
|
+
```markdown
|
|
242
|
+
## Fix Agent — Post-Wave {N} Build Failure
|
|
243
|
+
|
|
244
|
+
### Build Log
|
|
245
|
+
<build-log>
|
|
246
|
+
{contents of .claude/logs/build-wave{N}.log — last 100 lines}
|
|
247
|
+
</build-log>
|
|
248
|
+
|
|
249
|
+
### Agent Verify Logs Summary
|
|
250
|
+
{for each agent in this wave:}
|
|
251
|
+
- M{A}: {PASS/FAIL} — {error count} errors, {warning count} warnings
|
|
252
|
+
{any warnings that look related to the build failure}
|
|
253
|
+
|
|
254
|
+
### Runtime Logs (if any)
|
|
255
|
+
{contents of .claude/logs/runtime-M{X}.log if it exists for this wave}
|
|
256
|
+
|
|
257
|
+
### Diagnosis
|
|
258
|
+
The build error at {file}:{line} was introduced by M{X}'s merge.
|
|
259
|
+
M{X}'s verify log shows: {relevant warning or pass-despite-issue}
|
|
260
|
+
The type mismatch suggests {analysis}.
|
|
261
|
+
|
|
262
|
+
### Your Task
|
|
263
|
+
Fix the errors in the build log. The verify logs and diagnosis above give you
|
|
264
|
+
full context. Do NOT re-investigate — the logs tell the story.
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Rules for log relay:**
|
|
268
|
+
- Include only the RELEVANT portion of each log (last 100 lines of build, relevant warnings from verify)
|
|
269
|
+
- Never relay the full bootstrap.log — it's only useful for debugging install issues
|
|
270
|
+
- Verify logs are small (< 2KB each) — safe to include in full
|
|
271
|
+
- Build logs can be large — tail to last 100 lines
|
|
272
|
+
- Runtime logs can be large — include only the stack trace (grep for "Error:", "panic:", "FATAL")
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## CLAUDE.md Verify Field
|
|
277
|
+
|
|
278
|
+
`/setup` writes this to the project's CLAUDE.md after running toolchain detection:
|
|
279
|
+
|
|
280
|
+
```markdown
|
|
281
|
+
## Verify
|
|
282
|
+
Quick: {Tier 1 command}
|
|
283
|
+
Test: {Tier 2 command}
|
|
284
|
+
Build: {Tier 3 command}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Example for a Rust + Svelte project:
|
|
288
|
+
```markdown
|
|
289
|
+
## Verify
|
|
290
|
+
Quick: cargo check && npx svelte-check
|
|
291
|
+
Test: cargo test && npm test
|
|
292
|
+
Build: cargo build --release && npm run build
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Every agent reads this field. No agent guesses the verify command.
|
|
296
|
+
If the field is missing → agent runs toolchain detection inline (slower but safe).
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Cleanup Protocol
|
|
301
|
+
|
|
302
|
+
Logs accumulate across waves. Clean up after ship:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# After /ship completes successfully:
|
|
306
|
+
mkdir -p .claude/logs/archive
|
|
307
|
+
mv .claude/logs/*.log .claude/logs/*.md .claude/logs/archive/ 2>/dev/null
|
|
308
|
+
echo "Archived $(date -u +%Y-%m-%dT%H:%M:%S)" > .claude/logs/archive/README.md
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**Do NOT delete logs before ship** — they may be needed for fix agents.
|
|
312
|
+
**Do NOT commit logs to git** — add `.claude/logs/` to `.gitignore`.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Integration Points
|
|
317
|
+
|
|
318
|
+
| Component | How it uses toolchain-gate |
|
|
319
|
+
|-----------|--------------------------|
|
|
320
|
+
| `/setup` | Runs detection protocol, writes `Verify:` to CLAUDE.md |
|
|
321
|
+
| `env-scan.sh` | Outputs `toolchain` + `verify_cmd` in JSON |
|
|
322
|
+
| `problem-architect` | Reads `Verify:` field, adds `Verify:` to Team Spec per milestone |
|
|
323
|
+
| `milestone-builder` | Runs Tier 1+2 exit gate, writes verify-log, captures runtime logs |
|
|
324
|
+
| `orchestrator` | Runs bootstrap, runs Tier 3 between waves, relays logs to fix agents |
|
|
325
|
+
| `blueprint` | Includes toolchain check in Wave 0 foundation |
|
|
326
|
+
| `.gitignore` | Must include `.claude/logs/` |
|
|
@@ -160,9 +160,43 @@ echo "source_files=$SRC_COUNT"
|
|
|
160
160
|
```
|
|
161
161
|
If source_files < 10 → greenfield project. Force Wave 1 = all foundation work (schema, config, shared utils, types) as a SINGLE milestone regardless of feature count. Parallel only unlocks from Wave 2 onward, after the foundation exists and greps have real files to scan.
|
|
162
162
|
|
|
163
|
+
**Step 0b: Toolchain check (load `capabilities/shared/toolchain-gate.md`)**
|
|
164
|
+
```bash
|
|
165
|
+
# Check Verify field in CLAUDE.md
|
|
166
|
+
grep -q "^Quick:" CLAUDE.md 2>/dev/null && echo "verify=configured" || echo "verify=missing"
|
|
167
|
+
```
|
|
168
|
+
If `verify=missing` → run toolchain detection protocol from toolchain-gate.md and write `## Verify` to CLAUDE.md.
|
|
169
|
+
If tools are missing → warn in the plan: `"⚠ Toolchain gap: {tool} not installed. Agents cannot run Tier 1 verification. Run: {install command}"`
|
|
170
|
+
|
|
171
|
+
Wave 0 (foundation) MUST include a toolchain bootstrap step:
|
|
172
|
+
```
|
|
173
|
+
## M0: Foundation — Toolchain + Schema + Shared Types
|
|
174
|
+
- Install missing tools and dependencies
|
|
175
|
+
- Run smoke test: {quick_verify_cmd}
|
|
176
|
+
- Create shared types, base schemas, core config
|
|
177
|
+
```
|
|
178
|
+
|
|
163
179
|
**Step 1: List raw work items**
|
|
164
180
|
From the intent/spec, enumerate ALL features, endpoints, models, UI pages, and background jobs as raw items. Do not group yet — just list everything the project needs.
|
|
165
181
|
|
|
182
|
+
**Step 1b: Migration detection (before coupling analysis)**
|
|
183
|
+
For each raw work item, check if it is a **migration or cross-cutting refactor**:
|
|
184
|
+
- Framework/library upgrade (React class→hooks, Svelte 4→5, Vue Options→Composition, Angular versions)
|
|
185
|
+
- Language version bump that changes syntax or stdlib APIs
|
|
186
|
+
- Build tool change (webpack→vite, setuptools→poetry, Maven→Gradle)
|
|
187
|
+
- Store/state management rewrite (Redux→Zustand, Vuex→Pinia, writable→runes)
|
|
188
|
+
- ORM or database driver migration
|
|
189
|
+
- Auth/middleware pattern rewrite
|
|
190
|
+
|
|
191
|
+
**If detected → force SEQUENTIAL-ONLY.** Never split a migration across parallel agents.
|
|
192
|
+
Mark the milestone: `Parallel: no (migration — SEQUENTIAL-ONLY)`.
|
|
193
|
+
If the migration touches 15+ files, recommend sequential sub-milestones:
|
|
194
|
+
```
|
|
195
|
+
Sub-1: {foundation — sets the new pattern} → SEQUENTIAL-ONLY
|
|
196
|
+
Sub-2: {consumers group A — follows pattern} → Depends: Sub-1
|
|
197
|
+
Sub-3: {consumers group B — follows pattern} → Depends: Sub-2
|
|
198
|
+
```
|
|
199
|
+
|
|
166
200
|
**Step 2: Coupling analysis — merge rule**
|
|
167
201
|
For each pair of raw work items, check if they share ANY of:
|
|
168
202
|
- Same database table (both CREATE or ALTER the same table)
|
|
@@ -200,6 +234,14 @@ Wave 2 = milestones that only depend on Wave 1
|
|
|
200
234
|
Wave N = milestones that only depend on waves 1..N-1
|
|
201
235
|
```
|
|
202
236
|
|
|
237
|
+
**Wave 1 contract rule:** Wave 1 sets the types, APIs, schemas, and patterns for all later waves.
|
|
238
|
+
- Wave 1 should be the **smallest, most carefully specified wave**
|
|
239
|
+
- Wave 1 milestones define shared types, base schemas, core configs, foundational patterns
|
|
240
|
+
- Wave 1 agents get 3 fix attempts (not 2) — errors here multiply across every later wave
|
|
241
|
+
- Wave 1 MUST pass full build+test verification before Wave 2 dispatches
|
|
242
|
+
- If Wave 1 introduces a new pattern → document it in `patterns.md` before Wave 2 dispatch
|
|
243
|
+
- **Max agents in Wave 1:** 3 (even if more milestones are ready) — precision over speed
|
|
244
|
+
|
|
203
245
|
**Step 2: Directory-level isolation check (Layer 1a)**
|
|
204
246
|
|
|
205
247
|
For each wave with 2+ milestones:
|
|
@@ -40,6 +40,40 @@ cat <<EOF
|
|
|
40
40
|
"commands_count": $(count_files .claude/commands 2>/dev/null),
|
|
41
41
|
"agents_count": $(count_files .claude/agents 2>/dev/null)
|
|
42
42
|
},
|
|
43
|
+
"toolchain": {
|
|
44
|
+
"node": { "installed": $(command -v node >/dev/null 2>&1 && echo true || echo false), "version": "$(node --version 2>/dev/null || echo null)" },
|
|
45
|
+
"cargo": { "installed": $(command -v cargo >/dev/null 2>&1 && echo true || echo false), "version": "$(cargo --version 2>/dev/null | head -1 || echo null)" },
|
|
46
|
+
"python": { "installed": $(command -v python3 >/dev/null 2>&1 && echo true || echo false), "version": "$(python3 --version 2>/dev/null || echo null)" },
|
|
47
|
+
"go": { "installed": $(command -v go >/dev/null 2>&1 && echo true || echo false), "version": "$(go version 2>/dev/null || echo null)" },
|
|
48
|
+
"dotnet": { "installed": $(command -v dotnet >/dev/null 2>&1 && echo true || echo false), "version": "$(dotnet --version 2>/dev/null || echo null)" },
|
|
49
|
+
"ruby": { "installed": $(command -v ruby >/dev/null 2>&1 && echo true || echo false), "version": "$(ruby --version 2>/dev/null || echo null)" }
|
|
50
|
+
},
|
|
51
|
+
"deps": {
|
|
52
|
+
"node_modules": $(has_dir node_modules),
|
|
53
|
+
"target": $(has_dir target),
|
|
54
|
+
"venv": $([ -d venv ] || [ -d .venv ] && echo true || echo false),
|
|
55
|
+
"vendor": $(has_dir vendor)
|
|
56
|
+
},
|
|
57
|
+
"verify_cmd": "$(
|
|
58
|
+
V=""
|
|
59
|
+
if [ -f Cargo.toml ]; then
|
|
60
|
+
command -v cargo >/dev/null 2>&1 && V="cargo check" || V="# cargo missing"
|
|
61
|
+
fi
|
|
62
|
+
if [ -f package.json ]; then
|
|
63
|
+
if command -v npx >/dev/null 2>&1; then
|
|
64
|
+
grep -q '"typescript"' package.json 2>/dev/null && V="${V:+$V && }npx tsc --noEmit" || V="${V:+$V && }npx eslint src/ || true"
|
|
65
|
+
else
|
|
66
|
+
V="${V:+$V && }# node missing"
|
|
67
|
+
fi
|
|
68
|
+
fi
|
|
69
|
+
if [ -f pyproject.toml ] || [ -f requirements.txt ]; then
|
|
70
|
+
command -v python3 >/dev/null 2>&1 && V="${V:+$V && }python3 -m py_compile" || V="${V:+$V && }# python missing"
|
|
71
|
+
fi
|
|
72
|
+
if [ -f go.mod ]; then
|
|
73
|
+
command -v go >/dev/null 2>&1 && V="${V:+$V && }go vet ./..." || V="${V:+$V && }# go missing"
|
|
74
|
+
fi
|
|
75
|
+
echo "${V:-echo no-stack-detected}"
|
|
76
|
+
)",
|
|
43
77
|
"git_log": "$(git log --oneline -5 2>/dev/null | head -5 | tr '\n' '|' | sed 's/"/\\"/g' || echo 'none')",
|
|
44
78
|
"readme_head": "$(head -10 README.md 2>/dev/null | tr '\n' '|' | sed 's/"/\\"/g' || echo 'none')"
|
|
45
79
|
}
|
|
@@ -404,7 +404,7 @@
|
|
|
404
404
|
if (event.event === 'SubagentStop') { feed.appendChild(createSessionMarker('Subagent Finished')); scrollToBottom(); return; }
|
|
405
405
|
|
|
406
406
|
// Fallback
|
|
407
|
-
|
|
407
|
+
var fallbackCard = createEventCard(event); feed.appendChild(fallbackCard); scrollToBottom();
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
// SSE
|
|
@@ -198,7 +198,7 @@ function handleStatic(req, res) {
|
|
|
198
198
|
|
|
199
199
|
fs.readFile(filePath, (err, data) => {
|
|
200
200
|
if (err) { res.writeHead(404); res.end('Not found'); return; }
|
|
201
|
-
res.writeHead(200, { 'Content-Type': mime });
|
|
201
|
+
res.writeHead(200, { 'Content-Type': mime, 'Cache-Control': 'no-cache, no-store, must-revalidate' });
|
|
202
202
|
res.end(data);
|
|
203
203
|
});
|
|
204
204
|
}
|