crabtalk_core/config/hooks.rs
1//! Per-agent hook configuration — bash deny rules, memory recall
2//! tuning. Each agent owns its own `HooksConfig` directly on
3//! [`crate::AgentConfig`]; there is no global override.
4
5use serde::{Deserialize, Serialize};
6
7/// Per-agent hook configuration.
8#[derive(Debug, Clone, Serialize, Deserialize, Default)]
9#[serde(default)]
10pub struct HooksConfig {
11 /// Bash tool configuration (`hooks.bash` under an agent).
12 pub bash: BashConfig,
13 /// Memory hook configuration (`hooks.memory` under an agent).
14 pub memory: MemoryConfig,
15}
16
17/// Bash tool configuration.
18#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
19#[serde(default)]
20pub struct BashConfig {
21 /// Disable the bash tool entirely.
22 pub disabled: bool,
23 /// Reject commands containing any of these strings (e.g. `".ssh"`).
24 pub deny: Vec<String>,
25}
26
27/// Built-in memory configuration.
28#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
29#[serde(default)]
30pub struct MemoryConfig {
31 /// Maximum entries returned by auto-recall (default 5).
32 pub recall_limit: usize,
33}
34
35impl Default for MemoryConfig {
36 fn default() -> Self {
37 Self { recall_limit: 5 }
38 }
39}