Skip to main content
This guide explains how tk’s graph analytics, stacks, parallel tracks, and worktrees work together to enable sophisticated development workflows. Understanding these concepts helps you structure work for maximum parallelization and efficient merge queues.

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
Use stacks for:
  • 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
Use tracks for:
  • 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.
How it works:
  1. Each issue starts with equal “importance”
  2. Importance flows through dependency edges
  3. Issues that block many others accumulate importance
  4. Scores normalize to 0-100 range
Interpretation:

Betweenness Centrality

Measures how often an issue appears on the shortest path between other issues. High betweenness indicates a bottleneck.
Why it matters: An issue with high betweenness:
  • 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.
Using critical path:
  1. Identify issues on the critical path
  2. These are your highest-leverage optimization targets
  3. Breaking dependencies on critical path shortens timeline
  4. Monitor critical path length as a project health metric

Execution Planning

The tk plan command generates an execution plan using topological sort:
Sample output:
Batches represent:
  • 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

  1. Detect stacks in your issue graph
  2. Create worktrees for each issue in the stack
  3. Work bottom-up from stack root to tip
  4. Validate at tip — run tests on the final state
  5. 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

The critical path determines minimum timeline. To shorten it:
  • Break large issues into parallel sub-tasks
  • Remove unnecessary dependencies
  • Identify and optimize bottleneck issues
Stacks excel when:
  • Changes must be reviewed/merged in order
  • Each layer builds on the previous
  • You want to validate the final state once
Avoid stacks when:
  • Work can genuinely be done in parallel
  • You have multiple reviewers
  • Speed is more important than ordering
Deep stacks (5+ issues) have trade-offs:
  • Pro: Clear progression, easy to follow
  • Con: Sequential bottleneck, long merge times
Consider splitting deep stacks into parallel tracks where possible.
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
  • 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


Next Steps

Stacks

Deep dive into linear dependency chains.

Dependencies

Managing issue dependencies.

Graph Analytics

PageRank, critical path, and metrics.

CLI Reference

Full command documentation.