azclaude-copilot 0.4.13 → 0.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +92 -20
  2. package/bin/cli.js +28 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -12,9 +12,10 @@
12
12
  <a href="#the-core-idea">Core Idea</a> ·
13
13
  <a href="#zero-setup-grows-with-your-project">Zero Setup</a> ·
14
14
  <a href="#what-you-get">What You Get</a> ·
15
+ <a href="#spec-driven-workflow">Spec-Driven</a> ·
15
16
  <a href="#memory-system">Memory</a> ·
16
17
  <a href="#self-improving-loop">Self-Improving Loop</a> ·
17
- <a href="#all-27-commands">Commands</a> ·
18
+ <a href="#all-33-commands">Commands</a> ·
18
19
  <a href="#autonomous-mode">Autonomous Mode</a> ·
19
20
  <a href="DOCS.md">Full Docs</a>
20
21
  </p>
@@ -41,6 +42,9 @@ Loses reasoning mid-session. /snapshot saves WHY — auto-injected next
41
42
  CLAUDE.md drifts from reality. /reflect finds stale rules and fixes them.
42
43
  Builds the same agent repeatedly. patterns.md encodes what worked.
43
44
  Can't work autonomously. /copilot builds, tests, commits, ships — unattended.
45
+ Plans without requirements. /spec writes structured specs before any code is planned.
46
+ Milestones violate project rules. constitution-guard blocks non-compliant milestones.
47
+ Plan drifts from what was built. /analyze catches ghost milestones before they ship.
44
48
  ```
45
49
 
46
50
  One install. Any stack. Zero dependencies.
@@ -118,7 +122,7 @@ npm install -g azclaude-copilot@latest
118
122
  azclaude-copilot setup --full
119
123
  ```
120
124
 
121
- That's it. Your project now has AZCLAUDE in `.claude/` — 27 commands, 4 hooks, memory, reflexes, agents, and skills.
125
+ That's it. Your project now has AZCLAUDE in `.claude/` — 33 commands, 4 hooks, memory, reflexes, agents, and skills.
122
126
 
123
127
  ```bash
124
128
  azclaude-copilot doctor # 32 checks — verify everything is wired correctly
@@ -128,14 +132,14 @@ azclaude-copilot doctor # 32 checks — verify everything is wired correctly
128
132
 
129
133
  ## What You Get
130
134
 
131
- **27 commands** · **8 auto-invoked skills** · **13 agents** · **4 hooks** · **memory across sessions** · **learned reflexes** · **self-evolving environment**
135
+ **33 commands** · **8 auto-invoked skills** · **15 agents** · **4 hooks** · **memory across sessions** · **learned reflexes** · **self-evolving environment**
132
136
 
133
137
  ```
134
138
  .claude/
135
139
  ├── CLAUDE.md ← dispatch table: conventions, stack, routing
136
- ├── commands/ ← 27 slash commands (/add, /fix, /copilot, /sentinel...)
140
+ ├── commands/ ← 33 slash commands (/add, /fix, /copilot, /spec, /sentinel...)
137
141
  ├── skills/ ← 8 skills (test-first, security, architecture-advisor...)
138
- ├── agents/ ← 13 agents (orchestrator, code-reviewer, security-auditor...)
142
+ ├── agents/ ← 15 agents (orchestrator, spec-reviewer, constitution-guard...)
139
143
  ├── capabilities/ ← 37 files, lazy-loaded via manifest.md (~380 tokens/task)
140
144
  ├── hooks/
141
145
  │ ├── user-prompt.js ← injects goals.md + checkpoint before your first message
@@ -189,6 +193,56 @@ Phase 4: Quality gate — won't say "ready" without passing all checks
189
193
 
190
194
  If your domain is compliance, finance, or medical — it generates a domain-specific advisor skill with decision matrices, thresholds, and anti-patterns automatically.
191
195
 
196
+ ### 4. Spec-Driven Workflow — build what you actually meant to build
197
+
198
+ The biggest cause of wasted work: building the wrong thing correctly. `/dream` gives you an environment. The spec-driven workflow ensures you build what the environment is *for*.
199
+
200
+ ```
201
+ /constitute — define ground rules before any planning
202
+ Non-negotiables, required patterns, definition of done.
203
+ Copilot checks this before every milestone. Violations are blocked, not ignored.
204
+
205
+ /spec — write a structured spec before /blueprint
206
+ User stories, acceptance criteria (3+), out-of-scope, failure modes.
207
+ spec-reviewer (haiku) validates quality — if incomplete, /blueprint is blocked.
208
+
209
+ /clarify — resolve open questions in a spec
210
+ Structured interrogation (max 5 questions). Writes answers back into the spec.
211
+
212
+ /blueprint — derive a milestone plan from the spec
213
+ Each milestone traces to an acceptance criterion.
214
+ spec-reviewer gates quality before planning starts.
215
+
216
+ /analyze — cross-artifact consistency check
217
+ Detects ghost milestones (marked done, files missing),
218
+ spec vs. implementation drift, plan vs. reality gaps.
219
+ Runs automatically in /ship and /audit.
220
+
221
+ /tasks — build a dependency graph from plan.md
222
+ Shows parallelizable wave groups and critical path length.
223
+ Tells orchestrator which milestones can run simultaneously.
224
+
225
+ /issues — convert plan.md milestones to GitHub Issues
226
+ Creates labels (azclaude, copilot-milestone), deduplicates,
227
+ writes issue numbers back to plan.md for traceability.
228
+ ```
229
+
230
+ **The full sequence:**
231
+ ```
232
+ /constitute → /spec → /clarify → /blueprint → /copilot → /analyze → /ship
233
+ ```
234
+
235
+ **What the gates actually prevent:**
236
+
237
+ | Without spec-driven | With spec-driven |
238
+ |---------------------|-----------------|
239
+ | Plan milestones that don't trace to requirements | spec-reviewer blocks /blueprint if ACs < 3 or goal unclear |
240
+ | Copilot builds things that violate project rules | constitution-guard blocks each milestone before dispatch |
241
+ | Ship code where plan.md says "done" but files are missing | /analyze catches ghost milestones; /ship blocks on them |
242
+ | Open questions resolved arbitrarily in implementation | /clarify forces answers before planning starts |
243
+
244
+ ---
245
+
192
246
  ### 3. `/copilot` — walk away, come back to a product
193
247
 
194
248
  ```bash
@@ -551,12 +605,13 @@ Build step fails →
551
605
  Never fail silently.
552
606
  ```
553
607
 
554
- **Copilot pipeline:**
608
+ **Copilot pipeline (with spec-driven workflow):**
555
609
  ```
556
- Session 1: /dream → /blueprint (architect annotates milestones) M1, M2, M3 → /snapshot
557
- Session 2: /evolve (new agents unblock plan)M4+M5 parallel M6 → /snapshot
610
+ Session 0: /constitute → /spec /clarify/blueprint (spec-reviewed, constitution-checked)
611
+ Session 1: /copilot constitution-guard validates each milestone M1, M2, M3 → /snapshot
612
+ Session 2: /evolve → M4+M5 parallel → M6 → /analyze (ghost check) → /snapshot
558
613
  Session 3: /evolve → M7, M8, M9 → /snapshot
559
- Session 4: /evolve → /audit → /ship → COPILOT_COMPLETE
614
+ Session 4: /evolve → /analyze → /audit → /ship → COPILOT_COMPLETE
560
615
  ```
561
616
 
562
617
  **Every 3 milestones:** `/reflexes analyze` + `/evolve` + orchestrator re-evaluates blocked milestones.
@@ -571,7 +626,7 @@ Session 4: /evolve → /audit → /ship → COPILOT_COMPLETE
571
626
 
572
627
  ---
573
628
 
574
- ## All 27 Commands
629
+ ## All 33 Commands
575
630
 
576
631
  ### Build and Ship
577
632
 
@@ -582,21 +637,32 @@ Session 4: /evolve → /audit → /ship → COPILOT_COMPLETE
582
637
  | `/setup` | Analyze existing project. Detect domain + stack + scale. Build environment. |
583
638
  | `/add` | Add a feature. Pre-analyzes scope via intelligent-dispatch before touching code. |
584
639
  | `/fix` | REPRODUCE → INVESTIGATE → HYPOTHESIZE → FIX. Show passing tests. Never guesses. |
585
- | `/audit` | Spec-first code review (read-only). Injects decisions.md + patterns.md as checklist. |
640
+ | `/audit` | Spec-first code review (read-only). Ghost milestone check + decisions.md + patterns.md. |
586
641
  | `/test` | IDE diagnostics, framework detection, exit-code gate, failure classification. |
587
- | `/blueprint` | Read-only analysis → structured plan.md. Architect annotates each milestone in copilot mode. |
588
- | `/ship` | Risk scan → tests → secrets scan → commit → push. Auto-deploys in copilot mode. |
589
- | `/refactor` | Safe restructuring. Tests before + after. Worktree isolation for high-risk changes. |
642
+ | `/blueprint` | Read-only analysis → structured plan.md. spec-reviewer gates quality before planning. |
643
+ | `/ship` | Ghost check → risk scan → tests → secrets scan → commit → push. Auto-deploys in copilot mode. |
644
+ | `/refactor` | Safe restructuring. Constitution pre-flight. Tests before + after. Worktree for high-risk. |
590
645
  | `/doc` | Generate docs from code. Matches existing style. |
591
646
  | `/migrate` | Upgrade deps/frameworks. Researches breaking changes. Worktree for major versions. |
592
647
  | `/deps` | Audit: outdated, vulnerable, unused packages. |
593
648
 
649
+ ### Spec-Driven Development
650
+
651
+ | Command | What it does |
652
+ |---------|-------------|
653
+ | `/constitute` | Define project ground rules before any planning. Non-negotiables, required patterns, definition of done. Copilot enforces on every milestone. |
654
+ | `/spec` | Write a structured spec: goal, user stories (≥2), acceptance criteria (≥3), out-of-scope, failure modes. spec-reviewer validates before /blueprint. |
655
+ | `/clarify` | Structured interrogation loop (max 5 questions). Resolves open questions in a spec file. Required before /blueprint if any questions remain open. |
656
+ | `/analyze` | Cross-artifact consistency check. Finds ghost milestones (marked done, files missing), spec vs. code drift, plan vs. reality gaps. Read-only. |
657
+ | `/tasks` | Build dependency graph from plan.md. Shows parallelizable wave groups and critical path. Tells orchestrator which milestones can run simultaneously. |
658
+ | `/issues` | Convert plan.md milestones to GitHub Issues. Deduplicates, creates labels, writes issue numbers back to plan.md for traceability. |
659
+
594
660
  ### Think and Improve
595
661
 
596
662
  | Command | What it does |
597
663
  |---------|-------------|
598
664
  | `/debate` | Adversarial debate with evidence scoring (AceMAD). Order-independent, length-independent. |
599
- | `/evolve` | Detect gaps → generate fixes → quality-gate → create agents from evidence. 3 cycles. |
665
+ | `/evolve` | Detect gaps → generate fixes → quality-gate → create agents from evidence. Drift analysis. |
600
666
  | `/sentinel` | Security scan — 5 layers, 102 rules, scored 0–100 (grade A–F). Blocks /ship on findings. |
601
667
  | `/reflexes` | View, analyze, promote learned behavioral patterns. Confidence scoring. |
602
668
  | `/reflect` | Self-improve CLAUDE.md. Reads friction logs + session history. Proposes exact rule edits. |
@@ -617,15 +683,17 @@ Session 4: /evolve → /audit → /ship → COPILOT_COMPLETE
617
683
 
618
684
  ---
619
685
 
620
- ## 13 Agents
686
+ ## 15 Agents
621
687
 
622
688
  **Framework agents** (ship with AZCLAUDE, always available):
623
689
 
624
690
  | Agent | Role |
625
691
  |-------|------|
626
- | `orchestrator` | Tech lead for `/copilot`. Owns plan.md. Dispatches, monitors, triggers /evolve. Never writes code. |
692
+ | `orchestrator` | Tech lead for `/copilot`. Owns plan.md. Reads constitution.md. Runs constitution-guard before every dispatch. Never writes code. |
627
693
  | `problem-architect` | Pre-flight analyst. Returns Team Spec (agents/skills/files/risks/complexity) before every dispatch. Never implements. |
628
- | `milestone-builder` | Base builder. Pre-reads all files, implements, verifies, self-corrects (fix budget), commits, reports. |
694
+ | `milestone-builder` | Base builder. Reads constitution.md FIRST. Pre-reads all files, implements, verifies, self-corrects, commits. |
695
+ | `spec-reviewer` | **New — haiku model.** Validates spec quality before /blueprint runs. 7 criteria. Verdict: APPROVED / NEEDS_CLARIFY / INCOMPLETE. Read-only gate. |
696
+ | `constitution-guard` | **New — haiku model.** Checks each milestone against constitution.md before dispatch. Verdict: APPROVED / VIOLATION. Blocks on violations. Read-only gate. |
629
697
  | `orchestrator-init` | Runs once during `/setup`. Scans project, fills CLAUDE.md, creates goals.md. Exits permanently. |
630
698
  | `loop-controller` | Level 10 autonomous agent. 3 cycles: evolution, knowledge consolidation, topology optimization. |
631
699
  | `evolution-module` | Called by orchestrator to run /evolve and /level-up at Level 10. Delegates to loop-controller. |
@@ -730,6 +798,10 @@ Run `/level-up` at any time to see your current level and build the next one.
730
798
  | Agent specialization | None | Project agents emerge from git evidence, not guessing |
731
799
  | Autonomous building | Not possible | /copilot — three-tier intelligent team |
732
800
  | Self-improvement | Not possible | /evolve + /reflect + /reflexes — 3-layer environment evolution |
801
+ | Requirements traceability | None | /spec + acceptance criteria → every milestone traces to a requirement |
802
+ | Governance enforcement | None | constitution-guard blocks milestones that violate non-negotiables |
803
+ | Plan vs. reality drift | Invisible | /analyze detects ghost milestones before they ship |
804
+ | Spec quality gate | None | spec-reviewer (haiku) validates before /blueprint starts planning |
733
805
  | Any stack | Yes | Yes |
734
806
  | You own the code | Yes | Yes |
735
807
  | Zero dependencies | — | Yes (0 in package.json) |
@@ -738,11 +810,11 @@ Run `/level-up` at any time to see your current level and build the next one.
738
810
 
739
811
  ## Verified
740
812
 
741
- 1353 tests. Every template, command, capability, agent, hook, and CLI feature verified.
813
+ 1357 tests. Every template, command, capability, agent, hook, and CLI feature verified.
742
814
 
743
815
  ```bash
744
816
  bash tests/test-features.sh
745
- # Results: 1353 passed, 0 failed, 1353 total
817
+ # Results: 1357 passed, 0 failed, 1357 total
746
818
  ```
747
819
 
748
820
  ---
package/bin/cli.js CHANGED
@@ -1016,7 +1016,7 @@ function runDoctor() {
1016
1016
  const hasGitFail = failures.some(f => /uncommitted/.test(f));
1017
1017
  const hasMemoryFail = failures.some(f => /checkpoints|sessions|codebase-map|goals/.test(f));
1018
1018
  console.log('');
1019
- if (hasCommandFail || hasHookFail) console.log(' Fix: re-run npx azclaude-copilot to install missing files');
1019
+ if (hasCommandFail || hasHookFail) console.log(' Fix: run npx azclaude-copilot upgrade to install/refresh all files');
1020
1020
  if (hasHookFail) console.log(' If hooks still fail: check that Node.js ≥ 16 is in PATH');
1021
1021
  if (hasGitFail) console.log(' Git: commit or stash uncommitted changes');
1022
1022
  if (hasMemoryFail) console.log(' Memory: run /setup or /persist to create missing files');
@@ -1054,15 +1054,31 @@ if (process.argv[2] === 'copilot') {
1054
1054
  process.exit(result.status || 0);
1055
1055
  }
1056
1056
 
1057
- const fullInstall = process.argv.includes('--full');
1058
- const forceUpdate = process.argv.includes('--update');
1059
1057
  const projectDir = process.cwd();
1060
1058
  const cli = detectCLI();
1061
1059
 
1060
+ // ─── Smart version detection ──────────────────────────────────────────────────
1061
+ // If AZCLAUDE already installed in this project, read the version it was installed with.
1062
+ // Compare to current package version. If outdated (or missing version marker) → auto-upgrade.
1063
+ const pkg = require('../package.json');
1064
+ const currentVer = pkg.version;
1065
+ const versionFile = path.join(projectDir, cli.cfg, '.azclaude-version');
1066
+ const installedVer = fs.existsSync(versionFile) ? fs.readFileSync(versionFile, 'utf8').trim() : null;
1067
+ const isFirstInstall = !fs.existsSync(path.join(projectDir, cli.cfg, 'commands'));
1068
+ const needsUpgrade = !isFirstInstall && installedVer !== currentVer;
1069
+
1070
+ // explicit flags still work as overrides
1071
+ const explicitUpgrade = process.argv[2] === 'upgrade' || process.argv.includes('--update');
1072
+ const fullInstall = explicitUpgrade || isFirstInstall || needsUpgrade || process.argv.includes('--full');
1073
+ const forceUpdate = explicitUpgrade || needsUpgrade;
1074
+
1062
1075
  console.log('\n════════════════════════════════════════════════');
1063
1076
  console.log(' AZCLAUDE — AI Coding Environment');
1064
1077
  console.log(` CLI: ${cli.name} → installing to ${cli.cfg}/`);
1065
- if (forceUpdate) console.log(' Mode: --update (refreshing all templates)');
1078
+ if (isFirstInstall) console.log(` Mode: fresh install (v${currentVer})`);
1079
+ else if (needsUpgrade) console.log(` Mode: auto-upgrade ${installedVer} → ${currentVer}`);
1080
+ else if (forceUpdate) console.log(` Mode: forced refresh (v${currentVer})`);
1081
+ else console.log(` Mode: verify (v${currentVer} already current)`);
1066
1082
  console.log('════════════════════════════════════════════════\n');
1067
1083
 
1068
1084
  // ── Detect conflicting installations ─────────────────────────────────────────
@@ -1107,6 +1123,9 @@ if (!fs.existsSync(evolLogPath)) {
1107
1123
  try { fs.writeFileSync(evolLogPath, header); } catch (_) {}
1108
1124
  }
1109
1125
 
1126
+ // ── Write version marker (used by auto-upgrade detection on next run) ────────
1127
+ fs.writeFileSync(versionFile, currentVer);
1128
+
1110
1129
  // ── Post-install capability reference verification ───────────────────────────
1111
1130
  verifyCapabilityReferences(projectDir, cli.cfg);
1112
1131
 
@@ -1126,15 +1145,14 @@ if (fs.existsSync(postInstallValidator)) {
1126
1145
  }
1127
1146
 
1128
1147
  console.log('\n════════════════════════════════════════════════');
1129
- console.log(` Install mode: ${fullInstall ? 'full (all capabilities)' : 'core (shared + level-builders)'}`);
1148
+ console.log(` v${currentVer} ${isFirstInstall ? 'installed' : needsUpgrade ? 'upgraded' : 'up to date'}`);
1130
1149
  console.log(' Architecture: lazy-loaded, manifest-driven');
1131
1150
  console.log(' Token cost per task: ~200-600 (vs ~21,000 monolith)');
1132
1151
  console.log('');
1133
- if (!fullInstall) {
1134
- console.log(' Next steps:');
1135
- console.log(' 1. npx azclaude-copilot --full (Level 5+: debate, pipeline, ELO)');
1136
- console.log(' 2. Open Claude Code and run /setup');
1137
- } else {
1152
+ if (isFirstInstall || needsUpgrade) {
1138
1153
  console.log(' Next step: open Claude Code and run /setup');
1154
+ } else {
1155
+ console.log(' Already up to date. Run /setup in Claude Code to configure.');
1139
1156
  }
1157
+ console.log(` To upgrade later: npx azclaude-copilot@latest (auto-detects version)`);
1140
1158
  console.log('════════════════════════════════════════════════\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azclaude-copilot",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "description": "AI coding environment — 27 commands, 8 skills, 13 agents, memory, reflexes, evolution. Install: npm install -g azclaude-copilot@latest, then in Claude Code: azclaude-copilot setup --full",
5
5
  "bin": {
6
6
  "azclaude": "bin/cli.js",