Hooks Reference
🔵 Hooks intercept the agent lifecycle. These are YAML files in
config/agents/<agent>/hooks/, connected via hook_files: (or by name in
hooks:). The kind: field selects the hook. Below is a summary table of all hooks with
links to sections.
Hook Types
| kind | Purpose | Section |
|---|---|---|
faq_cache |
cache (question → answer) in DuckDB; serve repeats, skipping the LLM | Context and Memory |
inject |
declaratively inject system/user messages | Context and Memory |
escalate |
escalation to a human when the agent cannot help | Routing and Reliability |
memory |
long-term per-user memory (facts + summary) | Context and Memory |
rag |
retrieval from the archive: injects relevant chunks into context (BM25, no embeddings) | Context and Memory |
tool_cache |
cache of read-only tool results by (scope, tool, args); short-circuit repeats |
Context and Memory |
link_check |
output guardrail: checks the final answer's references for groundedness (against the archive) and structural safety; opt-in live HTTP |
Security and Quality |
condense |
condensation of follow-ups into a standalone query using history; full audit | Context and Memory |
compact_results |
compression of long tool outputs (head/tail + preserving references) | Context and Memory |
context_summary |
LLM summarization of evicted history in the context window (replaces crude concatenation) | Context and Memory |
format_guard |
deterministic answer formatting: bare URL → links, dedup, one link per line | Security and Quality |
schema_guard |
validation of the answer or tool arguments against JSON Schema; notice / rework / deny |
Security and Quality |
language_guard |
answer language: capture the user's language, optional directive, notice/rework on mismatch |
Security and Quality |
guard |
stateless DLP membrane: entity detection (email/phone/cards/INN/SNILS/keys…) and action — redact/deny/suppress/notice/rework on input, output, and tool boundaries |
Security and Quality |
pseudonymize |
reversible pseudonymization: surrogates [EMAIL_1] to the model, local DuckDB vault, detokenization of the answer/tool arguments |
Security and Quality |
loop_guard |
breaking tool-call loops: deny repeats beyond the threshold |
Routing and Reliability |
groundedness |
output guardrail: checks the final answer's claims for confirmation by the RAG archive; notice/rework |
Security and Quality |
circuit_breaker |
config for the native provider circuit breaker (per-agent): skip a failed provider, falling back to failover | Routing and Reliability |
model_router |
classifier-based model routing (ONNX/LLM/hybrid): choose model_config per message |
Routing and Reliability |
intent_router |
classifier-based triage: reply/inject/notice/escalate by intent |
Routing and Reliability |
lexicon |
self-learning query normalizer: slots + gap + golden-gated auto-training (YAML packs + DuckDB overlay) | Context and Memory |
llm_cache |
native inference cache: an exact prompt repeat is served from DuckDB without the provider (turn loop, llm(...), ask judges) |
Routing and Reliability |
script_hook |
scripted hook in Rhai/JavaScript (see 07-scripts) |
Extension |
agent_events |
native agent action log: writes an event at selected lifecycle points; the GET /v1/events route exposes it externally with long-poll and cursor drain |
Extension |
dll_hook |
hook from a native Rust DLL (C ABI, see 20-native-plugins) |
Extension |
Sections
- Fundamentals — lifecycle points, composition,
HookContext, local testing. - Context and Memory —
faq_cache,inject,memory,rag,tool_cache,condense,compact_results,context_summary,lexicon. - Security and Quality —
guard,pseudonymize,link_check,groundedness,language_guard,format_guard,schema_guard. - Routing and Reliability —
escalate,loop_guard,circuit_breaker,model_router,intent_router,llm_cache. - Extension —
script_hook,dll_hook, nativeagent_events(agent action log).