Skip to content

add loop controller — replace /loop + ScheduleWakeup with external spawn#163

Merged
ProtocolWarden merged 1 commit into
mainfrom
feat/loop-controller
May 21, 2026
Merged

add loop controller — replace /loop + ScheduleWakeup with external spawn#163
ProtocolWarden merged 1 commit into
mainfrom
feat/loop-controller

Conversation

@ProtocolWarden
Copy link
Copy Markdown
Owner

Summary

  • tools/loop/controller.py replaces /loop + ScheduleWakeup for the OC watchdog cycle
  • Each iteration is a fresh claude -p session — context never accumulates across cycles
  • Session writes .context/loop_schedule.json at STEP 10 with {delay_s, state, reason}; controller reads it for adaptive timing
  • Enables overnight unattended runs without hitting the 5-hour session context limit

Adaptive cadence (unchanged table, different mechanism)

State Delay
CRITICAL 180s
DEGRADED 300s
STALLED 600s
ACTIVE 900s
PARKED_OPERATOR_BLOCKED 1800s
HEALTHY 3600s

Usage

nohup python tools/loop/controller.py > /dev/null 2>&1 &
python tools/loop/controller.py --status
python tools/loop/controller.py --stop
# Log: logs/local/loop_controller.log

Files changed

  • tools/loop/controller.py — new controller script
  • .console/watchdog_loop_prompt.md — STEP 10: write loop_schedule.json, exit cleanly (no ScheduleWakeup)
  • docs/operator/watchdog_loop.md — intro, Starting/Stopping sections, embedded STEP 10
  • LOOP_START.md — Step 3 updated to controller start commands

Test plan

  • python tools/loop/controller.py --status → "No lock file" when not running
  • Start controller, confirm --status shows ACTIVE with correct pid
  • --stop writes stop flag; controller exits after current session completes
  • Session writes .context/loop_schedule.json; controller reads it for next delay

🤖 Generated with Claude Code

tools/loop/controller.py spawns a fresh claude -p session for each watchdog
cycle. Context never accumulates; each session reconstructs from the CLP
checkpoint. Session writes .context/loop_schedule.json at STEP 10 (state +
delay_s + reason); controller reads it for adaptive timing before spawning
the next session.

Updates:
- watchdog_loop_prompt.md STEP 10: write loop_schedule.json, exit cleanly
- watchdog_loop.md: intro, Starting/Stopping sections, embedded STEP 10
- LOOP_START.md: Step 3 replaced with controller start commands

Usage: nohup python tools/loop/controller.py &
Stop:  python tools/loop/controller.py --stop
Log:   logs/local/loop_controller.log

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ProtocolWarden ProtocolWarden merged commit 2108811 into main May 21, 2026
0 of 11 checks passed
@ProtocolWarden ProtocolWarden deleted the feat/loop-controller branch May 21, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant