Skip to content

Commit 8374777

Browse files
committed
Consistency updates to commands
1 parent a172e4c commit 8374777

8 files changed

Lines changed: 225 additions & 121 deletions

File tree

templates/commands/analyze.md

Lines changed: 179 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -5,100 +5,182 @@ scripts:
55
ps: scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks
66
---
77

8-
The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty).
9-
10-
User input:
11-
12-
`$ARGUMENTS
13-
`
14-
Goal: Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `/tasks` has successfully produced a complete `tasks.md`.
15-
16-
STRICTLY READ-ONLY: Do **not** modify any files. Output a structured analysis report. Offer an optional remediation plan (user must explicitly approve before any follow-up editing commands would be invoked manually).
17-
18-
Constitution Authority: The project constitution (`/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasks—not dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `/analyze`.
19-
20-
Execution steps:
21-
22-
1. Run `{SCRIPT}` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
23-
- SPEC = FEATURE_DIR/spec.md
24-
- PLAN = FEATURE_DIR/plan.md
25-
- TASKS = FEATURE_DIR/tasks.md
26-
Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
27-
28-
2. Load artifacts:
29-
- Parse spec.md sections: Overview/Context, Functional Requirements, Non-Functional Requirements, User Stories, Edge Cases (if present).
30-
- Parse plan.md: Architecture/stack choices, Data Model references, Phases, Technical constraints.
31-
- Parse tasks.md: Task IDs, descriptions, phase grouping, parallel markers [P], referenced file paths.
32-
- Load constitution `/memory/constitution.md` for principle validation.
33-
34-
3. Build internal semantic models:
35-
- Requirements inventory: Each functional + non-functional requirement with a stable key (derive slug based on imperative phrase; e.g., "User can upload file" -> `user-can-upload-file`).
36-
- User story/action inventory.
37-
- Task coverage mapping: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases).
38-
- Constitution rule set: Extract principle names and any MUST/SHOULD normative statements.
39-
40-
4. Detection passes:
41-
A. Duplication detection:
42-
- Identify near-duplicate requirements. Mark lower-quality phrasing for consolidation.
43-
B. Ambiguity detection:
44-
- Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria.
45-
- Flag unresolved placeholders (TODO, TKTK, ???, <placeholder>, etc.).
46-
C. Underspecification:
47-
- Requirements with verbs but missing object or measurable outcome.
48-
- User stories missing acceptance criteria alignment.
49-
- Tasks referencing files or components not defined in spec/plan.
50-
D. Constitution alignment:
51-
- Any requirement or plan element conflicting with a MUST principle.
52-
- Missing mandated sections or quality gates from constitution.
53-
E. Coverage gaps:
54-
- Requirements with zero associated tasks.
55-
- Tasks with no mapped requirement/story.
56-
- Non-functional requirements not reflected in tasks (e.g., performance, security).
57-
F. Inconsistency:
58-
- Terminology drift (same concept named differently across files).
59-
- Data entities referenced in plan but absent in spec (or vice versa).
60-
- Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note).
61-
- Conflicting requirements (e.g., one requires to use Next.js while other says to use Vue as the framework).
62-
63-
5. Severity assignment heuristic:
64-
- CRITICAL: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality.
65-
- HIGH: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion.
66-
- MEDIUM: Terminology drift, missing non-functional task coverage, underspecified edge case.
67-
- LOW: Style/wording improvements, minor redundancy not affecting execution order.
68-
69-
6. Produce a Markdown report (no file writes) with sections:
70-
71-
### Specification Analysis Report
72-
| ID | Category | Severity | Location(s) | Summary | Recommendation |
73-
|----|----------|----------|-------------|---------|----------------|
74-
| A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
75-
(Add one row per finding; generate stable IDs prefixed by category initial.)
76-
77-
Additional subsections:
78-
- Coverage Summary Table:
79-
| Requirement Key | Has Task? | Task IDs | Notes |
80-
- Constitution Alignment Issues (if any)
81-
- Unmapped Tasks (if any)
82-
- Metrics:
83-
* Total Requirements
84-
* Total Tasks
85-
* Coverage % (requirements with >=1 task)
86-
* Ambiguity Count
87-
* Duplication Count
88-
* Critical Issues Count
89-
90-
7. At end of report, output a concise Next Actions block:
91-
- If CRITICAL issues exist: Recommend resolving before `/implement`.
92-
- If only LOW/MEDIUM: User may proceed, but provide improvement suggestions.
93-
- Provide explicit command suggestions: e.g., "Run /specify with refinement", "Run /plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'".
94-
95-
8. Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
96-
97-
Behavior rules:
98-
- NEVER modify files.
99-
- NEVER hallucinate missing sections—if absent, report them.
100-
- KEEP findings deterministic: if rerun without changes, produce consistent IDs and counts.
101-
- LIMIT total findings in the main table to 50; aggregate remainder in a summarized overflow note.
102-
- If zero issues found, emit a success report with coverage statistics and proceed recommendation.
103-
104-
Context: {ARGS}
8+
## User Input
9+
10+
```text
11+
$ARGUMENTS
12+
```
13+
14+
You **MUST** consider the user input before proceeding (if not empty).
15+
16+
## Goal
17+
18+
Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `/tasks` has successfully produced a complete `tasks.md`.
19+
20+
## Operating Constraints
21+
22+
**STRICTLY READ-ONLY**: Do **not** modify any files. Output a structured analysis report. Offer an optional remediation plan (user must explicitly approve before any follow-up editing commands would be invoked manually).
23+
24+
**Constitution Authority**: The project constitution (`/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasks—not dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `/analyze`.
25+
26+
## Execution Steps
27+
28+
### 1. Initialize Analysis Context
29+
30+
Run `{SCRIPT}` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
31+
32+
- SPEC = FEATURE_DIR/spec.md
33+
- PLAN = FEATURE_DIR/plan.md
34+
- TASKS = FEATURE_DIR/tasks.md
35+
36+
Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
37+
38+
### 2. Load Artifacts (Progressive Disclosure)
39+
40+
Load only the minimal necessary context from each artifact:
41+
42+
**From spec.md:**
43+
44+
- Overview/Context
45+
- Functional Requirements
46+
- Non-Functional Requirements
47+
- User Stories
48+
- Edge Cases (if present)
49+
50+
**From plan.md:**
51+
52+
- Architecture/stack choices
53+
- Data Model references
54+
- Phases
55+
- Technical constraints
56+
57+
**From tasks.md:**
58+
59+
- Task IDs
60+
- Descriptions
61+
- Phase grouping
62+
- Parallel markers [P]
63+
- Referenced file paths
64+
65+
**From constitution:**
66+
67+
- Load `/memory/constitution.md` for principle validation
68+
69+
### 3. Build Semantic Models
70+
71+
Create internal representations (do not include raw artifacts in output):
72+
73+
- **Requirements inventory**: Each functional + non-functional requirement with a stable key (derive slug based on imperative phrase; e.g., "User can upload file" → `user-can-upload-file`)
74+
- **User story/action inventory**: Discrete user actions with acceptance criteria
75+
- **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
76+
- **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
77+
78+
### 4. Detection Passes (Token-Efficient Analysis)
79+
80+
Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
81+
82+
#### A. Duplication Detection
83+
84+
- Identify near-duplicate requirements
85+
- Mark lower-quality phrasing for consolidation
86+
87+
#### B. Ambiguity Detection
88+
89+
- Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
90+
- Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
91+
92+
#### C. Underspecification
93+
94+
- Requirements with verbs but missing object or measurable outcome
95+
- User stories missing acceptance criteria alignment
96+
- Tasks referencing files or components not defined in spec/plan
97+
98+
#### D. Constitution Alignment
99+
100+
- Any requirement or plan element conflicting with a MUST principle
101+
- Missing mandated sections or quality gates from constitution
102+
103+
#### E. Coverage Gaps
104+
105+
- Requirements with zero associated tasks
106+
- Tasks with no mapped requirement/story
107+
- Non-functional requirements not reflected in tasks (e.g., performance, security)
108+
109+
#### F. Inconsistency
110+
111+
- Terminology drift (same concept named differently across files)
112+
- Data entities referenced in plan but absent in spec (or vice versa)
113+
- Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
114+
- Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
115+
116+
### 5. Severity Assignment
117+
118+
Use this heuristic to prioritize findings:
119+
120+
- **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
121+
- **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
122+
- **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
123+
- **LOW**: Style/wording improvements, minor redundancy not affecting execution order
124+
125+
### 6. Produce Compact Analysis Report
126+
127+
Output a Markdown report (no file writes) with the following structure:
128+
129+
## Specification Analysis Report
130+
131+
| ID | Category | Severity | Location(s) | Summary | Recommendation |
132+
|----|----------|----------|-------------|---------|----------------|
133+
| A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
134+
135+
(Add one row per finding; generate stable IDs prefixed by category initial.)
136+
137+
**Coverage Summary Table:**
138+
139+
| Requirement Key | Has Task? | Task IDs | Notes |
140+
|-----------------|-----------|----------|-------|
141+
142+
**Constitution Alignment Issues:** (if any)
143+
144+
**Unmapped Tasks:** (if any)
145+
146+
**Metrics:**
147+
148+
- Total Requirements
149+
- Total Tasks
150+
- Coverage % (requirements with >=1 task)
151+
- Ambiguity Count
152+
- Duplication Count
153+
- Critical Issues Count
154+
155+
### 7. Provide Next Actions
156+
157+
At end of report, output a concise Next Actions block:
158+
159+
- If CRITICAL issues exist: Recommend resolving before `/implement`
160+
- If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
161+
- Provide explicit command suggestions: e.g., "Run /specify with refinement", "Run /plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'"
162+
163+
### 8. Offer Remediation
164+
165+
Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
166+
167+
## Operating Principles
168+
169+
### Context Efficiency
170+
171+
- **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
172+
- **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
173+
- **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
174+
- **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
175+
176+
### Analysis Guidelines
177+
178+
- **NEVER modify files** (this is read-only analysis)
179+
- **NEVER hallucinate missing sections** (if absent, report them accurately)
180+
- **Prioritize constitution violations** (these are always CRITICAL)
181+
- **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
182+
- **Report zero issues gracefully** (emit success report with coverage statistics)
183+
184+
## Context
185+
186+
{ARGS}

templates/commands/checklist.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ scripts:
55
ps: scripts/powershell/check-prerequisites.ps1 -Json
66
---
77

8-
The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty).
8+
## User Input
99

10-
User input:
10+
```text
11+
$ARGUMENTS
12+
```
13+
14+
You **MUST** consider the user input before proceeding (if not empty).
1115

12-
`$ARGUMENTS
13-
`
1416
## Execution Steps
1517

1618
1. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS list.

templates/commands/clarify.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ scripts:
55
ps: scripts/powershell/check-prerequisites.ps1 -Json -PathsOnly
66
---
77

8-
The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty).
8+
## User Input
99

10-
User input:
10+
```text
11+
$ARGUMENTS
12+
```
1113

12-
`$ARGUMENTS`
14+
You **MUST** consider the user input before proceeding (if not empty).
15+
16+
## Outline
1317

1418
Goal: Detect and reduce ambiguity or missing decision points in the active feature specification and record the clarifications directly in the spec file.
1519

templates/commands/constitution.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
description: Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync.
33
---
44

5-
The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty).
5+
## User Input
66

7-
User input:
7+
```text
8+
$ARGUMENTS
9+
```
810

9-
`$ARGUMENTS`
11+
You **MUST** consider the user input before proceeding (if not empty).
12+
13+
## Outline
1014

1115
You are updating the project constitution at `/memory/constitution.md`. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g. `[PROJECT_NAME]`, `[PRINCIPLE_1_NAME]`). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts.
1216

templates/commands/implement.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ scripts:
55
ps: scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks
66
---
77

8-
The user input can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty).
8+
## User Input
99

10-
User input:
10+
```text
11+
$ARGUMENTS
12+
```
1113

12-
`$ARGUMENTS`
14+
You **MUST** consider the user input before proceeding (if not empty).
15+
16+
## Outline
1317

1418
1. Run `{SCRIPT}` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute.
1519

templates/commands/plan.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ agent_scripts:
88
ps: scripts/powershell/update-agent-context.ps1 -AgentType __AGENT__
99
---
1010

11-
The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty).
11+
## User Input
1212

13-
User input:
13+
```text
14+
$ARGUMENTS
15+
```
1416

15-
`$ARGUMENTS`
17+
You **MUST** consider the user input before proceeding (if not empty).
1618

17-
## Execution Steps
19+
## Outline
1820

1921
1. **Setup**: Run `{SCRIPT}` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH.
2022
- Before proceeding: Check FEATURE_SPEC has `## Clarifications` section. If missing or ambiguous, instruct user to run `/clarify` first.

templates/commands/specify.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ scripts:
55
ps: scripts/powershell/create-new-feature.ps1 -Json "{ARGS}"
66
---
77

8-
The user input to you can be provided directly by the agent or as a command argument - you **MUST** consider it before proceeding with the prompt (if not empty).
8+
## User Input
99

10-
User input:
10+
```text
11+
$ARGUMENTS
12+
```
1113

12-
`$ARGUMENTS`
14+
You **MUST** consider the user input before proceeding (if not empty).
15+
16+
## Outline
1317

1418
The text the user typed after `/specify` in the triggering message **is** the feature description. Assume you always have it available in this conversation even if `{ARGS}` appears literally below. Do not ask the user to repeat it unless they provided an empty command.
1519

0 commit comments

Comments
 (0)