Agent Integration

Worktrunk ships a plugin for each supported agent CLI. What a plugin provides depends on the hooks that CLI exposes:

CapabilityClaude CodeCodexOpenCodeGemini CLI
Configuration skillβœ“βœ“βœ“
Activity tracking (πŸ€–/πŸ’¬ in wt list)βœ“βœ“βœ“
Worktree isolationβœ“
/wt-switch-create commandβœ“

The configuration skill is documentation the agent reads to help set up LLM commits, hooks, and troubleshooting. Activity tracking shows which worktrees have running sessions. Worktree isolation and /wt-switch-create need worktree-lifecycle hooks that only Claude Code exposes, so Codex, OpenCode, and Gemini users invoke wt switch --create and wt remove directly. Codex omits activity tracking because its hooks have no turn-end event, so a πŸ€– marker could never clear back to πŸ’¬.

Installation

Claude Code

wt config plugins claude install

Manual equivalent:

claude plugin marketplace add max-sixty/worktrunk
claude plugin install worktrunk@worktrunk

Codex

wt config plugins codex install

This configures the Worktrunk marketplace in Codex. Then run /plugins in Codex and install Worktrunk from the marketplace. Manual equivalent:

codex plugin marketplace add max-sixty/worktrunk

To remove the marketplace entry, run wt config plugins codex uninstall. Already-installed plugins are left unchanged.

OpenCode

wt config plugins opencode install

This writes the activity-tracking plugin to OpenCode's global plugins directory, ~/.config/opencode/plugins/worktrunk.ts (honoring $OPENCODE_CONFIG_DIR and $XDG_CONFIG_HOME). wt config plugins opencode uninstall removes it.

Gemini CLI

gemini extensions install https://github.com/max-sixty/worktrunk

Gemini loads the extension natively from the repository, so there is no wt wrapper. gemini extensions uninstall worktrunk removes it.

Configuration skill

The plugin includes a skill β€” documentation the agent can read β€” covering Worktrunk's configuration system. After installation, the agent can help with:

Claude Code is designed to load the skill automatically when it detects worktrunk-related questions.

Activity tracking

The Claude Code, OpenCode, and Gemini plugins track agent sessions with status markers in wt list:

wt list
  Branch       Status        HEADΒ±    main↕  Remoteβ‡…  Path                 Commit    Age   Message
@ main             ^⇑                         ⇑1      .                    33323bc1  1d    Initial commit
+ feature-api      ↑ πŸ€–              ↑1               ../repo.feature-api  70343f03  1d    Add REST API endpoints
+ review-ui      ? ↑ πŸ’¬              ↑1               ../repo.review-ui    a585d6ed  1d    Add dashboard component
+ wip-docs       ? –                                  ../repo.wip-docs     33323bc1  1d    Initial commit

β—‹ Showing 4 worktrees, 2 with changes, 2 ahead

The plugin clears the marker when a session ends. A stale marker can remain if the agent process is killed before its session-end hook runs; wt config state marker clear removes a marker manually.

Manual status markers

Set status markers manually for any workflow:

wt config state marker set "🚧"                   # Current branch
wt config state marker set "βœ…" --branch feature  # Specific branch
git config worktrunk.state.feature.marker '{"marker":"πŸ’¬","set_at":0}'  # Direct

Worktree isolation (Claude Code only)

Claude Code agents can run in isolated worktrees (isolation: "worktree"). By default, Claude Code creates these with git worktree add. The plugin's WorktreeCreate and WorktreeRemove hooks route this through wt switch --create and wt remove instead, so worktrees created by agents get worktrunk's naming conventions, hooks, and lifecycle management.

/wt-switch-create command (Claude Code only)

/wt-switch-create <branch> [<repo>] [-- <task>] starts work in a fresh worktree without leaving the session. It creates (or re-enters) the named worktrunk worktree β€” sibling layout <repo>.<branch>/, not .claude/worktrees/ β€” switches the session's working directory into it, then runs the task there. An optional second token names a different repository to create the worktree in; the task is whatever follows -- (or, with no --, whatever follows the branch). The command rides the same WorktreeCreate hook as agent isolation, so the worktree gets worktrunk's naming, hooks, and lifecycle.

On session exit the worktree is offered for removal via the WorktreeRemove hook; one with uncommitted changes is kept rather than removed.

Statusline (Claude Code only)

wt list statusline --format=claude-code outputs a single-line status for the Claude Code statusline. When the CI status cache is stale, this fetches from the network β€” typically 1–2 seconds β€” making it suitable for async statuslines but too slow for synchronous shell prompts. If a faster version would be helpful, please open an issue.

~/w/myproject.feature-auth !πŸ€– @+42 -8 ↑3 ⇑1 ● | Opus πŸŒ” 65%

When Claude Code provides context window usage via stdin JSON, a moon phase gauge appears (πŸŒ•β†’πŸŒ‘ as context fills).

Claude Code statusline demo

Add to ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "wt list statusline --format=claude-code"
  }
}