Director-mode-lite auto-loop
TDD-based autonomous development loop with checkpoint recovery and observability changelog
install
source · Clone the upstream repo
git clone https://github.com/claude-world/director-mode-lite
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/claude-world/director-mode-lite "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/auto-loop" ~/.claude/skills/claude-world-director-mode-lite-auto-loop && rm -rf "$T"
manifest:
skills/auto-loop/SKILL.mdsource content
Auto-Loop
Execute a TDD-based autonomous development loop with full observability.
Usage
# Start new task /auto-loop "Implement user login" # With acceptance criteria /auto-loop "Implement authentication Acceptance Criteria: - [ ] Login form (email + password) - [ ] JWT token generation - [ ] Error handling " # Resume interrupted session /auto-loop --resume # Force restart (clear old state) /auto-loop --force "New task" # Check status /auto-loop --status # With iteration limit /auto-loop "Task" --max-iterations 15
How It Works
┌───────────────────────────────────────────────────────────────┐ │ TDD Iteration │ ├───────────┬───────────────────────────────────────────────────┤ │ RED │ Write failing test for next AC │ │ │ → Auto-logged: file_created, test_fail │ ├───────────┼───────────────────────────────────────────────────┤ │ GREEN │ Write implementation to make test pass │ │ │ → Auto-logged: file_created/modified, test_pass │ ├───────────┼───────────────────────────────────────────────────┤ │ REFACTOR │ Improve code quality (no behavior change) │ │ │ → Use code-reviewer agent for suggestions │ ├───────────┼───────────────────────────────────────────────────┤ │ VALIDATE │ Run full test suite + linter │ │ │ → Auto-logged: test_pass/fail │ ├───────────┼───────────────────────────────────────────────────┤ │ COMMIT │ Commit changes with descriptive message │ │ │ → Auto-logged: commit │ ├───────────┼───────────────────────────────────────────────────┤ │ DECIDE │ Check AC completion → continue or complete │ └───────────┴───────────────────────────────────────────────────┘
Execution
When user runs
/auto-loop "<request>":
1. State Detection (Conflict Prevention)
STATE_DIR=".auto-loop" CHECKPOINT="$STATE_DIR/checkpoint.json" # Check for existing in-progress session if [ -f "$CHECKPOINT" ]; then status=$(jq -r '.status // "unknown"' "$CHECKPOINT" 2>/dev/null || echo "unknown") iteration=$(jq -r '.current_iteration // 0' "$CHECKPOINT" 2>/dev/null || echo "0") if [ "$status" == "in_progress" ]; then echo "⚠️ Found interrupted session at iteration #$iteration" echo "Options:" echo " /auto-loop --resume → Continue" echo " /auto-loop --force \"...\" → Start fresh" exit 1 fi fi
Behavior Matrix:
| Existing State | Command | Action |
|---|---|---|
| None | | Start new |
| | Archive & start new |
| | Block - prompt user |
| | Continue |
| | Archive & start new |
2. Initialize
# Archive old changelog if > 100 lines CHANGELOG_DIR=".director-mode" CHANGELOG="$CHANGELOG_DIR/changelog.jsonl" if [ -f "$CHANGELOG" ] && [ $(wc -l < "$CHANGELOG") -gt 100 ]; then mv "$CHANGELOG" "$CHANGELOG_DIR/changelog.$(date +%Y%m%d_%H%M%S).jsonl" fi # Create state directories mkdir -p "$STATE_DIR" "$CHANGELOG_DIR" # Initialize checkpoint cat > "$CHECKPOINT" << EOF { "request": "$ARGUMENTS", "current_iteration": 0, "max_iterations": 20, "status": "in_progress", "started_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)", "acceptance_criteria": [], "last_test_result": null, "files_changed": [] } EOF
3. Parse Acceptance Criteria
Input: "Implement authentication Acceptance Criteria: - [ ] Login form - [ ] JWT token " Parsed: { "acceptance_criteria": [ { "id": 1, "description": "Login form", "done": false }, { "id": 2, "description": "JWT token", "done": false } ] }
4. DECIDE - Completion Check
┌─────────────────────────────────────────────────────────────┐ │ DECIDE - Iteration #3 │ ├─────────────────────────────────────────────────────────────┤ │ [x] 1. Login form ← test passing │ │ [x] 2. JWT token ← test passing │ │ [ ] 3. Error handling ← NO TEST YET │ ├─────────────────────────────────────────────────────────────┤ │ Decision: 2/3 complete → CONTINUE │ └─────────────────────────────────────────────────────────────┘
Complete when:
- All AC marked
done: true - All tests passing
Stop when:
reachedmax_iterations
file exists.auto-loop/stop
Flags
| Flag | Description |
|---|---|
| Continue interrupted session |
| Clear old state, start fresh |
| Show current session status |
| Set iteration limit (default: 20) |
Observability
All events are automatically logged via PostToolUse hooks:
| Event | Trigger | Hook |
|---|---|---|
| Write tool | |
| Edit tool | |
| Bash (test) | |
| Bash (git commit) | |
Query with
/changelog:
/changelog # Recent events /changelog --summary # Statistics /changelog --type test # Filter by type
Stop / Resume
# Interrupt (stop after current iteration) touch .auto-loop/stop # Check status /auto-loop --status # Resume /auto-loop --resume # Force restart /auto-loop --force "New task"
Related
- /changelog - View development events
- code-reviewer - Code quality review
- debugger - Error analysis
- test-runner - Test automation