Skip to content

Document the worktree-based PR investigation model in architecture docs #156

@ooloth

Description

@ooloth

Why

A developer adding a new investigation type will not understand why investigations run in a separate worktree rather than the current directory, and may implement one that doesn't work correctly.

Current state

The worktree-based PR investigation flow — bare repo cloned to ~/.hub/repos/, PR fetched to a subdirectory, Claude launched there with cwd set to the worktree — is only partially explained in source comments. No architecture doc or TUI README describes this as a system. ui/tui/src/investigations/mod.rs contains the implementation but no prose explanation of the design.

Ideal state

  • A section in docs/architecture/ or the TUI README explains the worktree model as a system:
    • Bare repos are cloned by hub fetch to ~/.hub/repos/
    • PR worktrees are created on demand at investigation time as subdirectories
    • cwd is set to the worktree before launching Claude
    • Why this model was chosen (isolation, no interference with the user's working tree)

Out of scope

Changing the worktree implementation.

Starting points

  • ui/tui/src/investigations/mod.rs — worktree creation and cwd setup
  • workflows/src/implement.rs — bare repo and worktree interaction
  • docs/architecture/ — target location for the new section

QA plan

  1. Open the relevant architecture doc or TUI README — expect a prose section describing the worktree model with the four points above.
  2. A developer reading only that section should be able to implement a new investigation type that correctly sets cwd to a worktree path.

Done when

docs/architecture/ or the TUI README contains a section that explains the worktree model well enough that a developer can implement a new investigation type without reading investigation source code.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions