azclaude-copilot 0.4.0 → 0.4.2

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/README.md CHANGED
@@ -469,7 +469,7 @@ azclaude-copilot/
469
469
  ├── DOCS.md <- full user guide
470
470
  ├── SECURITY.md <- security policy + architecture
471
471
  ├── tests/
472
- │ └── test-features.sh ← 1096 tests
472
+ │ └── test-features.sh ← 1135 tests
473
473
  ```
474
474
 
475
475
  ---
@@ -495,11 +495,11 @@ The runner is stateless. These files ARE the state.
495
495
 
496
496
  ## Verified
497
497
 
498
- 1096 tests. Every template, command, capability, agent, and CLI feature verified.
498
+ 1135 tests. Every template, command, capability, agent, and CLI feature verified.
499
499
 
500
500
  ```bash
501
501
  bash tests/test-features.sh
502
- # Results: 1096 passed, 0 failed, 1096 total
502
+ # Results: 1135 passed, 0 failed, 1135 total
503
503
  ```
504
504
 
505
505
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azclaude-copilot",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "AI coding environment — 26 commands, 8 skills, 10 agents, memory, reflexes, evolution. Install once, works on any stack.",
5
5
  "bin": {
6
6
  "azclaude": "./bin/cli.js",
@@ -25,6 +25,7 @@ Load only the files that match the current task. Never load the full list.
25
25
  | shared/context-artifacts.md | Project has DB schemas, API specs, infra configs, or knowledge/ dir — discover and use non-code knowledge before implementing | ~200 |
26
26
  | shared/semantic-boundary-check.md | /evolve Cycle 3 or boundary validator warns — detect deeper behavioral duplication across extension types that grep misses | ~300 |
27
27
  | shared/domain-advisor-generator.md | Non-tech domain detected (compliance, marketing, finance, medical, legal, research) — generates domain-specific advisor skill | ~400 |
28
+ | shared/intelligent-dispatch.md | About to build, fix, refactor, audit, or ship — non-trivial scope (3+ files or structural) — pre-flight analysis via problem-architect | ~300 |
28
29
 
29
30
  ## Level Builders — load ONE at a time
30
31
  | File | When to load | Tokens |
@@ -0,0 +1,79 @@
1
+ # Intelligent Dispatch — Pre-Flight Protocol
2
+
3
+ Load before any non-trivial build, fix, refactor, audit, or plan task.
4
+ Invokes problem-architect for structured analysis BEFORE touching code.
5
+
6
+ ---
7
+
8
+ ## When to Run Problem-Architect
9
+
10
+ Run pre-analysis if ANY of these is true:
11
+ - Task will touch 3+ files
12
+ - Task involves a structural change (schema, API contract, auth, architecture)
13
+ - Task crosses directory boundaries (multiple modules or layers)
14
+ - First time working in this part of the codebase this session
15
+
16
+ Skip if:
17
+ - Only 1-2 files, clearly scoped
18
+ - Pure config/docs change with no code impact
19
+ - Already in copilot mode with annotated plan.md (milestones already have Team Spec)
20
+
21
+ ---
22
+
23
+ ## How to Invoke
24
+
25
+ ```bash
26
+ ls .claude/agents/problem-architect.md 2>/dev/null && echo "ARCHITECT_AVAILABLE" || echo "NOT_INSTALLED"
27
+ ```
28
+
29
+ If ARCHITECT_AVAILABLE — spawn problem-architect with:
30
+ ```
31
+ Task: {command name} — {what you're doing}
32
+ Current state: {what files/dirs exist relevant to this task}
33
+ Available agents: {output of: ls .claude/agents/ 2>/dev/null}
34
+ Available skills: {output of: ls .claude/skills/ 2>/dev/null}
35
+ ```
36
+
37
+ ---
38
+
39
+ ## What to Do with the Returned Team Spec
40
+
41
+ | Field | Action |
42
+ |-------|--------|
43
+ | Skills to Load | Load each skill before implementing |
44
+ | Pre-Read Files | Read every file listed, in order: schema → source → tests → patterns → antipatterns |
45
+ | Pre-Conditions | Verify each; STOP if any unmet |
46
+ | Files Written | Note for parallel safety — no concurrent work on same files |
47
+ | Structural Decision: YES | Run /debate before proceeding; log result to `.claude/memory/decisions.md` |
48
+ | Risks | Read mitigation; apply to implementation approach |
49
+
50
+ ---
51
+
52
+ ## Implementation Protocol (milestone-builder)
53
+
54
+ For any implementation task (3+ files or MEDIUM/COMPLEX):
55
+
56
+ 1. **Pre-read** all files from Team Spec — no exceptions
57
+ 2. **Implement** following patterns.md exactly — never invent patterns
58
+ 3. **Verify** — run full test suite, show actual output (never summarize)
59
+ 4. **Self-correct** — re-read error + check antipatterns.md → ONE alternative approach
60
+ 5. **Budget** — 2 fix attempts for SIMPLE/MEDIUM, 3 for COMPLEX
61
+ - Budget exhausted → report exact error + what was tried → do not guess again
62
+
63
+ ---
64
+
65
+ ## When to Escalate to Orchestrator
66
+
67
+ If `.claude/agents/orchestrator.md` exists:
68
+ - Task spans 2+ milestones in plan.md → delegate to orchestrator
69
+ - Multiple independent workstreams → orchestrator manages parallel dispatch
70
+ - Structural decision needed → orchestrator triggers /debate
71
+
72
+ ---
73
+
74
+ ## Rules
75
+
76
+ - NEVER skip pre-read. Context-blind implementation is the most common failure mode.
77
+ - NEVER invent patterns. patterns.md says use X → use X.
78
+ - NEVER exceed fix attempt budget. Stop and report when exhausted.
79
+ - ALWAYS show test output. Never say "tests should pass."
@@ -18,6 +18,19 @@ Load: shared/tdd.md + shared/completion-rule.md
18
18
 
19
19
  ---
20
20
 
21
+ ## Pre-Flight Analysis (intelligent-dispatch)
22
+
23
+ Load `shared/intelligent-dispatch.md`.
24
+
25
+ If task will touch 3+ files OR crosses module boundaries:
26
+ → Spawn problem-architect (see intelligent-dispatch protocol)
27
+ → Use returned Team Spec: load skills, pre-read files, check pre-conditions, note risks
28
+ → If Structural Decision: YES → run /debate before Phase 4
29
+
30
+ If problem-architect not installed: proceed with Phase 1 as normal (manual scan in Phase 2).
31
+
32
+ ---
33
+
21
34
  ## Copilot Mode Detection
22
35
 
23
36
  ```bash
@@ -48,6 +48,27 @@ If `COPILOT_MODE`:
48
48
 
49
49
  ---
50
50
 
51
+ ## Step 1b: Structural Context (intelligent-dispatch)
52
+
53
+ Load `shared/intelligent-dispatch.md`.
54
+
55
+ If problem-architect available — spawn it before reviewing:
56
+ ```
57
+ Task: audit — structural context for spec compliance review
58
+ Current state: {what's changed, what the diff covers}
59
+ Available agents: {list}
60
+ Available skills: {list}
61
+ ```
62
+ Use returned Team Spec to inject:
63
+ - `decisions.md` rulings to check against (architectural commitments)
64
+ - `patterns.md` conventions the code should follow
65
+ - `antipatterns.md` known failure patterns to scan for
66
+ - Risks flagged by architect → include in audit checklist
67
+
68
+ If problem-architect not installed: proceed with manual review using available memory files.
69
+
70
+ ---
71
+
51
72
  ## Step 2: Spec Compliance (REQUIRED FIRST)
52
73
 
53
74
  **Assume the implementation may be incomplete or optimistic. Verify independently.**
@@ -104,7 +104,33 @@ When running inside `/copilot` (detected by: `.claude/copilot-intent.md` exists)
104
104
  - Include `Files:` with expected paths
105
105
  - Include `Commit:` with conventional commit format
106
106
  - Write `## Summary` with counts at the bottom
107
- - After writing plan.md, return control to /copilot
107
+
108
+ ### Problem-Architect Validation (if available)
109
+
110
+ After writing plan.md, check:
111
+ ```bash
112
+ ls .claude/agents/problem-architect.md 2>/dev/null
113
+ ```
114
+
115
+ If problem-architect.md exists — spawn it for EACH milestone in plan.md:
116
+ ```
117
+ Analyze this milestone for the Team Spec:
118
+ Milestone: {description from plan.md}
119
+ Current state: {what files exist in the project}
120
+ Available agents: {list of .claude/agents/}
121
+ Available skills: {list of .claude/skills/}
122
+ ```
123
+
124
+ For each milestone, append the returned Team Spec fields directly into plan.md:
125
+ - `Complexity:` SIMPLE / MEDIUM / COMPLEX
126
+ - `Files Written:` exact paths the builder will touch (critical for parallel safety)
127
+ - `Pre-conditions:` checklist before starting
128
+ - `Risks:` and mitigation
129
+ - `Structural Decision:` YES/NO (if YES → orchestrator must /debate before dispatching)
130
+
131
+ This pre-annotation makes orchestrator dispatch faster and prevents parallel file collision.
132
+
133
+ After all milestones annotated — return control to /copilot.
108
134
 
109
135
  ---
110
136
 
@@ -57,6 +57,23 @@ Read `.claude/capabilities/manifest.md` if it exists.
57
57
 
58
58
  Detect current level (0–7) from what's present.
59
59
 
60
+ **Existing project deep scan (intelligent-dispatch):**
61
+
62
+ If `.claude` directory exists and project has code files — load `shared/intelligent-dispatch.md` and spawn problem-architect:
63
+ ```
64
+ Task: dream — analyze existing codebase before generating vision
65
+ Current state: {what files, agents, skills already exist}
66
+ Available agents: {list}
67
+ Available skills: {list}
68
+ ```
69
+ Use returned Team Spec to understand:
70
+ - What agents/skills already cover (don't regenerate what exists)
71
+ - Co-change clusters (candidate future agents)
72
+ - Established patterns (vision must not conflict with them)
73
+ - Structural decisions already made (decisions.md)
74
+
75
+ If clean slate (no .claude dir): skip problem-architect, proceed to Phase 3.
76
+
60
77
  **ExitPlanMode** — ready to build.
61
78
 
62
79
  ---
@@ -203,6 +203,26 @@ ls .claude/commands/*.md .claude/agents/*.md .claude/skills/*/SKILL.md 2>/dev/nu
203
203
  Skip creation if a skill/agent already covers the same workflow.
204
204
  Update existing ones if they're missing steps discovered in recent sessions.
205
205
 
206
+ ### 7e: Orchestrator re-evaluation (if intelligent copilot installed)
207
+
208
+ After generating new agents/skills, check:
209
+ ```bash
210
+ ls .claude/agents/orchestrator.md .claude/plan.md 2>/dev/null
211
+ ```
212
+
213
+ If BOTH exist — spawn orchestrator with:
214
+ ```
215
+ Re-evaluate plan.md after /evolve created new agents and skills.
216
+ Focus on: which blocked milestones can now be unblocked?
217
+ New agents available: {list of newly created agents}
218
+ New skills available: {list of newly created skills}
219
+ Check blockers.md for each blocked milestone — does a new agent cover the missing capability?
220
+ Update plan.md status for any milestone that is now unblockable (blocked → pending).
221
+ Report: milestones unblocked + reason.
222
+ ```
223
+
224
+ This closes the loop: /evolve creates capability → orchestrator immediately re-routes blocked work.
225
+
206
226
  ---
207
227
 
208
228
  ## Step 8: Promote GENERAL Skills
@@ -14,6 +14,20 @@ Load: shared/tdd.md + shared/completion-rule.md before starting.
14
14
 
15
15
  ---
16
16
 
17
+ ## Pre-Flight Analysis (intelligent-dispatch)
18
+
19
+ Load `shared/intelligent-dispatch.md`.
20
+
21
+ After reproducing the error — before investigating — spawn problem-architect if available:
22
+ → Task: "fix — {error description}"
23
+ → Current state: {files involved in the failure}
24
+ → Use returned Team Spec: pre-read the affected files, load patterns/antipatterns for this area
25
+ → Pre-conditions check prevents fixing a symptom instead of the root cause
26
+
27
+ If problem-architect not installed: proceed with Phase 2 manual investigation as normal.
28
+
29
+ ---
30
+
17
31
  ## Phase 1: REPRODUCE
18
32
 
19
33
  **First: check IDE diagnostics (instant, no build needed)**
@@ -18,6 +18,27 @@ Load: shared/completion-rule.md
18
18
 
19
19
  ---
20
20
 
21
+ ## Pre-Flight Analysis (intelligent-dispatch)
22
+
23
+ Load `shared/intelligent-dispatch.md`.
24
+
25
+ Spawn problem-architect before any scan:
26
+ ```
27
+ Task: refactor — {what's being refactored}
28
+ Current state: {target file/function + surrounding directory}
29
+ Available agents: {list}
30
+ Available skills: {list}
31
+ ```
32
+ Use returned Team Spec:
33
+ - Pre-Read Files → read these BEFORE grepping for references (architect already knows the dependency graph)
34
+ - Risks → structural risks the refactor may trigger (e.g., type exports used downstream)
35
+ - Files Written → exhaustive list of files the refactor will touch
36
+ - If Structural Decision: YES → run /debate (refactors sometimes expose architectural choices)
37
+
38
+ If problem-architect not installed: proceed with Phase 1 manual scan.
39
+
40
+ ---
41
+
21
42
  ## Phase 1: Understand Current State
22
43
 
23
44
  If $ARGUMENTS is blank, use **AskUserQuestion**:
@@ -121,6 +121,27 @@ Read `.claude/capabilities/level-builders/level5-agents.md` for agent design gui
121
121
 
122
122
  Skip if project has < 10 files or < 5 commits.
123
123
 
124
+ ### Problem-Architect Supplement (new projects with zero git history)
125
+
126
+ If the project has < 5 commits (no co-change data), check:
127
+ ```bash
128
+ ls .claude/agents/problem-architect.md 2>/dev/null
129
+ ```
130
+
131
+ If problem-architect.md exists — spawn it to analyze the project structure directly:
132
+ ```
133
+ Analyze this project to recommend agents and skills.
134
+ No git history available — use file structure and stack signals instead.
135
+ Project stack: {from env-scan.sh output}
136
+ Files found: {top-level structure}
137
+ Domain: {from CLAUDE.md}
138
+ Available agents already installed: {list .claude/agents/}
139
+ Return: recommended cc- agents (with directory claims) + skills to generate
140
+ ```
141
+
142
+ Use the returned recommendations as the basis for agent/skill generation.
143
+ This fills the gap when git history is too thin for co-change analysis.
144
+
124
145
  ---
125
146
 
126
147
  ## Step 7: Quality Gate
@@ -15,6 +15,26 @@ $ARGUMENTS
15
15
 
16
16
  ---
17
17
 
18
+ ## Step 0: Risk Scan (intelligent-dispatch)
19
+
20
+ Load `shared/intelligent-dispatch.md`.
21
+
22
+ If problem-architect available — spawn it for a pre-ship risk scan:
23
+ ```
24
+ Task: ship — pre-ship risk assessment
25
+ Current state: {output of: git diff --stat HEAD}
26
+ Available agents: {list}
27
+ Available skills: {list}
28
+ ```
29
+ Use returned Team Spec:
30
+ - Risks → must address before shipping (not suggestions)
31
+ - Structural Decision: YES → a decision was made without /debate → log it to decisions.md now
32
+ - Pre-Conditions → any unmet condition blocks ship (e.g., migration not run, env var not set)
33
+
34
+ If problem-architect not installed OR git diff is only docs/config: skip and proceed to Pre-Ship Gate.
35
+
36
+ ---
37
+
18
38
  ## Pre-Ship Gate (runs before any commit)
19
39
 
20
40
  **1. IDE diagnostics** — use `mcp__ide__getDiagnostics` if available.