mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
## 主要改进 ### 🏗️ 新的文件夹结构 - 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>
6.9 KiB
6.9 KiB
name, description, usage, argument-hint, examples
| name | description | usage | argument-hint | examples | |||
|---|---|---|---|---|---|---|---|
| task-execute | Execute tasks with appropriate agents and context-aware orchestration | /task/execute <task-id> | task-id |
|
🚀 Command Overview: /task/execute
- Purpose: Executes tasks using intelligent agent selection, context preparation, and progress tracking.
- Core Principles:
- Task Management: @~/.claude/workflows/task-management-principles.md
- File Structure: @~/.claude/workflows/file-structure-standards.md
- Session Management: @~/.claude/workflows/session-management-principles.md
⚙️ Execution Modes
- auto (Default)
- Fully autonomous execution with automatic agent selection.
- Provides progress updates at each checkpoint.
- Automatically completes the task when done.
- guided
- Executes step-by-step, requiring user confirmation at each checkpoint.
- Allows for dynamic adjustments and manual review during the process.
- review
- Executes under the supervision of a
review-agent. - Performs quality checks and provides detailed feedback at each step.
- Executes under the supervision of a
🤖 Agent Selection Logic
The system determines the appropriate agent for a task using the following logic.
FUNCTION select_agent(task, agent_override):
// A manual override always takes precedence.
// Corresponds to the --agent=<agent-type> flag.
IF agent_override IS NOT NULL:
RETURN agent_override
// If no override, select based on keywords in the task title.
ELSE:
CASE task.title:
WHEN CONTAINS "Build API", "Implement":
RETURN "code-developer"
WHEN CONTAINS "Design schema", "Plan":
RETURN "planning-agent"
WHEN CONTAINS "Write tests":
RETURN "test-agent"
WHEN CONTAINS "Review code":
RETURN "review-agent"
DEFAULT:
RETURN "code-developer" // Default agent
END CASE
END FUNCTION
🔄 Core Execution Protocol
Pre-Execution -> Execution -> Post-Execution
✅ Pre-Execution Protocol
Validate Task & Dependencies -> Prepare Execution Context -> Coordinate with TodoWrite
- Validation: Checks for the task's JSON file in
.task/and resolves its dependencies. - Context Preparation: Loads task and workflow context, preparing it for the selected agent.
- TodoWrite Coordination: Generates execution Todos and checkpoints, syncing with
TODO_LIST.md.
🏁 Post-Execution Protocol
Update Task Status -> Generate Summary -> Save Artifacts -> Sync All Progress -> Validate File Integrity
- Updates status in the task's JSON file and
TODO_LIST.md. - Creates a summary in
.summaries/. - Stores outputs and syncs progress across the entire workflow session.
🧠 Task & Subtask Execution Logic
This logic defines how single, multiple, or parent tasks are handled.
FUNCTION execute_task_command(task_id, mode, parallel_flag):
// Handle parent tasks by executing their subtasks.
IF is_parent_task(task_id):
subtasks = get_subtasks(task_id)
EXECUTE_SUBTASK_BATCH(subtasks, mode)
// Handle wildcard execution (e.g., IMPL-001.*)
ELSE IF task_id CONTAINS "*":
subtasks = find_matching_tasks(task_id)
IF parallel_flag IS true:
EXECUTE_IN_PARALLEL(subtasks)
ELSE:
FOR each subtask in subtasks:
EXECUTE_SINGLE_TASK(subtask, mode)
// Default case for a single task ID.
ELSE:
EXECUTE_SINGLE_TASK(task_id, mode)
END FUNCTION
🛡️ Error Handling & Recovery Logic
FUNCTION pre_execution_check(task):
// Ensure dependencies are met before starting.
IF task.dependencies ARE NOT MET:
LOG_ERROR("Cannot execute " + task.id)
LOG_INFO("Blocked by: " + unmet_dependencies)
HALT_EXECUTION()
FUNCTION on_execution_failure(checkpoint):
// Provide user with recovery options upon failure.
LOG_WARNING("Execution failed at checkpoint " + checkpoint)
PRESENT_OPTIONS([
"Retry from checkpoint",
"Retry from beginning",
"Switch to guided mode",
"Abort execution"
])
AWAIT user_input
// System performs the selected action.
END FUNCTION
✨ Advanced Execution Controls
- Dry Run (
--dry-run): Simulates execution, showing the agent, estimated time, and files affected without making changes. - Custom Checkpoints (
--checkpoints="..."): Overrides the default checkpoints with a custom, comma-separated list (e.g.,"design,implement,deploy"). - Conditional Execution (
--if="..."): Proceeds with execution only if a specified condition (e.g.,"tests-pass") is met. - Rollback (
--rollback): Reverts file modifications and restores the previous task state.
📄 Simplified Context Structure (JSON)
This is the simplified data structure loaded to provide context for task execution.
{
"task": {
"id": "impl-1",
"title": "Build authentication module",
"type": "feature",
"status": "active",
"agent": "code-developer",
"context": {
"requirements": ["JWT authentication", "OAuth2 support"],
"scope": ["src/auth/*", "tests/auth/*"],
"acceptance": ["Module handles JWT tokens", "OAuth2 flow implemented"],
"inherited_from": "WFS-user-auth"
},
"relations": {
"parent": null,
"subtasks": ["impl-1.1", "impl-1.2"],
"dependencies": ["impl-0"]
}
},
"workflow": {
"session": "WFS-user-auth",
"phase": "IMPLEMENT"
},
"execution": {
"agent": "code-developer",
"mode": "auto",
"attempts": 0
}
}
🎯 Agent-Specific Context
Different agents receive context tailored to their function:
code-developer: Code patterns, dependencies, file scopes.planning-agent: High-level requirements, constraints, success criteria.test-agent: Test requirements, code to be tested, coverage goals.review-agent: Quality standards, style guides, review criteria.
🗃️ Simplified File Output
- Task JSON File (
.task/<task-id>.json): Updated with status and last attempt time only. - Session File (
workflow-session.json): Updated task stats (completed count). - Summary File: Generated in
.summaries/upon completion (optional).
📝 Simplified Summary Template
Optional summary file generated at .summaries/impl-[task-id]-summary.md.
# Task Summary: impl-1 Build Authentication Module
## What Was Done
- Created src/auth/login.ts with JWT validation
- Added tests in tests/auth.test.ts
## Execution Results
- **Agent**: code-developer
- **Status**: completed
## Files Modified
- `src/auth/login.ts` (created)
- `tests/auth.test.ts` (created)