Repository navigation
Start hooks through an .mjs launcher that enables Node's compile cache - #55
Merged
bguidolim merged 3 commits intoOct 31, 2026
Merged
Conversation
bguidolim
force-pushed
the
bruno/hook-compile-cache
branch
from
October 29, 2026 00:34
4832a06 to
7320a12
Compare
bguidolim
changed the base branch from
main
to
bruno/GH-50-edit-linked-memories
October 29, 2026 00:34
bguidolim
force-pushed
the
bruno/hook-compile-cache
branch
2 times, most recently
from
October 29, 2026 09:39
5870f12 to
65faaa7
Compare
- Each registered hook runs a small .mjs that calls enableCompileCache and imports its .mts, cutting ~30 ms of type stripping per start - The .mts modules install as plain file components; a contract test keeps every node registration on .mjs
bguidolim
force-pushed
the
bruno/hook-compile-cache
branch
from
October 30, 2026 00:06
65faaa7 to
fe54e41
Compare
- Launchers feature-detect module.enableCompileCache, which Node added in 22.8 - Node 22.6 and 22.7 now load the hooks without the cache instead of failing to link
- Launcher comments and CLAUDE.md: Node 22 caches only the compile step
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every hook start strips the TypeScript types before running, which costs about 30 ms regardless of file size. That cost is paid on every prompt, every Write/Edit, every memory retrieval and every Read. Each registered hook is now a small plain-JS launcher that enables Node's compile cache and then loads the TypeScript module, so stripping happens once per file version instead of on every start. Measured on an installed layout: 89 ms → 57 ms per run.
The TypeScript modules still install as before; only the registered entry points change from
.mtsto.mjs, andmcs syncreplaces the old registrations.Stacked on #54; review and merge that first.
Test plan
mcs sync, thenmcs doctor→ expect hooks registered askb-gate.mjs,kb-usage.mjsandsync-memories.mjs, no leftover.mtsregistrations