The Dependency Graph
At its core, tk maintains a directed acyclic graph (DAG) of your issues. Each issue can depend on zero or more other issues, and these relationships form the graph structure. This graph enables:- Topological sorting — Determine execution order
- Cycle detection — Prevent impossible dependencies
- Impact analysis — Know what work unblocks what
- Parallelization — Find independent work streams
Two Types of Structure: Stacks vs Tracks
tk recognizes two fundamental patterns in your dependency graph:Stacks (Linear Chains)
A stack is a linear sequence where each issue depends on exactly one predecessor: Characteristics:- Sequential execution — Must be worked in order
- Coordinated review — Can be reviewed as a unit
- Merge optimization — Validate tip, fast-forward merge all
- Graphite-style — Mirrors stacked PR workflows
- Incremental feature development
- Layered refactoring (foundation → API → UI)
- Changes that must be merged in order
Parallel Tracks
A track is a group of issues that share a common root but can be worked independently: Characteristics:- Parallel execution — Can be worked simultaneously
- Independent review — Each track reviewed separately
- Merge flexibility — Merge in any order after root completes
- Feature branches that share infrastructure
- Platform-specific implementations
- Independent components of a larger system
Graph Analytics Deep Dive
tk uses several graph algorithms to help prioritize work:PageRank Priority
PageRank scores issues by their position in the dependency graph. Issues that block more downstream work get higher scores.- Each issue starts with equal “importance”
- Importance flows through dependency edges
- Issues that block many others accumulate importance
- Scores normalize to 0-100 range
| Score | Meaning |
|---|---|
| 80+ | Critical blocker, blocks significant work |
| 50-79 | Important, blocks multiple issues |
| 20-49 | Moderate impact |
| < 20 | Leaf node or low-dependency issue |
Betweenness Centrality
Measures how often an issue appears on the shortest path between other issues. High betweenness indicates a bottleneck.- Sits at a critical junction in your workflow
- Delays here cascade to multiple work streams
- May need to be split or prioritized
Critical Path
The longest chain of dependencies determines your minimum timeline. No amount of parallelization can shorten the critical path.- Identify issues on the critical path
- These are your highest-leverage optimization targets
- Breaking dependencies on critical path shortens timeline
- Monitor critical path length as a project health metric
Execution Planning
Thetk plan command generates an execution plan using topological sort:
- Maximum parallelism — All issues in a batch can be worked simultaneously
- Dependency ordering — Each batch depends only on previous batches
- Resource allocation — Match batch sizes to team capacity
Stacks + Worktrees: Graphite-Style Workflows
tk’s worktree support enables Graphite-style stacked development:The Pattern
- Detect stacks in your issue graph
- Create worktrees for each issue in the stack
- Work bottom-up from stack root to tip
- Validate at tip — run tests on the final state
- Merge all — fast-forward the entire stack
Setup
Working a Stack
Stack-Aware Hooks
tk’s hook system supports stack workflows with special variables:Combining Concepts: A Real Workflow
Here’s how all these concepts work together in a real project:1. Structure Your Work
2. Analyze the Graph
3. Execute Strategically
4. Monitor Health
Best Practices
Minimize critical path length
Minimize critical path length
The critical path determines minimum timeline. To shorten it:
- Break large issues into parallel sub-tasks
- Remove unnecessary dependencies
- Identify and optimize bottleneck issues
Use stacks for incremental features
Use stacks for incremental features
Stacks excel when:
- Changes must be reviewed/merged in order
- Each layer builds on the previous
- You want to validate the final state once
- Work can genuinely be done in parallel
- You have multiple reviewers
- Speed is more important than ordering
Balance stack depth
Balance stack depth
Deep stacks (5+ issues) have trade-offs:
- Pro: Clear progression, easy to follow
- Con: Sequential bottleneck, long merge times
Use triage daily
Use triage daily
tk triage combines all analytics into actionable recommendations:- Start sessions with
tk triage - Focus on blockers to clear first
- Quick wins maintain momentum
- Monitor health trends over time
Structure for your team size
Structure for your team size
- Solo: Deeper stacks are fine, you control the sequence
- Small team (2-4): Mix stacks and parallel tracks
- Large team (5+): Maximize parallel tracks, minimize shared stacks
Command Reference
| Command | Purpose |
|---|---|
tk plan | Parallel execution batches |
tk stacks | Detect linear chains |
tk priority | PageRank-based priorities |
tk insights | Betweenness, critical path |
tk triage | Unified recommendations |
tk dep tree <id> | Visualize dependencies |
tk worktree create <id> | Create issue worktree |