---
title: "Configuration"
description: "Configure Task Master through environment variables in a .env file"
---

## Required Configuration

<Note>
  Task Master requires an Anthropic API key to function. Add this to your `.env` file:

  ```bash
  ANTHROPIC_API_KEY=sk-ant-api03-your-api-key
  ```

  You can obtain an API key from the [Anthropic Console](https://console.anthropic.com/).
</Note>

## Optional Configuration

| Variable | Default Value | Description | Example |
| --- | --- | --- | --- |
| `MODEL` | `"claude-3-7-sonnet-20250219"` | Claude model to use | `MODEL=claude-3-opus-20240229` |
| `MAX_TOKENS` | `"4000"` | Maximum tokens for responses | `MAX_TOKENS=8000` |
| `TEMPERATURE` | `"0.7"` | Temperature for model responses | `TEMPERATURE=0.5` |
| `DEBUG` | `"false"` | Enable debug logging | `DEBUG=true` |
| `LOG_LEVEL` | `"info"` | Console output level | `LOG_LEVEL=debug` |
| `DEFAULT_SUBTASKS` | `"3"` | Default subtask count | `DEFAULT_SUBTASKS=5` |
| `DEFAULT_PRIORITY` | `"medium"` | Default priority | `DEFAULT_PRIORITY=high` |
| `PROJECT_NAME` | `"MCP SaaS MVP"` | Project name in metadata | `PROJECT_NAME=My Awesome Project` |
| `PROJECT_VERSION` | `"1.0.0"` | Version in metadata | `PROJECT_VERSION=2.1.0` |
| `PERPLEXITY_API_KEY` | - | For research-backed features | `PERPLEXITY_API_KEY=pplx-...` |
| `PERPLEXITY_MODEL` | `"sonar-medium-online"` | Perplexity model | `PERPLEXITY_MODEL=sonar-large-online` |

## TDD Workflow Configuration

Comprehensive options for autonomous TDD workflow via `.taskmaster/config.json`:

### Core Workflow Settings

| Setting | Default | Description |
| --- | --- | --- |
| `workflow.enableAutopilot` | `true` | Enable autopilot/TDD workflow features |
| `workflow.maxPhaseAttempts` | `3` | Maximum retry attempts for phase validation |
| `workflow.branchPattern` | `"task-{taskId}"` | Branch naming pattern for workflow branches |
| `workflow.requireCleanWorkingTree` | `true` | Require clean working tree before starting workflow |
| `workflow.autoStageChanges` | `true` | Automatically stage all changes during commit phase |

### Commit Configuration

| Setting | Default | Description |
| --- | --- | --- |
| `workflow.includeCoAuthor` | `true` | Include co-author attribution in commits |
| `workflow.coAuthorName` | `"Claude"` | Co-author name for commit messages |
| `workflow.coAuthorEmail` | `"noreply@anthropic.com"` | Co-author email for commit messages |
| `workflow.commitMessageTemplate` | `"{type}: {description}\n\n{body}"` | Commit message template pattern |
| `workflow.defaultCommitType` | `"feat"` | Default commit type for autopilot |
| `workflow.allowedCommitTypes` | `["feat", "fix", "refactor", "test", "docs", "chore"]` | Allowed conventional commit types |

### Test Validation Thresholds

| Setting | Default | Description |
| --- | --- | --- |
| `workflow.testThresholds.minTests` | `1` | Minimum test count for valid RED phase |
| `workflow.testThresholds.maxFailuresInGreen` | `0` | Maximum allowed failing tests in GREEN phase |

### Activity Logging

| Setting | Default | Description |
| --- | --- | --- |
| `workflow.enableActivityLogging` | `true` | Enable activity logging for workflow events |
| `workflow.activityLogPath` | `".taskmaster/logs"` | Path to store workflow activity logs |
| `workflow.enableStateBackup` | `true` | Enable automatic backup of workflow state |
| `workflow.maxStateBackups` | `10` | Maximum workflow state backups to retain |
| `workflow.operationTimeout` | `300000` | Timeout for workflow operations in milliseconds |

### Environment Variables (Legacy Support)

| Variable | Default | Description |
| --- | --- | --- |
| `TM_MAX_ATTEMPTS` | `3` | Max attempts per subtask before marking blocked |
| `TM_AUTO_COMMIT` | `true` | Auto-commit after GREEN phase |
| `TM_PROJECT_ROOT` | Current dir | Default project root |

## Example Configuration

### Environment Variables (.env file)

```bash
# Required
ANTHROPIC_API_KEY=sk-ant-api03-your-api-key

# Optional - Claude Configuration
MODEL=claude-3-7-sonnet-20250219
MAX_TOKENS=4000
TEMPERATURE=0.7

# Optional - Perplexity API for Research
PERPLEXITY_API_KEY=pplx-your-api-key
PERPLEXITY_MODEL=sonar-medium-online

# Optional - Project Info
PROJECT_NAME=My Project
PROJECT_VERSION=1.0.0

# Optional - Application Configuration
DEFAULT_SUBTASKS=3
DEFAULT_PRIORITY=medium
DEBUG=false
LOG_LEVEL=info

# TDD Workflow (Legacy)
TM_MAX_ATTEMPTS=3
TM_AUTO_COMMIT=true
```

### Config JSON (.taskmaster/config.json)

```json
{
  "models": {
    "main": "claude-3-5-sonnet-20241022",
    "research": "perplexity-llama-3.1-sonar-large-128k-online",
    "fallback": "claude-3-haiku-20240307"
  },
  "workflow": {
    "enableAutopilot": true,
    "maxPhaseAttempts": 3,
    "branchPattern": "task-{taskId}",
    "requireCleanWorkingTree": true,
    "autoStageChanges": true,
    "includeCoAuthor": true,
    "coAuthorName": "Claude",
    "coAuthorEmail": "noreply@anthropic.com",
    "commitMessageTemplate": "{type}: {description}\n\n{body}",
    "defaultCommitType": "feat",
    "allowedCommitTypes": ["feat", "fix", "refactor", "test", "docs", "chore"],
    "testThresholds": {
      "minTests": 1,
      "maxFailuresInGreen": 0
    },
    "enableActivityLogging": true,
    "activityLogPath": ".taskmaster/logs",
    "enableStateBackup": true,
    "maxStateBackups": 10,
    "operationTimeout": 300000
  },
  "tasks": {
    "defaultPriority": "medium",
    "maxSubtasks": 10,
    "validateDependencies": true
  },
  "logging": {
    "enabled": true,
    "level": "info",
    "logRequests": false,
    "logPerformance": false
  }
}
```

## Troubleshooting

### If `task-master init` doesn't respond:

Try running it with Node directly:

```bash
node node_modules/claude-task-master/scripts/init.js
```

Or clone the repository and run:

```bash
git clone https://github.com/eyaltoledano/claude-task-master.git
cd claude-task-master
node scripts/init.js
```

<Note>
For advanced configuration options and detailed customization, see our [Advanced Configuration Guide] page.
</Note>
