azclaude-copilot 0.5.9 → 0.7.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.
@@ -8,8 +8,8 @@
8
8
  "plugins": [
9
9
  {
10
10
  "name": "azclaude",
11
- "description": "AZCLAUDE is a complete AI coding environment for Claude Code. It installs 39 commands, 10 auto-invoked skills, 15 specialized agents, 4 hooks, 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.5.9",
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.0",
13
13
  "source": {
14
14
  "source": "github",
15
15
  "repo": "haytamAroui/AZ-CLAUDE-COPILOT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "azclaude",
3
- "version": "0.5.9",
4
- "description": "AZCLAUDE is a complete AI coding environment for Claude Code. It installs 39 commands, 10 auto-invoked skills, 15 specialized agents, 4 hooks, 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",
3
+ "version": "0.7.0",
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",
7
7
  "url": "https://github.com/haytamAroui"
package/README.md CHANGED
@@ -40,7 +40,7 @@ Repeats the same mistakes. antipatterns.md prevents known failures.
40
40
  Forgets what was decided. decisions.md logs every architecture choice.
41
41
  Loses reasoning mid-session. /snapshot saves WHY — auto-injected next session.
42
42
  Can't work autonomously. /copilot builds, tests, commits, ships — unattended.
43
- Agents run serially, one at a time. Task Classifier + parallel waves run agents simultaneously.
43
+ Agents run serially, one at a time. DAG dispatch + merge-on-complete runs 6 agents simultaneously.
44
44
  ```
45
45
 
46
46
  One install. Any stack. Zero dependencies.
@@ -110,7 +110,7 @@ npx azclaude-copilot@latest
110
110
 
111
111
  One command, no flags. Auto-detects whether this is a fresh install or an upgrade:
112
112
 
113
- - **First time** → full install (39 commands, 4 hooks, 15 agents, 10 skills, memory, reflexes). Creates folders, instructions, and hooks — **no manual setup required.**
113
+ - **First time** → full install (40 commands, 5 hooks, 15 agents, 10 skills, memory, reflexes). Creates folders, instructions, and hooks — **no manual setup required.**
114
114
  - **Already installed, older version** → auto-upgrades everything to latest templates
115
115
  - **Already up to date** → verifies, no overwrites
116
116
 
@@ -123,7 +123,7 @@ npx azclaude-copilot@latest doctor # 32 checks — verify everything is wired
123
123
 
124
124
  ## What You Get
125
125
 
126
- **39 commands** · **10 auto-invoked skills** · **15 agents** · **4 hooks** · **memory across sessions** · **learned reflexes** · **self-evolving environment**
126
+ **40 commands** · **10 auto-invoked skills** · **15 agents** · **5 hooks** · **memory across sessions** · **learned reflexes** · **self-evolving environment**
127
127
 
128
128
  ```
129
129
  .claude/
@@ -272,7 +272,7 @@ Claude Code
272
272
  │ └── stop.js → Session cleanup, friction logging
273
273
 
274
274
  └── Markdown files (capability — Claude reads natively, zero overhead)
275
- ├── 39 commands → Claude reads the .md, follows instructions
275
+ ├── 40 commands → Claude reads the .md, follows instructions
276
276
  ├── 15 agents → Claude spawns as subagents with Task tool
277
277
  ├── 10 skills → Auto-invoked when relevant context detected
278
278
  ├── 48 capabilities → Lazy-loaded via manifest.md (~100 tokens overhead)
@@ -357,19 +357,19 @@ Never writes code Never implements
357
357
 
358
358
  ## Parallel Execution
359
359
 
360
- AZCLAUDE runs multiple Claude Code agents simultaneously — without file corruption or test interference. Each agent works in an isolated git worktree on its own branch.
360
+ AZCLAUDE runs up to 6 Claude Code agents simultaneously using **DAG-based dispatch** each milestone launches the moment its dependencies are satisfied, not when an entire wave completes. Merge-on-complete means finished agents unblock dependents immediately.
361
361
 
362
362
  ```
363
- M1 (schema) → done
364
-
365
- ┌────────────┬────────────┬────────────┬──────────────┐
366
- M2 (auth) M3 (profile) M4 (email) M5 (dashboard) all run simultaneously
367
- └────────────┴────────────┴────────────┴──────────────┘
368
-
369
- M6 (E2E tests)
363
+ M0 (foundation) → done ← auto-detected shared files
364
+
365
+ ┌────────────┬────────────┬────────────┬────────────┬────────────┬──────────────┐
366
+ M1 (auth) M2 (profile) M3 (email) M4 (tests) M5 (NIST) M6 (dashboard)
367
+ └���────┬──────┴────────────┴─────┬──────┴────────────┴────────────┴──────────────┘
368
+ ↓ ← merge-on-complete: M1 done → M7 starts
369
+ M7 (API routes) M8 (integration) immediately, doesn't wait for M2-M6
370
370
  ```
371
371
 
372
- 3 sequential waves instead of 6 sequential milestones. Same output, fraction of the time.
372
+ DAG dispatch instead of sequential waves. Same output, ~50% faster wall clock.
373
373
 
374
374
  ### Real case — ShopFlow e-commerce sprint
375
375
 
@@ -410,13 +410,26 @@ What the classifier caught: M1 and M2 were separate plan milestones but both wro
410
410
 
411
411
  **On tokens:** You will notice the token counts look large. You would spend the same tokens building this sequentially — the work is identical. What changes is wall-clock time. Sequential execution: each agent waits for the previous one to finish → ~2 hours. Parallel waves: agents run simultaneously → ~15 minutes. Same total tokens. Same output. One-eighth the time.
412
412
 
413
- ### Four-layer safety model
413
+ ### v0.6.0: What changed in parallel execution
414
+
415
+ | Before (wave-based) | After (DAG-based) |
416
+ |---------------------|-------------------|
417
+ | Wave 2 waits for ALL of Wave 1 | Each milestone launches when its `Depends:` are satisfied |
418
+ | Max 3 agents at once | Max 6 agents (test-only agents uncapped) |
419
+ | Manual Wave 0 for shared files | Auto-foundation detection extracts shared-file edits |
420
+ | Agents re-read shared files independently | Pre-read injection: shared files read once, injected inline |
421
+ | Agents run full test suite | Scoped tests: each agent runs only its module's tests |
422
+ | Merge after entire wave completes | Merge-on-complete: each branch merges immediately, unblocks dependents |
423
+ | Context loss kills the wave | Wave state file survives compaction, auto-resumes on next session |
424
+
425
+ ### Five-layer safety model
414
426
 
415
427
  Parallel execution is safe only when agents don't write to the same files. The key insight: **Layer 0 makes conflicts impossible by design** before any safety checking begins.
416
428
 
417
429
  | Layer | When | What |
418
430
  |-------|------|------|
419
431
  | **0 — Task Classifier** | `/blueprint`, before milestones exist | Groups coupled work into single milestones. Conflicts become impossible by construction. |
432
+ | **0b — Foundation Detection** | Before dispatch | Auto-detects shared files (models, schemas) → sequential Wave 0 before any parallel agents |
420
433
  | **1 — Directory + import check** | `/blueprint`, post-plan | Fast grep: same dirs? shared utility imports? |
421
434
  | **2 — problem-architect file scan** | Post-plan, per milestone | Returns exact `Files Written:` paths + `Parallel Safe: YES/NO` |
422
435
  | **3 — Orchestrator dispatch gate** | Runtime, final | Overlap check before spawning. Cannot be bypassed. |
@@ -427,12 +440,12 @@ Claude Code's `isolation: "worktree"` in the Task tool is a raw primitive — li
427
440
 
428
441
  | Without AZCLAUDE | With AZCLAUDE |
429
442
  |------------------|---------------|
430
- | Which tasks to parallelize? | **Task Classifier** — groups coupled work, splits independent work |
431
- | Is it safe to parallelize? | **Four-layer safety** — classifier + dir check + file scan + dispatch gate |
432
- | What context does each agent need? | **Problem-Architect** — builds full Team Spec per milestone |
443
+ | Which tasks to parallelize? | **Task Classifier + DAG dispatch** — groups coupled work, launches on dependency satisfaction |
444
+ | Is it safe to parallelize? | **Five-layer safety** — classifier + foundation + dir check + file scan + dispatch gate |
445
+ | What context does each agent need? | **Problem-Architect** — Team Spec + pre-read injection (shared files read once) |
433
446
  | What conventions to follow? | **patterns.md / antipatterns.md** — injected automatically |
434
- | What if one agent fails? | **Blocker recovery + /debate escalation** |
435
- | What happens when the session ends? | **goals.md + checkpoints + plan.md** — resumes exactly |
447
+ | What if one agent fails? | **Blocker recovery + /debate escalation** (other agents continue) |
448
+ | What happens when the session ends? | **DAG state file + checkpoints** — auto-resumes interrupted waves |
436
449
  | How do we improve over time? | **/evolve** — new agents from git evidence every 3 milestones |
437
450
 
438
451
  **Claude Code is the engine. AZCLAUDE is the transmission, the steering, and the GPS — the system that makes those cylinders produce coordinated forward motion instead of random spinning.**
@@ -624,11 +637,11 @@ AZCLAUDE is a lazy-loaded environment of 48 capability modules. It only loads wh
624
637
 
625
638
  ## Verified
626
639
 
627
- 1810 tests. Every template, command, capability, agent, hook, and CLI feature verified.
640
+ 1868 tests. Every template, command, capability, agent, hook, and CLI feature verified.
628
641
 
629
642
  ```bash
630
643
  bash tests/test-features.sh
631
- # Results: 1810 passed, 0 failed, 1810 total
644
+ # Results: 1868 passed, 0 failed, 1868 total
632
645
  ```
633
646
 
634
647
  ---
package/bin/cli.js CHANGED
@@ -8,7 +8,7 @@ const { execSync } = require('child_process');
8
8
 
9
9
  const TEMPLATE_DIR = path.join(__dirname, '..', 'templates');
10
10
  const CORE_COMMANDS = ['setup', 'fix', 'add', 'audit', 'test', 'blueprint', 'ship', 'pulse', 'explain', 'snapshot', 'persist'];
11
- const EXTENDED_COMMANDS = ['dream', 'refactor', 'doc', 'loop', 'migrate', 'deps', 'find', 'create', 'reflect', 'hookify', 'sentinel', 'clarify', 'spec', 'analyze', 'constitute', 'tasks', 'issues', 'driven', 'mcp', 'verify', 'inoculate', 'ghost-test'];
11
+ const EXTENDED_COMMANDS = ['dream', 'refactor', 'doc', 'loop', 'migrate', 'deps', 'find', 'create', 'reflect', 'hookify', 'sentinel', 'clarify', 'spec', 'analyze', 'constitute', 'tasks', 'issues', 'driven', 'mcp', 'verify', 'inoculate', 'ghost-test', 'visualize'];
12
12
  const ADVANCED_COMMANDS = ['evolve', 'debate', 'level-up', 'copilot', 'reflexes', 'parallel'];
13
13
  const COMMANDS = [...CORE_COMMANDS, ...EXTENDED_COMMANDS, ...ADVANCED_COMMANDS];
14
14
 
@@ -118,7 +118,7 @@ function substitutePaths(content, cfg) {
118
118
 
119
119
  // ─── Hook Scripts ─────────────────────────────────────────────────────────────
120
120
 
121
- const HOOK_SCRIPTS = ['user-prompt.js', 'stop.js', 'post-tool-use.js', 'pre-tool-use.js'];
121
+ const HOOK_SCRIPTS = ['user-prompt.js', 'stop.js', 'post-tool-use.js', 'pre-tool-use.js', 'visualizer-hook.js'];
122
122
 
123
123
  function copyHookScripts(dstDir) {
124
124
  fs.mkdirSync(dstDir, { recursive: true });
@@ -140,11 +140,15 @@ function buildHookEntries(scriptsDir) {
140
140
  const stopScript = path.join(scriptsDir, 'stop.js');
141
141
  const postToolUseScript = path.join(scriptsDir, 'post-tool-use.js');
142
142
  const preToolUseScript = path.join(scriptsDir, 'pre-tool-use.js');
143
+ const vizScript = path.join(scriptsDir, 'visualizer-hook.js');
143
144
  return {
144
145
  UserPromptSubmit: [{ matcher: '', hooks: [{ type: 'command', command: `"${nodeExe}" "${userPromptScript}"` }] }],
145
146
  Stop: [{ matcher: '', hooks: [{ type: 'command', command: `"${nodeExe}" "${stopScript}"` }] }],
146
147
  PreToolUse: [{ matcher: 'Write|Edit|MultiEdit', hooks: [{ type: 'command', command: `"${nodeExe}" "${preToolUseScript}"` }] }],
147
148
  PostToolUse: [{ matcher: 'Write|Edit|Read|Bash|Grep', hooks: [{ type: 'command', command: `"${nodeExe}" "${postToolUseScript}"` }] }],
149
+ Notification: [{ matcher: '', hooks: [{ type: 'command', command: `"${nodeExe}" "${vizScript}"` }] }],
150
+ SubagentStart: [{ matcher: '', hooks: [{ type: 'command', command: `"${nodeExe}" "${vizScript}"` }] }],
151
+ SubagentStop: [{ matcher: '', hooks: [{ type: 'command', command: `"${nodeExe}" "${vizScript}"` }] }],
148
152
  };
149
153
  }
150
154
 
@@ -441,6 +445,23 @@ function installScripts(projectDir, cfg) {
441
445
  ok(`Scripts installed/updated (${cfg}/scripts/)`);
442
446
  }
443
447
 
448
+ // ─── Visualizer (real-time pipeline dashboard) ──────────────────────────────
449
+
450
+ function installVisualizer(projectDir, cfg) {
451
+ const src = path.join(TEMPLATE_DIR, 'visualizer');
452
+ if (!fs.existsSync(src)) return;
453
+ const dst = path.join(projectDir, cfg, 'visualizer');
454
+ if (fs.existsSync(dst)) {
455
+ // Refresh files
456
+ copyDir(src, dst);
457
+ info('Visualizer files refreshed');
458
+ return;
459
+ }
460
+ fs.mkdirSync(dst, { recursive: true });
461
+ copyDir(src, dst);
462
+ ok(`Visualizer installed (${cfg}/visualizer/) — start with: AZCLAUDE_VISUALIZER=8765 node ${cfg}/visualizer/server.js`);
463
+ }
464
+
444
465
  // ─── Statusline (auto-updating cost/context bar) ─────────────────────────────
445
466
 
446
467
  function installStatusline(projectDir, cfg) {
@@ -1116,6 +1137,42 @@ function copyDir(src, dst) {
1116
1137
  if (process.argv[2] === 'doctor' && process.argv[3] === '--audit') { runAudit(); process.exit(0); }
1117
1138
  if (process.argv[2] === 'doctor') { runDoctor(); process.exit(0); }
1118
1139
  if (process.argv[2] === 'demo') { runDemo(); process.exit(0); }
1140
+ if (process.argv[2] === 'visualize') {
1141
+ const action = process.argv[3] || 'start';
1142
+ const detectedCli = detectCLI();
1143
+ const vizCfg = detectedCli.cfg;
1144
+ const serverPath = path.join(process.cwd(), vizCfg, 'visualizer', 'server.js');
1145
+ if (!fs.existsSync(serverPath)) {
1146
+ console.error('Visualizer not installed. Run: npx azclaude-copilot');
1147
+ process.exit(1);
1148
+ }
1149
+ if (action === 'stop') {
1150
+ const pidFile = path.join(os.tmpdir(), '.azclaude-visualizer.pid');
1151
+ if (fs.existsSync(pidFile)) {
1152
+ const pid = parseInt(fs.readFileSync(pidFile, 'utf8'), 10);
1153
+ try { process.kill(pid); } catch (_) {}
1154
+ try { fs.unlinkSync(pidFile); } catch (_) {}
1155
+ ok('Visualizer stopped');
1156
+ } else {
1157
+ info('No running visualizer found');
1158
+ }
1159
+ } else {
1160
+ const port = process.argv[4] || '8765';
1161
+ const { spawn } = require('child_process');
1162
+ const child = spawn(process.execPath, [serverPath], {
1163
+ detached: true, stdio: 'ignore',
1164
+ env: Object.assign({}, process.env, { AZCLAUDE_VISUALIZER: port })
1165
+ });
1166
+ child.unref();
1167
+ const pidFile = path.join(os.tmpdir(), '.azclaude-visualizer.pid');
1168
+ fs.writeFileSync(pidFile, String(child.pid));
1169
+ ok(`Visualizer started on port ${port} (PID: ${child.pid})`);
1170
+ info(`Open: http://localhost:${port}`);
1171
+ info(`Set env: AZCLAUDE_VISUALIZER=${port}`);
1172
+ }
1173
+ process.exit(0);
1174
+ }
1175
+
1119
1176
  if (process.argv[2] === 'copilot') {
1120
1177
  // Delegate to copilot runner
1121
1178
  const copilotScript = path.join(__dirname, 'copilot.js');
@@ -1182,6 +1239,7 @@ installCapabilities(projectDir, cli.cfg, fullInstall);
1182
1239
  installCommands(projectDir, cli.cfg);
1183
1240
  installSkills(projectDir, cli.cfg);
1184
1241
  installScripts(projectDir, cli.cfg);
1242
+ installVisualizer(projectDir, cli.cfg);
1185
1243
  installStatusline(projectDir, cli.cfg);
1186
1244
  installAgents(projectDir, cli.cfg);
1187
1245
  installRulesFile(projectDir, cli.cfg, cli.rulesFile);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "azclaude-copilot",
3
- "version": "0.5.9",
4
- "description": "AI coding environment — 39 commands, 10 skills, 15 agents, memory, reflexes, evolution. Install: npx azclaude-copilot@latest, then open Claude Code.",
3
+ "version": "0.7.0",
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",
7
7
  "azclaude-copilot": "bin/copilot.js"
@@ -55,23 +55,51 @@ Follow the Resume Protocol from `capabilities/shared/parallel-coordination.md`:
55
55
 
56
56
  ---
57
57
 
58
- ### Step 2: Select Next Milestone Wave
58
+ ### Step 2: Select Next Milestones (DAG Dispatch)
59
+
60
+ **DAG readiness check** — a milestone is **ready** when:
61
+ 1. `status = pending` in plan.md
62
+ 2. ALL milestones listed in its `Depends:` field have `status = done`
63
+
64
+ That's it. Ignore `Wave:` fields for dispatch decisions — they are informational (for visualization and estimation only). The dependency graph is the truth.
59
65
 
60
- **If plan.md has `Wave:` fields** (blueprint wrote them — read directly):
61
66
  ```bash
62
- grep "Wave:" .claude/plan.md
67
+ # Find all ready milestones
68
+ grep -B2 "Status: pending" .claude/plan.md | grep "^## M"
69
+ # For each, check its Depends: are all done
70
+ ```
71
+
72
+ **Step 2a: Foundation Detection (auto-Wave 0)**
73
+
74
+ Before dispatching any parallel agents, scan ALL ready milestones' Team Specs for shared files:
75
+
63
76
  ```
64
- Find the lowest wave number where all milestones have `status = pending` and all `Depends:` are `done`.
65
- This is the next wave to dispatch.
77
+ For each pair (A, B) in ready milestones:
78
+ shared_files = Files Written(A) Files Written(B)
79
+ If shared_files is not empty:
80
+ → Extract shared file edits into a FOUNDATION milestone
81
+ → Dispatch foundation sequentially FIRST
82
+ → Remove shared-file edits from A and B's scope
83
+ → Re-check readiness after foundation completes
84
+ ```
85
+
86
+ If no shared files → skip foundation, go directly to parallel dispatch.
87
+
88
+ **Step 2b: Parallel safety check**
66
89
 
67
- **If plan.md has NO `Wave:` fields** (older plan formatcompute from scratch):
68
- Find milestones where `status = pending` AND all dependencies have `status = done`.
90
+ From the ready set (after foundation), verify `Files Written` from problem-architect for each pair don't overlap. `Files Written` is more precise than `Files:` use it.
91
+ If any two candidates share a written file dispatch the conflicting one sequentially after the other.
69
92
 
70
- **Parallel candidates:** milestones in the same wave with `Parallel: yes` (or computed as independent).
93
+ **Step 2c: Classify milestones**
71
94
 
72
- **REQUIRED parallel safety check:** Even if `Parallel: yes`, verify `Files Written` from problem-architect
73
- for each candidate don't overlap. `Files Written` is more precise than `Files:` — use it.
74
- If any two candidates share a written file dispatch sequentially. Silent file corruption otherwise.
95
+ | Type | Definition | Dispatch rule |
96
+ |------|-----------|---------------|
97
+ | Foundation | Touches files needed by 2+ milestones | Sequential, before all others |
98
+ | Test-only | Creates new test files, never writes production code | Safe alongside ANY milestone |
99
+ | Standard | Writes to unique files | Parallel with worktree isolation |
100
+
101
+ **Max parallel agents:** 6 (default). Override with `max_parallel` in plan.md frontmatter.
102
+ If ready milestones exceed max_parallel → dispatch highest-priority first, queue the rest.
75
103
 
76
104
  - All done → SHIP
77
105
  - All remaining blocked → BLOCKER RECOVERY
@@ -123,16 +151,19 @@ If verdict is `APPROVED` or `APPROVED (no constitution found)`: proceed to Step
123
151
 
124
152
  ### Step 4: Dispatch Milestone Builder(s)
125
153
 
126
- **Parallel dispatch (2+ milestones in wave with disjoint Files Written):**
154
+ **Parallel dispatch (2+ ready milestones with disjoint Files Written):**
127
155
 
128
156
  Load `capabilities/shared/parallel-coordination.md` first.
129
157
  Load `capabilities/shared/context-inoculation.md` and prepend its Required Preamble to every agent prompt below.
130
158
 
131
- 1. Write `.claude/ownership.md` table (branch, directories, status) for every agent in this wave
132
- 2. Spawn each builder via Task with `isolation: "worktree"` in the same message (true parallel)
133
- 3. Include worktree rules in every parallel prompt (see parallel-coordination.md Step 3)
134
- 4. Wait for ALL agents in the wave before merging
135
- 5. Merge branches sequentially (simplest milestone first) following the Merge Protocol
159
+ 1. Write `.claude/ownership.md` table (branch, directories, status) for every agent in this batch
160
+ 2. Write `.claude/parallel-wave-state.md` with `dispatch_mode: dag` (see parallel-coordination.md)
161
+ 3. **Pre-read shared files** (models, schemas, configs referenced by 2+ agents) and inject their content inline into each agent's prompt eliminates redundant file reads across agents
162
+ 4. Spawn each builder via Task with `isolation: "worktree"` in the same message (true parallel)
163
+ 5. Include worktree rules + **test scope** (`Test scope: {test-dir}`) in every parallel prompt
164
+ 6. **Merge-on-complete**: as each agent reports done, merge its branch immediately (don't wait for all)
165
+ 7. After each merge: check if newly-unblocked milestones exist → dispatch them immediately
166
+ 8. If `max_parallel <= 3` or merge conflicts detected: fall back to batch-merge (wait for all, then merge)
136
167
 
137
168
  **Sequential dispatch (single milestone OR overlapping files):**
138
169
 
@@ -173,13 +204,18 @@ Dependent milestones, overlapping `Files Written`, or `Parallel Safe: NO` → sp
173
204
 
174
205
  ---
175
206
 
176
- ### Step 5: Monitor Results
207
+ ### Step 5: Monitor Results + Merge-on-Complete
208
+
209
+ **When an agent reports PASS (parallel mode):**
210
+ 1. Merge its branch to main immediately: `git merge parallel/{slug} --no-ff`
211
+ 2. Run tests for the merged module: `{test command} tests/{agent-scope}/ 2>&1 | tail -10`
212
+ 3. If tests pass → update plan.md status → `done`, update `.claude/parallel-wave-state.md`
213
+ 4. **Check DAG for newly-unblocked milestones** — any milestone whose `Depends:` are now ALL `done` becomes ready. Dispatch it immediately (back to Step 3 → Step 4).
214
+ 5. New pattern emerged? → append to patterns.md
177
215
 
178
- **PASS:**
216
+ **When an agent reports PASS (sequential mode):**
179
217
  - Approve commit
180
218
  - Update plan.md status → `done`
181
- - New pattern emerged? → append to patterns.md
182
- - Compromise made? → append to antipatterns.md
183
219
 
184
220
  **FAIL — attempt 1:**
185
221
  - Read exact error
@@ -190,6 +226,11 @@ Dependent milestones, overlapping `Files Written`, or `Parallel Safe: NO` → sp
190
226
  - Log to blockers.md with full context
191
227
  - Set plan.md status → `blocked`
192
228
  - Move to next milestone
229
+ - In parallel mode: do NOT block other agents — continue merging completed branches
230
+
231
+ **Merge conflict during merge-on-complete:**
232
+ - Read both versions, apply correct merge (keep both feature additions)
233
+ - If unresolvable: fall back to batch-merge for remaining agents in this dispatch
193
234
 
194
235
  ---
195
236
 
@@ -40,26 +40,35 @@ Rules:
40
40
 
41
41
  ---
42
42
 
43
- ## Dispatch Protocol (Orchestrator)
43
+ ## Dispatch Protocol (DAG-Based)
44
44
 
45
- ### Step 1: Confirm Parallel Safety
45
+ ### Step 1: Build Dependency Graph + Confirm Parallel Safety
46
46
 
47
- Before spawning any parallel agents for a wave, verify from problem-architect Team Specs:
47
+ Parse `plan.md` into a DAG. A milestone is **ready** when all its `Depends:` have `status = done`.
48
+
49
+ Before spawning any parallel agents, verify from problem-architect Team Specs:
48
50
 
49
51
  ```
50
- For each pair (A, B) in the wave:
52
+ For each pair (A, B) in ready milestones:
51
53
  - Files Written(A) ∩ Files Written(B) = empty set? → safe
52
54
  - Parent directories of A and B do not overlap? → safe
53
55
  - No shared schema/config files (prisma.schema, package.json, tsconfig)? → safe
54
56
  - No runtime dependency (A's output is B's input)? → safe
55
57
 
56
- If any check fails → remove the conflicting milestone from the wave, dispatch sequentially
58
+ If any check fails → remove the conflicting milestone from parallel batch, dispatch sequentially after
57
59
  ```
58
60
 
59
61
  ### Step 2: Write Ownership Map
60
62
 
61
63
  Write `.claude/ownership.md` before spawning any agents.
62
64
 
65
+ ### Step 2b: Foundation Detection (Auto-Wave 0)
66
+
67
+ Scan all ready milestones for shared-file bottlenecks:
68
+ - If 2+ milestones need to write the same file → extract those changes into a foundation milestone
69
+ - Dispatch foundation sequentially FIRST, before any parallel agents
70
+ - After foundation completes: re-check readiness (more milestones may now be ready)
71
+
63
72
  ### Step 3: Dispatch with Worktree Isolation
64
73
 
65
74
  Spawn each agent via Task with `isolation: "worktree"`:
@@ -69,9 +78,13 @@ Task: Implement Milestone {N} — {title}
69
78
 
70
79
  [worktree mode]
71
80
  Branch: parallel/{milestone-slug}
81
+ Test scope: {test-dir} — run ONLY these tests, not the full suite
72
82
  Do NOT push to origin. Commit locally only.
73
83
  Report branch name in completion message.
74
84
 
85
+ ## Pre-loaded Context (do NOT re-read these files)
86
+ {orchestrator pre-reads shared files and injects content here}
87
+
75
88
  {standard milestone context from orchestrator Step 4}
76
89
  ```
77
90
 
@@ -79,50 +92,74 @@ Include in every parallel dispatch:
79
92
  ```
80
93
  Worktree rules:
81
94
  - You are in an isolated git worktree on branch: parallel/{slug}
82
- - Run all tests they test YOUR changes in isolation only
95
+ - Run ONLY tests in your Test scope not the full suite
83
96
  - If you see errors in files outside your owned directories: STOP, report to orchestrator
84
97
  - Do NOT run git push — commit locally only
85
98
  - Your completion message MUST include: "Branch: parallel/{slug}" for merge tracking
86
99
  ```
87
100
 
88
- ### Step 4: Wait for All Agents in the Wave
101
+ **Max parallel agents:** 6 (default). Test-only milestones do NOT count toward the limit.
102
+
103
+ ### Step 4: Merge-on-Complete (Default) or Batch-Merge (Fallback)
104
+
105
+ **Merge-on-complete (default when max_parallel > 3):**
106
+ As each agent reports `COMPLETE`, merge immediately:
107
+ 1. `git checkout main && git merge parallel/{slug} --no-ff -m "merge: M{N} {title} [dag]"`
108
+ 2. Run scoped tests: `{test command} tests/{scope}/ 2>&1 | tail -10`
109
+ 3. Update plan.md status → `done`, update DAG state file
110
+ 4. **Check DAG for newly-unblocked milestones** → dispatch them immediately (back to Step 1)
111
+ 5. Clean up branch: `git branch -d parallel/{slug}`
112
+
113
+ **Batch-merge fallback (max_parallel <= 3 OR merge conflict detected):**
114
+ Wait for ALL dispatched agents to complete, then merge sequentially (simplest first).
89
115
 
90
- Do NOT start the merge until ALL parallel agents in this wave have reported:
91
- - `COMPLETE` proceed with merge
92
- - `FAILED` merge all completed branches first, then handle the failure as a blocked milestone
116
+ When agent reports `FAILED`:
117
+ - Do NOT block other agents — continue merging completed branches
118
+ - Log failure to blockers.md, set plan.md status `blocked`
93
119
 
94
120
  ---
95
121
 
96
122
  ## Merge Protocol (Orchestrator)
97
123
 
98
- After all parallel agents report done, merge sequentially:
124
+ Two modes, selected automatically based on `max_parallel` and conflict state:
125
+
126
+ ### Mode A: Merge-on-Complete (default, max_parallel > 3)
127
+
128
+ Each agent's branch is merged as soon as it completes — no waiting for others:
99
129
 
100
130
  ```bash
101
- # Step 1: Return to main branch
102
- git checkout main # or master / development
131
+ # Agent M3 reports COMPLETE:
132
+ git checkout main
133
+ git merge parallel/m3-auth --no-ff -m "merge: M3 auth endpoints [dag]"
134
+ {test command} tests/auth/ 2>&1 | tail -10 # scoped test only
135
+ git branch -d parallel/m3-auth
136
+
137
+ # Check DAG: M5 depends on M3 → M5 is now ready → dispatch M5 immediately
138
+ # Meanwhile M4 is still running in its worktree — no interference
139
+ ```
103
140
 
104
- # Step 2: Merge each branch in completion order
105
- git merge parallel/m3-auth --no-ff -m "merge: M3 auth endpoints [parallel wave N]"
106
- git merge parallel/m4-profile --no-ff -m "merge: M4 user profile [parallel wave N]"
141
+ **After all agents in batch complete:** run full test suite once on merged main.
142
+ If full suite passes `git push origin main`.
107
143
 
108
- # Step 3: If merge conflict on step N:
109
- # - Identify which files conflict
110
- # - Read both versions
111
- # - Apply the correct merge (usually: keep both feature additions, not one-or-other)
112
- # - Mark conflict resolved, continue with remaining branches
144
+ ### Mode B: Batch-Merge (fallback, max_parallel <= 3 or conflict detected)
113
145
 
114
- # Step 4: Run full test suite on merged main
115
- npm test 2>&1 | tail -20
146
+ Wait for ALL dispatched agents, then merge sequentially:
116
147
 
117
- # Step 5: If tests pass → push
148
+ ```bash
149
+ git checkout main
150
+ git merge parallel/m3-auth --no-ff -m "merge: M3 auth endpoints [dag]"
151
+ git merge parallel/m4-profile --no-ff -m "merge: M4 user profile [dag]"
152
+ {test command} 2>&1 | tail -20 # full suite after all merges
118
153
  git push origin main
119
-
120
- # Step 6: Clean up worktree branches
121
- git branch -d parallel/m3-auth parallel/m4-profile parallel/m5-email
154
+ git branch -d parallel/m3-auth parallel/m4-profile
122
155
  ```
123
156
 
124
- **Merge order matters**: merge the branch with the fewest cross-dependencies first.
125
- When uncertain: sort by `Estimated Complexity` ascending (simpler merges first).
157
+ ### Merge Rules (both modes)
158
+
159
+ - **Merge order**: simplest milestone first (sort by `Estimated Complexity` ascending)
160
+ - **If merge conflict**: read both versions, apply correct merge (keep both feature additions)
161
+ - **If conflict is unresolvable**: switch from Mode A to Mode B for remaining branches
162
+ - **If tests fail after merge**: identify which merge broke it → revert that branch → add to blocked
126
163
 
127
164
  ---
128
165
 
@@ -134,7 +171,7 @@ These rules are injected by orchestrator into every parallel milestone-builder p
134
171
 
135
172
  2. **Never push** — commit locally on your worktree branch. Do not run `git push`.
136
173
 
137
- 3. **Test in isolation** — your test run should only test what you changed. If the test suite has cross-cutting failures, filter to your files: `pytest tests/auth/ -v` not `pytest .`
174
+ 3. **Test in isolation** — run ONLY the tests in your `Test scope` (injected by orchestrator). Example: `pytest tests/auth/ -v` not `pytest .`. Cross-cutting failures are expected from other agents' work.
138
175
 
139
176
  4. **Errors outside your files = not your problem** — if you see compilation errors or test failures in files you didn't modify, that's a parallel agent's in-progress state. Report to orchestrator: "Test failures in {file} — outside my scope, may be parallel agent interference."
140
177
 
@@ -240,17 +277,18 @@ During parallel execution, the orchestrator writes `.claude/parallel-wave-state.
240
277
 
241
278
  ```markdown
242
279
  ---
243
- wave: {N}
280
+ dispatch_mode: dag
244
281
  started: {ISO timestamp}
245
282
  status: in-flight
283
+ max_parallel: 6
246
284
  milestones: [M3, M4, M5]
247
285
  ---
248
286
 
249
- | Milestone | Branch | Status | Commit | Notes |
250
- |-----------|--------|--------|--------|-------|
251
- | M3 — Auth endpoints | parallel/m3-auth | running | — | P1 slot |
252
- | M4 — User profile | parallel/m4-profile | done | a1b2c3d | merged to worktree |
253
- | M5 — Email service | parallel/m5-email | failed | — | timeout on test suite |
287
+ | Milestone | Branch | Status | Commit | Depends | Unblocks |
288
+ |-----------|--------|--------|--------|---------|----------|
289
+ | M3 — Auth endpoints | parallel/m3-auth | running | — | [M0] | [M5, M6] |
290
+ | M4 — User profile | parallel/m4-profile | done | a1b2c3d | [M0] | [] |
291
+ | M5 — Email service | parallel/m5-email | failed | — | [M3] | [M7] |
254
292
  ```
255
293
 
256
294
  ### Lifecycle
@@ -229,7 +229,7 @@ runs after plan.md is written and handles the cases Layer 1 misses.
229
229
  - Dirs: top-level directories this milestone exclusively owns
230
230
  - Parallel: yes — safe at directory level + no shared utility writes
231
231
  - Parallel: no — touches shared config, shared utility, schema, or depends on sibling
232
- - Wave: {N}
232
+ - Wave: {N} (informational — orchestrator uses Depends: for dispatch, not Wave:)
233
233
  ```
234
234
 
235
235
  A well-designed plan for a 6-feature product: