# Adaptive Agent Workflow
This workflow is designed for autonomous agents to systematically plan, execute, and verify complex tasks.
## 1. Planning Phase
- [ ] **Analyze Request**: Understand the user's goal, context, and constraints.
- [ ] **Explore Codebase**: Use `list_files`, `view_file_outline`, and `grep_search` to understand existing systems.
- [ ] **Define Task**: Use `task_boundary` to set the `TaskName` and `TaskSummary`.
- [ ] **Create Plan**: Use `plan_task` to break down the work into steps.
- [ ] **Create Implementation Plan**: Create `implementation_plan.md` using the artifact format.
- [ ] **Review**: Request user review of the plan using `notify_user` if the task is complex or risky.
## 2. Execution Phase
- [ ] **Task Management**: Update `task.md` and `task_boundary` as you progress.
- [ ] **Step-by-Step**: Execute one step at a time.
- [ ] **Sequential Thinking**: Use `sequential_thinking` for complex logic or when stuck.
- [ ] **Code Changes**: Use `replace_file_content` or `multi_replace_file_content` for edits.
- [ ] **Validation**: Verify each change immediately after making it (e.g., compile, lint, run test).
- [ ] **Artifact Updates**: Update `task_boundary` status frequently.
## 3. Verification Phase
- [ ] **Comprehensive Testing**: Run relevant tests using `run_command` (e.g., `npm test`).
- [ ] **Visual Verification**: Use `browser_subagent` or `generate_image` if applicable.
- [ ] **Documentation**: Update `walkthrough.md` with proof of work (diffs, logs, screenshots).
- [ ] **Final Review**: Self-correction using `reflect_on_code` or `act_as_reviewer`.
## 4. Completion
- [ ] **Cleanup**: Remove temporary files or debug logs.
- [ ] **Final Notification**: Use `notify_user` to inform the user of completion and point to the `walkthrough.md`.
## Decision Heuristics
- **Complexity**: If > 3 files affected, create a detailed plan.
- **Risk**: If deleting code or changing DB schema, require user approval.
- **Uncertainty**: If unsure, prototyped first or ask the user.