setup-hooks --platform=codex does not copy _memoryFiltering.js, so session-start fails with MODULE_NOT_FOUND
Summary
After a fresh official Codex install flow, the generated session-start hook fails immediately because _memoryFiltering.js is required but not copied into .codex/hooks/.
Environment
- OS: Windows
- Host: Codex
- package:
@evomap/[email protected] - install path: global npm install
What I did
npm uninstall -g @evomap/evolvernpm cache clean --forcenpm install -g @evomap/[email protected] --prefer-online --no-audit- In a fresh git repo, ran:
evolver setup-hooks --platform=codex
- Ran the generated hook directly:
node .codex/hooks/evolver-session-start.js
Actual behavior
It fails with:
Error: Cannot find module './_memoryFiltering'
Why this happens
The generated evolver-session-start.js contains:
const { filterRelevantOutcomes } = require('./_memoryFiltering');
but setup-hooks --platform=codex only copied these files into .codex/hooks/ in my fresh install:
_runtimePaths.jsevolver-session-start.jsevolver-signal-detect.jsevolver-session-end.js
So the default generated hook cannot run successfully.
Expected behavior
Either:
_memoryFiltering.jsshould also be copied alongside the generated hooks, orevolver-session-start.jsshould not require a local helper file that is not installed with the hook set.
Notes
This was reproduced on a clean official-path setup without local source patching or manual file injection.
@rendigua Thanks for the clean reproduction — the “what I did / actual / expected” breakdown made the bug class identifiable in a single read.
Confirmed root cause
evolver-session-start.js requires ./_memoryFiltering at the top of the file.
The helper itself exists in the package at:
src/adapters/scripts/_memoryFiltering.js
But setup-hooks uses an explicit allowlist when copying files into .codex/hooks/, and _memoryFiltering.js was never added to that list after the require landed.
PR #94 review previously caught the same class of issue when _runtimePaths.js was introduced — this is the second occurrence of that exact pattern.
So your option (1) — “should also be copied alongside the generated hooks” — is the correct diagnosis.
The require path itself is valid; the install/copy side simply drifted out of sync with the runtime dependencies of the generated hook.
Fix direction
The next release will:
-
Add
_memoryFiltering.jsto:- the install copy list
- the uninstall cleanup list
so a fresh:
setup-hooks --platform=codex
produces a runnable hook out of the box.
-
Add a regression guard that:
- scans every
require('./_xxx')inside adapter scripts - asserts each referenced helper exists in both the copy and cleanup manifests
- scans every
This means future helper additions that are forgotten in the allowlist will fail pre-publish tests instead of shipping silently.
Workaround until the next release
After running setup-hooks, manually copy the missing helper:
# Find your evolver install
EVOLVER_PKG="$(dirname "$(node -e "console.log(require.resolve('@evomap/evolver/package.json'))")")"
# Copy the missing helper into the hook directory
cp "$EVOLVER_PKG/src/adapters/scripts/_memoryFiltering.js" .codex/hooks/
# Verify the hook now runs
node .codex/hooks/evolver-session-start.js < /dev/null
That mirrors exactly what the fixed setup-hooks implementation will do automatically.
I also re-checked _runtimePaths.js and _memoryFiltering.js for transitive require('./...') dependencies — there are no additional missing helper files beyond this one.
Progress
Fix PR is currently under review. I’ll ping back here once it lands on npm.
And re-confirming: the clean-install validation flow you used:
uninstall → cache clean --force → install --prefer-online → setup-hooks
is exactly the correct way to test fresh-install behavior, and the artifact snapshot you posted is extremely useful as a pre-fix reference for future reviewers.
Thanks again.
Fixed and shipped. As of v1.87.2, setup-hooks copies _memoryFiltering.js alongside the generated hooks — I verified the published tarball: copyHookScripts (and removeHookScripts) now include _memoryFiltering.js, so the generated evolver-session-start.js can require('./_memoryFiltering') without MODULE_NOT_FOUND.
Please:
npm uninstall -g @evomap/evolver
npm i -g @evomap/evolver@latest # 1.87.2
evolver setup-hooks --platform=codex
node .codex/hooks/evolver-session-start.js
Thanks for the clean repro — the what-I-did / actual / expected breakdown made this a one-read fix. Closing as resolved; reopen if it still repros on 1.87.2.