Craig Motlin's Autonomous Development Loop

Table of content
Craig Motlin's Autonomous Development Loop

Craig P. Motlin is a VP at Two Sigma and a software engineer with 20+ years of experience. He studied Computer Science and Finance at the University of Pennsylvania. Previously, he spent 12 years at Goldman Sachs. His blog at motlin.com documents his Claude Code setup in detail, and he maintains his dotfiles publicly on GitHub.

Motlin built a Claude Code workflow that runs autonomously for hours, processing task lists without human input. His system combines todo-driven automation, hierarchical subagents, and parallel git worktrees to keep multiple Claude instances working simultaneously.

Background

The Development Loop

Motlin’s core workflow is a repeating cycle:

/todo → Test → /commit → /compact → Repeat

Each command does one thing:

CommandPurpose
/todoImplement the next incomplete task from .llm/todo.md
/commitStage and commit with a concise message
/compactSummarize conversation to manage context window

He plans features by chatting with a thinking model, requesting a markdown checklist in implementation order. Each checkbox is an independently committable task.

<!-- .llm/todo.md -->
- [ ] Add user authentication endpoint
- [ ] Implement JWT token generation
- [ ] Add refresh token rotation
- [ ] Write integration tests

The /todo command extracts the first incomplete task and implements it in isolation. Every task contains all the context needed to execute.

Parallel Worktrees

LLMs work slowly. Waiting for one task wastes time. Motlin’s solution: run multiple Claude instances on separate git worktrees.

# Create worktree for a task
git worktree add ../project-auth feature/auth

# Run Claude in the worktree
cd ../project-auth && claude /worktree

His /worktree command automates this:

  1. Mark the next todo as in-progress
  2. Create a new git worktree with a branch
  3. Copy environment files (.envrc, etc.)
  4. Create a focused single-task todo file
  5. Launch Claude in a new terminal tab

Each Claude instance works in complete isolation. No file conflicts. He runs loops outside Claude to spawn multiple instances:

for i in $(seq 1 10); do claude /worktree; done

When tasks complete, he cherry-picks commits into a single branch for review. Anthropic now officially recommends this parallel worktree approach in their documentation.

Hierarchical Subagents

The real power comes from nested agents. Motlin’s /todo-all command orchestrates a looping workflow:

/todo-all
  └── @do-todo (implements task)
        ├── @comment-cleaner (removes redundant comments)
        ├── @precommit-runner (validates build/tests)
        ├── @git-commit-handler (stages and commits)
        └── @git-rebaser (rebases on upstream)
              └── @conflict-resolver (handles merge conflicts)

The key insight: each subagent runs in its own context window. All the verbose output (test failures, build logs, git operations) happens inside the subagent and never touches the main window.

This separation prevents token bloat. Motlin’s longest automation run lasted over two hours. Claude worked independently, processing an entire task list without human input.

Configuration

Motlin uses a tiered configuration system:

His configuration includes:

## Code Style
- Prefer explicit types over inference
- No redundant comments

## LLM-Specific
- Do not run long-lived processes (npm start, npm dev)
- Do not force push or delete branches
- Gather contextual files in `.llm/` directories

He accepts that LLMs generate excessive comments despite instructions. Instead of fighting it, he uses /all-comments to clean them up after.

Phone Notifications

When Claude finishes a task, Motlin gets a notification on his phone:

{
  "hooks": {
    "Stop": [{
      "matcher": "",
      "hooks": [{
        "type": "command",
        "command": "if [ \"$NOTIFICATIONS\" = \"true\" ]; then woof \"Claude: $(basename $(pwd))\"; fi"
      }]
    }]
  }
}

This uses Pushover via a custom woof command. He can walk away from a task and know when to come back.

Key Takeaways

PrincipleImplementation
Task isolationEach todo contains all needed context
Parallel executionGit worktrees for multiple Claude instances
Context preservationSubagents run in separate context windows
Autonomous loops/todo-all processes entire task lists
Post-hoc cleanupAccept LLM quirks, fix after with commands

Lessons Learned

Motlin discovered that agents work better with several short, focused prompts rather than one long prompt with multiple steps. Converting slash commands to subagents enabled this decomposition naturally.

He also found that agent descriptions load lazily. Unlike slash commands that load fully into context when invoked, agents load only their description initially. Full prompts stay in isolated context windows, similar to MCP tools.


Next: Jesse Vincent’s Superpowers Skills Framework

Topics: claude-code workflow automation ai-coding