Skip to content
Back to skills

Next

ASecurity

Runs the next node of a Kraft Lite chain from its recorded state. Use when continuing a chain: right after `kraft-lite:start`, after `kraft-lite:gate` has recorded an answer, when the user says to carry on or that they merged a slice's PR, or in a new or cleared session. A chain blocked at a gate belongs to `kraft-lite:gate`; a read-only progress question belongs to `kraft-lite:status`; a slice's child starts with `kraft-lite:build-slice`.

  • 16 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added October 21, 2026
ai-agentspythongoshellnodegit

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add itsOmidKarami/kraft --skill next --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Next?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Next
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/itsomidkarami-next/badge)](https://www.skillsdirectory.com/skills/itsomidkarami-next)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: next
description: "Runs the next node of a Kraft Lite chain from its recorded state. Use when continuing a chain: right after `kraft-lite:start`, after `kraft-lite:gate` has recorded an answer, when the user says to carry on or that they merged a slice's PR, or in a new or cleared session. A chain blocked at a gate belongs to `kraft-lite:gate`; a read-only progress question belongs to `kraft-lite:status`; a slice's child starts with `kraft-lite:build-slice`."
---

# Running the next node

If `$CLAUDE_PLUGIN_ROOT` is unset, `kl.py` is two directories above this file;
it needs `python3` 3.10 or newer, and without one, tell the user and stop.

This skill holds no state in the conversation: everything comes from `state`,
so it survives a `/clear`. Below, `KL` is short for
`python3 "$CLAUDE_PLUGIN_ROOT/kl.py"`, and every `KL` command except `settings`,
`import`, `chains`, `detect`, `migrate` and `start` carries `--chain-id <id>`.
In a cleared session you have no id: take `chain_id` from `KL chains`, or from
a bare `state` while one chain is unfinished. If a verb exits saying there is
more than one unfinished chain, show the user the list it printed and ask
which - don't pick. A verb that refuses with `Run: python3 kl.py migrate` means
a run or registry from an older Kraft Lite: follow `kraft-lite:init`'s last
section, `A pre-V1 directory: migrate`, then go on with the new id it prints.

## 1. Read the state

    python3 "$CLAUDE_PLUGIN_ROOT/kl.py" state --chain-id <id>

You get `chain_id`, `node`, `kind` (`exec` or `gate`), `status`, `note`, `attempt`, `cap`,
`read_only`, `steps`, `on_failure`, `on_failure_ran`, `fix_loop`, `on_base_changed`,
`on_merge_rejected`, `gate` and `sliced`.

- `status: unstarted` - there is no chain here: tell the user so. Invoke
  `kraft-lite:start` only if they asked to begin work, with the title they gave.
  Do not report this as finished.
- `status: done` - the chain is finished. Report what it cost (section 5) and stop.
- `status: blocked` - a gate is waiting. Invoke `kraft-lite:gate`. Do not proceed.
- `sliced` null, as in most chains - `kind: exec` is section 2 and `kind: gate`
  is section 4; skip the rest of this section.
- `sliced` not null, `status` neither `done` nor `blocked` - `sliced.action` says
  what this node is:
  - `run_slices` - invoke `kraft-lite:run-slices`, which closes this node when every
    slice is done. Stop.
  - `scoped_verify` - a quick check of the seams between slices before the
    feature PR. In the feature worktree (below), first set it up as the repo says:
    a fresh one has nothing installed. Then run only the node's tasks with
    `task_kind` `builtin` and `ref` `kraft.verify_changed_test_scopes`, on the files
    `git diff --name-only origin/<base branch>...HEAD` lists there: a `prompt`
    task runs on their test paths, a `subprocess` `command` gets them appended,
    and one that takes no paths is a reason to stop and say so, never to run the
    whole suite. Run none of its other tasks: every slice was reviewed, and the
    feature PR's review covers how they fit. Then `KL close`, or section 3 on a
    failure.
  - `skip` - `KL close` with nothing run (`KL approve` on a gate node: `close`
    refuses one), then this skill again.
  - `await_user_merges` - check the PR of each slice that `KL slices` does not show as
    `merged`. For each the user merged: `KL slice-set --slice <key> --status merged`,
    tell each slice cut from its branch or from the target to rebase onto the
    target, and archive its child, as `kraft-lite:run-slices` says after a merge,
    then export state, as `kraft-lite:run-slices` describes under State branch.
    Record a slice merged only once every slice it comes after is: `slice-set`
    refuses it before. Name the slices still waiting and stop. Once all are
    merged, `KL close` (`KL approve` on a gate node), then this skill again. Never
    open this node's gate or ask anyone to approve it: the user's merges are the answer.
  - `run` - as in an unsliced chain, below.

In a sliced `feature` run, every task from the first build node on (the
`shape.first_build` that `KL slices` prints) runs in a
worktree of the feature branch, never in the state branch's checkout: the rebase
and the PR are made from the branch they run in. Make the worktree
once, from origin's feature branch, where the slices merged:

    git fetch origin
    git worktree add -B <feature branch> <path> origin/<feature branch>

The local feature branch is as old as the run's start: a worktree of it tests
none of the slices, and a push from it drops them. If `git worktree list` shows
the feature branch checked out already, use that checkout, after
`git -C <it> merge --ff-only origin/<feature branch>`. Only the tasks run there:
every `KL` command runs from the controller's checkout, the one whose
`.kraft-lite/` holds the chain, not the worktree's own, empty one. So a file a
task writes there is recorded by its absolute path in the worktree.

## 2. Run an exec node

Run `steps` in order. The tasks inside one step may run in any order, or in
parallel as subagents (set each one's model explicitly, from the task's `hints`
where they name one, not the strongest by default). Run each task by its `kind`:

- `skill` - invoke `skill`, with `prompt` as the instruction.
- `prompt` - follow `prompt`. A `source` ending `(skill missing)` means the bound
  skill is not installed here, and Lite ships no method for it: say you fell back.
  One ending `(shipped method)` means the skill is missing too, but `prompt` ends
  with a `## Method` section naming a file: read that file and follow it as the
  task's method.
- `subprocess` - run `command` as an argument list, without a shell; show its output.
- `skip` - run nothing; say the task was skipped, and its `why`.

A non-empty `note` means the node was sent back (a rejection, a base change or a
merge drop), and `state` doesn't put it in any task's `prompt`. Give it to every
`skill` and `prompt` task as the first thing in its instruction.

A step with `read_only: true`, or any step in `steps` when the node's own
`read_only` is true, changes nothing: write, edit and commit nothing, run no
test or command that writes, leave no file behind. The node's flag doesn't reach
its `on_failure` or `fix_loop` steps, which repair. Kraft Lite does not check
this: the rule is yours to keep.

After a task with `produces`, record the file it wrote before anything else:
`KL produced --kind <produces> --path <file>`, `<file>` being the absolute path
where the task wrote it. A gate later presents it.

A step fails when a task in it fails or reports findings of critical or
important severity; no later step runs then: section 3. A step that moved the
branch's base (a rebase or sync that did work) has not failed. If
`on_base_changed` is set, stop the node there and `KL restart`: it reopens the
walk from `on_base_changed.restart_from` through this node. Then this skill
again. It refuses past `on_base_changed.cap` restarts: with `restarts` already
at `cap`, stop and ask the user instead, as for `over_cap`.

The merge task can report that the forge's merge train or merge queue dropped
the PR instead of merging it: the pipeline it ran on the PR merged into the
target failed, or the target moved under it. No step failed, so spend no
`attempt` and skip section 3. First, before any repair runs or anything is
pushed: with `on_merge_rejected` null, or `rejections` already at its `cap`,
stop and tell the user why the PR was dropped, as for `over_cap`. Stop the same
way when the forge gave no reason a repair can act on: the PR was taken off by
hand, or for a reason it does not say. Otherwise run
`on_merge_rejected.repair.steps` as above, with the drop's reason and each
failed job as their input. If they committed nothing, stop and tell the user:
the forge would drop the same head again. Else push what they committed to the
PR's branch, then `KL restart --merge-rejected`: it reopens the walk from
`on_merge_rejected.restart_from` through this node, gates included, so the PR's
checks and the final gate are answered again before the merge runs. Then this
skill again.

Checks still running are neither a pass nor a failure: leave the node open,
spend no `attempt`, run no `KL close`, and wait as below. Every step passed:
`KL close`, then this skill again. In a sliced run (`sliced`
not null), export state after every `close`, as `kraft-lite:run-slices`
describes under State branch.

Resuming replays a node from its first step: keep tasks idempotent, and stop and
ask rather than run twice one that is not. Before replaying a task, check what
it left: the branch, the PR, the merge. The chain froze at `start` and cannot
be reordered, but `.kraft-lite/bindings.yaml` is read again at every `state`, so
rebinding a task there is how a live chain is corrected.

## 3. When a step fails, in Kraft's order

1. Every failure is a task with `task_kind` `builtin` or `forge` that ended in
   an error no repair can change - credentials, a tool missing, no PR: stop and
   tell the user, and spend no attempt and no `on_failure`. Failing tests or
   failing checks such a task reports are findings, for the fix loop below.
2. The node failed, `on_failure` is set and `on_failure_ran` is false: run
   `on_failure.steps` as in section 2, `KL mark --on-failure-ran`, then the
   whole node again from its first step.
3. `fix_loop` null: stop and report. A node with no fix loop has no retry budget.
4. `KL attempt`. When it prints `attempt` 2 or more and `fix_loop.judge` is set,
   run the judge first, with every attempt's findings and `attempt` against
   `cap`. It returns `continue`, `stop_needs_human` or `stop_downgrade`, with
   `concerns`. On `stop_needs_human`, stop for the user with its `concerns`. On
   `stop_downgrade`, finish with findings when no task failed outright (`KL close`,
   report the findings left). On `continue`, step 6 hands its `concerns` to the
   repair. No verdict buys a cycle past the cap: step 5 still applies.
5. `over_cap: true` - stop the chain and escalate: show the user every attempt's
   output, not a summary. A cap that is hit is a failure they need the traces for.
6. Run `fix_loop.steps` as in section 2, with what failed, the findings and the
   judge's `concerns` (when it ran) as their input, then the whole node again
   from its first step - not the chain.

## 4. A gate node

- `gate.slice_gate` true and `sliced` null: invoke `kraft-lite:run-slices`. It
  decides whether to slice, opens the gate itself and hands it to
  `kraft-lite:gate`. Stop.
- Otherwise `KL gate`, then invoke `kraft-lite:gate`. Stop. Never `approve` or
  `reject` it here, whatever the user said before it opened: the gate skill
  presents it and records their answer.

## 5. When the chain is done, report what the run cost

    python3 "$CLAUDE_PLUGIN_ROOT/kl.py" summary --chain-id <id>

Render it as a short table - one row per node with its time, how much of that time
was `blocked_seconds` waiting on the user, attempts against the cap where there is
one, its gate, and any rejection note - then a line of totals. The shape to
follow, with the field names from `summary`:

    node           seconds  blocked_seconds  attempts/cap  gate           rejected
    spec_approval      312              300  -             spec_approval  -
    verification       120                -  1/2           -              -
    total   nodes 2, duration_seconds 432, blocked_seconds 300, attempts 1, gates 1, rejections 0

`blocked_seconds` is normally part of the node's `seconds`, not extra to it. Say
which of the two the run actually went on - in a gated chain the waiting is usually
the larger, and reporting the total alone bills the agent for the user's hours.
After a rewind the two stop nesting: waiting is banked across every round, while
`seconds` is re-timed from the redo. Report them as the node's whole history
against its last run. Likewise `attempts` is every attempt the node ever cost, so
after a rewind it can exceed `cap`, the budget it has now: those are the retries
the run paid for.

Times are stamped a second apart at the coarsest: a fast node's second is the
clock's floor, not a measurement - say so. There is no token count, cost or turn
count: Lite runs inside your session and never sees them. Do not estimate them.

## A wait never blocks

A task that reports CI or an approval (`mr.ci`, `mr.external_approval`,
`mr.post_merge_ci`) reports once. Never sit in a synchronous loop waiting for
it. Do not idle - the user is sitting here, and their attention is the resource
this whole mode is spending. If your harness can wait in the background and wake
you when the wait finishes, use it: start the check in the background, say so,
and report once when the pipeline settles.

If your starting instructions name a controller, wait for CI as
`kraft-lite:build-slice` says. With no controller and no background primitive,
run the check once, report, and tell the user to invoke this skill again when it
finishes. That is the fallback, not the design.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.