A nightly GitHub Actions loop that reads a SPEC.md, plans its own backlog, and ships
one feature per run as a pull request. Built on the official
anthropics/claude-code-action.
Two roles, auto-selected: initializer (turns your spec into an ordered
feature_list.json) and coder (builds the next pending feature, runs tests first,
opens a PR). One long-lived branch, one PR, so you don't wake up to a thousand branches.
I built this for my trading-data repo and wrote up the whole messy story here: https://mphinance.substack.com
claude-autonomous.yml- the loop. Drop it in.github/workflows/.SPEC.example.md- rename toSPEC.md, fill in what you want built.setup-prompt.md- paste into Claude Code to have it wire all this up for you.
- Install the Claude GitHub App on your repo: https://github.com/apps/claude
(or run
/install-github-appinside Claude Code). - Add the auth secret. Subscription: run
claude setup-token, thengh secret set CLAUDE_CODE_OAUTH_TOKEN. (Prefer an API key? SetANTHROPIC_API_KEYand change the workflow input toanthropic_api_key.) - Your
ghlogin needs theworkflowscope to push workflow files:gh auth refresh -h github.com -s workflow. - Add
claude-autonomous.ymlto.github/workflows/, renameSPEC.example.mdtoSPEC.md, and edit it. - Run it: Actions tab, "Claude Autonomous Loop", Run workflow. It opens a PR. You merge.
1. The agent needs permission to act. In headless CI it cannot approve its own tool
prompts, so without a permission mode it auto-denies everything and produces nothing.
Ask me how I know: my first run flailed for 15 minutes, hit 68 permission denials,
burned $2, and created zero files. The workflow sets --permission-mode bypassPermissions for exactly this reason.
2. So protect main instead. bypassPermissions is only safe because three things
are true at once: the runner is an ephemeral sandbox that gets destroyed after each run,
the agent only opens PRs (it never merges, you do), and branch protection blocks
force-push/deletion to main. Turn on branch protection. The agent gets freedom inside
the box, not the keys to the house.
The agent plans and writes in a throwaway sandbox; the only thing it can do to your repo is ask, by opening a PR. You are the gate.
MIT. If it helps you, that's the point.