Skip to main content

Module hooks

Module hooks 

Source
Expand description

Full hook implementations - expanded from plugins/aphrodite/_hooks/

transform_tool_result: content-aware compression with essential tool skip, file reference tracking, threshold gating, preview generation. transform_terminal_output: terminal-specific compression with exit code detection, threshold gating, streaming support.

Structs§

ToolCallMeta
Metadata Hermes already sends alongside a tool result (report 05, P2) - the signals the bridge historically dropped on the floor (status, error_type, error_message, args, duration_ms). Threaded through transform_tool_result_with_meta into the tool_events telemetry ring.

Functions§

compute_hash
Compute a CCR hash for content using BLAKE3 (40 hex chars).
on_session_start
Session start hook - full reset.
post_llm_call
Post-LLM call hook - archive turn.
pre_llm_call
Pre-LLM call hook - inject catalog + active directives into context.
transform_terminal_output
Transform terminal output - exit code aware.
transform_terminal_output_classified
Same as transform_terminal_output, with the same classify contract as transform_tool_result_classified.
transform_terminal_output_with_meta
Same as transform_terminal_output_classified, plus the Hermes-supplied command and returncode (report 05, P2/T6/T8) recorded into the tool_events telemetry ring. returncode == 0 (or absent) is ok.
transform_tool_result
Transform tool output - full compression pipeline.
transform_tool_result_classified
Same as transform_tool_result, but a caller that has already found the “real” payload underneath a wrapper the core classifier can’t see through (e.g. an agent-specific JSON envelope) may supply it via classify as (content_to_classify, type). Core stays agnostic to what a wrapper looks like - it only ever hashes and stores the ORIGINAL content, so aphrodite_retrieve always returns exactly what was passed in; classify affects only the reported type and the generated preview.
transform_tool_result_with_meta
Same as transform_tool_result_classified, plus the Hermes-supplied call metadata (report 05, P2/T6) that gets recorded into the tool_events telemetry ring. This is the entry point the Hermes bridge routes to so the error/args/duration signals Hermes ships on every call stop being dropped.