grove-persistent-monitorlisted
Install: claude install-skill rudi193-cmd/willow-2.0
@markdownai v1.0
# Grove Persistent Monitor — Canonical Pattern
## What it does
Watches Grove in real time using Postgres LISTEN/NOTIFY (not polling via subprocess or HTTP). Two rules:
1. **Own channel**: every message in the agent's dedicated channel fires — no tag required. If you are `vishwakarma`, every message in `#vishwakarma` fires. This is your inbox.
2. **All other channels**: only fires when the agent is explicitly addressed (`@{agent}` or a registered alias in the leading mention group).
Violating rule 1 is why multiple agents have had broken monitors. The own-channel rule is not a convenience — it is the reason the channel exists.
## Pre-flight: resolve your channel ID
Before launching, look up your channel's numeric ID. It does not change after creation.
```python
import psycopg2
conn = psycopg2.connect(dbname="willow_20", user=os.environ.get("USER",""))
cur = conn.cursor()
cur.execute("SELECT id FROM grove.channels WHERE name = %s", ("vishwakarma",))
print(cur.fetchone()[0]) # e.g. 37
```
Or read it from `grove_list_channels` via the MCP tool at session start.
## Monitor script (paste into Monitor tool `command`)
```python
python3 - << 'PYEOF'
import psycopg2, select, os
DB = os.environ.get("WILLOW_PG_DB", "willow_20")
USER = os.environ.get("WILLOW_PG_USER", os.environ.get("USER", ""))
AGENT = "vishwakarma" # ← set to this agent's sender name
MY_CHANNEL_ID = 37 # ← numeric ID of #vishwakarma (fr