Problem
All hook scripts in .claude-plugin/hooks/ and the MCP server definition in plugin.json call bare python3:
Hooks (mempal-stop-hook.sh, mempal-precompact-hook.sh):
echo "$INPUT" | python3 -m mempalace hook run --hook stop --harness claude-code
MCP server (plugin.json):
"mcpServers": {
"mempalace": {
"command": "python3",
"args": ["-m", "mempalace.mcp_server"]
}
}
In projects with an active Python .venv, python3 resolves to .venv/bin/python3, which doesn't have mempalace installed. This causes the stop hook to fail on every session exit:
.venv/bin/python3: No module named mempalace
The MCP server also fails to start for the same reason.
Environment
- mempalace 3.3.1 (pip) / 3.3.0 (plugin)
- Python installed via mise, mempalace installed in mise python
- Project has its own
.venv which shadows python3 in PATH
Proposed fix
Support a MEMPALACE_PYTHON environment variable with fallback to python3:
Hooks:
MEMPALACE_PYTHON="${MEMPALACE_PYTHON:-python3}"
echo "$INPUT" | "$MEMPALACE_PYTHON" -m mempalace hook run --hook stop --harness claude-code
plugin.json: Harder to fix since JSON is static. Options:
- A wrapper script (
mempalace-run) that reads MEMPALACE_PYTHON
- Document that users with venvs need to set
MEMPALACE_PYTHON in Claude Code settings.json → env
This lets users set MEMPALACE_PYTHON in Claude Code's settings.json → env to point to the python where mempalace is installed, without affecting other hooks or tools.
Problem
All hook scripts in
.claude-plugin/hooks/and the MCP server definition inplugin.jsoncall barepython3:Hooks (
mempal-stop-hook.sh,mempal-precompact-hook.sh):MCP server (
plugin.json):In projects with an active Python
.venv,python3resolves to.venv/bin/python3, which doesn't havemempalaceinstalled. This causes the stop hook to fail on every session exit:The MCP server also fails to start for the same reason.
Environment
.venvwhich shadowspython3in PATHProposed fix
Support a
MEMPALACE_PYTHONenvironment variable with fallback topython3:Hooks:
plugin.json: Harder to fix since JSON is static. Options:
mempalace-run) that readsMEMPALACE_PYTHONMEMPALACE_PYTHONin Claude Codesettings.json→envThis lets users set
MEMPALACE_PYTHONin Claude Code'ssettings.json→envto point to the python where mempalace is installed, without affecting other hooks or tools.