feat(worktree): include parent repo observations in worktree read scope
Worktrees are branches off main; the parent holds the architecture, decisions, and long-tail history the worktree inherits. Scoping reads to the worktree alone meant every new worktree started cold on any question that required prior context. Expand `allProjects` in a worktree to `[parent, composite]` so reads pull both. Writes still go through `.primary` (the composite), so sibling worktrees don't leak into each other. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -64,7 +64,9 @@ export interface ProjectContext {
|
||||
parent: string | null;
|
||||
/** True if currently in a worktree */
|
||||
isWorktree: boolean;
|
||||
/** Projects to query — always `[primary]` so observations don't cross worktrees */
|
||||
/** Projects to query for reads. In a worktree: `[parent, composite]` so
|
||||
* main-repo context flows into every worktree while sibling worktrees stay
|
||||
* isolated. In the main repo: `[primary]`. Writes always use `.primary`. */
|
||||
allProjects: string[];
|
||||
}
|
||||
|
||||
@@ -96,7 +98,7 @@ export function getProjectContext(cwd: string | null | undefined): ProjectContex
|
||||
primary: composite,
|
||||
parent: worktreeInfo.parentProjectName,
|
||||
isWorktree: true,
|
||||
allProjects: [composite]
|
||||
allProjects: [worktreeInfo.parentProjectName, composite]
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user