Skip to main content

mati_core/hooks/
subagent_start.rs

1/// subagent-start.sh — inject mati awareness into a freshly-spawned subagent.
2///
3/// SubagentStart fires before a subagent's first turn. Subagents are fresh
4/// contexts blind to mati; this surfaces the gotcha count + how to consult.
5/// Awareness only (enforcement already fires on subagent tool calls). Fail-open.
6pub const SCRIPT: &str = r#"#!/usr/bin/env bash
7# mati subagent-start hook — inject codebase-memory awareness (fail-open)
8HOOKS_DIR="$(cd "$(dirname "$0")" && pwd)" && export PATH="$HOOKS_DIR:$PATH"
9command -v mati >/dev/null 2>&1 || exit 0
10cat > /dev/null
11mati subagent-context 2>/dev/null || true
12"#;