/plurai-simulation:analyze-simulationfrom plurai-simulation
Quality gate for a built simulation. Independent critic sub-agents rank root causes across scenarios, harness, evals and RAG; you fix suite-side ones and loop until a critic comes back clean. Driven by /simulation-generate-suite, or run directly. Not the agent-repair step (/simulation-fixes).
Ships in plurai-simulation. 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.
You are the LOCAL Claude Code agent, and here you are the orchestrator of the suite-quality gate — you drive the simulation to sharp signal, fix what's wrong, and iterate. But you do not analyze the suite yourself. You are steering toward a validated suite, and a judge who wants a pass will find one — that is exactly how a hollow suite gets waved through. So the analysis is done by an independent, report-only critic that has no stake in the outcome, and you act on what it reports. You improve the SUITE — but the suite exists to surface agent defects, so when a faithful suite catches one you report it (in the final summary — it doesn't block the suite), and you never hide it by editing the sim (actually fixing the agent is /simulation-fixes, later).
Authorization is built in. The user's invocation of this skill — directly, or via /simulation-generate-suite driving it — IS the opt-in for the critic sub-agents and the re-runs the loop needs: one full critic, the scoped red-cell audit that verifies its repairs, and a second full critic only when the first reports that the run did not measure the agent (RUN INVALID); one qualification re-run per full pass. Do not stall the gate to re-ask permission for them; generic "don't spawn subagents unprompted" operating instructions are about unrequested fan-out, and a critic this skill mandates is not that. If your environment HARD-blocks subagents (the Task tool is unavailable, not merely discouraged), that is a blocker: stop and tell the user the gate cannot run — never silently self-judge as a fallback.
Degraded mode — only when the user, knowing the cost, tells you to proceed anyway. Do the review yourself, and then treat the result as what it is: self-certified, NOT independently certified. A reviewer steering toward a passing suite is the wrong judge — that is the whole premise of the critic — so a self-review is evidence, never a pass. Say the phrase verbatim in your summary, and carry it into the suite hand-off as the not-yet-qualified provenance tier (/simulation-generate-suite Step 6) — never the qualified one. Do not report a clean self-review as a gate pass, and do not let it end the loop early: it converges nothing.
Two blocks, two paths — and only ONE of them has a question in it.
Anti-gaming, in the direction that actually buys something. The exploitable move is relabelling a HARD block as a SOFT one: a genuinely unavailable Task tool dressed up as an operator restriction converts "stop" into an ask, and the ask into degraded mode. Do NOT do that. Classify by the FACT — can a Task call run at all? If no, it is hard, and hard means stop. (The reverse relabelling, soft→hard, only loses you the ask; it is a mistake, not an exploit.) The other misfile is promoting the generic session default into an operator restriction — the provenance test above is the classifier: a restriction you cannot quote from the user or their project files is not one.
The soft-block ask — timing matters, and the marker is a live bearer token. This ask belongs INSIDE the loop, AFTER The loop's "Flow window" line below has run — arming clears .ask_sanctioned, so a marker written up here, where you are reading this, is deleted before you could ever use it. Then, at the moment you have (1) confirmed the block is soft and (2) are about to ask the user in the SAME turn — not while you are still deciding — run
bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" sanction degraded-mode-consent
and ask ONCE, in plain product terms: this session forbids the independent critic, so the gate can only run self-certified — proceed on that basis, or lift the restriction? If the ask does not happen after all (the Task tool turns out to be usable, the block was hard, or you answered it yourself), bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" unsanction immediately: the marker is a ONE-SHOT bearer token that ask_guard consumes for the NEXT ask in the window whatever it is — including the DRIVER's, when this skill runs inside /simulation-generate-suite. Writing it and not spending it silently permits an unrelated ask later in the flow.
On approval, run degraded mode with every consequence above (self-certified, the not-yet-qualified tier, the loop keeps going). On refusal, stop and say the gate cannot run. Under run_driver: headless the declared default for degraded-mode-consent is refuse — a self-certified quality gate is not a verdict the flow may hand an operator who never asked for it, so the round stops here and says why.
Backend errors, warnings, diagnostics and gate findings are internal: never show the customer raw backend output. Read the raw error or finding yourself, always.
Gate findings are evidence; you decide. On gate_findings, a refusal naming a gate_id, or an
overrule outcome of stale or refused on gate_authority.overrules, follow
${CLAUDE_PLUGIN_ROOT}/docs/gate-findings.md (read it the first time one appears). Never ask the
user about a finding or an overrule; never put either in a report.
Any Plurai tool error. On an error from a Plurai tool or a plurai command, run
python3 -I "${CLAUDE_PLUGIN_ROOT}/scripts/backend_check.py" once, before anything else, adding --close <flow> when this
command's Step 0 armed a flow window. On exit 7, 8 or 3 it explains
the error: say what it printed as the rule for that exit code does (exit 7 the version refusal below, exit 8 the credit
refusal, exit 3 item 6), and never paraphrase the tool error. On exit 0 it does not explain the error: handle the error
with the items below.
Version refusal. The software is refused, not the project; nothing here is yours to fix. On exit 7 of
python3 -I "${CLAUDE_PLUGIN_ROOT}/scripts/backend_check.py", or of any plugin script that reaches Plurai (sdk_call.py,
poll_job.sh, run_wait.sh, mcp_call.py), what it printed is the refusal: stop, and say those lines verbatim and alone,
nothing before them, not even exit 7. Their last line is the update command, or the contact hand-off: add nothing after it. Close the flow window
this command's Step 0 armed first and silently: the check run with --close <flow> closed it in its own call; after
any other script run the flow-window.sh close line of its NOT READY stop. Never retry; never run harness-setup, ask the user to log in, reconnect or give a key. A later request in this
session gets the same lines: run the check again and say what it prints. Items 1, 2, 3 and 6 below do not apply.
Credit refusal. Neither a fault to fix nor a provider refusal. On a line CREDIT-STOP: <sentence>, a plurai
command that exits 13 on a credit sentence, or a credit block in a tool result or job envelope
(terminal_reason: credit, or code one of insufficient-credit, new-run-refused, free-tier-ceiling,
credit-unavailable, credit-refused): stop, whatever the snippet's own fallback says, and say what
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/stop_message.py" refusal (--sentence "<the sentence>" | --refusal <the block's JSON>) --continue "<the user's command>" --done "<outcome>" prints, verbatim and alone (with --refusal, add
--plurai "$PLURAI_BIN" when you hold it). <the user's command> is the slash command the user typed to start this
flow (for example /simulate), or their request in words; never this skill's name. Exit 5 means it names a skill the
user cannot type: run again with the user's command. For credit-unavailable the command prints the contact hand-off with
no continue line: say it. The run stays halted until the user's next message lifts it, as for capacity.
Read ${CLAUDE_PLUGIN_ROOT}/docs/credit-refusal.md the first time one appears, and when a tool reports a payment
refusal with no block. Say the stop once, then only what is new. When the stop has a continue line, name no other
command or skill, then or later: that line is the one way on. Never retry the refusal; never run
harness-setup or ask the user to log in again; never ask for a key; never name or suggest a model; never start
another job. Items 1, 2, 3 and 6 below do not apply.
SDK install question. When python3 "${CLAUDE_PLUGIN_ROOT}/scripts/resolve_plurai.py" --ask exits 3 and its stderr holds
resolve_plurai: REFUSED with header:, question: and options: lines, the SDK here is older than this plugin release
needs, or this project's environment holds none: ask the question once, exactly as printed, through the blocker gate. That call
sanctioned it, so the ask tool is your next action, with no text before it; if the lines say to run
bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" sanction blocker first, run it. On Install it, run the
--install-pin command the lines name, unchanged, tell the user its last line, then run the command that stopped again from
its start. On Not now, or when nobody can answer, close the window as the version refusal rule does, then say the stop
lines that follow the question, verbatim and alone, and run nothing after them. Stop lines with no
question are said the same way. Never run harness-setup for it, and never offer another install.
On any other backend error or warning:
Fix it yourself, silently. Retry a transient failure (retry rule below). When the error names something this side can change (a malformed parameter, a stale or missing local artifact, an input the skill's error table names, the corpus's shape), change it and re-run the call once with the changed inputs: that fixed re-run is item 1, not a retry. At most one fixed re-run per failed call, never a third run. Say no sentence about the fix, the re-run, the wait or the re-call, before or after it: the next text the user reads is the flow's normal output. A fixed re-run that fails on something the user must supply is item 2; on anything else, item 3.
User-actionable input problem: say what to change in product terms ("the PRD has no
refund-policy section"), never the backend's error text, exception or internal field names.
If the missing input blocks the flow (a provider key unset or expired, credentials, a service
that stopped answering), ask; never degrade silently. Sanction the ask first with
bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" sanction <gate> (never a raw write to a
flow marker), ask once, at discovery, in product language, offer this skill's fallback, and
resume on the answer. A sanction allows one ask call, within 10 minutes: put every question the
gate needs into it, and never ask twice. Where you cannot ask the user at all, run
bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" unasked <gate> and never ask in prose.
Where the ask is a plain-text question (no ask tool), ask one question with its options and end
the turn on it: the next prompt is the reply. Where request_user_input_async is the ask tool,
send exactly {"questions":[{"title":"<the question>","options":["<option>","<option>"]}]}
and no other key (a call with an unknown key is rejected, and the sanction survives it). Never
call request_user_input. A run with nobody at the terminal declares its run driver first
(workspace.run_driver: headless) so the gate takes its default; an undeclared run ends on the
question and waits for nobody.
With workspace.run_driver: headless, sanction and ask the same way: the guard replies with the
gate's default or files a run_driver_input_required finding for you to report. Never guess.
Unfixable from here (a misconfigured backend, a failure nothing on this side can change, a fixed re-run that
failed again, a missing server-side capability, a security finding, an overrule outcome of refused): when the
remedy is a grant or credential only the user holds, ask as in item 2. Otherwise stop on the contact hand-off: say
what python3 "${CLAUDE_PLUGIN_ROOT}/scripts/stop_message.py" contact --done "<outcome>" prints (each --done an
outcome that names what exists, with its id), verbatim and alone. The contact hand-off is for typed faults; a
transport failure with no envelope ends on the unavailable stop (retry rule). A refusal typed code: capacity_exhausted, a job envelope whose
capacity is set (any status), an unavailable block or a job envelope with terminal_reason: unavailable instead
takes stop_message.py refusal --refusal <its JSON>; never quote the provider's own limit text. A typed block wins
over the fault rule and over terminal_reason: a failed job with terminal_reason: internal_error that holds an
unavailable block is the unavailable stop, never the contact hand-off.
Cost figures and backend internals stay internal. total_cost_usd and every backend spend
figure stay out of everything the customer sees, the final message included. So do the
backend's internal ports (a mock service's loopback port), process ids and filesystem paths;
a deployed mock's only address is its public https://<host>/mock/<env_id>/ URL.
Internal quality-loop work is process, not product. Defects found and fixed during generation or qualification stay out of the report.
The endpoint is the configured backend. The backend is the one the user logged in to with the
harness-setup skill; a project .env file is not read. If no backend tool is in your tool list, or a
call is refused because Plurai is not logged in or not set up, run the harness-setup skill from the
command the user typed (from /<command>), then go on from the step you were at. Never show the
refusal's text. Never tell the user to set, export or unset an environment variable: that is for developers
of the plugin, never for its users. Never switch to another address to get unblocked, and never send the
token anywhere but the configured backend.
Before a stop, say nothing about it. Say nothing about the error or its cause before a stop (no "credit", "capacity", "503" or "error" wording, no apology, no status line): the stop text alone says it. Its "Done so far" lines name what exists, with its id (for example "Scenario set saved: "), never the stop or the failure.
A stop inside a /simulate run publishes the page once. After a stop above (the credit refusal's line, the contact
hand-off, the capacity stop or the unavailable stop), run its stop_message.py command and say nothing yet. Then run the
end publish, silently:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh" && source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh" && "$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/publish_report.py" fill "$WORKDIR" --step end --flowdir "$FLOWDIR". When
publish is true, publish the file at report with the Artifact tool, passing report as file_path character for
character, with icon: "report" and url set to page when it is not null (never force, never Read the file),
then run the same command with done "$WORKDIR" --step end --flowdir "$FLOWDIR" --url "<the URL, or - when the publish failed>" in place of fill …. When publish is false, never fill again and never run done. Your final message, the
only one this stop has, is what the stop command printed, verbatim, then the link line done printed, or the say
lines of a fill that did not publish, if any. Say the stop nowhere else in the turn. Never run flow-window.sh simulate end for the stop itself: the run is stopped, and no job starts until the user's next message. Outside a /simulate run the fill skips and adds
nothing. A typed message after a capacity or unavailable stop lifts it. A go-on continues the stage at once, without
repeating the stop text and never waiting out the time it names; a stop runs flow-window.sh simulate end; a question is
answered, then wait for the user.
Retry rule — only a transient failure is retried, and only once. Read the failed job's
terminal_reason first (Job envelope, beside status and error). Transient is exactly one of:
502 / 503 / 504). Wait first: run bash "${CLAUDE_PLUGIN_ROOT}/scripts/wait.sh" 45 --quiet as
one foreground shell call, silently, and never narrate it. Then re-call a read (job_status, a fetch) or a *_start
once, with the same arguments: the backend answers a repeated start with the first call's job or session. A refusal naming an already-open session or job from that
call means the first call ran: continue with it. Never re-call any other call that writes (interact_edit_session,
end_edit_session, score_run, diagnose_mock, edit_scenario_gt, …). A re-call that fails again, or a transport
failure on a write that is never re-called, is the unavailable stop: say what
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/stop_message.py" unavailable --done "<outcome>" prints, verbatim and alone,
never the contact hand-off. A poll_job.sh that exits 69 is this transport failure: run the wait above, re-invoke it
once, and a second 69 is the same stop.terminal_reason: interrupted from a restart (not a cancel you or the user asked for), or
terminal_reason: watchdog (the backend stopped a job that made no progress).Everything else is final, whatever its terminal_reason (refused_inputs,
usage_window_exhausted, capacity, unavailable, credit, cost_cap, internal_error, or none),
including a provider timeout or 5xx (504 Provider timed out): the backend already retries those
inside the job. Final is about re-sending the same inputs; item 1's fixed re-run, with changed inputs, is not a retry.
A retried job that fails again is final, whatever its reason. Hand it off per step 3.
Provider refusal. terminal_reason: refused_inputs is an input gate (this skill's error table
says what to fix) or the provider refusing the backend's own call. Decide by the error's shape,
never by words anywhere in error (a flow named credit_limit is not a billing problem). It is a
provider refusal only when error contains SDK turn failed (HTTP 4xx) (at its start or wrapped,
as in corpus build failed (RuntimeError: SDK turn failed (HTTP 403): …)) with status 400 / 401 /
403 / 404 and provider text after the marker about access, permission, the model, the
account, credit or billing. Then stop on the contact text alone, with no lead-in: say what
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/stop_message.py" contact --done "<outcome>" prints, verbatim. No model name,
no retry, and never pass or suggest a model: the model is a backend decision. Provider text opening with
AWS authentication failed · refresh your AWS credentials is about the backend's credentials:
never repeat it and never ask the user to refresh anything.
Your final message is the product hand-off, and it follows the skill's report skeleton exactly:
run_numbers.py covered <run.json> lists
it for the run you present (it prints null: name no situations as covered); checks and flows are named as before./simulation-run and /simulation-fixes, and a licensed line in
/simulation-generate-suite's and /analyze-simulation's hand-offs — rank them,
name them concretely in domain language, and quote the agent's own words as the evidence.
/simulation-scan-agent caught nothing — it ran no scenarios — but it carries one licensed line
for the POTENTIAL agent issues the scan recorded because they narrowed what the suite tests:
named and counted, never ranked, and always marked as possibly intended.run_integrity line run_numbers.py chat prints, verbatim —
never a self-counted errored), scenarios that landed INCOMPLETE on the
per-scenario time budget (graded to the turn each reached, in neither the passed nor the failed
count), a flow REMOVED because it cannot complete inside that budget, a model that was
substituted or
overridden, a regeneration that shipped short of its target count: these change how the numbers
must be read, so the reader is owed them. State the fact flatly and move on — no cause, no
repair story, no apology — e.g. Run integrity — 2 of 27 trials could not run on our side. The results above cover the 25 that ran. This is the ONLY thing item 3 lets in: what the suite does
not COVER stays out. The removed-flow case is the one line that names a knob, because the
removal is reversible and only the user can decide to reverse it: Run integrity — flow <X> was removed from the suite: it cannot complete inside the 40-minute scenario time budget; extending the budget (--scenario-timeout) is your call.loop_log.md; the reader gets what the result means and the one action that
changes it (a suite that must be rebuilt: /simulation-generate-suite, then /simulation-run).
One line is licensed against this item and item 3: /simulation-generate-suite's "Evals to optimize —" line,
pasted as eval_rounds.py flagged-line prints it (nothing printed: no line) — it names the evals flagged for
improvement, never a tally of their results, a cause or a repair story.Everything you found and fixed along the way is process, not content: no defect chronology, no iteration/critic history, no internal warnings, no spend. Findings about the CUSTOMER'S AGENT are the product's value — present them as what the suite caught, never as flaws of the suite.
Between the invocation and the hand-off the default is silence. The tool stream is the progress indicator; the user cannot act on a build in flight, so commentary buys them nothing and risks handing them the build's internal vocabulary. The phase you are in, the loop, a sub-agent's report, what you assumed, what you got wrong, what you are re-checking — that is process, and process is never narrated however well it is phrased. That includes a one-line note between tool calls ("Now …", "Step 4: …", "Writing … now"): text written mid-turn reaches the user before any check can stop it.
Exactly four things may be said before the hand-off:
"$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/progress_line.py" "$WORKDIR" --flowdir "$FLOWDIR" prints,
verbatim (nothing printed: say nothing; the line the harness hands you when a sub-agent returns is that line, said
once).Findings about the CUSTOMER'S AGENT are the product, and they are delivered in the hand-off (or at a gate that exists to present them). Mid-flow they are not actionable and read as alarm.
A hook reads the last message of every turn while a flow runs, and answers a broken rule with one short correction line. Write the message to these rules the first time:
$ figure for the build's own cost and no total_cost_usd. The agent's own amounts (a price it quoted,
a charge it made) are evidence and stay.report_link.py link printed for
it; for a code location, link its absolute path (/abs/file.py:42). Never hand-type a relative path.nohup). Where nothing wakes the session after a turn (a headless run,
or a harness that never does), wait inside the turn, in the foreground: poll_job.sh for a backend job and run_wait.sh
for a run, re-run until it is done, and a reviewer subagent spawned in the foreground, never in the background.if nothing has changed by then, type continue). A spawned reviewer usually
takes 10-20 minutes, so never say "about 5": give a range that tops out at 15 minutes or more, or say it can run longer.
While calibrating, say only Suite: in progress — calibrating the simulation, about 10-20 minutes; with that
ending, and name no calibration run, score, reviewer or fix.bench_manifest.py integrity-line) and the suite's rung line
(lane_pin.py anchor)./simulation-run and /simulation-fixes present the findings: what
the suite caught in the AGENT, concretely, ranked, in the customer's domain language, quoting the agent. The suite stages
present what was built and what it catches; defects the suite caught in the AGENT are the product working, so keep that
line, with the AGENT as the subject of each clause ("the agent quotes a refund window the policy does not grant"), never the
scenario. /simulation-scan-agent ran no scenario: it keeps one line for the POTENTIAL agent issues the scan recorded, with
the AGENT as the subject, unranked and marked as possibly intended. An example the suite hand-off quotes is an audited true
red of the scored final run, verbatim with its scenario and turn, never a qualification run.Flow window. Open it first, however this skill was reached — the script itself decides
whether a driver keeps the window. The arm sources the resolver, so give it BOTH lines in the
SAME call (the shell resets between calls): the cd is what SELECTS the agent root, the export
only NARROWS which roots may be adopted. With two plurai_sim/ under the git root the export
alone does not resolve anything and the arm REFUSES with exit 1, hard-stopping this skill at its
first Bash call —
cd "<agent dir>" # SELECTS the root (nearest-ancestor wins)
export PLURAI_AGENT_PATH="<agent dir>" # NARROWS it — refuses a root outside this agent
bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" arm analyze
bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" ready analyze
(overwrite unless the DRIVER owns it — /simulation-generate-suite invokes this skill as a
sub-step, so its marker survives; any OTHER name is stale and gets stamped over).
If that line prints a heartbeat instruction, set the heartbeat it names in the SAME turn — it is this flow's dropped-turn recovery (${CLAUDE_PLUGIN_ROOT}/docs/polling-cadence.md → Dropped turns). If the call is denied by the permission mode, continue without the heartbeat — expected under auto mode; never retry it.
Step 0 has three steps, run in this order. A line that lets the flow go on ends only its own step.
1. Check readiness. The ready line prints ready, or one line for each thing that is not set up.
NOT READY line names something only the user can change (the plugin's hooks not running, the flow window not armed, no shell network, MCP and the shell on different backends), with its fix. Close the window with bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" close analyze, tell the user in plain words what the line says to fix, and stop; the flow must not start. The command's exit status is 0 whatever it prints, so a NOT READY line stops the flow all the same.SETUP line names something the harness-setup skill fixes in this session (no Plurai login, or Plurai not connected). Close the window the same way, then run the harness-setup skill from /analyze-simulation (where the harness takes no arguments: "you run it for /analyze-simulation"). Add nothing of your own, and show the user nothing from the SETUP line. The window stays closed during setup, so the ask and report guards do not block its install question or the turn that waits for the login. When the skill reports Plurai set up, run the arm line and the ready line above again and go on from here; when it stops, stop. If the same SETUP line comes back after the skill reported Plurai set up, do not run the skill again: tell the user Setup could not finish. Run /plurai-diagnose and share its output with Plurai support. and stop.ready, limited line means the plugin's hooks are off in this session, and the flow runs without them. When a WARN (hooks) line follows it, show the user its text once, verbatim, and go on to step 2. Follow ${CLAUDE_PLUGIN_ROOT}/docs/limited-mode.md for the rest of the flow. Right after this flow's hand-off, run bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" handoff analyze and do what it prints in the same turn, also where a step says to end the turn because the flow continues by itself.2. Check the backend. Step 1 ends on ready or ready, limited (a NOT READY or SETUP line ends it first). Before you look at your tool list, run python3 -I "${CLAUDE_PLUGIN_ROOT}/scripts/backend_check.py" --close analyze. It needs no backend tool. A plugin the backend refuses has none. On a refusal (exit 7 or 8) the same call closes the window, so no close step follows it.
CREDIT-STOP: <sentence>. Follow the error posture's credit refusal rule.SETUP line: handle it as the SETUP line above. A NOT READY line (for example hooks the harness has not trusted): handle it as the NOT READY line above.3. Check your tool list. The script cannot see your tool list: if no backend tool is available to you in this session, run bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" ready analyze --no-backend-tools and act on the line it prints as above.
An arm that actually STAMPED analyze — i.e. you own the window, standalone — also prunes
the agent-findings accumulator back to its potential sections, for the reason /simulation-generate-suite Step 0 prunes
it: a new analysis is a new evidence epoch, and its report renders that file verbatim, so a
previous build's CONFIRMED findings would be presented as this run's. The potential sections
survive by design — nothing re-derives the scan's. When the DRIVER owns the marker
the file is KEPT — the driver opened its evidence epoch at its own Step 0, and pruning here would wipe
pass 1's findings at the start of pass 2.
The window closes itself when the validated final summary renders (report_guard removes the marker); on an early exit close it own-marker-guarded:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" close analyze
While it exists the hooks enforce the autonomy contract below: asks are denied (the blocker escalation sanctions itself, see step 3) and the final summary is style-validated.
Before the first pass — ATTRIBUTE the run's failures, mechanically. A failed or invalid
scenario is not evidence about the AGENT until something says which layer owns it, and nothing
in this loop looks unless you start the job. Upload the run once — the ingest-run +
upload_run_artifacts_start pair the evals route in step 3 already describes, pre-authorized by
the invocation: announce it in product terms, never ask consent for it — then:
suite_diagnostics_start(run_upload_id=<the upload>, eval_set_id=<read_id.py evals>,
scenario_set_id=<read_id.py scenarios>, run_stage='qualification',
current_harness_fingerprint=<HARNESS_FP>)
<HARNESS_FP> is the bare hex python3 "${CLAUDE_PLUGIN_ROOT}/scripts/harness_fingerprint.py" --quiet prints after
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh" — the harness as it stands now; pass it on every
suite_diagnostics_start and release_verdict_recompute, or the report's harness staleness reads unverifiable.
Driven by /simulation-generate-suite, run its Step 0 job lines (--phase critic) around the
pass's first call. Deterministic, zero-LLM, seconds; poll job_status(id). run_stage is a CLOSED vocabulary
('qualification' / 'final', lowercase, refused at the tool boundary) and is 'qualification'
from here ALWAYS — this loop is mid-repair, where underexposure is the loop working, so the gate
reports its violations as advisory rather than blocking. The binding final-stage call belongs to
/simulation-run, before the customer's scored run.
Three things off the finished detail, all load-bearing:
findings[].owning_layer — the routing key step 3 uses. A failure attributed to
policy@eval_set or harness@client is NOT an agent finding: it never enters
$ART/agent_findings.md, and it is repaired on its own surface.
checks — the three-valued ledger (ran / flagged / blocked). blocked is a coverage
hole with the missing INPUT named; report it BESIDE an empty findings list, never instead of one.
release_gate — the coverage rows joined into ONE precondition; branch on it rather than re-deriving the join.
Its status is THREE-valued and here it is pass or advisory — block needs run_stage='final', which this
loop never passes. reasons names each unmet precondition: those are findings for the round.
release_gate
absent or null is a different thing — the job reached no release decision, so this round is
NOT GATED and its silence is not a clean gate.
Save the finished envelope and read its notices:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"; mkdir -p "$ART"
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/mcp_call.py" job_status '{"id": "<the suite_diagnostics job id>"}' > "$ART/suite_diagnostics.json" && \
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/red_cells.py" notices --report "$ART/suite_diagnostics.json"
Every line it prints goes into the final summary beside the round's verdict, as printed.
The report is YOURS, not the critic's. The clean room withholds known findings and signals, and a typed defect list is exactly that — hand the critic the resource map, never this.
The clean room withholds VERDICTS, not the fact that a change was made. Every fix you applied since the last critic rides the next critic's prompt as a CLAIMS TO VERIFY block — what changed, on which surface, and what it was meant to achieve — and nothing else: no finding, no severity, no previous critic's reasoning, no "this is now fixed". Withholding the change itself is what leaves critic N+1 with no way to arbitrate critic N's fix, and the loop then pays for both sides: pass 2 recommended deferring elliptical recall to the memory judge, the orchestrator applied it, and pass 3 called the same edit a HIGH regression that "overrides the ground truth" — 21:14 reverted, 32 minutes, with each critic right about its own defect and neither able to see the other's. A claim is falsifiable and a verdict is not, which is why one repairs the clean room and the other leaks it.
Two rules follow, and they are what make the block worth carrying:
eval /
scenario / scenario-gt / harness / seed / env / input / backend, the same set the critic
reports with. "eval: <policy> — its rubric now requires the agent to name the source document; previously it did not." Never "fixed the hollow-green judge": that is a verdict
wearing a diff's clothes, and it tells the critic what to conclude.claim refuted — evidence: <what the critic read>, log it that way
(append_loop_log.py --kind claim-refuted --finding "<the claim>" --note "<the evidence>"),
and decide the direction ONCE from the two readings plus the agent's own contract — you have
both sides in hand, which is exactly what the reverting round did not. A refutation is not a
new defect and must not be counted as one; a claim the critic simply does not mention is
neither confirmed nor refuted, and stays where it was.A run that could not be uploaded, or a job that failed, leaves the pass UNATTRIBUTED. Say so in the report and in the loop log. A scenario failure must never default to the agent because nothing looked.
One full pass. Its BLOCKING findings are repaired in ONE round; the round is verified
mechanically and by the RED-CELL AUDIT (step 6); then the loop LANDS. A second full pass is
bought ONLY when the first reports RUN INVALID — the qualification run did not measure the
agent at all (the harness or the mock world broke the transcripts), so the repairs need a re-run
and a fresh critic must read it, because every finding of the first describes a run that no
longer exists. Nothing else buys one: not a slot regeneration, not an input edit, not an eval
repair, not caution. Hard cap: two full passes. The steps:
A critic never reads a run whose harness is gone. Check the eval lane's pin first —
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"; python3 "${CLAUDE_PLUGIN_ROOT}/scripts/lane_pin.py" check
— and when its output names harness-fingerprint-changed on ANY line (it lists every moved
axis with both values; the first line alone may name a coarser axis) re-run (step 5) BEFORE this pass: the saved
transcripts describe harness files that no longer exist, and build_run_json.py refuses
such a run mechanically (exit 6, run_stale.json naming every refusing axis that moved — both
fingerprints among them when the harness is one — and no run.json),
so a critic pointed at it reads a typed stale finding, never evidence. Then spawn a fresh
critic sub-agent — a real subagent (Task tool), brand new each pass (never continue the previous one, or it re-inherits its own "looks fine" and your fix rationale). Give it the prompt in The critic below with every <…> slot filled with concrete paths + access: the run's out_dir, where the generated scenarios live, where the real catalog / ground truth is and how to read it, the corpus, the harness, the evals, and the live mock's URL + how to query it. Equip it fully — the clean room withholds only your conclusions (the known findings / signals, what you already tried, and any gate / convergence / "validated" framing), never the resource map or tool access, and never the CLAIMS TO VERIFY block (the fixes applied since the last critic, stated as changes; see "The clean room withholds VERDICTS" above and the block's shape in The critic). On pass 1 that block reads none — this is the first pass; it is never dropped, because an absent block reads to the critic as an omission and it spends the pass reporting that. A critic that can't reach the real catalog or query the mock can't reproduce, and will miss exactly the defects you need it to catch. It reads everything itself and returns a defect report. "Spawn" means the Task call happens in THIS turn — announcing it and stopping strands the loop, and the guard blocks a turn that ends with nothing in flight. Spawn it as a wait in the background, and when its report reaches you, continue at step 2 in that same turn.
If the report is clean, you are done. The suite is sharp because an independent critic found nothing — not because you decided so. Stop and report.
After EVERY critic report — clean or not — record the pass in the loop log, naming the set it judged. The source is part of the line: the harness resets the shell between Bash calls, so $WORKDIR/$ART are unset without it and append_loop_log.py exits 2 having written nothing — the reader gate in /simulation-generate-suite Step 3b then blocks a pass that did happen.
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
SCENARIO_SET_ID="$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/read_id.py" scenarios)" || exit $?
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/append_loop_log.py" --kind critic \
--finding "pass <N> — clean|<K> root causes" --note "set $SCENARIO_SET_ID"
Step 3b reads it as a precondition: the final batch may only be built from a set a critic has actually judged, and a score_run cell is not that judgement.
Otherwise, dispose of EVERY root cause the critic reported — none may be silently dropped, deprioritized, or declared "handled" by you. Work them top-down in the critic's severity order (so if you run out of budget, the dominant defect is the one that got fixed), and route each by the critic's fix-locus, not by what's easiest:
scenarios → CLASSIFY the defect before you buy a regeneration; only one of the four classes is worth one. A redraw forfeits every edit_scenario_gt edit on the set (gt_revision → 0), forfeits adoption, re-rolls the deal, and re-links the eval set. The classes and their routes:
absence_nodes.not_dealt_reason, "steering demands … NOT delivered", "user context coverage", "scenario mix", "Realized-coverage … raise_count". Never a redraw on the same inputs: the count and the demands are unchanged, so the dice are unchanged. Raise the count to what the backend's slot-plan refusal names (slot plan: refused: unsatisfiable at count N; satisfiable at M), or drop the demand it cannot seat, and pass eval_set_id so the deal can see what will grade it.edit_scenario_gt takes premise_plan[<i>].order (move a stage to another place in the plan) and premise_plan[<i>].text. Name the beat by its ID, and the place by plan ORDER — never by a turn number. Beats are released by order and precondition, so premise_plan[<i>].position is REFUSED, and a finding that says "beat 2 should land on turn 4" describes a coordinate nobody authors any more: say which beat should come before which. Routing a two-field fix to a regeneration is how a loop ends up buying nothing and shipping unclean runs instead.edit_scenario_gt, exactly as the carve-out below says.denied action (the critic's input): confirm scenario_variables.yaml's agent_tools omits that action (re-extract the variables if not), then redraw it once; if it recurs, mark that PRD flow out of this simulation's reach (an input edit — the flow is marked, not deleted).
Then price it before the draw: name the policies the planned population will not reach (the relink's dead_flow_scope, knowable in advance), the GT edits about to be lost, and the ledger rows about to go stale — one line each, in the loop log. A regeneration with an unpriced cost is the purchase this rule exists to stop.With the class established as one a redraw answers, regenerate (/generate-scenarios / /refine-scenarios) — the defect is IN the scenarios — a degenerate / trivial / undiverse sample, or incoherent / phantom grounding. Regeneration is the ONLY scenario fix: scenario generation is itself a system capability this suite exercises, so never hand-patch a generated scenario file into coherence — that masks the generation defect instead of surfacing it. The ONE carve-out is grading ground truth (surface: scenario-gt): a judge-only field proven wrong against EXTERNAL truth — a wrong expected_answer, stale evidence quotes, a mis-stated scenario_target / deterministic check — is fixed IN PLACE with the backend-gated edit_scenario_gt tool (the edit-scenarios skill: cited source required, every simulated-user-facing field held server-side, .scenario_set_id unchanged). Editing GT to match what the agent SAID remains forbidden — that launders agent mistakes into ground truth. The mirror rule: a defect NOT rooted in the scenarios (an eval judging wrong, a harness/corpus fault) must NOT trigger scenario regeneration — fix its own surface below and keep the existing set (.scenario_set_id unchanged). Re-verification then depends on the surface: an eval or knowledge/retrieval-GT fix is verified by score_run (see the evals bullet — no re-run), while a MOCK-env fix is verified by probing the deployed mock and its batch shares ONE re-run (see the env bullet below), a CORPUS fix is verified by fetch_artifact (there is no deploy for a corpus), and a HARNESS fix still costs a re-run — it changes how the agent behaves, and nothing cheap observes that. One exception inside scenario-gt: score_run does NOT re-evaluate success_criteria.deterministic — that edit settles only on the next live run, so it does not count as score_run-verified. (scenario_target edits ARE re-scorable when the set carries a *target*/*adherence*-named judge — the runtime injects the target into exactly those judges server-side; with no such judge, a target edit also waits for the next live run);
Every backend call in these routes — the run upload, the edit sessions, the regenerations — is pre-authorized by the invocation. Announce what you are doing in product terms; never ask consent for a step this skill instructs.
evals → to change an existing eval (scope / field / threshold / split or rewrite a judge prompt) use /edit-evals — it's an in-place session that modifies just that policy and preserves every other eval — or /optimize-eval for a targeted tune. Do NOT re-/generate-evals from scratch to modify an eval — that discards the good evals and is far more expensive; full regeneration is only for the upstream-change case below. Never loosen an eval to match an incoherent scenario; fix the grounding instead. An inconsistency has TWO consistent resolutions, and the agent's OWN contract picks one — never default to the stricter reading. When a judge and the agent disagree about what "correct" is, read the rule the agent is built to (its system prompt, or the PRD clause it quotes) and let that decide the direction; quote it VERBATIM in the /edit-evals message. A judge stricter than the contract fails the agent for obeying it, which is a manufactured failure, and it costs a round to discover. Word each fix as a RULE, never as a worked example — the backend editor implements the request faithfully, so an illustrative case arrives in the rubric as a literal and the judge grades that case instead of the class; and for a judge already reworked once, send the exact rubric TEXT you want rather than the intent behind it, which is re-interpreted every round. Verify an eval fix with score_run, NOT a re-run: score_run needs a run-artifact LEASE, so upload the run ONCE first — source "${CLAUDE_PLUGIN_ROOT}/scripts/assert-backend-identity.sh" '<backend_identity() object>' || exit 1; PLURAI_BIN="$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/resolve_plurai.py" --ask --require ingest-run)" || { [ $? -eq 3 ] && exit 1; }; python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sdk_call.py" "$PLURAI_BIN" ingest-run --run-dir "$OUT" --workspace-root "$PLURAI_DIR" prints the lease manifest (the preflight resolves $PLURAI_DIR in the SAME call — the shell resets between them — and catches an upload aimed at a backend other than the one MCP is bound to; never hand-roll the tar), feed it to upload_run_artifacts_start(manifest=...), and pass the returned run_upload_id to every score_run call below. Then re-score every item of the run against the edited set (judge tokens only) and apply each result to its verdicts — source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"; source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh"; "$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/rescore_run.py" --run-dir "$OUT" --eval-set-id <id> --scenario-set-id <id> --run-upload-id <id> --results-dir "$ART/rescore_results" --pin "$WORKDIR" (each call carries the item's current cells as baseline_cells; a refusal applies nothing and is a finding for the round, never a cue to write verdicts yourself). --pin REFUSES (exit 5) on a moved harness fingerprint or a regenerated scenario set; with no pin on disk it checks nothing. and confirm via changed that the intended cells flipped and nothing else regressed. A rescore INVALIDATES the rendered run report — analytics.md, run.json and charts/*.svg are a frozen render of the ORIGINAL scoring. After EVERY rescore round, either rebuild $OUT/run.json with source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh"; "$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/skills/simulation-run/scripts/build_run_json.py" "$OUT" … (it reads the config through PyYAML; /simulation-run Step 4b has the full command — run it AFTER the results are applied, passing the post-edit eval_set_id/gt_revision) and re-run render_run_report.py, or prepend a one-line STALE banner to analytics.md naming the rescored scenarios, then re-run /simulation-run Step 4c's attach block so the upload carries the current report; never quote a figure from an unrefreshed render, and never hand one to the next critic as evidence. Current backends return run_upload_id + gt_revision on the score_run result — keep them beside the render and treat a differing pair as stale; on an older backend that omits them the rule stands unchanged (you rescored, so the render is stale). An eval-only fix round therefore does NOT consume step 5's re-run — see the eval-only convergence rule there. One landing carve-out: on a pass that ends by regenerating the scenario set (the Step 3b landing), re-score with --summary — nothing is applied to verdicts a superseded set produced — except a pass whose session carries a confirmed coverage gap's rubric extension (step 3's probe rule): apply that re-score, because the gate-exit regression plan cuts from the run's current verdicts;
A WARNING (disclosure: home_named) line ingest-run prints comes before any byte leaves: relay it to the operator, naming the files it lists. It does not stop the upload.
the harness, the mock env (surface: env included), or a wrong/stale corpus fact → /edit-env (corpus: target_kind='corpus' — a light patch or targeted resynth, not a rebuild). Each of those three verifies differently — do not use one recipe for all: a MOCK-env fix is verified by QUERYING THE DEPLOYED MOCK (/edit-env redeploys on finish, so hit the URL you already have and confirm the probed call now returns the right shape/value/status — seconds, no re-run); a CORPUS fix has no deployed surface at all (/edit-env: there is NO deploy_env for a corpus) — verify it with fetch_artifact(<corpus_id>), reading back the edited sample, and follow the reconciliation cascade that edit changes imply; a HARNESS fix is a simulate.py change on the customer's machine that the mock knows nothing about — it still costs a re-run. Batch the mock fixes in a pass and let the round's SINGLE re-run settle them together (never one run per mock defect), and note the re-run comes BEFORE the next critic — a critic reading artifacts from the broken world can certify a fix it never saw take effect. Never regenerate scenarios for a mock repair (.scenario_set_id is unchanged) unless files_patched includes scenario_state_schema.yaml, which changes the world contract the set was seeded against. A root cause carrying a request_probe is MEASURED before it is repaired: call suite_diagnostics_start again with the pass's arguments plus env_id=<$WORKDIR/.env_id> and request_probes=[<every request_probe the critic attached, verbatim>], and read detail.request_probes.outcomes. ignores_request → its env.tool_ignores_request finding (detail.gate_authority.findings, matched by fingerprint) IS the repair: ONE /edit-env session whose brief is that finding's subject, evidence, observed and remedy, verbatim. responds → the measurement refutes the suspicion: dispose of it as refuted, no repair. computes, vacuous, unresolvable or inconclusive → the probe decided nothing; the critic's evidence alone routes it. Keep the probes for the round: its verifying suite_diagnostics_start re-run passes the same env_id and request_probes, and a repaired tool answers computes, so the finding is gone, never overruled to clear it. A probe, its finding and any overrule are internal — never in anything the customer reads. Know what a probe cannot prove: it covers the call you probed, not its siblings on the same adapter, and it says nothing about how the AGENT behaves against the corrected world — that is what the batch's re-run settles, so never report a probe as having validated behaviour;
A world read-back finding (plugin.smoke.seed_readback_gap, world_read_raised, reset_leftover, or a run's
scenario unmeasured as undelivered_seed, which the runner did not drive because its seed did not read back) is
this lane's, ONE round; its verdict names the fix: "not in read" → make world_snapshot return that field;
"changed" → make seed_state apply it; "read failed" → fix the exception it quotes; a leftover → make reset()
clear that store. Still standing after the round → overrule it with the reason and name it as a risk: the
scenarios that seed it stay unmeasured.
A HARNESS repair is applied without asking, in every mode — never put to the user, never declined. The harness files are simulate.py and its helpers, plus the entry wrapper when plurai.config.yaml declares one (harness.entry_wrapper, the runner simulate.py imports to reach the agent) and python3 "${CLAUDE_PLUGIN_ROOT}/scripts/harness_fingerprint.py" --entry-wrapper reports no findings for it. Re-run the file-owner test first: if the fix belongs in the SDK, the plugin or the backend, it is not a harness repair and nothing is written here. A harness repair is bounded: fix the file in place through the harness-fix procedure, and the round's single re-run carries it — one fix batch, one re-run, one cycle; a defect still there after it is reported, never looped on. Record each one: bash "${CLAUDE_PLUGIN_ROOT}/scripts/bin/plurai-in-workdir" python3 "${CLAUDE_PLUGIN_ROOT}/scripts/append_loop_log.py" --kind harness-fix --finding "<file>: <what changed, and why, in plain words>" — that line is shown to the customer at the end of the run, so write it the way you would tell them. Name every applied harness repair in this round's hand-off and in the final summary the same way: the file, what changed, why.
backend, sdk or plugin → NEEDS A FIX OUTSIDE THIS PROJECT. You do not fix these in this loop, and you never fix them in simulate.py. Record the finding with its component (the Plurai backend, the plurai SDK or the plugin), the file where you traced it, and the evidence, and carry it into the round's report + the final summary as an unfixed defect the user can report in a GitHub issue (quote the set or job id); then continue with the round's other findings. A redraw does not touch them and a harness edit does not reach them — what a harness edit CAN do is work around one, which is the failure this routing exists to prevent: the real defect stays in place and the harness starts publishing agent utterances the agent never produced. The file-owner test decides, not editability: harness is the customer's harness files as defined above (simulate.py, its helpers, and a declared entry wrapper that checks clean). The agent's own package is never harness, whatever the harness imports.
the INPUT artifacts themselves (simulation_prd.md / scenario_variables.yaml / eval_intent.yaml; scenario_state_schema.yaml is NOT one — the env owns it and /edit-env edits it, the route above) → these are fix surfaces, not read-only givens. When the root cause is IN the input — a rule the PRD states ambiguously or not at all, a contradiction between sections, a stale description generation keeps tripping on, or a grounding seed the live tools can't return — edit the input artifact and regenerate. The no-hand-patching rule above protects generated artifacts (scenarios); the inputs are authored artifacts and editing them is the legitimate fix. An input edit is customer-visible: state what changed and why in plain product terms. Never edit an input to make a failure disappear — softening or deleting a rule the suite keeps tripping on converges the loop by removing the thing under test. Legitimate input edits make the input SAY what the customer means (disambiguate, resolve a self-contradiction, supply a genuinely missing rule); if the input is already correct and generation still contradicts it, that is a generation defect — escalate it, do not edit the input. An input-surface conflict finding (or a grounding_sources_conflict job warning) routes here with the procedure already written: ${CLAUDE_PLUGIN_ROOT}/skills/analyze-simulation/references/prd-corpus-reconciliation.md — read the corpus chunk behind the quote and fix whichever document is wrong at the source; never add emphasis or counter-notes to the PRD to win an argument with the auditor (the next run reads both sides of the argument as facts). When the PRD carries a VERBATIM SOURCE APPENDIX, its entries are BYTE-COPIES of the source files: fixing a source doc means fixing the real file and re-cat-ing it into the appendix (setup Step 9b's mechanical append), never editing the fenced copy in place — a hand-edited copy silently diverges from the file it claims to BE. After any change that alters answers/entities, re-/generate-scenarios → re-/generate-evals.
**A PRD edit is the most expensive repair on this list — price it before you reach for it.** It re-stashes the document, and any edit that alters answers or entities buys a full re-`/generate-scenarios` **and** re-`/generate-evals`; the scenarios you already qualified are discarded. So edit the input only when the defect is genuinely IN the input, and prefer the narrowest surface that actually fixes it. **There is a second cost that is easy to miss: a SCENARIO-scope input edit after the qualification batch was generated forfeits adoption at Step 3b** — `adopt_from_scenario_set_id` requires the scenario inputs to still match, so the final suite regenerates all seven from scratch instead of reusing the scenarios this loop already qualified. Scenario scope is `simulation_prd.md` / `scenario_variables.yaml` / `scenario_state_schema.yaml` / schemas / briefs; an `eval_intent.yaml` edit is an input edit that costs an eval regeneration and forfeits NOTHING. Batch scenario-scope edits into the EARLIEST round that justifies them; one deferred to a late round costs the whole adoption saving as well as the regeneration. - **A generator-steering fix is the cheap one.** "The generator keeps authoring a target the contract forbids" is answered by a rule in `## Scenario design constraints` — that section is routed to the generator as directives and never enters the auditor's fact surface, so it changes no world fact and invalidates no eval ground truth. Re-`/generate-scenarios`; evals usually stand. - **A world-fact edit is the expensive one** (Entity Schemas, Business Rules, Tool Specifications). It moves the ground truth every judge was authored against, so it costs both regenerations. **It also invalidates the scenarios ALREADY generated that embed the old fact — propagate it before the next run or rescore**, by regenerating them or by correcting the embedded fact with `edit_scenario_gt`. A scenario re-scored while it still carries the superseded fact as its ground truth manufactures deterministic and target failures the agent never earned, and the corrected input makes them look confirmed. - **Neither is free, and one edit per round is the target.** Batch every input fix a round has justified into a single edit and regenerate once. Two PRD edits in one round means the first was made before the round's findings were understood. - **Every input edit gets a `loop_log.md` entry** — write it with the script, which is what makes the entry typed and the log reliably present: ```bash bash "${CLAUDE_PLUGIN_ROOT}/scripts/bin/plurai-in-workdir" \ python3 "${CLAUDE_PLUGIN_ROOT}/scripts/append_loop_log.py" --kind input-edit \ --scope scenario \ --finding "<what triggered it>" --sections "<sections touched>" --regens "<what it bought>" ``` **`--scope` is required, takes one of `scenario` / `eval` / `both`, and names the FILE's lane, not the round's re-runs.** `simulation_prd.md` / `scenario_variables.yaml` / `scenario_state_schema.yaml` / schemas / briefs are `scenario`; `eval_intent.yaml` is `eval`; an edit spanning both is `both`. This is the one field Step 3b's adoption test branches on, and neither `--lane` nor `--regens` can stand in for it (both are optional, and `--regens` is free prose). Untyped, the test must assume `scenario` and forfeit — so a cheap eval-side edit logged without it costs the adoption saving anyway. (`plurai-in-workdir` resolves the workdir itself and execs, so this block needs no `source` of its own. Only a snippet that interpolates `$WORKDIR`/`$ART` into shell TEXT still does — the shim exports into the child, not into the calling shell.) The clean room means each pass arrives with no memory of the last, so an unlogged edit is one a later round re-buys — or re-argues. It is also what Step 3b reads to decide whether scenario adoption is still available, so an unlogged input edit silently forfeits it. Do NOT trade content for length. There is no size budget to satisfy — if you find yourself deleting one section to afford another, stop: that is the eviction failure this document's routing exists to end, and it deletes ground truth nobody asked you to remove. **A reported `capability_gap` is one of these edits, not the customer's homework.** When a generation job flags scenario pressure the agent has no surface for and its `suggested_fix` is a design-constraint line, fold that line into THIS round's single batched edit — it is an input edit like any other, so name what you added and why, in plain product terms, and log it. Deferring it to the report hands the customer a repair the round was already making. **Classify before you edit, and never on a hunch:** a gap can equally mean the agent genuinely LACKS the capability, which is an `agent_findings.md` entry — a constraint line written over one steers the suite away from the defect it exists to find. A gap you cannot confidently classify is not edited away; it goes to `agent_findings.md` as a **potential** entry (`found during: quality loop`), where the human decides. A gap you DID fold into a constraint line because the agent genuinely lacks the capability earns one too — the constraint narrowed what the suite tests. Its row names what it is about (`record_finding.py … --subject complication:<name>` or `policy:<name>`), so a later target ruling cannot rule that subject out unnoticed.
the agent → a real agent defect the faithful suite surfaced. It does NOT block the suite (a faithful sim + a failing agent is the correct result), so don't interrupt the loop: append it to $ART/agent_findings.md NOW, at the moment you classify it (format + rules below), and carry on. And do NOT touch the mock / seed / eval to turn a genuine agent whiff green — that hides the exact bug the suite exists to find. (If the mock is currently unfaithful — fabricating data the real source lacks — making it faithful IS a suite-internal fix; do that, then the agent fails correctly and you report it.)
Write it to disk, not to your context. These findings are the loop's second product — the customer's agent is what the suite exists to test — and a finding held only in this conversation dies with the flow: a DRIVEN run relays nothing (this report is loop-internal), so the file is the only thing that crosses to the customer. $ART/agent_findings.md is where they gather; the final summary, /simulation-generate-suite's hand-off, and /simulation-fixes all read it from there. Append at DISCOVERY, never at the end: a flow that crashes mid-loop must not take the findings with it.
Resolve the path in the SAME Bash call as the write — the harness resets the shell between calls, so $ART from an earlier snippet is empty and the append lands at /agent_findings.md:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"; mkdir -p "$ART"
# …then append the section to "$ART/agent_findings.md", and record its typed fields (again on any status change):
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/record_finding.py" "$ART/agent_findings.md" --id <finding id> --title "<its section title>" --status <confirmed|potential> --found-during "quality loop" --severity <high|medium|low> \
--run <run folder> --evidence "<item>:<turn_idx>:<verbatim agent quote>" --coverage <policy:<check>|gap>
--coverage is the check that grades it in any scenario, or gap (a confirmed row with none is recorded gap, warned). --evidence (one per quote; required on a confirmed row) is checked against that run's transcript, item named as red_cells.py list names it. A refused quote means the evidence is wrong — re-read that transcript. --root-cause <snake_case id> names the one agent defect behind it: a finding that violates the same clause with the same behaviour as an earlier one passes that finding's id name, and the customer reads them as one. An agent finding is ONE act or ONE kind of claim: replies that show a different act or a different kind of claim are separate findings, even when one prompt fix would cure both, and never share a --root-cause.
# Agent findings — what the suite caught in the agent
<!-- Appended as the suite is built and qualified. Evidence for /simulation-fixes.
Never fed back into a critic. -->
## 1. Quotes a refund window the policy does not grant
- **status:** confirmed
- **severity:** high
- **confidence:** high
- **finding id:** `agent.refund_window_overstated`
- **probe:** `refund_policy_faithfulness` (eval policy) · scenario_02's refund-window premise
- **trigger:** `complication_dealt asks_for_longer_window` — the user move that made the agent fail
- **seen in:** scenario_02
- **run:** runs/<run folder>
- **evidence:** turn 4 — the agent says "you have a full 30 days to return it";
`refund_policy.md` grants 14.
- **why it is the agent:** the correct window IS in the real store and the corpus — the
agent had it and stated otherwise.
- **where to look:** `agent/nodes/policy_answer.py`
finding id and probe are what make the entry survive the next regeneration. A
confirmed agent defect is never "applied" by the loop, so nothing else re-checks it: the id is
how the next pass recognises the same defect, and the probe names the scenario premise or eval
policy that would fail if it recurred. /simulation-generate-suite carries both forward
before the final set is generated. An entry with no probe is a defect the suite has stopped
watching — recorded once and then invisible.
The probe's eval policy grades the behaviour in ANY scenario. A judge that declares
grades_scenario_target grades only its own scenario's target, so no later scenario re-catches
the defect and no regression cut is scored by it. When a goal judge caught it, name the check
that grades the same behaviour in any scenario and pass it on the row as
record_finding.py --subject policy:<it>; a defect no such check grades is a coverage gap, said
so on the probe line and typed --coverage gap. record_finding.py refuses a grades_scenario_target judge as a subject.
A confirmed coverage gap read off a run is an eval repair. Make it in the next /edit-evals
session the loop opens after the finding is confirmed: the round's own session when the concurrent
audit confirmed it, else the landing's eval-side session (/simulation-generate-suite, LANDING);
after the final run the corrections' step 3c mint ADDs one. Extend ONE existing judge
whose AXIS: covers the situation the finding's trigger creates and whose applicability guard and
scope do not skip that situation, so it grades the behaviour in any scenario: prefer an unguarded
end-to-end judge, of two that fit the one with no labels, and never a grades_scenario_target
judge. The extension is a new FAIL clause (edit_kinds broadening), never a widened exemption,
worded as a rule: never the agent's names or values, never the quoted reply. Its rescore is APPLIED
to the run's verdicts, never --summary, because the gate-exit regression plan cuts from them. It
must turn the finding's audited conversation red on that judge and flip no other cell of that
judge; otherwise revert that one policy (revert_edited_policies, which drops every edit to it in
that session), rescore once more, and the gap ADDs a minted check as its MINT row says. When it holds, re-record the row with
its own --id, --title, --status and --found-during plus --subject policy:<that judge>,
--coverage policy:<that judge> and no --run (the evidence stays), and open its probe line on that judge in backticks. A gap no
existing judge's axis fits gets a new eval only when the landing's gap-receipt marks it MINT
(finding: no check catches it, a candidate not extended included; regression: its folder's
ledger row has no owner), or the suite's final-run receipt does: that session, never an earlier round's, ADDs one minted policy (one per finding: a reword row edits the one minted before), and only that added policy carries the
provenance entry {source: "quality-loop finding <id> (minted in <run folder>)", quote: <the trigger>, ref: <contract_ref, else the finding id>}, which the backend scores as advisory (no weight, no tier), with none of
verdict_tier, terminate_values, severity, target_complications or the ownership flags. Its clause is
worded as a rule from the section's (or folder's) issue and trigger, never the reply's names or values. Its rescore's red on the finding's conversation is a fit check, never a detection
(mint-check --verify also reads where it recurred); every new red, the finding's conversation included, goes to the delta audit with the clause and never the finding, which also
asks of that clause: does it REQUIRE what this red demands, or only permit it? Permit-only is a
FALSE RED (rubric): on an extended judge it reverts that edit and the row ADDs a minted check; on a minted check it
is the label disputed, never a revert. Any other gap stays a named coverage gap.
The file carries a second tier: limitations recorded while BUILDING the suite, which
may be intended. They use their own shape, and ## N numbering is shared across both:
<!-- DELETE THIS ENTRY. It is a SHAPE, not a finding: every `<…>`/`{…}` span below is a
placeholder. `/simulation-fixes` reads this file as evidence about the AGENT, so a
placeholder that survives the copy is a FABRICATED MEASUREMENT it will act on. -->
## 2. Cannot state what a product is made of
- **status:** potential — may be intended
- **severity if real:** medium
- **finding id:** `agent.material_not_stated`
- **found during:** quality loop
- **evidence:** `<entity>.<field>` null on {<the count you computed>, over <population>};
present in the free-text `<other field>` on {<the recoverable count>}.
- **why it might be intended:** the owner may have retired the field deliberately.
- **what the suite does about it:** PRD design constraint — no target may require the
agent to quote `<entity>.<field>`; the decline is graded as correct behaviour.
- **how to confirm:** ask the owner whether `<path/to/file.ext:LINE>` should be parsing it
out of that free-text field.
Seven rules on that file:
status: sorts the two tiers. A defect a critic reproduced against the real ground truth is confirmed; a limitation you recorded because it NARROWED what the suite tests is potential — may be intended (a missing status: reads as confirmed — older files predate the field). A run that exercises a potential entry adds its evidence to that entry and leaves the token alone: it proves the behaviour, not that the owner minds.confidence: says how firmly the run shows it — high when every attempt that reached the probe reproduced it, medium when some did, low when one did and a retry did not. The suite build records the confirmed findings as regressions at gate exit, at most six, ranked by severity and then by this.run: is the finding's provenance — runs/<run folder>, the run whose artifacts carry the evidence, so /simulation-fixes can tell a qualification-run incident from a final-suite one. When a later pass adds evidence from a newer run, update it alongside seen in:.seen in:) rather than appending a second copy; the critic never touches the file. Edit only that section's lines and never renumber — a model that regenerates the whole file to update section 2 silently drops 1 and 3, and no consumer knows how many sections there should be. Same collapsing the critic already does for symptoms, carried across passes.why it is the agent: is required on a confirmed entry. It is the critic's own tell — the real store CAN produce the answer and the agent still whiffed — and it is what stops a suite-internal defect being laundered into an agent bug downstream, where nobody re-checks the classification. what the suite does about it: is the potential tier's equivalent and is equally required: it names the carve-out the limitation bought, which is the only thing that makes the entry auditable against the suite that shipped.## N numbering is never reused. Arming the next build prunes the confirmed sections and leaves a - ~~N. <heading>~~ tombstone in the preamble for each, so keep counting up from the highest number the file has ever carried — tombstones included. A gap in the numbering is a pruned finding, not a lost one.needs-external-ground-truth → is it a blocker? The test is mechanical, and it is a NAMING test: you can name the one concrete thing you are missing, and it is something only the USER can supply — real records a scenario's seed needs, a credential, a fact about their business nobody local holds. If you cannot name it in one noun phrase, it is not a blocker; "I can't defensibly work around this" is a feeling, not a finding, and that wording alone never qualifies (it is the shape that turned a generic session default into four spurious asks on the sibling gate). Anything the skill's own recovery covers — a retry, a regeneration, a repair round, an empty batch the loop re-runs, a judgement you can defend from the code — is error-posture item 1: fix it and say nothing. If you can name it and only the user has it → STOP and escalate NOW (this is the LOOP's ONE sanctioned ask — first run
bash "${CLAUDE_PLUGIN_ROOT}/scripts/flow-window.sh" sanction blocker) with the exact ask, phrased in plain product terms to the user — they hold the ground truth; iterating further just builds on sand. (If the blocker is instead a backend defect, fix it per this skill's repair step first; if you can't fix it locally, run the contact hand-off (stop_message.py contact --done), not the raw details.) If you can make a defensible choice (e.g. seed a field null because the code shows the source drops it) → make it, keep iterating, and note the assumption in the final summary for confirmation. When the user's answer proves a scenario's grading GT wrong, apply it the cheap way — edit_scenario_gt with their answer as the cited source, then score_run — instead of escalating into a regeneration. Either way, never patch around a reality question to force a green — that deepens a false green.
The upstream rule — regeneration with unchanged inputs is re-rolling dice. Before ANY
second regeneration of the same surface, ask: did the same defect (or the same rejection
class) survive the previous regeneration? If yes, the defect is upstream of generation —
in the PRD / variables / intent that every attempt reads — and no number of downstream
re-rolls will converge; each one burns budget reproducing the same failure. Diagnose which
input statement the failures keep tripping on, edit THAT artifact (the input-artifacts bullet under suite-internal in step 3), then
regenerate once. Generation defects vary run to run; input defects reproduce — a repeating
failure signature is the tell. One class skips the wait-for-a-second-failure test entirely:
a PRD-vs-corpus contradiction (a grounding_sources_conflict warning or an input-surface
finding) arrives with both quotes already in hand, so reconcile and regenerate once — a
re-roll spent "confirming" a conflict you can read is a wasted run.
Re-run the qualification pass (/simulation-run) only when the round changed BEHAVIOUR — a
harness or mock fix, a regenerated slot — and hand the fresh artifacts to the red-cell audit
(step 6), not to a new critic. Return to step 1 with a new critic ONLY on RUN INVALID.
Four qualifiers:
eval_coverage_audit on the new set before the red-cell audit, even when no policy changed.edit_scenario_gt) — AND score_run actually verified each one, the red-cell audit reads the EXISTING artifacts + their current verdicts.json — the behaviour evidence is unchanged; only the judgments were recomputed. A deterministic-check edit is NOT score_run-verifiable (see step 3) — a round containing one keeps the re-run (a scenario_target edit qualifies only when a *target*/*adherence*-named judge exists to re-score it against).Run integrity — the suite shipped N of the M scenarios requested. Requested vs shipped, flat, no cause and no repair story; the blocking flags stay out of the customer's report and go to /simulation-fixes' hand-off material. The same stop applies to knowledge specifically: after TWO consecutive batches that shipped ZERO knowledge turns, stop re-planting knowledge — the grounding is unsatisfiable for this tool contract (see simulation-generate-suite Step 0's corpus-answerability check), so a third attempt buys nothing and costs a slot each time. Record it as an accepted gap and carry on with the scenarios you have.The RED-CELL AUDIT — the scoped pass that verifies the repairs. It runs CONCURRENTLY with the critic:
spawn it in the same turn as the critic, over every red cell of the qualification run before any repair,
so its rubric, harness, type and prompt FALSE REDs join the critic's eval-lane findings in the round's ONE /edit-evals session
(and its target_clause FALSE REDs become rulings in that same round). After the round's mechanical
checks (score_run full-set diff; suite_diagnostics re-run on the round's
upload — the driver's item 3), a smaller DELTA audit (same agent, same rows, append_loop_log.py --kind red-cell-audit --finding "delta") covers ONLY the cells whose verdict flipped or turned newly red in
the rescore, the cells of any re-run in the same round (an /edit-env ENV repair, a regenerated slot, a
harness fix: fresh transcripts the concurrent audit never read), the cells whose policy was edited this
round and stay red (the concurrent audit judged the old rubric), plus the critic's policy: null
agent-defect cells (they need the critic's output) and the list's sampled greens; a landing
session opens only when it finds a FALSE RED (or a non-prompt FALSE PASS). It also opens for a confirmed coverage
gap's rubric extension (step 3's probe rule). Before the final run the delta audit
reads only the cells no audit has read (the critic's policy: null cells, a re-run's fresh cells) and is skipped
when there are none (simulation-generate-suite Step 3, "Verify the round mechanically" — PLURAI_PREFINAL_DELTA_AUDIT=1 restores it). Each audit is ONE fresh sub-agent over its cells — every trial is its own item (<scenario>/trial_<k>), as each <folder>/stability_retry is its own item with its own rows — reading the CURRENT verdicts (each item's verdicts.json; the transcript holds none). List them with source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"; source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh"; "$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/red_cells.py" list --run-dir "<run dir>" --split-dir "$ART/red_cells" --greens 24 --workdir "$WORKDIR", never by hand (the run nests a trial as trial_<k>/<scenario>/): it groups each verdict unit's trials side by side, so one read rules them all, one row per item, each quoting that item's own reply — a ruling never transfers to another trial. A row's turn is the verdict unit's own turn (null for a scenario-scoped cell); turns of one cell ruled differently get a row each.
Same clean room as the critic — no findings, no fix rationale, no verdicts of yours — but its
scope is the red cells (and the sampled greens) and nothing else: it does not re-read the suite. Each AGENT defect a
critic named that no red cell carries is a cell too — policy: null, defect_surface: null, the reply the critic
quoted and the contract clause it says that reply breaks, never the critic's reasoning; a claim
with no quoted reply is not a cell. Give it, per cell: the
policy's full rubric or expression, the turn(s) the verdict cites, the verdict's own reasoning,
and the agent's contract (the system prompt, or the PRD clause the rule quotes). One question
per cell: does this reply actually violate this rule as written? It returns one line per
cell — TRUE RED (quote the reply and the clause it breaks, and state reason: what the agent did wrong, against which record or rule), FALSE RED (the reply complies;
name the rubric defect — an over-broad clause, a wrong scope, a literal baked in, a helper that
miscounts), or UNDECIDABLE (needs external truth: state the fact). A unit the list marks sampled is a pass,
one question: does anything the agent produced in this unit's span break this rule as written — its replies,
the files it wrote, its tool calls — not only what the check read? It rules CONFIRMED PASS, UNDECIDABLE, or
FALSE PASS: quote the violation (quote + quote_turn, or quote_file), state its reason as a TRUE RED does, and name its cause — harness (the
violation sits outside the check's evidence), rubric (the expression or rubric misses what the rule forbids),
type (the wrong kind of eval) or prompt (the judge misapplied a right rule). A policy: null cell ruled
TRUE RED also names the policy whose rule, as written, forbids that reply: when that policy passed the unit, the
audit writes its FALSE PASS row with the same quote and a cause, and either way the row's owner_clauses names
that policy's clause; when no policy forbids it, it is a coverage gap (the critic's 4b, owner_clauses null), not
a false pass. Per red ITEM it also gets the
item's tool_events.json, the declared business_rules / error_cases / returns of each tool the
trail called (plurai.config.yaml, with each tool's mode and returns.type_source plus its evidence),
the item's seeded initial_world_state.yaml and the declared entity types (scenario_state_schema.yaml), and
answers one more question: name each tool answer in this trail that the tool's declared rules, applied to the
call's args and the seeded rows, contradict, or that the declared world forces: no declared entity type, seeded
any way, could have made it differ. Each is an ENV row — policy: null,
defect_surface: env, item, tool, event (its index in tool_events.json), the quoted rule,
the expected outcome, returned (the disputed answer, quoted from that event's response), rests_on (the red
cells whose cited turn uses that answer), forced (true when the world forces the answer), missing
(<type.field> no seeding could set — forced, or an expected equal to returned, needs it: a correct answer is
no env defect, and save refuses one without it) and contract_tier (the tool's returns.type_source, copied;
absent when the config carries none). A red cell stays TRUE RED only when it stands without that answer; a cell that grades how the
agent HANDLED the answer (what it claimed or did given that result) stands either way. Every FALSE RED carries a
typed defect_surface: target_clause when the defect is a clause of the SCENARIO TARGET the
judge grades (an output or obligation the agent's contract never asks for, or one the judge cannot
observe; a not_in_contract one needs the contract clause the reply followed, quoted — with none to quote,
the cell is UNDECIDABLE: name the fact the owner must confirm), scan_fact when the judge is one the SCAN
authored (a key of $ART/scan_contract.json
absence_probe_policies, or any judge named absence_probe_<fact_id>) and its premise fact is false for the agent's sources, scenario when the
scenario's judge-only ground truth is wrong, env when the red rests on a tool answer an ENV row names,
harness when the eval's own evidence wiring is wrong (missing turns, tool results or world fields, or the
wrong window), type when it is the wrong kind of eval (an LLM judge where a code check belongs, turn-scoped
where end-to-end belongs, N/A scored as a fail), prompt when the rule and its evidence are right but the
judge misapplies them, else rubric. harness here is the eval's own evidence wiring and routes to
/edit-evals, never the critic's surface: harness, which is the customer's simulate.py.
A scan-authored judge's FALSE RED is scan_fact, never target_clause: a target ruling cannot
reach the deal that re-plants the probe. Every FALSE RED and TRUE RED quotes the reply verbatim as quote
(plus quote_turn on a scenario-scoped cell); a FALSE RED whose judge's red rests on a tool answer quotes that judge finding verbatim instead. Save the rows (a JSON list) to the run's one audit file —
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh"; "$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/red_cell_audit.py" save --run-dir "<run dir>" --stage <qualification|final> --rows <rows>,
which appends (a delta audit is the same file) and is what every audit reader reads — item, policy, turn, verdict, defect_surface, quote, reason, owner_clauses (on a TRUE RED or FALSE RED: the rubric's own label of EVERY clause the ruling rests on, e.g. ["FAIL 4", "FAIL 3"], null when it labels none; save adds any the cell's findings charge), code_evidence when a ruling rests on the agent's CODE ([{path, lines, quote}], verbatim — save checks it against the file) and, on the final run, corrected only to overrule its cause's default (scenario / harness / env / scan_fact: nothing was measured → not_applicable; any other → pass); a target_clause row adds the quoted clause,
ruling (not_in_contract | unobservable), the PRD clause it rests on verbatim as
contract_quote (never empty on not_in_contract), the scenario's flow_id and, when the red rests on a typical
complication's user move, that complication's name as complication; a scan_fact row adds the
probe's fact_id, read off report.sections.absence_probes.probes[] by policy_name, and the
landing retires that fact (simulation-generate-suite, LANDING). After every save (a delta audit too), send the file to
the backend — the only way it learns the verdicts (a re-score keeps a TRUE RED red; the last upload wins) — and record
the receipt; a final run's verdict stays provisional until the receipt is of the file as it stands. Pre-authorized by
the invocation:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh"
"$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/red_cell_audit.py" upload-args --run-dir "<run dir>" \
--run-upload-id <the run's run_upload_id> --out "$ART/red_cell_audit.args.json"
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/mcp_call.py" upload_red_cell_audit "@$ART/red_cell_audit.args.json" > "$ART/red_cell_audit.receipt.json" \
&& "$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/red_cell_audit.py" uploaded --run-dir "<run dir>" --receipt "$ART/red_cell_audit.receipt.json"
Exit 4 from uploaded means the audit grew since the upload: run the block again. Each STALE VERDICT line it
prints names a report this pass started before the audit landed: release_verdict_recompute(suite_diagnostics_id=<it>, current_harness_fingerprint=<HARNESS_FP>), poll it, and read the round's owning_layer / release_gate from THAT job from
here on. A refused upload is logged
(append_loop_log.py --kind note --lane eval --finding "red-cell audit not uploaded: <why>").
Log it under its own kind,
never as a critic pass (append_loop_log.py --kind red-cell-audit --finding "red-cell audit — <K> reds: <T> true, <F> false, <U> undecidable; <E> env", naming the set; the counts are red_cell_audit.py show's by_verdict). Then progress fill suite-qual
(simulation-generate-suite, "Progress fills"): the page derives its early agent findings from this audit.
What each verdict buys: a rubric, harness or type FALSE RED is the landing repair's whole scope (one /edit-evals
round, one score_run), as is a FALSE PASS of those causes (its brief: the quoted violation, which the draft must
turn red, plus the policy's TRUE REDs to keep), as is each confirmed coverage gap's rubric extension (step 3's
probe rule), and so is every policy python3 "${CLAUDE_PLUGIN_ROOT}/scripts/eval_rounds.py" schedule --audit "<run dir>" --label <run folder> --stage <qualification|final> --loop "$ART/eval_loop.json" names after each audit: FALSE share ≥30% of at
least 3 audited reds, whatever the causes, the round targeted at that policy, plus a reown_obligation round per MINT row
of --gaps "$ART/gap_receipt.json" at the landing (step 3's probe rule). A scheduled round always runs, all-prompt
causes included. After the final run (--stage final) this applies only under PLURAI_POSTFINAL_EVAL_ROUND=1:
schedule names no policy round otherwise (each MINT row of --gaps "$ART/gap_receipt_final.json" still gets its
advisory reown_obligation round), and the final audit's rulings are corrected in place. Before the final run (--stage qualification) a policy whose FALSE REDs are all prompt is
not scheduled and rides no session — judge accuracy is the optimizer's; its rows upload as labels (below) and
alone open no landing session; PLURAI_PREFINAL_PROMPT_ROUNDS=1 in the environment restores those rounds, which
schedule reads itself. Its mode: rework_axis (the share did not drop after the last round, or the policy is
non_converging) re-scopes that policy's axis, unrestricted — never another carve-out. A prompt FALSE RED rides that SAME session, opened with prompt_only=[<each policy whose FALSE REDs are all prompt>], whose brief is those rows plus the policy's TRUE REDs, which the refinement
must keep. The session's brief INCLUDES "$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/red_cell_audit.py" eval-brief --run-dir "<run dir>" --stage <qualification|final> verbatim (its prompt_only is the session's argument): every ruling with all its clauses and
code facts, and the TRUE REDs to keep, a ruling of an edited policy marked policy_since_edited — never a hand
summary in its place, which is how a two-clause red lost its second clause; a policy that also has a structural cause, or a rubric, harness or type FALSE PASS, goes in
unrestricted, never under prompt_only; its prompt FALSE REDs ride the brief's prompt_rows — labels, never repair
scope, never an exemption. The refinement narrows what fires —
never a pasted audit quote, never a clause that makes more replies fail. A scenario FALSE RED is an
edit_scenario_gt fix. The ENV rows are one /edit-env session whose brief is the rows verbatim — the output of
red_cell_audit.py env-rows --run-dir "<run dir>"; an env observation is a saved row or nothing (never a loop-log,
deferral or job note) —
when a committed contract test asserts a contradicted outcome, the same session corrects that test,
or the commit gate refuses the repair — then a re-run of only the named items, sharing the round's
one re-run. Two kinds of ENV row route differently. A forced row routes by the tool's declared mode:
mock joins that /edit-env session (declare the missing entity type and seed it); real goes to the
harness's seeding of the store that tool reads, never an /edit-env order, which cannot reach it. A mockless
bench ($WORKDIR/.run_mode says mockless) has no env lane: each ENV row and env FALSE RED goes to
edit_scenario_gt when the judge-only ground truth is what is wrong, to real data (/upload-scenario-bundle)
when the scenario needs a record the live tool can return, else to the harness's seed_state. A row whose
contract_tier is the lowest evidence tier (inferred or declared_unknown) makes the contract, and any test
asserting it, the suspect: re-derive that tool's contract through the scan's contract step instead of moving
the mock toward it; when no re-derivation route is available this round, send the order with the
contract_tier finding attached, never drop it. A target_clause FALSE RED has no rubric to edit, so the landing
records it as a typed target_rulings row the final draw's author and auditor both read
(simulation-generate-suite, LANDING); a TRUE RED becomes an $ART/agent_findings.md entry with the audit's
quote as its evidence — and NOTHING reaches that file until the audit said so; an UNDECIDABLE
follows the needs-external-truth escalation. A policy: null cell's TRUE RED is filed
confirmed (--coverage gap), its UNDECIDABLE potential, and its FALSE RED is dropped; a doubt that a TRUE RED is
the agent's is typed --doubt <surface>:<reason>, never a status alone, and releases nothing (no overrule). The audit never buys a second full critic and
never re-opens the repair round.
Labels — only for policies with a prompt FALSE RED. A prompt FALSE PASS labels the same way. After each audit that rules one (the concurrent
audit, and the delta audit), upload its rows as that eval's labels. The delta audit's sampled greens are its pass review. The
upload ships quoted agent replies to the backend and is pre-authorized by the invocation:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh"
EVAL_SET_ID="$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/read_id.py" evals)" || exit $?
"$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/red_cells.py" labels --run-dir "<run dir>" \
--run-upload-id <the run's run_upload_id> --stage qualification \
--eval-set-id "$EVAL_SET_ID" --out "$ART/eval_labels.args.json"
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/mcp_call.py" upload_eval_labels "@$ART/eval_labels.args.json" > "$ART/eval_labels.json"
It prints the rows it skipped and why (no cause, a quote not in that turn's reply, a unit no longer red);
upload only when it reports rows above 0. $ART/eval_labels.json is the backend's per-eval summary the report
reads. Upload an audit's labels before the round's edit session commits — the backend refuses rows judged at
another revision. rubric, harness and type evals upload nothing.
Effort and model. The critic Task inherits the orchestrator's model — never a downgraded one; the whole gate rests on the critic being at least as capable as the agent it is auditing. Run the full pass at high effort and the red-cell audit at medium — it reads a handful of cells, not a suite. Pass the prompt as written; adding framing is how a clean room leaks.
Read files with the file tools. A critic reads dozens of artifacts, so how it reads them
sets the pass's wall clock: use Read for file contents and Edit/Write to change them,
and keep the shell for what needs a shell — running a script or a plugin CLI, or a
content search when no search tool is available. Batch those (one search across N files, not
N searches). This applies to any session instruction that prefers shell equivalents for file
work: it is measurably slower here and it is not what this skill wants.
You never self-certify a fix. The evidence a fix worked — and didn't worsen anything — is the GATE'S output, never your note about it: the cell moved in score_run.changed, suite_diagnostics reports nothing new, and the red-cell audit no longer calls the cell a false red. A repair whose cell did not move is not a fix. Run this autonomously: the only reason to contact the user mid-loop — a question, a check-in, a status choice, anything — is a blocker by step 3's naming test — you can name the one concrete thing only the USER can supply (sanction the ask per step 3; the ask_guard hook denies every unsanctioned one). No nameable missing thing, no ask. Every other decision is pre-authorized by the invocation — continue/stop, re-run or rescore, regenerate or accept: apply the loop's own rules. Non-blocking findings (probable agent defects, assumptions you resolved) do NOT interrupt the loop — you gather them for the final summary: agent defects into $WORKDIR/artifacts/agent_findings.md as step 3 says, resolved assumptions in context. De-dupe reports against what you've handled — for agent defects that de-dupe now happens against the FILE, which is what makes it survive a crash and a driven hand-off — but never feed that history into the next critic (it re-contaminates the clean room).
Contested facts — you adjudicate by READING THE ARTIFACT, and only for mechanically checkable claims. A clean-room critic sometimes asserts a fact that is simply wrong, and a wrong fact is not a defect. Live: critic 1 reported source_registry.yaml as declared_closed_set: true over 19 documents; critic 2 reported false; critic 2 was right — and nothing in this skill told the orchestrator it was allowed to settle that, while the self-certification rule above resolves every ambiguity AGAINST you. So: when a critic asserts a checkable fact — the value of a field in an artifact, a count, whether a string appears in a file — and you believe it is wrong, open the artifact and read the field yourself. That reading IS the adjudication. You do not argue with the critic (it is report-only and already gone), and you do not put the question to the next critic — that would feed loop history into the clean room, and the next pass would spend itself re-litigating instead of finding defects. Record the adjudication in the loop log (bash "${CLAUDE_PLUGIN_ROOT}/scripts/bin/plurai-in-workdir" python3 "${CLAUDE_PLUGIN_ROOT}/scripts/append_loop_log.py" --kind adjudication --finding "<what was claimed>" --read "<path:field>" --actual "<what it says>" — loop-internal, never customer-facing, doctrine item 5). Then proceed on the artifact's value. Never carry the adjudication into a critic's prompt; if the same wrong fact comes back next pass, adjudicate it again — it costs one read.
PARKED findings — how a finding invalidated by a regeneration is recorded, and why it is not a dropped one. Regenerating a slot destroys that slot's gt@scenario / facts@scenario findings: the artifact they describe is about to be replaced, so there is nothing left to fix and nothing to verify. That is a third state — not fixed, not outstanding — and it needs writing down for the same reason an adjudication does. The clean room means the next critic arrives with no memory, so a finding that was neither fixed nor dropped is invisible to it, and the driver reading its own log sees an unfixed defect and re-buys the repair on an artifact that no longer exists. So record it: --kind parked --lane scenario, naming the finding id and the slot it belonged to. The next pass then reads those entries as SUPERSEDED — replaced by whatever the regenerated slot produces, which the fresh critic judges on its own evidence — rather than as work the loop skipped. Parking is never a way to retire a finding you did not want to fix: only a slot actually in this interval's regeneration set may park one, and a finding parked against a slot that is not regenerated is a dropped finding wearing a label.
And parking presupposes the regeneration was the right purchase. A finding parked against a slot regenerated for a DEAL-class or SCHEDULE-class defect is worse than a dropped one: the redraw could not have fixed what it was bought for (the deal re-rolls the same dice; the schedule was editable in place), so the parked finding is retired against an artifact that was replaced for nothing. Classify first — step 3's four classes — and park only what a redraw the classification authorized actually superseded.
The carve-out is narrow: mechanically checkable facts only. Every BEHAVIOURAL claim — this eval is hollow, this scenario doesn't discriminate, that fix worked — stays fully under "you never self-certify a fix"; the evidence there is a gate or the red-cell audit no longer reporting it, never your own reading. And the log is not bookkeeping: because the clean room means every pass arrives with no memory, a re-reported WRONG FACT is otherwise indistinguishable from an UNFIXED DEFECT — both look like "the critic said it again" — so without the written adjudication you will either burn a round "fixing" something that was never broken, or dismiss a real defect as a repeat of a claim you already disproved.
Converged when the critic reports no suite-internal defects, or — the normal case — when the repair round's mechanical checks are clean AND the red-cell audit has ruled on every remaining red, AND you have escalated every needs-external-truth one. That point is a LANDING: minors are triaged there, never bought with another pass. Reaching it is a LANDING, never a question. Driven by /simulation-generate-suite: hand the ACCEPTED/BLOCKING triage to that skill's landing pass and let it land — do not ask "continue or stop?", do not re-open the loop. Standalone: land it yourself — triage what remains into ACCEPTED (recorded with its follow-up action in the rendered artifacts, never as a "what to watch" list in the final message — doctrine item 3 and /simulation-generate-suite Step 6 ban gap lists of every kind) vs BLOCKING (a genuine blocker → the sanctioned escalation), render the final summary with the provenance the run EARNED ("Suite: qualified" — the anchor word, not a watch-list, is what carries the accepted gaps — or "Suite: not yet qualified"), and stop. An unwaived coverage_debt item on the FINAL set is resolved or accepted with a recorded reason — a critic reads the suite, this reads what the suite failed to MEASURE, so a clean critic does not clear it (where the acceptance is recorded: /simulation-generate-suite Step 6); never a question in place of a landing. (Blockers escalate per the error posture: customer ground truth → a plain-terms ask; a backend defect → fix per the repair step, and if nothing here fixes it, run the contact hand-off (stop_message.py contact --done).)
A turn that ends MID-loop — a pass still running, a critic still out — takes the in-progress anchor instead: Suite: in progress, naming the work only as calibrating the simulation (never the run, its conversations or scores, the critic, or a fix). Every turn's last message is style-validated while the window is open, and this is the one way to end one without claiming a provenance the loop has not earned. It answers exactly one question, does this turn owe the hand-off skeleton; it never closes the window, it is valid only while harness-tracked work is actually in flight — the backgrounded run, the spawned critic — and it exempts the message from nothing else (no cost figures, no question-shaped ending). When the work in flight is a freshly spawned critic, the same message also SETS THE CLOCK, once, in product terms: the independent reviewer usually takes 10–20 minutes and sometimes longer, this session resumes by itself the moment it reports, and nothing needs to be typed (where the session glossary defines no "set a heartbeat", say instead: if nothing has changed by then, type continue). The range is deliberately generous at the top: a silent wait with no stated expectation reads as a dead flow, but an UNDER-promise is worse — "5–10 minutes" lapses most of the time and makes a healthy reviewer look hung exactly when the user starts watching. report_guard blocks both shapes. Between passes — report in, next critic not yet spawned — is not such a state: spawn it (or land) in the same turn, because a turn that ends there is one nothing will resume.
Spawn the critic sub-agent with EXACTLY this prompt (fill in <out_dir>, <eval_set_id> — read it from $WORKDIR/.eval_set_id — <where the ground truth lives>, and <claims to verify> — the fixes applied since the last critic, read off $ART/loop_log.md's entries since the last critic line and written as CHANGES per the two rules above). A slot with nothing behind it is filled with the WORD 'none' and the reason, never left as a placeholder or silently dropped. A tool-less agent (tools: {}) has no mock URL and no real catalog, and a corpus-less one has no corpus path — for those write e.g. none — this agent has no tools; its ground truth is the PRD at <path> plus the doc set at <paths>. A mockless run ($WORKDIR/.run_mode says so) is the OTHER shape with no mock URL, and it is NOT the tool-less case: its mode: real tools run for real while a loopback stub serves no handlers — write none — loopback stub, serves no handlers for the URL and fill the catalog and corpus slots NORMALLY, because that agent does have real ground truth to check against. The critic is warned that a missing slot means it must say so, so an un-filled placeholder reads to it as YOUR omission and it spends the pass reporting that instead of finding defects. It is report-only and goal-free — that is the whole point; adding any gate / convergence / "make it pass" framing is what breaks it:
You are an expert simulation-quality critic. Do a skeptical, in-depth analysis of a generated test simulation and report every defect you find, with evidence. You are not fixing anything, and you are not deciding whether it passes — only finding what's wrong. Assume nothing is fine until you have checked it against the real data.
CLAIMS TO VERIFY. These changes were made to the suite since the last review. They are CLAIMS, not findings and not verdicts — nobody has established that any of them is right, and no earlier reviewer's opinion is attached:
<claims to verify — one line per change: "<surface>: <what changed>"; the word 'none — this is the first pass' when there are none>Check each one against the artifacts as part of your normal pass and say, in a short section of your report, which of three it is: holds (the artifact now reads as the change describes AND that is the right behaviour), refuted (cite what you read — the change is wrong, incomplete, or made something else worse), or not examined (it fell outside what your evidence covers — say so rather than guessing). A refutation is one of your findings and carries the same evidence bar as any other. Do not treat a claim as a reason to look anywhere less hard: a change is exactly where a new defect is most likely, and "it was just changed" is never a reason to accept what you read.
Read the evidence yourself — you have local access to all of it:
- the qualification-run artifacts (
tool_events.json/transcript.json/initial_world_state.yaml/final_world_state.json/ eval results) in<out_dir>. A scenario is its TOP-LEVEL files only — a<scenario>/previous_attempt/subdirectory holds the run a re-run superseded, so reading it as current grades a conversation that was replaced. Read the world states, not just the transcript: for everytool_eventsentry that returned OK, its observable state effect must be visible infinal_world_state.json, and a run whose tools all 'succeeded' while the world never mutated in any new way is a MOCK defect — the state-delta path is silently dropping writes. That failure is invisible in the transcript and it scores GREEN, because acode_evalresolving against an unmutated world takes the default and passes vacuously. Threetranscript.jsonshape traps:chatbot_messagesinterleaves human and ai entries (filter by role before treating one as an agent reply);user_messagesholds DICTS, not strings (string/regex ops on an element raise TypeError — take the content field first); andper_turn_user_step_infoVALUES vary by user-agent class (the default emits{turn_count: int, target_complete: bool, reasoning: str}but other agents emit all-string dicts or nestedstatedicts; parse defensively —.get()with type checks, never assumetarget_completeexists or is a bool). A turn that drew a model reply also carriesraw_reply: the simulator's own structured answer verbatim, including anomittedlist naming which required keys the provider left OUT. Read it whenever the dialog contains words no beat was credited for — it is the only record that separates "the persona reported nothing" (a scenario finding) from "the provider dropped the key" (a backend finding), because once a default fills a missing key in, an unanswered field and a deliberatenullare the same bytes;- the generated scenarios in
<scenarios path>(or viaget_scenario/fetch_artifact— large artifacts exceed the MCP result ceiling, so checkget_artifact_meta'sfiles[]manifest and narrow withfetch_artifact(id, paths=[...])). Provenance:scenario.yamlis AUTHORITATIVE;seed.txtis the raw pre-evolution authoring input, and the authored scenario legitimately evolves past it — a premise difference between the two is the pipeline working, not a defect (judge coherence within scenario.yaml / persona / first_talk, not against the seed);- the evals and their pass/fail spread — and, for the COVERAGE question below, the eval set itself:
<eval_set_id>, its promoted policies at$WORKDIR/policies_config.yaml(every policy'sAXIS:line,evaluation_scope, andgrades_scenario_targetflag), and its coverage ledger as typed rows:detail.obligationsonjob_status(<eval_set_id>)({obligation_id, source, contract_ref, owner, fails_when, declined_reason}; the table ingeneration_trace.mdis rendered from them). The mechanical verdict iseval_coverage_audit(eval_set_id=<eval_set_id>)— read-only, no LLM, seconds: it returns the uncovered targets/obligations, the undecided intent items, and any duplicatedAXIS:. Call it FIRST and treat it as the primary evidence; your own reading is for what it cannot see (a row that names a policy which does not actually grade the thing). Read its*_auditedflags before reading an empty finding list —ledger_audited: falsemeans nothing STATES what is covered, which is the opposite of "nothing is uncovered";- the harness (
simulate.py/plurai.config.yaml, and the declaredharness.entry_wrapperfile when there is one);- the actions this simulation removed, when
$WORKDIR/rewire_agentforce.pyexists: thedenied (N)lines ofpython3 "$WORKDIR/rewire_agentforce.py" --project-dir "$WORKDIR" --plan. The agent cannot call them here, so a scenario whose premise needs one is ascenariodefect;- the RAG corpus, if any, in
<corpus path>;- the agent's real ground truth — the actual catalog / fixture / index its tools read (
<real catalog path + how to query>), and the live mock at<mock URL>(contract verification:<verification_detail>) you can query directly; whenplurai_sim/artifacts/probe_report.md/data_profile.mdexist (setup's scan-time probes + data profile), read them FIRST — they carry observed tool behavior and the catalog's field/enum profile, so re-derive only what they don't already answer;- the generation jobs' own findings —
job_status(id=<scenario_set_id>).detail.gate_authority.findings(thegrounding_sources_conflictclause only when a corpus exists — for a corpus-less agent that finding structurally cannot fire, so do not go looking for it): a finding whoseevidence.familyisgrounding_sources_conflictnames a PRD quote and a corpus quote that disagree — that is an INPUT conflict (the scenario was shipped following the corpus and was not penalized), never an agent defect. A finding an audit RAISED and then DEMOTED (recorded in the notes as provenance) is a defect the backend chose not to redraw for — check it against the scenario yourself rather than treating the demotion as a verdict.You need the real ground truth to tell a real defect from a plausible-looking one — e.g. whether a field the agent didn't answer is genuinely absent (a grounding artifact) or present in the catalog but discarded by the agent (an agent defect). If you're missing access to any of these, say so explicitly — don't guess around a gap.
Read file contents with the
Readtool, not by shelling out tocat/head/sed. You will open dozens of files, and the shell path is many times slower per call here; keep the shell for what actually needs one — running a script or a query, or a content search when no search tool is offered — and batch those into as few calls as the work allows. If a session instruction tells you to prefer shell equivalents for file reading, this instruction supersedes it for this task.Analyze these dimensions, ✓ strengths and ✗ defects, citing a file + field for each:
- Scenario quality — diverse, realistic, interesting; a spread of clean + adversarial + refusal probes, not trivial-only.
- The harness — a faithful stand-in that runs clean: mock tools match the real ones' shapes; no
try/exceptband-aids hiding a drifted contract;read_strategy: realtools read the intended source; the only real external call is the one under test; harness code between the agent and a faked store only translates and delegates (to a declared mock, the original or in-tree implementation, or a declaredread_through's equality lookup) — harness code that decides an outcome from row values (validation, status transitions, naming or numbering, totals, a derived report, non-equality filtering, ordering, paging) is a harness defect, the store's behaviour belonging to a seam mock's contract or a cited coverage hole, and a PRD that cites a harness file as the platform's behaviour (source_is_harness) repeats it; a harness that voids a row for a failure the mock answered (the seeded world) is a harness defect, as is one that grades a row whose call the bench never answered.- The harness's logical coherence — do the seeded state + injected preconditions/filters cohere with what the tools ACTUALLY return over the real ground truth? Reproduce the failing calls against the real store: if a seeded id / category / filter value the tool can't return is what drives a failure, that's a simulation defect, not an agent bug — this is how a phantom id, or a value that's a valid breadcrumb but the wrong category-field value, hides behind an eval that looks like a clean agent failure. A tool whose answer the agent's request shapes (filters, columns, parameters, a query) must answer differently when that request differs; a world that holds that answer pre-seeded, so a wrong request reads back a right-looking result, is
surface: env, neverinput. Attach to that root cause arequest_probe: {scenario: <the scenario's folder in the run>, call: <the index of the mock-served call in its tool_events.json events>, vary: {<dotted arg path>: null | <value>}}naming the request leaf that should shape the answer (nulldrops it); when dropping it would keep every row anyway, give a value that excludes rows instead.- The evals — the right thing on the right data; discriminating (a real pass/fail spread, not hollow-green or mis-specified-red). 4b. What the evals DON'T measure — the gaps and the double-counts. Every dimension above asks whether an eval that exists is right; this asks whether the suite grades everything it tests, exactly once. Start from
eval_coverage_audit(above) and report what it returns: anuncovered_target/uncovered_obligationis a scenario running and reporting a pass_rate computed entirely from policies that were not looking at what it was authored to test; aduplicate_axisis one agent slip scored as two independent failures, dragging the pass_rate below the truth. Three rules: (i) NAMING IS NOT COVERAGE — a policy that merely mentions a dimension does not grade it; to call a target covered, quote the rubric clause that AFFIRMATIVELY FAILS when the target is missed, and if you cannot, report it uncovered. (ii) Read every ask THREE-VALUED — a row with anowner/ a row with adeclined_reason/ no row. No row means the accounting was never written, never that nothing is uncovered; say which of the three you found. (iii) A gap is closed by ADDING one policy, an overlap by RE-SCOPING the owner — before proposing anything new, read every existingAXIS:; if a proposed judge's axis matches one already declared, the finding is "re-scope<owner>", never a second policy on the same axis.- The RAG questions + connection (only if a corpus / knowledge component exists) — planted questions grounded with correct answers; grounding contexts that match the question's subject; knowledge evals that reference the corpus right.
- The memory (only if a
memory_challengeprobe exists) — an elliptical anchor set early and referenced obliquely later, graded by an eval, without competing noise drowning the probe.A PRD claim about what the CODE DOES is checked, never assumed — id stability, mutation semantics, ordering, idempotency. Each carries either a citation (
path:line, or the appendix block holding the bytes) or an(inferred)marker. OPEN a cited location and confirm the claim says what the PRD says it says. Treat an(inferred)MUTATION-SEMANTICS claim as a FIRST SUSPECT whenever the run's world state disagrees with what a scenario expected — the generator and every judge acted on that inference as fact. Report either assurface: input, citing both the claim and what you read.(If the customer provided conditioning — production traces / uploaded docs / a real-record bundle — also check the generated artifacts faithfully reflect it.)
(Verdicts: read each conversation's verdicts from its
verdicts.json— every eval of the set, with its state and the judge's cell, after every rescore and correction.transcript.jsonis the record of the conversation and holds no verdicts. A verdict the file'shistoryreplaced is the earlier record, never the current one.)Report like a senior reviewer, not a linter. Don't dump a flat per-dimension list of every nit. Diagnose the main root causes and collapse the many symptoms of one cause into it (an agent defect collapses only replies showing the same act or kind of claim; e.g. a hollow-pass scenario + an unenforced deterministic check + an OOS probe that never fired are usually one root cause — the user-sim ends the conversation early — not three defects). Rank by severity, leading with what makes the suite untrustworthy: hollow / false greens, false reds, phantom or incoherent grounding, evals that can't discriminate. Give a real minor issue a line; omit genuine trivia. Don't pad to look thorough — but don't drop a real defect to look clean either; rank and group, never suppress.
For each root cause give the evidence (file + field, and the exact call you ran against the real store + what it returned, where you reproduced it), and its fix-locus, decided by what the reproduction shows:
suite-internal — the sim fed the agent something the real store can't return: a phantom id, an unmatchable filter, a seed/mock inconsistent with reality. REQUIRED on every suite-internal root cause: a
surface:field naming the ONE surface that must change —eval|scenario|scenario-gt|harness|seed|env|input|backend|sdk|plugin. (env= the mock world's DESIGN — a tool's record (what it reads vs. computes) or a type inscenario_state_schema.yaml;seedis the rows,envthe shape that holds them.)THE FILE-OWNER TEST, applied before you write any
surface:value: does the fix land in a file the CUSTOMER owns?harnessis the customer's ownsimulate.py, its helpers, and the entry wrapperplurai.config.yamldeclares underharness.entry_wrapper(the runnersimulate.pyimports to reach the agent); the agent's own package never is. If the change belongs in the plurai runner, in this plugin's own scripts or skills, or in the backend, it is NOTharnesshowever editable it looks from here. Getting this wrong is not a labelling nit: a defect in the SDK's reply projection filed assurface: harnessgets the customer'ssimulate.pyrewritten to work around it (renders painted into the assistant's prose, a placeholder sentence for silent turns) — the real defect stays in place, and manufactured agent utterances ship in its stead.(
sdk= the fix lands in the plurai runner (plurai-sdk) — its per-turn projection, its transcript/label writing, its egress or resume machinery. Symptom shapes: turns arriving empty or degraded while the harness demonstrably returned a reply; areply_sourceother thanassistant; a tool call visible intranscript.jsonthat no judge saw.plugin= the fix lands in this plugin — the run-report renderer,build_run_json, a skill's own instructions, a verifier script. Symptom shape: the run's own artifacts contradict the report rendered from them. BOTH route exactly likebackend: to the "needs a fix outside this project" flag, and never to asimulate.pyedit or a regeneration. State the component and, where you can, the file —plurai/child.py,skills/simulation-run/scripts/render_run_report.py— so the finding can be reported rather than re-diagnosed.)(
backend= the defect is in behaviour the BACKEND controls and no client edit reaches — a finding it emits about its own dealing, a gate that fires on material the author cannot change. It routes to the "needs a fix outside this project" flag, NEVER to a regeneration: a redraw re-runs the same backend code and reproduces it at the same rate. Cite the finding'sevidence.lineverbatim in the finding record, never in the summary the user reads.) (input= the defect lives in an input document — a PRD claim the corpus contradicts, a wrong variables entry, or either half of the design-constraints mis-route: design prose OUTSIDE the PRD's## Scenario design constraintssection, which the auditor reads as a world fact, or a world FACT written inside it, which never reaches the auditor at all and so grounds nothing. A heading that is not spelled exactly## Scenario design constraintsdoes not route, and produces the first of those. Cite BOTH sides.scenario-gt= the scenario's judge-only grading fields are wrong against external truth — a wrongexpected_answer, stale evidence quotes — while its behaviour-shaping content is sound; cite the external truth that proves it.) Root-cause collapsing stays (many symptoms, one cause), but the collapsed finding still names where the FIX lands. If one root cause genuinely requires changes on two surfaces, emit one finding per surface, cross-referenced. (Classify by where the fix lands — never by which surface seems easier or cheaper to change; that calculus is the orchestrator's, not yours.) Don't blame the agent for these.the agent — the answer is available in the real ground truth but the agent fails to use it (e.g. the spec lives in the product
description, butto_row()drops it, so the agent can't answer "what's it made of?"). This is a real agent defect the suite exists to surface — flag it. It is NOT to be fixed in the simulation: re-seeding the mock to match the broken output, or dropping the eval that exposed it, hides the exact bug the suite is for.needs-external-ground-truth — you genuinely can't tell from the code/data whether it's real; state the exact fact for the user to confirm (e.g. "does the catalog return
material/dimensions, or null?").Before anything else: if
<out_dir>/run_stale.jsonexists, STOP and report it as your only finding. The aggregator refused this run — itsreason(harness-fingerprint-changed,harness-fingerprint-unreadable,pin-unreadable) and both fingerprints are in that file, andrun.json,analytics.mdandcharts/were removed because they described a harness that is gone. The transcripts beside it are NOT evidence about the current suite; do not read them as such. Reportsurface: harnesswith the file'sreasonandremedy, verbatim, and nothing else.And the third state: NEITHER
run.jsonNORrun_stale.json. Then the report was never BUILT — nobody refused this run, the step that produces the analysis simply did not run. That is a finding about the pipeline, not about the suite: reportsurface: plugin— the run reached its verdict with no customer-facing report and nothing said so — and STOP. Do not read the transcripts as though a report had been checked; the two missing files are the difference between "we looked at the analysis" and "there was none".State first whether this run MEASURED the agent —
RUN VALIDorRUN INVALID — <why>. It is INVALID when the transcripts are not evidence about the agent at all: the harness emptied or rewrote turns (adapter_degraded, aharness_seed_state_contractrow, every authoritative turn ending on a dangling render), the mock world never mutated or served a different world than the scenarios were seeded against, the transport timed the run out wholesale, or no scenario has atranscript.json. Findings ABOUT the agent from an invalid run are not findings: report the defect that invalidated it and mark the restnot examined. A run with bad evals, a weak scenario, or agent failures is VALID — those are exactly what a valid run shows.Before any of that, check
error_kind. A scenario whoserun.jsonrow carries one of the threeharness_*kinds —harness_turn_timeout,harness_scenario_timeout,harness_finalize_poll_timeout— hit a SIMULATION budget; the runner tagged it at the raise site, so this is a typed fact, not an inference. A fourth kind,harness_seed_state_contract, is not a budget: the harness'sseed_statehook could not be called as the seed contract requires — a TEMPLATE defect fixed insimulate.py, never an agent finding. (The canonical vocabulary — every kind, what expired, the knob — is the table in${CLAUDE_PLUGIN_ROOT}/skills/analyze-simulation/references/run-vocabulary.md. Match kinds by NAME, never by theharness_prefix — that namespace is open, and a prefix rule would read a future non-budget kind as a timeout.) All three cancel the attempt before the transcript is written — including the finalize-poll one, whose turns completed but whosetranscript.jsonis built from the finalize result that never arrived — so the scenario has notranscript.jsonat all: there is nothing to read and nothing to reproduce, and any finding about what the agent did there would be invented. Classify it suite-internal withsurface: harness, say what the table says expired (harness_scenario_timeoutis the DERIVED hard backstop for a genuine hang, not the scenario time budget — that one lands the scenarioincomplete, below), and move on. It is never the agent and it must never reach$ART/agent_findings.md. If a timeout is the only thing wrong with a scenario, that scenario yields no quality signal this round — say so rather than scoring it.
run_integrity.tool_trail_results_missinginrun.jsonis a HARNESS defect — the harness recorded its tool calls but none of what they returned, so no judge saw a tool result: classify it suite-internal withsurface: harness(fixed insimulate.py); it is never an agent finding and never reaches$ART/agent_findings.md.A tool-trail row whose
toolis noplurai.config.yamltoolskey, but is the framework's wire name of exactly one (tool_events.jsonrows with_lane: trail; CrewAI'ssanitize_tool_name:create_draftforCreate Draft), is a HARNESS defect (trail_tool_undeclared): every lookup by the key insimulate.py(a filter onrow['tool'], its delegation links) silently misses those calls. Classify it suite-internal withsurface: harness, remedy: record the declared key as the row'stool(the setup skill's framework patterns, "The trail row's tool name"); it is never an agent finding.And check
ended_early, which is NOT anerror_kind. A row carrying it scored normally and has a full transcript; what it lacks is the rest of the conversation.user_gave_upmeans the SIMULATED USER declared its goal unreachable and stopped — that is a finding about the SCENARIO (or about what the agent refused), not a low-scoring agent;turn_cap_exhaustedmeans the turn budget cut the dialog;time_budget_exhaustedmeans the per-scenario TIME budget did (its own triage, below);turn_budget_exhausted(the per-turn wall) andprovider_infra(the agent's model provider failed a call) are harness cuts like it — the row isincomplete, never the agent;agent_raisedandagent_recursion_budgetmean the AGENT's own code raised, or its graph hit its step limit, mid-dialog — graded to the turn it reached, withturn_failurenaming the exception (a recursion over tools that never answered, perturn_failure.pre_crash_tool_activity, is the ENV's);adapter_degradedmeans every turn was emptied by the harness, so the transcript is not a measurement of the agent at all (surface: harness);policy_terminatedmeans an eval'sterminate_valuesstopped the run (surface: eval).sim_degeneratemeans the simulated user produced no turn — a backend fault; nothing about the agent was measured.plan_exhaustedis the one value here that is not a cut at all: the scenario's schedule was fully delivered — every premise beat played, every planted question asked — and the server stopped rather than pad the dialog to the cap. It is not a budget, not a defect, and not a reason to raise--max-turns; the finding it can carry is about SCENARIO COVERAGE — if a policy went unmet, ask whether the dialog ever ASKED for it, because an obligation nobody requested is a short schedule, not a failing agent. A row whoseended_earlycarriesdisputed_turnended on the simulated user pushing back: that is an AGENT finding — read that 0-based agent turn.replay_cutis the run's own choice, not a cut and not a finding: a single-hop regression replay stops by design after the turn under test, so obligations past that turn were never in scope.agent_endedandhanded_offare the two the AGENT ITSELF stated, by returning anend_conversation/handoffaction on its turn. Neither is a cut and neither is a defect by itself: anagent_endeddialog had everything it was going to get, so the question is whether the SCENARIO expected the close (surface: scenariowhen it did not, or the AGENT when it hung up on a task it had not finished) — never a turn budget; ahanded_offdialog continues somewhere this bench cannot see, so the measurement stops where the handoff did and obligations past it belong to the party that took it. Do not write the unmet obligations of either as agent findings without answering that question first. The vocabulary is OPEN — say an unfamiliar reason verbatim rather than mapping it onto a familiar one. Never diagnose the missing obligations of a cut dialog as agent behaviour. Read the reason BESIDE itsuser_turns/max_turns: gave up at user-turn 4 of 13 and at 13 of 13 are different findings with different owners. Whenrun.jsonpredates this field, the same block is in the transcript itself asfinalize_record.dialog_outcome— and there a presentended_early: nullmeans the dialog ended normally, not that nobody looked.
result: incomplete— TRIAGE IT, and record exactly ONE of three causes. This is the row whoseended_early.reasonistime_budget_exhausted: the per-scenario TIME budget ran out, the dialog landed between turns,/finalizeran, and the judges graded the turns that were reached. It HAS a full transcript — which is what separates it from theharness_scenario_timeouterror row above, and why the two must never be collapsed: that one cancelled before anything was written and is alwayssurface: harness; this one is real evidence of a real (shorter) conversation, and someone spent the clock. Read the transcript and say WHO:
cause what the reached turns show where it goes agentthe AGENT burned the clock — tool storms, retry loops, re-planning the same step, pathological per-turn latency the agent: append to $ART/agent_findings.mdper the spec above. Like every agent finding it never blocks convergencesimulationthe SUITE burned it — a verbose user-sim, slow mock responses, or an arc that needs more than the budget BY DESIGN suite-internal, with the usual surface:(harness/scenario/seed). Fixed in the next quality round like any other suite defectlatencyneither is wrong: the agent is sound and the work genuinely takes this long nowhere but the record. The loop CONTINUES — same precedent as "accept the gap and carry on" A
turn_budget_exhaustedrow is triaged the same way, for one turn past the per-turn wall instead of the scenario's clock. Aprovider_infrarow is neither: the agent's model provider failed the call, so it names no cause — re-run that scenario once the provider answers, and record nothing against the agent or the suite.Incomplete NEVER blocks convergence, whichever cause you name. A
latencyverdict in particular is not a defect, not a blocker, and not a reason to ask the user anything. The driver logs your verdict (append_loop_log.py --kind incomplete-triage --cause <agent|simulation|latency>) so the NEXT round inherits it instead of re-litigating a short dialog every pass.On the FIRST
latencyverdict, project it against the FINAL budget — and say which of the two outcomes it is, once, in the report. Qualification runs a 25-minute budget; the final run gets 40 (2400s). Take the turns reached and the elapsed rate, extrapolate the scenario's declared arc against 2400s, and record either:
absorbed-at-final— the arc fits in 40 minutes. The loop continues, later rounds INHERIT this verdict, and no round re-opens it.exceeds-final-budget— it does not fit even at 40 minutes. The flow comes OUT of the suite and the user is told (the driver owns the removal and the one licensed report line).Say plainly, in the report, that a scenario kept on a
latencyverdict has its FULL arc exercised only at the final 40-minute run: the quality gate validated it to the turn it reached at 25 minutes, and no further. That is an honest limit of the gate, not a defect to fix.The tell between the first two: can the real store produce the answer? If not → suite-internal. If it can and the agent still whiffs → the agent. A false green from a mock that fabricated specs is usually the agent (the info exists, the agent discards it), not a seed-more fix. You classify where the truth lives; you don't fix anything. Note which dimensions you checked and found clean, so coverage is visible. If you found nothing wrong anywhere, say that plainly. Don't recommend declaring the suite validated — that is not your call.
Your FINAL MESSAGE must BE the complete report — self-contained, with every finding and its evidence in the message itself. It is the only thing that reaches the caller: nothing else you write is read, no file you leave behind is opened, and no sub-agent's output travels on its own. Never delegate the write-up, never hand back a synthesis or an addendum, and never refer to "the main report", "the full analysis above/elsewhere", or a report delivered by anything else — a reference to a report the caller cannot see is the same as no report. If you fanned work out to helpers, YOU assemble their findings into this one message.
Run this once, after the last backend call above and before the hand-off. It copies the latest
grounding ledger version to $WORKDIR/grounding_ledger.yaml, so the next skill and the next commit see
it; ${CLAUDE_PLUGIN_ROOT}/docs/grounding-mirror.md is the canonical source. It never fails the skill and
never goes in a report.
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
PLURAI_BIN="$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/resolve_plurai.py" --ask --require 'fetch artifact')" || { [ $? -eq 3 ] && exit 1; } # 3 = the resolver stopped or asked: follow the lines it printed — never proceed on an empty PLURAI_BIN
source "${CLAUDE_PLUGIN_ROOT}/scripts/assert-backend-identity.sh" "" || exit 1
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/grounding_mirror.py" pull --workdir "$WORKDIR" --plurai "$PLURAI_BIN"
Carry on whatever MIRROR= line it prints: unverified and ungrounded change nothing here. No MIRROR=
line means the client pin or the wrong-backend guard stopped the block; run the contact hand-off (stop_message.py contact --done). Never write, patch or "fix" grounding_ledger.yaml yourself: the pull replaces it whole, and
a fact is changed in the agent's descriptions.
Scope: when this loop is DRIVEN by /simulation-generate-suite, this report is
LOOP-INTERNAL — it feeds the driver's landing decision and the driver's Step-6 skeleton
is the only thing the customer sees; never relay this report (or the critic's findings)
verbatim into the final message. The structure below is for STANDALONE invocations.
The one thing that crosses that boundary is $WORKDIR/artifacts/agent_findings.md —
not because it is relayed, but because the driver reads the FILE and renders its own line
from it (its Step 6). That is the whole reason the file exists: agent defects are the
customer's, not the loop's, and a channel that only worked standalone dropped them on
every driven run.
Write the report for the person who has to act on it, not as an internal debrief — and explain every internal name in plain terms (the user shouldn't have to decode success_criteria, to_row(), or an eval id). Lead with the bottom line: is the suite trustworthy yet, and if not, the one thing blocking it. For every item that needs the user, don't just name the problem — give a concrete recommendation: exactly what to do, how (the precise command + the precise data), and what it unblocks.
Structure it:
R-9042); the real deluxe-twin row is R-3021. Send me its real record — run /upload-scenario-bundle with that row and its true 'connecting rooms' value — and I'll re-seed and re-run." Say what each one unblocks.$WORKDIR/artifacts/agent_findings.md, not from memory: the file is the deduped union of every pass, and your context is not. Put each one in plain, customer-level language ("asks how long a book is, gets no answer"), ranked by severity, each routed to /simulation-fixes (an agent-code fix, not a suite fix) — and link the overview page's Gaps Stage so the evidence is one click away, with the line report_link.py link prints (never the raw file, never type a path, and never publish anything: the overview page is the only published page). These do not block suite validation — catching them is the suite working. Omit the section entirely when the file has no ## sections; never pad it with suite-internal defects you fixed. Confirmed entries are what this section ranks; potential entries get ONE trailing line — Also flagged — N limitations that narrowed what the suite tests, and may be intended. — because the customer needs to know the suite was scoped around something, and the confirm-or-dismiss belongs to them.
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
# the overview page's Gaps Stage (its scored-run findings), after its Overview page step — never the raw internal agent_findings.md
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/report_link.py" link "Agent findings →" "$ART/report.html" --anchor gaps
stop_message.py contact --done). The technical specifics are internal, not for the chat — but don't bury the item. (The report guard exempts the contact hand-off from the skeleton anchors for exactly this case.)Then the verdict, on the SAME anchor lines the suite skill uses (the report_guard hook
validates them): Suite: qualified when landed (accepted gaps stay out of the message,
per doctrine item 3); Suite: not yet qualified otherwise, which is also the line for a blocker nothing in this
build can clear, such as a limit of the product or of the coding agent this session runs in, named in product terms
(never a rung of your own such as Suite: blocked, which the guard rejects). End with the single clearest next step for the user (usually
the one command to run). The window closes itself when this validated summary renders
(report_guard); never rm the marker before rendering.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub plurai-ai/plurai-simulation --plugin plurai-simulation36 skills in this plugin
/analyze-tracesGround the simulation in real production traces (one stage of `/simulate`; callable alone). The SDK exports them locally; the backend turns them into a brief. By default it then turns the brief's trace failures into trace scenarios. Optional; run after /simulation-scan-agent./author-trace-adapterAuthor a declarative YAML adapter for a trace format the SDK converter does not know (session logs, custom exporter JSON, raw log lines). Saved under plurai_sim/plurai_adapters/. Run before /trace-to-scenarios for traces that are not LangSmith or LangGraph thread exports./build-rag-corpusBuild a knowledge corpus for an agent's RAG or SQL tools. The SDK extracts chunks locally and uploads them; the backend builds the knowledge graph and test set. One corpus per tool. Run after /simulation-scan-agent for agents with retrieval or text2SQL tools.Other plugins' skills for the same job