What is a Stack?
A stack is a maximal linear chain where:- Each issue depends on exactly one predecessor (except the root)
- Each issue has at most one dependent (except the tip)
Stacks are detected automatically from your issue dependencies. You don’t need to explicitly create them.
Why Use Stacks?
1. Structured Feature Development
Break large features into incremental, reviewable pieces:2. Clear Work Order
The stack defines the exact order work should be completed:3. Coordinated Worktrees
Create worktrees for stack issues that share.tickets/:
Stack Commands
tk provides a complete set of subcommands for managing stacks:| Command | Description |
|---|---|
tk stacks or tk stacks list | List all detected stacks |
tk stacks show <id> | Show detailed stack info |
tk stacks validate <id> | Check if stack is ready to merge |
tk stacks merge <id> | Fast-forward merge all branches |
tk stacks worktree <id> | Create worktree for stack development |
Detecting Stacks
View All Stacks
--all— Include stacks with closed issues--ready— Show only stacks where all issues are ready
Show Stack Details
JSON Output
For programmatic access:Stack Properties
| Property | Description |
|---|---|
id | Unique identifier (e.g., “stack-1”) |
root | First issue in chain (no blockers) |
tip | Last issue in chain (no dependents) |
issues | Ordered list from root to tip |
depth | Number of issues in stack |
is_ready | Whether the root can be started |
Working with Stacks
Start at the Root
Only the root issue is “ready” since others are blocked:Progress Through the Stack
As you complete each issue, the next becomes unblocked:View Stack Progress
tk-auth1:
Stacks vs Branches
Not all dependency chains form stacks:Linear Chain = Stack
Linear Chain = Stack
Each issue has one parent and one child. This is a stack.
Branching = Not a Stack
Branching = Not a Stack
A has multiple dependents. This is not a stack.
Multiple Parents = Not a Stack
Multiple Parents = Not a Stack
C has multiple dependencies. This is not a stack.
Validating Stacks
Before merging, validate that a stack is ready:- All non-tip issues in the stack are closed
- Tip issue has no external blockers (outside the stack)
- All issues exist and are parseable
Merging Stacks
Once validated, merge all branches in a stack with one command:--dry-run— Preview merge without making changes--yes— Skip confirmation prompt
- Validates the stack (same as
tk stacks validate) - Merges branches in dependency order (root → tip)
- Closes all issues in the stack
- Reports merge results
Stack Worktrees
Create a dedicated worktree for working on a stack:- Creates worktree with the stack’s tip branch
- Symlinks
.tickets/for shared issue tracking - Places worktree in
~/.tickets/worktrees/<repo>/<stack-id>
Git Worktree Integration
Stacks work seamlessly with git worktrees:1. Configure Worktree Location
2. Create Worktrees for Stack Development
3. Use Hooks for Automation
Configure hooks in.tickets/config.yaml:
Worktree Variables
Available template variables:
{{ worktree_base }}- Base directory from config{{ worktree_path }}- Full path to worktree{{ id | short }}- Issue ID without prefix (e.g., “auth1”)
Best Practices
Keep stacks focused
Keep stacks focused
Aim for 3-5 issues per stack. Longer stacks increase merge risk.
Work root-to-tip
Work root-to-tip
Always complete the root before moving to dependent issues.
Review incrementally
Review incrementally
Each stack issue should be independently reviewable.
Use descriptive names
Use descriptive names
Name issues to show their position: “Auth: Base”, “Auth: API”, “Auth: UI”
Future Enhancements
Planned stack features:- Stack navigation:
tk stacks navigateto move between issues in a stack - Stack rebase:
tk stacks rebaseto rebase entire stacks onto main - Stack create:
tk stacks createto easily build new dependency chains - Bisection: Isolate failures in O(log n) CI runs