Component: PAI/TOOLS/KnowledgeHarvester.ts (memory → KNOWLEDGE graduation tool, v5)
Affected source: Releases/v5.0.0/.claude/PAI/TOOLS/KnowledgeHarvester.ts @ 2fde1bb
Severity: High on Linux — the tool runs, exits 0, and graduates nothing. Silent total failure.
Summary
On Linux, KnowledgeHarvester reads auto-memory notes from a hardcoded macOS path
(-Users-${USER}--claude). That directory never exists on Linux (the real slug is
-home-${USER}--claude), so the source directory is missing, the scan returns empty, and
zero memory notes ever graduate to MEMORY/KNOWLEDGE/ — with no error and a success exit code.
Bug — Hardcoded macOS auto-memory path
Lines 39–45:
const CURRENT_USER = process.env.USER;
if (!CURRENT_USER) {
// ...guard...
}
const AUTO_MEMORY_DIR = path.join(HOME, ".claude", "projects",
`-Users-${CURRENT_USER}--claude`, "memory");
Root cause: the slug -Users-${CURRENT_USER}--claude is the macOS form of the ~/.claude path
(/Users/<name>/.claude). On Linux the home is /home/<name>, so the real auto-memory directory is
…/projects/-home-<name>--claude/memory. The hardcoded slug points at a path that does not exist on Linux.
Expected: the harvester resolves the auto-memory directory from the actual ~/.claude path on any platform.
Actual (Linux): fs.existsSync(AUTO_MEMORY_DIR) is false → collectAutoMemory() returns [] →
no candidates → graduation count is 0, exit 0, no warning.
Impact: the memory→KNOWLEDGE graduation pipeline is a silent no-op on every Linux PAI v5 install.
(Pre-v5 installs do not ship KnowledgeHarvester at all — it is a v5-only tool — so this is a v5-Linux
regression, not a historical bug.) Because it fails silently with a success exit code, it reads as
"nothing to graduate" rather than "broken."
Proposed fix
Derive the slug from the live ~/.claude path — the same cross-platform pattern the sibling
SessionHarvester.ts already uses in this release (see Related below) — and drop the now-unused
CURRENT_USER guard:
const AUTO_MEMORY_SLUG = path.join(HOME, ".claude").replace(/[\/\.]/g, "-");
const AUTO_MEMORY_DIR = path.join(HOME, ".claude", "projects", AUTO_MEMORY_SLUG, "memory");
This yields -Users-<name>--claude on macOS and -home-<name>--claude on Linux from the same code.
Verification (two independent Linux installs)
- Install A — Linux, PAI 5.x (empirical): with the fix applied, all 23 local auto-memory notes
graduated successfully where the unpatched tool graduated 0.
- Install B — Linux (Ubuntu), PAI 4.0.3 (path-derivation corroboration):
KnowledgeHarvester.ts
is not present on this 4.0.3 install (v5-only tool), so this is not a harvest reproduction.
What was checked: the real auto-memory dir on this host is .../projects/-home-<user>--claude/memory
(confirmed to exist); the buggy upstream slug resolves to -Users-<user>--claude, which does not
exist on this Linux host; the proposed fix's slug-derivation resolves to -home-<user>--claude,
matching the real directory. Independently corroborates the Linux slug mismatch and confirms the fix
yields the correct path on a second Linux box.
Related issues & precedent
Suggested labels
bug, platform:linux, tool:KnowledgeHarvester
Component:
PAI/TOOLS/KnowledgeHarvester.ts(memory → KNOWLEDGE graduation tool, v5)Affected source:
Releases/v5.0.0/.claude/PAI/TOOLS/KnowledgeHarvester.ts@2fde1bbSeverity: High on Linux — the tool runs, exits 0, and graduates nothing. Silent total failure.
Summary
On Linux,
KnowledgeHarvesterreads auto-memory notes from a hardcoded macOS path(
-Users-${USER}--claude). That directory never exists on Linux (the real slug is-home-${USER}--claude), so the source directory is missing, the scan returns empty, andzero memory notes ever graduate to
MEMORY/KNOWLEDGE/— with no error and a success exit code.Bug — Hardcoded macOS auto-memory path
Lines 39–45:
Root cause: the slug
-Users-${CURRENT_USER}--claudeis the macOS form of the~/.claudepath(
/Users/<name>/.claude). On Linux the home is/home/<name>, so the real auto-memory directory is…/projects/-home-<name>--claude/memory. The hardcoded slug points at a path that does not exist on Linux.Expected: the harvester resolves the auto-memory directory from the actual
~/.claudepath on any platform.Actual (Linux):
fs.existsSync(AUTO_MEMORY_DIR)is false →collectAutoMemory()returns[]→no candidates → graduation count is 0, exit 0, no warning.
Impact: the memory→KNOWLEDGE graduation pipeline is a silent no-op on every Linux PAI v5 install.
(Pre-v5 installs do not ship
KnowledgeHarvesterat all — it is a v5-only tool — so this is a v5-Linuxregression, not a historical bug.) Because it fails silently with a success exit code, it reads as
"nothing to graduate" rather than "broken."
Proposed fix
Derive the slug from the live
~/.claudepath — the same cross-platform pattern the siblingSessionHarvester.tsalready uses in this release (see Related below) — and drop the now-unusedCURRENT_USERguard:This yields
-Users-<name>--claudeon macOS and-home-<name>--claudeon Linux from the same code.Verification (two independent Linux installs)
graduated successfully where the unpatched tool graduated 0.
KnowledgeHarvester.tsis not present on this 4.0.3 install (v5-only tool), so this is not a harvest reproduction.
What was checked: the real auto-memory dir on this host is
.../projects/-home-<user>--claude/memory(confirmed to exist); the buggy upstream slug resolves to
-Users-<user>--claude, which does notexist on this Linux host; the proposed fix's slug-derivation resolves to
-home-<user>--claude,matching the real directory. Independently corroborates the Linux slug mismatch and confirms the fix
yields the correct path on a second Linux box.
Related issues & precedent
AUTO_MEMORY_DIRline from a different angle — per-project memorydirs invisible / single-PAI-instance scope — and quotes the
-Users-${USER}--claudeslug as-is. Thisissue is the platform dimension: on Linux that slug resolves to a path that does not exist, so the
harvester silently graduates nothing. The glob-based fix proposed in KnowledgeHarvester is single-PAI-instance — per-project memory dirs (~/.claude/projects/<slug>/memory/) invisible without PAI_DIR override #1170 would incidentally resolve
this too; filing separately so the Linux-platform symptom is tracked and linkable.
SessionHarvester.ts.SessionHarvester.ts(lines 33–36) alreadyderives the slug cross-platform (
CLAUDE_DIR.replace(/[\/\.]/g, "-"), with an explicit macOS/Linuxcomment), while
KnowledgeHarvester.ts(lines 39–45) hardcodes-Users-. The fix simply bringsKnowledgeHarvesterin line with its sibling.classifyDomainprecision bug found and fixedin the same pass.
Suggested labels
bug,platform:linux,tool:KnowledgeHarvester