agentleFS
niksavisniksavis/basicly/.claude/skills/harness-loop/SKILL.md

harness-loop

Skill0 starsChanged 56 days agoMITView on GitHub

Drives tracked work through the basicly loop, intake to ship. Use to start or resume work, or to move an issue past a checkpoint or gate.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

23 rules. About 0 are common, 10 are distinctive, and 13 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never record the verify gate by hand during build: Only the build-to-verify loop advance merges the branch.

    line 22
  2. Very specific:

    Never signal a supervisor or its lanes: Use --max-passes or loop stop, so no lane dies mid-write.

    line 27
  3. Very specific:

    When a required fact is missing, do not guess: Write .basicly/usage/needs-input.json and stop.

    line 28
  4. Very specific:

    Use it to inspect one transition.

    line 43
  5. Distinctive:

    Run the command yourself.

    line 60
  6. Very specific:

    Ask when the challenge appears, because the code expires after 15 minutes.

    line 62
  7. Very specific:

    If it expired, run the command again without --confirm to get a new code.

    line 63
  8. Distinctive:

    If you approve there, the checkpoint is approved but the loop stays parked.

    line 67
  9. Very specific:

    Use feature only when the work fans out into children that land separately.

    line 95
  10. Very specific:

    Do not guess the DoR sections.

    line 101
  11. Very specific:

    Every later phase reads ## Scope.

    line 105
  12. Very specific:

    If you record the gate first (basicly verify --issue), the phase jumps to verify without the merge.

    line 137
  13. Distinctive:

    After the landing merged, re-run the gate from the base checkout only:

    line 139
  14. Distinctive:

    Check each clause. Revert the mechanism that you think delivers it and watch named tests fail.

    line 193
  15. Very specific:

    If git diff --cached --stat shows deletions under .basicly/ledger/, stop and find what rewrote it.

    line 200
  16. Distinctive:

    Never commit the ledger on a harness branch.

    line 208
  17. Distinctive:

    Commit the ledger between those steps and the next landing.

    line 209
  18. Very specific:

    Use preflight and supervise over an epic for parallel work.

    line 226
  19. Distinctive:

    Only a human sets a limit on lanes.

    line 227
  20. Distinctive:

    Keep two or fewer agents in the base checkout.

    line 228
  21. Distinctive:

    Read the log file it prints.

    line 241
  22. Very specific:

    Do not push while a pass holds the lock: Read in the base. Write in your own worktree until loop stop returns.

    line 242
  23. Distinctive:

    After an epic slice lands, write a retro comment and file a record for each finding the user keeps:

    line 252

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Generated by `basicly skills-build` from skill.yaml. Do not edit; edit the source. -->

Harness Loop

This skill drives one tracked issue, or many lanes under an epic, through the loop with basicly loop. The agent supplies the phase inputs and writes the code. The engine records state, runs gates and advances. The same commands work under Claude, Codex and Copilot.

Other skills own the mechanics of each phase: work-tracker (records), worktree-isolation (worktrees), decompose-plan (child plans), repair-in-place (rework), validate-as-consumer (validate), conventional-commits (commit messages).

Rules

  • Read the state first with basicly loop status <issue>. The tracker ledger is the only state, so any agent can resume.
  • Commit your work on the harness branch before you advance. The loop never commits the agent's work.
  • Never stage or commit tracker state yourself for loop work. The engine makes every tracker commit.
  • Never record the verify gate by hand during build. Only the build-to-verify loop advance merges the branch.
  • Get an explicit yes before you relay a confirm code. Each approval covers one checkpoint only.
  • Treat the base checkout as read-only while a pass runs. Your uncommitted files fail the lanes' landings.
  • Never clear another session's files to unblock a landing. Hold the branch until that session commits.
  • Confirm a landing from the [merged] line, not from the exit code. Every checkpoint stop exits non-zero.
  • Never signal a supervisor or its lanes. Use --max-passes or loop stop, so no lane dies mid-write.
  • When a required fact is missing, do not guess. Write .basicly/usage/needs-input.json and stop.

Drive one issue

basicly loop run advances to the next boundary where it needs an agent or a human. A leaf issue takes two runs:

basicly loop status <issue>                   # phase, worktree, gates, checkpoints, rework, ready and blocked sets
basicly loop run <issue> --work-type task     # intake -> worktree ready for the agent
#   ... write the code in the worktree, then git commit it on the harness branch ...
basicly loop run <issue>                      # land, verify, validate, ship, close

basicly loop advance <issue> [--work-type T] [--children plan.toml] [--mode M] does one step. Use it to inspect one transition. Both commands exit non-zero when the track stops short. Pass the input that loop status or loop advance names as needs input. Other flags on both: --runner <agent> (manual gives a handoff), --autonomy, --tier. loop run also takes --confirm <code>, --root <epic> and --detach.

Checkpoints and confirm codes

There are three ways past a checkpoint: an interactive terminal, a covering grant, or a relayed confirm code. Without a terminal, loop run stops at each checkpoint. It prints a one-time code and the full command to run again.

  1. Show the exact command, with the code.
  2. Say in one line what approval does. Read it from the challenge, not from the phase name. A classify approval provisions a worktree. A ship approval tears the worktree down and closes the issue. Ship does not merge and does not publish.
  3. Get an explicit yes. Silence, or a yes to a different checkpoint, is not approval.
  4. Run the command yourself.

Ask when the challenge appears, because the code expires after 15 minutes. If it expired, run the command again without --confirm to get a new code.

Relay the code on the reprinted basicly loop run <issue> --confirm <code>. basicly policy checkpoint <issue> <classify|decompose|ship> only shows the status. If you approve there, the checkpoint is approved but the loop stays parked.

A grant resolves checkpoints with no relay:

basicly policy grant <epic> --level L2 --token-budget <tokens>   # L2 and L3 need a budget
basicly loop run <issue> --root <epic>

Phases

loop run does every engine step. The agent proposes the work type, writes the child plan, writes the code and commits it.

PhaseWhat advances itCommands and notes
intakethe agent proposes the work type--work-type {bug,chore,task,feature,epic}. See "Classify by shape".
classify (checkpoint)approval, then the Definition-of-Ready (DoR) gateRelay the code on the reprinted basicly loop run <id> --confirm <code>. basicly policy dor <id> checks readiness. basicly policy scaffold --type <type> prints every required heading. See "Write a ready body".
decomposea feature needs a child plan. A leaf goes to build.basicly decompose <feature> --plan plan.toml [--dry-run], or --children on advance. See decompose-plan.
decompose (checkpoint)approval before fan-outRelay the code on the reprinted basicly loop run <id> --confirm <code>.
buildthe agent commits the work on the harness branchbasicly worktree list. Write the code, add fragments, git commit, then basicly loop advance <id> lands it through the serial merge queue.
verifythe landing ran verify and recorded the required gate; inspect it, then approve shipbasicly policy gate <id> to inspect. Relay the ship code on the reprinted basicly loop run <id> --confirm <code>, not on a bare basicly policy checkpoint <id> ship --approve, which leaves the loop parked.
validatean L3 unit needs a consumer verdict on the merged checkoutRefused first when the record states no requirements. Blocks with needs input: validation. Repair a FAIL in the lane's worktree and land again.
shipteardown and the closing writebasicly loop advance <id>. It blocks with no side effect on needs input: demonstration or on an unmerged branch.

Classify by shape

The work type decides if the loop asks for children. One coherent change is a task, bug or chore. Use feature only when the work fans out into children that land separately. A feature blocks at decompose and provisions no worktree. To fix a wrong type, run basicly tracker write -- update <id> -t task and run the loop again.

Write a ready body

Do not guess the DoR sections. Fill the TODOs that policy scaffold prints. A bug also needs ## Steps to Reproduce. An epic also needs ## Success Criteria. Pass the body with basicly tracker write -- create ... -d or basicly tracker write -- update <id> -d.

Every later phase reads ## Scope. Write each entry as one backticked glob on its own line:

- `src/app/cli.py`

A bare path, or a path with a note after it, parses to no glob. basicly policy dor <id> warns when ## Scope parses to zero globs.

Add fragments, never edit shared files

Two lanes that edit one shared file collide at the merge. A file named with the issue id cannot collide.

ChangeWriteNever edit
user-facing changechangelog.d/<issue-id>.<category>.md, body only, no ### headingCHANGELOG.md
new verify checka [[verify.checks]] entry in basicly.d/<issue-id>.toml[[verify.checks]] in basicly.toml
ratchet number moved[ratchet.<gate>] count_delta or [ratchet.<gate>.frozen] in basicly.d/<issue-id>.tomlthe ratchet table in pyproject.toml

The category is one of added, changed, deprecated, removed, fixed, security. basicly release assembles the changelog fragments. A ratchet fragment is a delta, never a new total. Two lanes that each record a total both write the same number, and the merged tree then fails the gate.

For a path that every lane appends to by convention, add it to [worktree] append_only_paths. The engine then serializes the lanes that touch it, and loop preflight warns with contend:. Split the shared file where you can, because serial lanes are slower.

Verify gate

The build-to-verify loop advance rebases, runs verify, records the required gate and merges. If you record the gate first (basicly verify --issue), the phase jumps to verify without the merge. Ship refuses to close an issue whose branch has not landed. After the landing merged, re-run the gate from the base checkout only:

basicly verify --mode full --issue <id>

A dirty worktree, or a branch with no commit, blocks the landing with "commit the work on <branch> before landing".

Gates and rework

Deterministic checks (tests, lint, types, build) record a required gate. A failed required gate blocks. Semantic AI checks record an advisory gate. It never blocks. A loop-provisioned worktree records gates in the base ledger through the redirect file. basicly verify --issue refuses in a linked worktree that has no redirect.

A failed node gets a bounded rework loop ([policy] max_rework, default 2). Rework is gate results and comments, not a status. At the cap, the node escalates to a human.

basicly policy rework <id> --gate verify [--record] [--allow-retry]

Answer an escalation

The engine reads the first word of the answer. A reason can follow it.

basicly loop answer <decision-id> "park - the upstream fix is not released"
AnswerWhat the engine does
retryGives one more attempt on that gate. A delegated answer does not give it.
re-dispatchNothing now. The supervisor runs the lane again on the next pass.
park or holdSets the lane deferred with the reason. It stops holding its parent open. Human only.
land anywayOnly for an unreliable-gate escalation. The next landing skips that gate once. Human only.

The command prints what it did, so an answer that changed nothing is visible.

To drop a requirement, kill the lane. A human must confirm, and a grant cannot replace the code:

basicly loop kill <id> --reason "<why this work is not done>"            # refuses and prints a code
basicly loop kill <id> --reason "<why>" --confirm <code> [--discard]

The kill tears the worktree down and closes the issue. The committed work stays on the harness/ branch unless you pass --discard. There is no undo.

Before you build

  • Check a third-party claim in the issue against the real tool. The DoR gate checks structure, not facts. Record the result with basicly tracker write -- comments add <id> "verified: ...".
  • Check a follow-up issue against the merged code. An issue filed after a lane overran records the lane's last position. Check each clause. Revert the mechanism that you think delivers it and watch named tests fail. Then run the real command. Close the issue with no diff when the work is done, and record the evidence.
  • Read the brief when a lane built the wrong thing. basicly brief <issue> prints what the loop dispatches, with no dispatch.

Tracker commits

The ledger is append-only. Its location follows .basicly/ledger/redirect, so every worktree writes the same log. If git diff --cached --stat shows deletions under .basicly/ledger/, stop and find what rewrote it.

The engine commits tracker state at three points:

  1. At provisioning, it commits the claim before it creates the worktree.
  2. At landing, loop advance puts the .basicly/ledger/** changes in one chore(tracker) commit, then merges.
  3. At ship, it commits the closing state.

Never commit the ledger on a harness branch. Grants, checkpoints and answers also write the ledger. Commit the ledger between those steps and the next landing.

The landing checks that the base checkout is clean, and it counts untracked files. Other dirt outside the ledger blocks the landing. Check the base before every landing:

git -C <base-checkout> status --short

Push cadence:

  • Solo repository: push once per track, after ship.
  • Team repository: push each engine tracker commit at once, most of all the claim, so nobody takes claimed work. A claimed record with no live worktree shows a race. Compare basicly loop status <id> with basicly worktree list.

Many lanes

Use preflight and supervise over an epic for parallel work. Only a human sets a limit on lanes. Control cost by the size of the work. Keep two or fewer agents in the base checkout. Put every other agent in its own worktree.

basicly loop preflight <epic>                                   # read-only: can a pass start, and what does it cost
basicly loop supervise <epic> --max-passes 3 --detach           # provision, dispatch, land through the merge queue
basicly loop stop <epic> --reason "<why>" --by <name>           # finish the current round, then return
  • Run preflight first, from the base checkout. A worktree cannot see the run records in .basicly/usage/.
  • Read the whole VERDICT: not ready - ... line. It lists every blocker, separated by semicolons.
  • Approve the epic's decompose checkpoint once. Without it, the pass ends seed-blocked, even with a grant: basicly policy checkpoint <epic> decompose --approve --root <epic>.
  • Start a supervisor with --detach. A round can outlast the timeout of the agent's shell tool. Read the log file it prints. Commit the ledger before you start it again.
  • Do not push while a pass holds the lock. Read in the base. Write in your own worktree until loop stop returns.
  • loop stop refuses when nothing supervises that root. A stale lock is taken only from a holder with a stale heartbeat.
  • --label <label> fans out over the issues with that label instead of the epic's children.

Size the grant budget, read the band table, and watch lanes with references/many-lanes.md.

Ship and retro

Ship tears down the worktree and closes the issue. The merge already happened at the landing. After an epic slice lands, write a retro comment and file a record for each finding the user keeps:

basicly tracker write -- comments add <epic-id> "Retro: <finding>"

Resume

To resume after a crash or an agent switch, run basicly loop status <issue>. Compare the result with basicly worktree list, and continue.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.