mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
refactor: split task JSON templates and improve CLI mode support
- Split task-json-schema.txt into two mode-specific templates: - task-json-agent-mode.txt: Agent execution (no command field) - task-json-cli-mode.txt: CLI execution (with command field) - Update task-generate.md: - Remove outdated Codex resume mechanism description - Add clear execution mode examples (Agent/CLI) - Simplify CLI Execute Mode Details section - Update task-generate-agent.md: - Add --cli-execute flag support - Command selects template path before invoking agent - Agent receives template path and reads it (not content) - Clarify responsibility: Command decides, Agent executes - Improve architecture: - Clear separation: Command layer (template selection) vs Agent layer (content generation) - Template selection based on flag, not agent logic - Agent simplicity: receives path, reads template, generates content 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
---
|
||||
name: task-generate-agent
|
||||
description: Autonomous task generation using action-planning-agent with discovery and output phases
|
||||
argument-hint: "--session WFS-session-id"
|
||||
argument-hint: "--session WFS-session-id [--cli-execute]"
|
||||
examples:
|
||||
- /workflow:tools:task-generate-agent --session WFS-auth
|
||||
- /workflow:tools:task-generate-agent --session WFS-auth --cli-execute
|
||||
---
|
||||
|
||||
# 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.
|
||||
Autonomous task JSON and IMPL_PLAN.md generation using action-planning-agent with two-phase execution: discovery and document generation. Supports both agent-driven execution (default) and CLI tool execution modes.
|
||||
|
||||
## 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
|
||||
- **Pre-Selected Templates**: Command selects correct template based on `--cli-execute` flag **before** invoking agent
|
||||
- **Agent Simplicity**: Agent receives pre-selected template and focuses only on content generation
|
||||
|
||||
## Execution Lifecycle
|
||||
|
||||
@@ -26,6 +29,10 @@ Autonomous task JSON and IMPL_PLAN.md generation using action-planning-agent wit
|
||||
```javascript
|
||||
{
|
||||
"session_id": "WFS-[session-id]",
|
||||
"execution_mode": "agent-mode" | "cli-execute-mode", // Determined by flag
|
||||
"task_json_template_path": "~/.claude/workflows/cli-templates/prompts/workflow/task-json-agent-mode.txt"
|
||||
| "~/.claude/workflows/cli-templates/prompts/workflow/task-json-cli-mode.txt",
|
||||
// Path selected by command based on --cli-execute flag, agent reads it
|
||||
"session_metadata": {
|
||||
// If in memory: use cached content
|
||||
// Else: Load from .workflow/{session-id}/workflow-session.json
|
||||
@@ -96,6 +103,14 @@ Autonomous task JSON and IMPL_PLAN.md generation using action-planning-agent wit
|
||||
|
||||
### Phase 2: Agent Execution (Document Generation)
|
||||
|
||||
**Pre-Agent Template Selection** (Command decides path before invoking agent):
|
||||
```javascript
|
||||
// Command checks flag and selects template PATH (not content)
|
||||
const templatePath = hasCliExecuteFlag
|
||||
? "~/.claude/workflows/cli-templates/prompts/workflow/task-json-cli-mode.txt"
|
||||
: "~/.claude/workflows/cli-templates/prompts/workflow/task-json-agent-mode.txt";
|
||||
```
|
||||
|
||||
**Agent Invocation**:
|
||||
```javascript
|
||||
Task(
|
||||
@@ -105,7 +120,8 @@ Task(
|
||||
## Execution Context
|
||||
|
||||
**Session ID**: WFS-{session-id}
|
||||
**Mode**: Two-Phase Autonomous Task Generation
|
||||
**Execution Mode**: {agent-mode | cli-execute-mode}
|
||||
**Task JSON Template Path**: {template_path}
|
||||
|
||||
## Phase 1: Discovery Results (Provided Context)
|
||||
|
||||
@@ -147,17 +163,18 @@ Task(
|
||||
|
||||
#### 1. Task JSON Files (.task/IMPL-*.json)
|
||||
**Location**: .workflow/{session-id}/.task/
|
||||
**Schema**: 5-field enhanced schema with artifacts
|
||||
**Template**: Read from the template path provided above
|
||||
|
||||
**Task JSON Schema Template**:
|
||||
**Task JSON Template Loading**:
|
||||
\`\`\`
|
||||
$(cat ~/.claude/workflows/cli-templates/prompts/workflow/task-json-schema.txt)
|
||||
Read({template_path})
|
||||
\`\`\`
|
||||
|
||||
**Important**:
|
||||
- Use the schema template above for all task JSON generation
|
||||
- Replace placeholder variables ({synthesis_spec_path}, {role_analysis_path}, etc.) with actual paths
|
||||
- Include MCP tool integration examples in pre_analysis steps
|
||||
- Read the template from the path provided in context
|
||||
- Use the template structure exactly as written
|
||||
- Replace placeholder variables ({synthesis_spec_path}, {role_analysis_path}, etc.) with actual session-specific paths
|
||||
- Include MCP tool integration in pre_analysis steps
|
||||
- Map artifacts based on task domain (UI → ui-designer, Backend → system-architect)
|
||||
|
||||
#### 2. IMPL_PLAN.md
|
||||
@@ -194,34 +211,43 @@ $(cat ~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt)
|
||||
- \`- [x]\` = Completed leaf task
|
||||
\`\`\`
|
||||
|
||||
### Execution Instructions
|
||||
### Execution Instructions for Agent
|
||||
|
||||
**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
|
||||
**Agent Task**: Generate task JSON files, IMPL_PLAN.md, and TODO_LIST.md based on analysis results
|
||||
|
||||
**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
|
||||
**Note**: The correct task JSON template path has been pre-selected by the command based on the `--cli-execute` flag and is provided in the context as `{template_path}`.
|
||||
|
||||
**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 1: Load Task JSON Template**
|
||||
- Read template from the provided path: `Read({template_path})`
|
||||
- This template is already the correct one based on execution mode
|
||||
|
||||
**Step 4: Generate TODO_LIST.md**
|
||||
- List all tasks with container/leaf structure
|
||||
- Link to task JSON files
|
||||
**Step 2: Extract and Decompose Tasks**
|
||||
- Parse ANALYSIS_RESULTS.md for task recommendations
|
||||
- Apply task merging rules (merge when possible, decompose only when necessary)
|
||||
- Map artifacts to tasks based on domain (UI/Backend/Data)
|
||||
- Ensure task count ≤10
|
||||
|
||||
**Step 3: Generate Task JSON Files**
|
||||
- Use the template structure from Step 1
|
||||
- Create .task/IMPL-*.json files with proper structure
|
||||
- Replace all {placeholder} variables with actual session paths
|
||||
- Embed artifacts array with brainstorming outputs
|
||||
- Include MCP tool integration in pre_analysis steps
|
||||
|
||||
**Step 4: Create IMPL_PLAN.md**
|
||||
- Use IMPL_PLAN template
|
||||
- Populate all sections with session-specific content
|
||||
- List artifacts with priorities and usage guidelines
|
||||
- Document execution strategy and dependencies
|
||||
|
||||
**Step 5: Generate TODO_LIST.md**
|
||||
- Create task progress checklist matching generated JSONs
|
||||
- Use proper status indicators (▸, [ ], [x])
|
||||
- Link to task JSON files
|
||||
|
||||
**Step 5: Update Session State**
|
||||
- Update .workflow/{session-id}/workflow-session.json
|
||||
- Mark session as ready for execution
|
||||
- Record task count and artifact inventory
|
||||
**Step 6: Update Session State**
|
||||
- Update workflow-session.json with task count and artifact inventory
|
||||
- Mark session ready for execution
|
||||
|
||||
### MCP Enhancement Examples
|
||||
|
||||
@@ -312,3 +338,29 @@ const agentContext = {
|
||||
mcp_analysis: executeMcpDiscovery()
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```bash
|
||||
# Agent Mode (default) - steps without command field
|
||||
/workflow:tools:task-generate-agent --session WFS-auth
|
||||
|
||||
# CLI Execute Mode - steps with command field
|
||||
/workflow:tools:task-generate-agent --session WFS-auth --cli-execute
|
||||
|
||||
# Called by /workflow:plan (default mode)
|
||||
SlashCommand(command="/workflow:tools:task-generate-agent --session WFS-[id]")
|
||||
|
||||
# Called by /workflow:plan --cli-execute (CLI mode)
|
||||
SlashCommand(command="/workflow:tools:task-generate-agent --session WFS-[id] --cli-execute")
|
||||
```
|
||||
|
||||
## Related Commands
|
||||
- `/workflow:plan` - Orchestrates planning and calls this command
|
||||
- `/workflow:plan --cli-execute` - Planning with CLI execution mode
|
||||
- `/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
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
Task JSON Schema - Agent Mode (No Command Field)
|
||||
|
||||
## Schema Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "IMPL-N[.M]",
|
||||
"title": "Descriptive task name",
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "feature|bugfix|refactor|test|docs",
|
||||
"agent": "@code-developer|@test-fix-agent|@general-purpose"
|
||||
},
|
||||
"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",
|
||||
"usage": "Primary requirement source - use for consolidated requirements and cross-role alignment"
|
||||
},
|
||||
{
|
||||
"type": "role_analysis",
|
||||
"path": "{role_analysis_path}",
|
||||
"priority": "high",
|
||||
"usage": "Technical/design/business details from specific roles. Common roles: system-architect (ADRs, APIs, caching), ui-designer (design tokens, layouts), product-manager (user stories, metrics)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"flow_control": {
|
||||
"pre_analysis": [
|
||||
{
|
||||
"step": "load_synthesis_specification",
|
||||
"action": "Load consolidated synthesis specification",
|
||||
"commands": [
|
||||
"Read({synthesis_spec_path})"
|
||||
],
|
||||
"output_to": "synthesis_specification",
|
||||
"on_error": "fail"
|
||||
},
|
||||
{
|
||||
"step": "load_context_package",
|
||||
"action": "Load context package for project structure",
|
||||
"commands": [
|
||||
"Read({context_package_path})"
|
||||
],
|
||||
"output_to": "context_pkg",
|
||||
"on_error": "fail"
|
||||
},
|
||||
{
|
||||
"step": "mcp_codebase_exploration",
|
||||
"action": "Explore codebase using MCP",
|
||||
"command": "mcp__code-index__find_files(pattern=\"{file_pattern}\") && mcp__code-index__search_code_advanced(pattern=\"{search_pattern}\")",
|
||||
"output_to": "codebase_structure",
|
||||
"on_error": "skip_optional"
|
||||
}
|
||||
],
|
||||
"implementation_approach": [
|
||||
{
|
||||
"step": 1,
|
||||
"title": "Implement task following synthesis specification",
|
||||
"description": "Implement '{title}' following [synthesis_specification] requirements and [context_pkg] patterns. Use synthesis-specification.md as primary source, consult artifacts for technical details.",
|
||||
"modification_points": [
|
||||
"Apply consolidated requirements from synthesis-specification.md",
|
||||
"Follow technical guidelines from synthesis",
|
||||
"Consult artifacts for implementation details when needed",
|
||||
"Integrate with existing patterns"
|
||||
],
|
||||
"logic_flow": [
|
||||
"Load synthesis specification and context package",
|
||||
"Analyze existing patterns from [codebase_structure]",
|
||||
"Implement following specification",
|
||||
"Consult artifacts for technical details when needed",
|
||||
"Validate against acceptance criteria"
|
||||
],
|
||||
"depends_on": [],
|
||||
"output": "implementation"
|
||||
}
|
||||
],
|
||||
"target_files": ["file:function:lines", "path/to/NewFile.ts"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Key Features - Agent Mode
|
||||
|
||||
**Execution Model**: Agent interprets `modification_points` and `logic_flow` to execute autonomously
|
||||
|
||||
**No Command Field**: Steps in `implementation_approach` do NOT include `command` field
|
||||
|
||||
**Context Loading**: Context loaded via `pre_analysis` steps, available as variables (e.g., [synthesis_specification], [context_pkg])
|
||||
|
||||
**Agent Execution**:
|
||||
- Agent reads modification_points and logic_flow
|
||||
- Agent performs implementation autonomously
|
||||
- Agent validates against acceptance criteria
|
||||
|
||||
## Field Descriptions
|
||||
|
||||
**implementation_approach**: Array of step objects (NO command field)
|
||||
- **step**: Sequential step number
|
||||
- **title**: Step description
|
||||
- **description**: Detailed instructions with variable references
|
||||
- **modification_points**: Specific code modifications to apply
|
||||
- **logic_flow**: Business logic execution sequence
|
||||
- **depends_on**: Step dependencies (empty array for independent steps)
|
||||
- **output**: Expected deliverable variable name
|
||||
|
||||
## Usage Guidelines
|
||||
|
||||
1. **Load Context**: Use pre_analysis to load synthesis, context package, and explore codebase
|
||||
2. **Reference Variables**: Use [variable_name] to reference outputs from pre_analysis steps
|
||||
3. **Clear Instructions**: Provide detailed modification_points and logic_flow for agent
|
||||
4. **No Commands**: Never add command field to implementation_approach steps
|
||||
5. **Agent Autonomy**: Let agent interpret and execute based on provided instructions
|
||||
@@ -0,0 +1,178 @@
|
||||
Task JSON Schema - CLI Execute Mode (With Command Field)
|
||||
|
||||
## Schema Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "IMPL-N[.M]",
|
||||
"title": "Descriptive task name",
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "feature|bugfix|refactor|test|docs",
|
||||
"agent": "@code-developer|@test-fix-agent|@general-purpose"
|
||||
},
|
||||
"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",
|
||||
"usage": "Primary requirement source - use for consolidated requirements and cross-role alignment"
|
||||
},
|
||||
{
|
||||
"type": "role_analysis",
|
||||
"path": "{role_analysis_path}",
|
||||
"priority": "high",
|
||||
"usage": "Technical/design/business details from specific roles"
|
||||
}
|
||||
]
|
||||
},
|
||||
"flow_control": {
|
||||
"pre_analysis": [
|
||||
{
|
||||
"step": "load_synthesis_specification",
|
||||
"action": "Load consolidated synthesis specification",
|
||||
"commands": [
|
||||
"Read({synthesis_spec_path})"
|
||||
],
|
||||
"output_to": "synthesis_specification",
|
||||
"on_error": "fail"
|
||||
},
|
||||
{
|
||||
"step": "load_context_package",
|
||||
"action": "Load context package",
|
||||
"commands": [
|
||||
"Read({context_package_path})"
|
||||
],
|
||||
"output_to": "context_pkg",
|
||||
"on_error": "fail"
|
||||
},
|
||||
{
|
||||
"step": "mcp_codebase_exploration",
|
||||
"action": "Explore codebase using MCP",
|
||||
"command": "mcp__code-index__find_files(pattern=\"{file_pattern}\")",
|
||||
"output_to": "codebase_structure",
|
||||
"on_error": "skip_optional"
|
||||
}
|
||||
],
|
||||
"implementation_approach": [
|
||||
{
|
||||
"step": 1,
|
||||
"title": "Implement task with Codex",
|
||||
"description": "Implement '{title}' using Codex CLI tool",
|
||||
"command": "bash(codex -C {focus_path} --full-auto exec \"PURPOSE: {purpose} TASK: {task_description} MODE: auto CONTEXT: @{{synthesis_spec_path}} @{{context_package_path}} EXPECTED: {expected_output} RULES: Follow synthesis specification\" --skip-git-repo-check -s danger-full-access)",
|
||||
"modification_points": [
|
||||
"Create/modify implementation files",
|
||||
"Follow synthesis specification requirements",
|
||||
"Integrate with existing patterns"
|
||||
],
|
||||
"logic_flow": [
|
||||
"Codex loads context package and synthesis",
|
||||
"Codex implements according to specification",
|
||||
"Codex validates against acceptance criteria"
|
||||
],
|
||||
"depends_on": [],
|
||||
"output": "implementation"
|
||||
}
|
||||
],
|
||||
"target_files": ["file:function:lines", "path/to/NewFile.ts"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Multi-Step Example (Complex Task with Resume)
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "IMPL-002",
|
||||
"title": "Implement RBAC system",
|
||||
"flow_control": {
|
||||
"implementation_approach": [
|
||||
{
|
||||
"step": 1,
|
||||
"title": "Create RBAC models",
|
||||
"description": "Create role and permission data models",
|
||||
"command": "bash(codex -C src/models --full-auto exec \"PURPOSE: Create RBAC models TASK: Define role and permission models MODE: auto CONTEXT: @{{synthesis_spec_path}} @{{context_package_path}} EXPECTED: Models with migrations RULES: Follow synthesis spec\" --skip-git-repo-check -s danger-full-access)",
|
||||
"modification_points": ["Define role model", "Define permission model"],
|
||||
"logic_flow": ["Design schema", "Implement models", "Generate migrations"],
|
||||
"depends_on": [],
|
||||
"output": "rbac_models"
|
||||
},
|
||||
{
|
||||
"step": 2,
|
||||
"title": "Implement RBAC middleware",
|
||||
"description": "Create route protection middleware",
|
||||
"command": "bash(codex --full-auto exec \"PURPOSE: Create RBAC middleware TASK: Route protection middleware MODE: auto CONTEXT: RBAC models from step 1 EXPECTED: Middleware for route protection RULES: Use session patterns\" resume --last --skip-git-repo-check -s danger-full-access)",
|
||||
"modification_points": ["Create permission checker", "Add route decorators"],
|
||||
"logic_flow": ["Check user role", "Validate permissions", "Allow/deny access"],
|
||||
"depends_on": [1],
|
||||
"output": "rbac_middleware"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Key Features - CLI Execute Mode
|
||||
|
||||
**Execution Model**: Commands in `command` field execute steps directly
|
||||
|
||||
**Command Field Required**: Every step in `implementation_approach` MUST include `command` field
|
||||
|
||||
**Context Delivery**: Context provided via CONTEXT field in command prompt using `@{path}` syntax
|
||||
|
||||
**Multi-Step Support**:
|
||||
- First step: Full context with `-C directory` and complete CONTEXT field
|
||||
- Subsequent steps: Use `resume --last` to maintain session continuity
|
||||
- Step dependencies: Use `depends_on` array to specify step order
|
||||
|
||||
## Command Templates
|
||||
|
||||
### Single-Step Codex Command
|
||||
```bash
|
||||
bash(codex -C {focus_path} --full-auto exec "PURPOSE: {purpose} TASK: {task} MODE: auto CONTEXT: @{{synthesis_spec_path}} @{{context_package_path}} EXPECTED: {expected} RULES: {rules}" --skip-git-repo-check -s danger-full-access)
|
||||
```
|
||||
|
||||
### Multi-Step Codex with Resume
|
||||
```bash
|
||||
# First step
|
||||
bash(codex -C {path} --full-auto exec "..." --skip-git-repo-check -s danger-full-access)
|
||||
|
||||
# Subsequent steps
|
||||
bash(codex --full-auto exec "..." resume --last --skip-git-repo-check -s danger-full-access)
|
||||
```
|
||||
|
||||
### Gemini/Qwen Commands (Analysis/Documentation)
|
||||
```bash
|
||||
bash(~/.claude/scripts/gemini-wrapper -p "PURPOSE: {purpose} TASK: {task} MODE: analysis CONTEXT: @{{synthesis_spec_path}} EXPECTED: {expected} RULES: {rules}")
|
||||
|
||||
# With write permission
|
||||
bash(~/.claude/scripts/gemini-wrapper --approval-mode yolo -p "PURPOSE: {purpose} TASK: {task} MODE: write CONTEXT: @{{context}} EXPECTED: {expected} RULES: {rules}")
|
||||
```
|
||||
|
||||
## Field Descriptions
|
||||
|
||||
**implementation_approach**: Array of step objects (WITH command field)
|
||||
- **step**: Sequential step number
|
||||
- **title**: Step description
|
||||
- **description**: Brief step description
|
||||
- **command**: Complete CLI command to execute the step
|
||||
- **modification_points**: Specific code modifications (for reference)
|
||||
- **logic_flow**: Execution sequence (for reference)
|
||||
- **depends_on**: Step dependencies (array of step numbers, empty for independent)
|
||||
- **output**: Expected deliverable variable name
|
||||
|
||||
## Usage Guidelines
|
||||
|
||||
1. **Always Include Command**: Every step MUST have a `command` field
|
||||
2. **Context via CONTEXT Field**: Provide context using `@{path}` syntax in command prompt
|
||||
3. **First Step Full Context**: First step should include `-C directory` and full context package
|
||||
4. **Resume for Continuity**: Use `resume --last` for subsequent steps in same task
|
||||
5. **Step Dependencies**: Use `depends_on: [1, 2]` to specify execution order
|
||||
6. **Parameter Position**:
|
||||
- Codex: `--skip-git-repo-check -s danger-full-access` at END
|
||||
- Gemini/Qwen: `--approval-mode yolo` AFTER wrapper command, BEFORE -p
|
||||
@@ -1,200 +0,0 @@
|
||||
Task JSON Schema - Enhanced 5-Field Schema with Artifacts Integration
|
||||
|
||||
## Schema Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "IMPL-N[.M]",
|
||||
"title": "Descriptive task name",
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "feature|bugfix|refactor|test|docs",
|
||||
"agent": "@code-developer|@test-fix-agent|@general-purpose"
|
||||
},
|
||||
"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",
|
||||
"usage": "Primary requirement source - use for consolidated requirements and cross-role alignment"
|
||||
},
|
||||
{
|
||||
"type": "role_analysis",
|
||||
"path": "{role_analysis_path}",
|
||||
"priority": "high",
|
||||
"usage": "Technical/design/business details from specific roles. Common roles: system-architect (ADRs, APIs, caching), ui-designer (design tokens, layouts), product-manager (user stories, metrics)",
|
||||
"note": "Dynamically discovered - multiple role analysis files included based on brainstorming results"
|
||||
},
|
||||
{
|
||||
"type": "topic_framework",
|
||||
"path": "{topic_framework_path}",
|
||||
"priority": "low",
|
||||
"usage": "Discussion context and framework structure"
|
||||
}
|
||||
]
|
||||
},
|
||||
"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": [
|
||||
{
|
||||
"step": 1,
|
||||
"title": "Implement task following synthesis specification",
|
||||
"description": "Implement '[title]' following synthesis specification. PRIORITY: Use synthesis-specification.md as primary requirement source. When implementation needs technical details (e.g., API schemas, caching configs, design tokens), refer to artifacts[] for detailed specifications from original role analyses.",
|
||||
"modification_points": [
|
||||
"Apply consolidated requirements from synthesis-specification.md",
|
||||
"Follow technical guidelines from synthesis",
|
||||
"Consult artifacts for implementation details when needed",
|
||||
"Integrate with existing patterns"
|
||||
],
|
||||
"logic_flow": [
|
||||
"Load synthesis specification and relevant role artifacts",
|
||||
"Execute MCP code-index discovery for relevant files",
|
||||
"Analyze existing patterns and identify modification targets",
|
||||
"Implement following specification",
|
||||
"Consult artifacts for technical details when needed",
|
||||
"Validate against acceptance criteria"
|
||||
],
|
||||
"depends_on": [],
|
||||
"output": "implementation"
|
||||
}
|
||||
],
|
||||
"target_files": ["file:function:lines", "path/to/NewFile.ts"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Field Descriptions
|
||||
|
||||
### Required Fields
|
||||
|
||||
**id**: Task identifier following format IMPL-N or IMPL-N.M for subtasks
|
||||
- Top-level: IMPL-1, IMPL-2, ...
|
||||
- Subtasks: IMPL-1.1, IMPL-1.2, ...
|
||||
|
||||
**title**: Clear, descriptive task name indicating the work to be done
|
||||
|
||||
**status**: Current task state
|
||||
- "pending": Not started
|
||||
- "active": Currently in progress
|
||||
- "completed": Successfully finished
|
||||
- "blocked": Waiting on dependencies
|
||||
- "container": Parent task with subtasks
|
||||
|
||||
**meta**: Metadata for task execution
|
||||
- type: Category of work (feature, bugfix, refactor, test, docs)
|
||||
- agent: Designated agent for execution (@code-developer, @test-fix-agent, @general-purpose)
|
||||
|
||||
**context**: Rich context for task execution
|
||||
- requirements: Clear, extracted requirements from analysis
|
||||
- focus_paths: Specific directories/modules to work on
|
||||
- acceptance: Measurable criteria for task completion
|
||||
- depends_on: Array of task IDs that must complete first
|
||||
- artifacts: Brainstorming outputs with usage guidance
|
||||
|
||||
### Artifacts Array Structure
|
||||
|
||||
Each artifact entry includes:
|
||||
- **type**: Category (synthesis_specification, role_analysis, topic_framework)
|
||||
- **path**: Relative path from project root
|
||||
- **priority**: highest | high | medium | low
|
||||
- **usage**: Clear description of when and how to use this artifact
|
||||
- **note**: Optional additional context or discovery information
|
||||
|
||||
### Flow Control Structure
|
||||
|
||||
**pre_analysis**: Preparatory steps before implementation
|
||||
- load_synthesis_specification: Load primary requirements source
|
||||
- mcp_codebase_exploration: Discover relevant files using MCP tools
|
||||
- analyze_task_patterns: Analyze existing patterns for consistency
|
||||
|
||||
**implementation_approach**: Detailed implementation steps
|
||||
- step: Sequential step number
|
||||
- title: Step description
|
||||
- description: Detailed instructions with artifact usage guidance
|
||||
- modification_points: Specific code locations or patterns to modify
|
||||
- logic_flow: Execution sequence
|
||||
- depends_on: Step dependencies
|
||||
- output: Expected deliverable
|
||||
|
||||
**target_files**: Specific files to modify in format "file:function:lines" or "path/to/NewFile.ts"
|
||||
|
||||
## MCP Tool Integration 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
|
||||
)
|
||||
```
|
||||
|
||||
## Artifact Priority Guidelines
|
||||
|
||||
1. **synthesis-specification.md** (highest): Use as primary requirement source for all tasks
|
||||
2. **role-specific analysis** (high): Consult for technical details, design specifications, or business context
|
||||
3. **topic-framework.md** (low): Reference for discussion context and framework structure
|
||||
|
||||
## Usage in Agent Prompts
|
||||
|
||||
When generating task JSONs, ensure:
|
||||
- Extract requirements from ANALYSIS_RESULTS.md
|
||||
- Map artifacts based on task domain (UI → ui-designer, Backend → system-architect)
|
||||
- Include MCP tool integration in pre_analysis steps
|
||||
- Provide clear artifact usage guidance in implementation_approach
|
||||
- Specify exact modification targets in target_files
|
||||
Reference in New Issue
Block a user