Running Claude Code as an Autonomous PR Worker
Many developers use Claude Code to write code, fix bugs, and explain repositories. The harder problem is keeping the work moving after the first response. A coding agent can produce a patch, but a real change needs tests
Many developers use Claude Code to write code, fix bugs, and explain repositories. The harder problem is keeping the work moving after the first response. A coding agent can produce a patch, but a real change needs tests, commits, a pull request, CI, review feedback, and a merge. Claude Task Master is an open source orchestration layer for that full loop. It uses the Claude Agent SDK and GitHub CLI to keep Claude working until a goal is achieved.
Install and authenticate
Claude Task Master is distributed as the claudetm CLI. It requires Python 3.10 or newer, an authenticated Claude CLI, and an authenticated GitHub CLI. Installation can use uv, pip, or Docker.
uv tool install claude-task-master
Authenticate Claude before starting a run.
claude
/login
Then start a task from the repository you want to change.
cd your-project
claudetm start 'Add user authentication with tests'
The command above is a small example. The important part is the goal. The system reads the codebase, creates a task list, defines success criteria, and begins work.
The loop
The workflow has four stages. Planning reads the repository and organizes work into tasks. Working makes changes, runs tests, commits, and pushes. The PR lifecycle waits for CI, fixes failures, and addresses review comments. Verification checks tests, lint, and the success criteria before the task is considered complete.
Work is not finished when a file is edited. It is finished when the change is committed, pushed, and in a pull request. That rule makes the output easier to review and safer to merge.
State persistence
Long agent runs can fail for boring reasons. A network call drops. A laptop sleeps. A CI provider has an outage. Claude Task Master persists state between sessions. If a run stops, it resumes from the saved point instead of starting over. This matters for tasks that take many steps, such as adding authentication, migrating a database table, or updating a flaky test suite.
Profiles for multiple accounts
Teams that run several Claude subscriptions need isolation. Profiles provide that isolation. An oauth profile uses a separate Claude Code config home under ~/.claudetm/profiles//. Two profiles can run without overwriting each other. An API key profile uses a direct API key and base URL. Those values are injected as ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL. An API key profile can point at a direct Anthropic API or OpenRouter. This is useful when a team wants to keep credentials separate by project.
Building on top of it
The CLI is only one entry point. Claude Task Master also exposes a REST API, an MCP server, and webhooks. Another system can dispatch a task, watch progress, and react to events. The mailbox system lets instances receive plan updates while work is running. Multiple instances coordinate through the same mailbox mechanism. HMAC signed webhooks add a way to verify incoming events.
This makes the project useful for internal dashboards, bots, and CI pipelines. A dashboard can start a task and show the current PR state. A bot can post review feedback into the mailbox. A pipeline can wait for a merge signal instead of polling a human.
Handling existing pull requests
The merge loop is not only for new tasks. If a pull request already exists, claudetm merge-pr can own the remaining work. It watches CI, addresses review comments, and merges when the checks pass. The project used this path for its own pull requests 147 through 150. That detail is useful because it shows the tool is not limited to greenfield automation.
When it fits
Claude Task Master fits teams that already use Claude Code and want the pull request lifecycle handled end to end. It also fits work with clear success criteria. A goal such as add user authentication with tests is easier to verify than a vague request to improve the codebase. Teams running multiple Claude subscriptions can use profiles to keep credentials and sessions separate.
Repository
The project is MIT licensed and free to install. The repository is at https://github.com/developerz-ai/claude-task-master. If you are running Claude Code in production, the main question is whether you want to keep supervising every CI failure and review comment. Claude Task Master is built for the case where you would rather define the goal and let the loop run.
ClaudeCode #AIAgents
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.