Auto Mode Documentation¶
Auto mode enables autonomous agentic loops with Claude Code or GitHub Copilot CLI, allowing AI to work through multi-turn workflows with minimal human intervention.
Overview¶
Auto mode orchestrates an intelligent loop that:
- Clarifies objectives with measurable evaluation criteria
- Creates detailed execution plans identifying parallel opportunities
- Executes plans autonomously through multiple turns
- Evaluates progress after each turn
- Continues until objective achieved or max turns reached
- Provides comprehensive summary of work completed
Usage¶
With Claude Code¶
# Basic auto mode
amplihack claude --auto -- -p "implement user authentication"
# With custom max turns
amplihack claude --auto --max-turns 20 -- -p "refactor the API module"
# With interactive UI (requires Rich library)
amplihack claude --auto --ui -- -p "implement user authentication"
# Alias: launch command also supports auto mode
amplihack launch --auto -- -p "fix all failing tests"
Interactive UI Mode (--ui)¶
Auto mode supports an optional interactive terminal UI that displays real-time progress with:
- Session title and details (turn counter, elapsed time, cost tracking)
- Todo list with status indicators
- Streaming log output
- Interactive controls (pause, resume, exit)
Installing UI Dependencies:
The UI feature requires the Rich library. Install it with:
# Install with optional UI dependencies
pip install 'microsofthackathon2025-agenticcoding[ui]'
# Or install Rich directly
pip install 'rich>=13.0.0'
Usage:
What happens if Rich is not installed:
If you use the --ui flag without Rich installed, auto mode will display a helpful error message and continue in non-UI mode:
⚠️ WARNING: --ui flag requires Rich library
Error: No module named 'rich'
To enable TUI mode, install Rich:
pip install 'microsofthackathon2025-agenticcoding[ui]'
or:
pip install rich>=13.0.0
Continuing in non-UI mode...
This ensures auto mode always works, whether Rich is installed or not.
With GitHub Copilot CLI¶
# Basic auto mode
amplihack copilot --auto -- -p "add logging to all services"
# With custom max turns
amplihack copilot --auto --max-turns 15 -- -p "implement feature X"
How It Works¶
Turn 1: Objective Clarification¶
Auto mode starts by transforming your prompt into a clear objective with evaluation criteria.
Input: Your prompt Output:
- Clear objective statement
- Measurable evaluation criteria
- Key constraints
Turn 2: Plan Creation¶
Creates a detailed execution plan identifying parallel work opportunities.
Output:
- Step-by-step plan
- Parallel execution groups
- Dependencies between steps
- Complexity estimates
Turns 3+: Execute & Evaluate Loop¶
Iteratively executes the plan and evaluates progress.
Each turn:
- Execute next part of plan
- Evaluate if objective achieved
- Continue or complete based on evaluation
Final Turn: Summary¶
Provides comprehensive summary of the auto mode session.
Summary includes:
- What was accomplished
- What remains (if anything)
- Key decisions made
- Files modified
- Tests run
Configuration¶
Max Turns¶
Default: 10 turns
Adjust based on task complexity:
- Simple tasks: 5-10 turns
- Medium tasks: 10-15 turns
- Complex tasks: 15-30 turns
Per-Turn Timeout¶
Default: 30 minutes per turn
Controls how long each turn can run before timing out. This prevents runaway executions while allowing complex operations to complete.
Priority order (highest to lowest):
--no-timeoutflag (disables timeout entirely)- Explicit
--query-timeout-minutesvalue - Auto-detection (Opus models → 60 minutes)
- Default (30 minutes)
# Use default 30-minute timeout
amplihack claude --auto -- -p "implement feature"
# Explicit timeout (45 minutes)
amplihack claude --auto --query-timeout-minutes 45 -- -p "complex refactoring"
# Disable timeout for very long operations
amplihack claude --auto --no-timeout -- -p "comprehensive codebase analysis"
# Opus model auto-detects to 60 minutes
amplihack claude --auto -- --model opus -p "architectural design"
Note: Opus models automatically use 60-minute timeouts due to extended thinking requirements. Use --no-timeout for operations expected to exceed 60 minutes.
Session Logging¶
All auto mode sessions are logged to:
.claude/runtime/logs/auto_{sdk}_{timestamp}/
├── auto.log # Turn-by-turn log
├── prompt.md # Original prompt and session metadata
├── DECISIONS.md # Decision records (if any)
├── append/ # Pending instructions (for --append feature)
└── appended/ # Processed instructions (archived)
Examples¶
Example 1: Implementing a Feature¶
What happens:
- Clarifies requirements for profile editing feature
- Plans: API endpoint, validation logic, database updates, tests
- Executes: Implements each component
- Evaluates: Checks tests pass, requirements met
- Completes: Summarizes implementation
Example 2: Bug Fix¶
What happens:
- Clarifies the timeout bug and success criteria
- Plans: Investigate cause, implement fix, add tests
- Executes: Identifies issue, applies fix
- Evaluates: Verifies fix resolves timeout
- Completes: Documents fix and tests
Example 3: Refactoring¶
amplihack claude --auto --max-turns 15 -- -p "Refactor authentication module to use dependency injection"
What happens:
- Clarifies refactoring scope and constraints
- Plans: Update interfaces, modify implementations, update tests
- Executes: Refactors module incrementally
- Evaluates: Ensures all tests pass, no regressions
- Completes: Documents refactoring decisions
Example 4: Test Suite Creation¶
What happens:
- Clarifies coverage goals and test types needed
- Plans: Unit tests, integration tests, edge cases
- Executes: Writes test suite
- Evaluates: Checks coverage percentage, test quality
- Completes: Reports final coverage metrics
Injecting Instructions Mid-Session¶
You can append new instructions to a running auto mode session without interrupting it using the --append flag. This allows you to steer the agent's work in real-time as you observe its progress.
Usage¶
# Terminal 1: Start auto mode
amplihack claude --auto -- -p "Implement user authentication"
# Terminal 2: After reviewing initial work, append a new instruction
amplihack claude --append "Also add rate limiting to prevent brute force attacks"
# Terminal 2: Add another instruction
amplihack claude --append "Ensure all passwords are hashed with bcrypt"
How It Works¶
- The
--appendflag finds the active auto mode session in the current project - It writes your instruction to
.claude/runtime/logs/auto_<sdk>_<timestamp>/append/<timestamp>.md - Before the next turn, auto mode reads and processes all instructions in the
append/directory - The instructions are integrated into the turn prompt as additional requirements
- Processed instruction files are moved to
appended/directory for tracking
Example Workflow¶
# Start auto mode with initial task
$ amplihack claude --auto --max-turns 20 -- -p "Implement user authentication system"
# Watch progress in logs
$ tail -f .claude/runtime/logs/auto_claude_*/auto.log
# After turn 3, you realize you need additional security
$ amplihack claude --append "Add two-factor authentication support"
✓ Instruction appended to session: auto_claude_1729699200
File: 20241023_120534_123456.md
The auto mode session will process this on its next turn.
# Add another requirement
$ amplihack claude --append "Include comprehensive input validation for all forms"
✓ Instruction appended to session: auto_claude_1729699200
File: 20241023_120612_789012.md
The auto mode session will process this on its next turn.
Best Practices for Appending¶
- Be Specific: Appended instructions are added as-is. Be clear and specific about what you want.
Good: amplihack claude --append "Add input validation that checks password length is at least 12 characters"
Less Good: amplihack claude --append "improve security"
-
Timing: Instructions are processed before the next turn starts. Wait for the current turn to complete before expecting the new instruction to take effect.
-
Multiple Instructions: You can append multiple instructions - they queue in order and are all processed before the next turn.
-
Monitor Progress: Watch the logs to see when your appended instructions are processed:
- Review Appended History: Check what has been processed:
Troubleshooting Append¶
Error: No active auto mode session found
- Cause: No auto mode is currently running in this project
- Solution: Start an auto mode session first with
amplihack claude --auto -- -p "your task"
Instruction not being processed
- Cause: Auto mode may have completed before processing
- Solution: Check if auto mode reached max turns or completed the objective. Review logs to see what happened.
Multiple sessions detected
- Behavior: The system will use the most recent auto mode session
- Tip: Only run one auto mode session per project to avoid confusion
Security and Limits¶
The append feature includes several security controls:
- Size Limit: Instructions are limited to 100KB each
- Rate Limiting: Maximum 10 appends per minute, 100 pending instructions total
- Content Sanitization: Suspicious patterns are detected and sanitized before injection
- File Permissions: Instruction files are created with restrictive permissions (owner-only)
Log Directory Structure¶
When using the append feature, your log directory will have this structure:
.claude/runtime/logs/auto_claude_1729699200/
├── auto.log # Turn-by-turn execution log
├── prompt.md # Original prompt and session metadata
├── DECISIONS.md # Decision records (if any)
├── append/ # Pending instructions (waiting to be processed)
│ ├── 20241023_120534_123456.md
│ └── 20241023_120612_789012.md
└── appended/ # Processed instructions (archived)
└── 20241023_120455_000000.md
Best Practices¶
1. Be Specific in Your Prompt¶
Good:
Less Good:
2. Set Appropriate Max Turns¶
Match max turns to task complexity:
- Quick fixes: 3-5 turns
- Feature implementation: 10-15 turns
- Major refactoring: 20-30 turns
3. Let Auto Mode Work¶
Don't interrupt the process. Auto mode is designed to work autonomously. Check the logs afterward to see what was done.
4. Review Before Committing¶
Auto mode implements changes but doesn't commit them. Always:
- Review the changes made
- Run final tests manually
- Verify quality before committing
5. Use for Repetitive Tasks¶
Auto mode excels at:
- Adding tests to multiple files
- Refactoring patterns across codebase
- Implementing similar features
- Fixing categories of bugs
Troubleshooting¶
Auto Mode Stops Early¶
Cause: Objective achieved before max turns Solution: This is normal - check the summary
Reaches Max Turns¶
Cause: Task more complex than estimated Solution:
- Increase
--max-turns - Break task into smaller subtasks
- Review what was completed and continue manually
Execution Errors¶
Cause: Syntax errors, test failures during execution Solution: Auto mode logs errors and continues. Review logs in .claude/runtime/logs/ to see what happened.
Turn Timeouts¶
Cause: A turn exceeded the per-turn timeout (default 30 minutes) Solution:
- Check logs for
Turn N timed out after X seconds - For Opus models, ensure auto-detection is working (uses 60 min automatically)
- Use
--query-timeout-minutes 60for longer operations - Use
--no-timeoutfor very long operations (use with caution) - Consider breaking complex tasks into smaller subtasks
Installation Issues (Copilot)¶
Cause: GitHub Copilot CLI not installed Solution: Auto mode will attempt to install via npm. Ensure Node.js and npm are installed.
Hooks Integration¶
Session Start Hook¶
Runs at the beginning of auto mode session.
- Location:
.claude/tools/amplihack/hooks/session_start.py - Use: Initialize session logging, set up environment
Stop Hook¶
Runs at the end of auto mode session.
- Location:
.claude/tools/amplihack/hooks/stop.py - Use: Cleanup, final logging, metrics collection
Note: Only session_start and stop hooks run in auto mode. Tool-use hooks aren't supported.
Advanced Usage¶
Combining with Subagents¶
Auto mode automatically leverages subagents when appropriate. You can guide this in your prompt:
amplihack claude --auto -- -p "Use the architect agent to design a caching layer, then the builder agent to implement it"
Parallel Execution¶
Auto mode identifies parallel work opportunities. Help it by structuring your prompt:
amplihack copilot --auto -- -p "Add logging to all three services: auth, payment, and notification - these can be done in parallel"
Continuing Work¶
If auto mode runs out of turns, you can continue manually or start a new auto mode session with adjusted objectives:
# First session
amplihack claude --auto --max-turns 10 -- -p "implement feature X"
# If incomplete, refine and continue
amplihack claude --auto --max-turns 10 -- -p "complete feature X implementation: finish the API endpoint and add tests"
Comparison: Claude vs Copilot¶
Claude Auto Mode¶
- Tighter integration with Claude Code features
- Supports
--continueflag for context preservation - Automatic hook execution
- Better for complex, multi-file changes
Copilot Auto Mode¶
- Works with GitHub Copilot CLI
- Requires explicit subagent invocation
- Manual hook execution
- Good for focused, specific tasks
Tips¶
- Start small: Test auto mode with simpler tasks first
- Monitor logs: Check
.claude/runtime/logs/to understand what auto mode is doing - Iterate prompts: Refine your prompts based on results
- Use max-turns wisely: Don't set too high - better to run multiple focused sessions
- Trust the process: Let auto mode work through its turns autonomously
See Also¶
AGENTS.md- Guide for using subagents with Copilot CLI.claude/workflow/DEFAULT_WORKFLOW.md- Standard workflow steps.claude/context/PHILOSOPHY.md- Development principles
Auto mode brings autonomous agent capabilities to your development workflow, handling multi-turn tasks with minimal intervention while maintaining quality and following best practices.