Skip to main content

mati_core/hooks/
post_compact.rs

1/// post-compact.sh — clear consult receipts after compaction.
2///
3/// PostCompact — SYNCHRONOUS. Compaction wipes the agent's working memory of
4/// gotcha content, but daemon-side consult receipts survive (read-time TTL), so
5/// PreToolUse would not re-block. Clearing receipts forces a fresh mem_get on the
6/// next access to a gotcha'd file, restoring the "consulted ⇒ knows" invariant.
7pub const SCRIPT: &str = r#"#!/usr/bin/env bash
8# mati post-compact hook — clear consult receipts (restore re-block after compaction)
9HOOKS_DIR="$(cd "$(dirname "$0")" && pwd)" && export PATH="$HOOKS_DIR:$PATH"
10cat > /dev/null
11mati session-clear-consults 2>/dev/null || true
12"#;