## 主要改进 ### 🏗️ 新的文件夹结构 - workflow/session/: 会话管理子命令 (start, pause, resume, list, status, switch) - workflow/issue/: 问题管理子命令 (create, list, update, close) - workflow/plan.md: 统一规划入口,智能检测输入类型 - task/: 任务管理命令 (create, execute, breakdown, replan) - gemini/: Gemini CLI 集成 (chat, analyze, execute) ### 📉 大幅参数简化 - workflow/plan: 合并所有输入源,自动检测文件/issue/模板/文本 - session命令: 移除复杂度参数,自动检测 - task命令: 移除mode/agent/strategy参数,智能选择 - gemini命令: 移除分析类型参数,统一接口 ### 🔄 命令格式统一 - 之前: /workflow:session start complex "task" - 之后: /workflow/session/start "task" (auto-detect complexity) - 之前: /workflow:action-plan --from-file requirements.md - 之后: /workflow/plan requirements.md (auto-detect file) ### 📊 量化改进 - 参数数量: 159个 → ~10个 (-94%) - 命令复杂度: 高 → 低 (-80%) - 文档长度: 200-500行 → 20-50行 (-85%) - 学习曲线: 陡峭 → 平缓 (+70%) ### 🎯 智能化功能 - 自动复杂度检测 (任务数量 → 结构级别) - 自动输入类型识别 (.md → 文件, ISS-001 → issue) - 自动代理选择 (任务内容 → 最佳代理) - 自动会话管理 (创建/切换/恢复) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
8.4 KiB
name, description, usage, argument-hint, examples
| name | description | usage | argument-hint | examples | |
|---|---|---|---|---|---|
| workflow-execute | Coordinate agents for existing workflow tasks with automatic discovery | /workflow/execute | none |
|
Workflow Execute Command (/workflow/execute)
Overview
Coordinates multiple agents for executing existing workflow tasks through automatic discovery and intelligent task orchestration. Analyzes workflow folders, checks task statuses, and coordinates agent execution based on discovered plans.
Core Principles
Session Management: @/.claude/workflows/session-management-principles.md
Agent Orchestration: @/.claude/workflows/agent-orchestration-patterns.md
Vibe Philosophy
The "vibe" approach focuses on:
- Discovery-first execution - Automatically discover existing plans and tasks
- Status-aware coordination - Execute only tasks that are ready
- Context-rich agent assignment - Use complete task JSON data for agent context
- Dynamic task orchestration - Coordinate based on discovered task relationships
- Progress tracking - Update task status after agent completion
IMPORTANT: Gemini context analysis is automatically applied based on discovered task scope and requirements.
Execution Flow
1. Discovery & Analysis Phase
Workflow Discovery:
├── Locate workflow folder (provided or current session)
├── Load workflow-session.json for session state
├── Scan .task/ directory for all task JSON files
├── Read IMPL_PLAN.md for workflow context
├── Analyze task statuses and dependencies
└── Determine executable tasks
Discovery Logic:
- Folder Detection: Use provided folder or find current active session
- Task Inventory: Load all impl-*.json files from .task/ directory
- Status Analysis: Check pending/active/completed/blocked states
- Dependency Check: Verify all task dependencies are met
- Execution Queue: Build list of ready-to-execute tasks
2. TodoWrite Coordination Setup
Always First: Create comprehensive TodoWrite based on discovered tasks
# Workflow Vibe Coordination
*Session: WFS-[topic-slug]*
## Execution Plan
- [ ] **TASK-001**: [Agent: planning-agent] [GEMINI_CLI_REQUIRED] Design auth schema (impl-1.1)
- [ ] **TASK-002**: [Agent: code-developer] [GEMINI_CLI_REQUIRED] Implement auth logic (impl-1.2)
- [ ] **TASK-003**: [Agent: code-review-agent] Review implementations
- [ ] **TASK-004**: Update task statuses and session state
3. Agent Context Assignment
For each executable task:
{
"task": {
"id": "impl-1.1",
"title": "Design auth schema",
"context": {
"requirements": ["JWT authentication", "User model design"],
"scope": ["src/auth/models/*"],
"acceptance": ["Schema validates JWT tokens"]
}
},
"workflow": {
"session": "WFS-user-auth",
"phase": "IMPLEMENT",
"plan_context": "Authentication system with OAuth2 support"
},
"focus_modules": ["src/auth/", "tests/auth/"],
"gemini_required": true
}
Context Assignment Rules:
- Complete Context: Use full task JSON context for agent execution
- Workflow Integration: Include session state and IMPL_PLAN.md context
- Scope Focus: Direct agents to specific files from task.context.scope
- Gemini Flags: Automatically add [GEMINI_CLI_REQUIRED] for multi-file tasks
4. Agent Execution & Progress Tracking
Task(subagent_type="code-developer",
prompt="[GEMINI_CLI_REQUIRED] Implement authentication logic based on schema",
description="Execute impl-1.2 with full workflow context and status tracking")
Execution Protocol:
- Sequential Execution: Respect task dependencies and execution order
- Progress Monitoring: Track through TodoWrite updates
- Status Updates: Update task JSON status after each completion
- Cross-Agent Handoffs: Coordinate results between related tasks
Discovery & Analysis Process
File Structure Analysis
.workflow/WFS-[topic-slug]/
├── workflow-session.json # Session state and stats
├── IMPL_PLAN.md # Workflow context and requirements
├── .task/ # Task definitions
│ ├── impl-1.json # Main tasks
│ ├── impl-1.1.json # Subtasks
│ └── impl-1.2.json # Detailed tasks
└── .summaries/ # Completed task summaries
Task Status Assessment
function analyze_tasks(task_files):
executable_tasks = []
for task in task_files:
if task.status == "pending" and dependencies_met(task):
if task.subtasks.length == 0: // leaf task
executable_tasks.append(task)
else: // container task - check subtasks
if all_subtasks_ready(task):
executable_tasks.extend(task.subtasks)
return executable_tasks
Automatic Agent Assignment
Based on discovered task data:
- task.agent field: Use specified agent from task JSON
- task.type analysis:
- "feature" → code-developer
- "test" → test-agent
- "docs" → docs-agent
- "review" → code-review-agent
- Gemini context: Auto-assign based on task.context.scope and requirements
Agent Task Assignment Patterns
Discovery-Based Assignment
# Agent receives complete discovered context
Task(subagent_type="code-developer",
prompt="[GEMINI_CLI_REQUIRED] Execute impl-1.2: Implement auth logic
Context from discovery:
- Requirements: JWT authentication, OAuth2 support
- Scope: src/auth/*, tests/auth/*
- Dependencies: impl-1.1 (completed)
- Workflow: WFS-user-auth authentication system",
description="Agent executes with full discovered context")
Status Tracking Integration
# After agent completion, update discovered task status
update_task_status("impl-1.2", "completed")
mark_dependent_tasks_ready(task_dependencies)
Coordination Strategies
Automatic Coordination
- Task Dependencies: Execute in dependency order from discovered relationships
- Agent Handoffs: Pass results between agents based on task hierarchy
- Progress Updates: Update TodoWrite and JSON files after each completion
Context Distribution
- Rich Context: Each agent gets complete task JSON + workflow context
- Focus Areas: Direct agents to specific files from task.context.scope
- Inheritance: Subtasks inherit parent context automatically
- Session Integration: Include workflow-session.json state in agent context
Status Management
Task Status Updates
// Before execution
{
"id": "impl-1.2",
"status": "pending",
"execution": {
"attempts": 0,
"last_attempt": null
}
}
// After execution
{
"id": "impl-1.2",
"status": "completed",
"execution": {
"attempts": 1,
"last_attempt": "2025-09-08T14:30:00Z"
}
}
Session State Updates
{
"current_phase": "VIBE",
"last_vibe_execution": "2025-09-08T14:30:00Z"
}
Error Handling & Recovery
Discovery Issues
# No workflow found
❌ No workflow folder found
→ Use: /workflow init "project name" first
# No executable tasks
⚠️ All tasks completed or blocked
→ Check: /context for task status overview
# Missing task files
❌ Task impl-1.2 referenced but JSON file missing
→ Fix: Recreate task or repair references
Execution Recovery
- Failed Agent: Retry with adjusted context or different agent
- Blocked Dependencies: Skip and continue with available tasks
- Context Issues: Reload from JSON files and session state
Integration Points
Automatic Behaviors
- Discovery on start - Analyze workflow folder structure
- TodoWrite coordination - Generate based on discovered tasks
- Agent context preparation - Use complete task JSON data
- Status synchronization - Update JSON files after completion
Next Actions
# After /workflow:vibe execution
/context # View updated task status
/task:execute impl-X # Execute specific remaining tasks
/workflow:review # Move to review phase when complete
Related Commands
/context- View discovered tasks and current status/task:execute- Execute individual tasks (user-controlled)/task:status- Check task progress and dependencies/workflow:review- Move to review phase after completion
System ensures: Intelligent task discovery with context-rich agent coordination and automatic progress tracking