Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

docs(list): correct the module docstring's claim that wt list caches nothing but the default branch (#3957)

Worktrunk Botf0d14a3388ca
diff --git a/src/commands/list/mod.rs b/src/commands/list/mod.rs
index e536c0e26..65acaccba 100644
--- a/src/commands/list/mod.rs
+++ b/src/commands/list/mod.rs
@@ -3,7 +3,9 @@
//! # Performance
//!
//! `wt list` runs multiple git commands per worktree in parallel using Rayon. Performance
-//! depends heavily on git's internal caches, not worktrunk-specific caching.
+//! depends heavily on git's internal caches, and — for the commit-graph-derived commands —
+//! on worktrunk's own on-disk caches, which elide those commands entirely on a warm cache
+//! (see "Worktrunk's Own Caches" below).
//!
//! ## Time to First Information
//!
@@ -98,14 +100,19 @@
//! - `git gc` consolidates loose objects into packs
//! - More efficient for tree/blob access in diffs
//!
-//! ## Worktrunk's Only Cache: Default Branch
+//! ## Worktrunk's Own Caches
//!
-//! Worktrunk caches only the default branch name (main/master) in
+//! The default branch name (main/master) is cached in
//! `git config worktrunk.default-branch`. The remote HEAD ref (e.g., `origin/HEAD`)
-//! is git's cache; worktrunk reads it but does not set it. All other data is fetched
-//! fresh on each `wt list` invocation.
-//!
-//! Clear cache with: `wt config state default-branch clear`
+//! is git's cache; worktrunk reads it but does not set it. Clear it with
+//! `wt config state default-branch clear`.
+//!
+//! A collect also reads and writes the on-disk caches under `.git/wt/cache/`, so some of the
+//! per-worktree git commands above — the ahead/behind counts and the branch line diff — are
+//! what a *cold* cache costs, while `git status` and the working-tree diff run on every
+//! invocation regardless. The authoritative inventory — every directory, its key scheme, and
+//! when an entry goes stale — is the `## Caching` table in [`collect`]; don't restate it
+//! here. Clear those with `wt config state cache clear`.
//!
//! ## Performance Characteristics
//!