← Back to library

Split coding work across six bots, from issue to draft PR

Morlex describes a Grok bot setup he says has shipped over 1,000 pull requests. One bot maps the repository, a second judges the task's risk and routes it, a builder makes the smallest change, a tester runs checks, a fresh reviewer reads the diff, and a final bot checks secrets and permissions before opening a draft.

  • OutcomeRun each code change through separate bots for research, routing, building, testing, review and a risk check, so a draft pull request arrives with its context and checks attached.
  • SetupAn afternoon+
  • LevelAdvanced
  • CreditMorlex (@0xMorlex)
View original
Works with
Grok BotClaude CodeCustom agent

Published Oct 20, 2026Updated Oct 20, 2026AI dry run on sample input: passed Oct 20, 2026Source verified Oct 23, 2026

When should you use it?

  • You already let coding agents open pull requests and want fewer bad ones
  • Agents waste time rereading the whole repository for each task
  • You want the author and the reviewer of a change to be different

Not for: Merging to production without a person; this pipeline stops at a draft

What do you need, and what do you get?

You need

  • A repository with tests, lint and type checks that run from the command line
  • An issue or task description
  • Rules on which files or areas count as risky (auth, secrets, payments, config)

You get

  • An unmerged draft pull request plus a short note on context
  • Test, lint and build results
  • Review notes and a risk checklist for the change

How does it work, step by step?

  1. Research firstHave one bot locate the files and dependencies involved, comparable code and earlier pull requests, and pass on only that context.
  2. Route by riskA second bot classifies the task and its risk and picks which agent handles it.
  3. Build small, then testThe builder makes the smallest change that solves the task; a tester runs the checks and sends failures back.
  4. Review and gateA reviewer that didn't write the code reads the diff fresh; a final bot looks for leaked keys, login or permission changes, new dependencies and config edits before opening a draft.

The prompt

Our own prompt, inspired by Morlex (@0xMorlex) and written to work in Grok Bot, Claude Code and Custom agent. Values in lime are placeholders.

Fill in the blanks (optional; the copied prompt uses your values)

Prompt5 variables
Handle issue {issue} in {repo} as a pipeline of separate roles. Each role starts fresh with only what the previous one passes on.
1. Researcher: find the files and dependencies involved, comparable code and past pull requests. Pass on only that.
2. Router: classify the task and its risk (low, medium, high). High risk includes {risky_areas}.
3. Builder: write the minimal fix. Leave other files and unrelated cleanup alone.
4. Tester: run {test_commands} plus targeted edge cases; if anything fails, return it to step 3.
5. Reviewer: look only at the diff and the issue; note anything that could break existing behavior, guesses the code relies on, untested paths, and code that's more complicated than it needs to be.
6. Gatekeeper: flag leaked keys, login or access changes, new packages and config edits.
If everything passes, open the pull request as a draft and attach the context, results and review notes. Never merge. Label high-risk changes for {senior_reviewer}.

Inspired by Morlex (@0xMorlex): How a six-step Grok bot setup ships pull requests. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • If the reviewer shares the builder's context, it tends to approve its own reasoning. Start it fresh with only the diff and the task.
  • A green test run only means what your tests cover. Ask the tester for targeted edge cases, not just the existing suite.

Our take

The interesting claim here isn't the pull request count, which we can't check, but the design rule behind it: each bot does a single job with only the context it needs, and work is checked before it moves on. That matches what goes wrong when a single coding agent does everything. It rereads the repository, drifts into unrelated refactors and then grades its own homework. Splitting research from building keeps the builder's context small. Routing by risk means a typo fix and an auth change don't get the same treatment. And a reviewer that sees only the diff and the task is far more likely to catch a bad assumption than the agent that made it. The last gate, a check for leaked keys, permission and dependency changes and config edits, is the one we'd never skip. Our prompt keeps the six roles and adds two rules: the pipeline stops at a draft, and anything touching a risky area is labeled for a senior reviewer. In our dry run on a sample repository with 3 made-up issues, it opened 2 draft pull requests with passing checks, sent one failing change back to the builder once, and labeled a change to a login handler as high risk.

Where the time goes back: Changes arrive already researched, tested and reviewed, so a person's review is shorter and fewer pull requests get sent back.

FAQ

Why so many bots for one change?
The poster's point is that each one gets a single job and clean context. The builder doesn't hunt for where to start, and nothing moves on without a check.
Does it merge on its own?
No. The last bot opens the pull request as a draft, context attached, and a person decides whether to merge.

Source and credit

Inspired by Morlex (@0xMorlex). We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.

Inspired by
How a six-step Grok bot setup ships pull requests
Creator
Morlex (@0xMorlex)
Published on
X
Original date
Oct 4, 2026
License
Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
Originally for
Grok Bot
AI dry run
Oct 20, 2026: passed. Dry-run tested by our AI test agent on sample input. Stops at draft; author and reviewer separate.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in IT & Security

All 82 IT & Security playbooks →

Related playbooks

IT & SecurityWorkflow✓ AI dry run

Keep agent-built features in small, testable pull requests

Get reliable results from a coding agent by agreeing a plan, then having it deliver a feature as a series of small pull requests with tests, instead of one big autonomous run.

Credit: Christos Athanasiadis (@ckathanasiadis)

Minutes
IT & SecurityWorkflow✓ AI dry run

Let a coding agent triage your app-feedback Slack channel

Route user feedback into one Slack channel where a coding agent triages each report, investigates with read-only access and proposes fixes for an engineer to merge.

Credit: Sid Nanda (@sidstronaut)

An afternoon+
IT & SecurityWorkflow✓ AI dry run

Turn a public advisory into a tested exploit in a lab

See how fast an agent can go from a patched vulnerability to a working proof of concept inside an isolated lab, so you can judge real patch urgency.

Credit: Kev Breen

An afternoon+
IT & SecurityPrompt✓ AI dry run

Vet a third-party agent skill before you install it

Before adding someone else's skill to your coding or design agent, have the agent read the SKILL.md and report what it does, every command it would run, who it credits and where it clashes with your own standards, with nothing installed yet.

Credit: Tommy Geoco (@designertom)

Minutes