| name | stax |
| description | Use when working with stacked Git branches or PRs using stax, including creating, inserting, submitting, restacking, merging, repairing stacks, resolving conflicts, checking CI, and using stax lanes/worktrees for isolated agent work. |
| stax_version | 0.96.7 |
| metadata | {"short-description":"Stax stacked-branch and PR management commands"} |
Stax Skills for AI Coding Agents
This document teaches AI coding agents (Claude Code, Codex, Cursor, Gemini CLI, OpenCode) how to use stax to manage stacked Git branches and PRs.
Installing this skill: run stax skills update (or st setup --install-skills). Per-agent setup details live in docs/integrations/.
What is Stax?
Stax manages stacked branches: small focused branches layered on top of each other. Each branch maps to one PR targeting its parent branch.
Core Concepts
- Stack: A chain of branches where each branch builds on its parent
- Trunk: The main branch (
main or master)
- Parent: The branch a stacked branch is based on
- Tracked branch: A branch with stax metadata (parent and PR linkage)
Command Map
stax status|ls
stax ll
stax log|l
stax gui [path]
stax submit|ss
stax stack link
stax stack unlink
stax merge
stax sync|rs
stax sweep
stax restack
stax cascade
stax get [branch|PR]
stax checkout|co|bco
stax trunk|t
stax trunk <branch>
stax up|u [n]
stax down|d [n]
stax top
stax bottom
stax prev|p
stax branch ...|b
stax upstack ...|us
stax downstack ...|ds
stax create|c|add
stax modify|m
stax rename
stax detach
stax reorder
stax split
stax continue|cont
stax abort
stax undo [op-id]
stax redo [op-id]
stax pr
stax pr body
stax pr body --edit
stax ready
stax ready --current
stax ready --stack
stax ready --plain
stax pr list --ready
stax ready --all
stax issue list
stax open
stax comments
stax reviews --stack
stax reviews --all --json
stax copy [--pr]
stax ci [--oneline|-1]
stax standup
stax standup --ai
stax standup --ai --style slack
stax standup --ai --jit
stax changelog <from> [to]
stax changelog find [query]
stax changelog --find [query]
stax generate
stax gen --pr-body
stax gen --pr-title
stax gen --commit-msg
stax auth [status]
stax config
stax cli upgrade
stax doctor
stax doctor --fix
stax validate
stax fix
stax test <cmd...>
stax demo
stax skills
stax skills list
stax skills update
stax skills update --dry-run
stax lane [name] [prompt]
stax absorb
stax edit|e
stax worktree create [branch]
stax worktree list
stax worktree ll
stax worktree go <name>
stax worktree path <name>
stax worktree remove <name>
stax worktree promote
stax worktree cleanup
stax worktree restack
stax setup
stax setup --yes
stax setup --install-skills
stax setup --skip-skills
stax setup --auth-from-gh
stax setup --skip-auth
stax setup --print
stax wt
stax w
stax wtc [branch]
stax wtls
stax wtll
stax wtgo <name>
stax wtrm <name>
stax wtrs
sw <name>
High-Value Commands and Flags
Contributor Release Workflow
make release
make release LEVEL=patch
make release LEVEL=major
cargo release patch --no-confirm
Release prep regenerates CHANGELOG.md with git-cliff (config in cliff.toml) inside cargo release's pre-release hook, grouping the commits since the latest v* tag under the new version. Conventional prefixes map to grouped sections (feat → Features, fix → Bug Fixes, docs → Documentation, etc.); non-conventional subjects land in Other rather than being dropped. git-cliff must be installed locally (cargo install git-cliff).
Native macOS GUI
make gui-app
make install-gui-app
make gui-release
make gui-release-test
stax gui
stax gui /path/to/repo
Public GitHub Releases include Stax-aarch64-apple-darwin.zip and Stax-x86_64-apple-darwin.zip; extract the matching archive and move Stax.app to /Applications. The app is a separate artifact, not a new package, so it does not enlarge the CLI binaries. Ad-hoc-signed builds must be opened once to trigger Gatekeeper, then approved with Privacy & Security → Open Anyway; never disable Gatekeeper globally. The final bundle id is com.cesarferreira.stax.
stax gui [path] is macOS-only. It canonicalizes the supplied path, defaults to the current directory, and launches exactly open -n -b com.cesarferreira.stax --args <canonical-path>. The -n fresh-instance behavior is intentional: every invocation opens a new app process/window for one repository.
GUI operations are typed and repository-scoped. It can search branches; checkout, create, rename, delete, move, and reorder eligible local branches; restack selected/all; submit the current stack as Draft; Open PR without checkout; and undo/redo receipts whose transaction is fully local. Rename does not push. Delete shows descendants. Move/reorder/restack dirty-worktree recovery requires an explicit auto-stash confirmation. / focuses search, 1/2/3 toggle panes, draggable widths and visibility persist per canonical repository, and all enabled visible actions are keyboard-operable with visible focus and textual labels. GUI submit has no CLI prompts and does not auto-open PR pages. Keep AI naming, staging/commit creation, --below, --insert, custom prefixes, advanced submit options, and remote-effect recovery in CLI workflows.
Create and Edit Branches
stax create <name>
stax add <name>
stax create -m "message"
stax create -a
stax create -am "message"
stax create --ai
stax create --ai -a --yes
stax create <name> --ai -a
stax create --ai -m "message"
stax create -n -am "message"
stax create --from <branch>
stax create --prefix feature/
stax create <name> --below
stax create --below -am "message"
stax bc <name>
stax m
stax m -a
stax m -m "new msg"
stax rename <name>
stax rename --edit
stax rename --push
stax detach [branch] --yes
stax reorder --yes
stax split
Submit, Merge, Sync, Restack
stax submit
stax ss
stax submit --plan
stax submit --plan --json
stax submit --draft
stax submit --no-pr
stax submit --no-fetch
stax submit --no-verify
stax submit -n
stax submit --open
stax submit --reviewers a,b
stax submit --labels bug,urgent
stax submit --assignees alice
stax submit --template backend
stax submit --no-template
stax submit --edit
stax submit --ai
stax submit --ai --title
stax submit --ai --body
stax submit --ai --yes
stax submit --rerequest-review
stax submit --native-stack
stax submit --no-native-stack
stax completions zsh
[submit]
stack_links = "body"
single_stack = "on"
native_stack = "auto"
stack_links_when_native = "keep"
stax branch submit
stax bs
stax upstack submit
stax downstack submit
stax merge --all
stax merge --downstack-only
stax merge --ds
stax merge --dry-run
stax merge --method squash
stax merge --stack
stax merge --stack --downstack-only
stax merge --stack --full
stax merge --stack --when-ready
stax merge --when-ready
stax merge --remote
stax merge --remote --all
stax merge --interval 30
stax merge --no-wait
stax merge --timeout 60
stax merge --no-delete
stax merge --no-sync
stax merge-when-ready
stax rs
stax rs --restack
stax sync --continue
stax sync --safe
stax sync --force
stax sync --prune
stax sync --full
stax sync --no-delete
stax sync --auto-stash-pop
stax sweep
stax sweep --delete
stax sweep --delete --include-stale
stax sweep --delete --force
stax sweep --stale-days 60
stax sweep --json
stax update
stax update --no-pr
stax update --no-submit
stax update --force
stax update --force --yes --no-prompt
stax update --verbose
stax restack
stax restack --all
stax restack --continue
stax restack --dry-run
stax restack --submit-after yes
stax restack --auto-stash-pop
stax restack --quiet
stax cascade
stax cascade --no-pr
stax cascade --no-submit
stax cascade --auto-stash-pop
Navigation and Scopes
stax co
stax co <branch>
stax checkout --trunk
stax checkout --parent
stax checkout --child 1
stax t
stax trunk main
stax u 3
stax d
stax top
stax bottom
stax p
stax get
stax get teammate-branch
stax get 123
stax get teammate-branch --parent base-branch
stax get teammate-branch --downstack
stax get teammate-branch --remote-upstack
stax get teammate-branch --no-checkout
stax branch track --parent main
stax branch track --all-prs
stax branch untrack <branch>
stax branch reparent --parent new
stax branch delete <branch>
stax branch squash -m "message"
stax branch fold --keep
stax branch up
stax branch down
stax branch top
stax branch bottom
stax upstack restack
stax downstack get
Diagnostics, CI, Comments, and Reporting
stax ls
stax ll
stax log
stax diff
stax range-diff
stax pr body
stax pr body --edit
stax ready
stax ready --current
stax ready --plain
stax ready --all
stax ready --json
stax pr list --ready
stax issue list --limit 50 --json
stax comments
stax comments --plain
stax next / stax n
stax freeze [branch]
stax unfreeze [branch]
stax run --parallel --jobs 4 <cmd>
stax ci
stax ci --stack
stax ci --all
stax ci --oneline
stax ci --watch --interval 30
stax ci --watch --strict
stax ci --watch --alert
stax ci --watch --alert /path/to/sound.wav
stax ci --watch --no-alert
stax ci --refresh
stax ci --json
stax ci --verbose
[ci]
alert = true
success_alert_sound = "/path/to/ci-success.wav"
error_alert_sound = "/path/to/ci-error.wav"
stax standup --hours 48
stax standup --all --json
stax standup --ai
stax standup --ai --style slack
stax standup --ai --agent claude
stax standup --ai --plain-text
stax standup --ai --json
stax standup --ai --jit
stax changelog v1.2.0 HEAD
stax changelog v1.2.0 --path src/
stax changelog find
stax changelog find "auth fix"
stax changelog --find "auth fix"
stax changelog v1.2.0 --json
stax gen
stax generate --pr-body
stax gen --pr-title
stax gen --commit-msg
stax generate --pr-body --edit
stax generate --pr-body --agent codex --model gpt-5
AI Worktree Lanes (parallel AI agents)
stax lane
stax lane add-dark-mode "Add dark mode"
stax lane add-dark-mode --agent codex
stax lane add-dark-mode --agent codex --model gpt-5.5-fast
stax lane add-dark-mode
stax lane add-dark-mode "new prompt" --no-tmux
stax wt ll
stax wt rs
stax wt rm add-dark-mode --delete-branch
stax wt rm add-dark-mode --force
stax wt promote
stax wt cleanup --dry-run
stax wt cleanup
stax wt c review-pass --agent codex -- "address the open PR comments"
stax wt go review-pass --agent codex --tmux
[worktree]
reuse_slots = false
max_idle_slots = 4
reconcile = "pnpm install"
Maintenance, Safety, and Setup
stax continue
stax abort
stax undo
stax undo <op-id>
stax undo --no-push
stax redo
stax redo <op-id> --no-push
stax validate
stax fix --dry-run
stax fix --yes
stax test --all --fail-fast -- make lint
stax test -- cargo test -p my-crate
stax auth --token <token>
stax auth --from-gh
stax auth status
stax config
stax cli upgrade
stax doctor
stax doctor --fix
stax demo
stax skills
stax skills list
stax skills update
stax skills update --dry-run
Common Workflows
Start a New Feature Stack
stax t
stax rs
stax create api-layer
stax m
stax create ui-layer
stax m
stax ss
Update Reviewed Branch and Re-request Review
stax co <branch>
stax m
stax ss --rerequest-review
Merge with Safety Gates (CI + approvals)
stax ready
stax merge --when-ready --interval 15
stax merge --stack --when-ready
After Base PR Merges
stax update
Resolve Rebase Conflicts
stax restack
git add -A
stax continue
If stax detects that the stored parentBranchRevision would replay much more
history than merge-base(parent, branch), it prints a preflight: notice and
automatically uses the merge-base boundary for that rebase. This is the common
cause of “conflicts on files I never edited” after git merge main into a
branch or late tracking.
Silence the notice with [restack] preflight_warn = false or --quiet.
Disable the automatic correction with [restack] preflight_auto_repair = false
only when debugging old boundary behaviour.
Repair Broken Metadata
stax validate
stax fix --dry-run
stax fix --yes
Work on Multiple Stacks in Parallel (Developer Worktrees)
stax setup
stax setup --yes
stax setup --install-skills
stax worktree create feature/payments-api
stax worktree create origin/feature/payments-api
stax w
stax worktree go payments-api
sw payments-api
stax restack --all
stax ss
stax worktree promote
stax worktree remove payments-api
Run Multiple AI Agents in Parallel
Each agent gets its own isolated worktree and branch. They cannot conflict.
stax lane add-dark-mode --agent codex "Add dark mode"
stax lane fix-auth-refresh --agent claude "Fix auth refresh edge case"
stax lane write-integration-tests "Write integration tests for checkout flow"
stax wt ll
stax status
stax lane
stax lane fix-auth-refresh
stax wt rs
stax checkout add-dark-mode
stax submit
stax wt rm add-dark-mode --delete-branch
stax wt cleanup
Reading Stack Output
◉ feature/validation 1↑ # ◉ = current branch, 1↑ = commits ahead of parent
○ feature/auth 2↑ 1↓ ⟳ # ⟳ = needs restack
○ feature/old-base (missing parent: feature/base)
│ ○ ☁ feature/payments PR #42 # ☁ = has remote, PR #N = open PR
○─┘ ☁ main # trunk branch
Symbols:
◉ = current branch
○ = other branch
☁ = has remote tracking
↑ = commits ahead of parent
↓ = commits behind parent
⟳ = needs restacking (parent changed)
(missing parent: X) = branch metadata points to a deleted/missing parent; run stax fix --yes
PR #N = open PR
Best Practices
- Keep branches small and reviewable.
- Sync often (
stax rs).
- Restack after merges (
stax rs --restack); squash-merged local parents collapse to their updated parent before descendants rebase.
- Prefer amend flow (
stax m) to keep one commit per branch.
- Validate and repair metadata (
stax validate, stax fix) before deep stack surgery. Validation is read-only; only fix removes orphaned refs.
- Check stack shape (
stax ls / stax ll) before submit or merge.
- Use
stax lane <name> [prompt] to give each AI agent its own isolated worktree — prevents agents from conflicting on the same files.
- After trunk moves, run
stax wt rs once instead of rebasing each agent worktree manually.
- Use
stax worktree create when you want a worktree for an existing local branch, fetched remote branch, or human parallel development — st lane is the higher-level AI shortcut.
- Use
stax worktree promote inside a clean lane to retire it and continue its branch in the main worktree without losing stax or PR metadata.
- Run
stax setup once per machine to enable stax worktree go, stax worktree promote, and the sw alias to move the parent shell automatically.
Tips
- Run
stax with no args to launch the interactive TUI; selected-branch CI hydrates in the background, unchanged branch diffs can be reused from the repo-local TUI cache on reopen, and 1/2/3 toggle the Stack/Summary/Patch panes for small terminals. Pane visibility is remembered per repo.
- Run
stax gui [path] on macOS to launch a fresh installed GUI window for one repository. A pathless app launch restores the last project; use the toolbar project dropdown to switch recent repositories or add another. Use / for search, 1/2/3 for persistent pane toggles, and the guarded controls, menus, or shortcuts for structural operations and local-only undo/redo.
- Use
stax --help or stax <command> --help for exact flags.
- Add global
--trace to profile instrumented Git subprocesses and total command time; use make benchmark-status for reproducible cold status scaling fixtures.
- Hidden convenience shortcuts:
stax bc, stax bu, stax bd, stax bs, stax w, stax wtc, stax wtgo, stax wtrm.
- Use
--yes for non-interactive scripting.
- Use
--json on supported commands for machine-readable output.
- Use
stax lane with no arguments for an interactive picker over all stax-managed lanes — useful when you forget where a session lives.
- Use
stax worktree go (or sw) + shell integration to switch between stacks without cd gymnastics.
- Use
stax worktree promote when a lane should become the main-worktree checkout; it refuses dirty or conflicted checkouts instead of stashing automatically. If Git reports a removal failure after already retiring the lane, Stax keeps the completed promotion and warns you to inspect leftover files.
stax worktree list shows ALL worktrees including those created externally via git worktree add.