/iki:iki-character-loopfrom iki
Drives a generator/critic loop that refines a rigged Iki character (.iki) until it matches a reference illustration. Alternates an artist agent with critic agents to iteratively improve character quality.
Ships in iki. 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.
None: SKILL.md is the whole skill.
iki-character produces a renderable character in one pass. This skill makes
one that is good, by giving the process the two things a single pass lacks: a
fixed target to aim at, and someone to say how far off it is.
references (iki-create-image, once)
│
▼
┌─► artist ──► rigged .iki ──► orchestrator renders ──┬─► critic ────────┐
│ └─► appeal critic ─┤
│ │
└───────────────────── typed findings ◄──────────────────────────────────┘
You are the orchestrator. You spawn the three agents, carry artifacts between them, render each round, arbitrate escalations, and enforce the caps. No agent talks to another directly.
iki:iki-character-artist
and iki:iki-character-critic, and iki:iki-character-appeal-critic fresh
each round with only its inputs in the prompt. A session started before the
plugin gained an agent cannot dispatch it by name: give a general-purpose
subagent that role file's body instead, as Codex does.agents/ are role instructions, not
registered agent types. Resolve the plugin root two directories above this
skill's directory. Spawn a standard subagent for each role and tell it to
read the body of the artist or
the critic or
the appeal critic, passing the
absolute plugin root and the round's inputs. Their YAML tools, model and
color fields are Claude metadata; use Codex's available tools and inherited
model. Resume the same artist or critic subagent for later work. Spawn the
appeal critic without the parent's history (fork_turns: "none") and never
resume it: a forked subagent inherits this conversation, references and the critic's judgments
included, which would end its blindness. If subagents are unavailable,
perform the artist and critic steps sequentially with the same ownership
rules, rubric and caps, and the appeal checklist after the critic's step; it
is not reference-blind (you have seen the reference), so say so in item
6's message to the user rather than claim it.MCP tool prefixes vary by host: resolve the bundled iki server's tools by
their tool names. The render step needs no browser automation in either host.
Parts are generated independently, so nothing ties them together but a style string — and that is not enough. Real drift from an unanchored run: a photoreal macro-photograph iris on a flat cel-shaded face; orange highlights in the front hair and none in the back. A reference image is a shared anchor every part is drawn against.
The obvious loop — "compare, then regenerate" — cannot converge, because most defects are not art defects. From one real session, six defects:
| Defect | Actual cause | Regeneration fixes it? |
|---|---|---|
| Iris reads as a bead in white | the composer's iris ratio | no |
| Head slides off the shoulders | auto-rig translateX binding | no |
| Brows invisible | draw order vs. hairstyle | no |
| Lash misaligned from sclera | a careless layout.json edit | no |
| Straight seam on head turn | art cut through by its own frame | yes |
| Photoreal iris on a flat face | art style drift | yes |
Four of six were code or constants. A critic that can only say "try again" would
have burned the quota and never fixed them. So findings are typed —
regenerate (billed), retune (free), patch (free, kept only through a
blind gate), bake (free, a custom part's motion, kept only through the custom
gate), escalate (orchestrator only) — and the artist routes on the
type.
The analogy is useful for the shape and misleading about the mechanism. A
discriminator hands the generator a gradient; here the signal is prose into a
black box with weak prompt adherence, so rounds can wander instead of descend.
That is why the caps below are not optional, and why the critic is asked to call
stop when it cannot name a change likely to raise a score.
Every regenerate is a billed codex exec taking minutes. A full part set is
11 parts × 2 variants = 22 jobs; the mouth's two parts are mouth_keyed.png and
mouth_interior.png (a style that cannot fold draws mouth.png and
mouth_open.png instead). A full body adds reference-full.png (one
job), arm.png (two), and, with a pose forearm, reference-wave.png (one) and
forearm_pose.png (two).
You cannot check the quota up front. codex login status reports
authentication and nothing else — its output is byte-identical before and after
the limit is hit — so no precheck stops a run from dying halfway and leaving a
half-updated parts dir. Quota is only observable by attempting a generation: a
refused job exits non-zero and its log carries You've hit your usage limit
and a reset time. So fire ONE job and read its result before firing the rest —
a limit hit there costs one job instead of a batch, and the reset time is what
you hand back to the user.
retune rounds cost nothing: composing and measuring are pure local computation.
Prefer them, and let the artist exhaust them before spending on generation.
<workdir> is iki-char/ inside the project directory — build its tree
before anything else. Every compose and rig call goes through the MCP server,
which confines what it writes to its own cwd, so a /tmp workdir fails all of
them; the compose tool never creates directories, and gen-images.sh dies on
a missing parts dir. The iki repo ignores iki-char/; in any other project add
it to .gitignore before the first run, or the generated art lands in a commit.
mkdir -p iki-char/parts iki-char/layers iki-char/renders/debug \
iki-char/renders/patch/before iki-char/renders/patch/after \
iki-char/renders/plan/before iki-char/renders/plan/after iki-char/renders/judge \
iki-char/renders/face
[ -f iki-char/layout.json ] || echo '{}' > iki-char/layout.json
[ -f iki-char/rig-plan.json ] || echo '{}' > iki-char/rig-plan.json
[ -f iki-char/patches.json ] || echo '{"patches":[]}' > iki-char/patches.json
[ -f iki-char/patches-rejected.json ] || echo '{"rejected":[]}' > iki-char/patches-rejected.json
[ -f iki-char/plan-rejected.json ] || echo '{"rejected":[]}' > iki-char/plan-rejected.json
[ -f iki-char/canvas.json ] || echo '{}' > iki-char/canvas.json
[ -f iki-char/appeal-declined.json ] || echo '{"declined":[]}' > iki-char/appeal-declined.json
rm -f iki-char/patches-candidate.json iki-char/rig-plan-candidate.json iki-char/iki-character-candidate.iki
# Only a character with custom parts (the paragraph below) renders the measuring pair.
if grep -q '"path"' iki-char/custom-parts.json 2>/dev/null; then
mkdir -p iki-char/renders/measure/debug
fi
The seed lines only write a file that is missing, so re-entering or
restarting the loop keeps the tuning you already paid for — the workdir is
gitignored, so an overwrite here has no repository copy to recover it from.
rig-plan.json is the per-character rig tuning surface: the rigPlan of
auto_rig_from_layers (its paths, and the recommended spans a retune stays
inside, are in plan-catalog, below), where {} is the profile every
character starts from. Only the artist edits it, and only on a critic
retune. A style.json left by an earlier plugin is not read: move its knobs
into rig-plan.json by the field map in the iki-character skill (Step 3)
and delete it. Step 0 also calls describe_rig_plan once and keeps its text as
plan-catalog for every dispatch; a server without the tool predates 0.30.0
(the plugin's own .mcp.json pin, until the adopt commit moves it):
plan-catalog is then unavailable, the loop runs on, and item 7 routes every
plan retune as escalate, naming that cause. patches.json holds the accepted
patch ops (that skill's Step 3 patches), which only the patch gate (Step 1)
adds to; the artist only drops from it, for a part it redraws.
patches-rejected.json is your log of what the gate turned down on its own
pairs (judged:) or with its batch (batch:), a re-rig stranded (stale:)
or the rig refused (refused:), each entry
{ "op": …, "round": N, "verdict": "…" } under rejected. A judged:
entry rules out the same op in any amount — the same target, at and
region.role with by pointing the same way — and any other entry only
that exact op; neither the critic nor the artist proposes a ruled-out op
again. plan-rejected.json is the same log for the plan gate (Step 1, item
3): each entry { "field": "turn.noseLead", "from": 1, "to": 1.5, "round": N, "verdict": "judged: …" } under rejected. A judged: entry rules out moving
that field in that direction from that value again (the other direction stays
open); a batch:, stale: or refused: entry only that exact move; neither
the critic nor the artist proposes a ruled-out move. The rm line clears a proposal an
interrupted run left unjudged; patches.json and iki-character.iki only
ever hold accepted ops, so nothing else needs undoing. The renders/patch/
and renders/judge/ dirs are the gate's, since render_poses never creates
one. canvas.json stays {} for a bust; a full body writes its
canvasHeight there (below). appeal-declined.json is your log of the
appeal critic's retunes the user turned down (Step 1, item 6), each
{ "keys": […], "direction": "…", "round": N } under declined; its keys
are the appeal critic's locked.
Every image in the loop goes through the iki-create-image skill. Run its
--check before the first one: without Codex on this machine, each billed
draw below becomes that skill's hand-off to the user, and the artist returns
BLOCKED with the prompts it needs written out instead of drawing.
If <workdir>/reference.png and reference-30.png already exist (a restart),
reuse them — do not regenerate. Otherwise, draw 2–3 reference candidates
with that skill's front-reference prompt and let the user pick, or accept a
reference the user supplies. It must be a single front-facing character in the
target style. Then run that skill's
gen-turn-reference.sh <workdir>/reference.png <workdir> once to produce
<workdir>/reference-30.png: the same character turned to the rig's own
ParamAngleX limit (30°). It is a style check, nothing more — the
critic reads it by eye for whether the character still looks like itself
turned, and nothing measures it. Nothing fits the rig to it or picks a knob's
value from it: every turn amount stays inside the recommended spans in
plan-catalog (describe_rig_plan). Drawn at 30° so the
comparison is like for like: a drawing at 45° over-asks a 30° rig by ~1.7×
(measured, not derived). Redo the generation if both eyes are not fully
visible, the torso turned with the head, or any attribute drifted from the
front reference.
A restarted workdir may still hold a turn-targets.json from an earlier
version of this loop; it is ignored.
A full-body character (only when the user asked for one) also needs
<workdir>/reference-full.png and the canvas's height. Once reference.png
is picked, draw reference-full.png and write <workdir>/outfit.txt, <workdir>/figure.json (the figure's
measurements) and <workdir>/canvas.json as the iki-character skill's
full-body.md Step 0 says. On a restart, reuse an existing reference-full.png,
outfit.txt, figure.json and canvas.json, as the other two: that
canvasHeight is already corrected or tuned, so never write a provisional
one over it. A full body with a pose
forearm also draws <workdir>/reference-wave.png from reference-full.png
with the iki-create-image skill's gen-wave-reference.sh (the
iki-character skill's full-body.md Step 0 says how), reused on a restart
and frozen like the other references. The canvas.json written there is
provisional until the round-1 measuring compose that places layout.body
corrects it (full-body.md Step 2); after that the artist edits its
canvasHeight only on a critic retune, as it does rig-plan.json.
A character with custom parts (a twin tail or a hairpin the role list has
no name for) is opt-in, as a full body is. The user supplies
<workdir>/custom/ (the canvas-sized PNGs) and <workdir>/custom-parts.json
(the { "customParts": [ … ] } list the artist passes to the rig, as the
iki-character skill's Step 3 says) before the run, or they come from the
iki-character run that made the character. The loop never draws, places or
seeds a custom part: the seed lines above create neither, so a character
without custom parts never has them, and on a restart both are kept as they
are, with <workdir>/bakes.json and the custom/ bake files the artist makes
(bare.iki, bare.probe.json, probe-request.json, bake.mjs, try.iki). The dispatch passes custom-parts (the file's contents) when it exists. When custom-parts.json lists a part, setup also makes renders/measure/debug (the block above): render_poses writes only into a directory that exists, and that one call is both the measuring pair's output directory (Step 1, item 4) and the debug directory the critic passes measure_turn_reference (<turn-pair dir>/debug).
Restarting on picked parts. When parts/ already holds a picked set —
the plain <role>.png files, not only _a / _b variants — round 1 re-rigs
what is there: dispatch the artist with restart: true (Step 1, item 1). It
draws no part unless a finding carried into the round (the user's) names one,
keeps the workdir's tuning (layout.json, rig-plan.json, patches.json, and
on a full body whose layout.body is set, that placement and canvas.json),
and composes, measures and rigs. A full set is 20-odd billed jobs, so a round
1 that redraws it on a restart throws away the set the user already picked.
Then go to Step 1. reference.png and reference-30.png (and, for a full
body, reference-full.png and reference-wave.png) are frozen, because every round reads them and
changing any of them mid-loop or on a restart invalidates every prior score.
Dispatch the artist (see Host dispatch) with reference (the front view
only — gen-images.sh --ref attaches it to every job), workdir, round,
rigPlan (the contents of <workdir>/rig-plan.json, which its rig step
passes to auto_rig_from_layers when it is not empty), plan-catalog, patches (the
patches array of <workdir>/patches.json, read at dispatch) with
rejected (<workdir>/patches-rejected.json's), planRejected
(<workdir>/plan-rejected.json's), both critics' findings
(none on round 1 but, restarting, the user's carried ones), and on a
restart's round 1 restart: true (Step 0). A full body
also passes reference-full (<workdir>/reference-full.png, which its
body.png and arm.png jobs attach instead), reference-wave
(<workdir>/reference-wave.png, which its forearm_pose.png jobs attach), and canvas (the contents of
<workdir>/canvas.json, whose canvasHeight its compose step passes;
<workdir>/figure.json sits beside it).
Expect several dispatches per round. Generation runs as backgrounded jobs and a subagent cannot wait on them, so the artist returns while the batch is still in flight. That is not a failed round: wait for the parts to land, then resume the SAME agent — it holds the round's context — rather than dispatching a fresh one. If it returns reporting a usage limit instead, the round is over: take the reset time and go to Step 2.
An artist that returns BLOCKED on a hand-off file (no Codex here,
see Step 0) has not finished the round: give the user that file as the
iki-create-image skill's hand-off says, wait until they say the images
are in place, then resume the SAME artist to pick, compose and rig them.
An artist that returns BLOCKED on an accepted op (an
INVALID: patches[i]… rigging the accepted array: a layout or grid change
stranded it) has not finished the round either: move that op from
patches.json to patches-rejected.json, its verdict stale: and the
message, then resume the SAME artist with the new patches to rig again —
the round goes on. Each refused patch: <op> — <message> in a report's
ESCALATED (a candidate op the artist gave up) goes to
patches-rejected.json the same way, its verdict refused: and the
message.
An artist that returns BLOCKED: custom gate or CUSTOM: unavailable
(a character with custom parts: its model failed the per-part gate after
two re-derivations, the gate itself threw (CUSTOM GATE FAIL: gate error,
package code: the artist reports it under ESCALATED and retries nothing),
or the server returned no gate) ends the round as a
refused rig does: no render, no critic, the lines go to the user, Step 2.
The artist moved nothing, so the accepted model stands.
An artist that returns no model otherwise ends the round as a usage limit does — a refused rig leaves nothing to render. Skip the render and the critic (there is nothing to score), keep its escalation, and go to Step 2.
Check the custom gate before anything else this round, when
custom-parts.json is non-empty and the artist returned a model: before
item 2's reading, any gate (item 3) and any render. The artist's CUSTOM:
block (the promoted model's; the measuring rig's reading under BAKES: is
not judged) must end CUSTOM GATE pass. A missing block is a fail, and so
is any FAIL line in it, hidden art showing (EXPOSED) included. A
HIDDEN line (a part with an occlusion) is reported and never fails: it
goes to the critic with the rest. In a
gated round (PATCHES: or RIGPLAN: reads proposed) both the baseline's
and the candidate's blocks must read pass: the candidate is never judged or
promoted on a fail, and a baseline that fails ends the round. A fail ends
the round as a refused rig does: no render, no critic, the block goes to the
user, Step 2.
Read the rig's view once the artist returns a model: call the iki
server's describe_iki { modelPath } on <workdir>/iki-character-base.iki
when the artist's PATCHES: or RIGPLAN: reads proposed, else on
<workdir>/iki-character.iki — this round's layers either way, and a patch
or a plan change moves no box, stop or faceWidth, so it serves whichever
model item 3 keeps (in a gated round there is no fresh
iki-character.iki). Keep its summary (the text, or the JSON result's summary — item
4 says when a host shows which) as rig-view for the gate and the critic:
each part's
rest box in model px from the top-left and bustBox in the bust renders'
px, faceWidth, the patchable targets with their stops, and parameters
with their defaults. Any INVALID: (ok: false in the JSON) or error
makes rig-view unavailable — a server before 0.26.0 strips modelPath
and complains about the model instead.
The gates — the patch gate, then the plan gate. A dispatch carries at
most one of {a patch batch, a gated plan retune} (item 7 enforces it), so
the two gates never share a round and never both write
iki-character-base.iki / iki-character-candidate.iki.
The patch gate — only when the artist's PATCHES: reads proposed.
Paths here are in <workdir>. To discard the candidate is to delete
patches-candidate.json and iki-character-candidate.iki and
mv iki-character-base.iki iki-character.iki.
Diff patches.json (the accepted array, this round's drops included)
against patches-candidate.json by index: every op past the accepted
array's end, or at an index with any field changed, is a gated op. A
candidate shorter than patches.json, or with an op among the accepted
array's indices naming another target, at or region.role than the
accepted op there, has lost or shifted an op (a change in place keeps
those three): discard the candidate, log nothing, tell the user and go to
item 4. No gated op (the artist gave up its only proposal and re-rigged,
so the candidate equals the accepted array) leaves nothing to judge:
discard the candidate, log nothing and go to item 4 (render_poses
refuses an empty poses).
Build ONE pose list for the whole batch: per distinct target + at +
region.role among the gated ops (the long experiment's 12 ops needed
six), its stop (values the op's at) and its midpoint (each parameter
at (stop + default) / 2, the default from rig-view's parameters:
{ParamAngleX: -30} → −15, {ParamMouthOpenY: 1} → 0.5). Name each from
the target, the role and the settings, unique across the batch
(eyeWarp_R-eye_R-AngleX-30-AngleY0-stop, …-mid; the tool refuses a
repeat), and crop it to the role's box in rig-view grown by half
faceWidth a side (the tool clamps it to the canvas). Then exactly two
render_poses calls with that list: iki-character-base.iki into
renders/patch/before/ and iki-character-candidate.iki into
renders/patch/after/. Check each result's pose names (poses[].name
in the JSON form, the file names of the listed <outDir>/<name>.png paths directly in
outDir in the text, never the sweep's) against the
ones passed; a mismatch is an old server, so the gate cannot run: discard
the candidate, log nothing and tell the user.
When any gated op's at names ParamAngleX or ParamAngleY (a grid stop
names both; a part-warp stop names one), render the box too: two more
render_poses calls, poses: [{ name: "rest", values: {}, crop }] with
crop the face box in rig-view grown by half faceWidth a side (the
plan gate's) and sweeps: [{ name: "turn-nod", preset: "turn-nod", crop }]:
the base into renders/patch/before/, the candidate into
renders/patch/after/ (the tool creates turn-nod/ under each). The pose
list's calls never change. The box crosses the nod while turned, where a
stop-local patch shows and the stills do not. sweeps needs 0.32.0+: a
result without sweeps (JSON) or without the
renders/patch/{before,after}/turn-nod/sheet.png path (text) predates it
and skips the nod pair; the gate runs on the still pairs as it does today,
and item 6 says the nod pair was unavailable and why. A mismatch in the
returned pose name (rest) is the existing old-server discard.
Read both fold reports (the engine's set plus these poses; item 4 says how
in either form). The baseline's must have no offender: a FOLD there is
the critic's escalation before any patch, so discard the candidate and log
nothing. No patch can be judged on a folding baseline, so patches are
unavailable until item 4's fold report has no offender again (see item
7); say so to the user.
Then judge blind. renders/judge/ is empty between gates (a file left
there by an interrupted gate is deleted by name). Per pair flip a coin and
MOVE its before and after renders there as pair<k>-A.png and
pair<k>-B.png — move, not copy, so no file left on disk matches either
side. The nod pair, when rendered, is ONE more pair:
renders/patch/{before,after}/turn-nod/sheet.png moved into
renders/judge/ the same way as pair<k>-A.png / pair<k>-B.png, the
frames staying put; its <feature> is the roles of those ops in plain
words. Keep the key in this conversation only, never in a file until the
verdict is decoded: a subagent can share your scratchpad (Claude Code's
do) and the workdir, so a key on disk sits where the judge works. Dispatch ONE judge for every pair,
fresh, with nothing but those paths and this prompt (<feature> in plain
words for the op's role — "the eye on the left", "the front hair" — never
the op):
Open only the image paths listed below, and nothing else.
Each pair is the same character, in the same pose, rigged two ways.
A pair of nine-frame grids is the same motion, its frames in the same
order (left to right, top to bottom), rigged two ways: judge how
<feature> moves across the frames, not one cell.
A grid whose cells are labelled X and Y is laid out by angle, not by time:
judge how <feature> changes along each row and down each column.
For each pair: which side's <feature> reads more natural (no part
sliding over another, no seam, no squash)? Answer A, B or same, with
one phrase why.
pair1, <feature>: <pair1-A.png path> <pair1-B.png path>
…
Claude Code: a general-purpose subagent; Codex: a standard subagent
spawned with fork_turns: "none" and never resumed. Without subagents no
judge is blind, and the gate cannot run, as on an old server.
ONE verdict for the whole batch. Decode each answer with your key into
candidate, baseline or same, its phrase kept. Then move each pair
back by the key — its before render to renders/patch/before/ and its
after render to renders/patch/after/, under its pose name — which leaves
renders/judge/ empty for the next gate without a wildcard rm (Claude
Code's safety check refuses rm renders/judge/*). The nod pair moves back
into renders/patch/before/turn-nod/sheet.png and
renders/patch/after/turn-nod/sheet.png (the sweep dirs, not under a pose
name). Accept when the judge
prefers the candidate on at least one pair and the baseline on none, AND the
candidate's fold report has no offender (the accept rule is unchanged in
words; one more pair makes it stricter):
mv patches-candidate.json patches.json,
mv iki-character-candidate.iki iki-character.iki, delete
iki-character-base.iki, and the artist's TURN-CANDIDATE: becomes this
round's TURN:. Otherwise reject: append each gated op to
patches-rejected.json with the round and a verdict read off ITS OWN
pairs — the stop and midpoint of its target + at + region.role, as
decoded answers, never raw A/B. The nod pair is one of an op's OWN pairs
only when that op is the only gated op whose at names ParamAngleX or
ParamAngleY; with two or more such ops it is nobody's own pair, each
op's verdict reads its own still pairs as above, and a baseline on the
nod pair is named (batch:) as what sank the batch for any op whose own
pairs favour it, so an innocent op is never logged judged: off a pair it
shares. Own pairs with any baseline, or all
same, give judged: and those answers; otherwise (they favour it) the
verdict is batch: and what sank the batch (another op's pair, or the
candidate's FOLD line). Discard the candidate, and the artist's TURN:
(the baseline's) stands; patches.json was never touched, so it still
holds the accepted array with this round's drops. Say which, with the
decoded answers, in item 6's message. Neither patches.json nor
iki-character.iki ever holds an unjudged proposal, so an interrupted
gate leaves both accepted.
The plan gate — only when the artist's RIGPLAN: reads proposed: a
critic retune of turn.eyeForeshorten or turn.noseLead, the two
provisional fields; the six others are applied directly and never gated. To
discard the candidate is to delete rig-plan-candidate.json and
iki-character-candidate.iki and
mv iki-character-base.iki iki-character.iki. The pose list is the
field's catalog poses from plan-catalog ({ParamAngleX: -30} …), each
cropped to the face box in rig-view grown by half faceWidth a side
and named <field>-AngleX-30 and so on. Then exactly two render_poses
calls: iki-character-base.iki into renders/plan/before/ and
iki-character-candidate.iki into renders/plan/after/. Each call
carries the poses AND
sweep: { name: "turn", preset: "turn", crop: <the same face crop> }:
the eased ±30 turn with the hair physics running, written to
renders/plan/{before,after}/turn/. The old-server check adds the sweep:
the result's sweep (JSON) or, in the text, the <dir>/turn/sheet.png
path and a SWEEP line. Missing means a server before 0.31.0, which
strips sweep and renders the stills alone, so the gate cannot run:
discard the candidate, log nothing and tell the user, naming the cause —
the plugin's pinned @ikijs/mcp predates 0.31.0 (its .mcp.json pin
until the adopt commit moves it), so the turn.eyeForeshorten /
turn.noseLead gate waits for that commit. Never judge the stills alone.
The pairs are the field's three still pairs plus ONE sweep pair:
renders/plan/before/turn/sheet.png and
renders/plan/after/turn/sheet.png, MOVED into renders/judge/ as
pair<k>-A.png / pair<k>-B.png by the same coin flip, the kymographs
and frames staying where they are, and moved back by the key into their
sweep dirs afterwards. Everything else
is the patch gate's: the old-server check on the returned pose names, the
baseline's fold report (a folding baseline discards the candidate and logs
nothing), the blind judge with the same prompt (<feature> is "the eyes"
for eyeForeshorten, "the nose" for noseLead) and the same key kept in
this conversation only; the judged: verdict reads that field's four
pairs. Accept when the judge prefers the candidate on at
least one pair and the baseline on none, AND the candidate's fold report
has no new offender: mv rig-plan-candidate.json rig-plan.json,
mv iki-character-candidate.iki iki-character.iki, delete
iki-character-base.iki, and the artist's TURN-CANDIDATE: becomes this
round's TURN: and its RIGPLAN-CANDIDATE: this round's RIGPLAN:.
Otherwise reject: append the move to plan-rejected.json
(judged: with the decoded answers when its own pairs sank it, batch:
when the candidate's fold did), discard the candidate, and the artist's
TURN: (the baseline's) stands; rig-plan.json was never touched. Say
which, with the decoded answers, in item 6's message.
Render it with the iki server's render_poses tool:
render_poses { modelPath: <workdir>/iki-character.iki, outDir: <workdir>/renders, sweep: { name: "turn", preset: "turn" } }
(outDir must already exist and sit under the server's cwd; Step 0 makes
it). It needs @ikijs/mcp 0.24.0+, Node 22+ and an installed Chrome, Edge
or Chromium (CHROME_PATH for a non-standard install); stress and the
fold report need 0.25.0+. A server without render_poses predates 0.24.0,
and a result with no stress pose and no fold report (no FOLD… line in
the text, no folds field in the JSON) predates 0.25.0: update the plugin, whose .mcp.json pin moves when it adopts a
release. A server before 0.25.0 still renders every other pose, so the
round goes on, with folds passed as unavailable. On an INVALID:
refusal (no browser, a bad CHROME_PATH, Node < 22) give the user its
message and render again once it is fixed: the round waits, it is not over.
The model decides the set: a full body when the canvas is taller than wide,
the mouth crops centred on the rigged mouth part, the full-pose-* poses
when ParamArmPoseR is declared. Called with poses (each
{ name, values, crop? }, the crop in model px from the top-left — the
frame of describe_iki's boxes and the FOLD lines — and clamped to the
canvas) it renders those alone and adds them to the fold sweep; that needs
0.26.0+, and an older server strips the field silently and renders the
standard set, so after every call with poses compare the returned pose
names with the ones passed: a mismatch means an old server, and the patch
gate is unavailable. sweep needs 0.31.0+: the call renders the turn sweep
in addition (renders/turn/: 90 frames fNNN.png, manifest.json,
sheet.png, kymograph.png and the flipbook index.html; the tool
creates that dir itself), and a result without sweep (no
renders/turn/sheet.png path, no SWEEP line) predates it: the round goes
on with sweep passed as unavailable, never with a still in its place.
The result lists the written paths, then
the model's fold report: a FOLD line per warp grid or mesh part
that flips or collapses at some pose, or FOLDS: none over N poses, and a
FOLDS expected: line for the closures the rig draws on purpose (an eye or
the mouth shut). A fold never stops the round: it is the critic's input
(Step 3). The physics report follows it: a PHYSICS line per spring and
chain segment reading ok, frozen or unstable, or PHYSICS: no rigs.
It too is the critic's input and never stops the round. It needs 0.27.0+: a
result with the fold report but no PHYSICS line (no physics field in
the JSON) predates it, and the round goes on with physics passed as
unavailable.
Two result forms. The server returns every result both as text and as
structured JSON, and a host shows one — Claude Code shows the JSON, where
none of the lines above appear. Read the same facts off either. An
INVALID: <message> is ok: false with error. The written paths are
poses[] (name, path). The FOLD lines are folds.offenders, worst
first: each its target, its kind (flip or collapse) and its worst —
the ratio, the cell or triangle where, the settings pose.name, and
rest in model space, centred with y up, whose model px from the top-left
are (modelCanvas.width / 2 + x, modelCanvas.height / 2 − y).
FOLDS: none over N poses is an empty folds.offenders, N being
folds.poses. The FOLDS expected: line is each folds.targets entry
whose expected.ratio is under folds.thresholds.collapse (0.1). "No
offender" in this skill means either form of none. Pass the report on in
the form it came, never retyped into the other: the text's lines as they
are, or from the JSON modelCanvas, folds.poses, folds.offenders and
those expected entries (target, expected) copied as they are — the
rest of folds.targets is one entry per deformer and part, mostly ok,
and stays out. The PHYSICS lines are physics.targets, one per line in
model order (PHYSICS: no rigs is an empty one), passed whole and as they
are: there are few, and an ok one says the hair moves. The SWEEP lines
are sweep.report (its landmarks[] and plateAmplitude, or its
unavailable) and sweep.nod (its nod[] and corner[], or its
unavailable; absent before 0.32.0, where it is unavailable), passed
whole; the text's SWEEP nod and SWEEP corner lines follow the
SWEEP turn ones. A non-empty failedTextures means atlas pages did not load and
their parts are missing: render once more; if pages still fail, escalate,
because the critic does not score renders with parts missing.
Then render the turn once more, cropped to the face, for the appeal
critic's look at the motion (item 5), into <workdir>/renders/face:
render_poses with poses: [{ name: "rest", values: {}, crop }] and
sweep: { name: "turn", preset: "turn", crop } AND
sweeps: [{ name: "turn-nod", preset: "turn-nod", crop }], the crop the
face box in rig-view grown by half faceWidth a side, as the plan
gate's: the face-cropped turn goes into renders/face/turn/, and the box
into renders/face/turn-nod/ (180 frames, manifest.json, sheet.png —
the 3 × 3 grid by angle —, index.html; no kymograph). The box crosses
the nod while turned, where a stop-local patch or a corner keyform shows
and a still or the pure turn does not; the level turn stays because the
box never turns at AngleY 0. sweeps needs 0.32.0+: an older server
strips it and renders the rest, so a result without sweeps (JSON) or
without the renders/face/turn-nod/sheet.png path (text) predates it:
the critic's nod and the turn-nod half of the appeal critic's
motion are unavailable, the turn half is what it was (a server
before 0.31.0 strips sweep too and motion is unavailable as today).
The round goes on; item 6 names the cause (the pin predates 0.32.0 until
the adopt commit moves it). On the full
sheet the face is a fraction of each frame, and a part that slides or
stretches against the face reads as a few pixels. With rig-view or the
sweep unavailable, skip it: the appeal critic's motion and the critic's
nod are unavailable.
The rest shot is untouched by construction, which matters because every
proportion the critic measures is measured against it.
The poses: rest, turn-m30, turn-p30, turn-15, nod-15, blink,
blink-half, gaze, combined, stress (every head angle at −30, the
mouth open, both eyes at 0.5, the brows at opposite extremes and each
declared body angle at −10); the 15 mouth-* crops
(mouth-open-{0,0.3,0.6,1}-form-{m1,0,p1}, mouth-laugh,
mouth-surprised, mouth-turn-p30-half); on a full body full-rest,
full-turn-p30, full-body-{x,y,z}-{m10,p10}, full-arm-{l,r}-{16,32},
full-elbow-{l,r}-{m10,45,90}, and with a pose forearm full-pose-l,
full-pose-r, full-pose-r-angle-m15, full-pose-r-angle-p15,
full-pose-r-half.
A character with custom parts (custom-parts.json lists one) renders
two things more. Add a roll sweep to the face call's sweeps,
{ name: "roll", preset: "roll", crop }, the crop the union of the face
box and every custom part's box in rig-view, grown by half faceWidth a
side (the tails hang below the face, so the face crop alone cuts them off):
it goes into renders/face/roll/ (90 frames, manifest.json, sheet.png of
nine labelled frames, index.html; no kymograph). Then one more
render_poses call for the measuring pair: poses rest, turn-m30 and
turn-p30 with the standard values and no crop, hideParts every custom
part's id, outDir: <workdir>/renders/measure/ (Step 0 made it). The critic
measures that pair with measure_turn_reference, and a custom part crossing
the eye row widens the head the tool reads, as it does on a drawn reference;
the rig fits its turn to the role layers alone. turn-pair passed to the
critic is then that directory's three files, not renders/'s. Both need
0.34.0+, which the custom gate before item 2 has already shown (a server
before it returns no CUSTOM: block and the round ended there), so an
INVALID: or input validation error from either call is that call's own
(a bad crop, a missing directory): fix it and render again. Only roll
depends on the face call, which needs rig-view for its crop: when item 4
skips that call (rig-view unavailable), roll is passed as
unavailable. The measuring pair uses no crop and needs nothing from
rig-view, so it is always rendered and turn-pair is always its three
files.
Dispatch the critic (see Host dispatch) with reference, reference-30, layers,
renders (the returned paths other than mouth-* and full-* and the
sweep's (renders/turn and every file in it); each input
below is a subset of the returned paths, so a stale file from an earlier
round is never picked up), turn-pair (<workdir>/renders/rest.png,
turn-m30.png and turn-p30.png; on a character with custom parts the
three files of <workdir>/renders/measure/, item 4), mouth-renders (the 15 mouth-*.png
crops), round, plan-catalog, rig-plan (the accepted rig-plan.json, {} when
none), rig-plan-report (the KEPT model's RIGPLAN: line or rigPlan
echo, verbatim, in the form it came: the candidate's after an accepted plan
gate (the artist's RIGPLAN-CANDIDATE: line), the base's after a rejected one
(its RIGPLAN: line); unavailable from an old server),
scores (the previous rounds' SCORES: lines),
and turn-clamped (the KEPT model's turn line, verbatim: the artist's
TURN:, or its TURN-CANDIDATE: when item 3 accepted — its
turn.achieved, turn.clamped and turn.strandOverlap, or "none" when no
turn was solved, followed by the HAIRSIDE lines the artist quoted after
its TURN: (or its TURN-CANDIDATE:), verbatim)
so the critic can check the render against the rig's own
report and tell a clamp this art forced from a new turn defect, folds
(item 4's fold report, complete and in the form it came: every FOLD line
or the one FOLDS: none … line, and the FOLDS expected: line when there
is one — or their JSON fields, as item 4 lists them; or unavailable from
a server before 0.25.0), physics (item 4's physics report, complete and
in the form it came: every PHYSICS line or the PHYSICS: no rigs line,
or physics.targets; or unavailable from a server before 0.27.0),
custom (a character with custom parts: the artist's CUSTOM: block
verbatim, the promoted model's CUSTOM lines, which the check before item 2
found end CUSTOM GATE pass; in a gated round only the kept model's block,
though the artist's report line carries both models'; absent otherwise), sweep (<workdir>/renders/turn/sheet.png, <workdir>/renders/turn/kymograph.png
and item 4's SWEEP lines, in the form they came; or unavailable from a
server before 0.31.0; the lines include the SWEEP nod and SWEEP corner
ones, or sweep.nod), nod (<workdir>/renders/face/turn-nod/sheet.png
and the dir of its frames, <workdir>/renders/face/turn-nod/; or
unavailable from a server before 0.32.0, or when item 4 skipped the face
call), roll (a character with custom parts:
<workdir>/renders/face/roll/sheet.png and the dir of its frames, or
unavailable when item 4 skipped the face call; absent otherwise),
rig-view (item 2's summary, or
unavailable), patches (the accepted array, <workdir>/patches.json
as item 3 left it) and rejected (<workdir>/patches-rejected.json's,
so it names no patch the log rules out) and planRejected
(<workdir>/plan-rejected.json's, likewise for a plan move). It returns
scores and typed findings. A full body also passes reference-full, figure (the
contents of <workdir>/figure.json) and body-renders (the whole-canvas full-*.png poses) and, with a pose forearm,
reference-wave; its renders and
turn-pair are the bust crops.
In parallel (neither needs the other), dispatch the appeal critic with
renders (<workdir>/renders/rest.png, turn-p30.png,
mouth-open-0-form-0.png, mouth-open-0.6-form-0.png; a full body also
full-rest.png), motion (<workdir>/renders/face/turn/sheet.png and
the dir of its frames, <workdir>/renders/face/turn/, plus
<workdir>/renders/face/turn-nod/sheet.png and the dir of its frames,
<workdir>/renders/face/turn-nod/, either half unavailable on its own;
on a character with custom parts also <workdir>/renders/face/roll/sheet.png
and the dir of its frames, or unavailable when item 4 skipped the face
call),
layout (the contents of <workdir>/layout.json),
round and locked (every key in <workdir>/appeal-declined.json, names
only, [] for none) — and nothing else in its prompt: no reference, no
layers, no preview.png, nothing of the critic's report, no reason or
round a key was locked in.
When both reports are back, type any refer on the closed mouth by the
model's mouth route, read off this round's <workdir>/layers/ file names
(mouth_inner.png / lip_*.png is the lip set; mouth.png with
mouth_open.png is the legacy pair).
Legacy pair: the closed mouth is mouth.png as drawn, the rig bends
nothing, so a V or over-lifted corners is the drawing: a regenerate of
mouth.png with a gentle closed curve, never a rig escalation. Lip set: the
artist rigged it on the pinned server, so its closed line is already the
current rig's closing of the drawn arc (a smooth parabola, sag capped at
CLOSED_SAG_MAX, a drawn kink closed away); a model left by a restart from
an older rig is re-rigged by the artist first, since its V may be one the
rig no longer draws. Then route by the critic's own closed-line check of the
same round: if it names a regenerate of mouth_keyed.png or an escalate
on packages/editor/src/auto-rig/mouth.ts, the refer rides on that
finding (the appeal critic's direction wins on the mouth's expression, item 7's
rule; item 6 names the combined fix as one job for the user's OK); if it names nothing, read the closed crop against the critic's
rules. A line inside them (sag within the cap, ends tapered, no tick) that
still reads V or over-lifted is the drawn arc's depth: a regenerate of
mouth_keyed.png drawn shallower at the centre with the upper line flatter.
A line outside them (a surviving kink, a sag past the cap) is the rig: an
escalate on mouth.ts. Never type a lip set
by whether the closed line matches the drawing; the rig smooths it on
purpose.
Ask the user, every round whatever the verdict, once both critics
have returned and the refer is typed, before the critic's verdict is acted on and before Step 2: list the
absolute paths of <workdir>/renders/rest.png, turn-p30.png and
mouth-open-0-form-0.png (a full body also full-rest.png) for the user
to open — sent as files too where the host offers a tool for it — and the
turn's flipbook as a URL to paste into a browser's address bar (a path with
a query cannot be opened by a file tool or open):
file://<workdir>/renders/turn/index.html (play, scrub), and after a plan
gate file://<workdir>/renders/plan/before/turn/index.html?b=../../after/turn,
which shows the base beside the candidate in lockstep (the relative dir is
resolved from before/turn/), file://<workdir>/renders/face/turn-nod/index.html
and, after a patch gate that rendered the nod pair,
file://<workdir>/renders/patch/before/turn-nod/index.html?b=../../after/turn-nod
(resolved from before/turn-nod/) — the flipbook, not a GIF. When the nod view
was unavailable the message says the box needs @ikijs/mcp 0.32.0 and the
pin has not moved yet (the face-cropped turn is still there) — with the
critic's SCORES: and VERDICT: lines and the appeal critic's IMPRESSION:,
APPEAL: and MOTION: lines, and ask for a one-line reaction ("fine" if none). When the appeal
critic named a regenerate, or its refer was typed as one above, the same
question names the part and the billed job once (a refer riding on the
critic's regenerate is one combined job); that finding goes to the
artist only on the user's OK, and a declined one is dropped (the user's word
stands for Step 2's stop rule). The appeal critic's retunes are free and
need no OK: the same message lists them by key and amount, and they go to
the artist unless the reaction declines one. A declined appeal retune —
this round's, or one an earlier round applied, whose keys then go back to
their values before it (that round's artist RETUNED: line has them) as a
retune marked as the user's — goes into appeal-declined.json with
every key it names, its direction and the round, so later rounds pass
those keys as locked and the appeal critic stops naming them, either way.
The user's word unlocks a key: delete it from its entry. A lock binds the
appeal critic only: a critic retune of a locked key is named in this
question before it is routed. A
reaction that names a change becomes a finding of the type it
implies — a retune naming the layout key, or a regenerate of
the part — marked as the user's. The user's eye overrides a ratio that
passes and a ship or stop verdict: the loop runs another round, within
Step 2's caps. "fine" adds nothing.
Route: regenerate and retune go back to the artist — a retune names a
layout.json key, a mirror-parts.json entry or a rig-plan.json field, or on
a full body canvas.json's canvasHeight. The appeal critic's retunes go
with them, marked as its own — one on a locked key is dropped — and so
does a regenerate item 6 approved; a
refer typed as an escalate is handled as the critic's are. The reference
keeps identity (hair, outfit, palette, the style the features are drawn in),
so the critic wins there where the two disagree; on proportions,
placement and expression within that look the appeal critic wins; the
user's reaction (item 6) overrides both.
One gated change per round: when the critic's findings hold both a patch
and a gated plan retune (turn.eyeForeshorten, turn.noseLead), the
plan retune goes to the artist and the patch findings are DROPPED and
named in item 6's message (the plan retune is global and cheaper to judge;
an op sized against this round's renders would land on a rig the gate may
have just changed, so nothing is carried — the next round's critic
re-raises whatever still shows). At most one plan field of ANY kind per
round: the critic's first plan retune goes, later ones are dropped and
named the same way, so a gated field is never judged on top of same-round
plan changes. A gated retune whose move plan-rejected.json rules out is
dropped and named in item 6's message too. On a server that returned no
rigPlan echo or has no describe_rig_plan (the artist's
RIGPLAN: unavailable, plan-catalog unavailable), route every plan
retune as escalate, naming the cause: the plugin's pinned @ikijs/mcp
predates 0.30.0 (the adopt commit moves the pin).
The critic's bake findings go to the artist too, ungated: the custom gate
is their gate (the artist's Rig section), and a round of them spends no
generation.
The critic's patch findings go to the artist too, free like a retune:
a patch round spends no generation, so it counts toward no billed cap.
Once patches prove unavailable in a run — an artist's
PATCHES: unavailable, or a gate that could not run (item 3) — route that
run's patch findings as escalate; after a gate that found the baseline
folding, route them so until item 4's fold report has no offender again,
since the critic would name the same patch every round.
Handle escalate yourself — decide whether the package change is
warranted, and if it is, make it as normal code work with a test and a
changeset. A render-vs-report escalate (the critic's Δ beyond ±0.05)
comes off the palette-quantized model, so confirm it losslessly before
deciding (on a character with custom parts the lossless rig is layers/
alone, which is the same head without the custom parts, so its renders need
no hideParts): call auto_rig_from_layers yourself on the same layers (every
<workdir>/layers/*.png but the previews, preview.png and preview-pose.png) with the same rigPlan and
patches (the accepted array, which moves turn.achieved), no
quantizeColors, and outputPath: <workdir>/iki-character-lossless.iki;
call render_poses on that file into <workdir>/renders/lossless/ (mkdir -p first);
then measure them as the critic's Step 1
does — rest against each turn, with the iris window its finding names and
debugDir: <workdir>/renders/lossless, the overlays checked, the two
directions averaged — against that rig's own turn.achieved (the kept
model's again: the report is read off the layers, not the atlas). A Δ that closes
was the palette moving the iris detection, and the escalation drops. A Δ
still beyond ±0.05 is a render-vs-report discrepancy, not yet a rig defect:
the report lands each iris's painted span and the layers' silhouette edges,
while the tool takes iris widths from colour blobs and the head span at the
row of the irises it detected, so the two can disagree with the rig drawing
correctly. Diagnose it before changing either side — the raw lines of the
lossless calls (each image's iris widths and centres, eye row, head edges,
half-width and pair centre) and their overlays against the lossless rig's
result (turn.achieved, headHalfWidth, headEdges, strandEdges) say
whether the rig's landing or the tool's detection is off. Never let the loop edit
packages/. A turn the art has no room
for — the far eye at the face plate's edge, the chin at the neck's, the far
iris at the bangs' side strand — comes back CLAMPED, not refused, so the rig
still built; the clamp and any strandOverlap reach the critic in the kept
model's turn line (turn-clamped).
Stop on the first of:
ship or stop, the appeal critic's line ends in stop (or
the user said in item 6 to leave what it still names), and the user's
reaction (Step 1, item 6) named nothing to act onrig 3→4
against a palette 4→3 drift and reads as no progress; each of the nine
APPEAL: scores is its own axis too, never their totalThe turn axis's high-water mark starts over at the first round whose critic
had sweep (the critic says so under PROGRESS): a stills-only turn score is
never compared with a sweep one, and the round that restarts the mark does not
count as a new maximum on turn — the no-new-maximum streak is neither reset
nor extended by the transition.
A round run on the user's finding counts like any other: toward the billed cap when it spends generation, and a new maximum on any axis resets the no-new-maximum streak.
Then report to the user: the final render, the per-axis score trajectory across rounds, what remains unfixed, and every escalation with your recommendation.
The rig's defaults are constants picked by eye on our own characters
(packages/editor/AUTO-RIG.md). So a turn
whose amounts read wrong on the rig's own renders — too weak or too strong,
the features leading the face too much or too little, the hair following it
too much or too little — is first a rigPlan retune (rig-plan.json), free and per character,
inside the recommended spans and never toward what reference-30.png shows. A
local keyform defect — one feature wrong at one stop, the far eye over the ear
at ±30 or a bangs band shearing, which no knob reaches — is first a patch,
kept only through the gate (Step 1, item 3). A defect of the whole rig is the
package escalation: a seam, a fold, a part detaching from the one it sits on
across the whole head, or a nod that slides instead of tipping (no plan
field reaches ParamAngleY). The far eye too wide or too narrow at ±30 is a
turn.eyeForeshorten retune, and the nose leading too much or too little on
the turn renders a turn.noseLead one — both through the plan gate (Step 1,
item 3). A render that disagrees with the rig's own report even on a
lossless pair (the critic's render-vs-report delta, re-measured as in Step 1)
is a package escalation too, but a discrepancy to diagnose — the rig's
landing or the tool's detection — not a rig defect on sight. Treat a repeated rig escalation as a signal to fix
the package, not to keep re-rolling art or retuning the plan.
packages/.codex login status as a quota check. It reports authentication only —
see Cost for what a refused job actually looks like.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub zeikar/iki --plugin iki4 skills in this plugin
/iki-characterGenerate a renderable, auto-rigged Iki character (`.iki`) from one gesture — draw a front reference, then role-separated transparent part PNGs against it with the iki-create-image skill (eyeless, noseless face base, nose, sclera, iris, a keyed open mouth and its interior (or a closed + open mouth pair for a style that cannot fold), lash, brow, front and back hair, torso, an optional cheek blush, an optional front side lock beside the ear, and for an optional full body a body from the neck to the shoes and one arm, drawn against a full-body reference), compose them into canvas-aligned role layers with the `compose_layers_from_parts` MCP tool, then `auto_rig_from_layers` to emit a rigged `.iki` that blinks, gazes, lip-syncs, turns, nods and tilts its head with swaying hair, and emotes with its brows — drawn full body, also raises and bends its arms and turns its body, and with a pose forearm waves — and that declares head motions (Nod, Shake, Tilt) and, with a pose forearm, a Wave, and up to six default expressions (smile, laugh, angry, sad, surprised, shy; shy needs the blush), each with a description a host picks by. Use whenever the user asks to "make/generate/create an Iki character" from scratch (no existing art); for one finished picture the user already has, use iki-import-illustration instead./iki-create-imageDraw the images an Iki character is built from — the front reference, the role-separated part PNGs drawn against it, the 30° turned reference, and for a full-body character the full-body reference drawn from the front one and the waving reference drawn from that — with the Codex CLI's image tool on a model the plugin pins, or hand the user the prompts to run in another image tool when Codex is not set up. Used by the iki-character, iki-character-loop and iki-import-illustration skills; not for general image requests.Other plugins' skills for the same job