|
| 1 | +# Tasks |
| 2 | + |
| 3 | +Tasks are structured work units that enable agents to plan, track progress, and execute complex multi-step workflows. They provide a persistent checkpoint system — allowing work to be interrupted and resumed later — with clear goals, verifiable success criteria, and progressive state tracking. |
| 4 | + |
| 5 | +While **skills** teach agents *how* to do things (procedures and guidelines), **tasks** define *what* needs to be done (goals, plans, and execution steps). |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +Tasks are stored as markdown files in the `.agents/tasks/[task-name]/` directory. Each task contains structured files that describe goals, a step-by-step plan, and progress tracking. |
| 10 | + |
| 11 | +### Why Use Tasks? |
| 12 | + |
| 13 | +- **Checkpoints** — Interrupt and resume work at any phase |
| 14 | +- **Progress tracking** — Clear visibility into what's done and what remains |
| 15 | +- **Verifiable steps** — Each step has explicit success criteria |
| 16 | +- **Complex workflows** — Break large work into manageable phases |
| 17 | +- **Multi-agent coordination** — Delegate phases to specialized executor agents |
| 18 | + |
| 19 | +## Task Modes |
| 20 | + |
| 21 | +Tasks can be executed in two modes depending on the nature of the work: |
| 22 | + |
| 23 | +### Solo Tasks |
| 24 | + |
| 25 | +A single agent executes all phases sequentially, maintaining unified context throughout. |
| 26 | + |
| 27 | +**Best for:** |
| 28 | +- Reading/analyzing data to produce output |
| 29 | +- Tightly coupled phases with shared state |
| 30 | +- Tasks that fit within one agent's context window |
| 31 | +- Work requiring quick iteration and refinement |
| 32 | + |
| 33 | +``` |
| 34 | +[task-name]/ |
| 35 | +├── goals.md # Goals and success criteria |
| 36 | +├── plan.md # Full execution plan with all phases |
| 37 | +├── state.md # Progress tracking |
| 38 | +└── notes.md # Optional: additional context/notes |
| 39 | +``` |
| 40 | + |
| 41 | +### Team Tasks |
| 42 | + |
| 43 | +A coordinator agent delegates individual phases to executor agents, each working in isolated context. |
| 44 | + |
| 45 | +**Best for:** |
| 46 | +- Phases requiring different expertise or domains |
| 47 | +- Independent or parallelizable phases |
| 48 | +- Large tasks exceeding one agent's context window |
| 49 | +- Work benefiting from context isolation between phases |
| 50 | + |
| 51 | +``` |
| 52 | +[task-name]/ |
| 53 | +├── goals.md # Goals and success criteria |
| 54 | +├── plan.md # Full execution plan (reference) |
| 55 | +├── state.md # Progress tracking |
| 56 | +├── coordinator-instructions.md # Orchestration instructions |
| 57 | +└── phases/ |
| 58 | + ├── phase-1.md # Individual phase file |
| 59 | + └── phase-2.md |
| 60 | +``` |
| 61 | + |
| 62 | +### Choosing a Mode |
| 63 | + |
| 64 | +Use the `task-mode` skill to evaluate your task against decision criteria. The general rule: if phases need unified context, use solo; if phases benefit from isolation and different expertise, use team. |
| 65 | + |
| 66 | +## Task Files |
| 67 | + |
| 68 | +Each task file serves a specific purpose in the task lifecycle. |
| 69 | + |
| 70 | +### goals.md — Goals and Success Criteria |
| 71 | + |
| 72 | +Defines what the task achieves and how success is measured. |
| 73 | + |
| 74 | +```markdown |
| 75 | +# Goals and Success Criteria: [task-name] |
| 76 | + |
| 77 | +## Primary Goal |
| 78 | +[Clear statement of what the task achieves] |
| 79 | + |
| 80 | +## Success Criteria |
| 81 | +- [ ] Criterion 1 |
| 82 | +- [ ] Criterion 2 |
| 83 | + |
| 84 | +## Files Modified |
| 85 | +- `path/to/file` — description of changes |
| 86 | + |
| 87 | +## Exclusions |
| 88 | +[What is NOT included in this task] |
| 89 | +``` |
| 90 | + |
| 91 | +### plan.md — Execution Plan |
| 92 | + |
| 93 | +Contains all phases with step-by-step instructions and verifiable success criteria. |
| 94 | + |
| 95 | +```markdown |
| 96 | +# Task Plan: [task-name] |
| 97 | + |
| 98 | +## Phase 1: [Phase Name] |
| 99 | +**Goal:** [What this phase achieves] |
| 100 | + |
| 101 | +### Step 1.1: [Step Name] |
| 102 | +- **File:** `path/to/file` |
| 103 | +- **Action:** [Detailed instructions on what to do] |
| 104 | +- **Verify:** [Verifiable success criteria] |
| 105 | +``` |
| 106 | + |
| 107 | +**Rules:** Each step must be atomic (one clear action), specify the file to modify, describe the action, and include verifiable success criteria (e.g., "test passes", "code compiles"). |
| 108 | + |
| 109 | +### state.md — Progress Tracking |
| 110 | + |
| 111 | +Tracks current status and what has been completed. Updated after each phase. |
| 112 | + |
| 113 | +```markdown |
| 114 | +# Task State: [task-name] |
| 115 | + |
| 116 | +## Status: [planned | in-progress | completed] |
| 117 | + |
| 118 | +## Phases |
| 119 | +- [ ] Phase 1: [name] |
| 120 | + - [ ] Step 1.1 |
| 121 | + - [x] Step 1.2 ✓ |
| 122 | +- [ ] Phase 2: [name] |
| 123 | + |
| 124 | +## Notes |
| 125 | +- Next: Phase X, Step Y |
| 126 | +``` |
| 127 | + |
| 128 | +### notes.md — Optional Context |
| 129 | + |
| 130 | +Additional references, background information, or anything the agent should keep in mind during execution. |
| 131 | + |
| 132 | +### coordinator-instructions.md (Team Only) |
| 133 | + |
| 134 | +Orchestration guide for the coordinator agent — lists phases, step counts, and the delegation workflow. |
| 135 | + |
| 136 | +### phases/phase-X.md (Team Only) |
| 137 | + |
| 138 | +Self-contained phase file with full context and step-by-step instructions. Executor agents read only their assigned phase file. |
| 139 | + |
| 140 | +```markdown |
| 141 | +# Phase X: [Phase Name] |
| 142 | + |
| 143 | +## Context |
| 144 | +- **Task ID:** [task-name] |
| 145 | +- **Current state:** [metrics/status] |
| 146 | +- **Target:** [what we're aiming for] |
| 147 | + |
| 148 | +### Step X.1: [Step Name] |
| 149 | +**File:** `path/to/file` |
| 150 | +**Execution Plan:** [Detailed instructions] |
| 151 | +**Success Criteria:** |
| 152 | +- [ ] Criterion 1 (verifiable) |
| 153 | +``` |
| 154 | + |
| 155 | +## Task Skills Ecosystem |
| 156 | + |
| 157 | +The task system is powered by a set of specialized skills. Use `%use-tasks` to load the full reference guide. |
| 158 | + |
| 159 | +### Creation Skills |
| 160 | + |
| 161 | +| Skill | Purpose | When to Use | |
| 162 | +|-------|---------|-------------| |
| 163 | +| `create-task` | Entry point — analyzes request, chooses mode, delegates | User asks to create a new task | |
| 164 | +| `task-mode` | Mode selector — checklist to decide solo vs team | Determining execution mode | |
| 165 | +| `create-task-solo` | Creates task for single-agent execution | Task needs unified context | |
| 166 | +| `create-task-team` | Creates task for multi-agent execution | Task has independent phases | |
| 167 | + |
| 168 | +### Execution Skills |
| 169 | + |
| 170 | +| Skill | Purpose | When to Use | |
| 171 | +|-------|---------|-------------| |
| 172 | +| `execute-task-solo` | Execute a solo task (single agent runs all phases) | Running a solo task | |
| 173 | +| `execute-task-team` | Execute a team task (coordinator delegates to executors) | Coordinator running a team task | |
| 174 | +| `execute-task-phase` | Behavioral contract for executor agents | Executor agent running an assigned phase | |
| 175 | + |
| 176 | +### Reference |
| 177 | + |
| 178 | +| Skill | Purpose | |
| 179 | +|-------|---------| |
| 180 | +| `use-tasks` | Overview of the task system and which skill to use | |
| 181 | + |
| 182 | +## Using Tasks |
| 183 | + |
| 184 | +### Creating a Task |
| 185 | + |
| 186 | +Ask an agent to create a task. The agent will: |
| 187 | +1. Analyze the request |
| 188 | +2. Choose solo or team mode using `task-mode` |
| 189 | +3. Create the task directory structure with all required files |
| 190 | +4. Report the plan to you before execution |
| 191 | + |
| 192 | +``` |
| 193 | +Create a task to document the agent-smith-plugins package |
| 194 | +%create-task |
| 195 | +``` |
| 196 | + |
| 197 | +### Executing a Task |
| 198 | + |
| 199 | +Use the `load-task` tool to load a task into the workspace, then have an agent execute it: |
| 200 | + |
| 201 | +``` |
| 202 | +Execute the maintain-agent-docs task |
| 203 | +%execute-task-solo |
| 204 | +``` |
| 205 | + |
| 206 | +The agent will: |
| 207 | +1. Read `state.md` to determine current progress |
| 208 | +2. Execute the next incomplete step from `plan.md` |
| 209 | +3. Verify success criteria |
| 210 | +4. Update `state.md` to mark the step complete |
| 211 | +5. Repeat until all phases are done |
| 212 | + |
| 213 | +### Loading a Task |
| 214 | + |
| 215 | +Use the `load-task` tool to load a task into your workspace: |
| 216 | + |
| 217 | +``` |
| 218 | +%use-task maintain-agent-docs |
| 219 | +``` |
| 220 | + |
| 221 | +This copies the task files to your workspace for the agent to work with. |
| 222 | + |
| 223 | +## Task Lifecycle |
| 224 | + |
| 225 | +### 1. Create |
| 226 | +The agent creates the task structure (`goals.md`, `plan.md`, `state.md`) and presents it to you for review. |
| 227 | + |
| 228 | +### 2. Execute |
| 229 | +The agent executes phases one by one, updating `state.md` after each completed step. Never skip ahead — always verify success criteria before proceeding. |
| 230 | + |
| 231 | +### 3. Complete |
| 232 | +When all phases are done, the agent asks you to verify the results. Only delete the task directory if you confirm everything is correct. |
| 233 | + |
| 234 | +### 4. Interrupted |
| 235 | +If execution stops mid-way, `state.md` is updated with what was done and what remains. You can resume later by loading the task again. |
| 236 | + |
| 237 | +## Example: Solo Task |
| 238 | + |
| 239 | +Here's how a solo task looks in practice (from the `maintain-agent-docs` task): |
| 240 | + |
| 241 | +**goals.md:** |
| 242 | +```markdown |
| 243 | +# Goals and Success Criteria: maintain-agent-docs |
| 244 | + |
| 245 | +## Primary Goal |
| 246 | +Audit and maintain the AI agent navigation documentation for a single package. |
| 247 | + |
| 248 | +## Success Criteria |
| 249 | +- [ ] Summary accurately describes module purpose |
| 250 | +- [ ] Dependencies list is current |
| 251 | +- [ ] Key Files table includes all important files |
| 252 | +``` |
| 253 | + |
| 254 | +**plan.md (excerpt):** |
| 255 | +```markdown |
| 256 | +# Task Plan: maintain-agent-docs |
| 257 | + |
| 258 | +## Step 1: Resolve Package Path |
| 259 | +- Map the package parameter to its directory path |
| 260 | +- **Success Criteria:** |
| 261 | + - [ ] Package path identified |
| 262 | + - [ ] Target file path determined |
| 263 | + |
| 264 | +## Step 2: Explore the Module |
| 265 | +- Walk the module's directory tree |
| 266 | +- Identify entry points, key files, dependencies |
| 267 | +- **Success Criteria:** |
| 268 | + - [ ] All source files identified |
| 269 | + - [ ] Entry point located |
| 270 | +``` |
| 271 | + |
| 272 | +**state.md (excerpt):** |
| 273 | +```markdown |
| 274 | +# Task State: maintain-agent-docs |
| 275 | + |
| 276 | +## Status: completed |
| 277 | + |
| 278 | +## Progress |
| 279 | + |
| 280 | +### Step 1: Resolve Package Path |
| 281 | +- [x] ✓ Package path identified |
| 282 | +- [x] ✓ Target file path determined |
| 283 | + |
| 284 | +### Step 2: Explore the Module |
| 285 | +- [x] ✓ All source files identified |
| 286 | +- [x] ✓ Entry point located |
| 287 | +``` |
| 288 | + |
| 289 | +## Best Practices |
| 290 | + |
| 291 | +1. **Keep tasks focused** — One task should have one clear goal. Split complex work into multiple tasks. |
| 292 | +2. **Write verifiable success criteria** — Each step must have criteria that can be objectively checked (e.g., "test passes", "file contains X"). |
| 293 | +3. **Update state after each step** — Never batch updates. Always mark progress incrementally. |
| 294 | +4. **Don't skip phases** — Execute steps sequentially; never jump ahead. |
| 295 | +5. **Confirm before deleting** — Always ask the user before removing a completed task directory. |
| 296 | + |
| 297 | +## Troubleshooting |
| 298 | + |
| 299 | +| Problem | Solution | |
| 300 | +|---------|----------| |
| 301 | +| Task not found | Check `.agents/tasks/` directory exists and task name is correct | |
| 302 | +| State not updating | Ensure `state.md` exists in the task directory | |
| 303 | +| Agent skipping steps | Load `execute-task-solo` or `execute-task-team` skill for proper execution rules | |
| 304 | +| Wrong mode chosen | Use `task-mode` skill to re-evaluate before creating the task | |
| 305 | + |
| 306 | +<a href="javascript:openLink('/frontend/skills')">Previous: skills</a> |
| 307 | +<a href="javascript:openLink('/frontend/apps')">Next: apps</a> |
0 commit comments