Skip to content

feat(loop)!: the flip — every skill speaks the event model (v1.0.0) - #71

Merged
Ardnived merged 1 commit into
mainfrom
claude/loop-flip
Sep 8, 2026
Merged

Ardnived merged 1 commit into
mainfrom
claude/loop-flip

Conversation

@Ardnived

@Ardnived Ardnived commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fifth of the stack, on #69. This is the flip. Merging it changes what every cloud session does on its next dispatch, so it merges last, in the cutover sequence below — never on its own.

What changes

Skill Change
implement-issue Handler-shaped: bookended by handler-preflight/handler-journal, resumes an existing branch or PR, refuses only what the dispatcher could not see (Blocked by:/Re-check: in the body), splits a Hard ticket it cannot finish, cleans up right after the push. No gate table, no revocation, no Stage.
finalize-pr Steps 8 (CI watch) and 9 (mark ready) are gone. No reviewer request at open. Opens as a draft, pushes, ends. Locally, on a human's own PR, the human marks ready.
triage-issue No baton, no Stage, no Hold Until. Turn markers are the dispatcher's labels and Status, read-only. Blocked by: stays as the cloud-writable input (no (was:) suffix). Re-check: <date> parks a ticket on a date.
survey-routine One task: the survey. The awaiting drift sweep and the unheard-replies sweep are the dispatcher's. Proposal ceiling is one label:proposal search. Bookends in cron mode.
reflect Journals are titles + <!-- tally --> bodies + one comment per session (perPage ≤ 20, flagged days only). Signals table rewritten for the event model. New ## 📊 Usage section every week — dispatches per repo/handler, sessions per merged PR, items with ≥3 sessions — with one or two suggestions to the humans. Feedback, never a gate.
draft-ticket, cross-repo-issue File and let the dispatcher place it. Hand-off is a @sydevs-bot implement comment, asked explicitly.
adversarial-review No context: fork. Bookended. Own-login re-check honours flags.onDemand. Says why COMMENT-only.
survey-deps/-sentry/-analysis/-contracts "state machine sets Stage" → the dispatcher sets Status, proposal, awaiting. Re-check: instead of Blocked + Hold Until.
handler-preflight, handler-journal A local mode: no record, no lock, no journal.
README.md, AGENTS.md The loop section is the event model. The skills table has 22 rows plus the three legacy ones.
plugin.json 1.0.0.

Untouched on purpose: work-routine, preflight, journal, state-machine.yml, loop-config.json (the config-only cleanup PR removes wipCapPerRepo, stateMachine, issueFields.stage/holdUntil, ciPollAttempts, maxWorkItemsPerRun, assignment.bot, journalComment).

Rule delta (node workflow/lib/rule-delta.mjs --base claude/loop-dispatcher workflow/skills)

Added 7, removed 5. Each removal, adjudicated:

  • Always request the review, on every PR, the moment it opens — dropped. The dispatcher requests assignment.reviewer at mark-ready, after CI and the critic (M3). A request at open put unfinished work in the reviewer's queue.
  • Do not mark it ready while CI is red or a fix loop still runs — dropped. No session marks a PR ready any more. The dispatcher does, only on green.
  • Never end a run leaving a PR you opened in draft — dropped, and inverted. Every session ends with its PR in draft. The dispatcher clears the flag.
  • Do not close the ticket out — the state machine already did — reworded as implement-issue step 13 "Touch no state".
  • Do not act on these (survey-routine, unheard replies) — the sweep is gone. An issue needs a mention. The dispatcher's awaiting sweep and the unblock mention replace it.

Triage-issue also loses Never write Stage: Implement, Never add assignment.bot, Never leave a ticket at Blocked without a Hold Until, and Never record a blocker only as a Relationship — each folded into "Never write awaiting, blocked, proposal, bot:working, stuck, a Status, or an assignee", "Never authorise work by editing a ticket", and "Never park a ticket without a Re-check: line or a Blocked by: line". rule-delta matched them as rewordings.

ste-lint: hard violations equal or lower than the base in every touched file.

Cutover sequence (one sitting)

  1. Merge feat(loop): scripts for the event-driven loop (1/4) #66 → feat(loop): the dispatcher, dark (4/4) #69 (dark: BOT_DISPATCH=off, nothing changes).
  2. Disable sydevs-work-hourly and sydevs-survey-nightly, wait for any in-flight run. The old work-routine running this PR's finalize-pr would leave every PR in draft forever.
  3. BOT_DISPATCH=migrating. Run the backfill (migrate-to-status.mjs, dry then --apply). Close the two old-format journal issues.
  4. Merge this PR.
  5. Enable the five loop-* routines and re-enable sydevs-survey-nightly.
  6. Repo variable BOT_DISPATCH=on on claude-workflow only. @sydevs-bot answer … on a scratch issue, watched end to end. Then org on.

Rollback before step 4: BOT_DISPATCH=off, re-enable the hourly routine, --restore the snapshot. After: revert this PR (tag v0.3.1 marks the last polling-era plugin).

@Ardnived
Ardnived force-pushed the claude/loop-dispatcher branch from 996eca9 to 6cec14b Compare September 8, 2026 18:35
Base automatically changed from claude/loop-dispatcher to main September 8, 2026 18:36
implement-issue, finalize-pr, triage-issue, survey-routine, reflect, draft-ticket,
cross-repo-issue, adversarial-review and the four survey skills drop Stage, Hold Until,
the baton, the CI watch, mark-ready and the reviewer request at open. The dispatcher
owns every label and Status; sessions push and end. reflect gains a weekly usage
report read from the journal tallies (why: docs/why.md#there-is-no-wip-cap).
work-routine, preflight and journal stay until the cutover cleanup.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@Ardnived
Ardnived merged commit 4b46afb into main Sep 8, 2026
2 checks passed
@Ardnived
Ardnived deleted the claude/loop-flip branch September 8, 2026 22:28
@Ardnived Ardnived moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 10, 2026
@Ardnived Ardnived removed the awaiting label Sep 10, 2026
sydevs-bot added a commit that referenced this pull request Sep 20, 2026
The early return spared text that already fits, but every cut below it still
ran to `limit - reserve`. The same argument kills both: the 200-character
headroom is for a body that gets re-edited, and since #71 a journal entry is
a per-session comment written once.

Left in, it over-cut. A 1,599-character entry that one cut brought to 1,433 —
inside a 1,500 budget — lost a second `Did` line to reach 1,276.

`FIT_RESERVE`, `--reserve` and the `target` field go with it. Nothing outside
this script read any of them. The early return goes too: with the loop bound
by `limit`, text that fits never enters it, and the reason string now says
"nothing cut" from the count.

Gate: `node --test workflow/lib/*.test.mjs` → 21 pass. The new spec was
watched failing on the head before this commit — it dropped 2 lines, not 1.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011aKzLHT3FS4ac2Q58TkY6N
Ardnived pushed a commit that referenced this pull request Sep 21, 2026
…rity a run assigns (#118)

* fix(loop): preflight's record check runs without CLAUDE_PLUGIN_ROOT

`handler-preflight` step 2 spelled its command with `${CLAUDE_PLUGIN_ROOT}`,
which Claude Code sets only for an installed plugin. A routine reads the
skills from the checkout instead, so the variable is empty and the literal
command expands to `/lib/payload.mjs --attached /../..`.

Every dispatch hit it. 52 sessions across the six days to 2026-09-20 spent a
refused call, a guess and a friction line on it, and the guess was wrong twice
over: the path, and then the root, since `--attached` wants the directory
holding the five checkouts rather than the claude-workflow checkout inside it.

The skill now names the checkout, and `payload.mjs` derives the root from its
own path, so the documented command carries no `--attached` at all. Both new
assertions were watched failing against the root runs guessed first.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Z56SXwwDj6RTXxXYzXUw1

* fix(loop): --fit stops eating the journal line that carries the PR

`budget.mjs --fit` broke the record `reflect` reads, twice over.

It cut text that already fitted. `FIT_RESERVE` targets 200 characters below
the budget, and that headroom exists for a body that gets re-edited — but
since #71 a journal entry is a per-session comment, written once. So a
1,355-character entry against a 1,500 budget lost its whole `Did` section and
was told "532 to spare". Mon, Tue, Wed, Thu and Fri each carry that line.

And it cut top-down. `handler-journal`'s template leads `Did` with the PR the
run pushed, so the first line is the one that matters. Three entries in the
week to 2026-09-20 lost exactly that link, and Tuesday's survey worked around
it by ordering its Did section least-important-first — against the register
rule that leads with the outcome.

`fit` now returns text that is inside its budget untouched, and cuts from the
end of `Did` when it must cut. Both assertions were watched failing against
the behaviour they pin, and the first was resized until it could fail — at
1,229 characters it passed either way.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Z56SXwwDj6RTXxXYzXUw1

* fix(loop): one owner for Priority, so the two skills stop disagreeing

`triage-issue` said both things at once. Line 57: the reviewer sets Priority,
because consequence to the product is their judgement. The hard rule at the
bottom: never leave a ticket without a Priority field value. `revise-ticket`
agrees with the first and contradicts the second.

Nine sessions spent a friction line on it in the week to 2026-09-20, on five
distinct days, and they split three ways — SahajCloud#814 set Medium,
SahajCloud#819 set High, claude-workflow#106, #109, #110 and SahajAtlasWeb#217
left it unset. So bot-filed tickets carry a Priority nobody chose, on a field
the reviewer is meant to own.

The hard rule goes. The checklist and the ownership paragraph now say the one
thing: never choose a Priority, carry an existing value through a raw PUT so
the write does not clear it, and leave an empty one empty.

`rule-delta.mjs --base main workflow/skills` reads 63 → 63, none dropped: the
removed hard rule is replaced by its inverse two sections above, which it
matches.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Z56SXwwDj6RTXxXYzXUw1

* docs(review): naming is not taste here, and the profile said it was

The profile listed naming under "what they rarely flag — do not manufacture
findings here", on two comments in the seed corpus. Last week's reflection
saw three naming comments on SahajCloud#774, called one PR weather, and
pre-registered the check: if a second PR draws them, the entry needs
rewriting.

Three did, in the window since #95 merged, and the adversarial review passed
all three clean on naming. WeMeditateWeb#107 came back CHANGES_REQUESTED on
nothing else. SahajAtlasWeb#213 drew four comments, two with the replacement
supplied. WeMeditateWeb#112 drew two.

Written at the level of the value rather than the incidents: this is value 4,
the source of truth, applied to vocabulary. Every name they corrected made a
false claim — `readCms` did a retry beside an existing `withRetry`, and the
atlas said `Registration` for a guard covering every submission kind while
the CMS collection was already `user-submissions`. Spelling, casing and
house-style stay out of scope, so the entry narrows rather than opening a
whole class.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Z56SXwwDj6RTXxXYzXUw1

* chore(plugin): 2.2.2

`version` is the installed plugin's cache key, so a skill change that leaves
it alone never reaches `/plugin install workflow@sydevs`. Three skills moved
in this PR: handler-preflight, triage-issue and the reviewer profile.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Z56SXwwDj6RTXxXYzXUw1

* fix(loop): the attached-root test needs only this checkout

`record()` defaults to `repo: 'sydevs/SahajCloud'`, so the new assertion
demanded a SahajCloud checkout beside this one. A claude-workflow dispatch
clones one repo, so the gate was 19/20 on this head — watched failing before
the fix, 20/20 after.

`defaultAttachedDir()` can promise exactly one checkout: the one this file
lives in. The test now names it, as the assertion above it already did.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011aKzLHT3FS4ac2Q58TkY6N

* fix(loop): --fit cuts to the budget, not below it

The early return spared text that already fits, but every cut below it still
ran to `limit - reserve`. The same argument kills both: the 200-character
headroom is for a body that gets re-edited, and since #71 a journal entry is
a per-session comment written once.

Left in, it over-cut. A 1,599-character entry that one cut brought to 1,433 —
inside a 1,500 budget — lost a second `Did` line to reach 1,276.

`FIT_RESERVE`, `--reserve` and the `target` field go with it. Nothing outside
this script read any of them. The early return goes too: with the loop bound
by `limit`, text that fits never enters it, and the reason string now says
"nothing cut" from the count.

Gate: `node --test workflow/lib/*.test.mjs` → 21 pass. The new spec was
watched failing on the head before this commit — it dropped 2 lines, not 1.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011aKzLHT3FS4ac2Q58TkY6N

* fix(loop): the write examples stop choosing a Priority

The prose said the reviewer owns Priority while three examples picked one:
`triage-issue`'s update call set `High`, `draft-ticket` hard-coded `Medium`
on every create, and `cross-repo-issue` carried a Priority slot. Those are
the two values the week's runs supplied — sydevs/SahajCloud#814 Medium,
sydevs/SahajCloud#819 High.

Each example now names Effort alone, and the table's `Medium` row no longer
calls itself the default.

It also named the wrong mechanism. `issue_write` merges — `delete: true`
exists because omitting a field does not clear it — so a run leaves Priority
alone by not naming it. Only the raw PUT in the `<details>` replaces every
field, and only there is carrying the value back the way to keep it.

`rule-delta.mjs --base origin/main workflow/skills`: 63 → 63, none dropped.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011aKzLHT3FS4ac2Q58TkY6N

* fix(loop): the two run-loaded budget calls drop CLAUDE_PLUGIN_ROOT

Commit 1 fixed the record check and left the budget check beside it. Both
`handler-preflight`'s `--kind` line and `handler-journal`'s `--fit` line are
read on every dispatch, so the failure that commit diagnoses was still live
two commits later.

Both skills allow `Bash(node:*)` only, so the old spelling was refused twice
over: the variable is empty in a routine, and a bare script path is not a
node call.

The other six spellings stay. None is run-loaded, `hooks.json` is correct as
written — a hook does run as an installed plugin — and `AGENTS.md` documents
`${CLAUDE_PLUGIN_ROOT}/skills/<name>/<script>` as the convention, so changing
those is its own edit.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011aKzLHT3FS4ac2Q58TkY6N

* fix(loop): the run assigns a Priority, and every skill says so

The reviewer reversed commit 3's direction on
#118 (comment):
the loop assigns a Priority automatically, so a bot-filed ticket never
lands without one.

Commit 3 resolved the contradiction between `triage-issue` line 57 and
its own hard rule by deleting the rule. The reviewer wants it kept and
line 57 changed instead. The failure that reversal prevents is the one
already counted: nine sessions across five days split three ways over a
field nobody could tell them to set, and four tickets landed with no
Priority at all — a value the reviewer must now supply by hand on every
one.

So the ownership paragraph, the two write examples, the checklist and the
hard rule now say the single thing: you set both fields, `Medium` when
the consequence is not clear. A Priority the reviewer already set still
stands — `issue_write` merges, so omitting it keeps their value, and only
the raw PUT carries it back.

`revise-ticket` sets a Priority where the ticket has none. `answer-ticket`
still writes no field, and its reason names the skill that does, not an
owner that no longer exists. `cross-repo-issue` returns to its `main`
spelling.

Gate: `claude plugin validate ./workflow --strict` passed, 21 lib tests
pass, `rule-delta.mjs --base origin/main workflow/skills` 63 → 63.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Nwe5te9kXvEt7kqhyew1yK

---------

Co-authored-by: sydevs-bot <[email protected]>
Co-authored-by: sydevs-bot <[email protected]>
Ardnived pushed a commit that referenced this pull request Oct 9, 2026
The version string is the installed plugin's cache directory name, so an
unchanged one keeps serving the old skills however far main has moved. It
has stood at 2.8.1 since #161 while #165 and #167 rewrote 47 files under
workflow/skills, workflow/hooks and workflow/lib — every installed copy
still runs the pre-#165 skill names.

Major, not minor: #165 is `feat(loop)!`, and it renamed or deleted nearly
every skill, so an installed copy's command names are gone. The two prior
`feat(loop)!` commits each took a major bump — #71 to 1.0.0 and #101 to
2.0.0.

Found by Friday's cut-release audit.


Claude-Session: https://claude.ai/code/session_0134LSrTLenQog7g9n7TShtV

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant