Simplify state hooks to use AGENT_ID env var

- Replace complex PID-based lookup with AGENT_ID env var
- Much more reliable and cleaner approach
- AGENT_ID is exported by tmux and shell environment
This commit is contained in:
Levi Neely 2026-02-18 20:06:05 +01:00
parent 2dd7418e05
commit 67fbc83efd
1 changed files with 2 additions and 2 deletions

View File

@ -17,12 +17,12 @@
],
"userPromptSubmit": [
{
"command": "KIRO_PID=$(ps -o ppid= -p $PPID | tr -d ' '); cat $(namespace)/anvillm-session-id-$KIRO_PID 2>/dev/null | xargs -I{} sh -c 'echo running | 9p write agent/{}/state 2>/dev/null' || true"
"command": "echo running | 9p write agent/$AGENT_ID/state 2>/dev/null || true"
}
],
"stop": [
{
"command": "KIRO_PID=$(ps -o ppid= -p $PPID | tr -d ' '); cat $(namespace)/anvillm-session-id-$KIRO_PID 2>/dev/null | xargs -I{} sh -c 'echo idle | 9p write agent/{}/state 2>/dev/null' || true"
"command": "echo idle | 9p write agent/$AGENT_ID/state 2>/dev/null || true"
}
]
}