/kraft-lite:run-slicesfrom kraft-lite
Controls a sliced Kraft Lite run as the controller, spawning child sessions for each plan slice. Handles slice gates, child check-ins, PR reviews, and merges into the feature branch.
Ships in kraft-lite. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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.
You are the controller. Each slice is a part of the plan that stands
alone (section 1), built by a child session. The child walks the child
chain: the nodes kl.py gives it from this run's frozen chain, as
kraft-lite:build-slice lists them. Children report to you; you answer them,
review and merge their work into the feature branch, and keep the run's
truth in .kraft-lite/, copied to the state branch after every change. Your
conversation is not state: after a compaction or a restart, read state,
slices and decisions again.
In prose and checklists below, KL is short for
python3 "$CLAUDE_PLUGIN_ROOT/kl.py", and a KL command carries --chain-id <id>
even where it is not written: pass it to every verb except settings, import,
chains, detect, migrate and start. Type each command in full.
The tools for each ability are in your harness's guide; read it before section 2: Claude Code, Codex, Cursor, Gemini CLI, Antigravity, Amp, OpenCode. With no guide for this harness, or an ability its guide marks unconfirmed, follow discover.md before any fallback.
Entered at the slice gate: section 1. After a restart or a compaction: section 4. On a check-in or a child's message: section 5. A slice to review or merge: section 6.
At the slice gate, the last gate before the first build node, which state
marks gate.slice_gate true (chain_revision_approval on the default chain,
plan_approval on one that builds right after its plan gate). kraft-lite:next
invokes this skill there while sliced is null. Read KL slices first: its
shape names this chain's slice_gate, or says why it is unsliceable.
Unsliceable: tell the user its reason and draw nothing. At any other node: tell
the user slicing comes at shape.slice_gate, and draw nothing now. In both, go
on with kraft-lite:next, so each gate gets kraft-lite:gate's own question.
Slice only what stands alone: a part that uses no other part's work and is
coherent enough for its own tests and its own build, verify and review loop.
Groundwork and after order the parts that must come first; a part that needs a
sibling's work with no after doesn't stand alone. A slice of one or two tasks
almost never qualifies, and six slices are plenty.
Smaller independent tasks run as subagents in one session, which is the default;
a strained context is a reason to look for such parts, not a reason to slice. A
plan whose parts don't stand alone is not sliced: say so, delete any
.kraft-lite/proposals/<chain-id>.json left by an earlier round, then KL gate
and invoke kraft-lite:gate; the chain continues as one.
KL plan-slices reads the plan's ## Slices section, in Kraft's grammar
(- **Slice 1: <title>.** Tasks 2-4., keys 1 to n), and prints the
proposal's slices: take them as printed. A task in no slice is groundwork:
it prints a first groundwork slice that the others come after. A refused
section: tell the user its reason. With no section (slices null) or a
refused one, propose a grouping by the rule above.after (in a plan, a last sentence
Comes after slice 1.) is Lite's own, for a slice built on another's merged
work: Kraft can't slice a plan that uses it.KL decide --question "Mode for this run" --answer "<their words>" --why "set by the user",
else the mode KL settings prints. Add the feature branch (feature mode: a
new branch from the base branch, named by the repo's own rules; main mode:
null) and the state branch (section 7). The feature branch is never the
state branch..kraft-lite/proposals/<chain-id>.json:
{"mode", "feature_branch", "state_branch", "slices": [{"key", "title", "tasks": [N], "after": [key]}]}.
Then KL plan-slices --check .kraft-lite/proposals/<chain-id>.json: it
refuses a proposal that leaves a plan task out. Fix the proposal until it
passes. approve --slices runs the same check, and refuses an uncovered
proposal.KL gate, then invoke kraft-lite:gate. It presents the gate's own
artifact with the proposal beside it, and records the user's answer: an
approval as approve --slices .kraft-lite/proposals/<chain-id>.json, a
rejection by deleting the proposal. No slice records exist before the
approval. A rewind to the slice gate or earlier retires the slices
(kraft-lite:gate): slices lists none, and this section runs again.Copy this and tick it off; while a line is unticked, no child starts.
- [ ] Abilities confirmed from the guide, a local guide, or discover.md, or its fallback named: start, message, be messaged, archive, check in later. Each one with no guide, or that its guide leaves unconfirmed, looked for as discover.md says before its fallback. A missing ability is never a block.
- [ ] One user approval for every branch this run pushes outside this session's own: the feature branch (`feature` mode), and locally the state branch.
- [ ] Setup and the scoped test command run once here, and the working setup line written down.
- [ ] The user has finished giving instructions for this run: ask, and hear "go".
- [ ] Every command taken from a local guide (`.kraft-lite/harnesses/`) listed to the user in that ask.
- [ ] Rights read (section 12), and any the user changed for this run logged with `decide`.
- [ ] `feature` mode: feature branch pushed. State exported (section 7).
A slice's target is the branch its PR goes into: the feature branch, or in
main mode the base branch. KL slices lists what may start:
ready: every slice it comes after is merged. Start it, cut from the
target's tip (Cut from: target).early: it comes after exactly one slice, and that slice is in review or
ready to merge. It is cut from that slice's branch
(Cut from: <that slice's key>) and logged in step 3. Start it now when your
review of that slice has no findings or only small ones; otherwise it waits
for ready.A slice that comes after two or more slices starts only from ready, once all
of them are merged: one branch cannot hold two slices' unmerged work.
For each key you start:
KL slice-set --slice <key> --status starting --branch <slice-branch> --fork <sha>,
where <sha> is the commit it is cut from (git rev-parse origin/<branch>,
after git fetch origin <branch>).
Export state (section 7).<chain-id> <key>: <slice title>;
it is tagged with the chain id where the guide confirms tags; it has
an explicit model (middle tier).KL slice-set --slice <key> --status running --session <id> --branch <slice-branch>.
Started from early, also
KL decide --slice <key> --question "Start <key> from <slice>'s branch?" --answer "Forked from <branch> at <sha>" --why "...".
Export state.part i of n under the message limit. On the same machine, send their
paths instead.A replacement child for a slice whose branch already holds work (a resume)
continues that branch. Its Cut from: line carries the fork KL slices
records, from the slice its cut_from names, or target when that is null.
On the same machine, delete the old child's folder first,
$(git rev-parse --path-format=absolute --git-common-dir)/kraft-lite/<chain-id>/<key>/,
so the new child writes its own fork, base and chain files.
The starting instructions, in this order:
--fork sha: Cut from: target at <sha>
when cut from the target's tip, Cut from: <slice key> at <sha> when cut
from that slice's branch, where target is the word itself, never a branch
name. Then the state branch: its kraft-lite-state/chain.json is what the
child starts its child chain from.none; continue on the controller's check-in in its place. The channels
in the order to try them: a session message; on the same machine
.kraft-lite/messages/<chain-id>/<key>.jsonl under this checkout's absolute
path (the controller's chain id; one JSON per line: at, from, kind:
question|answer|status|done, body); else comments on its own draft PR into
its target, opened at its first commit.kraft-lite:build-slice; if the plugin is missing,
install it through the harness, else run
python3 <marketplace checkout>/plugins/kraft-lite/kl.py and read the skills
as files there.part i of n (or
as paths on the same machine); join them, write them down, and confirm.state dispatches for its first build node
under the slice layer; add no method of your own.kraft.verify_changed_test_scopes task runs under the slice layer.main mode the base branch. Its PR goes into the
target, and so does its kraft.mr_rebase. It rebases, and force-pushes its
own branch, as kraft-lite:build-slice says. The repo's rules, quoted from
its CLAUDE.md and CONTRIBUTING.md.main modeThere is no feature branch: nothing is pushed for one, and every slice PR goes
to the base branch. Merged means the user merged it: a slice after one ready to
merge is in early until then, and a slice after two or more waits for all of
the user's merges. When the user merges a slice, the steps after a merge
(section 6) apply, with the base branch as the target.
Before any other write and before starting anything:
-state branch in git worktree list, and with
none, ask the user and write nothing. Fetch the state branch,
KL import --from <state-checkout>/kraft-lite-state, then KL chains for
the chain id; with several unfinished chains, ask which. An empty chains
before the import is a missing import: never start a new chain. An import
refused as exported by an older Kraft Lite is a run from before V1 chains:
tell the user it must be finished on the previous Kraft Lite version, and
write nothing.KL slices. For every starting or running slice, and every waiting
one in ready or early, find its session, in the ways the guide
confirms: the recorded session id; a session whose title or name carries
<chain-id> and <key>; the chain-id tag; and its slice branch on the remote
(git ls-remote origin <slice-branch>) as evidence a child ran.
KL slice-set --slice <key> --status running --session <id> --branch <slice-branch>.starting, running, or its slice branch on the remote:
never start it blindly. Hold it with
KL decide --held --slice <key> --question "No session found for <key>: start a fresh child?" --why "starting a session twice duplicates the work",
tell the user what you found (a pushed branch, an archived session), and
start one only on their answer.waiting in ready or early, and no slice branch on the
remote: start it (section 3).A check-in is armed while any slice is not merged; in main mode, until the
nodes sliced.action marks await_user_merges close. Its message, word for word:
kraft-lite:run-slices check-in, chain <id>: read state first. Arm it with your
guide's "Check in later", about 20 minutes out, then end the turn: the check-in
wakes you, even after the session is reclaimed. Never wait on CI or a child
inside a turn. Every check-in:
- [ ] `KL state` and `KL slices`. Past the first build node: invoke `kraft-lite:next`, which records the user's merges, and skip to the last line. A non-empty `base_moved`: the rebase in section 6.
- [ ] Read messages, then `.kraft-lite/messages/<chain-id>/`, then each slice PR's comments.
- [ ] Per running child: its status summary where the guide has one, else `git fetch` + `git log` of its branch. Never its full transcript (it overflows your context).
- [ ] A child shown as blocked: find out on what (often its own subagents) before telling the user anything.
- [ ] `main` mode: each `ready_to_merge` slice's PR. One the user merged takes the steps after a merge (section 6).
- [ ] Answer every question (below). Export state.
- [ ] A child that is idle after reporting CI pending, or after a held answer: message it to continue.
- [ ] Report (section 8).
- [ ] Re-arm the check-in while its condition holds.
Answering a question:
KL decide --slice <key> --question "..." --answer "..." --why "...".
One the plan leaves open is still yours: the log keeps it cheap to overturn.KL decide --held --slice <key> --question "..." --why "...",
and tell the child to keep working on everything else.decide; if it comes back over the cap, hold it for the user. A binding in
.kraft-lite/bindings.yaml that a child's start or state refuses is
configuration: its question opens For the user: configuration, and it goes
to the user.Cut from: line:
KL slice-set --slice <key> --fork <sha>, then export state.You never answer a question that belongs to the user, and nothing but the
user's own answer answers it: silence never does. A push outside the child's own branch, merging
to the base branch, and anything settings gives the user, are theirs. In a
cloud session, a push the child was not given can only be approved by the user,
inside that child's own session: your "authorized" is refused there.
KL decide --held --slice <key> --question "..." --why "user-only: <right>".<id> and type:
You may push to <branch>." Any other answer: to you, in this session.KL answer --decision <id> --answer "<their words>",
then send their answer to the child (a permission: tell the child to look
for the words in its own session).| Thought | Reality |
|---|---|
| "They said keep things moving, don't block on me" | That is how to run the rest, not an answer to this. It stays held. |
| "I'll authorize it so the child can finish" | Your approval does not reach the child's session. It is refused there. |
| "Tell me if you want to approve it" | Wrong door: name the session and the words to type in it. |
| "They said yes to me; I'll relay it and have the child retry" | A relayed yes is refused too. Record it, and send the user to the child's session. The child does not retry until the words appear there. |
| "It's obviously what they'd choose" | Then it costs them one line. Ask. |
Red flags - stop and hold the question: you are about to type "I've authorized",
"the user approved, go ahead", "assuming yes", "proceeding unless", or to run
answer without the user's words in front of you.
Starting a review: KL slice-set --slice <key> --status in_review. Your review
is the slice's PR review, on the strongest tier. Read it against the slice's plan
tasks, the spec and the repo's rules, starting from the child's "look at first",
and check it keeps to the files and helpers its slice owns (section 1, step 2).
Read CI at the head you review and the scoped test paths the PR body lists, and
run no tests or checks yourself. What neither covers goes to the child as a
finding. Once your review has no findings or only small ones, start what
KL slices lists, as section 3 says. A small finding is a fix that changes
nothing a later slice builds on.
KL slice-set --slice <key> --status running,
and review again when it reports the fix. KL slices then lists in
base_moved each slice cut early from it, and each cut early from those:
once it is back in review, tell each to rebase onto the new tip of the slice
its cut_from names, naming that slice's branch, one after another down the
line, and record the fork
each reports (section 5). A recorded fork flags the slices cut from that one.feature mode: merge into the feature branch only on green CI at the exact
head you reviewed (pin the head SHA), and only once every slice it comes after
is merged; a head that moved, read the new commits.main mode: report the verdict to the user, naming any slice it comes after
that the user must merge first, then
KL slice-set --slice <key> --status ready_to_merge. The user merges it.
Start what KL slices lists, as section 3 says, and export state.After a merge (yours, or in main mode the user's), in order:
KL slice-set --slice <key> --status merged. It is refused while a slice it
comes after is unmerged: record that one first, or leave this one as it is
until it is merged.cut_from in KL slices says which:
the parent's key, or null for the target.KL slices now lists, as section 3 says.A call overturned later reopens the archived child, or starts a fresh one on the
target. When KL slices shows done: true on every slice (merged; in main
mode, ready to merge or merged):
KL decisions, while a call is cheap to overturn.KL decisions --unreported --mark, to mark it reported.KL close, and export state. The rest of the chain then runs per
state.sliced.action, through kraft-lite:next, which says where its tasks run.In a cloud session the state branch is this session's own branch, and this
checkout is its checkout. Locally it is the feature branch's name plus -state
(in main mode, a name for the run plus -state), in its own worktree. After every change to slices or decisions, check that
git -C <state-checkout> branch --show-current prints the state branch (switch
to it if not; never commit state on another branch), then:
python3 "$CLAUDE_PLUGIN_ROOT/kl.py" export --to <state-checkout>/kraft-lite-state --chain-id <id>
git -C <state-checkout> add kraft-lite-state
git -C <state-checkout> diff --cached --quiet || git -C <state-checkout> commit -m "kraft-lite state"
git -C <state-checkout> push origin HEAD:<state-branch>
It holds state only (no product code, specs or plans) and is never merged.
Report by invoking kraft-lite:status: it reads slices and the decisions log,
marks what it reports, and gives the report its shape.
When every slice is done, list the merged slices' branches for the user to
delete; when kraft-lite:next reports the chain done, the state branch too. In
feature mode, the MR node opens the feature PR: open none yourself.
With no guide for this harness, or an ability its guide marks unconfirmed,
follow discover.md first. With no way to start a child
even then: say so, and walk the slices here, one after another, in ready
order, with the same review, merge and state steps. Build each as its child
would: follow kraft-lite:build-slice on the slice's own branch, with this
session as its controller, so every question it would send is yours to answer.
Set the model on every child and every subagent:
KL settings gives the mode and who decides what. The user's words at the start
of a run override it for that run; record each change with
KL decide --question "Rights for this run" --answer "<their words>" --why "set by the user at start".
references/amp.md (opens in a new tab)references/antigravity.md (opens in a new tab)references/claude-code.md (opens in a new tab)references/codex.md (opens in a new tab)references/cursor.md (opens in a new tab)references/discover.md (opens in a new tab)references/gemini.md (opens in a new tab)references/opencode.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
7 skills in this plugin
/build-sliceBuilds one slice of a sliced Kraft Lite run as a child session that answers to its controller. Use when a controller's starting instructions name this skill, when a session is titled `<chain-id> <key>: <slice title>`, or when a controller or the harness tells a child to continue its slice, to rebase it, or that an earlier slice merged; the controller's side is `kraft-lite:run-slices`./gatePresents a Kraft Lite gate node to the user and records their answer. Use when a Kraft Lite chain's state is `blocked` at a gate node, or the user answers a gate./initWrites `.kraft-lite/bindings.yaml`, which binds a Kraft Lite chain's tasks to installed skills, instructions, or the repo's own test and CI commands where the defaults do not fit. Use when setting up Kraft Lite in a repo, when its bindings are stale, when a task should run a different skill or command, or when the repo still has a pre-V1 `.kraft-lite/registry.yaml` or a Kraft Lite verb refuses with `Run: python3 kl.py migrate`; starting work is `kraft-lite:start`, which needs no bindings./nextRuns 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`./startCreates a new Kraft Lite chain for the work and hands it to the first node. Use when the user asks to start, begin or kick off new work or a new chain under Kraft Lite; continuing an existing chain is `kraft-lite:next`./statusReports where Kraft Lite chains have got to, without changing them. Use when asked where a Kraft Lite chain or its slices are, whether it is stuck, or how long a run took or what it cost, and when `kraft-lite:run-slices` hands over its report; `kraft-lite:next` continues a chain, `kraft-lite:gate` answers a gate and `kraft-lite:run-slices` starts and merges slices.npx claudepluginhub itsomidkarami/kraft --plugin kraft-liteOther plugins' skills for the same job