feat(drive-local): pick any backlog item, not the one it was written for
The local drive flow could only ever execute BACKLOG F8b. Its selector hardcoded one file, one old identifier and one new one:
const target = 'packages/sdk/src/compile.ts';
const oldName = 'validateKernelRetry';
const newName = 'validateAuthoringRetryDefaults';
That proved a relayflow can drive a real change on this checkout with no Cloud admission, no Daytona and no Relaycast workspace — which was the point at the time. But every later tick needed a human to rewrite the script first, and a loop that needs editing between iterations is not a loop.
Two changes make it general
Selection uses the SDK's backlog picker (gate 3, PR #20) — the same rule the cloud drive uses: the first top-level bullet with a bold title, validated for a title, files in scope, and a definition of done. Using it rather than writing a second implementation means the local and cloud loops cannot drift about what "next" means. The script refuses an underspecified package rather than handing an agent something it cannot tell it has finished.
Implementation is an agent step. A deterministic step can only make mechanical changes, and most backlog entries are not mechanical — that limit, not the selector, is what really pinned the old flow to a rename. The agent is told to stay inside the declared scope, to change nothing if the package is already done or its premise is false, and that reporting "already done" is a good tick while inventing an edit to look busy is not.
Verification
Compiles under the 0.1.0 SDK — 5 steps, one of type agent:
COMPILES — steps: build-sdk:deterministic, select:deterministic,
implement:agent, verify:deterministic, report:deterministic
select against the real ops/BACKLOG.md picks a genuine item, not F8b:
SELECTED `timeoutMs` is enforced LATE, not never — a step ran 2.3x past its limit.
files in scope: .
definition of done: 1 item(s)
Two things running it taught me, now encoded
- An agent step cannot declare
timeoutMs— 0.1.0 bounds deterministic steps only. The compiler caught my first draft. selectBacklogEntryis not re-exported from the SDK index; onlydist/backlog-picker.jscarries all four functions. Importing the index gets you two of the four and aTypeErrorat runtime.
Known limitation
The picker extracted files in scope: . for the selected entry — technically valid, not useful. Scope extraction quality is the picker's, not this flow's, and is worth a separate look before the loop runs unattended.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FtQSAcGDta5VH9xiZFT4sR
[!NOTE]
Medium Risk
Changes how unattended local automation selects work and runs a broad agent edit plus full SDK test suite; bounded-scope skips reduce runaway edits but operator workflow and CI time depend on backlog quality.
Overview
Generalizes the local drive loop so each tick can take the next bounded item from ops/BACKLOG.md instead of a hardcoded F8b rename.
Selection now loads the SDK backlog picker (dist/backlog-picker.js), walks the first bold bullets until one validates and has bounded, on-disk scope—skipping invalid entries, repo-wide . scope, and paths that no longer exist—then writes .relayflow/drive-local/package.json with title, scope, definition of done, brief, backlogSha256, and pinned HEAD. The deterministic apply path is removed; only select and report remain, with report refusing if HEAD moved since selection.
SDK: BacklogEntry gains index / endIndex so callers advance the markdown by bullet position (not title search) when skipping entries.
Workflow drive-local is renamed and restructured: implement is an agent step (scoped instructions, DONE output check, stream pin); verify rebuilds the SDK and runs the full Vitest suite after the agent edits source; pre-flow SDK build is documented as a launcher prerequisite rather than an in-flow step.
Tests retarget atomic-write coverage to the package file, add stability and HEAD_MOVED cases, and drop apply/rename assertions.
Reviewed by Cursor Bugbot for commit c4831e29ae0e99020edb7282e0ec40c7abbbb427. Bugbot is set up for automated code reviews on this repo. Configure here.