azclaude-copilot 0.4.12 → 0.4.13

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.
@@ -18,6 +18,18 @@ Load: shared/completion-rule.md
18
18
 
19
19
  ---
20
20
 
21
+ ## Pre-Flight: Constitution Check
22
+
23
+ ```bash
24
+ [ -f .claude/constitution.md ] && echo "constitution=found" || echo "no constitution"
25
+ ```
26
+
27
+ If found: read `## Architectural Commitments` and `## Required Patterns`.
28
+ Refactoring often changes structure — ensure the refactor moves TOWARD required patterns, not away from them.
29
+ If the refactor would conflict with an architectural commitment → flag before starting Phase 1. Do not proceed silently.
30
+
31
+ ---
32
+
21
33
  ## Pre-Flight Analysis (intelligent-dispatch)
22
34
 
23
35
  Load `shared/intelligent-dispatch.md`.
@@ -159,6 +159,47 @@ All ✓ required before printing "Setup complete."
159
159
 
160
160
  ---
161
161
 
162
+ ## Step 8: Governance + Spec Readiness
163
+
164
+ After quality gate passes, check governance state:
165
+
166
+ ```bash
167
+ # Constitution check
168
+ [ -f .claude/constitution.md ] && echo "constitution=found" || echo "constitution=missing"
169
+
170
+ # Spec directory check
171
+ ls .claude/specs/*.md 2>/dev/null | head -3
172
+ ```
173
+
174
+ Output a next-steps block:
175
+
176
+ ```
177
+ ─── Recommended Next Steps ──────────────────────────────
178
+ ```
179
+
180
+ If constitution missing:
181
+ ```
182
+ ⚠ No project constitution found.
183
+ Run: /constitute
184
+ Why: defines non-negotiables, required patterns, definition of done.
185
+ Copilot checks this before every milestone implementation.
186
+ ```
187
+
188
+ If no specs found:
189
+ ```
190
+ · No feature specs found.
191
+ Run: /spec [feature name]
192
+ Why: structured spec → /blueprint derives a better plan → /copilot builds the right thing.
193
+ Spec-first workflow: /spec → /clarify → /blueprint → /copilot
194
+ ```
195
+
196
+ If both exist:
197
+ ```
198
+ ✓ Constitution and specs found. Ready for /copilot.
199
+ ```
200
+
201
+ ---
202
+
162
203
  ## If Running Again on an Existing Project
163
204
 
164
205
  Do not overwrite CLAUDE.md — read it first and update only the placeholders that are still unfilled.
@@ -37,7 +37,25 @@ If problem-architect not installed OR git diff is only docs/config: skip and pro
37
37
 
38
38
  ## Pre-Ship Gate (runs before any commit)
39
39
 
40
- **0. Security scan** — check if `security-auditor` agent is installed:
40
+ **0a. Ghost Milestone Check** — catch plan drift before it ships:
41
+
42
+ ```bash
43
+ [ -f .claude/plan.md ] && echo "plan=found" || echo "plan=missing"
44
+ ```
45
+
46
+ If `plan=found`: run `/analyze plan` inline:
47
+ - Scan for milestones marked `done` where the committed files no longer exist
48
+ - If ANY ghost milestones found → STOP:
49
+ ```
50
+ ✗ Pre-ship blocked: ghost milestones detected (marked done, files missing).
51
+ Run /analyze to see full list. Fix plan.md before shipping.
52
+ ```
53
+ - If constitution.md exists: also verify no `pending` milestones violate a non-negotiable
54
+ (a quick grep is sufficient — full constitution-guard runs per-milestone during /copilot)
55
+
56
+ If `plan=missing`: skip ghost check.
57
+
58
+ **0b. Security scan** — check if `security-auditor` agent is installed:
41
59
  ```bash
42
60
  ls .claude/agents/security-auditor.md 2>/dev/null && echo "agent=found" || echo "agent=missing"
43
61
  ```
@@ -0,0 +1,196 @@
1
+ ---
2
+ name: spec
3
+ description: >
4
+ Write a structured, versioned spec for a feature BEFORE planning or coding.
5
+ Triggers on: "write a spec", "spec this out", "create a spec", "spec for", "I need a spec",
6
+ "document the requirements", "write requirements for", "define what to build",
7
+ "spec-driven", "requirements document", "feature spec", "write the spec first",
8
+ "spec before we plan", "what should we build", "define the feature",
9
+ "product spec", "technical spec for", "write spec then plan",
10
+ "spec before blueprint", "let's spec this".
11
+ Use after /dream (intent exists) and before /blueprint (plan).
12
+ NOT triggered by "add X" or "build X" alone.
13
+ argument-hint: "[feature or product description]"
14
+ disable-model-invocation: true
15
+ allowed-tools: Read, Write, Bash, Glob, Grep
16
+ ---
17
+
18
+ # /spec — Write a Structured Spec
19
+
20
+ $ARGUMENTS
21
+
22
+ ---
23
+
24
+ ## Purpose
25
+
26
+ The spec is the primary artifact. Code is derived from it, not the reverse.
27
+ A spec produced here becomes the canonical input for /blueprint → /add → /audit.
28
+ Without a spec, /blueprint is guessing. With a spec, every milestone traces to a requirement.
29
+
30
+ **Workflow position:**
31
+ ```
32
+ /dream → /spec → /clarify (if needed) → /blueprint → /add
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Copilot Mode Detection
38
+
39
+ ```bash
40
+ [ -f .claude/copilot-intent.md ] && echo "COPILOT_MODE" || echo "INTERACTIVE_MODE"
41
+ ```
42
+
43
+ If `COPILOT_MODE`: read `.claude/copilot-intent.md` as the source — skip Phase 1 questions.
44
+ If `INTERACTIVE_MODE`: run Phase 1 as normal.
45
+
46
+ ---
47
+
48
+ ## Phase 1: Intake
49
+
50
+ If $ARGUMENTS is blank or vague, use **AskUserQuestion**:
51
+ - What are you building? (specific — "user login with JWT" not "auth")
52
+ - Who uses it? (role/persona)
53
+ - What's the single most important outcome for the first version?
54
+
55
+ If a spec file already exists for this feature:
56
+ ```bash
57
+ ls .claude/specs/ 2>/dev/null
58
+ ```
59
+ Show existing spec and ask: "Use this as a base, or start fresh?"
60
+
61
+ ---
62
+
63
+ ## Phase 2: Context Scan
64
+
65
+ ```bash
66
+ # Understand what already exists
67
+ grep -i "domain:\|stack:\|scale:" CLAUDE.md 2>/dev/null | head -5
68
+
69
+ # Find related existing code
70
+ grep -ri "$(echo "$ARGUMENTS" | cut -d' ' -f1-3)" --include="*.ts" --include="*.py" --include="*.js" -l 2>/dev/null | head -8
71
+
72
+ # Read constitution if it exists
73
+ cat .claude/constitution.md 2>/dev/null | head -30
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Phase 3: Write the Spec
79
+
80
+ Generate slug and create spec file:
81
+
82
+ ```bash
83
+ SLUG=$(echo "$ARGUMENTS" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-' | cut -c1-40)
84
+ NEXT_N=$(ls .claude/specs/ 2>/dev/null | grep -c '^' || echo 0)
85
+ N=$(printf '%02d' $((NEXT_N + 1)))
86
+ mkdir -p .claude/specs
87
+ SPEC_FILE=".claude/specs/${N}-${SLUG}.md"
88
+ ```
89
+
90
+ Write `$SPEC_FILE`:
91
+
92
+ ```markdown
93
+ # Spec: {feature title}
94
+ id: {N}-{slug}
95
+ created: {today's date}
96
+ status: draft
97
+ version: 1
98
+
99
+ ---
100
+
101
+ ## Goal
102
+ {1-2 sentences — the problem this solves, for whom, and why now}
103
+
104
+ ## User Stories
105
+ - As a {user type}, I want to {action} so that {outcome}
106
+ - As a {user type}, I want to {action} so that {outcome}
107
+ - As a {user type}, I want to {action} so that {outcome}
108
+
109
+ ## Acceptance Criteria
110
+ All criteria must be independently verifiable — "given X, when Y, then Z" format.
111
+
112
+ 1. Given {precondition}, when {action}, then {expected outcome}
113
+ 2. Given {precondition}, when {action}, then {expected outcome}
114
+ 3. Given {precondition}, when {action}, then {expected outcome}
115
+
116
+ ## Data Model Changes
117
+ {Describe any new or modified data structures, fields, tables, or schemas.}
118
+ {If none: "No data model changes."}
119
+
120
+ ## API / Interface Changes
121
+ {Describe new or modified endpoints, function signatures, events, or contracts.}
122
+ {If none: "No API changes."}
123
+
124
+ ## Out of Scope (this version)
125
+ - {explicitly excluded}
126
+ - {explicitly excluded}
127
+ - {explicitly excluded}
128
+
129
+ ## Failure Modes
130
+ | Scenario | Expected behavior |
131
+ |----------|-------------------|
132
+ | {X fails} | {what should happen} |
133
+ | {Y is missing} | {what should happen} |
134
+
135
+ ## Constraints
136
+ - Performance: {requirement or "none"}
137
+ - Security: {requirement or "none"}
138
+ - Backwards compatibility: {requirement or "none"}
139
+ - Dependencies: {blocked by or requires}
140
+
141
+ ## Open Questions
142
+ {List any unresolved decisions. Run /clarify to resolve before /blueprint.}
143
+ - [ ] {question}
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Phase 4: Validate
149
+
150
+ Before saving, check:
151
+ - At least 3 acceptance criteria present
152
+ - Out of scope section is not empty (forces explicit scoping)
153
+ - No open questions remain (or mark spec as `draft` if they do)
154
+
155
+ If any open questions remain → set `status: draft` and recommend `/clarify {spec-file}`.
156
+ If all criteria met → set `status: ready-for-blueprint`.
157
+
158
+ **Spec Reviewer Gate** (if `spec-reviewer` agent is installed):
159
+
160
+ ```bash
161
+ ls .claude/agents/spec-reviewer.md 2>/dev/null && echo "agent=found" || echo "agent=missing"
162
+ ```
163
+
164
+ If `agent=found` AND status is `ready-for-blueprint`: spawn spec-reviewer:
165
+ ```
166
+ Review spec file: {SPEC_FILE}
167
+ ```
168
+
169
+ - Verdict `APPROVED` → proceed to Completion Rule
170
+ - Verdict `NEEDS_CLARIFY` → downgrade status to `draft`, output spec-reviewer feedback,
171
+ recommend `/clarify {spec-file}`
172
+ - Verdict `INCOMPLETE` → do NOT write the file yet, list missing sections and re-run Phase 3
173
+
174
+ If `agent=missing`: skip gate, trust manual validation above.
175
+
176
+ ---
177
+
178
+ ## Completion Rule
179
+
180
+ Show:
181
+ 1. Spec file path: `.claude/specs/{N}-{slug}.md`
182
+ 2. Acceptance criteria count
183
+ 3. Status: `draft` or `ready-for-blueprint`
184
+ 4. Open questions count
185
+
186
+ If `ready-for-blueprint`:
187
+ ```
188
+ Next: /blueprint .claude/specs/{N}-{slug}.md
189
+ ```
190
+
191
+ If `draft`:
192
+ ```
193
+ Next: /clarify .claude/specs/{N}-{slug}.md (resolve open questions first)
194
+ ```
195
+
196
+ Do not write any implementation code during /spec.
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: tasks
3
+ description: >
4
+ Generate a dependency-ordered, parallelizable task list from a plan or spec.
5
+ Shows what can run in parallel vs. what must be sequential.
6
+ Triggers on: "show me the tasks", "task breakdown", "what are the tasks", "task list",
7
+ "dependency order", "what can run in parallel", "task graph", "ordered tasks",
8
+ "show task dependencies", "what should I work on next", "task queue",
9
+ "breakdown the milestones", "sequential vs parallel", "work order",
10
+ "what's next to build", "task planning", "task dependency graph",
11
+ "what order should we build", "parallelizable tasks", "task ordering",
12
+ "task schedule", "which tasks block which".
13
+ Use BEFORE /copilot to understand the work order, or AFTER /blueprint to validate the plan.
14
+ argument-hint: "[blank to read plan.md, or path to spec/plan file]"
15
+ disable-model-invocation: true
16
+ allowed-tools: Read, Bash, Glob, Grep
17
+ ---
18
+
19
+ # /tasks — Dependency-Ordered Task List
20
+
21
+ $ARGUMENTS
22
+
23
+ **EnterPlanMode** — read-only. No file modifications.
24
+
25
+ ---
26
+
27
+ ## Step 1: Find the Source
28
+
29
+ ```bash
30
+ # Check for plan.md
31
+ ls .claude/plan.md 2>/dev/null && echo "plan found" || echo "no plan"
32
+
33
+ # Check for specs
34
+ ls .claude/specs/*.md 2>/dev/null | head -5
35
+
36
+ # If $ARGUMENTS points to a file, use that
37
+ [ -n "$ARGUMENTS" ] && [ -f "$ARGUMENTS" ] && echo "using: $ARGUMENTS"
38
+ ```
39
+
40
+ Priority:
41
+ 1. If $ARGUMENTS is a file path → use that
42
+ 2. If `.claude/plan.md` exists → use plan.md
43
+ 3. If specs exist but no plan → suggest running `/blueprint` first
44
+ 4. If nothing found → use **AskUserQuestion**: "Paste the list of tasks or milestones to order"
45
+
46
+ ---
47
+
48
+ ## Step 2: Parse Tasks
49
+
50
+ Read the source file. Extract each task/milestone with:
51
+ - ID (M1, M2, … or T1, T2, …)
52
+ - Title
53
+ - `Depends:` field (what must be done first)
54
+ - `Files:` field (for parallel collision detection)
55
+ - Current status (`pending`, `in-progress`, `done`, `blocked`)
56
+
57
+ ---
58
+
59
+ ## Step 3: Build Dependency Graph
60
+
61
+ For each task, determine:
62
+ - **Blocked by**: all tasks that must complete before this one starts
63
+ - **Blocks**: all tasks that cannot start until this one is done
64
+ - **File collision**: tasks that write to the same files (cannot run in parallel)
65
+
66
+ Check file collisions:
67
+ ```bash
68
+ # Group tasks by shared files — tasks sharing files cannot run in parallel
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Step 4: Identify Parallel Groups
74
+
75
+ Tasks with no dependencies between them AND no file collisions can run in parallel.
76
+ Group them into "waves":
77
+
78
+ **Wave = a set of tasks that can all run simultaneously**
79
+
80
+ Algorithm:
81
+ 1. Wave 1 = tasks with no `Depends:` and status `pending`
82
+ 2. Wave 2 = tasks that only depend on Wave 1 tasks
83
+ 3. Wave N = tasks that only depend on tasks in waves 1 through N-1
84
+ 4. A wave cannot contain tasks that share files
85
+
86
+ ---
87
+
88
+ ## Step 5: Output the Task Graph
89
+
90
+ ```
91
+ Task Dependency Graph
92
+ ═════════════════════
93
+ Source: {file}
94
+ Total tasks: {N} | Done: {N} | Pending: {N} | Blocked: {N}
95
+
96
+ ── Wave 1 (can start now) ──────────────────────────────────────
97
+ ▶ M1 {title} [Files: src/auth/login.ts]
98
+ ▶ M2 {title} [Files: src/models/user.ts]
99
+ ▶ M3 {title} [Files: tests/auth/]
100
+
101
+ ── Wave 2 (after Wave 1) ───────────────────────────────────────
102
+ ▶ M4 {title} ←depends M1 [Files: src/api/routes.ts]
103
+ ▶ M5 {title} ←depends M2 [Files: src/services/]
104
+
105
+ ── Wave 3 (after Wave 2) ───────────────────────────────────────
106
+ ▶ M6 {title} ←depends M4,M5 [Files: src/app.ts]
107
+
108
+ ── Blocked ─────────────────────────────────────────────────────
109
+ ✗ M7 {title} reason: {from blockers.md}
110
+
111
+ ── Already Done ────────────────────────────────────────────────
112
+ ✓ M0 {title}
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Step 6: Parallelism Analysis
118
+
119
+ ```
120
+ Parallelism Analysis
121
+ ════════════════════
122
+ Max parallel at once: {N tasks in largest wave}
123
+ Critical path length: {N waves minimum to complete}
124
+ File collision pairs: {N pairs that cannot run simultaneously}
125
+
126
+ Suggested dispatch order for /copilot:
127
+ 1. Start Wave 1 tasks simultaneously (or sequentially if no orchestrator)
128
+ 2. On Wave 1 complete → start Wave 2
129
+ 3. ...
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Copilot Mode Integration
135
+
136
+ If `.claude/agents/orchestrator.md` exists:
137
+ → Note: "The orchestrator will use this graph to dispatch milestone-builder agents in parallel"
138
+
139
+ If no orchestrator:
140
+ → Note: "Copilot will process waves sequentially — Wave 1 first, then Wave 2, etc."
141
+
142
+ ---
143
+
144
+ ## Completion Rule
145
+
146
+ **ExitPlanMode**
147
+
148
+ Show: the full task graph with waves.
149
+ Show: parallelism analysis.
150
+ Show: critical path.
151
+ Do not modify plan.md or any other file during /tasks.
@@ -219,7 +219,7 @@ let editCount = 1;
219
219
  try { editCount = parseInt(fs.readFileSync(counterPath, 'utf8'), 10) + 1; } catch (_) {}
220
220
  try { fs.writeFileSync(counterPath, String(editCount)); } catch (_) {}
221
221
  if (editCount > 0 && editCount % 15 === 0) {
222
- process.stdout.write(`\n⚠ ${editCount} edits this session — run /snapshot before context compaction loses your reasoning\n`);
222
+ process.stderr.write(`\n⚠ ${editCount} edits this session — run /snapshot before context compaction loses your reasoning\n`);
223
223
  }
224
224
 
225
225
  // ── Rapid-edit detection — same file edited 5+ times in <5 min ───────────────
@@ -25,6 +25,21 @@ HOW to code — it guides WHEN to use WHICH approach based on project context an
25
25
  Any decision where the right answer depends on project scale, team size, domain, or
26
26
  deployment target — not just technical preference.
27
27
 
28
+ ## Step 0: Constitution Check
29
+
30
+ ```bash
31
+ [ -f .claude/constitution.md ] && echo "constitution=found" || echo "no constitution"
32
+ ```
33
+
34
+ If found: read `## Architectural Commitments` before advising.
35
+ Recommendations must not contradict an existing architectural commitment.
36
+ If the user's question asks to deviate from a committed decision:
37
+ 1. State the conflict explicitly: "constitution.md commits to {X}, this recommendation would change that"
38
+ 2. Offer two paths: (a) recommendation within the constraint, (b) what amending the constitution would require
39
+ 3. Do NOT silently recommend the deviation without flagging the conflict.
40
+
41
+ ---
42
+
28
43
  ## Step 1: Detect Project Context
29
44
 
30
45
  Read these signals (skip what doesn't exist):