Logs hook dispatch events and spills injected context exceeding 10K chars to overflow files with monotonic sequence for unique filenames.
// Source: https://github.com/shiwenwen/hope-agent | License: MIT | Copyright 2026 shiwenwen
// Provided via justclaw.it.com; keep this notice with the code.
//! Hook audit logging + overflow file handling (design §7.10 / §8.6 / §16.2).
//!
//! Every dispatch logs one `app_info!("hooks", "dispatch", …)` line. Injected
//! context exceeding the 10 000-char cap is spilled to an overflow file and
//! replaced inline with a pointer.
use std::path::PathBuf;
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::Duration;
use super::types::{HookDecision, HookEvent, HookOutcome};
/// Max characters of hook output injected into the LLM context (design §8.6).
pub const MAX_INJECT_CHARS: usize = 10_000;
/// Monotonic per-process counter so two overflow spills in the same millisecond
/// (e
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key