taskmaster
npx skills add https://github.com/lili-luo/aicoding-cookbook --skill taskmaster
Agent 安装分布
Skill 文档
Taskmaster â Unified Task Protocol
Purpose
Single skill for all multi-step task tracking, with two operating modes:
| LITE Mode | FULL Mode | |
|---|---|---|
| When | Quick tasks, 3-8 steps, <1 hour | Long autonomous sessions, 5-15 steps, 1+ hours |
| Trigger | Default for simple multi-step tasks | User says “long task”, “big project”, “autonomous”, or task clearly needs hours of work |
| Files | TODO.csv only |
SPEC.md + TODO.csv + PROGRESS.md |
| Location | Project root | <project-root>/.codex-tasks/<task-name>/ |
| Verification | Optional (notes column) | Mandatory (validation_command + acceptance_criteria) |
| Decision log | None | PROGRESS.md |
| Spec freeze | None | SPEC.md (user-approved, immutable) |
| Context recovery | Re-read CSV | Re-read all 3 files from .codex-tasks/<task-name>/ |
If unsure which mode, start LITE. Upgrade to FULL mid-task if complexity grows.
LITE Mode
Lightweight CSV tracking synchronized with update_plan.
Core Rule
One row in CSV = One step in update_plan (same order, same text, synced at every update).
Workflow
- Determine project root â Git root when in repo, else CWD.
- Choose task name â 10-40 chars, derive from user request. Filename:
"<Task Name> TO DO list.csv" - Create plan â Split into 3-8 steps. Call
update_planwith exactly onein_progress. Verb-first texts (e.g., “Locate root cause”, “Implement fix”). - Create CSV at project root:
id,task,status,completed_at,notes
1,<step text>,TODO,,
2,<step text>,TODO,,
Rules:
status: onlyTODOorDONEcompleted_at: empty until DONE; then local time like2026-02-05 11:38
- Update during execution â When finishing a step: mark
completedinupdate_plan, mark nextin_progress, update CSV row toDONE+ fillcompleted_at. - Handle plan changes â Update
update_planfirst, then apply same change to CSV. - Close-out â Delete CSV when all rows are DONE. Keep if user explicitly wants record.
Performance Mode (optional)
For stress/load/latency tasks, add metric columns:
metric_name,target,actual,evidence_path- Same
TODOâDONElifecycle - Template:
assets/perf_todo_template.csv
LITE Output Contract
Every status update must include:
ä»»å¡:one-line goalè¿åº¦:X/Y steps DONEå½å:the in-progress stepæä»¶:CSV path (or “deleted” if done)
FULL Mode
Complete long-horizon protocol with verification gates, decision audit trail, context protection, and compaction recovery. Based on the four-file system proven in production autonomous coding sessions (25+ hours, 30k+ lines):
- SPEC.md â Frozen goal (what to build, what NOT to build)
- TODO.csv â Milestone tracker with verification gates (what to do next)
- PROGRESS.md â Decision log + audit trail (what happened and why)
- Implement rules â Embedded in this skill (how to behave)
All task artifacts live in <project-root>/.codex-tasks/<task-name>/ to prevent
polluting the project source tree. Each task gets its own subdirectory, enabling
multiple long tasks to coexist without conflict.
Core Rules
- CSV is single source of truth â Re-read TODO.csv from disk before starting each new step. Never rely on in-context memory of the CSV.
- No step is DONE without verification â Every step must pass its
validation_commandbefore being marked DONE. - Stop-and-fix on failure â If validation fails, mark status as FAILED,
increment
retry_count, append error to notes, fix, then re-validate. Never skip a failed step. - Retry limit = 5 â If
retry_countreaches 5, try an alternative approach (different implementation strategy, skip and revisit later, or decompose into smaller sub-steps). Log the decision in PROGRESS.md. Only request human intervention if ALL alternative approaches also fail. - Scope discipline â Only work on the current IN_PROGRESS step. Do not “helpfully” fix unrelated code or refactor things outside the plan.
- External logging â Write verbose reasoning to PROGRESS.md, not into the conversation. Keep the conversation lean.
- Cache before process â When fetching external data (APIs, web pages, docs),
write raw results to
.codex-tasks/<task-name>/raw/first. Subsequent processing reads from local cache to avoid redundant requests. - Idempotent runs â Each task creates a unique
<task-name>directory. Never overwrite another task’s artifacts.
Task Naming
Generate a semantic, unique task name:
- Format:
<YYYYMMDD>-<short-topic>(e.g.,20260224-rest-api,20260224-auth-refactor) - All lowercase, hyphen-separated, no spaces
- If the same topic already exists, append a numeric suffix:
-2,-3
Directory Structure
<project-root>/
âââ .codex-tasks/ # â All task artifacts (NOT in ~/.codex/)
â âââ 20260224-rest-api/ # Task 1
â â âââ SPEC.md # Frozen specification
â â âââ TODO.csv # Progress tracker
â â âââ PROGRESS.md # Decision log
â â âââ raw/ # Cached external data (optional)
â âââ 20260224-auth-refactor/ # Task 2 (parallel, independent)
â â âââ SPEC.md
â â âââ TODO.csv
â â âââ PROGRESS.md
â âââ .gitignore # Auto-created: ignores all task dirs
âââ src/ # Project source â never polluted
âââ ...
.codex-tasks/lives at the project root, not the global~/.codex/.- On first use, auto-create
.codex-tasks/.gitignorewith content:*(ignores all task artifacts by default). - If the user explicitly wants task artifacts committed, remove the gitignore.
- When the task completes, ask the user whether to keep or delete the task dir.
Workflow
Phase 0: Initialize
- Determine project root â Git root if in repo, else CWD.
- Choose task name â Semantic, unique (see Task Naming above).
- Create task directory:
.codex-tasks/<task-name>/ - Auto-create
.codex-tasks/.gitignorewith content*if it doesn’t exist. - Create SPEC.md from
assets/SPEC_TEMPLATE.md:- Goals (what to build)
- Non-goals (what NOT to do)
- Constraints (tech stack, style, limits)
- Environment (auto-detect: language, runtime, package manager, test framework)
- Risk assessment (external deps, breaking changes, disk space, timeouts)
- Deliverables (concrete outputs)
- Done-when (final acceptance criteria + validation command)
- Demo flow (how to verify the finished product)
- Log SPEC.md to conversation for visibility, then continue immediately. Do NOT wait for user approval â autonomous execution is the default. SPEC.md is the reference anchor; if scope needs adjustment mid-task, update SPEC.md directly and log the change reason in PROGRESS.md.
Phase 1: Plan
- Break down into milestones â 5-15 steps, verb-first text.
- Define verification for each step:
acceptance_criteria: human-readable definition of donevalidation_command: shell command that exits 0 on success
- Create TODO.csv:
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
1,<step text>,TODO,<what success looks like>,<command that exits 0>,,0,
2,<step text>,TODO,<what success looks like>,<command that exits 0>,,0,
Column rules:
status:TODO|IN_PROGRESS|DONE|FAILEDcompleted_at: empty until DONE, then local time2026-02-05 11:38validation_command: exits 0 = pass. Useecho SKIPfor non-automatable steps.retry_count: starts 0, +1 on each validation failure
- Call
update_planwith matching steps (onein_progress). - Initialize PROGRESS.md from
assets/PROGRESS_TEMPLATE.md.
Phase 2: Execute (the agent loop)
For each step, repeat:
1. RE-READ â Load .codex-tasks/<task-name>/TODO.csv from disk (NOT memory)
2. MARK â Set current step IN_PROGRESS in CSV + update_plan
3. IMPLEMENT â Do the actual work (scope: ONLY this step)
4. VALIDATE â Run validation_command
ââ PASS â Mark DONE, fill completed_at
ââ FAIL â Mark FAILED, retry_count += 1, append error to notes
â Fix and re-validate
â If retry_count >= 5 â Try alternative approach, log in PROGRESS.md
â Only request human help if all alternatives exhausted
5. LOG â Append entry to PROGRESS.md:
- What was done
- Key decisions + reasoning (alternatives considered)
- Problems encountered + resolution
- Next step preview
6. NEXT â Go to step 1 for next TODO row
Compaction recovery: If you lose context mid-task, follow the Context Recovery Protocol (see below) to restore state and resume.
Phase 3: Handle plan changes
- If scope changes mid-execution:
- Update
update_planfirst - Apply same change to CSV (re-number
idif needed) - Update SPEC.md if the change affects goals/constraints
- Log the change reason in PROGRESS.md
- Update
Phase 4: Close-out
- Verify ALL rows are DONE.
- Run a final integration validation if defined in SPEC.md’s done-when.
- Write final summary in PROGRESS.md (total milestones, failures, recoveries, human interventions, key learnings).
- Auto-delete
.codex-tasks/<task-name>/by default. If the task was complex or produced valuable learnings, keep it and log the reason in PROGRESS.md. - If all tasks in
.codex-tasks/are completed and deleted, remove the.codex-tasks/directory itself to leave the project clean.
Context Protection
These rules prevent context degradation during long sessions:
- Re-read before each step: The CSV file is truth, not your memory of it.
Always load
.codex-tasks/<task-name>/TODO.csvfrom disk. - Keep conversation lean: Reasoning and verbose output go to PROGRESS.md. The conversation should only contain status updates (Output Contract format).
- Cache external data: When fetching docs, APIs, or web pages, save raw
results to
.codex-tasks/<task-name>/raw/first. Process from local cache. Never fetch the same URL twice â check raw/ first. - No task drift: Only work on the current IN_PROGRESS row. Ignore temptations to “improve” other parts of the codebase. If you spot an unrelated issue, note it in PROGRESS.md under “Recommendations” but do NOT fix it now.
- Session handoff: If stopping mid-task, ensure PROGRESS.md’s Context Recovery Block is up-to-date so the next session can resume instantly.
Context Recovery Protocol
When you lose context (compaction, session restart, manual resume, or /continue):
- Detect â If you don’t have clear knowledge of the current task state, you have lost context. Do NOT guess or hallucinate previous progress.
- Locate â Find the task directory:
ls .codex-tasks/ - Recover â Read all three files in order:
SPEC.mdâ restore goal understanding and constraintsTODO.csvâ find current progress (first non-DONE row = resume point)PROGRESS.mdâ read the Context Recovery Block first (top of file), then skim recent milestone entries for decision context
- Verify â Cross-check: does the CSV state match PROGRESS.md’s last entry? If not, CSV wins (it’s the source of truth).
- Resume â Continue from the first non-DONE row in TODO.csv.
Announce recovery in Output Contract format:
ð ä¸ä¸ææ¢å¤å®æ ä»»å¡: <from SPEC.md> è¿åº¦: X/Y steps DONE æ¢å¤ç¹: Step #N â <title> 䏿¬¡ç¶æ: <from PROGRESS.md Context Recovery Block>
Critical: Update PROGRESS.md’s Context Recovery Block EVERY time a milestone changes status. This block is the fast-path for recovery â without it, the agent must re-read every milestone entry to reconstruct state.
Project Hygiene
- On first FULL mode use in a project, auto-create
.codex-tasks/.gitignorewith content*to prevent task artifacts from being committed. - Task artifacts are gitignored by default. Only remove the gitignore if the user explicitly asks to commit task artifacts.
- When all tasks complete, auto-delete
.codex-tasks/to leave the project clean.
Output Contract
Every status update must include:
ä»»å¡:one-line goal (from SPEC.md)è¿åº¦:X/Y steps DONEå½å:the IN_PROGRESS step (or FAILED step with retry count)éªè¯:last validation result (pass/fail + command used)æä»¶:.codex-tasks/<task-name>/path
Example
.codex-tasks/
âââ .gitignore # Content: *
âââ 20260224-rest-api/
âââ SPEC.md
âââ TODO.csv
âââ PROGRESS.md
âââ raw/ # Cached external data
âââ openapi-spec.json
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
1,Scaffold project structure,DONE,package.json + src/ exist,test -f package.json && test -d src,2026-02-24 11:36,0,
2,Implement core editor,IN_PROGRESS,Canvas renders shapes,npm test -- --grep editor,,1,First attempt: missing canvas dep
3,Add real-time collaboration,TODO,Cursors sync across tabs,npm test -- --grep collab,,0,
4,Write integration tests,TODO,All tests pass + coverage >80%,npm test && npm run coverage,,0,
5,Update documentation,TODO,README reflects all features,test -f README.md,,0,