Skip to content

hooks: honor silent_save for autosave hooks - #966

Closed
PostProtoroman wants to merge 1 commit into
MemPalace:developfrom
PostProtoroman:fix/silent-save-harness-routing-20260417-151515
Closed

hooks: honor silent_save for autosave hooks#966
PostProtoroman wants to merge 1 commit into
MemPalace:developfrom
PostProtoroman:fix/silent-save-harness-routing-20260417-151515

Conversation

@PostProtoroman

Copy link
Copy Markdown

Summary

  • honor hooks.silent_save by checkpointing directly from the hook runtime
  • fall back to legacy MCP blocking only when direct save fails
  • route autosave diary entries by harness so codex sessions are not misfiled as claude_code

Validation

  • python3 -m compileall mempalace/hooks_cli.py mempalace/config.py mempalace/mcp_server.py mempalace/normalize.py
  • isolated smoke test for stop and precompact silent saves on claude-code and codex

@mvalentsev

Copy link
Copy Markdown
Contributor

The core change here (honoring hook_silent_save by checkpointing directly from the hook, with fallback to block on failure) substantially overlaps with open PR #673.

#673 implements the same two-layer design: Layer 1 is a direct tool_diary_write call from the hook runtime, Layer 2 is the legacy block fallback. 486 additions across 8 files (hooks_cli.py, plugin manifests, docs, tests), currently MERGEABLE against develop.

jphein's 2026-04-16 comment on #854 frames #673 against adjacent PRs:

#673 is dirty against develop after #863 landed; jphein offered there to rebase.

Two aspects of #966 that are not in #673:

jphein added a commit to techempower-org/mempalace that referenced this pull request Apr 18, 2026
Upstream v3.3.1 headline: multi-language entity detection (PT-BR, Russian,
Italian, Hindi, Indonesian, Chinese), BCP-47 case-insensitive locale
resolution, UTF-8 encoding fix for non-UTF-8 Windows locales, combining-mark
word-boundary fix for Devanagari/Arabic/Hebrew/Thai scripts. Also absorbs
PR MemPalace#966 (honor silent_save), MemPalace#863 (precompact blocking fix), MemPalace#895/MemPalace#897
(benchmarks + README rewrite), MemPalace#946 (UTF-8 Path.read_text), and more.

Conflict resolutions:

- mempalace/hooks_cli.py: kept fork-only _desktop_toast + _mempalace_python
  (hook wrappers depend on these), adopted upstream's _get_mine_dir helper +
  _mine_sync function + _maybe_auto_ingest(transcript_path) signature, kept
  fork's silent-save MempalaceConfig branch, kept _ingest_transcript call
  in hook_precompact before the new _mine_sync so the session JSONL still
  gets captured on precompact.
- tests/test_hooks_cli.py: merged both import sets. Updated
  test_stop_hook_rejects_injected_stop_hook_active to accept either the
  silent-save systemMessage output or the legacy decision=block — the
  security property (don't treat injected stop_hook_active as truthy) holds
  for both modes.
- tests/test_miner.py: merged both import sets (CHUNK_* constants +
  load_config).
- tests/test_readme_claims.py: accepted upstream's shift from README
  parsing to website/reference/mcp-tools.md and modules.md — website docs
  are now the source of truth for the tool table.
- mempalace/entity_detector.py: accepted upstream wholesale — replaces
  hardcoded English STOPWORDS with i18n-JSON-backed patterns and backward-
  compat module constants.
- README.md: kept fork README, bumped version badge 3.3.0 → 3.3.1.

Verification: 995 tests pass, stop hook fires end-to-end ("✦ 13 memories
woven into the palace"), 10/10 fresh-process palace opens + queries OK.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jphein added a commit to techempower-org/mempalace that referenced this pull request Apr 18, 2026
- Bump fork-target tag and drawer count (v3.3.0 → v3.3.1, 134K → 135K)
- Add "Pulled in from upstream v3.3.1" section: i18n entity detection,
  BCP-47 locale resolution, script-aware boundaries, UTF-8 Path.read_text,
  non-blocking precompact (MemPalace#863), basic silent_save honoring (MemPalace#966)
- Note that our MemPalace#673 silent-save is still ahead of upstream's MemPalace#966:
  marker-after-confirmed-save, themes extraction, systemMessage
- Add Mintlify to the memory-system comparison table (docs platform
  pitched as "self-updating knowledge management" with MCP support;
  not a verbatim personal memory tool, but shares the framing)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jphein added a commit to techempower-org/mempalace that referenced this pull request Apr 18, 2026
README:
- Bump drawer count 134K → 137K (matches current palace)
- Update "Open upstream PRs" table with actual reviewer status, add MemPalace#999
  and MemPalace#1000, drop stale "rebased against MemPalace#863" note since MemPalace#863 is in v3.3.1

CLAUDE.md:
- Rename section header v3.3.0 → v3.3.1 (we merged v3.3.1 earlier today)
- Add fork changes 11-13: None-metadata guards, .blob_seq_ids_migrated
  marker, quarantine_stale_hnsw
- Replace "Pulled in from upstream v3.3.1" summary: i18n, BCP-47 locales,
  UTF-8 Path.read_text, non-blocking precompact (MemPalace#863), silent_save
  honoring (MemPalace#966) — ours still broader
- Update the open-upstream-PRs table to 7 open, include MemPalace#999 + MemPalace#1000 and
  refresh each row's status line to match what's actually on GitHub
  (MERGEABLE flags, @bensig ping context, Copilot review addressed, etc.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@igorls igorls added enhancement New feature or request area/hooks Claude Code hook scripts (Stop, PreCompact, SessionStart) labels Apr 24, 2026
@igorls

igorls commented May 8, 2026

Copy link
Copy Markdown
Member

Hi, thanks for the contribution.

This PR has merge conflicts with develop, and the branch has not been updated in over 7 days, which puts it before our most recent release. The conflicts are likely against work that landed in that release.

Could you rebase onto develop so we can take another look?

If this change is no longer relevant, feel free to close the PR.

(This message is part of a periodic backlog pass, sent to all open PRs that match this state.)

@igorls igorls added the needs-rebase PR has merge conflicts with develop and needs rebase label May 8, 2026
@PostProtoroman PostProtoroman closed this by deleting the head repository May 8, 2026
@PostProtoroman

PostProtoroman commented May 11, 2026 via email

Copy link
Copy Markdown
Author

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 needs-rebase PR has merge conflicts with develop and needs rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants