From 9e52fd5b954ed9a6b83f47d842ad233c36154b50 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Fri, 6 Mar 2026 00:16:03 -0500 Subject: [PATCH] fix idle timer: daemon agent calls were resetting user activity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The daemon's claude -p subprocesses inherit hooks config, so every agent LLM call triggered UserPromptSubmit → signal_user(), making the idle timer think Kent was always active. The daemon was petting its own tail. Fix: set POC_AGENT=1 env var on all daemon claude subprocesses, and return early from poc-hook when it's set. --- src/bin/poc-hook.rs | 7 +++++++ src/llm.rs | 3 +++ 2 files changed, 10 insertions(+) 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 {