fix: Clarify pre_analysis execution flow in workflow commands

- Fix execute.md: Clarify that pre_analysis steps are passed to agents for execution, not executed by workflow:execute command
- Fix plan.md: Add explicit note that pre_analysis steps are generated for agent execution
- Streamline verbose sections while preserving critical operational details
- Maintain consistency between plan and execute commands regarding pre_analysis handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-09-24 17:06:15 +08:00
parent 27cf20d57f
commit f4d1f23e6d
3 changed files with 101 additions and 95 deletions

View File

@@ -34,13 +34,13 @@ Orchestrates autonomous workflow execution through systematic task discovery, ag
- **Autonomous completion**: **Execute all tasks without user interruption until workflow complete**
## Flow Control Execution
**[FLOW_CONTROL]** marker indicates sequential step execution required for context gathering and preparation.
**[FLOW_CONTROL]** marker indicates sequential step execution required for context gathering and preparation. **These steps are executed BY THE AGENT, not by the workflow:execute command.**
### Flow Control Rules
1. **Auto-trigger**: When `task.flow_control.pre_analysis` array exists in task JSON
2. **Sequential Processing**: Execute steps in order, accumulating context
3. **Variable Passing**: Use `[variable_name]` syntax to reference step outputs
4. **Error Handling**: Follow step-specific error strategies (`fail`, `skip_optional`, `retry_once`)
1. **Auto-trigger**: When `task.flow_control.pre_analysis` array exists in task JSON, agents execute these steps
2. **Sequential Processing**: Agents execute steps in order, accumulating context
3. **Variable Passing**: Agents use `[variable_name]` syntax to reference step outputs
4. **Error Handling**: Agents follow step-specific error strategies (`fail`, `skip_optional`, `retry_once`)
### Execution Pattern
```
@@ -49,11 +49,11 @@ Step 2: analyze_patterns [dependency_context] → pattern_analysis
Step 3: implement_solution [pattern_analysis] [dependency_context] → implementation
```
### Context Accumulation Process
- **Load Dependencies**: Retrieve summaries from `context.depends_on` tasks
- **Execute Analysis**: Run CLI tools with accumulated context
- **Prepare Implementation**: Build comprehensive context for agent execution
- **Pass to Agent**: Provide all accumulated context for implementation
### Context Accumulation Process (Executed by Agents)
- **Load Dependencies**: Agents retrieve summaries from `context.depends_on` tasks
- **Execute Analysis**: Agents run CLI tools with accumulated context
- **Prepare Implementation**: Agents build comprehensive context for implementation
- **Continue Implementation**: Agents use all accumulated context for task execution
## Execution Lifecycle
@@ -73,11 +73,12 @@ Step 3: implement_solution [pattern_analysis] [dependency_context] → implement
1. **Create TodoWrite List**: Generate task list with status markers
2. **Mark Initial Status**: Set first task as `in_progress`
3. **Prepare Session Context**: Inject workflow paths for agent use
4. **Validate Prerequisites**: Ensure all required context is available
4. **Prepare Complete Task JSON**: Include pre_analysis and flow control steps for agent consumption
5. **Validate Prerequisites**: Ensure all required context is available
### Phase 4: Execution
1. **Execute Flow Control**: Run `pre_analysis` steps if present
2. **Launch Agent**: Invoke specialized agent with complete context
1. **Pass Task with Flow Control**: Include complete task JSON with `pre_analysis` steps for agent execution
2. **Launch Agent**: Invoke specialized agent with complete context including flow control steps
3. **Monitor Progress**: Track agent execution and handle errors without user interruption
4. **Collect Results**: Gather implementation results and outputs
5. **Continue Workflow**: Automatically proceed to next pending task until completion
@@ -231,7 +232,7 @@ Task(subagent_type="{agent_type}",
{flow_control_marker}
### Flow Control Steps (if [FLOW_CONTROL] present)
Execute sequentially with context accumulation:
**AGENT RESPONSIBILITY**: Execute these pre_analysis steps sequentially with context accumulation:
{pre_analysis_steps}
### Implementation Context
@@ -375,58 +376,16 @@ fi
- **Dependency Validation**: Check all depends_on references exist
- **Context Verification**: Ensure all required context is available
## Usage Examples & Integration
## Usage Examples
### Complete Execution Workflow
### Basic Usage
```bash
# 1. Check current status
/workflow:status
# 2. Execute workflow tasks
/workflow:execute
# 3. Monitor progress
/workflow:status --format=hierarchy
# 4. Continue with remaining tasks
/workflow:execute
# 5. Review when complete
/workflow:review
/workflow:execute # Execute all pending tasks autonomously
/workflow:status # Check progress
/task:execute IMPL-1.2 # Execute specific task
```
### Common Scenarios
#### Single Task Execution
```bash
/task:execute IMPL-1.2 # Execute specific task
```
#### Resume After Error
```bash
/workflow:status --validate # Check for issues
/workflow:execute # Resume execution
```
#### Multiple Session Management
```bash
# Will prompt for session selection if multiple active
/workflow:execute
# Or check status first
find .workflow -name ".active-*" -exec basename {} \; | sed 's/^\.active-//'
```
### Integration Points
- **Planning**: Use `/workflow:plan` to create session and tasks
- **Status**: Use `/workflow:status` for real-time progress views
- **Documentation**: Use `/workflow:docs` for context generation
- **Review**: Use `/workflow:review` for completion validation
### Key Benefits
- **Autonomous Execution**: Agents work independently with complete context
- **Progress Tracking**: Real-time TodoWrite updates and status synchronization
- **Error Recovery**: Comprehensive error handling and recovery procedures
- **Context Management**: Systematic context accumulation and distribution
- **Flow Control**: Sequential step execution with variable passing
### Integration
- **Planning**: `/workflow:plan``/workflow:execute``/workflow:review`
- **Recovery**: `/workflow:status --validate``/workflow:execute`

View File

@@ -60,9 +60,10 @@ The command performs comprehensive analysis through:
### Context Management & Agent Execution
**Agent Context Loading** ⚠️ CRITICAL
Agents automatically load context from plan-generated documents during execution:
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": [
{
@@ -87,39 +88,25 @@ Agents automatically load context from plan-generated documents during execution
}
```
**Context Accumulation & Inheritance**:
1. **Structure Analysis**: project hierarchy
2. **Pattern Analysis**: Tool-specific commands → existing patterns
3. **Dependency Mapping**: Previous task summaries → inheritance context
4. **Task Context Generation**: Combined analysis → task.context fields
**Context Accumulation Guidelines**:
Flow_control design should follow these principles:
1. **Structure Analysis**: Project hierarchy and patterns
2. **Dependency Mapping**: Previous task summaries → inheritance context
3. **Task Context Generation**: Combined analysis → task.context fields
**Content Sources**:
- Task summaries: `.workflow/WFS-[session]/.summaries/IMPL-[task-id]-summary.md`
- Generated documentation: `.workflow/docs/` (architecture, modules, APIs from `/workflow:docs`)
- Documentation: `CLAUDE.md`, `README.md`, config files
- Schema definitions: `.json`, `.yaml`, `.sql` files
- Dependency contexts: `.workflow/WFS-[session]/.task/IMPL-*.json`
- Task summaries: `.workflow/WFS-[session]/.summaries/`
- Documentation: `.workflow/docs/`, `CLAUDE.md`, `README.md`, config files
- Analysis artifacts: `.workflow/WFS-[session]/.process/ANALYSIS_RESULTS.md`
**Trigger Conditions**: Task has `context.depends_on` array, references external docs, builds on previous summaries, requires config/schema files
- Dependency contexts: `.workflow/WFS-[session]/.task/IMPL-*.json`
### Task Decomposition Standards
**Core Principles**:
1. **Functional Completeness** - Each task delivers complete, independently runnable functional unit including all related files (logic, UI, tests, config)
2. **Minimum Size Threshold** - Single task must contain ≥3 related files or 200 lines of code; smaller content merged with adjacent features
3. **Dependency Cohesion** - Tightly coupled components completed in same task (shared models, API endpoints, user flows)
4. **Hierarchy Control** - Flat structure (≤5 tasks) | Two-level (6-10 tasks) | Re-scope (>10 tasks)
**Implementation Rules**:
- **Maximum 10 tasks**: Hard enforced limit - projects exceeding must be re-scoped
- **Function-based decomposition**: By complete functional units, not files/steps
- **File cohesion**: Group related files (UI + logic + tests + config) in same task
- **Task saturation**: Merge "analyze + implement" by default (0.5 count for complex prep tasks)
**Task Saturation Assessment**:
- **Default Merge** (cohesive files together): Functional modules with UI + logic + tests + config, features with tests/docs, files sharing interfaces/data structures
- **Only Separate When**: Independent functional modules, different tech stacks/deployment units, would exceed 10-task limit
**Rules**:
- **Maximum 10 tasks**: Hard limit - exceeding requires re-scoping
- **Function-based**: Complete functional units with related files (logic + UI + tests + config)
- **File cohesion**: Group tightly coupled components in same task
- **Hierarchy**: Flat (≤5 tasks) | Two-level (6-10 tasks) | Re-scope (>10 tasks)
### Session Management ⚠️ CRITICAL

View File

@@ -7,10 +7,70 @@
build_exclusion_filters() {
local filters=""
# Always exclude these system/cache directories
# Always exclude these system/cache directories and common web dev packages
local system_excludes=(
".git" ".history" ".vscode" "__pycache__" ".pytest_cache"
"node_modules" "dist" "build" ".egg-info" ".env"
# Version control and IDE
".git" ".gitignore" ".gitmodules" ".gitattributes"
".svn" ".hg" ".bzr"
".history" ".vscode" ".idea" ".vs" ".vscode-test"
".sublime-text" ".atom"
# Python
"__pycache__" ".pytest_cache" ".mypy_cache" ".tox"
".coverage" "htmlcov" ".nox" ".venv" "venv" "env"
".egg-info" "*.egg-info" ".eggs" ".wheel"
"site-packages" ".python-version" ".pyc"
# Node.js/JavaScript
"node_modules" ".npm" ".yarn" ".pnpm" "yarn-error.log"
".nyc_output" "coverage" ".next" ".nuxt"
".cache" ".parcel-cache" ".vite" "dist" "build"
".turbo" ".vercel" ".netlify"
# Package managers
".pnpm-store" "pnpm-lock.yaml" "yarn.lock" "package-lock.json"
".bundle" "vendor/bundle" "Gemfile.lock"
".gradle" "gradle" "gradlew" "gradlew.bat"
".mvn" "target" ".m2"
# Build/compile outputs
"dist" "build" "out" "output" "_site" "public"
".output" ".generated" "generated" "gen"
"bin" "obj" "Debug" "Release"
# Testing
".pytest_cache" ".coverage" "htmlcov" "test-results"
".nyc_output" "junit.xml" "test_results"
"cypress/screenshots" "cypress/videos"
"playwright-report" ".playwright"
# Logs and temp files
"logs" "*.log" "log" "tmp" "temp" ".tmp" ".temp"
".env" ".env.local" ".env.*.local"
".DS_Store" "Thumbs.db" "*.tmp" "*.swp" "*.swo"
# Documentation build outputs
"_book" "_site" "docs/_build" "site" "gh-pages"
".docusaurus" ".vuepress" ".gitbook"
# Database files
"*.sqlite" "*.sqlite3" "*.db" "data.db"
# OS and editor files
".DS_Store" "Thumbs.db" "desktop.ini"
"*.stackdump" "core" "*.core"
# Cloud and deployment
".serverless" ".terraform" "terraform.tfstate"
".aws" ".azure" ".gcp"
# Mobile development
".gradle" "build" ".expo" ".metro"
"android/app/build" "ios/build" "DerivedData"
# Game development
"Library" "Temp" "ProjectSettings"
"Logs" "MemoryCaptures" "UserSettings"
)
for exclude in "${system_excludes[@]}"; do