@raftlabs/raftstack 1.9.1 → 1.9.3
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/.claude/commands/raftstack/_planning-protocol.md +216 -0
- package/.claude/commands/raftstack/discover.md +53 -9
- package/.claude/commands/raftstack/help.md +63 -23
- package/.claude/commands/raftstack/index.md +49 -22
- package/.claude/commands/raftstack/init-context.md +54 -9
- package/.claude/commands/raftstack/inject.md +57 -11
- package/.claude/commands/raftstack/shape.md +102 -21
- package/.claude/settings.json +27 -0
- package/.claude/subagents/quick-fix.md +21 -0
- package/dist/cli.js +96 -28
- package/dist/cli.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# RaftStack Planning Protocol
|
|
2
|
+
|
|
3
|
+
**INTERNAL REFERENCE - NOT A USER-FACING COMMAND**
|
|
4
|
+
|
|
5
|
+
All RaftStack commands MUST follow this protocol to enforce plan-first workflows.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Core Principle
|
|
10
|
+
|
|
11
|
+
**NEVER implement before planning and getting explicit user approval.**
|
|
12
|
+
|
|
13
|
+
This protocol ensures:
|
|
14
|
+
- Users understand what will happen before it happens
|
|
15
|
+
- No accidental file modifications
|
|
16
|
+
- Changes align with user expectations
|
|
17
|
+
- Clear decision points with explicit approval gates
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Phase: Planning Gate (Required Before Implementation)
|
|
22
|
+
|
|
23
|
+
Before ANY file creation or modification:
|
|
24
|
+
|
|
25
|
+
### 1. Present Plan Summary
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
## 📋 Implementation Plan
|
|
29
|
+
|
|
30
|
+
### What Will Be Done
|
|
31
|
+
- [Bullet list of changes]
|
|
32
|
+
- [Standards that will be applied]
|
|
33
|
+
- [Files that will be created/modified]
|
|
34
|
+
|
|
35
|
+
### Files to Create/Modify
|
|
36
|
+
| File | Action | Purpose |
|
|
37
|
+
|------|--------|---------|
|
|
38
|
+
| [path] | [create/modify] | [why] |
|
|
39
|
+
|
|
40
|
+
### Standards Applied
|
|
41
|
+
- [List relevant RaftLabs standards]
|
|
42
|
+
- [Conventions being enforced]
|
|
43
|
+
|
|
44
|
+
### Estimated Scope
|
|
45
|
+
- [N] files affected
|
|
46
|
+
- [Complexity: Simple/Medium/Complex]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Request Approval via AskUserQuestion
|
|
50
|
+
|
|
51
|
+
**REQUIRED:** Use the `AskUserQuestion` tool with these options:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"questions": [{
|
|
56
|
+
"question": "Ready to proceed with this implementation?",
|
|
57
|
+
"header": "Approval",
|
|
58
|
+
"multiSelect": false,
|
|
59
|
+
"options": [
|
|
60
|
+
{
|
|
61
|
+
"label": "Proceed with implementation",
|
|
62
|
+
"description": "Start implementing the plan as presented"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"label": "Modify the plan",
|
|
66
|
+
"description": "Revise the approach before implementing"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"label": "Show more details",
|
|
70
|
+
"description": "Provide additional context about the plan"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"label": "Cancel",
|
|
74
|
+
"description": "Stop and do not implement"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 3. Implementation Rules
|
|
82
|
+
|
|
83
|
+
#### ✅ ALWAYS:
|
|
84
|
+
- Wait for explicit "Proceed with implementation" selection
|
|
85
|
+
- Present complete plan before asking for approval
|
|
86
|
+
- If user selects "Modify the plan", revise and re-present with new approval gate
|
|
87
|
+
- If user selects "Show more details", expand explanation then re-ask for approval
|
|
88
|
+
- If user selects "Cancel", stop all implementation activities
|
|
89
|
+
|
|
90
|
+
#### ❌ NEVER:
|
|
91
|
+
- Skip the approval step
|
|
92
|
+
- Implement before presenting the plan
|
|
93
|
+
- Assume approval from partial agreement
|
|
94
|
+
- Proceed without explicit "Proceed" selection
|
|
95
|
+
- Create or modify files during the planning phase
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Standard Planning Gate Template
|
|
100
|
+
|
|
101
|
+
Use this template in command files:
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
## ⚠️ PLANNING GATE
|
|
105
|
+
|
|
106
|
+
**DO NOT [ACTION] WITHOUT USER APPROVAL**
|
|
107
|
+
|
|
108
|
+
Before [specific action]:
|
|
109
|
+
|
|
110
|
+
1. **Present the Plan:**
|
|
111
|
+
- What will be done
|
|
112
|
+
- Files affected
|
|
113
|
+
- Standards applied
|
|
114
|
+
- Expected outcomes
|
|
115
|
+
|
|
116
|
+
2. **Request Approval:**
|
|
117
|
+
Use `AskUserQuestion` with these options:
|
|
118
|
+
- [A] Proceed with implementation (Recommended)
|
|
119
|
+
- [B] Modify the plan
|
|
120
|
+
- [C] Show more details
|
|
121
|
+
- [D] Cancel
|
|
122
|
+
|
|
123
|
+
3. **Implementation Rules:**
|
|
124
|
+
- ✅ Wait for explicit "Proceed" approval
|
|
125
|
+
- ✅ If "Modify" selected, revise plan and re-present
|
|
126
|
+
- ✅ If "Show details" selected, expand then re-ask
|
|
127
|
+
- ❌ Never skip approval gate
|
|
128
|
+
- ❌ Never implement without [A] selection
|
|
129
|
+
- ❌ Never create/modify files during planning
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## When to Use Planning Gates
|
|
135
|
+
|
|
136
|
+
### Required Gates (Every Command):
|
|
137
|
+
1. **Before any file creation**
|
|
138
|
+
2. **Before any file modification**
|
|
139
|
+
3. **Before running code generators**
|
|
140
|
+
4. **Before applying bulk changes**
|
|
141
|
+
|
|
142
|
+
### Optional Gates (Use judgment):
|
|
143
|
+
- After complex analysis when user might want to adjust scope
|
|
144
|
+
- When presenting multiple implementation options
|
|
145
|
+
- When significant decisions affect downstream work
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Command-Specific Guidelines
|
|
150
|
+
|
|
151
|
+
### `/raftstack/shape`
|
|
152
|
+
- Gate after complexity assessment (Quick/Light/Full)
|
|
153
|
+
- Gate before implementation phase
|
|
154
|
+
- All three complexity levels require approval
|
|
155
|
+
|
|
156
|
+
### `/raftstack/discover`
|
|
157
|
+
- Gate after pattern analysis
|
|
158
|
+
- Gate before creating standard files
|
|
159
|
+
- Gate before applying discovered standards
|
|
160
|
+
|
|
161
|
+
### `/raftstack/inject`
|
|
162
|
+
- No file modifications - guidance only
|
|
163
|
+
- Recommend `/raftstack/shape` for actual implementation
|
|
164
|
+
- Remind user that injected context is for planning
|
|
165
|
+
|
|
166
|
+
### `/raftstack/init-context`
|
|
167
|
+
- Gate after presenting constitution preview
|
|
168
|
+
- Gate before writing constitution file
|
|
169
|
+
|
|
170
|
+
### `/raftstack/index`
|
|
171
|
+
- Gate before creating/updating registry file
|
|
172
|
+
- Gate before resolving drift (file modifications)
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Example Flow
|
|
177
|
+
|
|
178
|
+
**Good:**
|
|
179
|
+
```
|
|
180
|
+
1. User: "/raftstack/shape Add login button"
|
|
181
|
+
2. Claude: [Analyzes, creates plan]
|
|
182
|
+
3. Claude: [Presents plan summary]
|
|
183
|
+
4. Claude: [Uses AskUserQuestion for approval]
|
|
184
|
+
5. User: [Selects "Proceed"]
|
|
185
|
+
6. Claude: [Implements plan]
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Bad:**
|
|
189
|
+
```
|
|
190
|
+
1. User: "/raftstack/shape Add login button"
|
|
191
|
+
2. Claude: [Analyzes]
|
|
192
|
+
3. Claude: [Immediately starts creating files] ❌
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Enforcement Strategy
|
|
198
|
+
|
|
199
|
+
This protocol relies on **instruction-based enforcement** because:
|
|
200
|
+
- Plan mode cannot be programmatically triggered
|
|
201
|
+
- Hooks execute after tool calls, can't prevent them
|
|
202
|
+
- No settings exist to enforce plan-first workflows
|
|
203
|
+
|
|
204
|
+
**Strong imperative language** ("DO NOT", "MUST", "NEVER") in command prompts is the most reliable enforcement mechanism.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Verification Checklist
|
|
209
|
+
|
|
210
|
+
Before considering a command complete:
|
|
211
|
+
|
|
212
|
+
- [ ] Planning gate added before all file operations
|
|
213
|
+
- [ ] `AskUserQuestion` tool configured with standard options
|
|
214
|
+
- [ ] Clear instructions about when to implement
|
|
215
|
+
- [ ] "DO NOT IMPLEMENT WITHOUT APPROVAL" warning present
|
|
216
|
+
- [ ] Command references this protocol file
|
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Analyze a specific area of the codebase and extract patterns into reusable standards.
|
|
4
4
|
|
|
5
|
+
## 🔒 Planning Protocol
|
|
6
|
+
|
|
7
|
+
This command follows the RaftStack Planning Protocol:
|
|
8
|
+
- All changes are planned before implementation
|
|
9
|
+
- User approval is required before creating standard files
|
|
10
|
+
- Use `AskUserQuestion` for all approval gates
|
|
11
|
+
|
|
12
|
+
**Reference:** See `_planning-protocol.md` for full protocol details.
|
|
13
|
+
|
|
5
14
|
## Arguments
|
|
6
15
|
|
|
7
16
|
- `$ARGUMENTS` - (Optional) Focus area to analyze (e.g., "API", "components", "database", "error handling")
|
|
@@ -11,6 +20,7 @@ Analyze a specific area of the codebase and extract patterns into reusable stand
|
|
|
11
20
|
**IMPORTANT:** Always use the `AskUserQuestion` tool for:
|
|
12
21
|
- Focus area selection
|
|
13
22
|
- Standard creation decisions
|
|
23
|
+
- **Standard file creation approval** (required before writing files)
|
|
14
24
|
- Location negotiation
|
|
15
25
|
- Option selection
|
|
16
26
|
|
|
@@ -35,6 +45,12 @@ If no focus area provided, use `AskUserQuestion` with these options:
|
|
|
35
45
|
|
|
36
46
|
## Phase 2: Deep Pattern Analysis
|
|
37
47
|
|
|
48
|
+
**IMPORTANT:** When researching patterns or understanding existing code:
|
|
49
|
+
- Use `context7` plugin to get latest documentation for any libraries detected
|
|
50
|
+
- Example: If analyzing React patterns, use context7 to get React 19 docs
|
|
51
|
+
- Example: If analyzing Drizzle ORM, use context7 to get current Drizzle docs
|
|
52
|
+
- This ensures standards are based on current best practices
|
|
53
|
+
|
|
38
54
|
For the selected area, analyze:
|
|
39
55
|
|
|
40
56
|
1. **Find representative files:**
|
|
@@ -89,14 +105,35 @@ After analyzing patterns, present:
|
|
|
89
105
|
1. **[Standard Name]** - Captures: [what pattern]
|
|
90
106
|
2. **[Standard Name]** - Captures: [what pattern]
|
|
91
107
|
3. **[Standard Name]** - Captures: [what pattern]
|
|
92
|
-
|
|
93
|
-
**Your options:** [A] Create all standards [B] Select specific standards [C] Analyze another area [D] Skip standardization
|
|
94
108
|
```
|
|
95
109
|
|
|
96
|
-
|
|
110
|
+
#### ⚠️ PLANNING GATE (Before Standard Creation)
|
|
111
|
+
|
|
112
|
+
**DO NOT CREATE STANDARD FILES WITHOUT USER APPROVAL**
|
|
113
|
+
|
|
114
|
+
Before creating any standard files:
|
|
115
|
+
|
|
116
|
+
1. **Present the Pattern Analysis Above** (already done)
|
|
117
|
+
|
|
118
|
+
2. **Request Approval** using `AskUserQuestion` with these options:
|
|
119
|
+
- [A] Create all standards (Recommended)
|
|
120
|
+
- [B] Select specific standards
|
|
121
|
+
- [C] Analyze another area first
|
|
122
|
+
- [D] Skip standardization
|
|
123
|
+
|
|
124
|
+
3. **Implementation Rules:**
|
|
125
|
+
- ✅ Wait for explicit [A] or [B] selection before creating files
|
|
126
|
+
- ✅ If [A] selected, create all recommended standards
|
|
127
|
+
- ✅ If [B] selected, ask which standards to create, then proceed
|
|
128
|
+
- ✅ If [C] selected, return to Phase 1 for new area
|
|
129
|
+
- ✅ If [D] selected, skip standard creation
|
|
130
|
+
- ❌ Never skip approval
|
|
131
|
+
- ❌ Never create standard files without [A] or [B] selection
|
|
97
132
|
|
|
98
133
|
## Phase 4: Standard Creation
|
|
99
134
|
|
|
135
|
+
**ONLY proceed to this phase after receiving approval in Phase 3 Planning Gate.**
|
|
136
|
+
|
|
100
137
|
For each selected pattern, create a standard document:
|
|
101
138
|
|
|
102
139
|
```markdown
|
|
@@ -130,13 +167,20 @@ For each selected pattern, create a standard document:
|
|
|
130
167
|
- [Link to related skill if applicable]
|
|
131
168
|
```
|
|
132
169
|
|
|
133
|
-
## Phase 5: Location
|
|
170
|
+
## Phase 5: Standard File Location
|
|
134
171
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
172
|
+
Standards are always saved at: `.claude/standards/[area]/[standard-name].md`
|
|
173
|
+
|
|
174
|
+
**Directory Structure:**
|
|
175
|
+
```
|
|
176
|
+
.claude/standards/
|
|
177
|
+
├── api/
|
|
178
|
+
├── react/
|
|
179
|
+
├── database/
|
|
180
|
+
└── REGISTRY.md
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Note:** For business documentation (user flows, edge cases, PRDs), use `docs/` instead.
|
|
140
184
|
|
|
141
185
|
## Phase 6: Completion Summary
|
|
142
186
|
|
|
@@ -15,29 +15,60 @@ Never use plain text questions - always use the structured `AskUserQuestion` too
|
|
|
15
15
|
|
|
16
16
|
Check for existing RaftStack artifacts:
|
|
17
17
|
|
|
18
|
-
###
|
|
19
|
-
- `.claude/context/constitution.md` →
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
###
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
-
|
|
18
|
+
### Technical Documentation (`.claude/`)
|
|
19
|
+
- `.claude/context/constitution.md` → Project constitution
|
|
20
|
+
- `.claude/standards/**/*.md` → Coding standards
|
|
21
|
+
- `.claude/standards/REGISTRY.md` → Standards registry
|
|
22
|
+
- `.claude/specs/**/*` → Feature specifications
|
|
23
|
+
- `.claude/skills/*/SKILL.md` → RaftStack skills
|
|
24
|
+
|
|
25
|
+
### Required Marketplaces
|
|
26
|
+
Check if required Claude Code marketplaces are installed:
|
|
27
|
+
|
|
28
|
+
1. **Check for marketplace directories:**
|
|
29
|
+
- `~/.claude/plugins/marketplaces/claude-plugins-official/` → Official plugins
|
|
30
|
+
- `~/.claude/plugins/marketplaces/anthropic-agent-skills/` → Document skills
|
|
31
|
+
|
|
32
|
+
2. **If missing, note in Health Assessment for installation guidance**
|
|
33
|
+
|
|
34
|
+
### Business Documentation (`docs/`)
|
|
35
|
+
All business logic and product-specific files are stored in the `docs/` folder.
|
|
36
|
+
|
|
37
|
+
## Planning Protocol
|
|
38
|
+
|
|
39
|
+
**All RaftStack commands follow a plan-first workflow:**
|
|
40
|
+
- Commands always plan before implementing
|
|
41
|
+
- User approval is required before any file modifications
|
|
42
|
+
- Use `AskUserQuestion` for all approval gates
|
|
43
|
+
|
|
44
|
+
For details, see `.claude/commands/raftstack/_planning-protocol.md`
|
|
45
|
+
|
|
46
|
+
## RaftStack Folder Convention
|
|
47
|
+
|
|
48
|
+
### `.claude/` - Technical (AI Context)
|
|
49
|
+
```
|
|
50
|
+
.claude/
|
|
51
|
+
├── context/
|
|
52
|
+
│ └── constitution.md # Project patterns & structure
|
|
53
|
+
├── standards/
|
|
54
|
+
│ ├── REGISTRY.md # Index of all standards
|
|
55
|
+
│ ├── api/ # Domain-specific standards
|
|
56
|
+
│ ├── react/
|
|
57
|
+
│ └── database/
|
|
58
|
+
├── specs/
|
|
59
|
+
│ └── {timestamp}-{slug}/ # Feature specifications
|
|
60
|
+
├── skills/ # RaftStack skills
|
|
61
|
+
├── commands/
|
|
62
|
+
│ └── raftstack/
|
|
63
|
+
│ ├── _planning-protocol.md # Internal: Planning enforcement protocol
|
|
64
|
+
│ ├── shape.md # /raftstack/shape command
|
|
65
|
+
│ ├── discover.md # /raftstack/discover command
|
|
66
|
+
│ └── ... # Other commands
|
|
67
|
+
└── subagents/ # Subagent definitions
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### `docs/` - Business (Human-Facing)
|
|
71
|
+
Contains all business logic and product-specific documentation.
|
|
41
72
|
|
|
42
73
|
## Phase 2: Assess Project State
|
|
43
74
|
|
|
@@ -78,6 +109,15 @@ Show the user their current state:
|
|
|
78
109
|
| Registry | [✅ Found / ❌ Missing] | [path or -] |
|
|
79
110
|
| Specs | [[N] found / ❌ None] | [path or -] |
|
|
80
111
|
| Skills | [✅ Installed / ❌ Missing] | [path or -] |
|
|
112
|
+
| Plugins | [✅ Ready / ⚠️ Marketplaces missing] | `.claude/settings.json` |
|
|
113
|
+
|
|
114
|
+
### 🔌 Marketplace Status (if any missing)
|
|
115
|
+
| Marketplace | Status | Install Command |
|
|
116
|
+
|-------------|--------|-----------------|
|
|
117
|
+
| claude-plugins-official | [✅ Installed / ❌ Missing] | `claude plugins add claude-plugins-official` |
|
|
118
|
+
| anthropic-agent-skills | [✅ Installed / ❌ Missing] | `claude plugins add https://github.com/anthropics/skills` |
|
|
119
|
+
|
|
120
|
+
**Note:** If marketplaces are missing, run the install commands above, then restart Claude Code.
|
|
81
121
|
|
|
82
122
|
### Health Assessment
|
|
83
123
|
- **Overall:** [New / Partially Set Up / Ready / Needs Maintenance]
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Scan for standards files and maintain a registry. Works with any directory structure.
|
|
4
4
|
|
|
5
|
+
## 🔒 Planning Protocol
|
|
6
|
+
|
|
7
|
+
This command follows the RaftStack Planning Protocol:
|
|
8
|
+
- All changes are planned before implementation
|
|
9
|
+
- User approval is required before creating/updating registry file
|
|
10
|
+
- User approval is required before resolving drift (file modifications)
|
|
11
|
+
- Use `AskUserQuestion` for all approval gates
|
|
12
|
+
|
|
13
|
+
**Reference:** See `_planning-protocol.md` for full protocol details.
|
|
14
|
+
|
|
5
15
|
## Purpose
|
|
6
16
|
|
|
7
17
|
Keep track of all standards and context files in the project, regardless of where they're stored.
|
|
@@ -9,6 +19,8 @@ Keep track of all standards and context files in the project, regardless of wher
|
|
|
9
19
|
## Tool Usage
|
|
10
20
|
|
|
11
21
|
**IMPORTANT:** Always use the `AskUserQuestion` tool for:
|
|
22
|
+
- **Registry file creation/update approval** (required before writing files)
|
|
23
|
+
- **Drift resolution approval** (required before modifying files)
|
|
12
24
|
- Location negotiation
|
|
13
25
|
- Drift resolution decisions
|
|
14
26
|
- Follow-up options
|
|
@@ -17,23 +29,21 @@ Never use plain text questions - always use the structured `AskUserQuestion` too
|
|
|
17
29
|
|
|
18
30
|
## Phase 1: Scan for Standards
|
|
19
31
|
|
|
20
|
-
Search
|
|
32
|
+
Search for standards and context files:
|
|
21
33
|
|
|
22
|
-
1. **
|
|
23
|
-
- `.claude/standards/**/*.md`
|
|
24
|
-
- `.claude/context/**/*.md`
|
|
25
|
-
- `docs/standards/**/*.md`
|
|
26
|
-
- `standards/**/*.md`
|
|
27
|
-
- `*.standard.md` (root level)
|
|
34
|
+
1. **Canonical locations:**
|
|
35
|
+
- `.claude/standards/**/*.md` → Project standards
|
|
36
|
+
- `.claude/context/**/*.md` → Project context
|
|
28
37
|
|
|
29
|
-
2. **
|
|
30
|
-
- `CONSTITUTION.md`
|
|
31
|
-
- `.claude/context/constitution.md`
|
|
32
|
-
- `docs/constitution.md`
|
|
33
|
-
|
|
34
|
-
3. **Skills (RaftStack-provided):**
|
|
38
|
+
2. **Skills:**
|
|
35
39
|
- `.claude/skills/*/SKILL.md`
|
|
36
40
|
|
|
41
|
+
3. **Legacy locations (migration detection):**
|
|
42
|
+
- `docs/standards/**/*.md`, `standards/**/*.md`, `*.standard.md`
|
|
43
|
+
- `CONSTITUTION.md`, `docs/constitution.md`
|
|
44
|
+
|
|
45
|
+
If found at legacy locations, suggest migration to `.claude/`.
|
|
46
|
+
|
|
37
47
|
## Phase 2: Analyze Each File
|
|
38
48
|
|
|
39
49
|
For each discovered file, extract:
|
|
@@ -99,15 +109,11 @@ Reference standards in conversation:
|
|
|
99
109
|
- `/raftstack/inject [domain]` - Get relevant standards for a task
|
|
100
110
|
```
|
|
101
111
|
|
|
102
|
-
## Phase 4: Location
|
|
112
|
+
## Phase 4: Registry Location
|
|
103
113
|
|
|
104
|
-
|
|
105
|
-
- Option A: `.claude/standards/REGISTRY.md` - With standards (Recommended)
|
|
106
|
-
- Option B: `.claude/REGISTRY.md` - In Claude folder
|
|
107
|
-
- Option C: `docs/REGISTRY.md` - With documentation
|
|
108
|
-
- Option D: Other (let user specify)
|
|
114
|
+
The registry is always saved at: `.claude/standards/REGISTRY.md`
|
|
109
115
|
|
|
110
|
-
If a registry
|
|
116
|
+
If a registry exists at a legacy location (`.claude/REGISTRY.md` or `docs/REGISTRY.md`), inform the user and migrate it.
|
|
111
117
|
|
|
112
118
|
## Phase 5: Drift Detection
|
|
113
119
|
|
|
@@ -175,13 +181,34 @@ After scanning and creating the registry, present:
|
|
|
175
181
|
- **Option C:** Review violations - Check flagged files for compliance
|
|
176
182
|
- **Option D:** Done for now
|
|
177
183
|
|
|
178
|
-
**Your options:** [A] Fix orphaned [B] Document areas [C] Review violations [D] Done
|
|
179
184
|
```
|
|
180
185
|
|
|
181
|
-
|
|
186
|
+
#### ⚠️ PLANNING GATE (Before Creating/Updating Registry)
|
|
187
|
+
|
|
188
|
+
**DO NOT CREATE OR UPDATE REGISTRY FILE WITHOUT USER APPROVAL**
|
|
189
|
+
|
|
190
|
+
Before writing the registry file:
|
|
191
|
+
|
|
192
|
+
1. **Present the Indexing Summary Above** (already done)
|
|
193
|
+
|
|
194
|
+
2. **Request Approval** using `AskUserQuestion` with these options:
|
|
195
|
+
- [A] Create/update registry file (Recommended)
|
|
196
|
+
- [B] Fix orphaned standards first
|
|
197
|
+
- [C] Document undocumented areas first
|
|
198
|
+
- [D] Review violations first
|
|
199
|
+
- [E] Cancel (don't create registry)
|
|
200
|
+
|
|
201
|
+
3. **Implementation Rules:**
|
|
202
|
+
- ✅ Wait for explicit [A] selection before creating/updating registry
|
|
203
|
+
- ✅ If [B/C/D] selected, proceed to drift resolution (which has its own gates)
|
|
204
|
+
- ✅ If [E] selected, stop without creating registry
|
|
205
|
+
- ❌ Never skip approval
|
|
206
|
+
- ❌ Never create/update registry file without [A] selection
|
|
182
207
|
|
|
183
208
|
## Phase 7: Drift Resolution
|
|
184
209
|
|
|
210
|
+
**IMPORTANT:** Each drift resolution action requires its own approval gate.
|
|
211
|
+
|
|
185
212
|
If user chooses to address drift:
|
|
186
213
|
|
|
187
214
|
### Orphaned Standards
|
|
@@ -2,10 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Analyze this codebase and generate a constitution document that captures how this project works.
|
|
4
4
|
|
|
5
|
+
## 🔒 Planning Protocol
|
|
6
|
+
|
|
7
|
+
This command follows the RaftStack Planning Protocol:
|
|
8
|
+
- All changes are planned before implementation
|
|
9
|
+
- User approval is required before creating constitution file
|
|
10
|
+
- Use `AskUserQuestion` for all approval gates
|
|
11
|
+
|
|
12
|
+
**Reference:** See `_planning-protocol.md` for full protocol details.
|
|
13
|
+
|
|
5
14
|
## Tool Usage
|
|
6
15
|
|
|
7
16
|
**IMPORTANT:** Always use the `AskUserQuestion` tool for:
|
|
8
17
|
- Location negotiation (where to save files)
|
|
18
|
+
- **Constitution file creation approval** (required before writing file)
|
|
9
19
|
- Confirmation requests
|
|
10
20
|
- Clarification questions
|
|
11
21
|
|
|
@@ -124,7 +134,7 @@ Use `AskUserQuestion` to present options A/B/C/D.
|
|
|
124
134
|
|
|
125
135
|
## Phase 3: Generate Constitution
|
|
126
136
|
|
|
127
|
-
|
|
137
|
+
**IMPORTANT:** Prepare the constitution content but DO NOT write the file yet. Present it for approval first.
|
|
128
138
|
|
|
129
139
|
```markdown
|
|
130
140
|
# [Project Name] Constitution
|
|
@@ -166,17 +176,52 @@ Create a constitution document with these sections:
|
|
|
166
176
|
[User provides this - project goals, planned features]
|
|
167
177
|
```
|
|
168
178
|
|
|
169
|
-
## Phase 4:
|
|
179
|
+
## Phase 4: Constitution Preview & Approval Gate
|
|
180
|
+
|
|
181
|
+
Present the generated constitution content to the user for review:
|
|
182
|
+
|
|
183
|
+
```markdown
|
|
184
|
+
## 📋 Constitution Preview
|
|
185
|
+
|
|
186
|
+
[Show first 30-40 lines of generated constitution content]
|
|
187
|
+
|
|
188
|
+
...
|
|
189
|
+
|
|
190
|
+
[Full constitution will be saved to `.claude/context/constitution.md`]
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### ⚠️ PLANNING GATE (Before Creating Constitution File)
|
|
194
|
+
|
|
195
|
+
**DO NOT CREATE CONSTITUTION FILE WITHOUT USER APPROVAL**
|
|
196
|
+
|
|
197
|
+
Before writing the constitution file:
|
|
198
|
+
|
|
199
|
+
1. **Present the Constitution Preview Above** (already done)
|
|
200
|
+
|
|
201
|
+
2. **Request Approval** using `AskUserQuestion` with these options:
|
|
202
|
+
- [A] Create constitution file (Recommended)
|
|
203
|
+
- [B] Modify the constitution content
|
|
204
|
+
- [C] Show full preview
|
|
205
|
+
- [D] Cancel
|
|
206
|
+
|
|
207
|
+
3. **Implementation Rules:**
|
|
208
|
+
- ✅ Wait for explicit [A] selection before creating file
|
|
209
|
+
- ✅ If [B] selected, revise content and re-present
|
|
210
|
+
- ✅ If [C] selected, show full content and re-ask for approval
|
|
211
|
+
- ❌ Never skip approval
|
|
212
|
+
- ❌ Never create file without [A] selection
|
|
213
|
+
|
|
214
|
+
## Phase 5: Constitution Location
|
|
215
|
+
|
|
216
|
+
**ONLY proceed to this phase after receiving approval in Phase 4 Planning Gate.**
|
|
217
|
+
|
|
218
|
+
The constitution is always saved at: `.claude/context/constitution.md`
|
|
170
219
|
|
|
171
|
-
|
|
220
|
+
**Migration:** If a constitution exists at a legacy location (`CONSTITUTION.md` or `docs/constitution.md`), inform the user and offer to migrate it.
|
|
172
221
|
|
|
173
|
-
**
|
|
174
|
-
- Option A: `.claude/context/constitution.md` - Claude-specific context folder (Recommended)
|
|
175
|
-
- Option B: `docs/constitution.md` - With project documentation
|
|
176
|
-
- Option C: `CONSTITUTION.md` - At project root
|
|
177
|
-
- Option D: Other (let user specify)
|
|
222
|
+
**Note:** For business-facing documentation (PRD, stakeholder docs), use `docs/` instead.
|
|
178
223
|
|
|
179
|
-
## Phase
|
|
224
|
+
## Phase 6: Final Summary
|
|
180
225
|
|
|
181
226
|
After saving the constitution, present:
|
|
182
227
|
|