feat: Add task-generate-agent and task-generate commands for autonomous task generation and manual task creation

- Implemented task-generate-agent for autonomous task generation using action-planning-agent with discovery and output phases.
- Introduced task-generate command to generate task JSON files and IMPL_PLAN.md from analysis results with automatic artifact detection and integration.
- Enhanced documentation for both commands, detailing execution lifecycle, phases, and output structures.
- Established clear integration points and error handling for improved user experience.
This commit is contained in:
catlog22
2025-09-30 10:10:34 +08:00
parent 3db68ef15e
commit 04876c80bd
6 changed files with 1438 additions and 517 deletions

View File

@@ -23,39 +23,134 @@ You are a pure execution agent specialized in creating actionable implementation
### Input Processing
**What you receive:**
- **Execution Context Package**: Structured context from command layer
- `session_id`: Workflow session identifier (WFS-[topic])
- `session_metadata`: Session configuration and state
- `analysis_results`: Analysis recommendations and task breakdown
- `artifacts_inventory`: Detected brainstorming outputs (synthesis-spec, topic-framework, role analyses)
- `context_package`: Project context and assets
- `mcp_capabilities`: Available MCP tools (code-index, exa-code, exa-web)
- `mcp_analysis`: Optional pre-executed MCP analysis results
**Legacy Support** (backward compatibility):
- **pre_analysis configuration**: Multi-step array format with action, template, method fields
- **Brief actions**: 2-3 word descriptions to expand into comprehensive analysis tasks
- **Control flags**: DEEP_ANALYSIS_REQUIRED, etc.
- **Task requirements**: Direct task description
**What you receive:**
- Task requirements and context
- Control flags from command layer (DEEP_ANALYSIS_REQUIRED, etc.)
- Workflow parameters and constraints
### Execution Flow
### Execution Flow (Two-Phase)
```
1. Parse input requirements and extract control flags
2. Process pre_analysis configuration:
→ Process multi-step array: Sequential analysis steps
Check for analysis marker:
- [MULTI_STEP_ANALYSIS] → Execute sequential analysis steps with specified templates and methods
Expand brief actions into comprehensive analysis tasks
Use analysis results for planning context
3. Assess task complexity (simple/medium/complex)
4. Create staged implementation plan
5. Generate required documentation
6. Update workflow structure
Phase 1: Context Validation & Enhancement (Discovery Results Provided)
1. Receive and validate execution context package
2. Check memory-first rule compliance:
session_metadata: Use provided content (from memory or file)
→ analysis_results: Use provided content (from memory or file)
artifacts_inventory: Use provided list (from memory or scan)
mcp_analysis: Use provided results (optional)
3. Optional MCP enhancement (if not pre-executed):
→ mcp__code-index__find_files() for codebase structure
→ mcp__exa__get_code_context_exa() for best practices
4. Assess task complexity (simple/medium/complex) from analysis
Phase 2: Document Generation (Autonomous Output)
1. Extract task definitions from analysis_results
2. Generate task JSON files with 5-field schema + artifacts
3. Create IMPL_PLAN.md with context analysis and artifact references
4. Generate TODO_LIST.md with proper structure (▸, [ ], [x])
5. Update session state for execution readiness
```
**Pre-Execution Analysis Standards**:
### Context Package Usage
**Standard Context Structure**:
```javascript
{
"session_id": "WFS-auth-system",
"session_metadata": {
"project": "OAuth2 authentication",
"type": "medium",
"current_phase": "PLAN"
},
"analysis_results": {
"tasks": [
{"id": "IMPL-1", "title": "...", "requirements": [...]}
],
"complexity": "medium",
"dependencies": [...]
},
"artifacts_inventory": {
"synthesis_specification": ".workflow/WFS-auth/.brainstorming/synthesis-specification.md",
"topic_framework": ".workflow/WFS-auth/.brainstorming/topic-framework.md",
"role_analyses": [
".workflow/WFS-auth/.brainstorming/system-architect/analysis.md",
".workflow/WFS-auth/.brainstorming/security-expert/analysis.md"
]
},
"context_package": {
"assets": [...],
"focus_areas": [...]
},
"mcp_capabilities": {
"code_index": true,
"exa_code": true,
"exa_web": true
},
"mcp_analysis": {
"code_structure": "...",
"external_research": "..."
}
}
```
**Using Context in Task Generation**:
1. **Extract Tasks**: Parse `analysis_results.tasks` array
2. **Map Artifacts**: Use `artifacts_inventory` to add artifact references to task.context
3. **Assess Complexity**: Use `analysis_results.complexity` for document structure decision
4. **Session Paths**: Use `session_id` to construct output paths (.workflow/{session_id}/)
### MCP Integration Guidelines
**Code Index MCP** (`mcp_capabilities.code_index = true`):
```javascript
// Discover relevant files
mcp__code-index__find_files(pattern="*auth*")
// Search for patterns
mcp__code-index__search_code_advanced(
pattern="authentication|oauth|jwt",
file_pattern="*.{ts,js}"
)
// Get file summary
mcp__code-index__get_file_summary(file_path="src/auth/index.ts")
```
**Exa Code Context** (`mcp_capabilities.exa_code = true`):
```javascript
// Get best practices and examples
mcp__exa__get_code_context_exa(
query="TypeScript OAuth2 JWT authentication patterns",
tokensNum="dynamic"
)
```
**Integration in flow_control.pre_analysis**:
```json
{
"step": "mcp_codebase_exploration",
"action": "Explore codebase structure",
"command": "mcp__code-index__find_files(pattern=\"[task_patterns]\") && mcp__code-index__search_code_advanced(pattern=\"[relevant_patterns]\")",
"output_to": "codebase_structure"
}
```
**Legacy Pre-Execution Analysis** (backward compatibility):
- **Multi-step Pre-Analysis**: Execute comprehensive analysis BEFORE implementation begins
- **Purpose**: Gather context, understand patterns, identify requirements before coding
- **Sequential Processing**: Process each step sequentially, expanding brief actions
- **Example**: "analyze auth" → "Analyze existing authentication patterns, identify current implementation approaches, understand dependency relationships"
- **Template Usage**: Use full template paths with $(cat template_path) for enhanced prompts
- **Method Selection**: Use method specified in each step (gemini/codex/manual/auto-detected)
- **Template Usage**: Use full template paths with $(cat template_path)
- **Method Selection**: gemini/codex/manual/auto-detected
- **CLI Commands**:
- **Gemini**: `bash(~/.claude/scripts/gemini-wrapper -p "$(cat template_path) [expanded_action]")`
- **Codex**: `bash(codex --full-auto exec "$(cat template_path) [expanded_action]" -s danger-full-access)`
- **Gemini**: `bash(~/.claude/scripts/gemini-wrapper -p "$(cat template_path) [action]")`
- **Codex**: `bash(codex --full-auto exec "$(cat template_path) [action]" -s danger-full-access)`
- **Follow Guidelines**: @~/.claude/workflows/intelligent-tools-strategy.md
### Pre-Execution Analysis
@@ -88,38 +183,138 @@ Break work into 3-5 logical implementation stages with:
- Dependencies on previous stages
- Estimated complexity and time requirements
### 2. Implementation Plan Creation
Generate `IMPL_PLAN.md` using session context directory paths:
- **Session Context**: Use workflow directory path provided by workflow:execute
- **Stage-Based Format**: Simple, linear tasks
- **Hierarchical Format**: Complex tasks (>5 subtasks or >3 modules)
- **CRITICAL**: Always use session context paths, never assume default locations
### 2. Task JSON Generation (5-Field Schema + Artifacts)
Generate individual `.task/IMPL-*.json` files with:
### 3. Task Decomposition (Complex Projects)
For tasks requiring >5 subtasks or spanning >3 modules:
- Create detailed task breakdown and tracking
- Generate TODO_LIST.md for progress monitoring using provided session context paths
- Use hierarchical structure (max 3 levels)
**Required Fields**:
```json
{
"id": "IMPL-N[.M]",
"title": "Descriptive task name",
"status": "pending",
"meta": {
"type": "feature|bugfix|refactor|test|docs",
"agent": "@code-developer|@code-review-test-agent"
},
"context": {
"requirements": ["from analysis_results"],
"focus_paths": ["src/paths"],
"acceptance": ["measurable criteria"],
"depends_on": ["IMPL-N"],
"artifacts": [
{
"type": "synthesis_specification",
"path": "{from artifacts_inventory}",
"priority": "highest"
}
]
},
"flow_control": {
"pre_analysis": [
{
"step": "load_synthesis_specification",
"commands": ["bash(ls {path} 2>/dev/null)", "Read({path})"],
"output_to": "synthesis_specification",
"on_error": "skip_optional"
},
{
"step": "mcp_codebase_exploration",
"command": "mcp__code-index__find_files() && mcp__code-index__search_code_advanced()",
"output_to": "codebase_structure"
}
],
"implementation_approach": {
"task_description": "Implement following synthesis specification",
"modification_points": ["Apply requirements"],
"logic_flow": ["Load spec", "Analyze", "Implement", "Validate"]
},
"target_files": ["file:function:lines"]
}
}
```
### 4. Document Generation
Create workflow documents with proper linking:
- Todo items link to task JSON: `[📋 Details](./.task/IMPL-XXX.json)`
- Completed tasks link to summaries: `[✅ Summary](./.summaries/IMPL-XXX-summary.md)`
- Consistent ID schemes (IMPL-XXX, IMPL-XXX.Y, IMPL-XXX.Y.Z)
**Artifact Mapping**:
- Use `artifacts_inventory` from context package
- Highest priority: synthesis_specification
- Medium priority: topic_framework
- Low priority: role_analyses
### 3. Implementation Plan Creation
Generate `IMPL_PLAN.md` at `.workflow/{session_id}/IMPL_PLAN.md`:
**Structure**:
```markdown
---
identifier: {session_id}
source: "User requirements"
analysis: .workflow/{session_id}/.process/ANALYSIS_RESULTS.md
---
# Implementation Plan: {Project Title}
## Summary
{Core requirements and technical approach from analysis_results}
## Context Analysis
- **Project**: {from session_metadata and context_package}
- **Modules**: {from analysis_results}
- **Dependencies**: {from context_package}
- **Patterns**: {from analysis_results}
## Brainstorming Artifacts
{List from artifacts_inventory with priorities}
## Task Breakdown
- **Task Count**: {from analysis_results.tasks.length}
- **Hierarchy**: {Flat/Two-level based on task count}
- **Dependencies**: {from task.depends_on relationships}
## Implementation Plan
- **Execution Strategy**: {Sequential/Parallel}
- **Resource Requirements**: {Tools, dependencies}
- **Success Criteria**: {from analysis_results}
```
### 4. TODO List Generation
Generate `TODO_LIST.md` at `.workflow/{session_id}/TODO_LIST.md`:
**Structure**:
```markdown
# Tasks: {Session Topic}
## Task Progress
**IMPL-001**: [Main Task] → [📋](./.task/IMPL-001.json)
- [ ] **IMPL-001.1**: [Subtask] → [📋](./.task/IMPL-001.1.json)
- [ ] **IMPL-002**: [Simple Task] → [📋](./.task/IMPL-002.json)
## Status Legend
- `▸` = Container task (has subtasks)
- `- [ ]` = Pending leaf task
- `- [x]` = Completed leaf task
```
**Linking Rules**:
- Todo items → task JSON: `[📋](./.task/IMPL-XXX.json)`
- Completed tasks → summaries: `[✅](./.summaries/IMPL-XXX-summary.md)`
- Consistent ID schemes: IMPL-XXX, IMPL-XXX.Y (max 2 levels)
**Format Specifications**: @~/.claude/workflows/workflow-architecture.md
### 5. Complexity Assessment
Automatically determine planning approach:
### 5. Complexity Assessment & Document Structure
Use `analysis_results.complexity` or task count to determine structure:
**Simple Tasks** (<5 tasks):
- Single IMPL_PLAN.md with basic stages
**Simple Tasks** (5 tasks):
- Flat structure: IMPL_PLAN.md + TODO_LIST.md + task JSONs
- No container tasks, all leaf tasks
**Medium Tasks** (5-15 tasks):
- Enhanced IMPL_PLAN.md + TODO_LIST.md
**Medium Tasks** (6-10 tasks):
- Two-level hierarchy: IMPL_PLAN.md + TODO_LIST.md + task JSONs
- Optional container tasks for grouping
**Complex Tasks** (>15 tasks):
- Hierarchical IMPL_PLAN.md + TODO_LIST.md + detailed .task/*.json files
**Complex Tasks** (>10 tasks):
- **Re-scope required**: Maximum 10 tasks hard limit
- If analysis_results contains >10 tasks, consolidate or request re-scoping
## Quality Standards
@@ -142,12 +337,19 @@ Automatically determine planning approach:
## Key Reminders
**ALWAYS:**
- Focus on actionable deliverables
- Ensure each stage can be completed independently
- Include clear testing and validation steps
- Maintain incremental progress throughout
- **Use provided context package**: Extract all information from structured context
- **Respect memory-first rule**: Use provided content (already loaded from memory/file)
- **Follow 5-field schema**: All task JSONs must have id, title, status, meta, context, flow_control
- **Map artifacts**: Use artifacts_inventory to populate task.context.artifacts array
- **Add MCP integration**: Include MCP tool steps in flow_control.pre_analysis when capabilities available
- **Validate task count**: Maximum 10 tasks hard limit, request re-scope if exceeded
- **Use session paths**: Construct all paths using provided session_id
- **Link documents properly**: Use correct linking format (📋 for JSON, ✅ for summaries)
**NEVER:**
- Over-engineer simple tasks
- Create circular dependencies
- Skip quality gates for complex tasks
- Load files directly (use provided context package instead)
- Assume default locations (always use session_id in paths)
- Create circular dependencies in task.depends_on
- Exceed 10 tasks without re-scoping
- Skip artifact integration when artifacts_inventory is provided
- Ignore MCP capabilities when available

View File

@@ -1,10 +1,11 @@
---
name: plan
description: Create implementation plans by orchestrating intelligent context gathering and analysis modules
usage: /workflow:plan <input>
argument-hint: "text description"|file.md|ISS-001
usage: /workflow:plan [--agent] <input>
argument-hint: "[--agent] \"text description\"|file.md|ISS-001"
examples:
- /workflow:plan "Build authentication system"
- /workflow:plan --agent "Build authentication system"
- /workflow:plan requirements.md
- /workflow:plan ISS-001
---
@@ -14,8 +15,14 @@ examples:
## Overview
Creates comprehensive implementation plans by orchestrating intelligent context gathering and analysis modules. Integrates with workflow session management, brainstorming artifacts, and automated task generation.
**Execution Modes**:
- **Manual Mode** (default): Command-driven task generation with phase-by-phase control
- **Agent Mode** (`--agent`): Autonomous agent-driven task generation using action-planning-agent
## Core Planning Principles
**⚡ Autonomous Execution Mandate**: Complete all planning phases sequentially without user interruption—from session initialization through task generation—ensuring full workflow integrity.
### Task Decomposition Standards
**Core Principle: Task Merging Over Decomposition**
@@ -57,14 +64,15 @@ Creates comprehensive implementation plans by orchestrating intelligent context
## Critical Process Requirements
### Session Management ⚠️ CRITICAL FIRST STEP
- **⚡ FIRST ACTION**: Execute `SlashCommand(command="/workflow:session:start")` for intelligent session discovery
- **Command Integration**: Uses `/workflow:session:start` command for intelligent session discovery and creation
- **Active Session Check**: Check for all `.workflow/.active-*` markers before any planning
- **Relevance Analysis**: Automatically analyzes task relevance with existing sessions
- **⚡ FIRST ACTION**: Execute `SlashCommand(command="/workflow:session:start --auto \"[task-description]\"")` for intelligent session discovery
- **Command Integration**: Uses `/workflow:session:start --auto` for automated session discovery and creation
- **Auto Mode Behavior**: Automatically analyzes relevance and selects/creates appropriate session
- **Relevance Analysis**: Keyword-based matching between task description and existing session projects
- **Auto-session creation**: `WFS-[topic-slug]` only if no active session exists or task is unrelated
- **Session continuity**: MUST use selected active session to maintain context
- **⚠️ Dependency context**: MUST read ALL previous task summary documents from selected session before planning
- **Session isolation**: Each session maintains independent context and state
- **Output Parsing**: Extract session ID from output line matching pattern `SESSION_ID: WFS-[id]`
### Session ID Transmission Guidelines ⚠️ CRITICAL
- **Format**: `WFS-[topic-slug]` from active session markers
@@ -81,12 +89,14 @@ Creates comprehensive implementation plans by orchestrating intelligent context
### Phase 1: Session Management & Discovery ⚠️ TodoWrite Control
1. **TodoWrite Initialization**: Initialize flow control, mark first phase as `in_progress`
2. **Session Discovery**: Execute `SlashCommand(command="/workflow:session:start [task-description]")`
3. **Relevance Analysis**: Automatically analyze task relevance with existing sessions
4. **Session Selection**: Auto-select or create session based on relevance analysis
2. **Session Discovery**: Execute `SlashCommand(command="/workflow:session:start --auto \"[task-description]\"")`
3. **Parse Session ID**: Extract session ID from command output matching pattern `SESSION_ID: WFS-[id]`
4. **Validate Session**: Verify session directory structure and metadata exist
5. **Context Preparation**: Load session state and prepare for planning
6. **TodoWrite Update**: Mark phase 1 as `completed`, phase 2 as `in_progress`
**Note**: The `--auto` flag enables automatic relevance analysis and session selection/creation without user interaction.
### Phase 2: Context Gathering & Asset Discovery ⚠️ TodoWrite Control
1. **Context Collection**: Execute `SlashCommand(command="/workflow:tools:context-gather --session WFS-[id] \"task description\"")`
2. **Asset Discovery**: Gather relevant documentation, code, and configuration files
@@ -102,13 +112,31 @@ Creates comprehensive implementation plans by orchestrating intelligent context
5. **TodoWrite Update**: Mark phase 3 as `completed`, phase 4 as `in_progress`
### Phase 4: Plan Assembly & Artifact Integration ⚠️ TodoWrite Control
**Delegated to**:
- Manual Mode: `/workflow:tools:task-generate --session WFS-[id]`
- Agent Mode: `/workflow:tools:task-generate-agent --session WFS-[id]`
Execute task generation command to:
1. **Artifact Detection**: Scan session for brainstorming outputs (.brainstorming/ directory)
2. **Plan Generation**: Create IMPL_PLAN.md from analysis results and artifacts
3. **Enhanced Task JSON Creation**: Generate task JSON files with artifacts integration
3. **Enhanced Task JSON Creation**: Generate task JSON files with artifacts integration (5-field schema)
4. **TODO List Creation**: Generate TODO_LIST.md with artifact references
5. **Session Update**: Mark session as ready for execution with artifact context
6. **TodoWrite Completion Validation**: Ensure all phases are marked as `completed` for complete execution
**Command Execution**:
```bash
# Manual Mode (default)
SlashCommand(command="/workflow:tools:task-generate --session WFS-[id]")
# Agent Mode (if --agent flag provided)
SlashCommand(command="/workflow:tools:task-generate-agent --session WFS-[id]")
```
**Reference Documentation**:
- Manual: `@.claude/commands/workflow/tools/task-generate.md`
- Agent: `@.claude/commands/workflow/tools/task-generate-agent.md`
## TodoWrite Progress Tracking ⚠️ CRITICAL FLOW CONTROL
**TodoWrite Control Ensures Complete Workflow Execution** - Guarantees planning lifecycle integrity through real-time status tracking:
@@ -145,7 +173,7 @@ TodoWrite({
})
// Step 2: Execute SlashCommand and Update Status Immediately
SlashCommand(command="/workflow:session:start task-description")
SlashCommand(command="/workflow:session:start --auto \"task-description\"")
// After command completion:
TodoWrite({
todos: [
@@ -168,241 +196,27 @@ SlashCommand(command="/workflow:tools:context-gather --session WFS-[id] \"task d
-**Error Handling**: If command fails, remain in current phase until issue resolved
-**Final Validation**: All todos status must be `completed` for planning completion
## Output Documents
## Output Document Structures
### Generated Files
**Documents Created by Phase 4** (`/workflow:tools:task-generate`):
- **IMPL_PLAN.md**: Implementation plan with context analysis and artifact references
- **.task/*.json**: Task definitions using 5-field schema with flow_control and artifacts
- **TODO_LIST.md**: Progress tracking (container tasks with ▸, leaf tasks with checkboxes)
### IMPL_PLAN.md Structure ⚠️ REQUIRED FORMAT
**File Header** (required)
- **Identifier**: Unique project identifier and session ID, format WFS-[topic]
- **Source**: Input type, e.g. "User requirements analysis"
- **Analysis**: Analysis document reference
**Summary** (execution overview)
- Concise description of core requirements and objectives
- Technical direction and implementation approach
**Context Analysis** (context analysis)
- **Project** - Project type and architectural patterns
- **Modules** - Involved modules and component list
- **Dependencies** - Dependency mapping and constraints
- **Patterns** - Identified code patterns and conventions
**Task Breakdown** (task decomposition)
- **Task Count** - Total task count and complexity level
- **Hierarchy** - Task organization structure (flat/hierarchical)
- **Dependencies** - Inter-task dependency graph
**Implementation Plan** (implementation plan)
- **Execution Strategy** - Execution strategy and methodology
- **Resource Requirements** - Required resources and tool selection
- **Success Criteria** - Success criteria and acceptance conditions
## Technical Reference
### Enhanced Task JSON Schema (5-Field + Artifacts)
Each task.json uses the workflow-architecture.md 5-field schema enhanced with artifacts:
- **id**: IMPL-N[.M] format (max 2 levels)
- **title**: Descriptive task name
- **status**: pending|active|completed|blocked|container
- **meta**: { type, agent }
- **context**: { requirements, focus_paths, acceptance, parent, depends_on, inherited, shared_context, **artifacts** }
- **flow_control**: { pre_analysis[] (with artifact loading), implementation_approach, target_files[] }
**Streamlined Artifacts Field with Single Synthesis Document**:
```json
"artifacts": [
{
"type": "synthesis_specification",
"source": "brainstorm_synthesis",
"path": ".workflow/WFS-[session]/.brainstorming/synthesis-specification.md",
"priority": "highest",
"contains": "complete_integrated_specification"
},
{
"type": "topic_framework",
"source": "brainstorm_framework",
"path": ".workflow/WFS-[session]/.brainstorming/topic-framework.md",
"priority": "medium",
"contains": "discussion_framework_structure"
},
{
"type": "individual_role_analysis",
"source": "brainstorm_roles",
"path": ".workflow/WFS-[session]/.brainstorming/[role]/analysis.md",
"priority": "low",
"contains": "role_specific_analysis_fallback"
}
]
```
**MCP Tools Integration**: Enhanced with optional MCP servers for advanced analysis:
- **Code Index MCP**: `mcp__code-index__find_files()`, `mcp__code-index__search_code_advanced()`
- **Exa MCP**: `mcp__exa__get_code_context_exa()` for external patterns
### Context Management & Agent Execution
**Agent Context Loading** ⚠️ CRITICAL
The following pre_analysis steps are generated for agent execution:
```json
// Example pre_analysis steps generated by /workflow:plan for agent execution
"flow_control": {
"pre_analysis": [
{
"step": "load_synthesis_specification",
"action": "Load consolidated synthesis specification from brainstorming",
"commands": [
"bash(ls .workflow/WFS-[session]/.brainstorming/synthesis-specification.md 2>/dev/null || echo 'synthesis specification not found')",
"Read(.workflow/WFS-[session]/.brainstorming/synthesis-specification.md)"
],
"output_to": "synthesis_specification",
"on_error": "skip_optional"
},
{
"step": "load_individual_role_artifacts",
"action": "Load individual role analyses as fallback",
"commands": [
"bash(find .workflow/WFS-[session]/.brainstorming/ -name 'analysis.md' 2>/dev/null | head -8)",
"Read(.workflow/WFS-[session]/.brainstorming/ui-designer/analysis.md)",
"Read(.workflow/WFS-[session]/.brainstorming/system-architect/analysis.md)",
"Read(.workflow/WFS-[session]/.brainstorming/topic-framework.md)"
],
"output_to": "individual_artifacts",
"on_error": "skip_optional"
},
{
"step": "load_planning_context",
"action": "Load plan-generated analysis and context",
"commands": [
"Read(.workflow/WFS-[session]/.process/ANALYSIS_RESULTS.md)",
"Read(.workflow/WFS-[session]/.process/context-package.json)"
],
"output_to": "planning_context"
},
{
"step": "load_context_assets",
"action": "Load structured assets from context package",
"command": "Read(.workflow/WFS-[session]/.process/context-package.json)",
"output_to": "context_assets"
},
{
"step": "mcp_codebase_exploration",
"action": "Explore codebase structure and patterns using MCP tools",
"command": "mcp__code-index__find_files(pattern=\"[task_focus_patterns]\") && mcp__code-index__search_code_advanced(pattern=\"[relevant_patterns]\", file_pattern=\"[target_extensions]\")",
"output_to": "codebase_structure"
},
{
"step": "mcp_external_context",
"action": "Get external API examples and best practices",
"command": "mcp__exa__get_code_context_exa(query=\"[task_technology] [task_patterns]\", tokensNum=\"dynamic\")",
"output_to": "external_context"
},
{
"step": "load_dependencies",
"action": "Retrieve dependency task summaries",
"command": "bash(cat .workflow/WFS-[session]/.summaries/IMPL-[dependency_id]-summary.md 2>/dev/null || echo 'dependency summary not found')",
"output_to": "dependency_context"
},
{
"step": "load_base_documentation",
"action": "Load core documentation files",
"commands": [
"bash(cat .workflow/docs/README.md 2>/dev/null || echo 'base docs not found')",
"bash(cat CLAUDE.md README.md 2>/dev/null || echo 'project docs not found')"
],
"output_to": "base_docs"
},
{
"step": "load_task_specific_docs",
"action": "Load documentation relevant to task type",
"commands": [
"bash(cat .workflow/docs/architecture/*.md 2>/dev/null || echo 'architecture docs not found')",
"bash(cat .workflow/docs/api/*.md 2>/dev/null || echo 'api docs not found')"
],
"output_to": "task_docs"
},
{
"step": "analyze_task_patterns",
"action": "Analyze existing code patterns for task context",
"commands": [
"bash(cd \"[task_focus_paths]\")",
"bash(~/.claude/scripts/gemini-wrapper -p \"PURPOSE: Analyze task patterns TASK: Review '[task_title]' patterns CONTEXT: Task [task_id] in [task_focus_paths], synthesis spec: [synthesis_specification], fallback artifacts: [individual_artifacts] EXPECTED: Pattern analysis integrating consolidated design specification RULES: Prioritize synthesis-specification.md over individual artifacts, align with consolidated requirements and design\")"
],
"output_to": "task_context",
"on_error": "fail"
}
],
"implementation_approach": {
"task_description": "Implement '[task_title]' following consolidated synthesis specification from [synthesis_specification] with fallback to [individual_artifacts]",
"modification_points": [
"Apply consolidated requirements and design patterns from synthesis-specification.md",
"Follow technical guidelines and implementation roadmap from synthesis specification",
"Integrate with existing patterns while maintaining design integrity from consolidated specification"
],
"logic_flow": [
"Load consolidated synthesis specification as primary context",
"Extract specific requirements, design patterns, and technical guidelines",
"Analyze existing code patterns for integration with synthesized design",
"Implement feature following consolidated specification",
"Validate implementation against synthesized acceptance criteria"
]
}
}
```
## Advanced Features
### Artifact Detection & Integration ⚠️ ENHANCED FEATURE
**Automatic Brainstorming Artifact Scanning**:
1. **Session Scan**: Check `.workflow/WFS-[session]/.brainstorming/` directory
2. **Role Detection**: Identify completed role analyses (ui-designer, system-architect, etc.)
3. **Artifact Mapping**: Map artifacts to relevant task types
4. **Relevance Scoring**: Assign relevance scores based on task-artifact alignment
**Artifact-Task Relevance Matrix**:
- **ui-designer** → UI/Frontend/Component tasks (high relevance)
- **system-architect** → Architecture/Backend/Database tasks (high relevance)
- **security-expert** → Authentication/Security/Validation tasks (high relevance)
- **data-architect** → Data/API/Analytics tasks (high relevance)
- **product-manager** → Feature/Business Logic tasks (medium relevance)
- **topic-framework.md** → All tasks (low-medium relevance for context)
**Artifact-Enhanced Task Creation Process**:
1. **Standard Task Generation**: Create base task from analysis results
2. **Artifact Detection**: Scan for relevant brainstorming outputs
3. **Context Enrichment**: Add artifacts array to task.context
4. **Pre-Analysis Enhancement**: Insert artifact loading steps
5. **Implementation Update**: Reference artifacts in task description and approach
**Automatic Artifact Integration Example**:
```json
{
"step": "load_brainstorming_artifacts",
"action": "Load brainstorming artifacts and design documents",
"commands": [
"bash(find .workflow/WFS-[session]/.brainstorming/ -name 'analysis.md' 2>/dev/null | while read file; do echo \"=== $(dirname \"$file\" | xargs basename) ===\"; cat \"$file\"; echo; done)",
"Read(.workflow/WFS-[session]/.brainstorming/topic-framework.md)"
],
"output_to": "brainstorming_artifacts",
"on_error": "skip_optional"
}
```
### Integration & Output
**Key Schemas**:
- **Task JSON**: 5-field schema (id, title, status, meta, context, flow_control) with artifacts integration
- **Artifacts**: synthesis-specification.md (highest), topic-framework.md (medium), role analyses (low)
- **Flow Control**: Pre-analysis steps for artifact loading, MCP tools, and pattern analysis
**Architecture Reference**: `@~/.claude/workflows/workflow-architecture.md`
**Documents Created for `/workflow:execute`**:
- **IMPL_PLAN.md**: Context loading and requirements with artifact references
- **.task/*.json**: Agent implementation context with enhanced artifact loading
- **TODO_LIST.md**: Status tracking (container tasks with ▸, leaf tasks with checkboxes)
## Command Chain Integration
1. `/workflow:plan [--agent]` → Orchestrates planning phases and delegates to modular commands
2. `/workflow:tools:context-gather` → Collects project context (Phase 2)
3. `/workflow:tools:concept-enhanced` → Analyzes and generates recommendations (Phase 3)
4. `/workflow:tools:task-generate` or `/workflow:tools:task-generate-agent` → Creates tasks and documents (Phase 4)
**Command Chain Integration**:
1. `/workflow:plan` → Creates implementation plan with task breakdown
2. `/workflow:execute` → Executes tasks using generated plan and context
3. Task management system → Tracks progress and dependencies
**Next Steps** (manual execution):
- Run `/workflow:execute` to begin task execution
- Run `/workflow:status` to check planning results and task status

View File

@@ -1,82 +1,221 @@
---
name: start
description: Discover existing sessions or start a new workflow session with intelligent session management
usage: /workflow:session:start [task_description]
argument-hint: [optional: task description for new session]
usage: /workflow:session:start [--auto|--new] [task_description]
argument-hint: [--auto|--new] [optional: task description for new session]
examples:
- /workflow:session:start "implement OAuth2 authentication"
- /workflow:session:start "fix login bug"
- /workflow:session:start
- /workflow:session:start --auto "implement OAuth2 authentication"
- /workflow:session:start --new "fix login bug"
---
# Start Workflow Session (/workflow:session:start)
## Overview
Manages workflow sessions - discovers existing active sessions or creates new ones.
Manages workflow sessions with three operation modes: discovery (manual), auto (intelligent), and force-new.
## Usage
## Mode 1: Discovery Mode (Default)
### Usage
```bash
/workflow:session:start # Discover/select existing sessions
/workflow:session:start "task description" # Create new session
/workflow:session:start
```
## Implementation Flow
### Step 1: Check for Active Sessions
### Step 1: Check Active Sessions
```bash
ls .workflow/.active-* 2>/dev/null
bash(ls .workflow/.active-* 2>/dev/null)
```
### Step 2: List Existing Sessions
### Step 2: List All Sessions
```bash
ls -1 .workflow/WFS-* 2>/dev/null | head -5
bash(ls -1 .workflow/WFS-* 2>/dev/null | head -5)
```
### Step 3: Create New Session (if needed)
### Step 3: Display Session Metadata
```bash
mkdir -p .workflow
echo "auth-system" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]'
bash(cat .workflow/WFS-promptmaster-platform/workflow-session.json)
```
### Step 4: Create Session Directory Structure
### Step 4: User Decision
Present session information and wait for user to select or create session.
**Output**: `SESSION_ID: WFS-[user-selected-id]`
## Mode 2: Auto Mode (Intelligent)
### Usage
```bash
mkdir -p .workflow/WFS-auth-system/.process
mkdir -p .workflow/WFS-auth-system/.task
mkdir -p .workflow/WFS-auth-system/.summaries
/workflow:session:start --auto "task description"
```
### Step 5: Create Session Metadata
### Step 1: Check Active Sessions Count
```bash
echo '{"session_id":"WFS-auth-system","project":"authentication system","status":"planning"}' > .workflow/WFS-auth-system/workflow-session.json
bash(ls .workflow/.active-* 2>/dev/null | wc -l)
```
### Step 6: Mark Session as Active
### Step 2a: No Active Sessions → Create New
```bash
touch .workflow/.active-WFS-auth-system
# Generate session slug
bash(echo "implement OAuth2 auth" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50)
# Create directory structure
bash(mkdir -p .workflow/WFS-implement-oauth2-auth/.process)
bash(mkdir -p .workflow/WFS-implement-oauth2-auth/.task)
bash(mkdir -p .workflow/WFS-implement-oauth2-auth/.summaries)
# Create metadata
bash(echo '{"session_id":"WFS-implement-oauth2-auth","project":"implement OAuth2 auth","status":"planning"}' > .workflow/WFS-implement-oauth2-auth/workflow-session.json)
# Mark as active
bash(touch .workflow/.active-WFS-implement-oauth2-auth)
```
### Step 7: Clean Old Active Markers (if creating new)
**Output**: `SESSION_ID: WFS-implement-oauth2-auth`
### Step 2b: Single Active Session → Check Relevance
```bash
rm .workflow/.active-WFS-* 2>/dev/null
# Extract session ID
bash(ls .workflow/.active-* 2>/dev/null | head -1 | xargs basename | sed 's/^\.active-//')
# Read project name from metadata
bash(cat .workflow/WFS-promptmaster-platform/workflow-session.json | grep -o '"project":"[^"]*"' | cut -d'"' -f4)
# Check keyword match (manual comparison)
# If task contains project keywords → Reuse session
# If task unrelated → Create new session (use Step 2a)
```
**Output (reuse)**: `SESSION_ID: WFS-promptmaster-platform`
**Output (new)**: `SESSION_ID: WFS-[new-slug]`
### Step 2c: Multiple Active Sessions → Use First
```bash
# Get first active session
bash(ls .workflow/.active-* 2>/dev/null | head -1 | xargs basename | sed 's/^\.active-//')
# Output warning and session ID
# WARNING: Multiple active sessions detected
# SESSION_ID: WFS-first-session
```
## Mode 3: Force New Mode
### Usage
```bash
/workflow:session:start --new "task description"
```
### Step 1: Generate Unique Session Slug
```bash
# Convert to slug
bash(echo "fix login bug" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50)
# Check if exists, add counter if needed
bash(ls .workflow/WFS-fix-login-bug 2>/dev/null && echo "WFS-fix-login-bug-2" || echo "WFS-fix-login-bug")
```
### Step 2: Create Session Structure
```bash
bash(mkdir -p .workflow/WFS-fix-login-bug/.process)
bash(mkdir -p .workflow/WFS-fix-login-bug/.task)
bash(mkdir -p .workflow/WFS-fix-login-bug/.summaries)
```
### Step 3: Create Metadata
```bash
bash(echo '{"session_id":"WFS-fix-login-bug","project":"fix login bug","status":"planning"}' > .workflow/WFS-fix-login-bug/workflow-session.json)
```
### Step 4: Mark Active and Clean Old Markers
```bash
bash(rm .workflow/.active-* 2>/dev/null)
bash(touch .workflow/.active-WFS-fix-login-bug)
```
**Output**: `SESSION_ID: WFS-fix-login-bug`
## Output Format Specification
### Success
```
SESSION_ID: WFS-session-slug
```
### Error
```
ERROR: --auto mode requires task description
ERROR: Failed to create session directory
```
### Analysis (Auto Mode)
```
ANALYSIS: Task relevance = high
DECISION: Reusing existing session
SESSION_ID: WFS-promptmaster-platform
```
## Command Integration
### For /workflow:plan (Use Auto Mode)
```bash
SlashCommand(command="/workflow:session:start --auto \"implement OAuth2 authentication\"")
# Parse session ID from output
grep "^SESSION_ID:" | awk '{print $2}'
```
### For Interactive Workflows (Use Discovery Mode)
```bash
SlashCommand(command="/workflow:session:start")
```
### For New Isolated Work (Use Force New Mode)
```bash
SlashCommand(command="/workflow:session:start --new \"experimental feature\"")
```
## Simple Bash Commands
### Basic Operations
- **Check sessions**: `ls .workflow/.active-*`
- **List sessions**: `ls .workflow/WFS-*`
- **Create directory**: `mkdir -p .workflow/WFS-session-name/.process`
- **Create file**: `echo 'content' > .workflow/session/file.json`
- **Mark active**: `touch .workflow/.active-WFS-session-name`
- **Clean markers**: `rm .workflow/.active-*`
```bash
# Check active sessions
bash(ls .workflow/.active-*)
### No Complex Logic
- No variables or functions
- No conditional statements
- No loops or pipes
- Direct bash commands only
# List all sessions
bash(ls .workflow/WFS-*)
# Read session metadata
bash(cat .workflow/WFS-[session-id]/workflow-session.json)
# Create session directories
bash(mkdir -p .workflow/WFS-[session-id]/.process)
bash(mkdir -p .workflow/WFS-[session-id]/.task)
bash(mkdir -p .workflow/WFS-[session-id]/.summaries)
# Mark session as active
bash(touch .workflow/.active-WFS-[session-id])
# Clean active markers
bash(rm .workflow/.active-*)
```
### Generate Session Slug
```bash
bash(echo "Task Description" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50)
```
### Create Metadata JSON
```bash
bash(echo '{"session_id":"WFS-test","project":"test project","status":"planning"}' > .workflow/WFS-test/workflow-session.json)
```
## Session ID Format
- Pattern: `WFS-[lowercase-slug]`
- Characters: `a-z`, `0-9`, `-` only
- Max length: 50 characters
- Uniqueness: Add numeric suffix if collision (`WFS-auth-2`, `WFS-auth-3`)
## Related Commands
- `/workflow:plan` - Uses this for session management
- `/workflow:execute` - Uses this for session discovery
- `/workflow:session:status` - Shows session information
- `/workflow:plan` - Uses `--auto` mode for session management
- `/workflow:execute` - Uses discovery mode for session selection
- `/workflow:session:status` - Shows detailed session information

View File

@@ -11,26 +11,28 @@ examples:
# Enhanced Analysis Command (/workflow:tools:concept-enhanced)
## Overview
Advanced intelligent planning engine with parallel CLI execution that processes standardized context packages, generates enhanced suggestions and design blueprints, and produces comprehensive analysis results with implementation strategies.
Advanced solution design and feasibility analysis engine with parallel CLI execution that processes standardized context packages and produces comprehensive technical analysis focused on solution improvements, key design decisions, and critical insights.
**Independent Usage**: This command can be called directly by users or as part of the `/workflow:plan` command. It accepts context packages and provides comprehensive analysis results that can be used for planning or standalone analysis.
**Analysis Focus**: Produces ANALYSIS_RESULTS.md with solution design, architectural rationale, feasibility assessment, and optimization strategies. Does NOT generate task breakdowns or implementation plans.
**Independent Usage**: This command can be called directly by users or as part of the `/workflow:plan` command. It accepts context packages and provides solution-focused technical analysis.
## Core Philosophy
- **Context-Driven**: Precise analysis based on comprehensive context
- **Intelligent Tool Selection**: Choose optimal analysis tools based on task characteristics
- **Solution-Focused**: Emphasize design decisions, architectural rationale, and critical insights
- **Context-Driven**: Precise analysis based on comprehensive context packages
- **Intelligent Tool Selection**: Choose optimal tools based on task complexity (Gemini for design, Codex for validation)
- **Parallel Execution**: Execute multiple CLI tools simultaneously for efficiency
- **Enhanced Suggestions**: Generate actionable recommendations and design blueprints
- **Write-Enabled**: Tools have full write permissions for implementation suggestions
- **Structured Output**: Generate standardized analysis reports with implementation roadmaps
- **No Task Planning**: Exclude implementation steps, task breakdowns, and project planning
- **Single Output**: Generate only ANALYSIS_RESULTS.md with technical analysis
## Core Responsibilities
- **Context Package Parsing**: Read and validate context-package.json
- **Parallel CLI Orchestration**: Execute multiple analysis tools simultaneously with write permissions
- **Enhanced Suggestions Generation**: Create actionable recommendations and design blueprints
- **Design Blueprint Creation**: Generate comprehensive technical implementation designs
- **Perspective Synthesis**: Collect and organize different tool viewpoints
- **Consensus Analysis**: Identify agreements and conflicts between tools
- **Summary Report Generation**: Output comprehensive ANALYSIS_RESULTS.md with implementation strategies
- **Parallel CLI Orchestration**: Execute Gemini (solution design) and optionally Codex (feasibility validation)
- **Solution Design Analysis**: Evaluate architecture, identify key design decisions with rationale
- **Feasibility Assessment**: Analyze technical complexity, risks, and implementation readiness
- **Optimization Recommendations**: Propose performance, security, and code quality improvements
- **Perspective Synthesis**: Integrate Gemini and Codex insights into unified solution assessment
- **Technical Analysis Report**: Generate ANALYSIS_RESULTS.md focused on design decisions and critical insights (NO task planning)
## Analysis Strategy Selection
@@ -114,41 +116,42 @@ Advanced intelligent planning engine with parallel CLI execution that processes
- Prepare error handling and recovery mechanisms
### Phase 3: Parallel Analysis Execution
1. **Gemini Comprehensive Analysis & Documentation**
1. **Gemini Solution Design & Architecture Analysis**
- **Tool Configuration**:
```bash
cd .workflow/{session_id}/.process && ~/.claude/scripts/gemini-wrapper -p "
PURPOSE: Generate comprehensive analysis and documentation for {task_description}
TASK: Analyze codebase, create implementation blueprints, and generate supporting documentation
PURPOSE: Analyze and design optimal solution for {task_description}
TASK: Evaluate current architecture, propose solution design, and identify key design decisions
CONTEXT: {context_package_assets}
EXPECTED:
1. Current State Analysis: Architecture patterns, code quality, technical debt, performance bottlenecks
2. Enhanced Suggestions: Implementation blueprints, code organization, API specifications, security guidelines
3. Implementation Roadmap: Phase-by-phase plans, CI/CD blueprints, testing strategies
4. Actionable Examples: Code templates, configuration scripts, integration patterns
5. Documentation Generation: Technical documentation, API docs, user guides, and README files
6. Generate .workflow/{session_id}/.process/gemini-enhanced-analysis.md with all analysis results
RULES: Create both analysis blueprints AND user-facing documentation. Generate actual documentation files, not just analysis of documentation needs. Focus on planning documents, architectural designs, and specifications - do NOT generate specific code implementations.
1. CURRENT STATE: Existing patterns, code structure, integration points, technical debt
2. SOLUTION DESIGN: Core architecture principles, system design, key design decisions with rationale
3. CRITICAL INSIGHTS: What works well, identified gaps, technical risks, architectural tradeoffs
4. OPTIMIZATION STRATEGIES: Performance improvements, security enhancements, code quality recommendations
5. FEASIBILITY ASSESSMENT: Complexity analysis, compatibility evaluation, implementation readiness
6. Generate .workflow/{session_id}/.process/gemini-solution-design.md with complete analysis
RULES: Focus on SOLUTION IMPROVEMENTS and KEY DESIGN DECISIONS, not task planning. Provide architectural rationale, evaluate alternatives, assess tradeoffs. Do NOT create task lists or implementation plans. Output ONLY ANALYSIS_RESULTS.md.
" --approval-mode yolo
```
- **Output Location**: `.workflow/{session_id}/.process/gemini-enhanced-analysis.md` + generated docs
- **Output Location**: `.workflow/{session_id}/.process/gemini-solution-design.md`
2. **Codex Implementation Validation** (Complex Tasks Only)
2. **Codex Technical Feasibility Validation** (Complex Tasks Only)
- **Tool Configuration**:
```bash
codex -C .workflow/{session_id}/.process --full-auto exec "
PURPOSE: Technical feasibility validation with write-enabled blueprint generation
TASK: Validate implementation feasibility and generate comprehensive blueprints
CONTEXT: {context_package_assets} and {gemini_analysis_results}
PURPOSE: Validate technical feasibility and identify implementation risks for {task_description}
TASK: Assess implementation complexity, validate technology choices, evaluate performance and security implications
CONTEXT: {context_package_assets} and {gemini_solution_design}
EXPECTED:
1. Feasibility Assessment: Complexity analysis, resource requirements, technology compatibility
2. Implementation Validation: Quality recommendations, security assessments, testing frameworks
3. Implementation Guides: Step-by-step procedures, configuration management, monitoring setup
4. Generate .workflow/{session_id}/.process/codex-validation-analysis.md with all validation results
RULES: Focus on technical validation, security assessments, and implementation planning examples. Create comprehensive validation documentation with architectural guidance and specifications - do NOT generate specific code implementations.
1. FEASIBILITY ASSESSMENT: Technical complexity rating, resource requirements, technology compatibility
2. RISK ANALYSIS: Implementation risks, integration challenges, performance concerns, security vulnerabilities
3. TECHNICAL VALIDATION: Development approach validation, quality standards assessment, maintenance implications
4. CRITICAL RECOMMENDATIONS: Must-have requirements, optimization opportunities, security controls
5. Generate .workflow/{session_id}/.process/codex-feasibility-validation.md with validation results
RULES: Focus on TECHNICAL FEASIBILITY and RISK ASSESSMENT, not implementation planning. Validate architectural decisions, identify potential issues, recommend optimizations. Do NOT create task breakdowns or step-by-step guides. Output ONLY feasibility analysis.
" --skip-git-repo-check -s danger-full-access
```
- **Output Location**: `.workflow/{session_id}/.process/codex-validation-analysis.md`
- **Output Location**: `.workflow/{session_id}/.process/codex-feasibility-validation.md`
3. **Parallel Execution Management**
- Launch both tools simultaneously for complex tasks
@@ -156,179 +159,209 @@ Advanced intelligent planning engine with parallel CLI execution that processes
- Handle process completion and error scenarios
- Maintain execution logs for debugging and recovery
### Phase 4: Results Collection & Validation
### Phase 4: Results Collection & Synthesis
1. **Output Validation & Collection**
- **Gemini Results**: Validate `gemini-enhanced-analysis.md` exists and contains complete analysis
- **Codex Results**: For complex tasks, validate `codex-validation-analysis.md` with implementation guidance
- **Gemini Results**: Validate `gemini-solution-design.md` contains complete solution analysis
- **Codex Results**: For complex tasks, validate `codex-feasibility-validation.md` with technical assessment
- **Fallback Processing**: Use execution logs if primary outputs are incomplete
- **Status Classification**: Mark each tool as completed, partial, failed, or skipped
2. **Quality Assessment**
- Verify analysis completeness against expected output structure
- Assess actionability of recommendations and blueprints
- Validate presence of concrete implementation examples
- Check coverage of technical requirements and constraints
- **Design Quality**: Verify architectural decisions have clear rationale and alternatives analysis
- **Insight Depth**: Assess quality of critical insights and risk identification
- **Feasibility Rigor**: Validate completeness of technical feasibility assessment
- **Optimization Value**: Check actionability of optimization recommendations
3. **Analysis Integration Strategy**
- **Simple/Medium Tasks**: Direct integration of Gemini comprehensive analysis
- **Complex Tasks**: Synthesis of Gemini understanding with Codex validation
- **Conflict Resolution**: Identify and resolve conflicting recommendations
- **Priority Matrix**: Organize recommendations by implementation priority
3. **Analysis Synthesis Strategy**
- **Simple/Medium Tasks**: Direct integration of Gemini solution design
- **Complex Tasks**: Synthesis of Gemini design with Codex feasibility validation
- **Conflict Resolution**: Identify architectural disagreements and provide balanced resolution
- **Confidence Scoring**: Assess overall solution confidence based on multi-tool consensus
### Phase 5: ANALYSIS_RESULTS.md Generation
1. **Structured Report Assembly**
- **Executive Summary**: Task overview, timestamp, tools used, key findings
- **Analysis Results**: Complete Gemini analysis with optional Codex validation
- **Synthesis & Recommendations**: Consolidated implementation strategy with risk mitigation
- **Implementation Roadmap**: Phase-by-phase development plan with timelines
- **Quality Assurance**: Testing frameworks, monitoring strategies, success criteria
- **Executive Summary**: Analysis focus, overall assessment, recommendation status
- **Current State Analysis**: Architecture overview, compatibility, critical findings
- **Proposed Solution Design**: Core principles, system design, key design decisions with rationale
- **Implementation Strategy**: Development approach, feasibility assessment, risk mitigation
- **Solution Optimization**: Performance, security, code quality recommendations
- **Critical Success Factors**: Technical requirements, quality metrics, success validation
- **Confidence & Recommendations**: Assessment scores, final recommendation with rationale
2. **Supplementary Outputs**
- **Machine-Readable Summary**: `analysis-summary.json` with structured metadata
- **Implementation Guidelines**: Phase-specific deliverables and checkpoints
- **Next Steps Matrix**: Immediate, short-term, and long-term action items
2. **Report Generation Guidelines**
- **Focus**: Solution improvements, key design decisions, critical insights
- **Exclude**: Task breakdowns, implementation steps, project planning
- **Emphasize**: Architectural rationale, tradeoff analysis, risk assessment
- **Structure**: Clear sections with decision justification and feasibility scoring
3. **Final Report Generation**
- **Primary Output**: `ANALYSIS_RESULTS.md` with comprehensive analysis and implementation blueprint
- **Secondary Output**: `analysis-summary.json` with machine-readable metadata and status
- **Report Structure**: Executive summary, analysis results, synthesis recommendations, implementation roadmap, quality assurance strategy
- **Action Items**: Immediate, short-term, and long-term next steps with success criteria
4. **Summary Report Finalization**
- Generate executive summary with key findings
- Create implementation priority matrix
- Provide next steps and action items
- Generate quality metrics and confidence scores
3. **Final Output**
- **Primary Output**: `ANALYSIS_RESULTS.md` - comprehensive solution design and technical analysis
- **Single File Policy**: Only generate ANALYSIS_RESULTS.md, no supplementary files
- **Report Location**: `.workflow/{session_id}/.process/ANALYSIS_RESULTS.md`
- **Content Focus**: Technical insights, design decisions, optimization strategies
## Analysis Results Format
Generated ANALYSIS_RESULTS.md format (Multi-Tool Perspective Analysis):
Generated ANALYSIS_RESULTS.md focuses on **solution improvements, key design decisions, and critical insights** (NOT task planning):
```markdown
# Multi-Tool Analysis Results
# Technical Analysis & Solution Design
## Task Overview
- **Description**: {task_description}
- **Context Package**: {context_package_path}
- **Analysis Tools**: {tools_used}
## Executive Summary
- **Analysis Focus**: {core_problem_or_improvement_area}
- **Analysis Timestamp**: {timestamp}
- **Tools Used**: {analysis_tools}
- **Overall Assessment**: {feasibility_score}/5 - {recommendation_status}
## Tool-Specific Analysis
---
### 🧠 Gemini Analysis (Enhanced Understanding & Architecture Blueprint)
**Focus**: Existing codebase understanding, enhanced suggestions, and comprehensive technical architecture design with actionable improvements
**Write Permissions**: Enabled for suggestion generation and blueprint creation
## 1. Current State Analysis
#### Current Architecture Assessment
- **Existing Patterns**: {identified_patterns}
- **Code Structure**: {current_structure}
- **Integration Points**: {integration_analysis}
- **Technical Debt**: {debt_assessment}
### Architecture Overview
- **Existing Patterns**: {key_architectural_patterns}
- **Code Structure**: {current_codebase_organization}
- **Integration Points**: {system_integration_touchpoints}
- **Technical Debt Areas**: {identified_debt_with_impact}
#### Compatibility Analysis
- **Framework Compatibility**: {framework_analysis}
- **Dependency Impact**: {dependency_analysis}
- **Migration Considerations**: {migration_notes}
### Compatibility & Dependencies
- **Framework Alignment**: {framework_compatibility_assessment}
- **Dependency Analysis**: {critical_dependencies_and_risks}
- **Migration Considerations**: {backward_compatibility_concerns}
#### Proposed Architecture
- **System Design**: {architectural_design}
- **Component Structure**: {component_design}
- **Data Flow**: {data_flow_design}
- **Interface Design**: {api_interface_design}
### Critical Findings
- **Strengths**: {what_works_well}
- **Gaps**: {missing_capabilities_or_issues}
- **Risks**: {identified_technical_and_business_risks}
#### Implementation Strategy
- **Code Organization**: {code_structure_plan}
- **Module Dependencies**: {module_dependencies}
- **Testing Strategy**: {testing_approach}
---
### 🔧 Codex Analysis (Implementation Blueprints & Enhanced Validation)
**Focus**: Implementation feasibility, write-enabled blueprints, and comprehensive technical validation with concrete examples
**Write Permissions**: Full access for implementation suggestion generation
## 2. Proposed Solution Design
#### Feasibility Assessment
- **Technical Risks**: {implementation_risks}
- **Performance Impact**: {performance_analysis}
- **Resource Requirements**: {resource_assessment}
- **Maintenance Complexity**: {maintenance_analysis}
### Core Architecture Principles
- **Design Philosophy**: {key_design_principles}
- **Architectural Approach**: {chosen_architectural_pattern_with_rationale}
- **Scalability Strategy**: {how_solution_scales}
#### Enhanced Implementation Blueprints
- **Tool Selection**: {recommended_tools_with_examples}
- **Development Approach**: {detailed_development_strategy}
- **Quality Assurance**: {comprehensive_qa_recommendations}
- **Code Examples**: {implementation_code_samples}
- **Testing Blueprints**: {automated_testing_strategies}
- **Deployment Guidelines**: {deployment_implementation_guide}
### System Design
- **Component Architecture**: {high_level_component_design}
- **Data Flow**: {data_flow_patterns_and_state_management}
- **API Design**: {interface_contracts_and_specifications}
- **Integration Strategy**: {how_components_integrate}
### Key Design Decisions
1. **Decision**: {critical_design_choice}
- **Rationale**: {why_this_approach}
- **Alternatives Considered**: {other_options_and_tradeoffs}
- **Impact**: {implications_on_architecture}
## Synthesis & Consensus
2. **Decision**: {another_critical_choice}
- **Rationale**: {reasoning}
- **Alternatives Considered**: {tradeoffs}
- **Impact**: {consequences}
### Enhanced Consolidated Recommendations
- **Architecture Approach**: {consensus_architecture_with_blueprints}
- **Implementation Priority**: {detailed_priority_matrix}
- **Risk Mitigation**: {comprehensive_risk_mitigation_strategy}
- **Performance Optimization**: {optimization_recommendations}
- **Security Enhancements**: {security_implementation_guide}
### Technical Specifications
- **Technology Stack**: {chosen_technologies_with_justification}
- **Code Organization**: {module_structure_and_patterns}
- **Testing Strategy**: {testing_approach_and_coverage}
- **Performance Targets**: {performance_requirements_and_benchmarks}
## Implementation Roadmap
---
### Phase 1: Foundation Setup
- **Infrastructure**: {infrastructure_setup_blueprint}
- **Development Environment**: {dev_env_configuration}
- **Initial Architecture**: {foundational_architecture}
## 3. Implementation Strategy
### Phase 2: Core Implementation
- **Priority Features**: {core_feature_implementation}
- **Testing Framework**: {testing_implementation_strategy}
- **Quality Gates**: {quality_assurance_checkpoints}
### Development Approach
- **Core Implementation Pattern**: {primary_implementation_strategy}
- **Module Dependencies**: {dependency_graph_and_order}
- **Quality Assurance**: {qa_approach_and_validation}
### Phase 3: Enhancement & Optimization
- **Performance Tuning**: {performance_enhancement_plan}
- **Security Hardening**: {security_implementation_steps}
- **Scalability Improvements**: {scalability_enhancement_strategy}
### Feasibility Assessment
- **Technical Complexity**: {complexity_rating_and_analysis}
- **Performance Impact**: {expected_performance_characteristics}
- **Resource Requirements**: {development_resources_needed}
- **Maintenance Burden**: {ongoing_maintenance_considerations}
## Enhanced Quality Assurance Strategy
### Risk Mitigation
- **Technical Risks**: {implementation_risks_and_mitigation}
- **Integration Risks**: {compatibility_challenges_and_solutions}
- **Performance Risks**: {performance_concerns_and_strategies}
- **Security Risks**: {security_vulnerabilities_and_controls}
### Automated Testing Blueprint
- **Unit Testing**: {unit_test_implementation}
- **Integration Testing**: {integration_test_strategy}
- **Performance Testing**: {performance_test_blueprint}
- **Security Testing**: {security_test_framework}
---
### Continuous Quality Monitoring
- **Code Quality Metrics**: {quality_monitoring_setup}
- **Performance Monitoring**: {performance_tracking_implementation}
- **Security Monitoring**: {security_monitoring_blueprint}
## 4. Solution Optimization
### Tool Agreement Analysis
- **Consensus Points**: {agreed_recommendations}
- **Conflicting Views**: {conflicting_opinions}
- **Resolution Strategy**: {conflict_resolution}
### Performance Optimization
- **Optimization Strategies**: {key_performance_improvements}
- **Caching Strategy**: {caching_approach_and_invalidation}
- **Resource Management**: {resource_utilization_optimization}
- **Bottleneck Mitigation**: {identified_bottlenecks_and_solutions}
### Task Decomposition Suggestions
1. **Primary Tasks**: {major_task_suggestions}
2. **Task Dependencies**: {dependency_mapping}
3. **Complexity Assessment**: {complexity_evaluation}
### Security Enhancements
- **Security Model**: {authentication_authorization_approach}
- **Data Protection**: {data_security_and_encryption}
- **Vulnerability Mitigation**: {known_vulnerabilities_and_controls}
- **Compliance**: {regulatory_and_compliance_considerations}
## Enhanced Analysis Quality Metrics
- **Context Coverage**: {coverage_percentage}
- **Multi-Tool Consensus**: {three_tool_consensus_level}
- **Analysis Depth**: {comprehensive_depth_assessment}
- **Implementation Feasibility**: {feasibility_confidence_score}
- **Blueprint Completeness**: {blueprint_coverage_score}
- **Actionability Score**: {suggestion_actionability_rating}
- **Overall Confidence**: {enhanced_confidence_score}
### Code Quality
- **Code Standards**: {coding_conventions_and_patterns}
- **Testing Coverage**: {test_strategy_and_coverage_goals}
- **Documentation**: {documentation_requirements}
- **Maintainability**: {maintainability_practices}
## Implementation Success Indicators
- **Technical Feasibility**: {technical_implementation_confidence}
- **Resource Adequacy**: {resource_requirement_assessment}
- **Timeline Realism**: {timeline_feasibility_score}
- **Risk Management**: {risk_mitigation_effectiveness}
---
## Next Steps & Action Items
1. **Immediate Actions**: {immediate_implementation_steps}
2. **Short-term Goals**: {short_term_objectives}
3. **Long-term Strategy**: {long_term_implementation_plan}
4. **Success Metrics**: {implementation_success_criteria}
## 5. Critical Success Factors
### Technical Requirements
- **Must Have**: {essential_technical_capabilities}
- **Should Have**: {important_but_not_critical_features}
- **Nice to Have**: {optional_enhancements}
### Quality Metrics
- **Performance Benchmarks**: {measurable_performance_targets}
- **Code Quality Standards**: {quality_metrics_and_thresholds}
- **Test Coverage Goals**: {testing_coverage_requirements}
- **Security Standards**: {security_compliance_requirements}
### Success Validation
- **Acceptance Criteria**: {how_to_validate_success}
- **Testing Strategy**: {validation_testing_approach}
- **Monitoring Plan**: {production_monitoring_strategy}
- **Rollback Plan**: {failure_recovery_strategy}
---
## 6. Analysis Confidence & Recommendations
### Assessment Scores
- **Conceptual Integrity**: {score}/5 - {brief_assessment}
- **Architectural Soundness**: {score}/5 - {brief_assessment}
- **Technical Feasibility**: {score}/5 - {brief_assessment}
- **Implementation Readiness**: {score}/5 - {brief_assessment}
- **Overall Confidence**: {overall_score}/5
### Final Recommendation
**Status**: {PROCEED|PROCEED_WITH_MODIFICATIONS|RECONSIDER|REJECT}
**Rationale**: {clear_explanation_of_recommendation}
**Critical Prerequisites**: {what_must_be_resolved_before_proceeding}
---
## 7. Reference Information
### Tool Analysis Summary
- **Gemini Insights**: {key_architectural_and_pattern_insights}
- **Codex Validation**: {technical_feasibility_and_implementation_notes}
- **Consensus Points**: {agreements_between_tools}
- **Conflicting Views**: {disagreements_and_resolution}
### Context & Resources
- **Analysis Context**: {context_package_reference}
- **Documentation References**: {relevant_documentation}
- **Related Patterns**: {similar_implementations_in_codebase}
- **External Resources**: {external_references_and_best_practices}
```
## Error Handling & Fallbacks
@@ -397,11 +430,10 @@ fi
- **Optional**: `--focus` specify analysis focus areas
### Output Interface
- **Primary**: Enhanced ANALYSIS_RESULTS.md file with implementation blueprints
- **Primary**: ANALYSIS_RESULTS.md - solution design and technical analysis
- **Location**: .workflow/{session_id}/.process/ANALYSIS_RESULTS.md
- **Secondary**: analysis-summary.json (machine-readable format)
- **Tertiary**: implementation-roadmap.md (detailed implementation guide)
- **Quaternary**: blueprint-templates/ directory (code templates and examples)
- **Single Output Policy**: Only ANALYSIS_RESULTS.md is generated
- **No Supplementary Files**: No additional JSON, roadmap, or template files
## Quality Assurance
@@ -411,15 +443,15 @@ fi
- **Feasibility Validation**: Ensure recommended implementation plans are feasible
### Success Criteria
- ✅ **Enhanced Output Generation**: Comprehensive ANALYSIS_RESULTS.md with implementation blueprints and machine-readable summary
- ✅ **Write-Enabled CLI Tools**: Full write permissions for Gemini (--approval-mode yolo) and Codex (exec ... --skip-git-repo-check -s danger-full-access)
- ✅ **Enhanced Suggestions**: Concrete implementation examples, configuration templates, and step-by-step procedures
- ✅ **Design Blueprints**: Detailed technical architecture with component diagrams and API specifications
- ✅ **Parallel Execution**: Efficient concurrent tool execution with proper monitoring and timeout handling
- ✅ **Solution-Focused Analysis**: ANALYSIS_RESULTS.md emphasizes solution improvements, design decisions, and critical insights
- ✅ **Single Output File**: Only ANALYSIS_RESULTS.md generated, no supplementary files
- ✅ **Design Decision Depth**: Clear rationale for architectural choices with alternatives and tradeoffs
- ✅ **Feasibility Assessment**: Technical complexity, risk analysis, and implementation readiness evaluation
- ✅ **Optimization Strategies**: Performance, security, and code quality recommendations
- ✅ **Parallel Execution**: Efficient concurrent tool execution (Gemini + Codex for complex tasks)
- ✅ **Robust Error Handling**: Comprehensive validation, timeout management, and partial result recovery
- ✅ **Actionable Results**: Implementation roadmap with phase-by-phase development strategy and success criteria
- ✅ **Quality Assurance**: Automated testing frameworks, CI/CD blueprints, and monitoring strategies
- ✅ **Performance Optimization**: Execution completes within 30 minutes with resource management
- ✅ **Confidence Scoring**: Multi-dimensional assessment with clear recommendation status
- ✅ **No Task Planning**: Exclude task breakdowns, implementation steps, and project planning details
## Related Commands
- `/context:gather` - Generate context packages required by this command

View File

@@ -0,0 +1,420 @@
---
name: task-generate-agent
description: Autonomous task generation using action-planning-agent with discovery and output phases
usage: /workflow:tools:task-generate-agent --session <session_id>
argument-hint: "--session WFS-session-id"
examples:
- /workflow:tools:task-generate-agent --session WFS-auth
---
# Autonomous Task Generation Command
## Overview
Autonomous task JSON and IMPL_PLAN.md generation using action-planning-agent with two-phase execution: discovery and document generation.
## Core Philosophy
- **Agent-Driven**: Delegate execution to action-planning-agent for autonomous operation
- **Two-Phase Flow**: Discovery (context gathering) → Output (document generation)
- **Memory-First**: Reuse loaded documents from conversation memory
- **MCP-Enhanced**: Use MCP tools for advanced code analysis and research
## Execution Lifecycle
### Phase 1: Discovery & Context Loading
**⚡ Memory-First Rule**: Skip file loading if documents already in conversation memory
**Agent Context Package**:
```javascript
{
"session_id": "WFS-[session-id]",
"session_metadata": {
// If in memory: use cached content
// Else: Load from .workflow/{session-id}/workflow-session.json
},
"analysis_results": {
// If in memory: use cached content
// Else: Load from .workflow/{session-id}/.process/ANALYSIS_RESULTS.md
},
"artifacts_inventory": {
// If in memory: use cached list
// Else: Scan .workflow/{session-id}/.brainstorming/ directory
"synthesis_specification": "path or null",
"topic_framework": "path or null",
"role_analyses": ["paths"]
},
"context_package": {
// If in memory: use cached content
// Else: Load from .workflow/{session-id}/.process/context-package.json
},
"mcp_capabilities": {
"code_index": true,
"exa_code": true,
"exa_web": true
}
}
```
**Discovery Actions**:
1. **Load Session Context** (if not in memory)
```javascript
if (!memory.has("workflow-session.json")) {
Read(.workflow/{session-id}/workflow-session.json)
}
```
2. **Load Analysis Results** (if not in memory)
```javascript
if (!memory.has("ANALYSIS_RESULTS.md")) {
Read(.workflow/{session-id}/.process/ANALYSIS_RESULTS.md)
}
```
3. **Discover Artifacts** (if not in memory)
```javascript
if (!memory.has("artifacts_inventory")) {
bash(find .workflow/{session-id}/.brainstorming/ -name "*.md" -type f)
}
```
4. **MCP Code Analysis** (optional - enhance understanding)
```javascript
// Find relevant files for task context
mcp__code-index__find_files(pattern="*auth*")
mcp__code-index__search_code_advanced(
pattern="authentication|oauth",
file_pattern="*.ts"
)
```
5. **MCP External Research** (optional - gather best practices)
```javascript
// Get external examples for implementation
mcp__exa__get_code_context_exa(
query="TypeScript JWT authentication best practices",
tokensNum="dynamic"
)
```
### Phase 2: Agent Execution (Document Generation)
**Agent Invocation**:
```javascript
Task(
subagent_type="action-planning-agent",
description="Generate task JSON and implementation plan",
prompt=`
## Execution Context
**Session ID**: WFS-{session-id}
**Mode**: Two-Phase Autonomous Task Generation
## Phase 1: Discovery Results (Provided Context)
### Session Metadata
{session_metadata_content}
### Analysis Results
{analysis_results_content}
### Artifacts Inventory
- **Synthesis Specification**: {synthesis_spec_path}
- **Topic Framework**: {topic_framework_path}
- **Role Analyses**: {role_analyses_list}
### Context Package
{context_package_summary}
### MCP Analysis Results (Optional)
**Code Structure**: {mcp_code_index_results}
**External Research**: {mcp_exa_research_results}
## Phase 2: Document Generation Task
### Task Decomposition Standards
**Core Principle**: Task Merging Over Decomposition
- **Merge Rule**: Execute together when possible
- **Decompose Only When**:
- Excessive workload (>2500 lines or >6 files)
- Different tech stacks or domains
- Sequential dependency blocking
- Parallel execution needed
**Task Limits**:
- **Maximum 10 tasks** (hard limit)
- **Function-based**: Complete units (logic + UI + tests + config)
- **Hierarchy**: Flat (≤5) | Two-level (6-10) | Re-scope (>10)
### Required Outputs
#### 1. Task JSON Files (.task/IMPL-*.json)
**Location**: .workflow/{session-id}/.task/
**Schema**: 5-field enhanced schema with artifacts
**Required Fields**:
\`\`\`json
{
"id": "IMPL-N[.M]",
"title": "Descriptive task name",
"status": "pending",
"meta": {
"type": "feature|bugfix|refactor|test|docs",
"agent": "@code-developer|@code-review-test-agent"
},
"context": {
"requirements": ["extracted from analysis"],
"focus_paths": ["src/paths"],
"acceptance": ["measurable criteria"],
"depends_on": ["IMPL-N"],
"artifacts": [
{
"type": "synthesis_specification",
"path": "{synthesis_spec_path}",
"priority": "highest"
}
]
},
"flow_control": {
"pre_analysis": [
{
"step": "load_synthesis_specification",
"action": "Load consolidated synthesis specification",
"commands": [
"bash(ls {synthesis_spec_path} 2>/dev/null || echo 'not found')",
"Read({synthesis_spec_path})"
],
"output_to": "synthesis_specification",
"on_error": "skip_optional"
},
{
"step": "mcp_codebase_exploration",
"action": "Explore codebase using MCP",
"command": "mcp__code-index__find_files(pattern=\\"[patterns]\\") && mcp__code-index__search_code_advanced(pattern=\\"[patterns]\\")",
"output_to": "codebase_structure"
},
{
"step": "analyze_task_patterns",
"action": "Analyze existing code patterns",
"commands": [
"bash(cd \\"[focus_paths]\\")",
"bash(~/.claude/scripts/gemini-wrapper -p \\"PURPOSE: Analyze patterns TASK: Review '[title]' CONTEXT: [synthesis_specification] EXPECTED: Pattern analysis RULES: Prioritize synthesis-specification.md\\")"
],
"output_to": "task_context",
"on_error": "fail"
}
],
"implementation_approach": {
"task_description": "Implement '[title]' following synthesis specification",
"modification_points": ["Apply requirements from synthesis"],
"logic_flow": [
"Load synthesis specification",
"Analyze existing patterns",
"Implement following specification",
"Validate against acceptance criteria"
]
},
"target_files": ["file:function:lines"]
}
}
\`\`\`
#### 2. IMPL_PLAN.md
**Location**: .workflow/{session-id}/IMPL_PLAN.md
**Structure**:
\`\`\`markdown
---
identifier: WFS-{session-id}
source: "User requirements"
analysis: .workflow/{session-id}/.process/ANALYSIS_RESULTS.md
---
# Implementation Plan: {Project Title}
## Summary
Core requirements, objectives, and technical approach.
## Context Analysis
- **Project**: Type, patterns, tech stack
- **Modules**: Components and integration points
- **Dependencies**: External libraries and constraints
- **Patterns**: Code conventions and guidelines
## Brainstorming Artifacts
- synthesis-specification.md (Highest priority)
- topic-framework.md (Medium priority)
- Role analyses: ui-designer, system-architect, etc.
## Task Breakdown
- **Task Count**: N tasks, complexity level
- **Hierarchy**: Flat/Two-level structure
- **Dependencies**: Task dependency graph
## Implementation Plan
- **Execution Strategy**: Sequential/Parallel approach
- **Resource Requirements**: Tools, dependencies, artifacts
- **Success Criteria**: Metrics and acceptance conditions
\`\`\`
#### 3. TODO_LIST.md
**Location**: .workflow/{session-id}/TODO_LIST.md
**Structure**:
\`\`\`markdown
# Tasks: {Session Topic}
## Task Progress
**IMPL-001**: [Main Task Group] → [📋](./.task/IMPL-001.json)
- [ ] **IMPL-001.1**: [Subtask] → [📋](./.task/IMPL-001.1.json)
- [ ] **IMPL-001.2**: [Subtask] → [📋](./.task/IMPL-001.2.json)
- [ ] **IMPL-002**: [Simple Task] → [📋](./.task/IMPL-002.json)
## Status Legend
- \`▸\` = Container task (has subtasks)
- \`- [ ]\` = Pending leaf task
- \`- [x]\` = Completed leaf task
\`\`\`
### Execution Instructions
**Step 1: Extract Task Definitions**
- Parse analysis results for task recommendations
- Extract task ID, title, requirements, complexity
- Map artifacts to relevant tasks based on type
**Step 2: Generate Task JSON Files**
- Create individual .task/IMPL-*.json files
- Embed artifacts array with detected brainstorming outputs
- Generate flow_control with artifact loading steps
- Add MCP tool integration for codebase exploration
**Step 3: Create IMPL_PLAN.md**
- Summarize requirements and technical approach
- List detected artifacts with priorities
- Document task breakdown and dependencies
- Define execution strategy and success criteria
**Step 4: Generate TODO_LIST.md**
- List all tasks with container/leaf structure
- Link to task JSON files
- Use proper status indicators (▸, [ ], [x])
**Step 5: Update Session State**
- Update .workflow/{session-id}/workflow-session.json
- Mark session as ready for execution
- Record task count and artifact inventory
### MCP Enhancement Examples
**Code Index Usage**:
\`\`\`javascript
// Discover authentication-related files
mcp__code-index__find_files(pattern="*auth*")
// Search for OAuth patterns
mcp__code-index__search_code_advanced(
pattern="oauth|jwt|authentication",
file_pattern="*.{ts,js}"
)
// Get file summary for key components
mcp__code-index__get_file_summary(
file_path="src/auth/index.ts"
)
\`\`\`
**Exa Research Usage**:
\`\`\`javascript
// Get best practices for task implementation
mcp__exa__get_code_context_exa(
query="TypeScript OAuth2 implementation patterns",
tokensNum="dynamic"
)
// Research specific API usage
mcp__exa__get_code_context_exa(
query="Express.js JWT middleware examples",
tokensNum=5000
)
\`\`\`
### Quality Validation
Before completion, verify:
- [ ] All task JSON files created in .task/ directory
- [ ] Each task JSON has 5 required fields
- [ ] Artifact references correctly mapped
- [ ] Flow control includes artifact loading steps
- [ ] MCP tool integration added where appropriate
- [ ] IMPL_PLAN.md follows required structure
- [ ] TODO_LIST.md matches task JSONs
- [ ] Dependency graph is acyclic
- [ ] Task count within limits (≤10)
- [ ] Session state updated
## Output
Generate all three documents and report completion status:
- Task JSON files created: N files
- Artifacts integrated: synthesis-spec, topic-framework, N role analyses
- MCP enhancements: code-index, exa-research
- Session ready for execution: /workflow:execute
`
)
```
## Command Integration
### Usage
```bash
# Basic usage
/workflow:tools:task-generate-agent --session WFS-auth
# Called by /workflow:plan
SlashCommand(command="/workflow:tools:task-generate-agent --session WFS-[id]")
```
### Agent Context Passing
**Memory-Aware Context Assembly**:
```javascript
// Assemble context package for agent
const agentContext = {
session_id: "WFS-[id]",
// Use memory if available, else load
session_metadata: memory.has("workflow-session.json")
? memory.get("workflow-session.json")
: Read(.workflow/WFS-[id]/workflow-session.json),
analysis_results: memory.has("ANALYSIS_RESULTS.md")
? memory.get("ANALYSIS_RESULTS.md")
: Read(.workflow/WFS-[id]/.process/ANALYSIS_RESULTS.md),
artifacts_inventory: memory.has("artifacts_inventory")
? memory.get("artifacts_inventory")
: discoverArtifacts(),
context_package: memory.has("context-package.json")
? memory.get("context-package.json")
: Read(.workflow/WFS-[id]/.process/context-package.json),
// Optional MCP enhancements
mcp_analysis: executeMcpDiscovery()
}
```
## Related Commands
- `/workflow:plan` - Orchestrates planning and calls this command
- `/workflow:tools:task-generate` - Manual version without agent
- `/workflow:tools:context-gather` - Provides context package
- `/workflow:tools:concept-enhanced` - Provides analysis results
- `/workflow:execute` - Executes generated tasks
## Key Differences from task-generate
| Feature | task-generate | task-generate-agent |
|---------|--------------|-------------------|
| Execution | Manual/scripted | Agent-driven |
| Phases | 6 phases | 2 phases (discovery + output) |
| MCP Integration | Optional | Enhanced with examples |
| Decision Logic | Command-driven | Agent-autonomous |
| Complexity | Higher control | Simpler delegation |

View File

@@ -0,0 +1,314 @@
---
name: task-generate
description: Generate task JSON files and IMPL_PLAN.md from analysis results with artifacts integration
usage: /workflow:tools:task-generate --session <session_id>
argument-hint: "--session WFS-session-id"
examples:
- /workflow:tools:task-generate --session WFS-auth
---
# Task Generation Command
## Overview
Generate task JSON files and IMPL_PLAN.md from analysis results with automatic artifact detection and integration.
## Core Philosophy
- **Analysis-Driven**: Generate from ANALYSIS_RESULTS.md
- **Artifact-Aware**: Auto-detect brainstorming outputs
- **Context-Rich**: Embed comprehensive context in task JSON
- **Flow-Control Ready**: Pre-define implementation steps
- **Memory-First**: Reuse loaded documents from memory
## Core Responsibilities
- Parse analysis results and extract tasks
- Detect and integrate brainstorming artifacts
- Generate enhanced task JSON files (5-field schema)
- Create IMPL_PLAN.md and TODO_LIST.md
- Update session state for execution
## Execution Lifecycle
### Phase 1: Input Validation & Discovery
**⚡ Memory-First Rule**: Skip file loading if documents already in conversation memory
1. **Session Validation**
- If session metadata in memory → Skip loading
- Else: Load `.workflow/{session_id}/workflow-session.json`
2. **Analysis Results Loading**
- If ANALYSIS_RESULTS.md in memory → Skip loading
- Else: Read `.workflow/{session_id}/.process/ANALYSIS_RESULTS.md`
3. **Artifact Discovery**
- If artifact inventory in memory → Skip scanning
- Else: Scan `.workflow/{session_id}/.brainstorming/` directory
- Detect: synthesis-specification.md, topic-framework.md, role analyses
### Phase 2: Task JSON Generation
#### Task Decomposition Standards
**Core Principle: Task Merging Over Decomposition**
- **Merge Rule**: Execute together when possible
- **Decompose Only When**:
- Excessive workload (>2500 lines or >6 files)
- Different tech stacks or domains
- Sequential dependency blocking
- Parallel execution needed
**Task Limits**:
- **Maximum 10 tasks** (hard limit)
- **Function-based**: Complete units (logic + UI + tests + config)
- **Hierarchy**: Flat (≤5) | Two-level (6-10) | Re-scope (>10)
#### Enhanced Task JSON Schema (5-Field + Artifacts)
```json
{
"id": "IMPL-N[.M]",
"title": "Descriptive task name",
"status": "pending|active|completed|blocked|container",
"meta": {
"type": "feature|bugfix|refactor|test|docs",
"agent": "@code-developer|@planning-agent|@code-review-test-agent"
},
"context": {
"requirements": ["Clear requirement from analysis"],
"focus_paths": ["src/module/path", "tests/module/path"],
"acceptance": ["Measurable acceptance criterion"],
"parent": "IMPL-N",
"depends_on": ["IMPL-N.M"],
"inherited": {"shared_patterns": [], "common_dependencies": []},
"shared_context": {"tech_stack": [], "conventions": []},
"artifacts": [
{
"type": "synthesis_specification",
"source": "brainstorm_synthesis",
"path": ".workflow/WFS-[session]/.brainstorming/synthesis-specification.md",
"priority": "highest",
"contains": "complete_integrated_specification"
},
{
"type": "topic_framework",
"source": "brainstorm_framework",
"path": ".workflow/WFS-[session]/.brainstorming/topic-framework.md",
"priority": "medium",
"contains": "discussion_framework_structure"
},
{
"type": "individual_role_analysis",
"source": "brainstorm_roles",
"path": ".workflow/WFS-[session]/.brainstorming/[role]/analysis.md",
"priority": "low",
"contains": "role_specific_analysis_fallback"
}
]
},
"flow_control": {
"pre_analysis": [
{
"step": "load_synthesis_specification",
"action": "Load consolidated synthesis specification",
"commands": [
"bash(ls .workflow/WFS-[session]/.brainstorming/synthesis-specification.md 2>/dev/null || echo 'not found')",
"Read(.workflow/WFS-[session]/.brainstorming/synthesis-specification.md)"
],
"output_to": "synthesis_specification",
"on_error": "skip_optional"
},
{
"step": "load_individual_role_artifacts",
"action": "Load individual role analyses as fallback",
"commands": [
"bash(find .workflow/WFS-[session]/.brainstorming/ -name 'analysis.md' 2>/dev/null | head -8)",
"Read(.workflow/WFS-[session]/.brainstorming/ui-designer/analysis.md)",
"Read(.workflow/WFS-[session]/.brainstorming/system-architect/analysis.md)"
],
"output_to": "individual_artifacts",
"on_error": "skip_optional"
},
{
"step": "load_planning_context",
"action": "Load plan-generated analysis",
"commands": [
"Read(.workflow/WFS-[session]/.process/ANALYSIS_RESULTS.md)",
"Read(.workflow/WFS-[session]/.process/context-package.json)"
],
"output_to": "planning_context"
},
{
"step": "mcp_codebase_exploration",
"action": "Explore codebase using MCP tools",
"command": "mcp__code-index__find_files(pattern=\"[patterns]\") && mcp__code-index__search_code_advanced(pattern=\"[patterns]\")",
"output_to": "codebase_structure"
},
{
"step": "analyze_task_patterns",
"action": "Analyze existing code patterns",
"commands": [
"bash(cd \"[focus_paths]\")",
"bash(~/.claude/scripts/gemini-wrapper -p \"PURPOSE: Analyze patterns TASK: Review '[title]' CONTEXT: [synthesis_specification] [individual_artifacts] EXPECTED: Pattern analysis RULES: Prioritize synthesis-specification.md\")"
],
"output_to": "task_context",
"on_error": "fail"
}
],
"implementation_approach": {
"task_description": "Implement '[title]' following synthesis specification",
"modification_points": [
"Apply consolidated requirements from synthesis-specification.md",
"Follow technical guidelines from synthesis",
"Integrate with existing patterns"
],
"logic_flow": [
"Load synthesis specification",
"Extract requirements and design",
"Analyze existing patterns",
"Implement following specification",
"Validate against acceptance criteria"
]
},
"target_files": ["file:function:lines"]
}
}
```
#### Task Generation Process
1. Parse analysis results and extract task definitions
2. Detect brainstorming artifacts with priority scoring
3. Generate task context (requirements, focus_paths, acceptance)
4. Build flow_control with artifact loading steps
5. Create individual task JSON files in `.task/`
### Phase 3: Artifact Detection & Integration
#### Artifact Priority
1. **synthesis-specification.md** (highest) - Complete integrated spec
2. **topic-framework.md** (medium) - Discussion framework
3. **role/analysis.md** (low) - Individual perspectives
#### Artifact-Task Mapping
- **synthesis-specification.md** → All tasks
- **ui-designer/analysis.md** → UI/Frontend tasks
- **system-architect/analysis.md** → Architecture/Backend tasks
- **security-expert/analysis.md** → Security tasks
- **data-architect/analysis.md** → Data/API tasks
### Phase 4: IMPL_PLAN.md Generation
#### Document Structure
```markdown
---
identifier: WFS-{session-id}
source: "User requirements" | "File: path" | "Issue: ISS-001"
analysis: .workflow/{session-id}/.process/ANALYSIS_RESULTS.md
---
# Implementation Plan: {Project Title}
## Summary
Core requirements, objectives, and technical approach.
## Context Analysis
- **Project**: Type, patterns, tech stack
- **Modules**: Components and integration points
- **Dependencies**: External libraries and constraints
- **Patterns**: Code conventions and guidelines
## Brainstorming Artifacts
- synthesis-specification.md (Highest priority)
- topic-framework.md (Medium priority)
- Role analyses: ui-designer, system-architect, etc.
## Task Breakdown
- **Task Count**: N tasks, complexity level
- **Hierarchy**: Flat/Two-level structure
- **Dependencies**: Task dependency graph
## Implementation Plan
- **Execution Strategy**: Sequential/Parallel approach
- **Resource Requirements**: Tools, dependencies, artifacts
- **Success Criteria**: Metrics and acceptance conditions
```
### Phase 5: TODO_LIST.md Generation
#### Document Structure
```markdown
# Tasks: [Session Topic]
## Task Progress
**IMPL-001**: [Main Task Group] → [📋](./.task/IMPL-001.json)
- [ ] **IMPL-001.1**: [Subtask] → [📋](./.task/IMPL-001.1.json)
- [x] **IMPL-001.2**: [Subtask] → [📋](./.task/IMPL-001.2.json) | [](./.summaries/IMPL-001.2-summary.md)
- [x] **IMPL-002**: [Simple Task] → [📋](./.task/IMPL-002.json) | [](./.summaries/IMPL-002-summary.md)
## Status Legend
- `▸` = Container task (has subtasks)
- `- [ ]` = Pending leaf task
- `- [x]` = Completed leaf task
- Maximum 2 levels: Main tasks and subtasks only
```
### Phase 6: Session State Update
1. Update workflow-session.json with task count and artifacts
2. Validate all output files (task JSONs, IMPL_PLAN.md, TODO_LIST.md)
3. Generate completion report
## Output Files Structure
```
.workflow/{session-id}/
├── IMPL_PLAN.md # Implementation plan
├── TODO_LIST.md # Progress tracking
├── .task/
│ ├── IMPL-1.json # Container task
│ ├── IMPL-1.1.json # Leaf task with flow_control
│ └── IMPL-1.2.json # Leaf task with flow_control
├── .brainstorming/ # Input artifacts
│ ├── synthesis-specification.md
│ ├── topic-framework.md
│ └── {role}/analysis.md
└── .process/
├── ANALYSIS_RESULTS.md # Input from concept-enhanced
└── context-package.json # Input from context-gather
```
## Error Handling
### Input Validation Errors
| Error | Cause | Resolution |
|-------|-------|------------|
| Session not found | Invalid session ID | Verify session exists |
| Analysis missing | Incomplete planning | Run concept-enhanced first |
| Invalid format | Corrupted results | Regenerate analysis |
### Task Generation Errors
| Error | Cause | Resolution |
|-------|-------|------------|
| Count exceeds limit | >10 tasks | Re-scope requirements |
| Invalid structure | Missing fields | Fix analysis results |
| Dependency cycle | Circular refs | Adjust dependencies |
### Artifact Integration Errors
| Error | Cause | Recovery |
|-------|-------|----------|
| Artifact not found | Missing output | Continue without artifacts |
| Invalid format | Corrupted file | Skip artifact loading |
| Path invalid | Moved/deleted | Update references |
## Integration & Usage
### Command Chain
- **Called By**: `/workflow:plan` (Phase 4)
- **Calls**: None (terminal command)
- **Followed By**: `/workflow:execute`, `/workflow:status`
### Basic Usage
```bash
/workflow:tools:task-generate --session WFS-auth
```
## Related Commands
- `/workflow:plan` - Orchestrates entire planning
- `/workflow:tools:context-gather` - Provides context package
- `/workflow:tools:concept-enhanced` - Provides analysis results
- `/workflow:execute` - Executes generated tasks