Sign in
Blog

Claude Code autonomous agent on GitHub, without a router

9 min read

A dark cable passing between the two white posts of a gate and ending at a dark terminal bar with an orange prompt, on an orange background

TL;DR

  • The short answer. Put a code gate in front of Claude Code, give each issue one worker on its own branch, send follow-ups back to that worker, and let a person merge. We would start with the GitHub Action and /install-github-app, which give you the gate. For same-worker follow-ups, we would use your own loop with --resume.
  • You may not need a router. A router is a model that talks to people and dispatches work to workers. The working build in Rob Shocks's video on this pattern has none.
  • "Faster than subagents" is weaker than it sounds. In DeepSeek's test, the slow row never used a subagent. A better prompt finished 1.4 minutes behind at the median, with a much worse worst case.
  • A gate limits who can start work. It does not limit what a running worker reads. The steps here limit the damage, and they do not make an agent safe.

The flags below come from the docs and the guide, and the outside numbers are other people's. We have not run these setups on a sandbox repo. The first-hand part is our own content engine: 40 runs, what they cost and what broke.

What did DeepSeek publish?

A research prototype, "for reference only, not an official DeepSeek product". It is packaged for DeepSeek Harness, so the ideas carry over to Claude Code and the install does not. It also differs from DeepSeek's internal version, and some designs in the article are not implemented in it, so the numbers below describe DeepSeek's system and not what the repo gives you. Rob Shocks's video and written guide show a Claude Code version. This post reads DeepSeek's own article against them.

The pattern has four parts:

  • Router. Talks to people and dispatches. DeepSeek's reason: one session runs one step at a time, which caps how fast it can work.
  • Worker. One task, isolated context, full tools. It never talks to people.
  • Triggers, filtered twice. Code filters by source, group and allowlist. Then a model decides, using policies written as prompts.
  • Pass-through. Once a worker subscribes to a thread, code passes follow-ups straight to it.

What do the numbers really say?

Less than the headline. These are DeepSeek's own figures, nobody has reproduced them that we found, and DeepSeek calls them indicative only. Coding was simulated by a tool that only consumes time, so they measure coordination and not coding. Each design ran 5 times.

DesignMedian / p95 (minutes)Cache-read tokens per run
Super-agent12.4 / 15.723.2M
Super-agent without pass-through12.6 / 15.531.8M
Single session, neutral prompt20.4 / 29.56.1M
Single session, delegation-first prompt13.8 / 29.010.8M

The slow row is not a subagent test. With the neutral prompt, the model did not call a subagent in any of the 5 runs. The video's "about 20 to 29 minutes" is that row's median and p95, not a range.

The fair comparison is much closer. With a delegation-first prompt, the single session finished 1.4 minutes behind at the median, using under half the cache-read tokens. Its p95 was far worse: in the one run of 5 where the model did not delegate, it produced the long tail. Our reading is that the win here is a steadier worst case more than a faster median.

Pass-through saved tokens, not time. Without it, cache-read tokens rose about 37%. DeepSeek says that under this workload it does not make tasks finish faster or better.

We can price only one part of this on Claude. At Claude's cache-read price of $0.10 per million on Sonnet 5.5, the super-agent's reads come to $2.32 a run and the delegation row's to $1.08. The arithmetic is ours. It is not what a run costs, because the article names no Claude model and publishes cache reads only.

To get your real number, run with --output-format json and read total_cost_usd. The docs say it is a client-side estimate that can differ from your bill.

Do you need a router?

Not at first, in our opinion. DeepSeek itself says some of the router's logic may not need a model at all. The guide's build lists the model coordinator under what it does not cover, and a code gate decides what starts work.

Add a router model for a specific reason, such as ambiguous follow-ups. A model that only sorts what an if statement could sort is one more thing to pay for.

What is the smallest version you can run today?

Three paths map the pattern onto what Claude Code already ships.

GitHub ActionScheduled taskYour own loop on claude -p
Code gateBuilt in: write access required, bots rejectedEvent filters, such as skipping draftsYou write it
Follow-ups reach the same workerNot stated in the docs we readNo: each event is a new sessionYes, with --resume
Runs onGitHub's runnersAnthropic's cloud, on your accountYour machine or server

The GitHub Action is where we would start. In a private sandbox repo on github.com, the only host the command works with, run /install-github-app from Claude Code. It installs the app, adds your secret and prepares the workflow pull request. Add the two limits the docs ask for to the file it generates, with starting numbers we picked:

yaml
# on the job
timeout-minutes: 30

# in the "with:" block of the claude-code-action step
claude_args: "--max-turns 20"

Then mention @claude on one small issue and read what comes back.

Scheduled tasks need no workflow file. They run on Anthropic-managed cloud infrastructure. Two PR updates produce two independent sessions, the opposite of pass-through, and commits and pull requests carry your GitHub user.

Your own loop gives you the most control. Keep one session ID per issue:

bash
# First turn for an issue: pick a UUID and store it with the issue
claude -p "$MESSAGE" --output-format json --session-id "$UUID" \
  --permission-mode dontAsk --allowedTools "Read,Edit,Bash(npm test)"

# Every follow-up on that issue: this is pass-through
claude -p "$MESSAGE" --output-format json --resume "$UUID" \
  --permission-mode dontAsk --allowedTools "Read,Edit,Bash(npm test)"

The session flags follow the guide. The guide runs workers with --dangerously-skip-permissions. We swapped in dontAsk, which denies every call that would otherwise prompt. Replace the tool list with what your task needs.

What can go wrong when strangers' text reaches an agent?

The guide calls its gate the main defense against prompt injection, because comment text can never grant permission. That is true of who may start work. It does not cover what a running worker reads.

The guide's table delivers a message from any person on a subscribed thread to the worker, and its workers run with permission prompts off. It recommends a private sandbox first. On a public repo, by our reading, a stranger's comment would reach a worker with shell access.

The risk has been shown. In Comment and Control, a researcher showed that PR titles, issue bodies and comments could hijack Claude Code Security Review, Gemini CLI Action and GitHub Copilot Agent. claude-code-action, the one recommended above, was not tested in that research, which does not make it immune.

These limit the damage:

  • Allowlist tools, secrets and network. That is the Comment and Control researcher's advice. The guide adds that an agent can call a program by absolute path, so command blocklists are guard rails and not a sandbox.
  • Use short-lived credentials. Anthropic's security doc says the GitHub app gets a short-lived token scoped to the repository. It warns that a static token could be recovered over time through prompt injection, in workflows that allow non-write users.
  • Filter comments by actor. include_comments_by_actor limits whose comments reach Claude on public repos.
  • Know what prompts-off means. --dangerously-skip-permissions disables prompts and safety checks.
  • Make the merge a branch setting. GitHub branch protection can require that the latest push be approved by someone else. We did not check which plans include it.

What did 40 runs of our own teach us?

Our content engine works on blog posts rather than code, and the lessons about unattended runs carry over. A GitHub issue does not start a run. A scheduler on our server or a click in our panel does, and the issues only store decisions. The start of a run sits behind our own code.

What it costs. We had 40 runs in about 3 days. The median cost was $0.48, the mean $1.02 and the range $0.08 to $3.10, with a median time of 1.8 minutes. These are estimates at API prices, because we run on a Claude subscription. The mean is about double the median, so read it and the top of the range as your warning, and measure your own runs.

What broke. All three had plain causes.

  • Our first version ran on GitHub Actions, and 21 of 22 runs failed in a week because no Claude login was set. We moved it to our server.
  • One run kept re-reviewing the same failed post, at about $1 per judge round. It now reviews again only if something changed.
  • Two runs failed on a brief network problem, so we added retries.

We found no runaway run in the logs.

What it may do. This is the real list, so you can compare it with yours. It may run engine commands, read and comment on issues and pull requests, use local git and search the web. It is refused git push, gh pr merge, gh api, gh secret, gh auth, .env files, and editing code or settings. The limits are 80 turns and 60 minutes. The app does the pushing, and only our panel merges, after a person approves.

Where should you start, and who can skip this?

Start narrow. DeepSeek advises beginning with a short allowed list and with proactive work only recorded, in a mode that notes what the agent would have done. Read that record, then widen it.

If you work alone with occasional tasks, skip it and keep a session open. The guide says the advantage is small for one developer with an agent already open, and our early view agrees. In our runs, it suits repeated jobs like topic scans and first drafts.

What to do next

Make a private sandbox repo with one small bug. Run /install-github-app, add a turn limit and a timeout, and mention @claude on an issue that describes the bug. Then read what it changed and what it did without asking. Write down what you would refuse it. That list is the start of your own rules.

Build your Claude Code setup.

  • agentic coding workflow
  • claude code subagents

Sources

  1. www.youtube.com/watch?v=n2TLtU65ZtA
  2. github.com/deepseek-ai/dsh-superagent-prototype
  3. x.com/DeepSeekHarness/status/2116857257245987236
  4. github.com/switch-dimension/deepseek-superagent-guide
  5. code.claude.com/docs/en/github-actions
  6. code.claude.com/docs/en/routines
  7. code.claude.com/docs/en/headless
  8. code.claude.com/docs/en/permission-modes
  9. github.com/anthropics/claude-code-action/blob/main/docs/security.md
  10. oddguan.com/blog/comment-and-control-prompt-injection-credential-theft-claude-code-gemini-cli-github-copilot
  11. platform.claude.com/docs/en/about-claude/pricing
  12. docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches

Keep reading