Skip to content

feat(hooks): hooks.ignore_paths config to exempt project dirs from capture#1994

Open
JasonAiassist wants to merge 2 commits into
MemPalace:developfrom
JasonAiassist:fix/hooks-ignore-paths
Open

feat(hooks): hooks.ignore_paths config to exempt project dirs from capture#1994
JasonAiassist wants to merge 2 commits into
MemPalace:developfrom
JasonAiassist:fix/hooks-ignore-paths

Conversation

@JasonAiassist

Copy link
Copy Markdown

Problem

Ephemeral worker sessions (objective-loop agents spawning dozens of nested harness sessions per hour) each fire session-start/stop/session-end ingests. On my store that meant hundreds of ingest writes per hour, several of which died mid-write (segfault in the HNSW add path) and re-diverged the index within hours of a repair (same failure family as #1888 / #1966).

Change

A new hooks.ignore_paths config lets an operator exempt listed project directories from capture entirely:

  • Matched by cwd path-prefix, with a transcript_path dash-encoded fallback for hooks that receive no cwd.
  • The hook still returns valid JSON immediately for exempted paths, so the harness never sees an error.
  • 38 lines of unit tests covering prefix matching, the transcript-path fallback, and the passthrough case; full suite green (147 tests).

Running live on my instance since 2026-07-10 — the agent-farm directories no longer generate ingests, and the store has stayed convergent since.

Note

Stacked on #1966 — this branch includes that PR's commit (327c28e) because it was cut from the same local build; once #1966 merges to develop, this PR reduces to the single feat(hooks) commit. Happy to rebase instead if you'd prefer.

🤖 Generated with Claude Code

Jason-Aiassist and others added 2 commits July 8, 2026 10:22
…alace#1888)

The per-palace writer lease (MemPalace#1818/MemPalace#1823) is held for the whole MCP
process lifetime, so a single interactive session starves every other
writer on the palace — hook and manual mines exit with
MineAlreadyRunning, daemon jobs fail, and a second session's mutating
tools are refused — for hours at a time.

Release the lease once no mutating tool has run for
MEMPALACE_MCP_WRITER_LEASE_IDLE_S seconds (default 300; 0 restores the
legacy hold-until-exit behavior). The release also runs
_force_chroma_cache_reset() so the next mutating call reopens the
palace from disk: a re-acquire is only safe when no stale in-memory
HNSW state survives, which is the reason the lease was
lifetime-scoped in the first place. Re-acquisition rides the existing
self-heal retry path, so the first mutating tool after a release
transparently wins the lease back.

The idle-exit watchdog thread drives the release check and now also
starts when only the lease release is enabled. The atexit hook is
registered once and reads the current lease, replacing the
per-acquire lambda that would go stale across release/re-acquire
cycles.

Part of the MemPalace#1963 concurrent-writer cluster.

Co-Authored-By: Claude Fable 5 <[email protected]>
…pture

Ephemeral worker sessions (objective-loop agents spawning dozens of nested
harness sessions per hour) each fire session-start/stop/session-end ingests;
on this store that meant hundreds of ingest writes per hour, several of
which died mid-write (segfault in the HNSW add path) and re-diverged the
index hours after a repair. ignore_paths lets an operator exempt those
project dirs from capture entirely: matched by cwd path-prefix with a
transcript_path dash-encoded fallback; hook still returns valid JSON.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants