add loop controller — replace /loop + ScheduleWakeup with external spawn#163
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tools/loop/controller.pyreplaces/loop+ScheduleWakeupfor the OC watchdog cycleclaude -psession — context never accumulates across cycles.context/loop_schedule.jsonat STEP 10 with{delay_s, state, reason}; controller reads it for adaptive timingAdaptive cadence (unchanged table, different mechanism)
Usage
Files changed
tools/loop/controller.py— new controller script.console/watchdog_loop_prompt.md— STEP 10: writeloop_schedule.json, exit cleanly (no ScheduleWakeup)docs/operator/watchdog_loop.md— intro, Starting/Stopping sections, embedded STEP 10LOOP_START.md— Step 3 updated to controller start commandsTest plan
python tools/loop/controller.py --status→ "No lock file" when not running--statusshows ACTIVE with correct pid--stopwrites stop flag; controller exits after current session completes.context/loop_schedule.json; controller reads it for next delay🤖 Generated with Claude Code