@@ -100,6 +100,25 @@ $ARGUMENTS
100100- Timeline or resource considerations
101101- Quality or compliance requirements
102102
103+ ## Outline (MANDATORY EXECUTION STEPS)
104+
105+ 1 . ** Setup** : Run ` {SCRIPT} ` from repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\' 'm Groot' (or double-quote if possible: "I'm Groot").
106+
107+ 2 . ** Load context** : Read FEATURE_SPEC and ` /memory/constitution.md ` . Load IMPL_PLAN template (already copied by setup script).
108+
109+ 3 . ** Execute plan workflow** (CREATE ALL ARTIFACTS):
110+ - Fill plan.md Technical Context section (mark unknowns as "NEEDS CLARIFICATION")
111+ - Fill plan.md Constitution Check section from constitution
112+ - Evaluate gates (ERROR if violations unjustified)
113+ - ** Phase 0: CREATE research.md** - Resolve all NEEDS CLARIFICATION via research
114+ - ** Phase 1: CREATE data-model.md** - Extract entities from feature spec
115+ - ** Phase 1: CREATE contracts/** directory with API endpoint definitions (if project has external interfaces)
116+ - ** Phase 1: CREATE quickstart.md** - Developer setup guide
117+ - ** Phase 1: RUN agent context update** - Execute ` {AGENT_SCRIPT} ` to update agent-specific files
118+ - Re-evaluate Constitution Check post-design in plan.md
119+
120+ 4 . ** Stop and report** : Command ends after Phase 1 completion. Report branch, IMPL_PLAN path, and all generated artifacts (research.md, data-model.md, contracts/, quickstart.md).
121+
103122## Execution Strategy
104123
105124** Chain of Thought Approach:**
@@ -110,62 +129,19 @@ $ARGUMENTS
1101294 . ** Validate Compliance** → Ensure constitutional alignment
1111305 . ** Generate Artifacts** → Produce implementation-ready documentation
112131
113- ## Core Workflow
114-
115- ### Phase 1: Planning Setup & Context Loading
116-
117- ** Objective:** Establish planning environment and load all required context
118-
119- 1 . ** Environment Initialization**
120- - Execute: ` {SCRIPT} ` from repository root
121- - Parse JSON output for: FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH
122- - Validate all required paths exist and are accessible
123- - Handle argument escaping for special characters
124-
125- ### CRITICAL - Path Validation
132+ ## CRITICAL - Path Validation
126133
127134** DO NOT write to project root directory**
128- - Parse ` IMPL_PLAN ` from script JSON output
135+ - Parse ` IMPL_PLAN ` from script JSON output (from ` {SCRIPT} ` )
129136- Write ONLY to ` IMPL_PLAN ` path - never to ` ./plan.md `
130137- The correct path is: ` ./specs/<BRANCH>/plan.md ` (e.g., ` ./specs/001-user-auth/plan.md ` )
131138- Common mistake: Writing to ` ./plan.md ` instead of ` ./specs/001-user-auth/plan.md `
132139
133- ### Non-Git Repository Support
134-
135- If working in a non-git repository:
136- - Ensure ` SPECIFY_FEATURE ` environment variable is set (from ` /spec.specify ` )
137- - Run: ` export SPECIFY_FEATURE=001-user-auth ` (or your feature branch name) before this command
140+ ** Non-Git Repository Support:**
141+ - If working in a non-git repository, ensure ` SPECIFY_FEATURE ` environment variable is set (from ` /spec.specify ` )
138142- Without this, the script may fail to find the correct feature directory
139143
140- 2 . ** Context Acquisition**
141- - ** Specification Loading:** Read FEATURE_SPEC for requirements and constraints
142- - ** Constitutional Loading:** Read ` /memory/constitution.md ` for governance rules
143- - ** Template Loading:** Load appropriate template
144- - ** Validation:** Ensure all context sources are available and consistent
145-
146- ### Phase 2: Technical Analysis & Research Planning
147-
148- ** Objective:** Identify technical scope and knowledge gaps requiring research
149-
150- 1 . ** Technical Context Mapping**
151- - Extract technical requirements from feature specification
152- - Identify technology stack and architectural patterns
153- - Map integration points and external dependencies
154- - ** NEEDS CLARIFICATION Flag:** Mark unknowns preventing confident planning
155-
156- 2 . ** Constitutional Compliance Assessment**
157- - Map feature requirements against constitution principles
158- - Identify potential conflicts or additional requirements
159- - Document compliance strategy and justification
160- - ** Gate Evaluation:** Block progression for unjustified violations
161-
162- 3 . ** Research Planning**
163- - ** Gap Analysis:** Convert NEEDS CLARIFICATION items to research tasks
164- - ** Dependency Research:** Plan investigation of critical integrations
165- - ** Best Practice Research:** Identify technology-specific recommendations
166- - Generate research.md with prioritized investigation plan
167-
168- ## Execution Flow
144+ ## Phases
169145
170146### Phase 0: Outline & Research
171147
@@ -214,113 +190,26 @@ If working in a non-git repository:
214190
215191** Output** : data-model.md, /contracts/* (if external interfaces), quickstart.md, agent-specific file
216192
217- ### Phase 2: Feature Architecture (via architect extension)
218-
219- ** Prerequisites:** Research complete
220-
221- ** Trigger** : architect extension installed and adr.md exists (.specify/drafts/adr.md from system-level architecture)
222-
223- ** Note** : Architecture workflow now handled via architect extension hooks:
224-
225- ** before_plan hook (if architect extension present)** :
226- - ` /architect.specify ` : Create feature-level ADRs
227- - ` /architect.clarify ` : Refine feature ADRs
228- - ` /architect.implement ` : Generate feature AD.md (optional)
229-
230- ** after_plan hook (if architect extension present)** :
231- - ` /architect.validate --for-plan ` : Validate plan alignment with architecture (READ-ONLY)
232- - Parse findings: BLOCKING, HIGH-SEVERITY, WARNINGS
233- - Document validation report in plan.md
234-
235- ** If architect extension NOT available** :
236- - Architecture workflow does not run
237- - Plan generation continues with spec-based information only
238-
239- ** Cross-Validation (if architect installed)** :
240- 1 . ** Load System Architecture** :
241- - Read ` AD.md ` (root) for system-level architecture context
242- - Read ` .specify/drafts/adr.md ` for system-level ADRs
243- - Extract relevant viewpoints and constraints
244-
245- 2 . ** Identify Feature-Specific Decisions** :
246- - What new components does this feature introduce?
247- - What existing components are modified?
248- - What data entities are added/changed?
249- - What integration points are affected?
250-
251- 3 . ** Generate Feature ADRs** (via before_plan hook):
252- - Create ` specs/{feature}/adr.md ` with feature-level decisions
253- - Each ADR should reference system ADRs: "Aligns with ADR-XXX"
254- - Flag any conflicts: "VIOLATION: Conflicts with ADR-XXX"
255-
256- 4 . ** Generate Feature Architecture Description** (via before_plan hook, \` /architect.implement\` ):
257- - Use ` templates/feature-AD-template.md ` as base
258- - Focus on feature context, functional design, data design
259- - Include integration points with system architecture
260- - Generate feature-specific diagrams
261-
262- 5 . ** Cross-Validate Against System AD** (via after_plan hook validation):
263- - Verify feature doesn't violate system boundaries
264- - Ensure consistency with system component patterns
265- - Check data model compatibility with Information View
266- - Validate deployment approach fits Deployment View
267-
268- ** Output** :
269-
270- - ` specs/{feature}/adr.md ` (feature-level decisions)
271- - ` specs/{feature}/AD.md ` (feature architecture description)
272-
273193## Triage Framework: [ SYNC] vs [ ASYNC] Task Classification
274194
275- ** Purpose** : Guide the classification of implementation tasks as [ SYNC] (human-reviewed) or [ ASYNC] (agent-delegated) to optimize execution efficiency and quality.
276-
277- #### Triage Decision Framework
278-
279- ** Evaluate Each Implementation Task Against These Criteria:**
280-
281- ##### [ SYNC] Classification (Human Execution Required)
282-
283- - ** Complex Business Logic** : Non-trivial algorithms, state machines, or domain-specific calculations
284- - ** Architectural Decisions** : System design choices, component boundaries, or integration patterns
285- - ** Security-Critical Code** : Authentication, authorization, encryption, or data protection
286- - ** External Integrations** : Third-party APIs, legacy systems, or complex data transformations
287- - ** Ambiguous Requirements** : Unclear specifications requiring interpretation or clarification
288- - ** High-Risk Changes** : Database schema changes, API contract modifications, or breaking changes
195+ ** Purpose** : Classify implementation tasks as [ SYNC] (human-reviewed) or [ ASYNC] (agent-delegated).
289196
290- ##### [ ASYNC] Classification (Agent Delegation Suitable)
197+ ** [ SYNC] - Human Execution Required:**
198+ - Complex business logic, algorithms, state machines
199+ - Security-critical code (auth, encryption, data protection)
200+ - External integrations, third-party APIs
201+ - Architectural decisions, component boundaries
202+ - High-risk changes (schema, API contracts, breaking changes)
291203
292- - ** Well-Defined CRUD ** : Standard create/read/update/delete operations with clear schemas
293- - ** Repetitive Tasks ** : Boilerplate code, standard library usage, or template-based generation
294- - ** Clear Specifications ** : Unambiguous requirements with complete acceptance criteria
295- - ** Independent Components ** : Self-contained modules with minimal external dependencies
296- - ** Standard Patterns ** : Established frameworks, libraries, or architectural patterns
297- - ** Testable Units ** : Components with comprehensive automated test coverage
204+ ** [ ASYNC ] - Agent Delegation Suitable: **
205+ - Well-defined CRUD operations with clear schemas
206+ - Boilerplate code, standard library usage
207+ - Independent components with minimal dependencies
208+ - Standard framework/library patterns
209+ - Testable units with comprehensive test coverage
298210
299- #### Triage Process
300-
301- 1 . ** Task Identification** : Break down the feature into discrete, implementable tasks
302- 2 . ** Criteria Evaluation** : Assess each task against the [ SYNC] /[ ASYNC] criteria above
303- 3 . ** Rationale Documentation** : Record the reasoning for each classification decision
304- 4 . ** Risk Assessment** : Consider the impact of incorrect classification
305- 5 . ** Review Checkpoint** : Validate triage decisions before task generation
306-
307- #### Triage Audit Trail
308-
309- ** Document for Each Task:**
310-
311- - Classification: [ SYNC] or [ ASYNC]
312- - Primary Criteria: Which criteria drove the classification
313- - Risk Level: Low/Medium/High (impact of misclassification)
314- - Rationale: 1-2 sentence explanation
315-
316- #### Triage Effectiveness Metrics
317-
318- ** Track Over Time:**
319-
320- - Classification Accuracy: Percentage of tasks correctly classified (measured post-implementation)
321- - Review Efficiency: Time spent on [ SYNC] reviews vs [ ASYNC] execution time
322- - Quality Impact: Defect rates by classification type
323- - Learning Opportunities: Common misclassification patterns
211+ ** Triage Output in plan.md:**
212+ Document each task with: Classification ([ SYNC] /[ ASYNC] ), Primary Criteria, Risk Level, Rationale
324213
325214## Key Rules
326215
@@ -338,24 +227,10 @@ If working in a non-git repository:
338227- Detailed technical analysis and constitutional compliance
339228- Complete design artifacts and thorough triage
340229
341- ** Architecture Integration** (via architect extension):
342-
343- - architect extension hooks handle architecture workflow automatically
344- - ** before_plan hook** : Create feature ADRs (if before_plan hook configured)
345- - ** after_plan hook** : Validate plan alignment (READ-ONLY validation via architect.validate)
346- - Feature ADRs auto-validated against system ADRs in ` .specify/drafts/adr.md `
347- - Conflicts flagged as VIOLATION requiring resolution
348- - Aligned decisions noted with "Aligns with ADR-XXX"
349-
350- ### Two-Level Architecture System
351-
352- | Level | Location | ADR File | Architecture Description | Generated By | Hook |
353- | -------| ----------| ----------| --------------------------| --------------| ------|
354- | ** System** | Main branch | ` .specify/drafts/adr.md ` | ` AD.md ` (root) or ` {TEAM_DIRECTIVES}/AD.md ` | ` /architect.* ` commands | N/A |
355- | ** Feature** | Feature branch | ` specs/{feature}/adr.md ` | ` specs/{feature}/AD.md ` | ` /architect.specify → /architect.clarify → /architect.implement ` | before_plan |
356- | ** Validation** | Plan level | READ-ONLY via ` /architect.validate --for-plan ` | Validates plan alignment | architect extension | after_plan |
357-
358- Feature architecture inherits and extends system architecture, ensuring consistent governance across all development.
230+ ** Architecture Integration Note** :
231+ - If architect extension is configured, hooks will handle feature architecture automatically
232+ - Plan command focuses on research, data modeling, and contracts generation
233+ - Architecture artifacts (adr.md, AD.md) are managed by architect extension hooks
359234
360235### AI-Powered Context/Skills Refresh (Always Enabled)
361236
0 commit comments