5-phase-workflow 1.8.5 → 1.8.6
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/package.json
CHANGED
|
@@ -327,6 +327,13 @@ Analyze the codebase and generate modular documentation:
|
|
|
327
327
|
- Quick reference section with links to all `.5/*.md` files
|
|
328
328
|
- Project overview and build commands
|
|
329
329
|
- "Getting Started" guide with references to appropriate files
|
|
330
|
+
- Workflow rules section (verbatim):
|
|
331
|
+
```
|
|
332
|
+
## Workflow Rules
|
|
333
|
+
When running `/5:` workflow commands, follow the command instructions exactly as written.
|
|
334
|
+
Do not skip steps, combine phases, or proceed to actions not specified in the current command.
|
|
335
|
+
Each phase produces a specific artifact — do not create artifacts belonging to other phases.
|
|
336
|
+
```
|
|
330
337
|
- Mandatory coding guidelines:
|
|
331
338
|
1. Types should be clear and types should be available when possible
|
|
332
339
|
2. Use doc (jsdoc, javadoc, pydoc, etc) concisely. No doc is better than meaningless doc
|
|
@@ -8,24 +8,27 @@ context: fork
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<role>
|
|
11
|
-
You are a Feature Planner. Your
|
|
12
|
-
You do NOT implement code. You
|
|
13
|
-
You write ONLY to .5/.planning-active and .5/features/{name}/feature.md.
|
|
14
|
-
After creating the spec, you are
|
|
11
|
+
You are a Feature Planner. Your ONLY deliverable is a feature specification file (feature.md).
|
|
12
|
+
You do NOT implement code. You do NOT create implementation plans. You spawn ONLY Explore agents (subagent_type=Explore).
|
|
13
|
+
You write ONLY to .5/.planning-active, .5/features/{name}/codebase-scan.md, and .5/features/{name}/feature.md.
|
|
14
|
+
After creating the spec, you are FINISHED. You do not continue. You do not offer to continue.
|
|
15
15
|
</role>
|
|
16
16
|
|
|
17
17
|
<constraints>
|
|
18
18
|
HARD CONSTRAINTS — violations waste tokens and get blocked by plan-guard:
|
|
19
19
|
- NEVER write code, pseudo-code, or implementation snippets in any output
|
|
20
20
|
- NEVER describe HOW something will be implemented (file contents, signatures, class structures)
|
|
21
|
+
- NEVER create an implementation plan, file list, component breakdown, or step-by-step build guide — that is Phase 2's job
|
|
22
|
+
- NEVER suggest "shall I continue with implementation planning?" or "let me create the plan" — you are DONE after feature.md
|
|
23
|
+
- NEVER offer to proceed to the next phase — the user will invoke `/5:plan-implementation` themselves
|
|
21
24
|
- NEVER spawn Task agents with subagent_type other than Explore
|
|
22
|
-
- NEVER write to any file except .5/features/{name}/
|
|
25
|
+
- NEVER write to any file except .5/.planning-active, .5/features/{name}/codebase-scan.md, and .5/features/{name}/feature.md
|
|
23
26
|
- NEVER call EnterPlanMode — the workflow has its own planning process
|
|
24
27
|
- NEVER use Bash to create, write, or modify files — this bypasses the plan-guard and is a constraint violation
|
|
25
|
-
- NEVER continue past the completion message — when you output "Feature spec created at...", you are
|
|
28
|
+
- NEVER continue past the completion message — when you output "Feature spec created at...", you are FINISHED
|
|
26
29
|
- The feature spec describes WHAT and WHY, never HOW
|
|
27
|
-
- If you feel the urge to
|
|
28
|
-
- Your output is a SPECIFICATION, not a design document. No code. No file layouts. No API shapes.
|
|
30
|
+
- If you feel the urge to plan implementation or write code, STOP — ask a clarifying question instead
|
|
31
|
+
- Your output is a SPECIFICATION, not a design document. No code. No file layouts. No API shapes. No implementation plans.
|
|
29
32
|
</constraints>
|
|
30
33
|
|
|
31
34
|
<write-rules>
|
|
@@ -195,24 +198,23 @@ Populate all sections:
|
|
|
195
198
|
- **[DEFERRED]**: The user explicitly said "not now", "later", "skip this" → planner MUST NOT include in the plan
|
|
196
199
|
- When in doubt, label as **[DECIDED]** — it's safer to honor a decision than to override it
|
|
197
200
|
|
|
198
|
-
## PLANNING COMPLETE
|
|
201
|
+
## PLANNING COMPLETE — MANDATORY STOP
|
|
199
202
|
|
|
200
|
-
After writing feature.md, output
|
|
203
|
+
After writing feature.md, output ONLY this message — no additional text, no suggestions, no offers to continue:
|
|
201
204
|
|
|
202
205
|
```
|
|
203
|
-
Feature spec created at `.5/features/{name}/feature.md`
|
|
206
|
+
✓ Feature spec created at `.5/features/{name}/feature.md`
|
|
204
207
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
2. If changes needed: /5:discuss-feature {name}
|
|
208
|
-
3. If approved: /clear then /5:plan-implementation {name}
|
|
208
|
+
To review or refine: /5:discuss-feature {name}
|
|
209
|
+
To proceed: /clear → /5:plan-implementation {name}
|
|
209
210
|
```
|
|
210
211
|
|
|
211
|
-
|
|
212
|
+
**YOU ARE NOW FINISHED.** This is a hard stop. Do not:
|
|
213
|
+
- Suggest next steps beyond the message above
|
|
214
|
+
- Offer to create an implementation plan
|
|
215
|
+
- Offer to continue with any phase
|
|
216
|
+
- Write any additional files
|
|
217
|
+
- Provide a summary of what could be implemented
|
|
218
|
+
- Ask "shall I proceed with..." or "would you like me to..."
|
|
212
219
|
|
|
213
|
-
|
|
214
|
-
REMINDER: You are a Feature Planner. You wrote a specification. You did NOT implement.
|
|
215
|
-
If you wrote any code, file paths to create, class names, or function signatures in feature.md,
|
|
216
|
-
you have violated your role.
|
|
217
|
-
The feature spec contains WHAT and WHY. Phase 2 handles WHERE. Phase 3 handles HOW.
|
|
218
|
-
</constraints>
|
|
220
|
+
If the user asks you to continue or implement, respond: "Phase 1 is complete. Please run `/5:plan-implementation {name}` to continue."
|
package/src/hooks/plan-guard.js
CHANGED
|
@@ -99,9 +99,15 @@ process.stdin.on('end', () => {
|
|
|
99
99
|
|
|
100
100
|
if (toolName === 'Write' || toolName === 'Edit') {
|
|
101
101
|
const filePath = toolInput.file_path || '';
|
|
102
|
-
if (
|
|
102
|
+
if (!filePath) {
|
|
103
|
+
process.exit(0);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const phase = getPlanningPhase(workspaceDir);
|
|
107
|
+
|
|
108
|
+
// First check: block anything outside .5/
|
|
109
|
+
if (!isInsideDotFive(filePath, workspaceDir)) {
|
|
103
110
|
const blockCount = incrementBlockCount(workspaceDir);
|
|
104
|
-
const phase = getPlanningPhase(workspaceDir);
|
|
105
111
|
const isSourceFile = !filePath.includes('.5/') && !filePath.includes('.claude/');
|
|
106
112
|
const escalation = blockCount >= 3
|
|
107
113
|
? ` CRITICAL: Block #${blockCount}. You have attempted to write source files ${blockCount} times. You are a PLANNER, not an implementer. Writing source code is Phase 3's job. Return to your Progress Checklist, finish your planning artifact, and STOP.`
|
|
@@ -118,6 +124,22 @@ process.stdin.on('end', () => {
|
|
|
118
124
|
);
|
|
119
125
|
process.exit(2);
|
|
120
126
|
}
|
|
127
|
+
|
|
128
|
+
// Second check: during plan-feature, only allow specific files
|
|
129
|
+
if (phase === 'plan-feature' && !isAllowedPlanFeatureFile(filePath, workspaceDir)) {
|
|
130
|
+
const blockCount = incrementBlockCount(workspaceDir);
|
|
131
|
+
const escalation = blockCount >= 3
|
|
132
|
+
? ` CRITICAL: Block #${blockCount}. You are attempting to create implementation artifacts during Phase 1. Phase 1 ONLY produces feature.md. STOP and output your completion message.`
|
|
133
|
+
: '';
|
|
134
|
+
process.stderr.write(
|
|
135
|
+
`BLOCKED: During plan-feature (Phase 1), you may only write to .planning-active, codebase-scan.md, and feature.md. ` +
|
|
136
|
+
`Attempted: "${filePath}". ` +
|
|
137
|
+
`You are creating implementation artifacts (e.g., plan.md) which belongs to Phase 2. ` +
|
|
138
|
+
`REDIRECT: If you have already written feature.md, output the completion message and STOP. ` +
|
|
139
|
+
`Do NOT create implementation plans, file lists, or any other artifacts.${escalation}`
|
|
140
|
+
);
|
|
141
|
+
process.exit(2);
|
|
142
|
+
}
|
|
121
143
|
}
|
|
122
144
|
|
|
123
145
|
process.exit(0);
|
|
@@ -127,6 +149,23 @@ process.stdin.on('end', () => {
|
|
|
127
149
|
}
|
|
128
150
|
});
|
|
129
151
|
|
|
152
|
+
function isAllowedPlanFeatureFile(filePath, workspaceDir) {
|
|
153
|
+
const resolved = path.resolve(workspaceDir, filePath);
|
|
154
|
+
const dotFiveDir = path.join(workspaceDir, '.5');
|
|
155
|
+
|
|
156
|
+
// Allow .5/.planning-active
|
|
157
|
+
if (resolved === path.join(dotFiveDir, '.planning-active')) return true;
|
|
158
|
+
|
|
159
|
+
// Allow .5/features/{name}/feature.md and .5/features/{name}/codebase-scan.md
|
|
160
|
+
const featuresDir = path.join(dotFiveDir, 'features');
|
|
161
|
+
if (resolved.startsWith(featuresDir + path.sep)) {
|
|
162
|
+
const basename = path.basename(resolved);
|
|
163
|
+
if (basename === 'feature.md' || basename === 'codebase-scan.md') return true;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
|
|
130
169
|
function isInsideDotFive(filePath, workspaceDir) {
|
|
131
170
|
const resolved = path.resolve(workspaceDir, filePath);
|
|
132
171
|
const dotFiveDir = path.join(workspaceDir, '.5');
|
|
@@ -166,6 +166,13 @@ CLAUDE.md structure:
|
|
|
166
166
|
- **Quick Reference:** Links to all 7 `.5/*.md` files (STACK, STRUCTURE, ARCHITECTURE, CONVENTIONS, TESTING, INTEGRATIONS, CONCERNS)
|
|
167
167
|
- **Project Overview:** 1-2 paragraphs from README/package.json
|
|
168
168
|
- **Build & Run Commands:** Build, test, and other detected commands
|
|
169
|
+
- **Workflow Rules:** Include this section verbatim:
|
|
170
|
+
```
|
|
171
|
+
## Workflow Rules
|
|
172
|
+
When running `/5:` workflow commands, follow the command instructions exactly as written.
|
|
173
|
+
Do not skip steps, combine phases, or proceed to actions not specified in the current command.
|
|
174
|
+
Each phase produces a specific artifact — do not create artifacts belonging to other phases.
|
|
175
|
+
```
|
|
169
176
|
- **Coding Guidelines:** The 6 mandatory principles (types, concise docs, short files, extract methods, SRP/DRY, maintainable/modular)
|
|
170
177
|
- **Getting Started:** Links to relevant `.5/` files for new devs and specific tasks
|
|
171
178
|
|