diff --git a/OperatingRhythm.md b/OperatingRhythm.md index b3ca2c2..8c08498 100644 --- a/OperatingRhythm.md +++ b/OperatingRhythm.md @@ -33,6 +33,31 @@ Rules: the top. 4. Workplan files match hub state (fix-consistency covers drift). +## Bridge scheduler (workstation cron) + +**Status: prepared, not installed** — installing a self-running agent loop is +a founder action (the Claude Code permission layer rightly refuses to let an +agent install its own persistence). Everything else is ready: +`scripts/rhythm-session.sh` runs a headless, lane-restricted Claude Code +session that does queue hygiene, writes the daily brief, and pulls one +autopilot item (agent name `agt-rhythm-bridge`; flock guard, logs to +`~/.cache/binky-control/rhythm/cron.log`). + +**Enable (founder, one line):** +```bash +( crontab -l; echo '23 8 * * 1-5 /home/worsch/binky-control/scripts/rhythm-session.sh # binky rhythm bridge' ) | crontab - +``` + +**Disable:** `crontab -e` and delete the `binky rhythm bridge` line. + +This is explicitly a **bridge**: once activity-core definitions (T05) and an +llm-connect executor (T06 follow-up) are live, the cron line is removed and +scheduling moves to the sanctioned coordination layer. + +Guardrails baked into the script: Green/Blue lane only, allowed tools limited +to file edits + git add/commit, no push, no network, one-run-at-a-time lock, +bounded "maintenance pass" prompt. + ## Weekly review (founder, ~15 min) Read the newest brief + `SuccessMilestones.md`. One question: did anything diff --git a/scripts/rhythm-session.sh b/scripts/rhythm-session.sh new file mode 100644 index 0000000..bbff663 --- /dev/null +++ b/scripts/rhythm-session.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Binky operating-rhythm bridge session (BINKY-WP-0003-T04). +# Runs a headless Claude Code session that does queue hygiene, writes the +# daily brief, and pulls one AutopilotWorkQueue item when idle. +# This is a BRIDGE until activity-core + llm-connect own scheduling/execution +# (BINKY-WP-0003 T05/T06). Disable: see OperatingRhythm.md "Bridge scheduler". +set -euo pipefail + +REPO="$HOME/binky-control" +LOGDIR="$HOME/.cache/binky-control/rhythm" +LOCK="$LOGDIR/rhythm.lock" +mkdir -p "$LOGDIR" + +# never overlap a prior run +exec 9>"$LOCK" +flock -n 9 || { echo "$(date -Is) skipped: previous rhythm session still running" >>"$LOGDIR/cron.log"; exit 0; } + +PROMPT=$(cat <<'EOF' +You are the Binky operating-rhythm bridge session (see OperatingRhythm.md). +Work autonomously, Green/Blue lane only. Do, in order: +1. Queue hygiene: check DecisionQueue.md (flag items older than 14 days), + OfficeHourQueue.md, RiskRegister.md escalation dates against today. +2. Write today's daily brief to briefs/-daily-brief.md in the + format defined in OperatingRhythm.md (Decide now / Progress / Risks / + Best next hour; one screen max). Skip if today's brief already exists. +3. If time remains, pull ONE item from AutopilotWorkQueue.md you can fully + complete in Green/Blue lane; mark it in_progress with agent + "agt-rhythm-bridge", do it, move it to the Completed log. +4. Commit all changes with a concise message. +Never touch Red/Yellow lane actions; queue them instead. Keep total effort +bounded — this is a maintenance pass, not a project session. +EOF +) + +cd "$REPO" +"$HOME/.local/bin/claude" -p "$PROMPT" \ + --permission-mode acceptEdits \ + --allowedTools "Read,Write,Edit,Glob,Grep,Bash(git add:*),Bash(git commit:*),Bash(git status),Bash(git log:*),Bash(git diff:*),Bash(date:*),Bash(ls:*)" \ + >>"$LOGDIR/cron.log" 2>&1 +echo "$(date -Is) rhythm session finished rc=$?" >>"$LOGDIR/cron.log" diff --git a/workplans/BINKY-WP-0003-autopilot-and-rhythm.md b/workplans/BINKY-WP-0003-autopilot-and-rhythm.md index b295fde..34cd670 100644 --- a/workplans/BINKY-WP-0003-autopilot-and-rhythm.md +++ b/workplans/BINKY-WP-0003-autopilot-and-rhythm.md @@ -59,7 +59,7 @@ the schedule and how to disable it. Blue lane. ```task id: BINKY-WP-0003-T04 -status: todo +status: done priority: high ```