azclaude-copilot 0.4.10 → 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.
@@ -29,9 +29,33 @@ $ARGUMENTS
29
29
 
30
30
  ---
31
31
 
32
- ## Step 1: Clarify (if needed)
32
+ ## Step 1: Spec Detection + Clarify
33
33
 
34
- If $ARGUMENTS is vague, use **AskUserQuestion**:
34
+ First check if $ARGUMENTS is a spec file:
35
+ ```bash
36
+ [ -f "$ARGUMENTS" ] && grep -q "Acceptance Criteria" "$ARGUMENTS" && echo "spec-file" || echo "inline"
37
+ ```
38
+
39
+ **If spec file detected** (`.claude/specs/*.md`):
40
+ 1. Spawn `spec-reviewer` agent to validate quality:
41
+ ```
42
+ Validate this spec file before I use it to generate plan.md: {spec-file-path}
43
+ ```
44
+ 2. If verdict = `APPROVED` → read spec directly as the source of truth. Skip AskUserQuestion.
45
+ - Extract acceptance criteria → use as milestone completion criteria
46
+ - Extract data model / API changes → use as Files: hints
47
+ - Extract out-of-scope → use to exclude from milestones
48
+ 3. If verdict = `NEEDS_CLARIFY` → stop: `Run /clarify {spec-file} first, then retry /blueprint`
49
+ 4. If spec-reviewer not installed → read spec file directly, proceed without validation
50
+
51
+ **If inline description** (not a spec file):
52
+ - Check if `.claude/specs/` has a spec matching $ARGUMENTS keywords:
53
+ ```bash
54
+ ls .claude/specs/ 2>/dev/null | grep -i "$(echo "$ARGUMENTS" | cut -d' ' -f1-2)"
55
+ ```
56
+ - If matching spec found → use it. If not → proceed with AskUserQuestion below.
57
+
58
+ If $ARGUMENTS is vague (and no spec found), use **AskUserQuestion**:
35
59
  - What is the goal? (the problem, not the solution)
36
60
  - Any hard constraints? (backwards compatibility, performance, deadline)
37
61
  - What's explicitly out of scope?
@@ -77,6 +101,26 @@ State the risk level. If risk = high → recommend `EnterWorktree` during implem
77
101
 
78
102
  ---
79
103
 
104
+ ## Step 3b: Constitution Check + Task Graph
105
+
106
+ After writing the plan (Step 3), check:
107
+ ```bash
108
+ [ -f .claude/constitution.md ] && echo "constitution=found" || echo "no constitution"
109
+ ```
110
+
111
+ If constitution found → scan plan steps against non-negotiables:
112
+ - Read `## Non-Negotiables` from constitution.md
113
+ - Flag any plan step that could violate a rule
114
+ - Add a note to flagged steps: `⚠ Constitution check: may conflict with "{rule}" — verify before implementing`
115
+
116
+ Then run `/tasks` to show dependency waves:
117
+ ```
118
+ Next: Run /tasks to see which plan steps can run in parallel
119
+ ```
120
+ (Do not block — /tasks is informational at this stage)
121
+
122
+ ---
123
+
80
124
  ## Step 4: Approval Gate
81
125
 
82
126
  **ExitPlanMode**
@@ -93,6 +137,42 @@ Tasks are only created after explicit approval. This is the point of /blueprint.
93
137
 
94
138
  ---
95
139
 
140
+ ## Feature-Scoped Mode (Optional)
141
+
142
+ When $ARGUMENTS points to a spec file (`.claude/specs/*.md`) OR contains a named feature:
143
+
144
+ ```bash
145
+ # Detect spec file
146
+ [ -f "$ARGUMENTS" ] && echo "spec-mode" || echo "inline-mode"
147
+
148
+ # Determine next feature number
149
+ NEXT_N=$(ls .claude/features/ 2>/dev/null | grep -c '^' || echo 0)
150
+ N=$(printf '%02d' $((NEXT_N + 1)))
151
+ SLUG=$(basename "$ARGUMENTS" .md 2>/dev/null || echo "$ARGUMENTS" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-' | cut -c1-40)
152
+ FEATURE_DIR=".claude/features/${N}-${SLUG}"
153
+ ```
154
+
155
+ If spec file provided → create a feature-scoped directory:
156
+ ```bash
157
+ mkdir -p "$FEATURE_DIR"
158
+ cp "$ARGUMENTS" "$FEATURE_DIR/spec.md"
159
+ ```
160
+
161
+ Write the plan to `$FEATURE_DIR/plan.md` (same format as `.claude/plan.md`).
162
+ Also write a summary entry to `.claude/plan.md` linking to the feature:
163
+ ```markdown
164
+ ## Feature: {N}-{slug}
165
+ Files: .claude/features/{N}-{slug}/plan.md
166
+ Status: pending
167
+ ```
168
+
169
+ This keeps the global plan.md as the tracker while feature details live in their own directory.
170
+ Each feature directory is self-contained: `spec.md` + `plan.md` + any generated artifacts.
171
+
172
+ **When NOT to use feature mode:** quick fixes, single-file changes, copilot mode (uses global plan.md).
173
+
174
+ ---
175
+
96
176
  ## Copilot Mode — Structured plan.md Output
97
177
 
98
178
  When running inside `/copilot` (detected by: `.claude/copilot-intent.md` exists):
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: clarify
3
+ description: >
4
+ Resolve ambiguity in a feature request, spec, milestone, or task BEFORE any planning or coding.
5
+ Triggers on: "clarify this", "what do you mean by", "I'm not sure what to build", "vague spec",
6
+ "clarify the requirements", "before we plan", "let's get clear on", "help me define",
7
+ "what exactly should it do", "I need to think through", "unclear requirements",
8
+ "what are the acceptance criteria", "define the scope", "what's in scope", "what's out of scope",
9
+ "who is this for", "what does done look like", "edge cases for", "what should happen when",
10
+ "clarify before building", "let's clarify before we start".
11
+ NOT triggered by: "add X", "implement X", "build X" alone — those go to /add directly.
12
+ argument-hint: "[feature description, milestone text, or spec to clarify]"
13
+ disable-model-invocation: true
14
+ allowed-tools: Read, Bash, Glob, Grep
15
+ ---
16
+
17
+ # /clarify — Resolve Before Planning
18
+
19
+ $ARGUMENTS
20
+
21
+ **EnterPlanMode** — read and think only. No file modifications.
22
+
23
+ ---
24
+
25
+ ## Purpose
26
+
27
+ Clarification runs BEFORE /blueprint and BEFORE /spec.
28
+ A vague input into /blueprint produces a vague plan. A vague plan produces wrong code.
29
+ This command produces a `.claude/specs/{slug}.md` with unambiguous, testable requirements.
30
+
31
+ ---
32
+
33
+ ## Step 1: Parse Input
34
+
35
+ If $ARGUMENTS is a milestone from plan.md → read `.claude/plan.md` to find it.
36
+ If $ARGUMENTS is a feature description → use it directly.
37
+ If $ARGUMENTS is blank → use **AskUserQuestion**: "What should I help clarify?"
38
+
39
+ Extract from the input:
40
+ - The goal (what problem this solves, for whom)
41
+ - Anything already specified (concrete details)
42
+ - Anything ambiguous or missing
43
+
44
+ ---
45
+
46
+ ## Step 2: Project Context
47
+
48
+ Read existing context to ask informed questions:
49
+
50
+ ```bash
51
+ # Stack and domain
52
+ grep -i "domain:\|stack:\|scale:" CLAUDE.md 2>/dev/null | head -5
53
+
54
+ # Existing patterns similar to this feature
55
+ grep -ri "$ARGUMENTS" --include="*.ts" --include="*.py" --include="*.js" -l 2>/dev/null | head -5
56
+
57
+ # Current constitution (if exists)
58
+ cat .claude/constitution.md 2>/dev/null | head -20
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Step 3: Structured Interrogation
64
+
65
+ Ask ONLY the questions that are genuinely unresolved — maximum 5 questions at once.
66
+
67
+ Use **AskUserQuestion** with these categories (skip any already answered in $ARGUMENTS):
68
+
69
+ **Goal**
70
+ - What problem does this solve? Who experiences it?
71
+ - What does success look like from the user's perspective?
72
+
73
+ **Scope boundary**
74
+ - What is explicitly OUT of scope for this version?
75
+ - What's the minimal version that still solves the problem?
76
+
77
+ **Acceptance criteria**
78
+ - How will we know it's done? (list 2-3 concrete, testable criteria)
79
+ - What does a passing state look like vs. a failing state?
80
+
81
+ **Failure modes**
82
+ - What's the worst thing that could go wrong?
83
+ - What should happen when X fails? (fill in X from the feature)
84
+
85
+ **Constraints**
86
+ - Any performance, security, or backwards-compatibility requirements?
87
+ - Any existing code this must integrate with?
88
+
89
+ Do NOT ask about implementation details — only about behavior and requirements.
90
+
91
+ ---
92
+
93
+ ## Step 4: Write the Clarified Spec
94
+
95
+ After answers received, generate a slug from $ARGUMENTS:
96
+ ```bash
97
+ SLUG=$(echo "$ARGUMENTS" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-' | cut -c1-40)
98
+ mkdir -p .claude/specs
99
+ ```
100
+
101
+ Write `.claude/specs/${SLUG}.md`:
102
+
103
+ ```markdown
104
+ # Spec: {feature title}
105
+ clarified: {today's date}
106
+ status: ready-for-blueprint
107
+
108
+ ## Goal
109
+ {who uses this and what problem it solves — 1-2 sentences}
110
+
111
+ ## User Stories
112
+ - As a {user type}, I want to {action} so that {outcome}
113
+ - As a {user type}, I want to {action} so that {outcome}
114
+
115
+ ## Acceptance Criteria
116
+ 1. {concrete, testable — "given X, when Y, then Z" format}
117
+ 2. {concrete, testable}
118
+ 3. {concrete, testable}
119
+
120
+ ## Out of Scope
121
+ - {explicitly excluded item}
122
+ - {explicitly excluded item}
123
+
124
+ ## Failure Modes
125
+ - {what happens when X fails — expected behavior}
126
+ - {what happens when Y fails — expected behavior}
127
+
128
+ ## Constraints
129
+ - {performance / security / compatibility requirement, or "none"}
130
+
131
+ ## Open Questions
132
+ - {any remaining unknowns — low priority, answer before implementation if possible}
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Step 5: Next Step
138
+
139
+ **ExitPlanMode**
140
+
141
+ Output:
142
+ ```
143
+ Spec written: .claude/specs/{slug}.md
144
+ Acceptance criteria: N
145
+ Open questions: N (or "none")
146
+
147
+ Next: /blueprint .claude/specs/{slug}.md
148
+ ```
149
+
150
+ If open questions remain → ask user to resolve them before /blueprint.
151
+ If no open questions → declare spec ready.
152
+
153
+ ---
154
+
155
+ ## Completion Rule
156
+
157
+ Show: the spec file path.
158
+ Show: acceptance criteria count.
159
+ Show: any open questions.
160
+ Do not write any code during /clarify — ever.
@@ -0,0 +1,190 @@
1
+ ---
2
+ name: constitute
3
+ description: >
4
+ Write or update the project constitution — explicit ground rules that govern all AI behavior.
5
+ Distinct from CLAUDE.md (operational config). The constitution is human-authored governance.
6
+ Triggers on: "write a constitution", "set ground rules", "define project rules",
7
+ "what are the non-negotiables", "project principles", "project constraints",
8
+ "what should Claude never do", "define the definition of done", "coding standards",
9
+ "project-level rules", "forbidden patterns", "required patterns",
10
+ "project constitution", "set constraints", "governance rules",
11
+ "architectural principles", "project norms", "what are our standards",
12
+ "define our conventions", "constitution for this project", "write the rules".
13
+ argument-hint: "[blank to create interactively, or path to existing constitution to update]"
14
+ disable-model-invocation: true
15
+ allowed-tools: Read, Write, Bash, Glob, Grep
16
+ ---
17
+
18
+ # /constitute — Write the Project Constitution
19
+
20
+ $ARGUMENTS
21
+
22
+ ---
23
+
24
+ ## Purpose
25
+
26
+ The constitution is the highest-priority governance document in a project.
27
+ It is written by the **human**, not generated from code.
28
+ Every /add, /fix, /blueprint, and /copilot milestone checks it before implementing.
29
+
30
+ **Hierarchy:**
31
+ ```
32
+ constitution.md ← human governance (this command)
33
+ CLAUDE.md ← operational config (/setup)
34
+ plan.md ← current work (/blueprint)
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Step 1: Check Existing State
40
+
41
+ ```bash
42
+ # Check if constitution already exists
43
+ cat .claude/constitution.md 2>/dev/null | head -40
44
+
45
+ # Read CLAUDE.md for current project identity
46
+ grep -i "domain:\|stack:\|scale:\|priority" CLAUDE.md 2>/dev/null | head -10
47
+ ```
48
+
49
+ If constitution exists → present it and ask: "Update existing, or rewrite from scratch?"
50
+ If creating new → proceed to Step 2.
51
+
52
+ ---
53
+
54
+ ## Step 2: Guided Constitution Interview
55
+
56
+ Use **AskUserQuestion** — one group at a time. Do NOT ask all at once.
57
+
58
+ **Group 1: Non-negotiables**
59
+ - What must NEVER be done in this codebase? (e.g., no direct DB writes from controllers, no hardcoded credentials, no breaking API changes without versioning)
60
+ - What external libraries / frameworks are forbidden?
61
+
62
+ **Group 2: Required patterns**
63
+ - What patterns MUST always be used? (e.g., all state changes through events, all errors logged before thrown, all public APIs documented)
64
+ - What conventions are load-bearing? (change them and everything breaks)
65
+
66
+ **Group 3: Definition of Done**
67
+ - What does "done" mean for this project? (tests pass? PR review? deployed? docs updated?)
68
+ - What quality gates must every change pass?
69
+
70
+ **Group 4: Architectural commitments**
71
+ - What architectural decisions are already settled and not open for debate? (e.g., "we use PostgreSQL, not MongoDB", "all services are REST, not GraphQL")
72
+ - What is the source of truth for data? For auth? For state?
73
+
74
+ **Group 5: Scope and values**
75
+ - Who are the users and what do they value most? (performance? simplicity? reliability?)
76
+ - What should be optimized for when priorities conflict?
77
+
78
+ ---
79
+
80
+ ## Step 3: Write the Constitution
81
+
82
+ Write `.claude/constitution.md`:
83
+
84
+ ```markdown
85
+ # Project Constitution
86
+ project: {project name from CLAUDE.md}
87
+ created: {today's date}
88
+ last_updated: {today's date}
89
+ version: 1
90
+
91
+ ---
92
+
93
+ ## Non-Negotiables (Never Do This)
94
+
95
+ These rules are inviolable. No exception, no matter the deadline or pressure.
96
+
97
+ - {rule — specific and verifiable}
98
+ - {rule — specific and verifiable}
99
+ - {rule — specific and verifiable}
100
+
101
+ ## Required Patterns (Always Do This)
102
+
103
+ These patterns must be used in all new code. Deviations require explicit approval.
104
+
105
+ - {pattern — specific and verifiable}
106
+ - {pattern — specific and verifiable}
107
+
108
+ ## Forbidden Dependencies
109
+
110
+ Libraries, frameworks, or services that must never be introduced:
111
+
112
+ - {dependency — with reason}
113
+
114
+ ## Architectural Commitments
115
+
116
+ Decisions already made. Not open for debate without a /debate session.
117
+
118
+ | Concern | Decision | Reason |
119
+ |---------|----------|--------|
120
+ | Database | {choice} | {reason} |
121
+ | Auth | {choice} | {reason} |
122
+ | API style | {choice} | {reason} |
123
+ | {other} | {choice} | {reason} |
124
+
125
+ ## Definition of Done
126
+
127
+ A change is only "done" when ALL of the following are true:
128
+
129
+ - [ ] {criterion — e.g., "tests pass (npm test exits 0)"}
130
+ - [ ] {criterion — e.g., "PR review approved"}
131
+ - [ ] {criterion — e.g., "no new lint warnings"}
132
+ - [ ] {criterion — e.g., "relevant docs updated"}
133
+
134
+ ## Priority Hierarchy
135
+
136
+ When requirements conflict, resolve in this order:
137
+
138
+ 1. {highest priority — e.g., "Data integrity over performance"}
139
+ 2. {second priority}
140
+ 3. {third priority}
141
+
142
+ ## User Values
143
+
144
+ Users of this project value (in order): {e.g., "reliability > speed > features"}
145
+ Optimise in this order when trade-offs arise.
146
+
147
+ ---
148
+
149
+ _This constitution governs all AI actions in this project.
150
+ Any command (/add, /fix, /copilot) must check this file before implementing._
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Step 4: Wire It Into the Workflow
156
+
157
+ After writing, update CLAUDE.md to reference the constitution:
158
+
159
+ ```bash
160
+ grep -q "constitution" CLAUDE.md && echo "already referenced" || echo "needs wiring"
161
+ ```
162
+
163
+ If not referenced → add to CLAUDE.md Rules section:
164
+ ```
165
+ ## Rules
166
+ ...
167
+ N. **Constitution** — Read `.claude/constitution.md` before any implementation. Non-negotiables override all other instructions.
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Completion Rule
173
+
174
+ Show:
175
+ 1. Constitution file path: `.claude/constitution.md`
176
+ 2. Count of non-negotiables
177
+ 3. Count of required patterns
178
+ 4. Definition of done criteria count
179
+ 5. Whether CLAUDE.md was updated
180
+
181
+ Output:
182
+ ```
183
+ Constitution written: .claude/constitution.md
184
+ Non-negotiables: N rules
185
+ Required patterns: N rules
186
+ Definition of done: N criteria
187
+ CLAUDE.md: updated / already referenced
188
+
189
+ Every /add, /fix, and /copilot milestone will now check this file.
190
+ ```
@@ -49,17 +49,33 @@ Read these files (skip any that don't exist):
49
49
 
50
50
  ---
51
51
 
52
+ ## Step 1b: Governance Check
53
+
54
+ ```bash
55
+ [ -f .claude/constitution.md ] && echo "constitution=found" || echo "constitution=missing"
56
+ ls .claude/specs/*.md 2>/dev/null | head -5
57
+ ```
58
+
59
+ If constitution missing → note in goals.md: "No constitution — run /constitute to define project rules"
60
+ (Do NOT block execution — constitution is recommended, not required)
61
+
62
+ ---
63
+
52
64
  ## Step 2: Decide What To Do
53
65
 
54
66
  Follow this decision tree in order:
55
67
 
56
68
  1. **No CLAUDE.md filled?** → Run `/setup` with the intent from copilot-intent.md
57
- 2. **No plan.md?** → Run `/blueprint` to generate a milestone plan
58
- 3. **Plan has incomplete milestones?** → Find the next one (respecting dependencies), implement it
59
- 4. **3 milestones done since last /evolve?** → Run `/evolve` first, then continue
60
- 5. **All milestones done?**Run `/audit` on the full project
61
- 6. **Review passes?**Run `/ship` and deploy
62
- 7. **Deploy succeeds?** Write `COPILOT_COMPLETE` to goals.md, generate copilot-report.md
69
+ 2. **No plan.md but specs exist?** → Run `/blueprint .claude/specs/{latest-spec}` to derive plan from spec
70
+ 3. **No plan.md, no specs?** → Run `/blueprint` to generate a milestone plan from intent
71
+ 4. **Plan has incomplete milestones?** → Find the next one (respecting dependencies):
72
+ - If `constitution.md` existsspawn `constitution-guard` agent with milestone details before implementing
73
+ - If constitution-guard returns VIOLATION log to `blockers.md`, skip this milestone, continue to next
74
+ - If APPROVED (or no constitution) implement the milestone
75
+ 5. **3 milestones done since last /evolve?** → Run `/evolve` first, then continue
76
+ 6. **All milestones done?** → Run `/analyze` then `/audit` on the full project
77
+ 7. **Review passes?** → Run `/ship` and deploy
78
+ 8. **Deploy succeeds?** → Write `COPILOT_COMPLETE` to goals.md, generate copilot-report.md
63
79
 
64
80
  ---
65
81
 
@@ -92,18 +108,24 @@ For each milestone in plan.md:
92
108
  After every 3 completed milestones:
93
109
  1. Run `/reflexes analyze` — detect patterns from tool-use observations, create/update reflexes
94
110
  2. Run `/evolve` — scans git history for patterns, creates agents if evidence found
95
- 3. Check if CLAUDE.md conventions need updating
96
- 4. Re-read plan.md re-evaluate remaining milestone priorities
97
- 5. If a blocked milestone can now be unblocked (new agents/context available) retry it
111
+ 3. Run `/analyze` check for GHOST milestones (marked done but not implemented) and spec→plan drift
112
+ - If GHOST milestones found → set their status back to `pending` in plan.md, add back to queue
113
+ - If spec drift found log gap to `.claude/memory/blockers.md` as a fix milestone
114
+ 4. Check if CLAUDE.md conventions need updating
115
+ 5. Re-read plan.md — re-evaluate remaining milestone priorities
116
+ 6. If a blocked milestone can now be unblocked (new agents/context available) → retry it
98
117
 
99
118
  ---
100
119
 
101
120
  ## Step 5: Final Review
102
121
 
103
122
  When all milestones show status `done` (or `blocked` with no unblock path):
104
- 1. Run `/audit` on the full project against copilot-intent.md
105
- 2. If review finds gapscreate fix milestones, add to plan.md, continue building
106
- 3. If review passes → proceed to ship
123
+ 1. Run `/analyze` verify all done milestones are actually implemented (no GHOSTs)
124
+ - If GHOST milestones foundre-open them, add as fix milestones, continue building
125
+ - If /analyze shows consistency ≥ 90% → proceed
126
+ 2. Run `/audit` on the full project against copilot-intent.md
127
+ 3. If review finds gaps → create fix milestones, add to plan.md, continue building
128
+ 4. If review passes → proceed to ship
107
129
 
108
130
  ---
109
131
 
@@ -126,12 +126,43 @@ All ✓ required before printing "project ready."
126
126
 
127
127
  ---
128
128
 
129
+ ## Phase 5: Spec-Driven Readiness
130
+
131
+ After quality gate passes, check and suggest the spec-driven workflow:
132
+
133
+ ```bash
134
+ [ -f .claude/constitution.md ] && echo "constitution=found" || echo "constitution=missing"
135
+ ls .claude/specs/*.md 2>/dev/null | head -3
136
+ ```
137
+
138
+ Always output this next-steps block:
139
+
140
+ ```
141
+ ─── Spec-Driven Workflow: Next Steps ────────────────────
142
+ 1. /constitute — define project ground rules (non-negotiables, required patterns,
143
+ definition of done). Copilot checks this before every milestone.
144
+
145
+ 2. /spec [feature] — write a structured spec for your first feature.
146
+ Produces: user stories + acceptance criteria + out-of-scope.
147
+ Feeds directly into /blueprint for a better plan.
148
+
149
+ 3. /clarify [spec] — resolve any open questions in the spec before planning.
150
+
151
+ 4. /blueprint [spec] — derive a milestone plan from the spec.
152
+ spec-reviewer validates quality before planning starts.
153
+
154
+ 5. /copilot — autonomous execution: spec → plan → build → test → ship.
155
+ ─────────────────────────────────────────────────────────
156
+ ```
157
+
158
+ ---
159
+
129
160
  ## Completion Rule
130
161
 
131
162
  Show:
132
163
  1. The created `CLAUDE.md` (full content)
133
164
  2. The created `goals.md` (full content)
134
165
  3. The level checklist (what was built)
135
- 4. First task to work on
166
+ 4. The spec-driven next steps block (always — even for existing projects)
136
167
 
137
168
  Do not say "project ready" without showing these four outputs.
@@ -90,7 +90,7 @@ If PLAN is empty: skip to Cycle 2.
90
90
 
91
91
  ---
92
92
 
93
- ## Cycle 2: Knowledge Consolidation (if sessions ≥ 3 since last consolidation)
93
+ ## Cycle 2: Knowledge Consolidation (if sessions ≥ 2 since last consolidation)
94
94
 
95
95
  Read `capabilities/evolution/cycle2-knowledge.md` and run.
96
96
  Outputs: consolidated patterns, pruned stale memory, enriched knowledge-index
@@ -225,6 +225,28 @@ This closes the loop: /evolve creates capability → orchestrator immediately re
225
225
 
226
226
  ---
227
227
 
228
+ ## Step 7f: Spec and Plan Drift Analysis
229
+
230
+ After generating/updating skills and agents, check for documentation drift:
231
+
232
+ ```bash
233
+ ls .claude/plan.md .claude/specs/*.md 2>/dev/null
234
+ ```
235
+
236
+ If plan.md exists → run `/analyze plan`:
237
+ - Identifies GHOST milestones (marked done but files missing)
238
+ - Surfaces dependency violations
239
+
240
+ Append drift findings to `ops/evolution-log.md`:
241
+ ```
242
+ | {date} | DRIFT | {N ghost milestones} | {N unplanned capabilities} | {1-line summary} |
243
+ ```
244
+
245
+ If GHOST milestones found → set their status back to `pending` in plan.md.
246
+ This closes a common drift loop: code gets deleted or renamed, plan.md still says done.
247
+
248
+ ---
249
+
228
250
  ## Step 8: Promote GENERAL Skills
229
251
 
230
252
  For any fix tagged GENERAL in EVALUATE:
@@ -14,6 +14,18 @@ Load: shared/tdd.md + shared/completion-rule.md before starting.
14
14
 
15
15
  ---
16
16
 
17
+ ## Pre-Flight: Constitution Check
18
+
19
+ ```bash
20
+ [ -f .claude/constitution.md ] && echo "constitution=found" || echo "no constitution"
21
+ ```
22
+
23
+ If found: read `## Non-Negotiables` before fixing.
24
+ The fix must not violate a non-negotiable — a "fix" that breaks a project rule is not a fix.
25
+ Flag any conflict explicitly before proceeding to Phase 1.
26
+
27
+ ---
28
+
17
29
  ## Pre-Flight Analysis (intelligent-dispatch)
18
30
 
19
31
  Load `shared/intelligent-dispatch.md`.