chainrail ๐
Ship smaller PRs. Review faster. Never fight a squash-merge conflict again.

Chainrail organises your work into a chain of small, reviewable pull requests and keeps the whole chain healthy when things change โ including when a parent PR gets squash-merged and GitHub would normally explode with false conflicts.
The problem ๐ค
Your team uses squash-and-merge. You build a stacked PR. The parent gets merged โ GitHub squashes it to a new commit. Now every child branch shows the entire parent diff as "conflicts." You spend the next hour doing git surgery.
cn sync does that surgery for you, automatically, every time.
Install
go install github.com/brayschurman/chainrail@latest
alias cn=chainrail
Requires Go 1.21+ and the gh CLI installed and authenticated.
See your stack at a glance โจ
Run cn status on any branch in your stack:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ chainrail ยท dev-42 โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ 1 bray/dev-42-1-schema #12 โ merged โ
โ โถ 2 bray/dev-42-2-api #13 โ open โ
โ 3 bray/dev-42-3-ui #14 โ open โ needs sync โ
โ โ
โ q quit โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Color-coded PR states, sync warnings, and your current position โ all live from GitHub. No more keeping the stack in your head.
Quickstart ๐
# one-time setup per repo
cn init --base main
# build a stack, one layer at a time
cn add feature-schema # creates your-name/feature-1-schema and checks it out
# ... write code, commit ...
cn add feature-api # stacks on top
# ... write code, commit ...
cn add feature-ui # one more layer
# ... write code, commit ...
# open all PRs at once, with correct bases
cn submit
# parent PR got squash-merged? just run:
cn sync # chainrail figures out the rest
Commands
cn init --base <trunk> โ set up chainrail in your repo (once per clone)
cn add <slug> โ create the next branch in your stack
cn submit โ push all layers and open PRs with correct base chains
cn sync โ rebase everything onto fresh trunk; handles squash-merged parents automatically
cn status โ open the TUI to see your full stack health at a glance
Stack map in every PR ๐บ๏ธ
Every PR description gets a navigation block so reviewers know where they are:
Stack (bottom โ top)
1. your-name/feature-1-schema โ you are here
2. your-name/feature-2-api
3. your-name/feature-3-ui
Rerunnning cn submit updates it in place โ no duplicates.
Working with agents ๐ค
Chainrail is built to be agent-friendly. If you're using Claude Code or another AI assistant, add the skill file so your agent understands stacked PR workflows automatically:
Load the chainrail skill from .claude/skills/chainrail/SKILL.md and use it to manage my PR stack.
A good starting prompt:
I want to split my current work into a stack of small PRs. Use chainrail to help me layer it โ schema first, then API, then UI.
The skill file teaches your agent when to reach for chainrail, how to decompose work into layers, and what to do when a parent PR gets merged.
For developers building on chainrail, see AGENTS.md for the full architectural guide.
How it compares
| Capability |
chainrail |
Graphite |
ghstack |
Manual stacking |
gh stack |
| Stacked PRs with correct bases |
โ
|
โ
|
โ
|
โ
|
โ
|
| Squash-merge conflict recovery |
โ
|
โ
|
โ |
โ |
โ
|
| TUI stack health view |
โ
|
โ |
โ |
โ |
โ |
| Agent / AI skill file |
โ
|
โ |
โ |
โ |
โ |
| Works with standard GitHub PRs |
โ
|
โ
|
โ |
โ
|
โ
|
| No account or subscription needed |
โ
|
โ |
โ
|
โ
|
โ
|
| Open source |
โ
|
โ |
โ
|
โ |
โ
|
| Requires Go (no binary install yet) |
โ
|
โ |
โ |
โ |
โ |
Chainrail is early. Graphite is the mature, polished option โ if you want a SaaS product with a web UI, use Graphite. Chainrail is for teams who want a lightweight, open-source tool that an AI agent can drive.
License
MIT