All environment variables for autonomous-dev, with defaults and examples.
# Copy template to .env
cp .env.example .env
# Edit with your values
vim .envIMPORTANT: Never commit .env to git. It should be in .gitignore.
| Variable | Required | Description |
|---|---|---|
GITHUB_TOKEN |
Yes | GitHub Personal Access Token for gh CLI, issue tracking, PR creation |
ANTHROPIC_API_KEY |
No | Anthropic API key for GenAI-powered features (security scan, test gen) |
GITHUB_TOKEN=ghp_your_token_hereCreate at: https://github.com/settings/tokens
Required scopes:
repo- Full control of private repositoriesread:org- Read org membership (for private repos)workflow- Update GitHub Action workflows (optional)
Used by:
/create-issue- Create GitHub issues/auto-implement- Close issues automatically/batch-implement --issues- Fetch issue titles- Auto-tracking hooks
ANTHROPIC_API_KEY=sk-ant-your_key_hereGet from: https://console.anthropic.com/
Used by:
GENAI_SECURITY_SCAN- AI-powered security scanningGENAI_TEST_GENERATION- Smart test case generationGENAI_DOC_AUTOFIX- Automatic documentation fixes
Note: Optional. Most GenAI features work through Claude Code directly (uses your Max subscription). Consider using OpenRouter instead for standalone scripts (cheaper).
OPENROUTER_API_KEY=sk-or-v1-your_key_hereGet from: https://openrouter.ai/keys
Used by:
- CI Pipeline - GenAI validation in GitHub Actions
/aligncommand - Manifest alignment validation- Standalone validation scripts
Why OpenRouter?
- Much cheaper: ~$0.10/1M tokens (Gemini Flash) vs $3/1M (Claude Sonnet)
- One API key for 400+ models
- Perfect for automated validation tasks
Model selection (optional):
OPENROUTER_MODEL=google/gemini-2.0-flash-exp # Default (cheapest)
OPENROUTER_MODEL=anthropic/claude-3-haiku # Fast Claude
OPENROUTER_MODEL=openai/gpt-4o-mini # OpenAI alternativeTo enable GenAI validation in CI:
- Go to repository Settings → Secrets and variables → Actions
- Click New repository secret
- Name:
OPENROUTER_API_KEY - Value: Your OpenRouter API key (sk-or-v1-...)
- Click Add secret
Cost: ~$0.001 per CI run (virtually free)
Controls automatic git operations after /auto-implement completes.
| Variable | Default | Description |
|---|---|---|
AUTO_GIT_ENABLED |
true |
Master switch for all git automation |
AUTO_GIT_PUSH |
true |
Auto-push commits to remote |
AUTO_GIT_PR |
false |
Auto-create pull request after push |
AUTO_CLOSE_ISSUES |
true |
Auto-close issues when commit contains "Closes #N" |
# Commit, push, and close issues automatically
AUTO_GIT_ENABLED=true
AUTO_GIT_PUSH=true
AUTO_GIT_PR=false
AUTO_CLOSE_ISSUES=true# Commit locally, but don't push
AUTO_GIT_ENABLED=true
AUTO_GIT_PUSH=false
AUTO_GIT_PR=false# Manual git operations only
AUTO_GIT_ENABLED=falseTrigger: Git automation triggers when doc-master agent completes (SubagentStop hook).
Reduces permission prompts during /auto-implement and /batch-implement.
| Variable | Default | Values | Description |
|---|---|---|---|
MCP_AUTO_APPROVE |
false |
true, false, subagent_only |
Auto-approve safe tool calls |
true- Auto-approve everywhere (main conversation + subagents)false- Always prompt for permissionsubagent_only- Only auto-approve in subagent workflows
# Eliminates 50+ permission prompts per /auto-implement
MCP_AUTO_APPROVE=trueSecurity: Uses blacklist-first policy. Dangerous commands (rm -rf, force push, etc.) are always blocked.
Enforces proper command-based workflows to prevent vibe coding and ensure validation pipelines.
| Variable | Default | Values | Description |
|---|---|---|---|
ENFORCE_WORKFLOW |
true |
true, false |
Enable/disable workflow enforcement |
The detect_feature_request.py hook (UserPromptSubmit lifecycle) enforces these workflows:
Feature Requests (Exit code 1 - WARN):
- Detects: "implement X", "add X", "create X", "build X"
- Action: Suggests using
/auto-implementinstead - Reason: Ensures PROJECT.md alignment and full TDD pipeline
Bypass Attempts (Exit code 2 - BLOCK):
- Detects: "gh issue create", "create issue", "skip /create-issue", "make issue"
- Action: BLOCKS the prompt and requires
/create-issuecommand - Reason: Ensures all issues go through research + duplicate detection + cache
Normal Prompts (Exit code 0 - PASS):
- Questions, queries, non-feature requests
- Action: Proceeds normally without intervention
# Disable all workflow enforcement
ENFORCE_WORKFLOW=falseWhy keep it enabled:
- Prevents accidental vibe coding (direct implementation without validation)
- Ensures all issues go through research pipeline (no duplicate work)
- Maintains audit trail from issue to implementation
- Forces proper workflows (tested and proven to work)
Scenario 1: Feature Request (Warned)
User: "implement JWT authentication"
Hook: Exit 1 (WARN) - Suggests /auto-implement "#123"Scenario 2: Bypass Attempt (Blocked)
User: "gh issue create --title JWT auth"
Hook: Exit 2 (BLOCK) - Requires /create-issue "JWT auth"Scenario 3: Normal Prompt (Passed)
User: "What is JWT and how does it work?"
Hook: Exit 0 (PASS) - Proceeds normallyScenario 4: Correct Workflow (Passed)
User: "/create-issue Add JWT authentication"
Hook: Exit 0 (PASS) - Correct command, proceeds normally- CLAUDE.md: Workflow Discipline section (explains philosophy)
/create-issuecommand: Proper GitHub issue creation workflow/auto-implementcommand: Feature implementation with alignment validation- plugins/autonomous-dev/hooks/detect_feature_request.py: Hook implementation
Controls /batch-implement behavior.
| Variable | Default | Description |
|---|---|---|
BATCH_RETRY_ENABLED |
false |
Auto-retry transient failures (network, timeout, rate limit) |
When enabled:
- Transient failures (network, timeout, API rate limit) → Retry up to 3x
- Permanent failures (syntax error, import error) → Never retry
- Circuit breaker → Pause after 5 consecutive failures
# Enable automatic retry
BATCH_RETRY_ENABLED=trueAutomatic issue creation from test failures and GenAI findings.
| Variable | Default | Description |
|---|---|---|
GITHUB_AUTO_TRACK_ISSUES |
false |
Enable automatic issue tracking |
GITHUB_TRACK_ON_PUSH |
true |
Create issues before git push |
GITHUB_TRACK_ON_COMMIT |
false |
Create issues on each commit |
GITHUB_TRACK_THRESHOLD |
high |
Minimum priority: low, medium, high |
GITHUB_DRY_RUN |
false |
Preview mode (don't actually create issues) |
high- Only critical bugs auto-trackedmedium- Bugs and important findingslow- Everything auto-tracked (creates many issues)
GITHUB_AUTO_TRACK_ISSUES=true
GITHUB_TRACK_ON_PUSH=true
GITHUB_TRACK_THRESHOLD=high
GITHUB_DRY_RUN=falseAI-powered enhancements. All default to true (opt-out model).
| Variable | Default | Description |
|---|---|---|
GENAI_SECURITY_SCAN |
true |
AI-powered security vulnerability detection |
GENAI_TEST_GENERATION |
true |
Smart test case generation |
GENAI_DOC_AUTOFIX |
true |
Automatic documentation fixes |
GENAI_DOC_UPDATE |
true |
AI-powered documentation updates |
GENAI_DOCS_VALIDATE |
true |
Documentation consistency validation |
# Faster but less intelligent checks
GENAI_SECURITY_SCAN=false
GENAI_TEST_GENERATION=false
GENAI_DOC_AUTOFIX=falseNote: Requires ANTHROPIC_API_KEY to be set for GenAI features to work.
Development and troubleshooting flags.
| Variable | Default | Description |
|---|---|---|
DEBUG_GENAI |
false |
Verbose GenAI operation output |
DEBUG_SECURITY_SCAN |
false |
Verbose security scan output |
STRICT_PIPELINE |
0 |
Fail on any warning (1 to enable) |
DEBUG_GENAI=true
DEBUG_SECURITY_SCAN=trueFor /batch-implement to run without ANY prompts, you need these settings:
# =============================================================================
# FULLY AUTONOMOUS MODE - No prompts, no questions, complete automation
# =============================================================================
# Required: Prevent MCP tool approval prompts
MCP_AUTO_APPROVE=true
# Required: Prevent git automation prompts
AUTO_GIT_ENABLED=true
AUTO_GIT_PUSH=true
AUTO_GIT_PR=true
AUTO_CLOSE_ISSUES=true
# Required: Prevent batch retry prompts
BATCH_RETRY_ENABLED=true
# Optional: Skip workflow enforcement (not recommended)
# ENFORCE_WORKFLOW=falseWhat this enables:
/batch-implementruns overnight without human intervention- All git operations execute automatically
- Transient failures (network, timeout) auto-retry
- PRs created and issues closed automatically
What still happens:
- Tests MUST pass 100% (not 80%) before proceeding
- Security vulnerabilities still block if CRITICAL
- Failed features are marked as failed (batch continues)
Here's a fully configured .env for autonomous development:
# =============================================================================
# API Keys
# =============================================================================
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
ANTHROPIC_API_KEY=sk-ant-api03-xxxxxxxxxxxx
# =============================================================================
# Git Automation (full auto)
# =============================================================================
AUTO_GIT_ENABLED=true
AUTO_GIT_PUSH=true
AUTO_GIT_PR=false
AUTO_CLOSE_ISSUES=true
# =============================================================================
# Tool Auto-Approval (reduce prompts)
# =============================================================================
MCP_AUTO_APPROVE=true
# =============================================================================
# Batch Processing
# =============================================================================
BATCH_RETRY_ENABLED=true
# =============================================================================
# Issue Tracking (conservative)
# =============================================================================
GITHUB_AUTO_TRACK_ISSUES=true
GITHUB_TRACK_ON_PUSH=true
GITHUB_TRACK_THRESHOLD=high
# =============================================================================
# GenAI Features (all enabled)
# =============================================================================
GENAI_SECURITY_SCAN=true
GENAI_TEST_GENERATION=true
GENAI_DOC_AUTOFIX=trueEnvironment variables override other configuration sources:
.envfile (highest priority)- User state (
~/.autonomous-dev/user_state.json) - Default values (lowest priority)
- GIT-AUTOMATION.md - Detailed git automation documentation
- TOOL-AUTO-APPROVAL.md - MCP auto-approval security details
- BATCH-PROCESSING.md - Batch processing documentation