Local · deterministic · no model
The model is repeating. Stop that session.
OpenCode Watchdog sits on your OpenCode server and trips when a session falls into a loop. Detection does not call a model. Protect mode aborts the affected session and leaves your files alone.
Breaker open · session aborted · files untouched
What trips the breaker
- Repeated tokens
- Repeated sentences or narration
- The same tool called with no progress
- Activity that is not moving the session forward
Three modes
The default is observe. Switch only after you have watched a real stream.
Default
Observe
Log the incident. Leave the session running. Use this until the stream looks right.
Recommended
Protect
Abort the affected session when the policy is sure. Files stay. Other sessions stay.
Experimental
Recover
Abort, then send one bounded recovery prompt. Treat this as optional, not the default.
How a trip happens
- 1. Desktop or CLI talks to your OpenCode server.
- 2. Watchdog reads that server's event stream on the machine.
- 3. Detectors score repetition. A single odd line is not enough.
- 4. In protect mode, the affected session is aborted.
- 5. The incident stays in a local log you can mark as a false positive.
Install
Node 22+. There is no hosted service. The watchdog only talks to the OpenCode server you point it at.
git clone https://github.com/M4G3LL4N0/opencode-watchdog.git
cd opencode-watchdog
pnpm install
pnpm run build
./bin/ocw.js startocw start adopts or starts the shared server and watches every session. The command list is on Commands.
What it will not do
- It does not send your session to another service for detection.
- It does not reset git or roll back files.
- It does not kill the Desktop app or sessions it is not watching.
- It does not log server passwords. Those stay in your environment, if you set them.