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?
- Research firstHave one bot locate the files and dependencies involved, comparable code and earlier pull requests, and pass on only that context.
- Route by riskA second bot classifies the task and its risk and picks which agent handles it.
- Build small, then testThe builder makes the smallest change that solves the task; a tester runs the checks and sends failures back.
- 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)
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?
Does it merge on its own?
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.