Skip to content

Fix configured memory path normalization#44

Merged
chandra447 merged 3 commits into
mainfrom
codex/fix-issue-42-path-normalization
May 21, 2026
Merged

Fix configured memory path normalization#44
chandra447 merged 3 commits into
mainfrom
codex/fix-issue-42-path-normalization

Conversation

@chandra447
Copy link
Copy Markdown
Owner

Summary

Fixes the memoryDir: "~/.pi/agent/pi-hermes-memory" config bug from #42 by normalizing configured storage paths before startup uses them.

What changed

  • expand and normalize memoryDir during config loading so ~ resolves to the user home directory instead of becoming a literal repo-local path
  • resolve relative memoryDir values against ~/.pi/agent so config behavior is stable and not dependent on the current working directory
  • centralize path normalization in a new helper module for extension storage paths
  • keep projectsMemoryDir constrained to a single safe directory segment under ~/.pi/agent, which matches the existing config contract and avoids opening a partially supported nested-path mode
  • make startup migration and Markdown-to-SQLite sync use the Pi agent root explicitly instead of inferring it from memoryDir, so custom global memory roots do not break legacy project migration or project memory discovery
  • add regression tests for ~ expansion, relative path normalization, unsafe projectsMemoryDir rejection, and the custom-global-root migration/sync behavior

Verification

  • npm run check
  • npx tsx --test tests/config.test.ts
  • npx tsx --test tests/project-memory-migration.test.ts
  • independent subagent review of the uncommitted diff, followed by a follow-up fix for the only finding around nested projectsMemoryDir handling

Notes

  • Full npm test is still blocked in this environment by the existing better-sqlite3 vs Node ABI mismatch in SQLite-backed tests; this branch does not introduce a new path-related test failure there.

Fixes #42

@chandra447 chandra447 merged commit 5ae8d76 into main May 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"~" in memoryDir is not expanded - creates structure in repo instead of ~/

1 participant