diff --git a/src/bin/poc-hook.rs b/src/bin/poc-hook.rs index ef68bfd..2308eb9 100644 --- a/src/bin/poc-hook.rs +++ b/src/bin/poc-hook.rs @@ -140,6 +140,13 @@ fn main() { .filter(|p| !p.is_empty()) .map(PathBuf::from); + // Daemon agent calls set POC_AGENT=1 — skip all signaling. + // Without this, the daemon's claude -p calls trigger hooks that + // signal "user active", keeping the idle timer permanently reset. + if std::env::var("POC_AGENT").is_ok() { + return; + } + match hook_type { "UserPromptSubmit" => { signal_user(); diff --git a/src/llm.rs b/src/llm.rs index 3754533..df4f766 100644 --- a/src/llm.rs +++ b/src/llm.rs @@ -59,6 +59,9 @@ fn call_model(agent: &str, model: &str, prompt: &str) -> Result cmd.env("CLAUDE_CONFIG_DIR", dir); } + // Tell hooks this is a daemon agent call, not interactive + cmd.env("POC_AGENT", "1"); + let start = std::time::Instant::now(); let result = unsafe {