Skip to content

fix: resolve python path in hooks + document restart requirement - #740

Closed
milla-jovovich wants to merge 1 commit into
developfrom
fix/hook-bugs
Closed

fix: resolve python path in hooks + document restart requirement#740
milla-jovovich wants to merge 1 commit into
developfrom
fix/hook-bugs

Conversation

@milla-jovovich

Copy link
Copy Markdown
Collaborator

Summary

  • Fix bare python3 in background calls in both hook scripts — nohup strips PATH so python3 can resolve to system python missing mempalace packages
  • Document the known limitation that hooks require session restart after install

What was happening

In long sessions, the mempal_save_hook.sh background ingest (python3 -m mempalace mine) would silently fail with ModuleNotFoundError because nohup resolved python3 to a different install. Fix: resolve $(command -v python3) before the call.

Files changed

  • hooks/mempal_save_hook.sh — resolve python path before background mine
  • hooks/mempal_precompact_hook.sh — same fix for sync mine call
  • hooks/README.md — added "Known Limitations" section about session restart

Test plan

  • $(command -v python3) resolves correctly and has packages
  • Existing hook logic unchanged — only the python invocation method changed
  • README documents the restart requirement

Thank you from Milla and Lu✨

Bugs fixed:
- mempal_save_hook.sh: bare `python3` in background ingest can resolve
  to system python missing mempalace packages. Now resolves path first.
- mempal_precompact_hook.sh: same bare python3 bug in sync ingest call.

Discovered in production: nohup strips PATH, background `python3` can
point to a different install than the one with sentence_transformers
and chromadb. Fix: $(command -v python3) before the call.

Docs:
- Added "Known Limitations" section to hooks README documenting that
  hooks require a session restart after install (Claude Code loads
  settings.json once at startup).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@milla-jovovich

Copy link
Copy Markdown
Collaborator Author

Closing — Ben correctly identified these fixes don't apply to v3.1. The public hooks use python3 -m mempalace mine (package entry point, no PATH issue) while the private version uses python3 mempal.py mine (direct script, hits the nohup PATH bug). The restart documentation is still valid but can go in a separate docs PR if needed. Thank you from Milla and Lu✨

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.

1 participant