-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Regression: worktree observations still tagged with worktree dir name in v10.6.2 #1500
Description
Description
The worktree project name bug reported in #1081 (fixed in v9.x) and #1317 (fixed in v10.5.5) has regressed. On v10.6.2, observations are still stored under the worktree directory name instead of the parent repository name, and every new worktree session shows "No previous sessions found."
Environment
- claude-mem version: 10.6.2 (installed 2026-03-24)
- Platform: macOS (Darwin 25.4.0)
- Claude Code CLI
Worktree layout
My worktrees live inside the main repo under a .worktrees/ directory (excluded via .git/info/exclude):
/Users/me/git/myproject/ ← main repo (git toplevel)
├── .git/ ← real .git directory
│ ├── info/exclude ← contains "/.worktrees/"
│ └── worktrees/
│ ├── noble-hare/ ← git worktree metadata
│ ├── jolly-condor/
│ └── ...
├── .worktrees/ ← excluded from git
│ ├── noble-hare/ ← worktree checkout (cwd when using Claude Code)
│ │ └── .git ← file: "gitdir: /Users/me/git/myproject/.git/worktrees/noble-hare"
│ ├── jolly-condor/
│ └── ...
├── src/
└── ...
Key details:
- Worktrees are created inside the repo:
git worktree add .worktrees/noble-hare .worktrees/is in.git/info/excludeso it doesn't show up ingit status- The
.gitfile in each worktree correctly points to the main repo's.git/worktrees/<name> git rev-parse --git-common-dirfrom any worktree correctly returns the main repo's.git
Evidence
Every distinct project name in my database is a worktree name — the parent repo name rewrite never appears:
sqlite> SELECT DISTINCT project FROM observations ORDER BY project;
-- Returns: csharp-typed-capture-generics, deft-marmot, noble-iguana, ...
-- Never: rewriteEvery new worktree session starts with "No previous sessions found" because it queries for observations where project = '<new-worktree-name>'.
Root cause (still)
The context-generator.cjs function that determines the project name still falls through to path.basename(cwd) in certain code paths. From the minified source in v10.6.2:
function fe(r) {
if (!r || r.trim() === "") return "unknown-project";
let e = path.basename(r);
// ...
return e;
}The worktree-aware detection function exists and works for SessionStart context injection, but observation storage, search API defaults, and the "No previous sessions" check still use basename(cwd).
Expected behavior
- Observations from all worktrees should be stored under the parent repo project name (
rewrite) - Search from any worktree should find observations from all worktrees of the same repo
- Session start should find previous sessions regardless of which worktree they ran in
Workaround
Manually passing project="rewrite" in search calls, or retroactively fixing with:
UPDATE observations SET project = 'rewrite'
WHERE project IN ('noble-hare', 'jolly-condor', ...);Related issues
- Bug: Worktree observations tagged with worktree dir name instead of parent project #1081 — same bug, closed as fixed in v9.x (Feb 2026)
- Search API and observation storage ignore worktree parent project name #1317 — same bug, closed as fixed in v10.5.5 (Mar 2026)
- Feature: Promote worktree observations to parent project after PR merge #1462 — feature request for promoting worktree observations after PR merge (open)