fix(indexer): derive project_path from message cwd instead of slug decoding

The old slug-to-path conversion (replace hyphens with slashes) was
  lossy and wrong for paths containing hyphens. Now infers project_path
  from the most-frequent observed cwd across session messages, falling
  back to slug decoding only when no cwd data exists. Adds
  refreshSessionProjectPaths() to backfill existing sessions on rebuild.
This commit is contained in:
tommy0103
2026-06-10 03:15:32 +08:00
parent 807e5141fa
commit 10b51d8878
3 changed files with 52 additions and 9 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ Project-like fields are distinct:
- `sessions.project`: stored Claude Code project slug.
- `memories.project`: stored project slug copied onto registered memory records.
- `sessions.project_path`: reconstructed absolute project path.
- `sessions.project_path`: absolute session path derived from message `cwd` when available; slug decoding is only a fallback.
- `messages.cwd`: working directory at message time.
- helper `project`: SQL `LIKE` over `sessions.project`, not exact membership.