task-based-multiagent
Set up task-based multi-agent systems with shared task files. Use when setting up parallel agent execution, designing worktree isolation patterns, or implementing task file coordination.
What this skill does
# Task-Based Multi-Agent Skill
Guide creation of task-based multi-agent systems using shared task files and worktree isolation.
## When to Use
- Setting up parallel agent execution
- Managing multiple concurrent workflows
- Scaling beyond single-agent patterns
- Building task queue systems
## Core Concept
Agents share a task file that acts as a coordination mechanism:
```markdown
## To Do
- [ ] Task A
- [ ] Task B
## In Progress
- [π‘ abc123] Task C - being worked on
## Done
- [β
def456] Task D - completed
```
## Task File Format
`tasks.md`:
```markdown
# Tasks
## Git Worktree {worktree-name}
## To Do
[] Pending task description # Available
[β°] Blocked task (waits for above) # Blocked
[] Task with #opus tag # Model override
[] Task with #adw_plan_implement tag # Workflow override
## In Progress
[π‘, adw_12345] Task being processed # Claimed by agent
## Done
[β
abc123, adw_12345] Completed task # Commit hash saved
[β, adw_12345] Failed task // Error reason # Error captured
```
## Status Markers
| Marker | Meaning | State |
| --- | --- | --- |
| `[]` | Pending | Available for pickup |
| `[β°]` | Blocked | Waiting for previous |
| `[π‘, {id}]` | In Progress | Being processed |
| `[β
{hash}, {id}]` | Complete | Finished successfully |
| `[β, {id}]` | Failed | Error occurred |
## Tag System
Tags modify agent behavior:
| Tag | Effect |
| --- | --- |
| `#opus` | Use Opus model |
| `#sonnet` | Use Sonnet model |
| `#adw_plan_implement` | Complex workflow |
| `#adw_build` | Simple build workflow |
## Implementation Architecture
```text
βββββββββββββββββββββββββββββββββββββββββββ
β CRON TRIGGER β
β (polls tasks.md every N seconds) β
βββββββββββββββββββ¬ββββββββββββββββββββββββ
β
βββββββββββΌββββββββββ
β β β
v v v
ββββββββββ ββββββββββ ββββββββββ
β Task A β β Task B β β Task C β
βWorktreeβ βWorktreeβ βWorktreeβ
β 1 β β 2 β β 3 β
ββββββββββ ββββββββββ ββββββββββ
```
## Setup Workflow
### Step 1: Create Task File
```markdown
# tasks.md
## To Do
[] First task to complete
[] Second task to complete
[β°] Blocked until first completes
## In Progress
## Done
```
### Step 2: Create Data Models
```python
from pydantic import BaseModel
from typing import Literal, Optional, List
class Task(BaseModel):
description: str
status: Literal["[]", "[β°]", "[π‘]", "[β
]", "[β]"]
adw_id: Optional[str] = None
commit_hash: Optional[str] = None
tags: List[str] = []
worktree_name: Optional[str] = None
```
### Step 3: Create Trigger Script
```python
# adw_trigger_cron_tasks.py
def main():
while True:
tasks = parse_tasks_file("tasks.md")
pending = [t for t in tasks if t.status == "[]"]
for task in pending:
if not is_blocked(task):
# Mark as in progress
claim_task(task)
# Spawn subprocess
spawn_task_workflow(task)
time.sleep(5) # Poll interval
```
### Step 4: Create Task Workflows
```python
# adw_build_update_task.py (simple)
def main(task_id: str):
# Mark in progress
update_task_status(task_id, "[π‘]")
# Execute /build
response = execute_template("/build", task_description)
# Mark complete
if response.success:
update_task_status(task_id, "[β
]", commit_hash)
else:
update_task_status(task_id, "[β]", error_reason)
```
### Step 5: Add Worktree Isolation
Each task gets its own worktree:
```bash
git worktree add trees/{task_id} -b task-{task_id} origin/main
```
## Coordination Rules
1. **Claim before processing**: Update status to `[π‘]` immediately
2. **Respect blocking**: Don't process `[β°]` tasks until dependencies complete
3. **Update on completion**: Always update status, even on failure
4. **Include context**: Save commit hash, error reason, ADW ID
## Key Memory References
- @git-worktree-patterns.md - Worktree isolation
- @composable-primitives.md - Workflow composition
- @zte-progression.md - Scaling to ZTE
## Output Format
```markdown
## Multi-Agent System Setup
**Task File:** tasks.md
**Trigger Interval:** 5 seconds
**Max Concurrent:** 5 agents
### Components
1. Task file format with status markers
2. Data models (Task, Status, Tags)
3. Cron trigger script
4. Task workflow scripts
5. Worktree isolation
### Workflow Routing
- Default: adw_build_update_task.py
- #adw_plan_implement: adw_plan_implement_update_task.py
- #opus: Use Opus model
### Status Flow
[] -> [π‘, id] -> [β
hash, id]
-> [β, id] // error
```
## Anti-Patterns
- Polling too frequently (< 1 second)
- Not claiming before processing (race conditions)
- Ignoring blocked tasks
- Not capturing failure reasons
- Running in same directory (no isolation)
## Version History
- **v1.0.0** (2025-12-26): Initial release
---
## Last Updated
**Date:** 2025-12-26
**Model:** claude-opus-4-5-20251101
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts β single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score β₯ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.