Skip to content

feat(hooks): add per-hook auto-save controls - #2295

Open
MichaelWave369 wants to merge 1 commit into
MemPalace:developfrom
MichaelWave369:feat/per-hook-auto-save-2294
Open

feat(hooks): add per-hook auto-save controls#2295
MichaelWave369 wants to merge 1 commit into
MemPalace:developfrom
MichaelWave369:feat/per-hook-auto-save-2294

Conversation

@MichaelWave369

Copy link
Copy Markdown

Closes #2294.

Keeps the existing hooks.auto_save / MEMPALACE_HOOKS_AUTO_SAVE behavior as the master switch and adds independent per-hook opt-outs in config.json:

{
  "hooks": {
    "stop": false,
    "pre_compact": true,
    "session_end": true
  }
}

Behavior:

  • omitted per-hook keys default to enabled, so existing configs are unchanged;
  • master auto_save: false still disables all auto-save hooks;
  • an environment master override still composes with the per-hook settings;
  • non-boolean per-hook values do not silently disable capture;
  • disabling SessionEnd still preserves its existing per-session save-marker cleanup.

The new check lives at the existing hook dispatcher, so a disabled hook returns before its Stop / PreCompact / SessionEnd handler performs checkpoint or mining work. The existing handler-level master-switch behavior remains unchanged.

Regression coverage in tests/test_per_hook_auto_save.py pins:

  • default enablement;
  • independent per-hook controls;
  • master-switch precedence;
  • environment-master precedence;
  • malformed per-hook values;
  • Stop and PreCompact dispatch short-circuiting;
  • SessionEnd cleanup while disabled;
  • normal dispatch when enabled.

Static branch verification against current develop (639c69a):

  • one commit ahead, zero behind;
  • two changed files;
  • runtime change in mempalace/hooks_cli.py: +45 / -0;
  • standalone focused regression test file added.

I was not able to execute the project test suite in the current contributor environment, so I am leaving execution to upstream CI rather than claiming a local pass I did not perform.

@igorls igorls added enhancement New feature or request area/hooks Claude Code hook scripts (Stop, PreCompact, SessionStart) labels Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/hooks Claude Code hook scripts (Stop, PreCompact, SessionStart) enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-hook mining configuration for MemPalace auto-save

2 participants