# Advanced Tasks Source: https://docs.task-master.dev/best-practices/advanced-tasks ## AI-Driven Development Workflow The Cursor agent is pre-configured (via the rules file) to follow this workflow: ### 1. Task Discovery and Selection Ask the agent to list available tasks: ``` What tasks are available to work on next? ``` ``` Can you show me tasks 1, 3, and 5 to understand their current status? ``` The agent will: * Run `task-master list` to see all tasks * Run `task-master next` to determine the next task to work on * Run `task-master show 1,3,5` to display multiple tasks with interactive options * Analyze dependencies to determine which tasks are ready to be worked on * Prioritize tasks based on priority level and ID order * Suggest the next task(s) to implement ### 2. Task Implementation When implementing a task, the agent will: * Reference the task's details section for implementation specifics * Consider dependencies on previous tasks * Follow the project's coding standards * Create appropriate tests based on the task's testStrategy You can ask: ``` Let's implement task 3. What does it involve? ``` ### 2.1. Viewing Multiple Tasks For efficient context gathering and batch operations: ``` Show me tasks 5, 7, and 9 so I can plan my implementation approach. ``` The agent will: * Run `task-master show 5,7,9` to display a compact summary table * Show task status, priority, and progress indicators * Provide an interactive action menu with batch operations * Allow you to perform group actions like marking multiple tasks as in-progress ### 3. Task Verification Before marking a task as complete, verify it according to: * The task's specified testStrategy * Any automated tests in the codebase * Manual verification if required ### 4. Task Completion When a task is completed, tell the agent: ``` Task 3 is now complete. Please update its status. ``` The agent will execute: ```bash theme={null} task-master set-status --id=3 --status=done ``` ### 5. Handling Implementation Drift If during implementation, you discover that: * The current approach differs significantly from what was planned * Future tasks need to be modified due to current implementation choices * New dependencies or requirements have emerged Tell the agent: ``` We've decided to use MongoDB instead of PostgreSQL. Can you update all future tasks (from ID 4) to reflect this change? ``` The agent will execute: ```bash theme={null} task-master update --from=4 --prompt="Now we are using MongoDB instead of PostgreSQL." # OR, if research is needed to find best practices for MongoDB: task-master update --from=4 --prompt="Update to use MongoDB, researching best practices" --research ``` This will rewrite or re-scope subsequent tasks in tasks.json while preserving completed work. ### 6. Reorganizing Tasks If you need to reorganize your task structure: ``` I think subtask 5.2 would fit better as part of task 7 instead. Can you move it there? ``` The agent will execute: ```bash theme={null} task-master move --from=5.2 --to=7.3 ``` You can reorganize tasks in various ways: * Moving a standalone task to become a subtask: `--from=5 --to=7` * Moving a subtask to become a standalone task: `--from=5.2 --to=7` * Moving a subtask to a different parent: `--from=5.2 --to=7.3` * Reordering subtasks within the same parent: `--from=5.2 --to=5.4` * Moving a task to a new ID position: `--from=5 --to=25` (even if task 25 doesn't exist yet) * Moving multiple tasks at once: `--from=10,11,12 --to=16,17,18` (must have same number of IDs, Taskmaster will look through each position) When moving tasks to new IDs: * The system automatically creates placeholder tasks for non-existent destination IDs * This prevents accidental data loss during reorganization * Any tasks that depend on moved tasks will have their dependencies updated * When moving a parent task, all its subtasks are automatically moved with it and renumbered This is particularly useful as your project understanding evolves and you need to refine your task structure. ### 7. Resolving Merge Conflicts with Tasks When working with a team, you might encounter merge conflicts in your tasks.json file if multiple team members create tasks on different branches. The move command makes resolving these conflicts straightforward: ``` I just merged the main branch and there's a conflict with tasks.json. My teammates created tasks 10-15 while I created tasks 10-12 on my branch. Can you help me resolve this? ``` The agent will help you: 1. Keep your teammates' tasks (10-15) 2. Move your tasks to new positions to avoid conflicts: ```bash theme={null} # Move your tasks to new positions (e.g., 16-18) task-master move --from=10 --to=16 task-master move --from=11 --to=17 task-master move --from=12 --to=18 ``` This approach preserves everyone's work while maintaining a clean task structure, making it much easier to handle task conflicts than trying to manually merge JSON files. ### 8. Breaking Down Complex Tasks For complex tasks that need more granularity: ``` Task 5 seems complex. Can you break it down into subtasks? ``` The agent will execute: ```bash theme={null} task-master expand --id=5 --num=3 ``` You can provide additional context: ``` Please break down task 5 with a focus on security considerations. ``` The agent will execute: ```bash theme={null} task-master expand --id=5 --prompt="Focus on security aspects" ``` You can also expand all pending tasks: ``` Please break down all pending tasks into subtasks. ``` The agent will execute: ```bash theme={null} task-master expand --all ``` For research-backed subtask generation using the configured research model: ``` Please break down task 5 using research-backed generation. ``` The agent will execute: ```bash theme={null} task-master expand --id=5 --research ``` # Advanced Configuration Source: https://docs.task-master.dev/best-practices/configuration-advanced Taskmaster uses two primary methods for configuration: 1. **`.taskmaster/config.json` File (Recommended - New Structure)** * This JSON file stores most configuration settings, including AI model selections, parameters, logging levels, and project defaults. * **Location:** This file is created in the `.taskmaster/` directory when you run the `task-master models --setup` interactive setup or initialize a new project with `task-master init`. * **Migration:** Existing projects with `.taskmasterconfig` in the root will continue to work, but should be migrated to the new structure using `task-master migrate`. * **Management:** Use the `task-master models --setup` command (or `models` MCP tool) to interactively create and manage this file. You can also set specific models directly using `task-master models --set-=`, adding `--ollama` or `--openrouter` flags for custom models. Manual editing is possible but not recommended unless you understand the structure. * **Example Structure:** ```json theme={null} { "models": { "main": { "provider": "anthropic", "modelId": "claude-3-7-sonnet-20250219", "maxTokens": 64000, "temperature": 0.2, "baseURL": "https://api.anthropic.com/v1" }, "research": { "provider": "perplexity", "modelId": "sonar-pro", "maxTokens": 8700, "temperature": 0.1, "baseURL": "https://api.perplexity.ai/v1" }, "fallback": { "provider": "anthropic", "modelId": "claude-3-5-sonnet", "maxTokens": 64000, "temperature": 0.2 } }, "global": { "logLevel": "info", "debug": false, "defaultSubtasks": 5, "defaultPriority": "medium", "defaultTag": "master", "projectName": "Your Project Name", "ollamaBaseURL": "http://localhost:11434/api", "azureBaseURL": "https://your-endpoint.azure.com/openai/deployments", "vertexProjectId": "your-gcp-project-id", "vertexLocation": "us-central1" } } ``` 2. **Legacy `.taskmasterconfig` File (Backward Compatibility)** * For projects that haven't migrated to the new structure yet. * **Location:** Project root directory. * **Migration:** Use `task-master migrate` to move this to `.taskmaster/config.json`. * **Deprecation:** While still supported, you'll see warnings encouraging migration to the new structure. ## Environment Variables (`.env` file or MCP `env` block - For API Keys Only) * Used **exclusively** for sensitive API keys and specific endpoint URLs. * **Location:** * For CLI usage: Create a `.env` file in your project root. * For MCP/Cursor usage: Configure keys in the `env` section of your `.cursor/mcp.json` file. * **Required API Keys (Depending on configured providers):** * `ANTHROPIC_API_KEY`: Your Anthropic API key. * `PERPLEXITY_API_KEY`: Your Perplexity API key. * `OPENAI_API_KEY`: Your OpenAI API key. * `GOOGLE_API_KEY`: Your Google API key (also used for Vertex AI provider). * `MISTRAL_API_KEY`: Your Mistral API key. * `AZURE_OPENAI_API_KEY`: Your Azure OpenAI API key (also requires `AZURE_OPENAI_ENDPOINT`). * `OPENROUTER_API_KEY`: Your OpenRouter API key. * `XAI_API_KEY`: Your X-AI API key. * **Optional Endpoint Overrides:** * **Per-role `baseURL` in `.taskmasterconfig`:** You can add a `baseURL` property to any model role (`main`, `research`, `fallback`) to override the default API endpoint for that provider. If omitted, the provider's standard endpoint is used. * **Environment Variable Overrides (`_BASE_URL`):** For greater flexibility, especially with third-party services, you can set an environment variable like `OPENAI_BASE_URL` or `MISTRAL_BASE_URL`. This will override any `baseURL` set in the configuration file for that provider. This is the recommended way to connect to OpenAI-compatible APIs. * `AZURE_OPENAI_ENDPOINT`: Required if using Azure OpenAI key (can also be set as `baseURL` for the Azure model role). * `OLLAMA_BASE_URL`: Override the default Ollama API URL (Default: `http://localhost:11434/api`). * `VERTEX_PROJECT_ID`: Your Google Cloud project ID for Vertex AI. Required when using the 'vertex' provider. * `VERTEX_LOCATION`: Google Cloud region for Vertex AI (e.g., 'us-central1'). Default is 'us-central1'. * `GOOGLE_APPLICATION_CREDENTIALS`: Path to service account credentials JSON file for Google Cloud auth (alternative to API key for Vertex AI). * **Optional Auto-Update Control:** * `TASKMASTER_SKIP_AUTO_UPDATE`: Set to '1' to disable automatic updates. Also automatically disabled in CI environments (when `CI` environment variable is set). **Important:** Settings like model ID selections (`main`, `research`, `fallback`), `maxTokens`, `temperature`, `logLevel`, `defaultSubtasks`, `defaultPriority`, and `projectName` are **managed in `.taskmaster/config.json`** (or `.taskmasterconfig` for unmigrated projects), not environment variables. ## Tagged Task Lists Configuration (v0.17+) Taskmaster includes a tagged task lists system for multi-context task management. ### Global Tag Settings ```json theme={null} "global": { "defaultTag": "master" } ``` * **`defaultTag`** (string): Default tag context for new operations (default: "master") ### Git Integration Task Master provides manual git integration through the `--from-branch` option: * **Manual Tag Creation**: Use `task-master add-tag --from-branch` to create a tag based on your current git branch name * **User Control**: No automatic tag switching - you control when and how tags are created * **Flexible Workflow**: Supports any git workflow without imposing rigid branch-tag mappings ## State Management File Taskmaster uses `.taskmaster/state.json` to track tagged system runtime information: ```json theme={null} { "currentTag": "master", "lastSwitched": "2025-06-11T20:26:12.598Z", "migrationNoticeShown": true } ``` * **`currentTag`**: Currently active tag context * **`lastSwitched`**: Timestamp of last tag switch * **`migrationNoticeShown`**: Whether migration notice has been displayed This file is automatically created during tagged system migration and should not be manually edited. ## Example `.env` File (for API Keys) ``` # Required API keys for providers configured in .taskmaster/config.json ANTHROPIC_API_KEY=sk-ant-api03-your-key-here PERPLEXITY_API_KEY=pplx-your-key-here # OPENAI_API_KEY=sk-your-key-here # GOOGLE_API_KEY=AIzaSy... # AZURE_OPENAI_API_KEY=your-azure-openai-api-key-here # etc. # Optional Endpoint Overrides # Use a specific provider's base URL, e.g., for an OpenAI-compatible API # OPENAI_BASE_URL=https://api.third-party.com/v1 # # Azure OpenAI Configuration # AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/ or https://your-endpoint-name.cognitiveservices.azure.com/openai/deployments # OLLAMA_BASE_URL=http://custom-ollama-host:11434/api # Google Vertex AI Configuration (Required if using 'vertex' provider) # VERTEX_PROJECT_ID=your-gcp-project-id ``` ## Troubleshooting ### Configuration Errors * If Task Master reports errors about missing configuration or cannot find the config file, run `task-master models --setup` in your project root to create or repair the file. * For new projects, config will be created at `.taskmaster/config.json`. For legacy projects, you may want to use `task-master migrate` to move to the new structure. * Ensure API keys are correctly placed in your `.env` file (for CLI) or `.cursor/mcp.json` (for MCP) and are valid for the providers selected in your config file. ### If `task-master init` doesn't respond: Try running it with Node directly: ```bash theme={null} node node_modules/claude-task-master/scripts/init.js ``` Or clone the repository and run: ```bash theme={null} git clone https://github.com/eyaltoledano/claude-task-master.git cd claude-task-master node scripts/init.js ``` ## Provider-Specific Configuration ### Google Vertex AI Configuration Google Vertex AI is Google Cloud's enterprise AI platform and requires specific configuration: 1. **Prerequisites**: * A Google Cloud account with Vertex AI API enabled * Either a Google API key with Vertex AI permissions OR a service account with appropriate roles * A Google Cloud project ID 2. **Authentication Options**: * **API Key**: Set the `GOOGLE_API_KEY` environment variable * **Service Account**: Set `GOOGLE_APPLICATION_CREDENTIALS` to point to your service account JSON file 3. **Required Configuration**: * Set `VERTEX_PROJECT_ID` to your Google Cloud project ID * Set `VERTEX_LOCATION` to your preferred Google Cloud region (default: us-central1) 4. **Example Setup**: ```bash theme={null} # In .env file GOOGLE_API_KEY=AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXX VERTEX_PROJECT_ID=my-gcp-project-123 VERTEX_LOCATION=us-central1 ``` Or using service account: ```bash theme={null} # In .env file GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json VERTEX_PROJECT_ID=my-gcp-project-123 VERTEX_LOCATION=us-central1 ``` 5. **In .taskmaster/config.json**: ```json theme={null} "global": { "vertexProjectId": "my-gcp-project-123", "vertexLocation": "us-central1" } ``` ### Azure OpenAI Configuration Azure OpenAI provides enterprise-grade OpenAI models through Microsoft's Azure cloud platform and requires specific configuration: 1. **Prerequisites**: * An Azure account with an active subscription * Azure OpenAI service resource created in the Azure portal * Azure OpenAI API key and endpoint URL * Deployed models (e.g., gpt-4o, gpt-4o-mini, gpt-4.1, etc) in your Azure OpenAI resource 2. **Authentication**: * Set the `AZURE_OPENAI_API_KEY` environment variable with your Azure OpenAI API key * Configure the endpoint URL using one of the methods below 3. **Configuration Options**: **Option 1: Using Global Azure Base URL (affects all Azure models)** ```json theme={null} // In .taskmaster/config.json { "models": { "main": { "provider": "azure", "modelId": "gpt-4o", "maxTokens": 16000, "temperature": 0.7 }, "fallback": { "provider": "azure", "modelId": "gpt-4o-mini", "maxTokens": 10000, "temperature": 0.7 } }, "global": { "azureBaseURL": "https://your-resource-name.azure.com/openai/deployments" } } ``` **Option 2: Using Per-Model Base URLs (recommended for flexibility)** ```json theme={null} // In .taskmaster/config.json { "models": { "main": { "provider": "azure", "modelId": "gpt-4o", "maxTokens": 16000, "temperature": 0.7, "baseURL": "https://your-resource-name.azure.com/openai/deployments" }, "research": { "provider": "perplexity", "modelId": "sonar-pro", "maxTokens": 8700, "temperature": 0.1 }, "fallback": { "provider": "azure", "modelId": "gpt-4o-mini", "maxTokens": 10000, "temperature": 0.7, "baseURL": "https://your-resource-name.azure.com/openai/deployments" } } } ``` 4. **Environment Variables**: ```bash theme={null} # In .env file AZURE_OPENAI_API_KEY=your-azure-openai-api-key-here # Optional: Override endpoint for all Azure models AZURE_OPENAI_ENDPOINT=https://your-resource-name.azure.com/openai/deployments ``` 5. **Important Notes**: * **Model Deployment Names**: The `modelId` in your configuration should match the **deployment name** you created in Azure OpenAI Studio, not the underlying model name * **Base URL Priority**: Per-model `baseURL` settings override the global `azureBaseURL` setting * **Endpoint Format**: When using per-model `baseURL`, use the full path including `/openai/deployments` 6. **Troubleshooting**: **"Resource not found" errors:** * Ensure your `baseURL` includes the full path: `https://your-resource-name.openai.azure.com/openai/deployments` * Verify that your deployment name in `modelId` exactly matches what's configured in Azure OpenAI Studio * Check that your Azure OpenAI resource is in the correct region and properly deployed **Authentication errors:** * Verify your `AZURE_OPENAI_API_KEY` is correct and has not expired * Ensure your Azure OpenAI resource has the necessary permissions * Check that your subscription has not been suspended or reached quota limits **Model availability errors:** * Confirm the model is deployed in your Azure OpenAI resource * Verify the deployment name matches your configuration exactly (case-sensitive) * Ensure the model deployment is in a "Succeeded" state in Azure OpenAI Studio * Ensure youre not getting rate limited by `maxTokens` maintain appropriate Tokens per Minute Rate Limit (TPM) in your deployment. # Intro to Advanced Usage Source: https://docs.task-master.dev/best-practices/index # Best Practices Explore advanced tips, recommended workflows, and best practices for getting the most out of Task Master. # CLI Commands Source: https://docs.task-master.dev/capabilities/cli-root-commands ```bash theme={null} # Parse a PRD file and generate tasks task-master parse-prd # Limit the number of tasks generated task-master parse-prd --num-tasks=10 ``` ```bash theme={null} # List all tasks task-master list # List tasks with a specific status task-master list --status= # List tasks with subtasks task-master list --with-subtasks # List tasks with a specific status and include subtasks task-master list --status= --with-subtasks # Watch for changes and auto-refresh the list task-master list --watch task-master list -w # Combine watch with other options task-master list all -w # Watch all tasks with subtasks task-master list -w --compact # Watch in compact format task-master list --status=pending -w # Watch pending tasks only ``` ```bash theme={null} # Show the next task to work on based on dependencies and status task-master next ``` ```bash theme={null} # Show details of a specific task task-master show # or task-master show --id= # View a specific subtask (e.g., subtask 2 of task 1) task-master show 1.2 ``` ```bash theme={null} # Update tasks from a specific ID and provide context task-master update --from= --prompt="" ``` ```bash theme={null} # Update a single task by ID with new information task-master update-task --id= --prompt="" # Use research-backed updates with Perplexity AI task-master update-task --id= --prompt="" --research ``` ```bash theme={null} # Append additional information to a specific subtask task-master update-subtask --id= --prompt="" # Example: Add details about API rate limiting to subtask 2 of task 5 task-master update-subtask --id=5.2 --prompt="Add rate limiting of 100 requests per minute" # Use research-backed updates with Perplexity AI task-master update-subtask --id= --prompt="" --research ``` Unlike the `update-task` command which replaces task information, the `update-subtask` command *appends* new information to the existing subtask details, marking it with a timestamp. This is useful for iteratively enhancing subtasks while preserving the original content. ```bash theme={null} # Generate individual task files from tasks.json task-master generate ``` ```bash theme={null} # Set status of a single task task-master set-status --id= --status= # Set status for multiple tasks task-master set-status --id=1,2,3 --status= # Set status for subtasks task-master set-status --id=1.1,1.2 --status= ``` When marking a task as "done", all of its subtasks will automatically be marked as "done" as well. ```bash theme={null} # Expand a specific task with subtasks task-master expand --id= --num= # Expand with additional context task-master expand --id= --prompt="" # Expand all pending tasks task-master expand --all # Force regeneration of subtasks for tasks that already have them task-master expand --all --force # Research-backed subtask generation for a specific task task-master expand --id= --research # Research-backed generation for all tasks task-master expand --all --research ``` ```bash theme={null} # Clear subtasks from a specific task task-master clear-subtasks --id= # Clear subtasks from multiple tasks task-master clear-subtasks --id=1,2,3 # Clear subtasks from all tasks task-master clear-subtasks --all ``` ```bash theme={null} # Analyze complexity of all tasks task-master analyze-complexity # Save report to a custom location task-master analyze-complexity --output=my-report.json # Use a specific LLM model task-master analyze-complexity --model=claude-3-opus-20240229 # Set a custom complexity threshold (1-10) task-master analyze-complexity --threshold=6 # Use an alternative tasks file task-master analyze-complexity --file=custom-tasks.json # Use your configured research model for research-backed complexity analysis task-master analyze-complexity --research ``` ```bash theme={null} # Display the task complexity analysis report task-master complexity-report # View a report at a custom location task-master complexity-report --file=my-report.json ``` ```bash theme={null} # Add a dependency to a task task-master add-dependency --id= --depends-on= # Remove a dependency from a task task-master remove-dependency --id= --depends-on= # Validate dependencies without fixing them task-master validate-dependencies # Find and fix invalid dependencies automatically task-master fix-dependencies ``` ```bash theme={null} # Add a new task using AI task-master add-task --prompt="Description of the new task" # Add a task with dependencies task-master add-task --prompt="Description" --dependencies=1,2,3 # Add a task with priority task-master add-task --prompt="Description" --priority=high ``` ```bash theme={null} # Initialize a new project with Task Master structure task-master init ``` # Clusters & Execution Source: https://docs.task-master.dev/capabilities/clusters Visualize execution phases and launch autonomous Claude Code teams sessions # Clusters & Execution Task Master automatically detects **execution clusters** — groups of tasks that can run in parallel, sequenced by their dependency graph. The `clusters` command visualizes your execution topology, and `clusters start` launches an autonomous Claude Code session to execute the plan. ## Recommended Setup For the best experience with `tm clusters start`, use **iTerm2** with **tmux control mode**. This gives Claude Code's agent teams the ability to open split panes and manage parallel work visually. ### Step-by-step 1. **Open iTerm2** (macOS) — [download here](https://iterm2.com) if you don't have it 2. **Start tmux in control mode:** ```bash theme={null} tmux -CC ``` iTerm2 will open a native tmux integration window. This lets Claude Code spawn panes and tabs that iTerm2 manages natively — no raw tmux key bindings needed. 3. **Run the command:** ```bash theme={null} tm clusters start --tag ``` Or without a tag to execute the active tag: ```bash theme={null} tm clusters start ``` `tmux -CC` is iTerm2's "control mode" — it bridges tmux sessions with iTerm2's native tab/pane management. You get all the benefits of tmux (session persistence, pane splitting) with iTerm2's UI. Claude Code's agent teams leverage this to orchestrate parallel task execution across panes. ## Visualizing Clusters Before executing, use `tm clusters` to understand your project's execution topology. ### Tag-level phases Without a `--tag` flag, `clusters` shows your tags organized into execution phases: ```bash theme={null} tm clusters ``` Tags at the same level can run in parallel. Tags at higher levels depend on lower levels completing first. ### Task-level clusters Drill into a specific tag to see how its tasks are clustered: ```bash theme={null} tm clusters --tag backend ``` Each cluster groups tasks that share the same topological level — they have no dependencies on each other and can execute concurrently. ### Output formats | Flag | Output | Use case | | ----------------------- | ------------------------------------ | ------------------------------------------------------------------ | | *(default)* | Table with cluster breakdown | Quick overview | | `--tree` | ASCII dependency tree | Understanding task relationships | | `--diagram mermaid` | Rendered Mermaid diagram in terminal | Visual dependency graph | | `--diagram mermaid-raw` | Raw Mermaid syntax | Copy-paste into docs, PRs, or [mermaid.live](https://mermaid.live) | | `--json` | Raw JSON | Programmatic access | ```bash theme={null} # Visual dependency graph tm clusters --tag backend --diagram mermaid # Raw Mermaid for embedding in docs tm clusters --diagram mermaid-raw > execution-plan.mmd ``` ## Executing Clusters ### `tm clusters start` Builds an execution plan from your task graph and launches an interactive Claude Code session with agent teams enabled. ```bash theme={null} tm clusters start --tag ``` **What happens:** 1. Task Master loads your tasks and detects clusters from the dependency DAG 2. An execution plan is built — showing clusters, task count, and estimated turns 3. The plan is displayed for review 4. Claude Code launches with a system prompt containing the full execution context 5. Agent teams mode is enabled (`CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`), allowing Claude to spawn sub-agents for parallel task execution ### CLI options | Option | Description | | ----------------------- | -------------------------------------------- | | `-t, --tag ` | Tag to execute (default: active tag) | | `--dry-run` | Show execution plan without launching Claude | | `--parallel ` | Max concurrent tasks per level (default: 5) | | `--resume` | Resume from a previous checkpoint | | `--continue-on-failure` | Keep going even if some tasks fail | | `--json` | Output the execution plan as JSON | | `-p, --project ` | Project root (auto-detected if not provided) | ### Dry run Preview the execution plan without launching a Claude session: ```bash theme={null} tm clusters start --tag backend --dry-run ``` ### Resume from checkpoint If a session is interrupted (Ctrl+C), Task Master saves a checkpoint automatically. Resume where you left off: ```bash theme={null} tm clusters start --tag backend --resume ``` ## Example Workflow ```bash theme={null} # 1. See the big picture — tag-level execution phases tm clusters # 2. Drill into a tag tm clusters --tag backend # 3. Preview the execution plan tm clusters start --tag backend --dry-run # 4. Open iTerm2, start tmux control mode, and execute tmux -CC tm clusters start --tag backend ``` *** **Related documentation:** * [CLI Root Commands](/capabilities/cli-root-commands) — full command reference * [Loop Command](/capabilities/loop) — autonomous loop-based execution * [Task Structure](/capabilities/task-structure) — understanding task organization # MCP Tools Source: https://docs.task-master.dev/capabilities/mcp # MCP Tools This document provides an overview of the MCP (Machine-to-Machine Communication Protocol) interface for the Task Master application. The MCP interface is defined in the `mcp-server/` directory and exposes the application's core functionalities as a set of tools that can be called remotely. ## Core Concepts The MCP interface is built on top of the `fastmcp` library and registers a set of tools that correspond to the core functionalities of the Task Master application. These tools are defined in the `mcp-server/src/tools/` directory and are registered with the MCP server in `mcp-server/src/tools/index.js`. Each tool is defined with a name, a description, and a set of parameters that are validated using the `zod` library. The `execute` function of each tool calls the corresponding core logic function from `scripts/modules/task-manager.js`. ## Configurable Tool Loading To optimize LLM context usage, you can control which Task Master MCP tools are loaded using the `TASK_MASTER_TOOLS` environment variable. This is particularly useful when working with LLMs that have context limits or when you only need a subset of tools. ### Configuration Modes #### Core Tools (Default, Lean Mode) Loads only 7 essential tools for daily development. Ideal for minimal context usage. **Core tools included:** * `get_tasks` - List all tasks * `next_task` - Find the next task to work on * `get_task` - Get detailed task information * `set_task_status` - Update task status * `update_subtask` - Add implementation notes * `parse_prd` - Generate tasks from PRD * `expand_task` - Break down tasks into subtasks ```json theme={null} { "mcpServers": { "task-master-ai": { "command": "npx", "args": ["-y", "task-master-ai"], "env": { "TASK_MASTER_TOOLS": "core", "ANTHROPIC_API_KEY": "your_key_here" } } } } ``` You can also use `"lean"` as an alias for `"core"`. If `TASK_MASTER_TOOLS` is not set, core tools are loaded by default. #### Standard Tools Loads 15 commonly used tools. Balances functionality with context efficiency. **Standard tools include all core tools plus:** * `initialize_project` - Set up new projects * `analyze_project_complexity` - Analyze task complexity * `expand_all` - Expand all eligible tasks * `add_subtask` - Add subtasks manually * `remove_task` - Remove tasks * `generate` - Generate task markdown files * `add_task` - Create new tasks * `complexity_report` - View complexity analysis ```json theme={null} { "mcpServers": { "task-master-ai": { "command": "npx", "args": ["-y", "task-master-ai"], "env": { "TASK_MASTER_TOOLS": "standard", "ANTHROPIC_API_KEY": "your_key_here" } } } } ``` #### Custom Tool Selection Specify exactly which tools to load using a comma-separated list. Tool names are case-insensitive and support both underscores and hyphens. ```json theme={null} { "mcpServers": { "task-master-ai": { "command": "npx", "args": ["-y", "task-master-ai"], "env": { "TASK_MASTER_TOOLS": "get_tasks,next_task,set_task_status,update_subtask", "ANTHROPIC_API_KEY": "your_key_here" } } } } ``` #### All Tools Loads all 36 available tools. Use when you need full Task Master functionality. ```json theme={null} { "mcpServers": { "task-master-ai": { "command": "npx", "args": ["-y", "task-master-ai"], "env": { "TASK_MASTER_TOOLS": "all", "ANTHROPIC_API_KEY": "your_key_here" } } } } ``` ### Choosing the Right Configuration * **Use `core`/`lean`**: Default setting, ideal for basic task management workflows or when context limits are strict * **Use `standard`**: For most development workflows that include task creation and analysis * **Use `all`**: When you need full functionality including tag management, dependencies, and advanced features * **Use custom list**: When you have specific tool requirements or want to experiment with minimal sets ### Verification When the MCP server starts, it logs which tools were loaded: ``` Task Master MCP Server starting... Tool mode configuration: standard Loading standard tools Registering 15 MCP tools (mode: standard) Successfully registered 15/15 tools ``` ## Tool Categories The MCP tools can be categorized in the same way as the core functionalities: ### 1. Task and Subtask Management * **`add_task`**: Creates a new task. * **`add_subtask`**: Adds a subtask to a parent task. * **`remove_task`**: Removes one or more tasks or subtasks. * **`remove_subtask`**: Removes a subtask from its parent. * **`update_task`**: Updates a single task. * **`update_subtask`**: Appends information to a subtask. * **`update`**: Updates multiple tasks. * **`move_task`**: Moves a task or subtask. * **`clear_subtasks`**: Clears all subtasks from one or more tasks. ### 2. Task Information and Status * **`get_tasks`**: Lists all tasks. * **`get_task`**: Shows the details of a specific task. * **`next_task`**: Shows the next task to work on. * **`set_task_status`**: Sets the status of a task or subtask. ### 3. Task Analysis and Expansion * **`parse_prd`**: Parses a PRD to generate tasks. * **`expand_task`**: Expands a task into subtasks. * **`expand_all`**: Expands all eligible tasks. * **`analyze_project_complexity`**: Analyzes task complexity. * **`complexity_report`**: Displays the complexity analysis report. ### 4. Dependency Management * **`add_dependency`**: Adds a dependency to a task. * **`remove_dependency`**: Removes a dependency from a task. * **`validate_dependencies`**: Validates the dependencies of all tasks. * **`fix_dependencies`**: Fixes any invalid dependencies. ### 5. Project and Configuration * **`initialize_project`**: Initializes a new project. * **`generate`**: Generates individual task files. * **`models`**: Manages AI model configurations. * **`research`**: Performs AI-powered research. ### 6. Tag Management * **`add_tag`**: Creates a new tag. * **`delete_tag`**: Deletes a tag. * **`list_tags`**: Lists all tags. * **`use_tag`**: Switches to a different tag. * **`rename_tag`**: Renames a tag. * **`copy_tag`**: Copies a tag. # Task Structure Source: https://docs.task-master.dev/capabilities/task-structure Tasks in Task Master follow a specific format designed to provide comprehensive information for both humans and AI assistants. ## Task Fields in tasks.json Tasks in tasks.json have the following structure: | Field | Description | Example | | -------------- | ---------------------------------------------- | ------------------------------------------------------ | | `id` | Unique identifier for the task. | `1` | | `title` | Brief, descriptive title. | `"Initialize Repo"` | | `description` | What the task involves. | `"Create a new repository, set up initial structure."` | | `status` | Current state. | `"pending"`, `"done"`, `"deferred"` | | `dependencies` | Prerequisite task IDs. ✅ Completed, ⏱️ Pending | `[1, 2]` | | `priority` | Task importance. | `"high"`, `"medium"`, `"low"` | | `details` | Implementation instructions. | `"Use GitHub client ID/secret, handle callback..."` | | `testStrategy` | How to verify success. | `"Deploy and confirm 'Hello World' response."` | | `subtasks` | Nested subtasks related to the main task. | `[{"id": 1, "title": "Configure OAuth", ...}]` | | `metadata` | Optional user-defined data (see below). | `{"githubIssue": 42, "sprint": "Q1-S3"}` | ## Task File Format Individual task files follow this format: ``` # Task ID: # Title: # Status: <status> # Dependencies: <comma-separated list of dependency IDs> # Priority: <priority> # Description: <brief description> # Details: <detailed implementation notes> # Test Strategy: <verification approach> ``` ## User-Defined Metadata Field The `metadata` field allows you to store arbitrary custom data on tasks without requiring schema changes. This is useful for: * **External IDs**: Link tasks to GitHub issues, Jira tickets, Linear issues, etc. * **Workflow data**: Track sprints, story points, custom statuses * **Integration data**: Store sync timestamps, external system references * **Custom tracking**: UUIDs, version numbers, audit information ### Key Characteristics <CardGroup> <Card title="Fully Optional" icon="toggle-off"> The field is optional. Existing tasks work without it. </Card> <Card title="AI-Safe" icon="shield"> AI operations preserve your metadata - it's never overwritten by AI. </Card> <Card title="Flexible Schema" icon="shapes"> Store any JSON-serializable data: strings, numbers, objects, arrays. </Card> <Card title="Subtask Support" icon="list-tree"> Both tasks and subtasks can have their own metadata. </Card> </CardGroup> ### Usage Examples **GitHub Issue Linking** ```json theme={null} { "id": 1, "title": "Implement authentication", "metadata": { "githubIssue": 42, "githubIssueUrl": "https://github.com/org/repo/issues/42" } } ``` **Sprint & Project Management** ```json theme={null} { "id": 2, "title": "Refactor API endpoints", "metadata": { "sprint": "Q1-S3", "storyPoints": 5, "epic": "API Modernization" } } ``` **External System Integration** ```json theme={null} { "id": 3, "title": "Fix login bug", "metadata": { "jira": { "key": "PROJ-123", "type": "bug", "priority": "P1" }, "importedAt": "2024-01-15T10:30:00Z", "lastSyncedAt": "2024-01-20T14:00:00Z" } } ``` **Stable UUID Tracking** ```json theme={null} { "id": 4, "title": "Add user preferences", "metadata": { "uuid": "550e8400-e29b-41d4-a716-446655440000", "version": 2, "createdBy": "import-script" } } ``` <Warning> **Security Note**: Do not store secrets, API keys, or sensitive credentials in the metadata field. Task data may be visible in logs, exports, or shared with AI providers. </Warning> ### Metadata Behavior | Operation | Metadata Behavior | | ---------------- | ------------------------------------------------------------ | | `parse-prd` | New tasks are created without metadata | | `update-task` | Existing metadata is preserved unless explicitly changed | | `expand` | Parent task metadata is preserved; subtasks don't inherit it | | `update-subtask` | Subtask metadata is preserved | | Manual edit | You can add/modify metadata directly in tasks.json | | MCP (with flag) | Use the `metadata` parameter to explicitly update metadata | ### Updating Metadata via MCP The `update_task` and `update_subtask` MCP tools support a `metadata` parameter for updating task metadata. This feature is disabled by default for safety. **To enable MCP metadata updates:** Add `TASK_MASTER_ALLOW_METADATA_UPDATES=true` to your MCP server environment configuration in `.mcp.json`: ```json theme={null} { "mcpServers": { "task-master-ai": { "command": "npx", "args": ["-y", "task-master-ai"], "env": { "TASK_MASTER_ALLOW_METADATA_UPDATES": "true", "ANTHROPIC_API_KEY": "your_key_here" } } } } ``` **Usage example:** ```javascript theme={null} // Update task metadata (merges with existing) update_task({ id: "1", projectRoot: "/path/to/project", metadata: '{"githubIssue": 42, "sprint": "Q1-S3"}' }) // Update only metadata (no prompt required) update_task({ id: "1", projectRoot: "/path/to/project", metadata: '{"status": "reviewed"}' }) ``` <Note> The `metadata` parameter accepts a JSON string. The new metadata is merged with existing metadata, allowing you to update specific fields without losing others. </Note> ## Features in Detail <AccordionGroup> <Accordion title="Analyzing Task Complexity"> The `analyze-complexity` command: * Analyzes each task using AI to assess its complexity on a scale of 1-10 * Recommends optimal number of subtasks based on configured DEFAULT\_SUBTASKS * Generates tailored prompts for expanding each task * Creates a comprehensive JSON report with ready-to-use commands * Saves the report to scripts/task-complexity-report.json by default The generated report contains: * Complexity analysis for each task (scored 1-10) * Recommended number of subtasks based on complexity * AI-generated expansion prompts customized for each task * Ready-to-run expansion commands directly within each task analysis </Accordion> <Accordion title="Viewing Complexity Report"> The `complexity-report` command: * Displays a formatted, easy-to-read version of the complexity analysis report * Shows tasks organized by complexity score (highest to lowest) * Provides complexity distribution statistics (low, medium, high) * Highlights tasks recommended for expansion based on threshold score * Includes ready-to-use expansion commands for each complex task * If no report exists, offers to generate one on the spot </Accordion> <Accordion title="Smart Task Expansion"> The `expand` command automatically checks for and uses the complexity report: When a complexity report exists: * Tasks are automatically expanded using the recommended subtask count and prompts * When expanding all tasks, they're processed in order of complexity (highest first) * Research-backed generation is preserved from the complexity analysis * You can still override recommendations with explicit command-line options Example workflow: ```bash theme={null} # Generate the complexity analysis report with research capabilities task-master analyze-complexity --research # Review the report in a readable format task-master complexity-report # Expand tasks using the optimized recommendations task-master expand --id=8 # or expand all tasks task-master expand --all ``` </Accordion> <Accordion title="Finding the Next Task"> The `next` command: * Identifies tasks that are pending/in-progress and have all dependencies satisfied * Prioritizes tasks by priority level, dependency count, and task ID * Displays comprehensive information about the selected task: * Basic task details (ID, title, priority, dependencies) * Implementation details * Subtasks (if they exist) * Provides contextual suggested actions: * Command to mark the task as in-progress * Command to mark the task as done * Commands for working with subtasks </Accordion> <Accordion title="Viewing Specific Task Details"> The `show` command: * Displays comprehensive details about a specific task or subtask * Shows task status, priority, dependencies, and detailed implementation notes * For parent tasks, displays all subtasks and their status * For subtasks, shows parent task relationship * Provides contextual action suggestions based on the task's state * Works with both regular tasks and subtasks (using the format taskId.subtaskId) </Accordion> </AccordionGroup> ## Best Practices for AI-Driven Development <CardGroup> <Card title="📝 Detailed PRD" icon="lightbulb"> The more detailed your PRD, the better the generated tasks will be. </Card> <Card title="👀 Review Tasks" icon="magnifying-glass"> After parsing the PRD, review the tasks to ensure they make sense and have appropriate dependencies. </Card> <Card title="📊 Analyze Complexity" icon="chart-line"> Use the complexity analysis feature to identify which tasks should be broken down further. </Card> <Card title="⛓️ Follow Dependencies" icon="link"> Always respect task dependencies - the Cursor agent will help with this. </Card> <Card title="🔄 Update As You Go" icon="arrows-rotate"> If your implementation diverges from the plan, use the update command to keep future tasks aligned. </Card> <Card title="📦 Break Down Tasks" icon="boxes-stacked"> Use the expand command to break down complex tasks into manageable subtasks. </Card> <Card title="🔄 Regenerate Files" icon="file-arrow-up"> After any updates to tasks.json, regenerate the task files to keep them in sync. </Card> <Card title="💬 Provide Context" icon="comment"> When asking the Cursor agent to help with a task, provide context about what you're trying to achieve. </Card> <Card title="✅ Validate Dependencies" icon="circle-check"> Periodically run the validate-dependencies command to check for invalid or circular dependencies. </Card> </CardGroup> # null Source: https://docs.task-master.dev/getting-started/api-keys # API Keys Configuration Task Master supports multiple AI providers through environment variables. This page lists all available API keys and their configuration requirements. ## Required API Keys > **Note**: At least one required API key must be configured for Task Master to function. > > "Required: Yes" below means "required to use that specific provider," not "required globally." You only need at least one provider configured. ### ANTHROPIC\_API\_KEY (Recommended) * **Provider**: Anthropic Claude models * **Format**: `sk-ant-api03-...` * **Required**: ✅ **Yes** * **Models**: Claude 3.5 Sonnet, Claude 3 Haiku, Claude 3 Opus * **Get Key**: [Anthropic Console](https://console.anthropic.com/) ```bash theme={null} ANTHROPIC_API_KEY="sk-ant-api03-your-key-here" ``` ### PERPLEXITY\_API\_KEY (Highly Recommended for Research) * **Provider**: Perplexity AI (Research features) * **Format**: `pplx-...` * **Required**: ✅ **Yes** * **Purpose**: Enables research-backed task expansions and updates * **Models**: Perplexity Sonar models * **Get Key**: [Perplexity API](https://www.perplexity.ai/settings/api) ```bash theme={null} PERPLEXITY_API_KEY="pplx-your-key-here" ``` ### OPENAI\_API\_KEY * **Provider**: OpenAI GPT models * **Format**: `sk-proj-...` or `sk-...` * **Required**: ✅ **Yes** * **Models**: GPT-4, GPT-4 Turbo, GPT-3.5 Turbo, O1 models * **Get Key**: [OpenAI Platform](https://platform.openai.com/api-keys) ```bash theme={null} OPENAI_API_KEY="sk-proj-your-key-here" ``` ### GOOGLE\_API\_KEY * **Provider**: Google Gemini models * **Format**: Various formats * **Required**: ✅ **Yes** * **Models**: Gemini Pro, Gemini Flash, Gemini Ultra * **Get Key**: [Google AI Studio](https://aistudio.google.com/app/apikey) * **Alternative**: Use `GOOGLE_APPLICATION_CREDENTIALS` for service account (Google Vertex) ```bash theme={null} GOOGLE_API_KEY="your-google-api-key-here" ``` ### GROQ\_API\_KEY * **Provider**: Groq (High-performance inference) * **Required**: ✅ **Yes** * **Models**: Llama models, Mixtral models (via Groq) * **Get Key**: [Groq Console](https://console.groq.com/keys) ```bash theme={null} GROQ_API_KEY="your-groq-key-here" ``` ### OPENROUTER\_API\_KEY * **Provider**: OpenRouter (Multiple model access) * **Required**: ✅ **Yes** * **Models**: Access to various models through single API * **Get Key**: [OpenRouter](https://openrouter.ai/keys) ```bash theme={null} OPENROUTER_API_KEY="your-openrouter-key-here" ``` ### AZURE\_OPENAI\_API\_KEY * **Provider**: Azure OpenAI Service * **Required**: ✅ **Yes** * **Requirements**: Also requires `AZURE_OPENAI_ENDPOINT` configuration * **Models**: GPT models via Azure * **Get Key**: [Azure Portal](https://portal.azure.com/) ```bash theme={null} AZURE_OPENAI_API_KEY="your-azure-key-here" ``` ### XAI\_API\_KEY * **Provider**: xAI (Grok) models * **Required**: ✅ **Yes** * **Models**: Grok models * **Get Key**: [xAI Console](https://console.x.ai/) ```bash theme={null} XAI_API_KEY="your-xai-key-here" ``` ## Optional API Keys > **Note**: These API keys are optional - providers will work without them or use alternative authentication methods. ### AWS\_ACCESS\_KEY\_ID (Bedrock) * **Provider**: AWS Bedrock * **Required**: ❌ **No** (uses AWS credential chain) * **Models**: Claude models via AWS Bedrock * **Authentication**: Uses AWS credential chain (profiles, IAM roles, etc.) * **Get Key**: [AWS Console](https://console.aws.amazon.com/iam/) ```bash theme={null} # Optional - AWS credential chain is preferred AWS_ACCESS_KEY_ID="your-aws-access-key" AWS_SECRET_ACCESS_KEY="your-aws-secret-key" ``` ### CLAUDE\_CODE\_API\_KEY * **Provider**: Claude Code CLI * **Required**: ❌ **No** (uses OAuth tokens) * **Purpose**: Integration with local Claude Code CLI * **Authentication**: Uses OAuth tokens, no API key needed ```bash theme={null} # Not typically needed CLAUDE_CODE_API_KEY="not-usually-required" ``` ### GEMINI\_API\_KEY * **Provider**: Gemini CLI * **Required**: ❌ **No** (uses OAuth authentication) * **Purpose**: Integration with Gemini CLI * **Authentication**: Primarily uses OAuth via CLI, API key is optional ```bash theme={null} # Optional - OAuth via CLI is preferred GEMINI_API_KEY="your-gemini-key-here" ``` ### GROK\_CLI\_API\_KEY * **Provider**: Grok CLI * **Required**: ❌ **No** (can use CLI config) * **Purpose**: Integration with Grok CLI * **Authentication**: Can use Grok CLI's own config file ```bash theme={null} # Optional - CLI config is preferred GROK_CLI_API_KEY="your-grok-cli-key" ``` ### OLLAMA\_API\_KEY * **Provider**: Ollama (Local/Remote) * **Required**: ❌ **No** (local installation doesn't need key) * **Purpose**: For remote Ollama servers that require authentication * **Requirements**: Only needed for remote servers with authentication * **Note**: Not needed for local Ollama installations ```bash theme={null} # Only needed for remote Ollama servers OLLAMA_API_KEY="your-ollama-api-key-here" ``` ### GITHUB\_API\_KEY * **Provider**: GitHub (Import/Export features) * **Format**: `ghp_...` or `github_pat_...` * **Required**: ❌ **No** (for GitHub features only) * **Purpose**: GitHub import/export features * **Get Key**: [GitHub Settings](https://github.com/settings/tokens) ```bash theme={null} GITHUB_API_KEY="ghp-your-github-key-here" ``` ## Configuration Methods ### Method 1: Environment File (.env) Create a `.env` file in your project root: ```bash theme={null} # Copy from .env.example cp .env.example .env # Edit with your keys vim .env ``` ### Method 2: System Environment Variables ```bash theme={null} export ANTHROPIC_API_KEY="your-key-here" export PERPLEXITY_API_KEY="your-key-here" # ... other keys ``` ### Method 3: MCP Server Configuration For Claude Code integration, configure keys in `.mcp.json`: ```json theme={null} { "mcpServers": { "task-master-ai": { "command": "npx", "args": ["-y", "task-master-ai"], "env": { "ANTHROPIC_API_KEY": "your-key-here", "PERPLEXITY_API_KEY": "your-key-here", "OPENAI_API_KEY": "your-key-here" } } } } ``` ## Key Requirements ### Minimum Requirements * **At least one** AI provider key is required * **ANTHROPIC\_API\_KEY** is recommended as the primary provider * **PERPLEXITY\_API\_KEY** is highly recommended for research features ### Provider-Specific Requirements * **Azure OpenAI**: Requires both `AZURE_OPENAI_API_KEY` and `AZURE_OPENAI_ENDPOINT` configuration * **Google Vertex**: Requires `VERTEX_PROJECT_ID` and `VERTEX_LOCATION` environment variables * **AWS Bedrock**: Uses AWS credential chain (profiles, IAM roles, etc.) instead of API keys * **Ollama**: Only needs API key for remote servers with authentication * **CLI Providers**: Gemini CLI, Grok CLI, and Claude Code use OAuth/CLI config instead of API keys ## Model Configuration After setting up API keys, configure which models to use: ```bash theme={null} # Interactive model setup task-master models --setup # Set specific models task-master models --set-main claude-3-5-sonnet-20241022 task-master models --set-research perplexity-llama-3.1-sonar-large-128k-online task-master models --set-fallback gpt-4o-mini ``` ## Security Best Practices 1. **Never commit API keys** to version control 2. **Use .env files** and add them to `.gitignore` 3. **Rotate keys regularly** especially if compromised 4. **Use minimal permissions** for service accounts 5. **Monitor usage** to detect unauthorized access ## Troubleshooting ### Key Validation ```bash theme={null} # Check if keys are properly configured task-master models # Test specific provider task-master add-task --prompt="test task" --model=claude-3-5-sonnet-20241022 ``` ### Common Issues * **Invalid key format**: Check the expected format for each provider * **Insufficient permissions**: Ensure keys have necessary API access * **Rate limits**: Some providers have usage limits * **Regional restrictions**: Some models may not be available in all regions ### Getting Help If you encounter issues with API key configuration: * Check the [FAQ](/getting-started/faq) for common solutions * Join our [Discord community](https://discord.gg/fWJkU7rf) for support * Report issues on [GitHub](https://github.com/eyaltoledano/claude-task-master/issues) # null Source: https://docs.task-master.dev/getting-started/contribute # Contributing to Task Master Thank you for your interest in contributing to Task Master! We're excited to work with you and appreciate your help in making this project better. 🚀 ## 🤝 Our Collaborative Approach We're a **PR-friendly team** that values collaboration: * ✅ **We review PRs quickly** - Usually within hours, not days * ✅ **We're super reactive** - Expect fast feedback and engagement * ✅ **We sometimes take over PRs** - If your contribution is valuable but needs cleanup, we might jump in to help finish it * ✅ **We're open to all contributions** - From bug fixes to major features **We don't mind AI-generated code**, but we do expect you to: * ✅ **Review and understand** what the AI generated * ✅ **Test the code thoroughly** before submitting * ✅ **Ensure it's well-written** and follows our patterns * ❌ **Don't submit "AI slop"** - untested, unreviewed AI output > **Why this matters**: We spend significant time reviewing PRs. Help us help you by submitting quality contributions that save everyone time! ## 🚀 Quick Start for Contributors ### 1. Fork and Clone ```bash theme={null} git clone https://github.com/YOUR_USERNAME/claude-task-master.git cd claude-task-master npm install ``` ### 2. Create a Feature Branch **Important**: Always target the `next` branch, not `main`: ```bash theme={null} git checkout next git pull origin next git checkout -b feature/your-feature-name ``` ### 3. Make Your Changes Follow our development guidelines below. ### 4. Test Everything Yourself **Before submitting your PR**, ensure: ```bash theme={null} # Run all tests npm test # Check formatting npm run format-check # Fix formatting if needed npm run format ``` ### 5. Create a Changeset **Required for most changes**: ```bash theme={null} npm run changeset ``` See the [Changeset Guidelines](#changeset-guidelines) below for details. ### 6. Submit Your PR * Target the `next` branch * Write a clear description * Reference any related issues ## 📋 Development Guidelines ### Branch Strategy * **`main`**: Production-ready code * **`next`**: Development branch - **target this for PRs** * **Feature branches**: `feature/description` or `fix/description` ### Code Quality Standards 1. **Write tests** for new functionality 2. **Follow existing patterns** in the codebase 3. **Add JSDoc comments** for functions 4. **Keep functions focused** and single-purpose ### Testing Requirements Your PR **must pass all CI checks**: * ✅ **Unit tests**: `npm test` * ✅ **Format check**: `npm run format-check` **Test your changes locally first** - this saves review time and shows you care about quality. ## 📦 Changeset Guidelines We use [Changesets](https://github.com/changesets/changesets) to manage versioning and generate changelogs. ### When to Create a Changeset **Always create a changeset for**: * ✅ New features * ✅ Bug fixes * ✅ Breaking changes * ✅ Performance improvements * ✅ User-facing documentation updates * ✅ Dependency updates that affect functionality **Skip changesets for**: * ❌ Internal documentation only * ❌ Test-only changes * ❌ Code formatting/linting * ❌ Development tooling that doesn't affect users ### How to Create a Changeset 1. **After making your changes**: ```bash theme={null} npm run changeset ``` 2. **Choose the bump type**: * **Major**: Breaking changes * **Minor**: New features * **Patch**: Bug fixes, docs, performance improvements 3. **Write a clear summary**: ``` Add support for custom AI models in MCP configuration ``` 4. **Commit the changeset file** with your changes: ```bash theme={null} git add .changeset/*.md git commit -m "feat: add custom AI model support" ``` ### Changeset vs Git Commit Messages * **Changeset summary**: User-facing, goes in CHANGELOG.md * **Git commit**: Developer-facing, explains the technical change Example: ```bash theme={null} # Changeset summary (user-facing) "Add support for custom Ollama models" # Git commit message (developer-facing) "feat(models): implement custom Ollama model validation - Add model validation for custom Ollama endpoints - Update configuration schema to support custom models - Add tests for new validation logic" ``` ## 🔧 Development Setup ### Prerequisites * Node.js 20+ * npm or yarn ### Environment Setup 1. **Copy environment template**: ```bash theme={null} cp .env.example .env ``` 2. **Add your API keys** (for testing AI features): ```bash theme={null} ANTHROPIC_API_KEY=your_key_here OPENAI_API_KEY=your_key_here # Add others as needed ``` ### Running Tests ```bash theme={null} # Run all tests npm test # Run tests in watch mode npm run test:watch # Run with coverage npm run test:coverage # Run E2E tests npm run test:e2e ``` ### Code Formatting We use Prettier for consistent formatting: ```bash theme={null} # Check formatting npm run format-check # Fix formatting npm run format ``` ## 📝 PR Guidelines ### Before Submitting * [ ] **Target the `next` branch** * [ ] **Test everything locally** * [ ] **Run the full test suite** * [ ] **Check code formatting** * [ ] **Create a changeset** (if needed) * [ ] **Re-read your changes** - ensure they're clean and well-thought-out ### PR Description Template ```markdown theme={null} ## Description Brief description of what this PR does. ## Type of Change - [ ] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation update ## Testing - [ ] I have tested this locally - [ ] All existing tests pass - [ ] I have added tests for new functionality ## Changeset - [ ] I have created a changeset (or this change doesn't need one) ## Additional Notes Any additional context or notes for reviewers. ``` ### What We Look For ✅ **Good PRs**: * Clear, focused changes * Comprehensive testing * Good commit messages * Proper changeset (when needed) * Self-reviewed code ❌ **Avoid**: * Massive PRs that change everything * Untested code * Formatting issues * Missing changesets for user-facing changes * AI-generated code that wasn't reviewed ## 🏗️ Project Structure ``` claude-task-master/ ├── bin/ # CLI executables ├── mcp-server/ # MCP server implementation ├── scripts/ # Core task management logic ├── src/ # Shared utilities and providers and well refactored code (we are slowly moving everything here) ├── tests/ # Test files ├── docs/ # Documentation └── .cursor/ # Cursor IDE rules and configuration └── assets/ # Assets like rules and configuration for all IDEs ``` ### Key Areas for Contribution * **CLI Commands**: `scripts/modules/commands.js` * **MCP Tools**: `mcp-server/src/tools/` * **Core Logic**: `scripts/modules/task-manager/` * **AI Providers**: `src/ai-providers/` * **Tests**: `tests/` ## 🐛 Reporting Issues ### Bug Reports Include: * Task Master version * Node.js version * Operating system * Steps to reproduce * Expected vs actual behavior * Error messages/logs ### Feature Requests Include: * Clear description of the feature * Use case/motivation * Proposed implementation (if you have ideas) * Willingness to contribute ## 💬 Getting Help * **Discord**: [Join our community](https://discord.gg/taskmasterai) * **Issues**: [GitHub Issues](https://github.com/eyaltoledano/claude-task-master/issues) * **Discussions**: [GitHub Discussions](https://github.com/eyaltoledano/claude-task-master/discussions) ## 📄 License By contributing, you agree that your contributions will be licensed under the same license as the project (MIT with Commons Clause). *** **Thank you for contributing to Task Master!** 🎉 Your contributions help make AI-driven development more accessible and efficient for everyone. # FAQ Source: https://docs.task-master.dev/getting-started/faq Coming soon. ## 💬 Getting Help * **Discord**: [Join our community](https://discord.gg/taskmasterai) * **Issues**: [GitHub Issues](https://github.com/eyaltoledano/claude-task-master/issues) * **Discussions**: [GitHub Discussions](https://github.com/eyaltoledano/claude-task-master/discussions) # Configuration Source: https://docs.task-master.dev/getting-started/quick-start/configuration-quick Before getting started with Task Master, you'll need to set up your API keys. There are a couple of ways to do this depending on whether you're using the CLI or working inside MCP. It's also a good time to start getting familiar with the other configuration options available — even if you don’t need to adjust them yet, knowing what’s possible will help down the line. ## API Key Setup Task Master uses environment variables to securely store provider API keys and optional endpoint URLs. ### MCP Usage: mcp.json file For MCP/Cursor usage: Configure keys in the env section of your .cursor/mcp.json file. ```java .env lines icon="java" theme={null} { "mcpServers": { "task-master-ai": { "command": "npx", "args": ["-y", "task-master-ai"], "env": { "ANTHROPIC_API_KEY": "ANTHROPIC_API_KEY_HERE", "PERPLEXITY_API_KEY": "PERPLEXITY_API_KEY_HERE", "OPENAI_API_KEY": "OPENAI_API_KEY_HERE", "GOOGLE_API_KEY": "GOOGLE_API_KEY_HERE", "XAI_API_KEY": "XAI_API_KEY_HERE", "OPENROUTER_API_KEY": "OPENROUTER_API_KEY_HERE", "MISTRAL_API_KEY": "MISTRAL_API_KEY_HERE", "AZURE_OPENAI_API_KEY": "AZURE_OPENAI_API_KEY_HERE", "OLLAMA_API_KEY": "OLLAMA_API_KEY_HERE", "GITHUB_API_KEY": "GITHUB_API_KEY_HERE" } } } } ``` <Tip> **Optimize Context Usage**: You can control which Task Master MCP tools are loaded using the `TASK_MASTER_TOOLS` environment variable. This helps reduce LLM context usage by only loading the tools you need. Options: * `core` or `lean` (default) - 7 essential tools * `standard` - 15 commonly used tools * `all` - All 36 tools Example: ```json theme={null} "env": { "TASK_MASTER_TOOLS": "standard", "ANTHROPIC_API_KEY": "your_key_here" } ``` See the [MCP Tools documentation](/capabilities/mcp#configurable-tool-loading) for details. </Tip> ### CLI Usage: `.env` File Create a `.env` file in your project root and include the keys for the providers you plan to use: ```java .env lines icon="java" theme={null} # Required API keys for providers configured in .taskmaster/config.json ANTHROPIC_API_KEY=sk-ant-api03-your-key-here PERPLEXITY_API_KEY=pplx-your-key-here # OPENAI_API_KEY=sk-your-key-here # GOOGLE_API_KEY=AIzaSy... # AZURE_OPENAI_API_KEY=your-azure-openai-api-key-here # etc. # Optional Endpoint Overrides # Use a specific provider's base URL, e.g., for an OpenAI-compatible API # OPENAI_BASE_URL=https://api.third-party.com/v1 # # Azure OpenAI Configuration # AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/ or https://your-endpoint-name.cognitiveservices.azure.com/openai/deployments # OLLAMA_BASE_URL=http://custom-ollama-host:11434/api # Google Vertex AI Configuration (Required if using 'vertex' provider) # VERTEX_PROJECT_ID=your-gcp-project-id ``` ## What Else Can Be Configured? The main configuration file (`.taskmaster/config.json`) allows you to control nearly every aspect of Task Master’s behavior. Here’s a high-level look at what you can customize: <Tip> You don’t need to configure everything up front. Most settings can be left as defaults or updated later as your workflow evolves. </Tip> <Accordion title="View Configuration Options"> ### Models and Providers * Role-based model setup: `main`, `research`, `fallback` * Provider selection (Anthropic, OpenAI, Perplexity, etc.) * Model IDs per role * Temperature, max tokens, and other generation settings * Custom base URLs for OpenAI-compatible APIs ### Global Settings * `logLevel`: Logging verbosity * `debug`: Enable/disable debug mode * `projectName`: Optional name for your project * `defaultTag`: Default tag for task grouping * `defaultSubtasks`: Number of subtasks to auto-generate * `defaultPriority`: Priority level for new tasks ### API Endpoint Overrides * `ollamaBaseURL`: Custom Ollama server URL * `azureBaseURL`: Global Azure endpoint * `vertexProjectId`: Google Vertex AI project ID * `vertexLocation`: Region for Vertex AI models ### Tag and Git Integration * Default tag context per project * Support for task isolation by tag * Manual tag creation from Git branches ### State Management * Active tag tracking * Migration state * Last tag switch timestamp </Accordion> <Note> For advanced configuration options and detailed customization, see our [Advanced Configuration Guide](/best-practices/configuration-advanced) page. </Note> # Executing Tasks Source: https://docs.task-master.dev/getting-started/quick-start/execute-quick Now that your tasks are generated and reviewed you are ready to begin executing. ## Select the Task to Work on: Next Task Task Master has the "next" command to find the next task to work on. You can access it with the following request: ``` What's the next task I should work on? Please consider dependencies and priorities. ``` Alternatively you can use the CLI to show the next task ```bash theme={null} task-master next ``` ## Discuss Task When you know what task to work on next you can then start chatting with the agent to make sure it understands the plan of action. You can tag relevant files and folders so it knows what context to pull up as it generates its plan. For example: ``` Please review Task 5 and confirm you understand how to execute before beginning. Refer to @models @api and @schema ``` The agent will begin analyzing the task and files and respond with the steps to complete the task. ## Agent Task execution If you agree with the plan of action, tell the agent to get started. ``` You may begin. I believe in you. ``` ## Review and Test Once the agent is finished with the task you can refer to the task testing strategy to make sure it was completed correctly. ## Update Task Status If the task was completed correctly you can update the status to done ``` Please mark Task 5 as done ``` The agent will execute ```bash theme={null} task-master set-status --id=5 --status=done ``` ## Rules and Context If you ran into problems and had to debug errors you can create new rules as you go. This helps build context on your codebase that helps the creation and execution of future tasks. ## On to the Next Task! By now you have all you need to get started executing code faster and smarter with Task Master. If you have any questions please check out [Frequently Asked Questions](/getting-started/faq) # Installation Source: https://docs.task-master.dev/getting-started/quick-start/installation Now that you have Node.js and your first API Key, you are ready to begin installing Task Master in one of three ways. <Note>Cursor Users Can Use the One Click Install Below</Note> <Accordion title="Quick Install for Cursor 1.0+ (One-Click)"> <a href="cursor://anysphere.cursor-deeplink/mcp/install?name=task-master-ai&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIi0tcGFja2FnZT10YXNrLW1hc3Rlci1haSIsInRhc2stbWFzdGVyLWFpIl0sImVudiI6eyJBTlRIUk9QSUNfQVBJX0tFWSI6IllPVVJfQU5USFJPUElDX0FQSV9LRVlfSEVSRSIsIlBFUlBMRVhJVFlfQVBJX0tFWSI6IllPVVJfUEVSUExFWElUWV9BUElfS0VZX0hFUkUiLCJPUEVOQUlfQVBJX0tFWSI6IllPVVJfT1BFTkFJX0tFWV9IRVJFIiwiR09PR0xFX0FQSV9LRVkiOiJZT1VSX0dPT0dMRV9LRVlfSEVSRSIsIk1JU1RSQUxfQVBJX0tFWSI6IllPVVJfTUlTVFJBTF9LRVlfSEVSRSIsIk9QRU5ST1VURVJfQVBJX0tFWSI6IllPVVJfT1BFTlJPVVRFUl9LRVlfSEVSRSIsIlhBSV9BUElfS0VZIjoiWU9VUl9YQUlfS0VZX0hFUkUiLCJBWlVSRV9PUEVOQUJFX0FQSV9LRVkiOiJZT1VSX0FaVVJFX0tFWV9IRVJFIiwiT0xMQU1BX0FQSV9LRVkiOiJZT1VSX09MTEFNQV9BUElfS0VZX0hFUkUifX0%3D"> <img alt="Add Task Master MCP server to Cursor" /> <img alt="Add Task Master MCP server to Cursor" /> </a> Or click the copy button (top-right of code block) then paste into your browser: ```text theme={null} cursor://anysphere.cursor-deeplink/mcp/install?name=taskmaster-ai&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIi0tcGFja2FnZT10YXNrLW1hc3Rlci1haSIsInRhc2stbWFzdGVyLWFpIl0sImVudiI6eyJBTlRIUk9QSUNfQVBJX0tFWSI6IllPVVJfQU5USFJPUElDX0FQSV9LRVlfSEVSRSIsIlBFUlBMRVhJVFlfQVBJX0tFWSI6IllPVVJfUEVSUExFWElUWV9BUElfS0VZX0hFUkUiLCJPUEVOQUlfQVBJX0tFWSI6IllPVVJfT1BFTkFJX0tFWV9IRVJFIiwiR09PR0xFX0FQSV9LRVkiOiJZT1VSX0dPT0dMRV9LRVlfSEVSRSIsIk1JU1RSQUxfQVBJX0tFWSI6IllPVVJfTUlTVFJBTF9LRVlfSEVSRSIsIk9QRU5ST1VURVJfQVBJX0tFWSI6IllPVVJfT1BFTlJPVVRFUl9LRVlfSEVSRSIsIlhBSV9BUElfS0VZIjoiWU9VUl9YQUlfS0VZX0hFUkUiLCJBWlVSRV9PUEVOQUlfQVBJX0tFWSI6IllPVVJfQVpVUkVfS0VZX0hFUkUiLCJPTExBTUFfQVBJX0tFWSI6IllPVVJfT0xMQU1BX0FQSV9LRVlfSEVSRSJ9fQo= ``` > **Note:** After clicking the link, you'll still need to add your API keys to the configuration. The link installs the MCP server with placeholder keys that you'll need to replace with your actual API keys. ### Claude Code Quick Install For Claude Code users: ```bash theme={null} claude mcp add taskmaster-ai -- npx -y task-master-ai ``` Don't forget to add your API keys to the configuration: * in the root .env of your Project * in the "env" section of your mcp config for taskmaster-ai </Accordion> ## Installation Options <Accordion title="Option 1: MCP (Recommended)"> MCP (Model Control Protocol) lets you run Task Master directly from your editor. ## 1. Add your MCP config at the following path depending on your editor | Editor | Scope | Linux/macOS Path | Windows Path | Key | | ------------ | ------- | ------------------------------------- | ------------------------------------------------- | ------------ | | **Cursor** | Global | `~/.cursor/mcp.json` | `%USERPROFILE%\.cursor\mcp.json` | `mcpServers` | | | Project | `<project_folder>/.cursor/mcp.json` | `<project_folder>\.cursor\mcp.json` | `mcpServers` | | **Windsurf** | Global | `~/.codeium/windsurf/mcp_config.json` | `%USERPROFILE%\.codeium\windsurf\mcp_config.json` | `mcpServers` | | **VS Code** | Project | `<project_folder>/.vscode/mcp.json` | `<project_folder>\.vscode\mcp.json` | `servers` | ## Manual Configuration ### Cursor & Windsurf (`mcpServers`) ```json theme={null} { "mcpServers": { "taskmaster-ai": { "command": "npx", "args": ["-y", "task-master-ai"], "env": { "ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE", "PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE", "OPENAI_API_KEY": "YOUR_OPENAI_KEY_HERE", "GOOGLE_API_KEY": "YOUR_GOOGLE_KEY_HERE", "MISTRAL_API_KEY": "YOUR_MISTRAL_KEY_HERE", "OPENROUTER_API_KEY": "YOUR_OPENROUTER_KEY_HERE", "XAI_API_KEY": "YOUR_XAI_KEY_HERE", "AZURE_OPENAI_API_KEY": "YOUR_AZURE_KEY_HERE", "OLLAMA_API_KEY": "YOUR_OLLAMA_API_KEY_HERE" } } } } ``` > 🔑 Replace `YOUR_…_KEY_HERE` with your real API keys. You can remove keys you don't use. > **Note**: If you see `0 tools enabled` in the MCP settings, restart your editor and check that your API keys are correctly configured. ### VS Code (`servers` + `type`) ```json theme={null} { "servers": { "taskmaster-ai": { "command": "npx", "args": ["-y", "task-master-ai"], "env": { "ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE", "PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE", "OPENAI_API_KEY": "YOUR_OPENAI_KEY_HERE", "GOOGLE_API_KEY": "YOUR_GOOGLE_KEY_HERE", "MISTRAL_API_KEY": "YOUR_MISTRAL_KEY_HERE", "OPENROUTER_API_KEY": "YOUR_OPENROUTER_KEY_HERE", "XAI_API_KEY": "YOUR_XAI_KEY_HERE", "AZURE_OPENAI_API_KEY": "YOUR_AZURE_KEY_HERE" }, "type": "stdio" } } } ``` > 🔑 Replace `YOUR_…_KEY_HERE` with your real API keys. You can remove keys you don't use. #### 2. (Cursor-only) Enable Taskmaster MCP Open Cursor Settings (Ctrl+Shift+J) ➡ Click on MCP tab on the left ➡ Enable task-master-ai with the toggle #### 3. (Optional) Configure the models you want to use In your editor's AI chat pane, say: ```txt theme={null} Change the main, research and fallback models to <model_name>, <model_name> and <model_name> respectively. ``` For example, to use Claude Code (no API key required): ```txt theme={null} Change the main model to claude-code/sonnet ``` #### 4. Initialize Task Master In your editor's AI chat pane, say: ```txt theme={null} Initialize taskmaster-ai in my project ``` </Accordion> <Accordion title="Option 2: Using Command Line"> ## CLI Installation ```bash theme={null} # Install globally npm install -g task-master-ai # OR install locally within your project npm install task-master-ai ``` ## Initialize a new project ```bash theme={null} # If installed globally task-master init # If installed locally npx task-master init # Initialize project with specific rules task-master init --rules cursor,windsurf,vscode ``` This will prompt you for project details and set up a new project with the necessary files and structure. </Accordion> # PRD Creation and Parsing Source: https://docs.task-master.dev/getting-started/quick-start/prd-quick # Writing a PRD A PRD (Product Requirements Document) is the starting point of every task flow in Task Master. It defines what you're building and why. A clear PRD dramatically improves the quality of your tasks, your model outputs, and your final product — so it’s worth taking the time to get it right. <Tip> You don’t need to define your whole app up front. You can write a focused PRD just for the next feature or module you’re working on. </Tip> <Tip> You can start with an empty project or you can start with a feature PRD on an existing project. </Tip> <Tip> You can add and parse multiple PRDs per project using the --append flag </Tip> ## What Makes a Good PRD? * Clear objective — what’s the outcome or feature? * Context — what’s already in place or assumed? * Constraints — what limits or requirements need to be respected? * Reasoning — why are you building it this way? The more context you give the model, the better the breakdown and results. *** ## Writing a PRD for Task Master <Note> Two example PRD templates are available in `.taskmaster/templates/`: * `example_prd.md` - Simple template for straightforward projects (`.md` recommended for better editor support) * `example_prd_rpg.md` - Advanced RPG (Repository Planning Graph) template for complex projects with dependencies **Why `.md`?** While both `.txt` and `.md` work, Markdown files provide syntax highlighting, proper rendering in VS Code/GitHub, and better collaboration through formatted documentation. </Note> You can co-write your PRD with an LLM model using the following workflow: 1. **Chat about requirements** — explain what you want to build. 2. **Show an example PRD** — share the example PRD so the model understands the expected format. The example uses formatting that work well with Task Master's code. Following the example will yield better results. 3. **Iterate and refine** — work with the model to shape the draft into a clear and well-structured PRD. This approach works great in Cursor, or anywhere you use a chat-based LLM. ### Choosing Between Templates **Use `example_prd.md` when:** * Building straightforward features * Working on smaller projects * Dependencies are simple and obvious **Use `example_prd_rpg.md` when:** * Building complex systems with multiple modules * Need explicit dependency management * Want structured guidance on architecture decisions * Planning a large codebase from scratch The RPG template teaches you to think about: 1. **Functional decomposition** (WHAT the system does) 2. **Structural decomposition** (HOW it's organized in code) 3. **Explicit dependencies** (WHAT depends on WHAT) 4. **Topological ordering** (build foundation first, then layers) <Tip> For complex projects, using the RPG template with a code-context-aware ai agent produces the best results because the AI can understand your existing codebase structure. [Learn more about the RPG method →](/capabilities/rpg-method) </Tip> *** ## Where to Save Your PRD Place your PRD file in the `.taskmaster/docs` folder in your project. * You can have **multiple PRDs** per project. * Name your PRDs clearly so they're easy to reference later. * Examples: `dashboard_redesign.md`, `user_onboarding.md` * Tip: Use `.md` extension for better editor support and syntax highlighting *** # Parse your PRD into Tasks This is where the Task Master magic begins. In Cursor's AI chat, instruct the agent to generate tasks from your PRD: ``` Please use the task-master parse-prd command to generate tasks from my PRD. The PRD is located at .taskmaster/docs/<prd-name>.md. ``` The agent will execute the following command which you can alternatively paste into the CLI: ```bash theme={null} task-master parse-prd .taskmaster/docs/<prd-name>.md ``` This will: * Parse your PRD document * Generate a structured `tasks.json` file with tasks, dependencies, priorities, and test strategies Now that you have written and parsed a PRD, you are ready to start setting up your tasks. # Quick Start Source: https://docs.task-master.dev/getting-started/quick-start/quick-start This guide is for new users who want to start using Task Master with minimal setup time. It covers: * [Requirements](/getting-started/quick-start/requirements): You will need Node.js and an AI model API Key. * [Installation](/getting-started/quick-start/installation): How to Install Task Master. * [Configuration](/getting-started/quick-start/configuration-quick): Setting up your API Key, MCP, and more. * [PRD](/getting-started/quick-start/prd-quick): Writing and parsing your first PRD. * [Task Setup](/getting-started/quick-start/tasks-quick): Preparing your tasks for execution. * [Executing Tasks](/getting-started/quick-start/execute-quick): Using Task Master to execute tasks. * [Rules & Context](/getting-started/quick-start/rules-quick): Learn how and why to build context in your project over time. <Tip> By the end of this guide, you'll have everything you need to begin working productively with Task Master. </Tip> # Requirements Source: https://docs.task-master.dev/getting-started/quick-start/requirements Before you can start using TaskMaster AI, you'll need to install Node.js and set up at least one model API Key. ## 1. Node.js TaskMaster AI is built with Node.js and requires it to run. npm (Node Package Manager) comes bundled with Node.js. <Accordion title="Install Node.js"> ### Installation **Option 1: Download from official website** 1. Visit [nodejs.org](https://nodejs.org) 2. Download the **LTS (Long Term Support)** version for your operating system 3. Run the installer and follow the setup wizard **Option 2: Use a package manager** <CodeGroup> ```bash Windows (Chocolatey) theme={null} choco install nodejs ``` ```bash Windows (winget) theme={null} winget install OpenJS.NodeJS ``` </CodeGroup> </Accordion> ## 2. Model API Key Taskmaster utilizes AI across several commands, and those require a separate API key. For the purpose of a Quick Start we recommend setting up an API Key with Anthropic for your main model and Perplexity for your research model (optional but recommended). <Tip>Task Master shows API costs per command used. Most users load \$5-10 on their keys and don't have to top it off for a few months.</Tip> At least one (1) of the following is required: 1. Anthropic API key (Claude API) - **recommended for Quick Start** 2. OpenAI API key 3. Google Gemini API key 4. Perplexity API key (for research model) 5. xAI API Key (for research or main model) 6. OpenRouter API Key (for research or main model) 7. Claude Code (no API key required - requires Claude Code CLI) # Tasks Setup Source: https://docs.task-master.dev/getting-started/quick-start/tasks-quick Now that your tasks are generated you can review the plan and prepare for execution. <Tip> Not all of the setup steps are required but they are recommended in order to ensure your coding agents work on accurate tasks. </Tip> ## Expand Tasks Used to add detail to tasks and create subtasks. We recommend expanding all tasks using the MCP request below: ``` Expand all tasks into subtasks. ``` The agent will execute ```bash theme={null} task-master expand --all ``` ## List/Show Tasks Used to view task details. It is important to review the plan and ensure it makes sense in your project. Check for correct folder structures, dependencies, out of scope subtasks, etc. To see a list of tasks and descriptions use the following command: ``` List all pending tasks so I can review. ``` To see all tasks in the CLI you can use: ```bash theme={null} task-master list ``` To see all implementation details of an individual task, including subtasks and testing strategy, you can use Show Task: ``` Show task 2 so I can review. ``` ```bash theme={null} task-master show --id=<##> ``` ## Update Tasks If the task details need to be edited you can update the task using this request: ``` Update Task 2 to use Postgres instead of MongoDB and remove the sharding subtask ``` Or this CLI command: ```bash theme={null} task-master update-task --id=2 --prompt="use Postgres instead of MongoDB and remove the sharding subtask" ``` ## Analyze complexity Task Master can provide a complexity report which can be helpful to read before you begin. If you didn't already expand all your tasks, it could help identify which could be broken down further with subtasks. ``` Can you analyze the complexity of our tasks to help me understand which ones need to be broken down further? ``` The agent will use the `analyze_project_complexity` MCP tool, or you can run it directly with the CLI command: ```bash theme={null} task-master analyze-complexity ``` For more comprehensive analysis using your configured research model, you can use: ```bash theme={null} task-master analyze-complexity --research ``` <Tip> The `--research` flag uses whatever research model you have configured in `.taskmaster/config.json` (configurable via `task-master models --setup`) for research-backed complexity analysis, providing more informed recommendations. </Tip> You can view the report in a friendly table using: ``` Can you show me the complexity report in a more readable format? ``` For more detailed CLI options, see the [Analyze Task Complexity](/capabilities/cli-root-commands#analyze-task-complexity) section. <Check>Now you are ready to begin [executing tasks](/getting-started/quick-start/execute-quick)</Check> # null Source: https://docs.task-master.dev/introduction <Tip> Welcome to v1 of the Task Master Docs. Expect weekly updates as we expand and refine each section. </Tip> We've organized the docs into three sections depending on your experience level and goals: ### Getting Started - Jump in to [Quick Start](/getting-started/quick-start) Designed for first-time users. Get set up, create your first PRD, and run your first task. ### Best Practices Covers common workflows, strategic usage of commands, model configuration tips, and real-world usage patterns. Recommended for active users. ### Technical Capabilities A detailed glossary of every root command and available capability — meant for power users and contributors. *** Thanks for being here early. If you spot something broken or want to contribute, check out the [GitHub repo](https://github.com/eyaltoledano/claude-task-master). Have questions? Join our [Discord community](https://discord.gg/fWJkU7rf) to connect with other users and get help from the team. # Azure OpenAI Source: https://docs.task-master.dev/providers/azure Configure Task Master to use Azure OpenAI Service Azure OpenAI Service provides enterprise-grade access to OpenAI models through Microsoft Azure. ## Prerequisites 1. **Azure subscription** with access to Azure OpenAI Service 2. **Deployed model** in your Azure OpenAI resource 3. **API key** from your Azure OpenAI resource ## Quick Setup ### 1. Set Your API Key Add your Azure OpenAI API key to your `.env` file: ```bash theme={null} AZURE_OPENAI_API_KEY="your-azure-openai-api-key" ``` ### 2. Configure the Base URL Set `azureBaseURL` in your `.taskmaster/config.json` under the `global` section: ```json theme={null} { "global": { "azureBaseURL": "https://your-resource.openai.azure.com/openai" } } ``` Or use the CLI: ```bash theme={null} task-master models --set-azure-base-url "https://your-resource.openai.azure.com/openai" ``` <Tip> Task Master automatically appends `/openai` to your base URL if needed. </Tip> ### 3. Set Azure as Your Provider ```bash theme={null} task-master models --set-main azure:gpt-4o ``` ## Supported Models Task Master supports Azure OpenAI models that use the Chat Completions API: | Model | Notes | | ------------- | ------------------------------ | | `gpt-4o` | Recommended for most use cases | | `gpt-4o-mini` | Cost-effective option | | `gpt-4-1` | GPT-4 Turbo | <Note> The `modelId` should match your Azure deployment name exactly. Azure deployment names are case-sensitive. </Note> ## Configuration Examples ### Basic Configuration ```json theme={null} { "models": { "main": { "provider": "azure", "modelId": "gpt-4o", "maxTokens": 16384, "temperature": 0.2 } }, "global": { "azureBaseURL": "https://my-resource.openai.azure.com/openai" } } ``` ### Role-Specific Base URLs You can set different base URLs per role if you have deployments in different regions: ```json theme={null} { "models": { "main": { "provider": "azure", "modelId": "gpt-4o", "baseURL": "https://us-east-resource.openai.azure.com/openai", "maxTokens": 16384 }, "fallback": { "provider": "azure", "modelId": "gpt-4o-mini", "baseURL": "https://eu-west-resource.openai.azure.com/openai", "maxTokens": 16384 } } } ``` ## MCP Server Configuration For Claude Code integration, include your Azure configuration in `.mcp.json`: ```json theme={null} { "mcpServers": { "task-master-ai": { "command": "npx", "args": ["-y", "task-master-ai"], "env": { "AZURE_OPENAI_API_KEY": "your-azure-key-here" } } } } ``` ## Troubleshooting ### "Azure endpoint URL is required" Make sure you've set either: * `global.azureBaseURL` in config * `models.[role].baseURL` for the specific role ### "Invalid API key" Verify your `AZURE_OPENAI_API_KEY` is correct and has access to the deployment. ### "Resource not found" (404) 1. Ensure the `modelId` matches your Azure deployment name exactly 2. Verify your base URL format is correct (should be `https://your-resource.openai.azure.com`) ## Getting Your Azure Credentials ### Azure Portal 1. Go to [Azure Portal](https://portal.azure.com) 2. Navigate to your Azure OpenAI resource 3. Under **Keys and Endpoint**, copy: * One of the API keys * The endpoint URL ### Creating a Deployment 1. In your Azure OpenAI resource, go to **Model deployments** 2. Click **Manage Deployments** to open Azure AI Studio 3. Create a new deployment and note the deployment name - this is your `modelId` # AI Agent Integration Guide Source: https://docs.task-master.dev/tdd-workflow/ai-agent-integration Complete guide for integrating AI agents with TaskMaster's autonomous TDD workflow system Complete guide for integrating AI agents with TaskMaster's autonomous TDD workflow system. ## Overview TaskMaster provides a complete TDD workflow orchestration system that enables AI agents to autonomously implement features following strict Test-Driven Development practices. The system manages workflow state, git operations, test validation, and progress tracking. ### Key Features * **TDD State Machine**: Enforces RED → GREEN → COMMIT cycle * **Git Integration**: Automated branch creation, commits with metadata * **Test Validation**: Ensures RED phase has failures, GREEN phase passes * **Progress Tracking**: Subtask completion, attempt counting, error logging * **State Persistence**: Automatic workflow state management * **Dual Interface**: CLI commands and MCP tools for flexibility ## Architecture ``` ┌─────────────────────────────────────────────────────┐ │ AI Agent │ │ (Claude Code, Custom Agent, etc.) │ └─────────────┬───────────────────────────────────────┘ │ │ Uses CLI or MCP │ ┌─────────────▼───────────────────────────────────────┐ │ TaskMaster Interface │ │ ┌──────────────┐ ┌──────────────┐ │ │ │ CLI Commands │ │ MCP Tools │ │ │ └──────┬───────┘ └──────┬───────┘ │ └─────────┼────────────────────────┼─────────────────┘ │ │ ┌─────────▼────────────────────────▼─────────────────┐ │ WorkflowOrchestrator (Core) │ │ ┌─────────────────────────────────────────────┐ │ │ │ State Machine: RED → GREEN → COMMIT │ │ │ └─────────────────────────────────────────────┘ │ │ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │ │ │GitAdapter│ │TestResult│ │CommitMessage │ │ │ │ │ │Validator │ │Generator │ │ │ └──────────┘ └──────────┘ └──────────────┘ │ └────────────────────────────────────────────────────┘ │ │ Persists to │ ┌─────────▼───────────────────────────────────────────┐ │ .taskmaster/workflow-state.json │ └──────────────────────────────────────────────────────┘ ``` ### Component Responsibilities **WorkflowOrchestrator** * Manages TDD state machine transitions * Tracks current subtask and progress * Enforces workflow rules and validations * Emits events for state changes **GitAdapter** * Creates and manages workflow branches * Stages files and creates commits * Validates git repository state * Provides safety checks (clean working tree, etc.) **TestResultValidator** * Validates RED phase has test failures * Validates GREEN phase has all tests passing * Parses test results from various formats **CommitMessageGenerator** * Generates conventional commit messages * Embeds workflow metadata (subtask ID, phase, etc.) * Follows project commit conventions ## Getting Started ### Prerequisites 1. TaskMaster initialized project with subtasks 2. Git repository with clean working tree 3. Test framework configured (vitest, jest, etc.) ### Quick Start ```bash theme={null} # 1. Initialize workflow for a task tm autopilot start 7 # 2. Check what to do next tm autopilot next # 3. Write failing test (RED phase) # ... create test file ... # 4. Run tests and complete RED phase tm autopilot complete --results '{"total":1,"passed":0,"failed":1,"skipped":0}' # 5. Implement code to pass tests (GREEN phase) # ... write implementation ... # 6. Run tests and complete GREEN phase tm autopilot complete --results '{"total":1,"passed":1,"failed":0,"skipped":0}' # 7. Commit changes tm autopilot commit # 8. Repeat for next subtask (automatically advanced) tm autopilot next ``` ## CLI Commands All commands support `--json` flag for machine-readable output. ### `tm autopilot start <taskId>` Initialize a new TDD workflow for a task. **Options:** * `--max-attempts <number>`: Maximum attempts per subtask (default: 3) * `--force`: Force start even if workflow exists * `--project-root <path>`: Project root directory * `--json`: Output JSON **Example:** ```bash theme={null} tm autopilot start 7 --max-attempts 5 --json ``` **JSON Output:** ```json theme={null} { "success": true, "message": "Workflow started for task 7", "taskId": "7", "branchName": "task-7", "phase": "SUBTASK_LOOP", "tddPhase": "RED", "progress": { "completed": 0, "total": 5, "percentage": 0 }, "currentSubtask": { "id": "1", "title": "Implement start command", "status": "in-progress", "attempts": 0 }, "nextAction": "generate_test" } ``` ### `tm autopilot resume` Resume a previously started workflow from saved state. **Example:** ```bash theme={null} tm autopilot resume --json ``` ### `tm autopilot next` Get the next action to perform with detailed context. **JSON Output:** ```json theme={null} { "action": "generate_test", "actionDescription": "Write a failing test for the current subtask", "phase": "SUBTASK_LOOP", "tddPhase": "RED", "taskId": "7", "branchName": "task-7", "progress": { "completed": 0, "total": 5, "current": 1, "percentage": 0 }, "currentSubtask": { "id": "1", "title": "Implement start command", "status": "in-progress", "attempts": 0, "maxAttempts": 3 }, "expectedFiles": ["test file"], "context": { "canProceed": false, "errors": [] } } ``` ### `tm autopilot status` Get comprehensive workflow progress and state information. **Example:** ```bash theme={null} tm autopilot status --json ``` ### `tm autopilot complete` Complete the current TDD phase with test result validation. **Options:** * `--results <json>`: Test results JSON string **Example:** ```bash theme={null} tm autopilot complete --results '{"total":10,"passed":9,"failed":1,"skipped":0}' --json ``` **Validation Rules:** * **RED Phase**: Must have at least one failing test * **GREEN Phase**: All tests must pass (failed === 0) ### `tm autopilot commit` Create a git commit with enhanced message generation. **Options:** * `--message <text>`: Custom commit message (optional) * `--files <paths...>`: Specific files to stage (optional) **Example:** ```bash theme={null} tm autopilot commit --json ``` ### `tm autopilot abort` Abort the workflow and clean up state (preserves git branch and code). **Example:** ```bash theme={null} tm autopilot abort --force --json ``` ## MCP Tools MCP tools provide the same functionality as CLI commands for programmatic integration. ### `autopilot_start` **Parameters:** ```typescript theme={null} { taskId: string; // Required: Task ID (e.g., "7", "2.3") projectRoot: string; // Required: Absolute path to project tag?: string; // Optional: Tag context maxAttempts?: number; // Optional: Default 3 force?: boolean; // Optional: Default false } ``` **Returns:** ```typescript theme={null} { success: boolean; message: string; taskId: string; branchName: string; phase: WorkflowPhase; tddPhase: TDDPhase; progress: { completed: number; total: number; percentage: number; }; currentSubtask: SubtaskInfo | null; nextAction: string; } ``` ### `autopilot_resume` **Parameters:** ```typescript theme={null} { projectRoot: string; // Required: Absolute path to project } ``` ### `autopilot_next` **Parameters:** ```typescript theme={null} { projectRoot: string; // Required: Absolute path to project } ``` **Returns:** ```typescript theme={null} { action: string; // 'generate_test' | 'implement_code' | 'commit_changes' actionDescription: string; phase: WorkflowPhase; tddPhase: TDDPhase; taskId: string; branchName: string; progress: ProgressInfo; currentSubtask: SubtaskInfo | null; expectedFiles: string[]; context: { canProceed: boolean; errors: string[]; }; } ``` ### `autopilot_status` **Parameters:** ```typescript theme={null} { projectRoot: string; // Required: Absolute path to project } ``` **Returns:** ```typescript theme={null} { taskId: string; branchName: string; phase: WorkflowPhase; tddPhase: TDDPhase; progress: ProgressInfo; currentSubtask: SubtaskInfo | null; subtasks: SubtaskInfo[]; errors: string[]; metadata: Record<string, any>; canProceed: boolean; } ``` ### `autopilot_complete_phase` **Parameters:** ```typescript theme={null} { projectRoot: string; // Required: Absolute path to project testResults: { total: number; // Required: Total tests passed: number; // Required: Passing tests failed: number; // Required: Failing tests skipped?: number; // Optional: Skipped tests }; } ``` ### `autopilot_commit` **Parameters:** ```typescript theme={null} { projectRoot: string; // Required: Absolute path to project files?: string[]; // Optional: Files to stage customMessage?: string; // Optional: Custom commit message } ``` ### `autopilot_abort` **Parameters:** ```typescript theme={null} { projectRoot: string; // Required: Absolute path to project } ``` ## Workflow Phases ### Phase Diagram ``` PREFLIGHT → BRANCH_SETUP → SUBTASK_LOOP → FINALIZE → COMPLETE ↓ RED → GREEN → COMMIT ↑ ↓ └──────────────┘ (Next Subtask) ``` ### Phase Descriptions **PREFLIGHT** * Validate task has subtasks * Check git repository state * Verify preconditions **BRANCH\_SETUP** * Create workflow branch: `task-{taskId}` * Checkout new branch * Initialize workflow context **SUBTASK\_LOOP** * **RED Phase**: Write failing tests * Action: `generate_test` * Validation: At least one test must fail * Files: Test files * **GREEN Phase**: Implement code * Action: `implement_code` * Validation: All tests must pass * Files: Implementation files * **COMMIT Phase**: Create commit * Action: `commit_changes` * Auto-generates commit message * Advances to next subtask **FINALIZE** * All subtasks complete * Workflow ready for review/merge **COMPLETE** * Workflow finished * State can be cleaned up ## Responsibility Matrix Clear division of responsibilities between AI Agent and TaskMaster. | Responsibility | AI Agent | TaskMaster | | -------------------------- | ------------------------ | ---------------------------------- | | **Workflow Orchestration** | | ✓ | | Start/resume workflow | Call CLI/MCP | Execute & validate | | Track workflow state | Read state | Persist state | | Manage TDD phases | Request transitions | Enforce transitions | | Validate phase completion | | ✓ (RED must fail, GREEN must pass) | | **Test Management** | | | | Write test code | ✓ | | | Run tests | ✓ | | | Parse test output | ✓ | | | Report test results | Provide JSON | Validate results | | **Implementation** | | | | Write implementation code | ✓ | | | Ensure tests pass | ✓ | | | Follow TDD cycle | ✓ (guided by TaskMaster) | Enforce rules | | **Git Operations** | | | | Create workflow branch | Request | ✓ Execute | | Stage files | Request (optional) | ✓ Execute | | Generate commit messages | | ✓ | | Create commits | Request | ✓ Execute | | **Progress Tracking** | | | | Query progress | Call status | ✓ Provide data | | Advance subtasks | | ✓ (automatic on commit) | | Count attempts | | ✓ | | Log activity | | ✓ | ### AI Agent Responsibilities 1. **Read and understand subtask requirements** 2. **Write test code** that validates the requirement 3. **Run test suite** using project's test command 4. **Parse test output** into JSON format 5. **Report results** to TaskMaster for validation 6. **Write implementation** to satisfy tests 7. **Request commits** when GREEN phase complete 8. **Handle errors** and retry within attempt limits ### TaskMaster Responsibilities 1. **Manage workflow state machine** 2. **Enforce TDD rules** (RED must fail, GREEN must pass) 3. **Track progress** (completed, current, attempts) 4. **Create git commits** with enhanced messages 5. **Manage git branches** and repository safety 6. **Validate transitions** between phases 7. **Persist state** for resumability 8. **Generate reports** and activity logs ## Examples ### Complete TDD Cycle Example #### 1. Start Workflow ```bash theme={null} $ tm autopilot start 7 --json ``` ```json theme={null} { "success": true, "taskId": "7", "branchName": "task-7", "tddPhase": "RED", "currentSubtask": { "id": "1", "title": "Implement start command", "status": "in-progress" }, "nextAction": "generate_test" } ``` #### 2. Get Next Action ```bash theme={null} $ tm autopilot next --json ``` ```json theme={null} { "action": "generate_test", "actionDescription": "Write a failing test for the current subtask", "tddPhase": "RED", "currentSubtask": { "id": "1", "title": "Implement start command" } } ``` #### 3. Write Failing Test AI Agent creates `tests/start.test.ts`: ```typescript theme={null} import { describe, it, expect } from 'vitest'; import { StartCommand } from '../src/commands/start.js'; describe('StartCommand', () => { it('should initialize workflow and create branch', async () => { const command = new StartCommand(); const result = await command.execute({ taskId: '7' }); expect(result.success).toBe(true); expect(result.branchName).toBe('task-7'); }); }); ``` #### 4. Run Tests (Should Fail) ```bash theme={null} $ npm test # Output: 1 test failed (expected) ``` Parse output to JSON: ```json theme={null} { "total": 1, "passed": 0, "failed": 1, "skipped": 0 } ``` #### 5. Complete RED Phase ```bash theme={null} $ tm autopilot complete --results '{"total":1,"passed":0,"failed":1,"skipped":0}' --json ``` ```json theme={null} { "success": true, "message": "Completed RED phase", "previousPhase": "RED", "currentPhase": "GREEN", "nextAction": "implement_code" } ``` #### 6. Implement Code AI Agent creates `src/commands/start.ts`: ```typescript theme={null} export class StartCommand { async execute(options: { taskId: string }) { // Implementation that makes test pass return { success: true, branchName: `task-${options.taskId}` }; } } ``` #### 7. Run Tests (Should Pass) ```bash theme={null} $ npm test # Output: 1 test passed ``` Parse output: ```json theme={null} { "total": 1, "passed": 1, "failed": 0, "skipped": 0 } ``` #### 8. Complete GREEN Phase ```bash theme={null} $ tm autopilot complete --results '{"total":1,"passed":1,"failed":0,"skipped":0}' --json ``` ```json theme={null} { "success": true, "previousPhase": "GREEN", "currentPhase": "COMMIT", "nextAction": "commit_changes" } ``` #### 9. Commit Changes ```bash theme={null} $ tm autopilot commit --json ``` ```json theme={null} { "success": true, "commit": { "hash": "abc123", "message": "feat(autopilot): implement start command (Task 7.1)\n\n..." }, "subtaskCompleted": "1", "currentSubtask": { "id": "2", "title": "Implement resume command" }, "nextAction": "generate_test" } ``` ### MCP Integration Example ```typescript theme={null} // AI Agent using MCP tools async function implementTask(taskId: string) { // Start workflow const start = await mcp.call('autopilot_start', { taskId, projectRoot: '/path/to/project' }); console.log(`Started task ${start.taskId} on branch ${start.branchName}`); while (true) { // Get next action const next = await mcp.call('autopilot_next', { projectRoot: '/path/to/project' }); console.log(`Next action: ${next.action}`); if (next.action === 'generate_test') { // AI generates test const testCode = await generateTest(next.currentSubtask); await writeFile(testCode); // Run tests const results = await runTests(); // Complete RED phase await mcp.call('autopilot_complete_phase', { projectRoot: '/path/to/project', testResults: results }); } else if (next.action === 'implement_code') { // AI generates implementation const implCode = await generateImplementation(next.currentSubtask); await writeFile(implCode); // Run tests const results = await runTests(); // Complete GREEN phase await mcp.call('autopilot_complete_phase', { projectRoot: '/path/to/project', testResults: results }); } else if (next.action === 'commit_changes') { // Commit const commit = await mcp.call('autopilot_commit', { projectRoot: '/path/to/project' }); console.log(`Committed: ${commit.commit.hash}`); if (commit.isComplete) { console.log('Task complete!'); break; } } } } ``` ## Error Handling ### Common Errors and Solutions #### Workflow Already Exists **Error:** ```json theme={null} { "error": "Workflow already in progress", "suggestion": "Use autopilot_resume to continue the existing workflow" } ``` **Solution:** ```bash theme={null} # Resume existing workflow tm autopilot resume # OR force start new workflow tm autopilot start 7 --force ``` #### RED Phase Validation Failed **Error:** ```json theme={null} { "error": "RED phase validation failed", "reason": "At least one test must be failing in RED phase", "actual": { "passed": 10, "failed": 0 }, "suggestion": "Ensure you have written a failing test before proceeding" } ``` **Solution:** The test isn't actually testing the new feature. Write a test that validates the new behavior that doesn't exist yet. #### GREEN Phase Validation Failed **Error:** ```json theme={null} { "error": "GREEN phase validation failed", "reason": "All tests must pass in GREEN phase", "actual": { "passed": 9, "failed": 1 }, "suggestion": "Fix the implementation to make all tests pass" } ``` **Solution:** Implementation isn't complete. Debug failing test and fix implementation. #### No Staged Changes **Error:** ```json theme={null} { "error": "No staged changes to commit", "suggestion": "Make code changes before committing" } ``` **Solution:** Ensure you've actually created/modified files before committing. #### Git Working Tree Not Clean **Error:** ```json theme={null} { "error": "Git validation failed: working tree not clean", "suggestion": "Commit or stash changes before starting workflow" } ``` **Solution:** ```bash theme={null} git status git add . && git commit -m "chore: save work" # Then start workflow ``` ### Error Recovery Patterns #### Retry Pattern ```typescript theme={null} async function withRetry<T>( fn: () => Promise<T>, maxAttempts: number = 3 ): Promise<T> { for (let attempt = 1; attempt <= maxAttempts; attempt++) { try { return await fn(); } catch (error) { if (attempt === maxAttempts) throw error; console.log(`Attempt ${attempt} failed, retrying...`); await sleep(1000 * attempt); // Exponential backoff } } throw new Error('Should not reach here'); } // Usage const results = await withRetry(async () => { const output = await runTests(); return parseTestResults(output); }); ``` #### Graceful Degradation ```typescript theme={null} async function completePhase(projectRoot: string, results: TestResults) { try { return await mcp.call('autopilot_complete_phase', { projectRoot, testResults: results }); } catch (error) { console.error('Phase completion failed:', error); // Log error for debugging await logError(error); // Attempt manual recovery console.log('Attempting manual state recovery...'); const status = await mcp.call('autopilot_status', { projectRoot }); console.log('Current state:', status); // Provide user guidance console.log('Manual intervention required:'); console.log('1. Check test results are correct'); console.log('2. Verify current phase allows transition'); console.log('3. Run: tm autopilot status'); throw error; } } ``` ## Troubleshooting ### Workflow State Issues **Problem:** State file corrupted or inconsistent **Solution:** ```bash theme={null} # Check state file cat .taskmaster/workflow-state.json # If corrupted, abort and restart tm autopilot abort --force tm autopilot start 7 ``` ### Test Results Parsing **Problem:** Test output format not recognized **Solution:** Ensure test results JSON has required fields: ```json theme={null} { "total": 10, // Required "passed": 8, // Required "failed": 2, // Required "skipped": 0 // Optional } ``` ### Branch Conflicts **Problem:** Workflow branch already exists **Solution:** ```bash theme={null} # Check branches git branch # Delete old workflow branch if safe git branch -D task-7 # Start workflow again tm autopilot start 7 ``` ### Permission Issues **Problem:** Cannot write to .taskmaster directory **Solution:** ```bash theme={null} # Check directory permissions ls -la .taskmaster/ # Fix permissions chmod -R u+w .taskmaster/ ``` ### State Persistence Failures **Problem:** State not saving between commands **Solution:** ```bash theme={null} # Check file system permissions ls -la .taskmaster/workflow-state.json # Verify state is being written tm autopilot status --json | jq . # If all else fails, reinstall rm -rf .taskmaster/ tm init ``` *** ## Working with AI Agents Example prompts for AI agents (Claude Code, Cursor, etc.) to use the TDD workflow. ### Starting a Task ``` I want to implement Task 7 using TDD workflow. Please: 1. Start the autopilot workflow 2. Show me the first subtask to implement 3. Begin the RED-GREEN-COMMIT cycle ``` ### RED Phase - Writing Failing Tests ``` We're in RED phase for subtask "{SUBTASK_TITLE}". Please: 1. Read the subtask requirements 2. Write a test that validates the behavior 3. The test MUST fail because the feature doesn't exist yet 4. Run the tests and report results to complete the RED phase ``` ### GREEN Phase - Implementing ``` We're in GREEN phase. The test is failing with: {ERROR_MESSAGE} Please: 1. Implement the minimal code to make this test pass 2. Don't over-engineer or add untested features 3. Run tests and report results to complete the GREEN phase ``` ### Handling Errors ``` The RED phase validation failed - no test failures detected. Please: 1. Review the test I just wrote 2. Identify why it's not actually testing new behavior 3. Rewrite the test to properly fail until the feature is implemented ``` ``` GREEN phase validation failed - {N} tests still failing. Please: 1. Review the failing test output 2. Fix the implementation to pass all tests 3. Try completing the GREEN phase again ``` ### Checking Progress ``` What's the current state of the workflow? Please show: - Which subtask we're on - Current TDD phase (RED/GREEN/COMMIT) - Progress percentage - Next action required ``` ### Resuming Work ``` I have an in-progress workflow. Please: 1. Resume the autopilot workflow 2. Show current status 3. Continue from where we left off ``` *** ## Additional Resources * [Command Reference](/command-reference) - Complete CLI command documentation * [MCP Provider Guide](/capabilities/mcp) - MCP integration details * [Task Structure](/capabilities/task-structure) - Understanding TaskMaster's task system * [Configuration](/configuration) - Project configuration options # TDD Workflow Quick Start Source: https://docs.task-master.dev/tdd-workflow/quickstart Get started with TaskMaster's autonomous TDD workflow in 5 minutes Get started with TaskMaster's autonomous TDD workflow in 5 minutes. ## Prerequisites * TaskMaster initialized project (`tm init`) * Tasks with subtasks created (`tm parse-prd` or `tm expand`) * Git repository with clean working tree * Test framework installed (vitest, jest, mocha, etc.) ## 1. Start a Workflow ```bash theme={null} tm autopilot start <taskId> ``` Example: ```bash theme={null} $ tm autopilot start 7 ✓ Workflow started for task 7 ✓ Created branch: task-7 ✓ Current phase: RED ✓ Subtask 1/5: Implement start command → Next action: Write a failing test ``` ## 2. The TDD Cycle ### RED Phase: Write Failing Test ```bash theme={null} # Check what to do next $ tm autopilot next --json { "action": "generate_test", "currentSubtask": { "id": "1", "title": "Implement start command" } } ``` Write a test that fails: ```typescript theme={null} // tests/start.test.ts import { describe, it, expect } from 'vitest'; import { StartCommand } from '../src/commands/start'; describe('StartCommand', () => { it('should initialize workflow', async () => { const command = new StartCommand(); const result = await command.execute({ taskId: '7' }); expect(result.success).toBe(true); }); }); ``` Run tests: ```bash theme={null} $ npm test # ✗ 1 test failed ``` Complete RED phase: ```bash theme={null} $ tm autopilot complete --results '{"total":1,"passed":0,"failed":1,"skipped":0}' ✓ RED phase complete ✓ Current phase: GREEN → Next action: Implement code to pass tests ``` ### GREEN Phase: Implement Feature Write minimal code to pass: ```typescript theme={null} // src/commands/start.ts export class StartCommand { async execute(options: { taskId: string }) { return { success: true }; } } ``` Run tests: ```bash theme={null} $ npm test # ✓ 1 test passed ``` Complete GREEN phase: ```bash theme={null} $ tm autopilot complete --results '{"total":1,"passed":1,"failed":0,"skipped":0}' ✓ GREEN phase complete ✓ Current phase: COMMIT → Next action: Commit changes ``` ### COMMIT Phase: Save Progress ```bash theme={null} $ tm autopilot commit ✓ Created commit: abc123 ✓ Message: feat(autopilot): implement start command (Task 7.1) ✓ Advanced to subtask 2/5 ✓ Current phase: RED → Next action: Write a failing test ``` ## 3. Continue for All Subtasks Repeat the RED-GREEN-COMMIT cycle for each subtask until complete. ```bash theme={null} # Check progress anytime $ tm autopilot status --json { "taskId": "7", "progress": { "completed": 1, "total": 5, "percentage": 20 }, "currentSubtask": { "id": "2", "title": "Implement resume command" } } ``` ## 4. Complete the Workflow When all subtasks are done: ```bash theme={null} $ tm autopilot status --json { "phase": "COMPLETE", "progress": { "completed": 5, "total": 5, "percentage": 100 } } ``` Your branch `task-7` is ready for review/merge! ## Common Patterns ### Parse Test Output Your test runner outputs human-readable format - convert to JSON: **Vitest:** ``` Tests 2 failed | 8 passed | 10 total ``` → `{"total":10,"passed":8,"failed":2,"skipped":0}` **Jest:** ``` Tests: 2 failed, 8 passed, 10 total ``` → `{"total":10,"passed":8,"failed":2,"skipped":0}` ### Handle Errors **Problem:** RED phase won't complete - "no test failures" **Solution:** Your test isn't testing new behavior. Make sure it fails: ```typescript theme={null} // Bad - test passes immediately it('should exist', () => { expect(StartCommand).toBeDefined(); // Always passes }); // Good - test fails until feature exists it('should initialize workflow', async () => { const result = await new StartCommand().execute({ taskId: '7' }); expect(result.success).toBe(true); // Fails until execute() is implemented }); ``` **Problem:** GREEN phase won't complete - "tests still failing" **Solution:** Fix your implementation until all tests pass: ```bash theme={null} # Run tests to see what's failing $ npm test # Fix the issue $ vim src/commands/start.ts # Verify tests pass $ npm test # Try again $ tm autopilot complete --results '{"total":1,"passed":1,"failed":0,"skipped":0}' ``` ### Resume Interrupted Work ```bash theme={null} # If you interrupted the workflow $ tm autopilot resume ✓ Workflow resumed ✓ Task 7 - subtask 3/5 ✓ Current phase: GREEN → Continue from where you left off ``` ## JSON Output Mode All commands support `--json` for programmatic use: ```bash theme={null} $ tm autopilot start 7 --json | jq . { "success": true, "taskId": "7", "branchName": "task-7", "phase": "SUBTASK_LOOP", "tddPhase": "RED", "progress": { ... }, "currentSubtask": { ... }, "nextAction": "generate_test" } ``` Perfect for: * CI/CD integration * Custom tooling * Automated workflows * Progress monitoring ## MCP Integration For AI agents (Claude Code, etc.), use MCP tools: ```typescript theme={null} // Start workflow await mcp.call('autopilot_start', { taskId: '7', projectRoot: '/path/to/project' }); // Get next action const next = await mcp.call('autopilot_next', { projectRoot: '/path/to/project' }); // Complete phase await mcp.call('autopilot_complete_phase', { projectRoot: '/path/to/project', testResults: { total: 1, passed: 0, failed: 1, skipped: 0 } }); // Commit await mcp.call('autopilot_commit', { projectRoot: '/path/to/project' }); ``` See [AI Agent Integration Guide](./ai-agent-integration.mdx) for details. ## Cheat Sheet ```bash theme={null} # Start tm autopilot start <taskId> # Initialize workflow # Workflow Control tm autopilot next # What's next? tm autopilot status # Current state tm autopilot resume # Continue interrupted work tm autopilot abort # Cancel and cleanup # TDD Cycle tm autopilot complete --results '{...}' # Advance phase tm autopilot commit # Save progress # Options --json # Machine-readable output --project-root <path> # Specify project location --force # Override safety checks ``` ## Next Steps * Read [AI Agent Integration Guide](./ai-agent-integration.mdx) for complete documentation * Check [Command Reference](/command-reference) for all options ## Tips 1. **Always let tests fail first** - That's the RED phase 2. **Write minimal code** - Just enough to pass 3. **Commit frequently** - After each subtask 4. **Use --json** - Better for programmatic use 5. **Check status often** - Know where you are 6. **Trust the workflow** - It enforces TDD rules *** **Ready to start?** Run `tm autopilot start <taskId>` and begin your TDD journey!