feat: symlink root CLAUDE.md into each worktree on create#106
Conversation
`bough create` cd-targets are launched via `claude --worktree`, which cd's into the worktree root — a non-git container whose git walk-up cannot reach the monorepo root. So the root CLAUDE.md never loaded for a worktree session: the session started with no project guidance at all. Mirror the existing linkWorktreeSkills step: link <worktreeRoot>/CLAUDE.md -> <monorepoRoot>/CLAUDE.md (absolute) in create step 5b, reusing the ensureSymlink helper. Best-effort and only when the monorepo root has a regular-file CLAUDE.md; a hand-authored real file already in the worktree is left untouched (ensureSymlink refuses to clobber a non-symlink). Adds TestLinkWorktreeClaudeMd (create + no-op-when-missing + real-file guard).
| // git walk-up cannot reach the monorepo root — so without explicit symlinks | ||
| // the worktree session would load neither the root CLAUDE.md nor the project | ||
| // skills. Both best-effort. | ||
| linkWorktreeClaudeMd(stderr, monorepoRoot, worktreeRoot) |
There was a problem hiding this comment.
Retrospective review: this wires linkWorktreeClaudeMd into bough create only, the same shape as issue #61 — which PR #112 had to fix for linkWorktreeArtifacts by relinking every discovered worktree dir in runBackfill too. That artifacts fix landed after this PR merged but didn't extend to CLAUDE.md, so bough backfill (the documented non-destructive repair command) never relinks a worktree's CLAUDE.md — any worktree bootstrapped before this feature shipped, or created outside bough create, keeps starting every Claude session with no root guidance indefinitely. Symlink mechanics themselves (absolute target, idempotent repoint, real-file guard, missing-root no-op) all checked out fine. Fixed in PR #117, which adds the equivalent linkWorktreeClaudeMd call to runBackfill.
fix: retrospective review fixes for merged PR #106
bough createtargets are launched viaclaude --worktree, which cd's into theworktree root — a non-git container whose git walk-up cannot reach the monorepo
root. So the root
CLAUDE.mdnever loaded for a worktree session; it startedwith no project guidance at all.
Mirror the existing
linkWorktreeSkillsstep (5b): link<worktreeRoot>/CLAUDE.md -> <monorepoRoot>/CLAUDE.md(absolute), reusing theensureSymlinkhelper. Only when the monorepo root has a regular-fileCLAUDE.md; a hand-authored real file already in the worktree is left untouched.go build/golangci-lintinternal/ cmd/ pkg/)bough createe2eNew test:
TestLinkWorktreeClaudeMd(create + missing-root no-op + real-file guard).