feat(hooks): independent precompact toggle via config + env var#1346
Open
rusel95 wants to merge 1 commit intoMemPalace:developfrom
Open
feat(hooks): independent precompact toggle via config + env var#1346rusel95 wants to merge 1 commit intoMemPalace:developfrom
rusel95 wants to merge 1 commit intoMemPalace:developfrom
Conversation
Adds hooks.precompact boolean (default true). Setting false lets /compact
proceed without the pre-compaction mine, independent of save_interval.
Config (~/.mempalace/config.json):
{"hooks": {"precompact": false}}
Env var (takes precedence):
MEMPALACE_HOOKS_PRECOMPACT=false
Disabling save_interval does NOT disable precompact and vice versa.
Closes MemPalace#949. Closes MemPalace#906.
24369d1 to
4d00b81
Compare
Author
✅ End-to-end testing completedVerified against the real Tests verified:
This is the critical test — it proves the two controls are truly independent. Disabling periodic saves does not silently disable the last-chance save before compaction. Full suite: 0 regressions. |
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.
🚫 The problem
You are in a long session. Context fills up. You type
/compact. Nothing happens.The precompact hook is blocking compaction. You cannot disable it without also disabling the stop hook. You are stuck.
This was the #1 reported issue after the initial precompact hook shipped. PR #863 fixed the hard-block by making precompact always return
{}— but that dropped the save nudge entirely. Users now get no signal that compaction is imminent.✅ What this does
Adds an independent toggle for the precompact hook:
# Or via env var MEMPALACE_HOOKS_PRECOMPACT=falseWhen disabled,
/compactproceeds immediately — no mine, no delay.🔑 Why independent controls matter
Disabling
save_intervaldoes not disable precompact. Disablingprecompactdoes not disable the stop hook. They are independent by design — so you can fix one without breaking the other.🧪 Tests
All 104 existing hook and config tests pass.
Depends on: #1345 (save_interval config, same config.py property pattern)
Closes #949. Closes #906.