Skip to main content
Stacks are linear chains of dependent issues that form a cohesive unit of work. Inspired by Graphite’s stacked PRs, tk automatically detects stacks in your issue graph and provides tools to work with them efficiently.

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:

Detecting Stacks

View All Stacks

Options:
  • --all — Include stacks with closed issues
  • --ready — Show only stacks where all issues are ready
Sample output:

Show Stack Details

Sample output:

JSON Output

For programmatic access:

Stack Properties


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

After resolving tk-auth1:
The stack shrinks as you complete issues. When only one issue remains, it’s no longer considered a stack.

Stacks vs Branches

Not all dependency chains form stacks:

Linear Chain = Stack

Each issue has one parent and one child. This is a stack.
A has multiple dependents. This is not a stack.
C has multiple dependencies. This is not a stack.

Validating Stacks

Before merging, validate that a stack is ready:
Validation checks:
  • All non-tip issues in the stack are closed
  • Tip issue has no external blockers (outside the stack)
  • All issues exist and are parseable
Sample output (valid):
Sample output (invalid):
Use tk stacks validate in CI to gate stack merges. Exit code 0 = valid, 1 = invalid.

Merging Stacks

Once validated, merge all branches in a stack with one command:
Options:
  • --dry-run — Preview merge without making changes
  • --yes — Skip confirmation prompt
Process:
  1. Validates the stack (same as tk stacks validate)
  2. Merges branches in dependency order (root → tip)
  3. Closes all issues in the stack
  4. Reports merge results
This command modifies git branches. Always use --dry-run first to preview changes.

Stack Worktrees

Create a dedicated worktree for working on a stack:
Features:
  • Creates worktree with the stack’s tip branch
  • Symlinks .tickets/ for shared issue tracking
  • Places worktree in ~/.tickets/worktrees/<repo>/<stack-id>
Manage worktrees:

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

Aim for 3-5 issues per stack. Longer stacks increase merge risk.
Always complete the root before moving to dependent issues.
Each stack issue should be independently reviewable.
Name issues to show their position: “Auth: Base”, “Auth: API”, “Auth: UI”

Future Enhancements

Planned stack features:
  • Stack navigation: tk stacks navigate to move between issues in a stack
  • Stack rebase: tk stacks rebase to rebase entire stacks onto main
  • Stack create: tk stacks create to easily build new dependency chains
  • Bisection: Isolate failures in O(log n) CI runs

Next Steps

Graph Analytics

Learn how tk analyzes your dependency graph.

Dependencies Guide

Best practices for structuring dependencies.

Worktree Commands

Full worktree command reference.

Claude Integration

Automate stack workflows with Claude Code.