Repository navigation
feat(loop): scripts for the event-driven loop (1/4) - #66
Merged
Merged
Conversation
This was referenced Sep 8, 2026
Merged
The event-driven loop starts every session from one untrusted block: the `<routine-fire-payload>` the `/fire` endpoint wraps around whatever the caller sent. A handler may act on it only as a pointer — repo, item, handler, lock — and must re-read every fact from GitHub. "Check the fields" as prose is evaluated by a model once per fire, forty times a day. `payload.mjs` evaluates it the same way every time: schema version, a handler this config knows, a repo in the configured set, a github.com url under that repo, the lock label the config names, an attempt inside `dispatch.maxAttempts`, a deadline in the future, and a journal pointer at the journal repo. It refuses with every reason at once, so one journal read diagnoses a bad fire. `--expect-handler` catches a record routed to the wrong routine. Anything else in the record is carried through untouched and never acted on. Reads stdin and `loop-config.json`; never fetches. Tested with `node --test workflow/lib/payload.test.mjs`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… lives The dispatcher in GitHub Actions is about to become the one caller of the merge gate, and it imports from `workflow/lib`. The copy under `skills/work-routine/` stays until that skill is deleted, so the running loop is untouched. Imports rewritten to `./config.mjs` and `./merge-gate.mjs`; no rule changed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The journal becomes one comment per run rather than one body per day, so each comment needs its own kind: `journalEntry`, 1500 characters, sized so a forty-dispatch day stays near 60 KB for the Sunday reflect to read. The value is a fallback here and lands in `loop-config.json` separately. A comment's sections are `###` where the day's body used `##`. `--fit` now recognises both, and an empty Did heading is removed once the text fits rather than only while the loop is still cutting — the skill omits an empty section, and an orphaned heading reads as one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Ardnived
force-pushed
the
claude/loop-scripts
branch
from
September 8, 2026 18:29
ad9178c to
6cec8bf
Compare
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.
First of four PRs that move the loop from hourly polling to GitHub-event dispatch. This one adds scripts only; no running skill reads them yet, so the hourly and nightly routines are untouched.
Design:
~/.claude/plans/let-s-consider-and-create-starry-church.md(rev. 3, agreed 2026-09-07/08).Commits, one behaviour each
payload.mjs+ tests--expect-handlercatches a mis-routed fire.lib/merge-verdict.mjslib/imports. The old path stays untilwork-routineis deleted.budget.mjsjournalEntrykind (1500);--fitaccepts###sections; an emptied Did heading is dropped once the text fits.No ceiling change
loop-config.jsonis untouched.journalEntry: 1500is a script fallback here and ships to the config in the additive config PR (3/4), per the never-skill-and-ceiling-together rule.Verification
node --test workflow/lib/payload.test.mjs— 12 pass.claude plugin validate ./workflow --strict— passed.--fit --kind journalCommentregression on the 7 KB / 19 KB / unfittable bodies from perf(loop): cut the four fixed costs every run pays #62: unchanged results.payload.mjsagainst main's config correctly refuses everything with "nohandlersblock" — the config PR adds it.Next: 2/4 new handler skills · 3/4 additive config · 4/4 the dispatcher (dark).