diff --git a/home_root/.claude/statusline-command.sh b/home_root/.claude/statusline-command.sh index ea642cb..aa2acce 100644 --- a/home_root/.claude/statusline-command.sh +++ b/home_root/.claude/statusline-command.sh @@ -110,9 +110,18 @@ if command -v althing-cli >/dev/null 2>&1; then # suppress the empty-inbox form (📪 0) — only surface actual unread mail (📬 N) case "$althing" in *📪*) althing="" ;; esac h="${ALTHING_HANDLE:-}" + # ALTHING_HANDLE isn't set in the statusline env — resolve the per-project handle from + # althing's session map (keyed by the cwd Claude Code passes on stdin), the same source + # `althing-cli use` writes. Without this the monitor bell (🔔/🔕) never renders. + [ -z "$h" ] && [ -n "$cwd" ] && h=$(jq -r --arg d "$cwd" '.[$d] // empty' "$HOME/.althing/session_handles.json" 2>/dev/null) if [ -n "$h" ]; then mon="🔕" - for lk in "$HOME/.althing/wake-listener-$h.lock" "$HOME/.althing/light-monitor-$h.lock"; do + # Three independent arming mechanisms, one lock each — any live one means "armed": + # monitor-$h.lock <- `althing-cli monitor` (the CC-native exit-0-re-arm loop) + # wake-listener-$h.lock <- `althing-wake-listener` (herald inbound) + # light-monitor-$h.lock <- `althing-light-monitor` (standing watch) + # The kill -0 liveness gate below discards stale locks, so listing all three is safe. + for lk in "$HOME/.althing/monitor-$h.lock" "$HOME/.althing/wake-listener-$h.lock" "$HOME/.althing/light-monitor-$h.lock"; do [ -f "$lk" ] || continue pid=$(tr -dc '0-9' < "$lk" 2>/dev/null) if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then mon="🔔"; break; fi