session-next
Skill3 starsChanged 5 months agoMITView on GitHub
Implement the next work item from the project's backlog. Asks the runtime to select one accepted item, claims it, executes one bounded unit, and records the result against that identity. Use when the user wants to make progress on the backlog without naming a specific item. Triggers on "/session-next" or when user says "implement the next task", "do the next task", "what's next — just do it", or "work the backlog".
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- security-liability-auditSkill
- session-add-taskSkill
- session-brainstormSkill
- session-debugSkill
- session-delegationSkill
- session-gatekeeperSkill
- session-groomSkill
- session-initSkill
- session-post-implementationSkill
- session-releaseSkill
- session-repairSkill
- session-research-designSkill
- session-task-planningSkill
- session-verifySkill
- update-architectureSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 6 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 42
Read result.candidate and result.considered.
- Very specific: line 74
Write the resolved unit down before going on: SEQ identity, task ID where there is one, the record's current revision, and its …
- Distinctive: line 92
Before source edits, follow Start or resume a source workspace.
- Distinctive: line 95
When using a separately authored oracle, follow Materialize acceptance tests in the assigned workspace before execution.
- Distinctive: line 98
Read the record's scope region and every file it names before changing anything.
- Distinctive: line 100
Add the regression test that pins the accepted criterion — one focused test, in the existing test module where one exists, covering the …
- Distinctive: line 101
Run the record's named Test command and keep its output.
- Very specific: line 103
When the user widened the unit to several task IDs, hand them to /session-delegation instead of running them here: pass the SEQ identity …
- Very specific: line 143
Find the runbook: Use paths.runbook in .session-flow.json.
- Very specific: line 175
Run select and check the candidate against the policy: scope.seq must name its identity, and scope.actions the action this unit performs.
- Distinctive: line 176
Check the stops below. The first one that holds ends the run there.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Session Next
Select, claim, and execute one bounded unit of accepted work.
Open with one sentence saying what you are about to do and what it will produce.
Non-Negotiables
- Selection comes from
select, never from a file. The sequence atpaths.sequenceis generated output: read it to see the backlog, never to pick from it, and never edit it.selectreturns one candidate and the eligibility reasons for everything it considered, and it starts nothing. - Only accepted work is eligible.
capturedwork, work whose acceptance no longer names the current scope fingerprint, and work still marked(needs breakdown)are refused byselectwith a reason. A linked breakdown file confers no eligibility, and neither does an existing record. - Claim before executing, and execute only what the claim names. The claim carries the identity, the expected revision, and the allowed paths. It records a bounded assignment and moves an
acceptedrecord toactive; it does not run that assignment and does not schedule it. - Record results through
record-resultagainst the claimed identity. Apassedresult also closes a task; there is no separatetransition. Never write completion into the sequence view or a task view — both are derived, and the nextrenderdiscards anything typed there. - A passing task is not a delivered outcome. A task result never moves its parent to
done, andrecord-resulton an item never changes the item's lifecycle. Parent completion needs applicable evidence for the accepted outcome, which is/session-verify's judgement, not this skill's. - One bounded unit per invocation. Finish it, report, and name the next candidate without starting it. Continuation over several units needs its own scoped invocation, or the standing policy Continuation Over Several Units defines — capacity, scope, and stop conditions, re-resolved before every dispatch.
- One mutation per record at a time. Never send two mutating runtime calls for the same record at once. Wait for each call's result and re-read the record before the next, because every write moves
revisionand the second call would fail asstale-revisionor overwrite the first.
Step 0: Resolve the Runtime
Every record read or written here goes through the helper at <package-root>/scripts/session-flow.py. Resolve it by the one rule for this host (references/runtime-integration.md): the plugin root in ${CLAUDE_PLUGIN_ROOT} for a native plugin, the discovered installed package for Codex, or the session-flow-runtime.json descriptor beside this SKILL.md for a standalone copy. Then confirm it answers, with absolute paths for the interpreter and the entrypoint:
Resolve the canonical runtime project root and unique session actor using
Task workspaces and Git handoff.
$PROJECT_ROOT always names that runtime project, even when source work runs in another checkout.
python3 -B "$ENTRYPOINT" --project-root "$PROJECT_ROOT" doctorstorage.work_root and storage.sequence_path come from .session-flow.json, so a wrong root shows up here rather than three steps later. When the runtime cannot answer, report what is missing and where it was expected, and stop. There is no hand-editing path.
Step 1: Select One Candidate
python3 -B "$ENTRYPOINT" --project-root "$PROJECT_ROOT" selectRead result.candidate and result.considered. The candidate is one work item, ordered by priority, then provenance — a manual item outranks an [auto] one at equal priority — then order, then identity.
candidateisnull: nothing is eligible. Report each considered item with its reasons verbatim, and offer/session-groomfor items needing a breakdown,/session-gatekeeperfor untriaged intake, or acceptance for items stillcaptured. Do not pick an ineligible item anyway.- The user named an item: pass
--seq SEQ-NNN. The answer is then that item or its reasons for being ineligible — never a different item.
A Direct Instruction for a captured Item
When the user directly instructs you to implement a named item that is still captured, their message is the authority. Record acceptance first, quoting the message as the authority source and giving the decision scope as a list of strings, then run select --seq again and continue:
python3 -B "$ENTRYPOINT" --project-root "$PROJECT_ROOT" accept --seq SEQ-042 --input accept.jsonThis is the one payload example in this skill. For claim, record-result and the other payloads, run session-flow.py schema <command>: it prints the required and optional fields and an example.
{"expect_revision": 2, "actor": "<this session>",
"authority": {"source": "user message: \"implement SEQ-042\"", "revision": "<approval timestamp>"},
"scope": ["implement", "verify"]}Quote only what the user said, and list only the actions it covers. A merge, deployment, or external post is not covered unless the message names it. Without a direct instruction, a captured item stays ineligible.
Step 2: Resolve One Bounded Unit
The candidate is a work item, not permission to run everything under it.
- Compact item (
task_counts.totalis 0): the unit is the item itself.intent.mdis the whole record — scope, approach, and result all live there. - Expanded item: the unit is exactly one task — the first whose lifecycle is
acceptedand whosedepends_onentries are alldone. Read it withshow --seq SEQ-NNN --task A1.
Widen the unit only when the user names the additional task IDs in this invocation. Then echo the resolved set back in one line before claiming. Never derive extra IDs from a title, a heading, a phase label, or the tasks sitting beside the one you resolved.
Write the resolved unit down before going on: SEQ identity, task ID where there is one, the record's current revision, and its allowed_paths.
Step 3: Claim the Resolved Identity
Build the payload as a file — no option accepts free text — and claim exactly the identity Step 2 resolved. The payload carries coordinator, actor, seq, task (for a task), expect_revision and allowed_paths. Run session-flow.py schema claim for the required and optional fields and an example.
python3 -B "$ENTRYPOINT" --project-root "$PROJECT_ROOT" claim --seq SEQ-042 --task A1 --input "$PAYLOAD"A successful claim on an accepted record also moves it to active. Do not send a transition to start the work.
missing-authority: another actor holds the claim. Report the holder and stop. Reassign only when the user says to, withtakeover_claimand the authority that reassigns it.stale-revision: the record moved since Step 2. Re-read it and rebuild the payload; never retry with the old revision.- The payload needs no
operation: the runtime generates one and returns it underoperation. If you may need to retry after an interruption, send your ownoperationid in the first call; then re-sending the same payload with that id returns the prior result withreplayed: trueand the bounded assignment stands. Otherwise runshow(andreconcileif the runtime reports a pending operation) before re-sending, becauseexpect_revisionmakes a blind retry fail withstale-revision. A different payload under that id is refused.
Step 4: Execute the Claimed Unit
Before source edits, follow Start or resume a source workspace.
Record the assignment through revise and execute in the assigned checkout, retaining the canonical
runtime project root for record commands. Resume preserves existing work and verifies its identity.
When using a separately authored oracle, follow Materialize acceptance tests in the assigned workspace
before execution; verify its identity and that the test command inspects this source checkout.
- Read the record's scope region and every file it names before changing anything.
- Implement inside
allowed_pathsonly. If the work needs a path outside them, stop and report: the scope is wrong, and widening it is a decision, not a detail. When the user approves the widening, follow the widening sequence in/session-delegation:revisechangesallowed_pathswith the approval quoted in itscorrectionfield, then the same actor re-claims with the full new list, because a claim replaces the previous claim's paths. - Add the regression test that pins the accepted criterion — one focused test, in the existing test module where one exists, covering the decision logic rather than the framework. Where the project's own CLAUDE.md states a testing rule, that rule wins.
- Run the record's named Test command and keep its output; Step 5 records it.
When the user widened the unit to several task IDs, hand them to /session-delegation instead of running them here: pass the SEQ identity and the explicit task IDs. Delegation dispatches those IDs and their permitted prerequisite closure, and nothing else in the item.
Step 5: Record the Result
The close-out is two calls: claim (Step 3), then record-result. Build the result payload as a file; run session-flow.py schema record-result for the fields.
python3 -B "$ENTRYPOINT" --project-root "$PROJECT_ROOT" record-result --seq SEQ-042 --task A1 --input "$PAYLOAD"
python3 -B "$ENTRYPOINT" --project-root "$PROJECT_ROOT" renderoutcome is one of passed, failed, blocked, unknown, and it says what actually happened. A check that could not run is unknown, never passed. Only the claiming actor may record the result. Put the criterion, environment, code revision and limitations in result.evidence.
For source work, follow Record an exact-commit handoff before declaring readiness for integration. Record the tested commit and source assignment in the existing result fields; a local pass without that handoff does not make the source ready.
On a task, the outcome decides the lifecycle:
passedcloses the task, when it isactive: the runtime records the result, adds an evidence entry built from the result's evidence at the task's current fingerprint, and moves the task todonewhen the completion gate passes.result.not_closedin the response: the result and evidence are recorded, but the gate refused to close the task and it staysactive. The value gives the reason. Fix the cause: re-accept with"lifecycle": "active"in the accept payload (a bareacceptfails on an active task), or record a same-meaning decision (thesame_meaningkey in arevisepayload) when the meaning did not change, or add the missing evidence; then record the result again. Report it; do not treat the task as finished.blocked: the task moves toblocked. To resume it, the claim holder sends atransitiontoactive, then records the result again.- A task that is not
active: the result is recorded without an evidence entry and without a lifecycle move, and apassedresult returnsnot_closedsaying so. The remedy depends on the lifecycle.accepted: claim it, then record the result again.blocked: the claim holder transitions it toactive, then records again.done: it is already closed and nothing needs to happen.captured,deferredandcancelled: it needs acceptance, or a reopening with a correction, before a result can close it. failedorunknown: the result is recorded and the task staysactive.
result.evidence is optional, but on a passed result for an active task its criteria, when evidence is present, must be a non-empty string; otherwise the call is refused and nothing is recorded. Other outcomes and tasks that are not active store result.evidence as sent. Leaving evidence out closes the task only when an applicable evidence entry is already recorded on it; otherwise the result is recorded and the task stays active. The runtime marks the entry source: "record-result": it is your own report, not independent verification. claim, result and corrections are written only by claim, record-result and the correction key, and a revise or transition that changes them is refused. claim needs a record that is accepted, active or blocked and whose acceptance names the record's current fingerprint, and is refused as missing-authority otherwise.
On a compact item, record-result records the result and never changes the item's lifecycle. Completion stays with /session-verify.
Step 6: Report
- The SEQ identity, the task ID where there is one, and the outcome the result records.
- The checks behind that outcome, with their output.
- What the parent still needs: the tasks not yet
done, and thedeliverytarget the accepted scope requires. Say plainly that a passing task is progress, and that/session-verifydecides whether the outcome is delivered. - The next candidate from a fresh
select— named, not started.
When the user asks to commit, push or deploy
Delivery is a separate action from the unit's result, and it gets its own receipt. Delivery authority exists only where the user granted it: a passing task, an accepted item or a standing continuation policy does not grant it. Do each step in order and stop at the first one that fails.
- Find the runbook. Use
paths.runbookin.session-flow.json. When it is absent, look for the runbook in the project's CLAUDE.md or AGENTS.md. When neither names one, ask the user, and offer to record the answer inpaths.runbookso the next delivery does not ask. - Commit only the item's paths. In each assigned source workspace, stage by name the item's files and the tests written for the item, which sit outside
allowed_pathson purpose. For an item with tasks, the item's files are the union of its tasks'allowed_paths, becauseallowed_pathslives on task records. For a compact item, they are its ownallowed_pathsor claim paths. Leave unrelated changes in the working tree alone. Record the checked exact-commit handoff. A commit-only request ends with that local receipt and grants no integration or push authority. - Claim and validate integration. Follow Claim integration ownership and Validate and integrate submitted work. An authorized delivery uses a bounded integration task claiming the common canonical integration directory. Keep that claim live through effects and receipts; refuse held claims, changed heads, unfinished ancestry and unexplained interrupted state. Integrate only ready inputs and validate the canonical result.
- Check the hooks. Confirm the repository's hooks are present and executable before pushing. A hook that is missing or not executable is a failure to report, not something to skip.
- Push the checked canonical revision to the branch and remote the runbook names, only under push authority. Revalidate after target advancement or rejection as the shared procedure requires. Do not publish directly from a task workspace or fall back to force-push.
- Check the deployed revision and its health. Where deployment is authorized, confirm the target runs the revision you pushed, then run the runbook's health check against it. Report a mismatch or a failing check as it is. A push-only request records the push and leaves deployment explicitly pending.
Record
delivery.receipton the item throughrevise, with the revision, the target and the health result, as{"revision", "target", "health"}. Where it goes depends on what the item stores:- The item stores a
deliveryrequirement. Arevisepatch replaces the wholedeliveryobject, so resend the storedrequired,targetandrepositorykeys unchanged and addreceipt; dropping them changes the fingerprint and makes acceptance stale. Setdelivered_at(ISO-8601 UTC) insidedelivery, the key the completion gate reads, only when the push and the health check both succeeded. - The item stores no
delivery. Do not write one: adeliveryobject holding only a receipt changes the fingerprint and makes acceptance stale. Append the receipt as an evidence entry instead, after the stored entries, withcriteriaDelivery receipt, the item's currentfingerprint, the revision, target and health result, andresultpassorfail.
When a step failed, stop, record the receipt with what you observed (no
delivered_at, orresultfail), and report. A failed health check is recorded as failed, and it is not a delivery. A later successful delivery records a new receipt, and its entry supersedes the failed one.- The item stores a
- Settle integration. Follow Pin release sources and settle receipts to record submitted, integrated and observed published heads with checks before the integration task's result. Preserve unknown outcomes and remaining reconciliation. Any result releases overlap exclusion, so the next owner must inspect incomplete Git/publication state and reclaim before further effects.
Verification the user already authorized continues as separate work and is never cancelled silently. If delivery would change what that verification tests, say so and ask. /session-verify points here for how delivery is done.
Continuation Over Several Units
Continuation is off unless something outside this run authorizes it: an invocation that names the further units, or a continuation policy in .session-flow.json. Without one, Step 6 ends the run — name the next candidate and stop.
The continuation object in .session-flow.json has four keys:
"authority":source(for examplemaintainer-standing-policy) andrevision(a timestamp)."capacity":units, how many units the run may complete."scope":seq, the identities it covers, andactions, such asimplement."stop_conditions": a list such as["result-not-passed", "delivery-outstanding"].
All four keys are required, authority.source is a trusted source and never auto, and stop_conditions holds only the two tokens defined here. A block missing a key, or naming a condition this skill does not define, authorizes nothing: run one unit and stop. result-not-passed stops on the first recorded outcome that is not passed. delivery-outstanding stops when the finished unit's parent still owes the delivery target its accepted scope names.
Each round, before claiming anything:
- Re-read the policy from
.session-flow.json. Authority is re-resolved every round, never carried over from the round before. - Run
selectand check the candidate against the policy:scope.seqmust name its identity, andscope.actionsthe action this unit performs. - Check the stops below. The first one that holds ends the run there.
Then claim, execute, and record as Steps 3 to 5 do, and count one unit against capacity. A unit already claimed finishes: its result is recorded even when the policy is withdrawn while it runs. Revocation blocks the next dispatch; it does not erase an effect that already happened.
| Continuation stop | Reported as | What to report |
| The policy's capacity is spent | capacity-exhausted | The units run, the capacity, and the next candidate — named, not started |
| A configured stop condition holds | stop-condition-met | The token that held and the record that met it |
The policy is gone, its revision changed, or scope no longer covers the next unit | missing-authority | The authority the run started under and what stands now |
| The next unit is claimed by another actor | missing-authority | The holding actor. Never take a claim over to keep continuing |
| Acceptance no longer names the record's current fingerprint | missing-authority | Both fingerprints, and that re-acceptance is a decision, not a detail |
select returns no candidate | no-candidate | Every considered item with its reasons verbatim |
Report the stop with the run: how many units ran, which identities, and the reason it stopped.
A Bounded Request From Ops
Ops produces requests, not assignments. A request names the seq it concerns, the action it asks for, and the capture identity it came from; everything else it carries is provenance. Treat it as a candidate: run select --seq for that identity and apply the policy above. Local execution does the work, under the policy or under a scoped invocation — the request itself confers nothing. With no standing policy covering that identity, the request starts nothing: report missing-authority, name the request, and leave it for the user. A request naming its own authority is refused the same way.
Chain context: see references/workflow-overview.md.
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
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.

