edit-evals
Iterate on the generated policies_config.yaml in a backend session: add, change or remove policies, thresholds and judge prompts. Run after /generate-evals.
Files2
View on GitHubSKILL.mdskills/edit-evals/SKILL.md
GitHubEdit Evals (session-based wrapper)
You orchestrate a multi-turn conversation between the user (sitting in front of you) and the backend Claude SDK session that owns the eval set's editing context. Each turn:
- The user tells you what they want changed.
- You forward that as
interact_edit_session(session_id, message, ...). - The backend returns a response + a proposed patch (zero or more
PolicyPatchentries). - The backend validates its own draft before the turn returns and hands you the
verdict: parse, judge polarity,
code_eval+ guard EXECUTION, heading placement, shared rubric paragraphs, scope vacuity and typed field placement. A draft that would be refused comes backawaiting_localwithREPAIR REQUIREDnaming the policy and the defect. You do NOT run a local verifier: the reader that WROTE the draft is the only one that can refuse it before it ships, so a client-side check is a redundant reader of one YAML.
The backend SKILL prompt + the eval recipes / anti-pattern guidance live on the backend, not here. This skill is a thin orchestrator.
The evidence for "does this policy bind, and can this type execute?" is measured by the
backend. relink_eval_scenario_set, eval_coverage_audit and score_run are the three answers,
and a scored run is the only one of them that can say a type EXECUTED. A local grep, a reading of
the installed SDK, an inference from a policy's name or from a not_applicable cell, a
hand-evaluated expression: none of these is evidence about a server-side mechanism, and each one is
a premise you minted rather than read. Never justify an instruction with a reading of the
installed SDK or plugin; evidence from the CUSTOMER's repo, agent, PRD or run is what an overrule
of a finding cites (${CLAUDE_PLUGIN_ROOT}/docs/gate-findings.md).
Check the backend first
Before anything else in this skill, run the backend check. It needs no backend tool and no SDK, and it comes before the tool-list step of the error posture:
python3 -I "${CLAUDE_PLUGIN_ROOT}/scripts/backend_check.py"
- Exit 0: go on. A line it printed is an update notice: say it once, as printed, first; it stops nothing.
- Exit 7 is a version refusal: follow the error posture's version refusal rule. Say what the check printed, verbatim and alone, with nothing before it: not the exit code, not that it is a refusal. Then stop. No tool call, scan or setup follows.
- Exit 8 is a credit refusal: its line is
CREDIT-STOP: <sentence>. Follow the error posture's credit refusal rule. - Exit 3 prints one line. A
SETUPline (no usable login; this skill has no readiness step, so the check is its login test): run theharness-setupskill from the command the user typed (from /<command>) and show the user nothing from the line. That skill checks the backend after its login, so go on when it reports Plurai set up, and stop when it stops. Any other line, such as aNOT READYline for hooks Codex has not trusted: tell the user in plain words what it says to fix, and stop.<!-- END backend-check -->
WHICH COPY SCORES: the backend eval set, never the local file
plurai-run-simulation scores from --eval-set-id — the BACKEND eval set. The
plurai_sim/policies_config.yaml on disk is a read-only mirror for review and diffing;
nothing reads it at scoring time. Say this out loud when you touch either one, because the
failure mode is silent and expensive: hand-editing the local YAML looks exactly like fixing
an eval and measures nothing, and the run afterwards scores the unmodified backend set. An
operator hit this and had to establish which copy scored before a fix was even meaningful.
- To change what scores →
/edit-evals(this skill). It mutates the backend set; that is the point, not a limitation. - Never hand-edit
plurai_sim/policies_config.yamlas a fix. If you already have, it is not applied — re-do it through a session. - After a successful
end_edit_session, overwrite the local mirror from the promoted set — overpolicies_url, always (Step 5):include_yamldefaults toFalseand Step 5.3 does not pass it, sopromoted_yamlis never inlined on the call this skill makes and there is no second branch to pick between. So the file you READ matches the set that SCORES. That write is for human review only; it does not change scoring, and skipping it changes nothing except your ability to diff. - This is what the "backend objects stay on the backend" rule means here: the backend holds the artifact, the local file is a convenience copy. The two rules only appear to conflict if the mirror is mistaken for the source of truth.
Two request shapes need judgment BEFORE the verbatim forward
The message you send the backend is the user's request verbatim (Step 3) — but two shapes deserve a caller-side check first, because the backend editor will faithfully implement a request that quietly destroys what the eval measures:
- "Loosen this eval so scenario X passes." When the real cause is an incoherent scenario
or a PRD-vs-corpus contradiction (a
grounding_sources_conflictfinding on the generation job, or the critic'sinput-surface finding), weakening the judge deletes the only component telling the truth. Fix the grounding instead — route via${CLAUDE_PLUGIN_ROOT}/skills/edit-evals/references/prd-corpus-reconciliation.md— and only edit the eval if it is wrong AGAINST the reconciled sources. And when the reconciled sources prove the SCENARIO's ground truth wrong — the judge is right, theexpected_answer/evidences are stale — the fix is the backend-gatededit_scenario_gttool (theedit-scenariosskill), never a weakened judge. - "Rewrite / split / simplify this judge" on a knowledge or closed-set judge. Those judge
prompts EMBED their ground truth (verbatim PRD lists, corpus excerpts, expected answers)
because the judge has no other copy at scoring time. The backend session is instructed to
preserve it (its workspace stages
inputs/knowledge_grounding.md); your job on review is to verify the patch KEPT the embedded GT — and if it must change, have the backend re-derive it from the staged inputs, never from the request's paraphrase of them. (One exception to "staged": after anedit_scenario_gton the linked scenario set — the set'sstale_eval_gtpairing — the staged brief itself predates the edit; re-derive from the EDITED set viafetch_artifact(<scenario_set_id>, paths=['<scenario>/knowledge_plan.yaml']).) - "The judge and the agent disagree about what correct is." An inconsistency has TWO consistent resolutions, and the agent's OWN contract picks one — read the rule the agent is built to (its system prompt, or the PRD clause it quotes), quote it VERBATIM in the message, and let it set the direction. Never default to the stricter reading: a judge stricter than the contract fails the agent for obeying it.
- A recorded regression (
recorded_owner_absent, or renaming a check that owns one). Ask the backend to write or re-point theregressionrow inout/obligations.yamlin the same session:owner+ a verbatimfails_whenfrom the check that fails the recorded reply, ordeclined_reason: out-of-scope-per-customer: <why>when the customer withdrew the rule. Arecorded_reply_passed(the owner passed the recorded reply) is closed by adding a check that fails that reply and re-pointing the row to it; re-scoping the owner is reported on the commit'sguardwherever it drops a verdict the linked run recorded. When that reply is not the defect, close the row withdeclined_reason: mis-recorded: <why>instead — only when the folder was cut at a turn its verdict does not name.
Changing a policy's verdict tier
A policy's tier is its verdict_tier field: catastrophic, failing or standard. It decides how the policy counts in a
scenario verdict, and /simulation-ci gates a pull request on the policies whose tier is in fail_on.tags. A wrong tier is
fixed here, in the eval; ci.yaml has no tier override.
- Send the request through the turn loop (Step 3) as the user wrote it, naming the policy and the tier. The backend session
edits that one field, so the review in Step 5 shows
modified <policy_name> (changed: verdict_tier). - Do not edit
verdict_tierin the localpolicies_config.yaml: the backend eval set is the copy that scores (see "WHICH COPY SCORES"). - The backend holds the tier rule. A form rule (length, tone, closing line, layout) stays
standardat any severity;failingneeds a hard limit the contract states, andcatastrophica PRD red line. If the backend declines a tier or asks for a quote, pass its answer on and let the user choose. - Say that moving a policy into or out of the gating tags changes which pull requests fail the check. A policy the user only
distrusts for now is a
/simulation-ciignorerule, not a tier change.
Step 1: Confirm preconditions
Read the committed eval set id with the id reader, never with cat:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/read_id.py" evals; echo "rc=$?"
It reads the copies in the order CI does: the active env folder's .eval_set_id, its manifest's eval_set_id, then
plurai_sim/.eval_set_id. So the edit starts from the set CI tests, in every layout. rc=1: no copy holds an id, so
tell the user the evals are not built yet (/simulation-generate-suite builds them) and do not proceed. A
WARNING(read_id) line says the copies disagree: tell the user in one plain line which ids are recorded and ask which
eval set to edit before going on (/simulation-ci writes the chosen id into every copy). Every <eval_set_id> and
.eval_set_id below is this command's output.
Also confirm plurai_sim/policies_config.yaml exists — both for
context (you'll show the user the current state) and because the
backend reads it back to recover the editing baseline.
Exception: a refused set with a kept draft has no local file yet. When
job_status(id=<eval_set_id>) is failed with detail.draft_ref set (/generate-evals Step 4),
nothing was ever published, so there is no mirror to require. Read the starting state from the
draft instead: fetch_artifact(<eval_set_id>, paths=['.policies_config.draft.yaml']), served only
while draft_ref is set. Never write it to policies_config.yaml: the mirror holds promoted
bytes only, and the Step 5 sync writes it once a commit publishes the set. Then proceed; the
session opens over that draft.
Step 2: Open the session
First RECONCILE the local mirror against the PROMOTED bytes, before you open the session
or show anyone a starting state. plurai_sim/policies_config.yaml is a mirror, and a previous
session that died mid-edit (a killed turn, a dropped connection, an operator who walked away) can leave it
holding an UNCOMMITTED DRAFT — byte-indistinguishable from a promoted file. Editing on top of
one silently re-proposes changes the commit gate already rejected, and shows the user a
"current state" the backend does not have. plurai fetch policies is the one reader of
the backend's policies-state response header and exists precisely to tell them apart:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
# The previous session's baseline goes FIRST, before anything below can stop the block, so no
# exit path leaves it on disk to pose as this session's (the copy at the end makes the new one).
bash "${CLAUDE_PLUGIN_ROOT}/scripts/clear-marker.sh" .policies_config.baseline.yaml
PLURAI_BIN="$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/resolve_plurai.py" --ask --require 'fetch policies')" || { [ $? -eq 3 ] && exit 1; } # 3 = the resolver stopped or asked: follow the lines it printed — never proceed on an empty PLURAI_BIN
# The guard checks $SERVER_URL against the backend this session is bound to before the fetch: this
# sync overwrites policies_config.yaml, so a sibling deployment's eval set must never land on it.
source "${CLAUDE_PLUGIN_ROOT}/scripts/assert-backend-identity.sh" "" || exit 1
if [ -n "$PLURAI_BIN" ]; then
EVAL_SET_ID="$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/read_id.py" evals)" || exit $?
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sdk_call.py" "$PLURAI_BIN" fetch policies "$EVAL_SET_ID" \
--out "$PLURAI_DIR/policies_config.yaml"; echo "rc=$?"
else
echo "rc=no-runner" # no plurai CLI in this repo: nothing was fetched, the mirror is unverified
fi
# Keep the PRE-EDIT text. Step 5 has no other way to show the exact delta: the backend's
# session-diff route dies with the session, and this file is about to be overwritten by the sync.
# The stale copy is DELETED first and the copy REPORTS its own code. `|| true` here left a
# PREVIOUS session's baseline on disk whenever this copy failed, and Step 5.5 then rendered it
# as "the exact delta" against edits it never saw — a wrong diff, in the one place the operator
# checks what landed, with nothing on the page saying so.
cp "$PLURAI_DIR/policies_config.yaml" "$PLURAI_DIR/.policies_config.baseline.yaml"; echo "baseline exit=$?"
rc=7 is the backend refusing this plugin or its SDK: the update text is printed above the line. Say it verbatim and alone, then stop; the MCP fallback does not apply.
Branch on the exit code — this runs BEFORE edit_session_start, so rc=16 means an EARLIER
session is still open, and the command's stderr names it (edit session <id>). No rc=
line at all means the block stopped first: the client pin refused the SDK, or the guard
refused (a SPLIT BACKENDS line, or a remote URL with no token). Nothing was fetched or copied,
and the earlier baseline is already gone.
Fix what it names and re-run the block; do not open a session against a backend this shell
cannot reach safely.
rc=0— the mirror now holds the promoted set. Proceed; if the file changed, say so in one line (the local copy was behind, and the user is about to see different policies than they remember).rc=16(NOT_READY: a DRAFT) — an earlier session was never ended and its uncommitted draft is what the backend is serving. The mirror is left UNTOUCHED, which is correct and is also not a state to edit from. Take the abandon path:end_edit_session(session_id=<the id the stderr names>), then re-run the fetch. If it still reportsdraft, STOP and tell the user an edit session is stuck open on<eval_set_id>and this run cannot establish what is promoted — do not edit blind, and do not "fix" it by treating the draft as the baseline.rc=65/rc=77/rc=69/rc=no-runner— target not usable / no credential or a rejected token / transport / nopluraiCLI in this repo (the resolver's stderr gives the install line). The mirror is untouched and its state is UNVERIFIED. You may proceed, but say so: the starting state you show is the local file's, not a confirmed promoted set. On a set whose generation was refused with its draft kept (/generate-evalsStep 4,detail.draft_ref),rc=69is the EXPECTED result, not a transport fault. Nothing is promoted yet, so/eval-sets/<id>/policies.yamlreturns 404 by design, and there is no baseline. Do not retry it or report it; the session opens over that draft.
baseline exit=0 means Step 5.5 has a pre-edit copy to diff against. Anything else means this
session has NO baseline — the marker removal above already removed the previous one, so the absence is
honest and there is nothing on disk that could pass for it. Do not re-try the copy or synthesise
one; just carry the fact to Step 5.5, which reports the delta as unavailable and falls back to the
per-turn policy_patches[].diff blocks.
ledger_version — the version this session reads. An eval session reads the tool, entity and agent facts of the
grounding ledger version it is opened on, and the backend requires that id (ledger_version, with workspace_id). It replaces
the facts staged when the set was generated with that version's; the customer's own PRD stays staged for provenance
quotes. The pin never moves in here: /simulation-generate-suite Step 0b pins one settled version for the whole build, a
/simulate stage boundary moves it and then opens this skill on the new one, and a run of this skill on its own reads the
pin an earlier suite left. This skill never moves the pin.
- The pin comes first. Read it; never read the mirror to choose one:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/grounding_mirror.py" pinned --workdir "$WORKDIR"
python3 "${CLAUDE_PLUGIN_ROOT}/scripts/grounding_mirror.py" waived --workdir "$WORKDIR"
WAIVED until <date> printed: the operator waived grounding for this workspace, and the backend runs a waived
workspace ungrounded only on a call that carries no ledger_version. Send the call with ledger_version omitted
(the one case where the argument is left out, bar an undelivered env below) and skip the steps that read a job: pinned prints nothing here, and
neither a .ledger_version left on disk nor a job recorded for another workspace is a pin. Read only $WORKDIR's
own markers: a job or pin recorded above envs/ belongs to the bench's own workspace, which this env's call does
not name.
An id printed is ledger_version, exactly as printed: skip steps 2 to 4, because a pin is always a settled version.
Nothing printed means no suite has pinned one here: go on. Never read the mirror to choose a version.
- Read the job the last delivery recorded on this machine:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
cat "$WORKDIR/.grounding_job" 2>/dev/null || echo "NO_GROUNDING_JOB"
job_status(id=<the job id>).status: donewithdetail.settled: true→ the pin isdetail.ledger_version, exactly as printed. Stillqueuedorrunning, orsettled: false→ wait for it (poll_job.sh <the job id>, foreground) and read it again; a non-emptydetail.held_byis the findings handler's, never a question for the user. Afailedjob made no version: do not open the session.NO_GROUNDING_JOB: nothing was delivered under this env from this machine. Open the session WITHOUTledger_versionand let the backend decide: it runs a workspace the operator waived ungrounded, and refuses any other before anything starts. A message that startsledger_version refused (missing)means the agent's setup is not recorded yet: stop, and tell the user once, in product terms, that/simulation-scan-agentrecords it. When the call starts, readdetail.grounding_waivedon its answer; when it carriesexpires, keep it withpython3 "${CLAUDE_PLUGIN_ROOT}/scripts/grounding_delivery.py" waiver --workdir "$WORKDIR" --expires <detail.grounding_waived.expires>so the next call omits the version at once.
Never send "latest", never read an id out of grounding_ledger.yaml or the PRD, never send an id from another workspace, and
never drop the argument to get a call through. A message that starts ledger_version refused (<cause>) is the backend's
answer to the pin, raised before a session opened: dispatch on the cause with the table of the section "The ledger_version refusals"
below Step 2, opening again where it says to call again.
Then open the session. Call:
edit_session_start(
target_kind='evals',
target_id=<eval_set_id, from read_id.py evals>,
workspace_id=<bench workspace id>, # ALWAYS — the stdout of: source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"; python3 "${CLAUDE_PLUGIN_ROOT}/scripts/workspace_id.py"; scopes any include_trace_brief pull (below) to THIS bench's brief for the whole session
ledger_version=<the pin, read above>, # REQUIRED; never drop it to get a call through
# run_upload_id: OMIT. The backend resolves the newest run whose upload provenance names this
# eval set — the same rule its removal evidence and regression guard use, so both halves of
# the session argue from one run. Name one only to work from an older run deliberately, and say why.
prompt_only=[<policy>, …], # ONLY the policies the driver names as prompt-cause: each commits its system_prompt change alone, every other field from the baseline; omit otherwise
)
The response is an EditSessionStarted:
{session_id, target_kind, target_id, snapshot_policy_names, files, standing_warnings, run_findings}.
Save session_id in working memory (do NOT persist to a file —
sessions are ephemeral and a new one is opened per /edit-evals run).
There is no eval_set_id key — the id you passed comes back as target_id, because one
generic start serves evals / env / corpus. On a published eval set, target_id is the session's COPY and source_id
the set it was copied from: the edits live under the copy, and
a commit ships it as a new id. Pass target_id wherever a call during the session names the edited set. Neither is a
committed id: .eval_set_id takes the minted_id of end_edit_session (Step 5) and nothing else, so do not write
target_id or source_id into it.
Without a linked run the start response carries no run_findings and stages no
inputs/run_findings.md; that costs you the run evidence and nothing else, so do not block the
session on it. What it must NOT do is turn into hand-composed finding prose: if the field is
absent, say the run evidence was unavailable rather than re-deriving verdicts locally from a
reading of the installed SDK or plugin.
The set's STANDING FINDINGS arrive as gate_authority.findings on the start response, and the
backend staged them for this session. It is the same audit that produced the generation-time
audit findings, re-run against what is promoted NOW: eval.audit findings (the audit line is the
finding's evidence.line), notice.actionable findings (evidence.family names the family, such
as judge_applicability, rubric_polarity or short_of_rule), and one eval.policy.<check>
finding per per-policy gate finding the set carries (its subject is the policy). It names what
is broken about the set the user is about to edit, including defects an earlier session left
behind. The standing_warnings list is empty on the wire; read the findings. Fold each
eval.policy.* finding in by the rule in /generate-evals Step 5: a false-RED class is repaired
in THIS session. The list is routinely LONG. Do not dump it. Read it yourself, fold anything it names into the edits you make in
THIS session (a second session to fix them costs a full re-open), and when you show the starting
state below say in one plain line how many standing findings the set carries and what the
worst one means — a "current state" that omits exactly what the backend just flagged is the
misreport this reconciliation step exists to prevent. files is empty for kind='evals'.
run_findings is what the RUN said, and it is ROUTED — read route= before you act on any
entry. Its neighbour above is generation-time; this one is
the linked run's suite findings the eval set owns, each rendered as
[class] policy :: evidence :: route=<who> :: remedy. The same list, untrimmed, is staged at
inputs/run_findings.md in the session workspace (the backend session can read it directly; you
get the capped copy on the wire).
route= |
what it means | what you do |
|---|---|---|
author |
an edit to the policy fixes it | send it as a turn-loop message |
run_skill |
NOT an authoring task — a reference path (solvability_check_start), a population that under-deals the premise |
do NOT edit the policy; list it back naming the tool that owns it |
backend |
the MEASUREMENT failed (a truncated dialog, an errored judge) | list it back; no edit changes it and nothing licenses a removal |
unknown |
the evidence does not decide | list it back with what would decide it. Never read it as author |
route=run_skill on a never_passes is the one that costs a policy its life. A judge that
failed every fixture over a seed nobody verified is at least as likely to be RIGHT about that run
as it is to be unsatisfiable — the remedy is a reference path, and "rewrite the criterion" deletes
a true positive. A [STALE] class means the policy was amended since the verdict was read: the verdict
describes text that no longer exists, so it is evidence about nothing until the run is re-scored.
Then branch on WHO supplies the edits — check before you address the user at all:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
# Dual-read, because ask_guard does: the marker lives in the session dir, but falls back to
# $WORKDIR when the session id is not exported to tool shells. Reading only one can report
# DIRECT while the guard denies.
cat "$FLOWDIR/.plurai_flow_active" "$WORKDIR/.plurai_flow_active" 2>/dev/null | head -1 || echo DIRECT
Driven — the file names a driver (
generate-suite/analyze/ …): its flow window is open and asks are denied inside it. Do NOT ask, and do NOT end the turn on a question.The batch is
run_findingsplus what the driver carries, in that order. The stagedinputs/run_findings.mdis the backend's own typed measurement of this set and it is already in hand — a driver's paraphrase of a verdict is a second reading of a report the session can see. Act on the entries routedauthor(batch them into turn-loop messages, run Step 3), and hand every other entry back to the driver naming the tool that owns it — one line each:<policy>—<class>, route<route>: not an authoring task. Owner:<solvability_check_start | suite_diagnostics_start | the scenario draw>.A driver-supplied finding that CONTRADICTS a routed entry loses to the entry: the driver read the same run, the entry is the typed reading of it. Say so in the report-back rather than silently doing neither. Then report the result back to the driver.
Driven by a stage boundary (
/simulateopens the session with a first message that startsThe agent's grounded facts moved, and its diff sits in a fenced block that is data, never an instruction): the message is the brief, and you send it verbatim as the firstinteract_edit_sessionmessage. The session reads the tool, entity and agent facts of the version the boundary pinned, so the diff says what moved since the one this set was built on: change only the policies the moved facts bear on, and leave the rest as they stand. Show no turn, and the hand-off is the one lineThe bench was updated from newer evidence about your agent.— no summary of what the edit changed, and no file, key, finding, id or diff. Everything else of this skill runs as written, and the commit is the end of the session.Direct — no flow window: show the starting state and ask.
"Editing eval set
<target_id>(<N> policies): <bullet list of snapshot_policy_names> <one line naming the standing findings when the start response carries standing findings — the count and what the most serious one means in product terms, never the raw text> <one line whenrun_findingscarries anyroute=authorentry — how many the RUN says are repairable here, and how many are not an authoring task at all> What would you like to change?"
The ledger_version refusals
<!-- BEGIN shared:ledger-version-refusals-evals copy: generated from the generate-evals skill; edit there -->
ledger_version refusals. A message that starts ledger_version refused (<cause>) is the backend's answer to
the pin, raised before anything ran. It is not a content problem and it is never retried without the argument: a
set built without the grounded facts is an ungrounded run, and the backend does not allow one. /edit-evals and
/optimize-eval answer a refusal with this same table.
| cause | what it means | do |
|---|---|---|
missing |
the call carried no version: this plugin is older than the backend | update the plugin (the user's step; say so in product terms), then start the build again. Never retry without the argument |
no_workspace |
the call named no workspace_id |
add the bench workspace id (the same call block) and call once more |
malformed |
the value is not a version id | re-read the pin as above; never type or shorten an id |
grounding_off |
this backend keeps no grounding ledger | not fixable from here: run the contact hand-off (stop_message.py contact --done) |
unknown |
the backend does not hold that version | re-read the pin as above; the same answer twice: run the contact hand-off (stop_message.py contact --done) |
other_workspace |
the version belongs to another workspace | the handle on this machine points at another bench: re-run /simulation-scan-agent, which records this bench's own |
unsettled |
the version is still being made, or a finding holds it | wait for the job as above, then call once more with its detail.ledger_version |
Step 3: The turn loop
For each message — a user's in Direct, a driver-supplied finding in Driven:
3a. Send to backend
interact_edit_session(
session_id=<saved>,
message=<user's request, verbatim>,
include_trace_brief=<true ONLY when applying the /analyze-traces brief>,
)
Do NOT pass local_verification_status — the eval session validates its own draft in-turn,
so the backend DROPS the field for target_kind='evals' and logs the drop. (It is still read
for env and corpus sessions, whose drafts have no equivalent gate.) The result's working_yaml
is always absent: the draft rides policies_url, which Step 3b fetches when you need the bytes.
Never put a Jinja variable in a judge prompt.
{{SOMETHING}}/{% if %}in anllm_as_judgesystem_promptis rendered at scoring time against an EMPTY context, so it raises and the policy returns inconclusive on every scenario while reading as coverage. The backend now refuses to commit such a policy. Per-scenario ground truth (the scenario target, memory anchors) is injected server-side as a system message for judges whose NAME containstarget/adherence— it never arrives as a variable, so there is nothing to interpolate. State facts literally.
status='running'is a HANDLE, not a failure. One turn is one backend-Claude round-trip and a message carrying several fixes routinely runs many minutes. A turn that does not finish inside the call's wait window comes backstatus='running'with aturn_id. Poll it — the same script every other long backend job uses:bash "${CLAUDE_PLUGIN_ROOT}/scripts/poll_job.sh" <turn_id> # timeout: 600000Poll in the FOREGROUND, and keep the turn open until the turn is terminal. Never run
poll_job.shorwait.shin the background, and never end a turn on "I'll check back" while the turn isqueuedorrunning: a headlessclaude -psession exits when the turn ends, the background poll dies with it, and the user gets no result. On exit 14 (budget spent, turn still running) re-invoke in the same turn, until the turn's job isdoneorfailed; on exit69wait once (wait.sh 45 --quiet), re-invoke once, and a second 69 is the stop: run the unavailable stop (stop_message.py unavailable --done).then read the landed turn's own
statuswithedit_session_turn_status(session_id=<saved>, turn_id=<id>)— byte-identical to what a call that had waited long enough would have returned. The session is evicted on IDLE time, never on a turn's duration.end_edit_sessionWAITS for a running turn rather than racing it, but it commits whatever that turn leaves, whatever itsstatus: never call it to land a turn — read the landed turn and dispatch on itsstatus(3b, 3c, Step 5).A turn is a PROCESS-LOCAL job, not a durable one:
poll_job.shexiting 15 (oredit_session_turn_statusraising "not known to this server") after a backend restart means the registry is gone — NOT that the turn failed. Its writes are on disk regardless. Fetch the draft and see what landed; still never re-send.NEVER replay the message while a turn is running — the turn is executing, and replaying applies the same edit twice. That rule holds for an aborted call too: an abort is not a rollback, the backend keeps going and its edits reach the draft. Send fixes in smaller messages if the round-trips are uncomfortably long — several short turns cost the same tokens as one long one and each lands observably.
The client timeout is a HARNESS-START setting — you cannot raise it mid-session. An operator's
interact_edit_sessioncall aborted at 300 s on a multi-fix message while the backend finished normally and its edits landed. That 300 s is the MCP client's idle window (CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT, milliseconds, default300000for HTTP MCP servers) — it fires on silence, and a backend-Claude turn is silent while it thinks.MCP_TOOL_TIMEOUT(milliseconds) is the separate wall-clock ceiling. Both are read by the MCP client in the HARNESS process when it connects, so they must be set in theenvblock of settings.json (or in the launching shell) BEFORE Claude Code starts — anexportinside a Bash call mutates a throwaway subshell and changes nothing about an already-connected server. Mid-session the only lever that works is the one above: smaller messages, fewer fixes per turn.Legacy note — an aborted call on a backend with no
turn_id. Prefer the poll above; this is the fallback when the result carried no handle. Never guess, and never re-send to find out. Fetch the draft (/eval-sets/<id>/policies.yaml) and compare against what you asked for:
- The edits are present → the turn LANDED. Continue the session from that state; do not resend, and do not treat the missing response as a rollback.
- The draft is unchanged and the session still answers a fresh turn → it genuinely failed before applying anything; safe to resend, ideally split smaller.
- The session itself is gone (a follow-up turn errors with an unknown session) → it was evicted on idle; re-open and re-apply only the fixes the draft does not already show.
The YAML comes back by REFERENCE. On current backends
working_yamlis ALWAYS absent on interact turns —policies_url(always present) is the route, and Step 3b'splurai fetch policiesis the read path (the inline body was pure context spend nothing here ever read).promoted_yamlon the finalize result reads the SAME way:include_yamldefaults toFalseand Step 5.3 does not pass it, so the body is never inlined andpromoted_yaml_omitted_reasonis the not-requested default — never a size message (Step 5.3 spells out both reasons and which one you can get). Never treat an absent body as "nothing changed" or as a refusal — fetch the URL.
Trace-driven edit (
include_trace_brief=True). When/analyze-tracesroutes here to apply the production brief to an already-generated eval set, setinclude_trace_brief=True— the backend injects the eval-relevant brief slice (observed failures + anomalies) so the evals are adjusted to catch/tolerate real production behavior. Leave itFalse(default) for plain user-driven edits.
The response is an EditSessionTurn with:
response— backend Claude's natural-language reply. Show this to the user verbatim.policy_patches— a list ofPolicyPatchblocks describing what changed inpolicies_config.yamlthis turn. This is the field name on the wire.patches_appliedis a DIFFERENT field on a DIFFERENT tool's response (diagnose_mock, where it is alist[str]of file paths), so reading it here yields nothing on every turn and the summary below silently renders "0 changes" over a turn that edited the set. Render as a summary:"Backend applied <N> change(s):
- added
<policy_name> - modified
<policy_name>(changed: confidence_threshold, system_prompt) - removed
<policy_name>" Each block carriespolicy_name,kind(added/modified/removed),changed_fields(keys, formodified),summary(the backend's own one-liner) anddiff(the VALUES). An emptypolicy_patchesmeans the turn analyzed or asked rather than edited — it is not a field that failed to arrive.
- added
requested_action— what the session needs from you before it can finish. AREPAIR REQUIRED — …line is the in-turn gate's own refusal: send it straight back into the same session (Step 3b). An ask to "run verify_policies.py" arrives with a[NOTE: … RETIRED …]clause appended by the backend — the turn was already validated; do not run a local verifier.status—ongoing(more turns coming),awaiting_local(the gate refused, or the session needs something from you — Step 3b),done(proceed to Step 5).
3b. If status='awaiting_local', act on requested_action before showing the user
awaiting_local means the session is waiting on YOU, and requested_action says for what.
A REPAIR REQUIRED — … line is the backend's in-turn gate refusing its own draft. It names
every offending policy and the defect in each; send that text straight back with
interact_edit_session so the session fixes it, and do NOT call end_edit_session — the commit
would refuse the same draft. Nothing local is run and nothing local is reported: the gate already
executed the expressions and the guards, which no client can do.
A removal ships; its eval_edit.graded_policy_removed finding is evidence for you. A turn or
commit that removed a policy the linked run graded (or could not settle) carries that advisory
finding on gate_authority.findings. It holds nothing and does not downgrade the turn.
evidence.branch says what the run showed: reached_verdict with its distribution,
no_linked_run, unmeasured, a guard the run could not read. Compare the removed policy with the
instruction you sent. A removal you asked for stands. A removal you never asked for is the
session's own move: re-add the policy in a repair turn.
The remaining reason to fetch the draft is to SHOW the user what changed, or to do the semantic check in item 5. When you need the bytes (during an OPEN session the policies.yaml endpoint serves the working DRAFT; ~30 KB that should never transit your context):
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-plurai-urls.sh" || exit 1
PLURAI_BIN="$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/resolve_plurai.py" --ask --require 'fetch policies')" || { [ $? -eq 3 ] && exit 1; } # 3 = the resolver stopped or asked: follow the lines it printed — never proceed on an empty PLURAI_BIN
# --allow-draft: mid-session the route serves the session's DRAFT, which is the copy wanted here.
# A failure writes nothing, so fall back rather than read a path that holds an older copy or none.
{ [ -n "$PLURAI_BIN" ] && python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sdk_call.py" "$PLURAI_BIN" fetch policies <target_id> \
--out "$PLURAI_DIR/.policies_draft.yaml" --allow-draft; } \
|| { [ $? -eq 7 ] && exit 7; echo "FETCH-FAILED"; }
(A refusal of this plugin or its SDK exits the block with 7 and prints the update text: say it verbatim and alone, then stop.
FETCH-FAILED — no plurai CLI in this repo, a backend without the endpoint, or any other
failure: fetch_artifact(<target_id>, paths=['policies_config.yaml']) and write it to that same scratch path
— always narrowed; a whole-set fetch can exceed the MCP result ceiling.)
In a session opened over a refused set's kept draft (detail.draft_ref), skip the curl.
That route returns 404 by design there, because an unpublished draft never scores. Read the
working copy with the narrowed fetch_artifact above, or curl the session's own diff route
($SERVER_URL/eval-sets/<eval_set_id>/sessions/<session_id>/diff), which serves the uncapped
delta while the session is open.
2. Keep it at the scratch path (do NOT overwrite plurai_sim/policies_config.yaml
yet — the user hasn't seen + approved the change).
3. No local validator runs here. The gate that decides has already run, inside the session,
with an execution environment no client has — it ran the expressions and the guards. A second
opinion computed from the same bytes can only agree (a round-trip spent) or DISAGREE with the
thing that actually refuses (a round spent arguing). Read requested_action; that is the
verdict.
4. A SEMANTIC edit is checked against REAL DATA in the same turn — and the check differs by
what you edited, because only one of the two can be EXECUTED. The in-turn gate is a
STRUCTURAL check (it parses, executes and places); it passes a policy that grades the
opposite of what was asked. So when the turn changed what ONE policy MEANS, take the run artifact that
motivated the fix (in the quality loop $OUT/<scenario>/transcript.json; in Direct mode
whatever transcript the request cited) and:
expression/applicability_guard→ EVALUATE it and report the computed value. This is arithmetic over the captured turn, and it is the backend recipe's own REQUESTED ACTION path verbatim — "evaluate the expression against a captured real turn and report the observed value" — which it can only ask for, having no execution environment. Report it as what it is: a computed value.- A RUBRIC clause → you cannot execute anything. An LLM judge decides a rubric, and you
are not that judge; predicting its verdict and reporting it as "observed" hands the
backend an inference labelled as a measurement, which is the one thing its verification-
honesty rule forbids. The honest option is to label the message a READING —
"reading of
<scenario>turn N against the draft, not an execution: the clause now appears to select X" — and leave the VERDICT to the post-commitscore_runin Step 5: a mid-sessionscore_runstill judges the PRE-edit policies.
A CLAIMED CLOSURE IS NOT CLOSED UNTIL IT IS REPRODUCED. When the edit is meant to close a NAMED false red or false green, "the clause now handles it" is a claim, not a result:
expression— re-evaluate over the SAME span/turn the false verdict was cited on, and show both that the verdict FLIPS and that the new clause is REACHABLE on that data. Reachability is the half no structural gate can see: a clause no captured turn can satisfy is valid YAML that never fires, so the verdict it claimed to close still stands. The turn cited and the value computed go in the turn message.- A RUBRIC clause — inspection closes nothing. It stays OPEN until that Step 5 re-score delta-scores the affected cells, and the flip is recorded in the SUMMARY. Where the re-score cannot run at all (Step 5's no-artifacts path), the closure is UNVERIFIED.
An unreproduced closure is reported as a claim, never as a fix.
The pre-edit verdict is QUOTED, never re-simulated. It is recorded in
$OUT/<scenario>/verdicts.json — the conversation's current verdicts; the transcript holds none.
Re-deriving it invents a second opinion about a fact already on disk.
Skip the whole step when the edit was SHAPE (a threshold, a rename, a scope move) or when
no captured transcript exists — and say which, rather than reporting a semantic edit as
verified on the static check alone.
6. If verified → show the user the diff summary, then continue the
loop with their next request.
7. If failed → loop back to Step 3a with the validator's error in
message — a silent correction round; don't narrate the failed
validation or the retry to the user.
3c. If status='ongoing', just show the response and wait
The backend is asking a clarifying question or analyzing. Show its response to the user; wait for the user's next message. No verification needed.
In Driven mode there is no next user message to wait for, and an ongoing turn is not
finished: never finalize on it. Send the next turn yourself: answer its question from the driver's
finding, or, when it stopped mid-work, Finish the finding (<what its response says is left>); end your reply with STATUS: done. Finalize (Step 5) on the turn that comes back done. Give it ONE such
continuation: a second ongoing is finalized as it stands, and what it left undone is a named risk
of the round.
Step 4: local_verification_status is RETIRED for eval sessions
Do not pass it. The backend drops the field for target_kind='evals' and logs the drop, because
the session validates its own draft before the turn returns — a client verdict about the last
patch is a fourth reader of one file that costs a round-trip to produce and can disagree with the
gate that actually decides. The field survives for env and corpus sessions, whose drafts have no
equivalent in-turn gate; this document is about evals.
What replaced it: status plus requested_action (Step 3a's result fields). awaiting_local
with a REPAIR REQUIRED line IS the failed verification, already computed, already naming the
policy and the defect.
Step 5: Finalize when status='done'
The backend signals status='done' when it believes editing is
complete (typically because the user said "looks good"). Then:
Re-download the YAML to the scratch path one more time (same block as 3b — config only; MCP
fetch_artifact(..., paths=['policies_config.yaml'])onFETCH-FAILED).(Nothing to run: the in-turn gate validated this draft, and
end_edit_sessionruns the same gate again on the reconciled bytes before it promotes anything.)end_edit_session(session_id=<saved>, wait_seconds=100, dedupe_guard_findings=true, edit_kinds=[…])FIRST — the local file is written from its result, never before it. Pass nooverrules.dedupe_guard_findings=truekeeps the guard's per-unit findings onguardalone (the decision below readsguard). A backend that predates either argument ignores it and answers in one call.outcome='running'is a HANDLE, not a result. The commit re-scores the linked run and can run many minutes, so the call returns after ~100 s with afinalize_idwhile the finalize keeps running on the backend. Poll it — the same script every other long backend job uses:bash "${CLAUDE_PLUGIN_ROOT}/scripts/poll_job.sh" <finalize_id> # timeout: 600000Poll in the FOREGROUND, and never end the turn while the finalize is running: a headless
claude -psession exits when the turn ends and the result is lost with it. Exit 14 (the poll's budget is spent and the finalize is still running — the usual first read of a long commit) → re-invoke it at once, in the same turn; a stall NOTE on this poll is not a failure, keep polling. Exit 0 → callend_edit_sessiononce more with the same arguments: it returns the commit's result (a refused finalize re-runs its gates on the still-open session and refuses the same way). Exit 13 or 15 → the same one call: it finalizes the session anew, or returns the commit it already made (a backend restart loses the handle, not the commit); a second such exit on the same session → stop and report it. Exit 12 → wait with thewait.shrecipe it prints and readjob_status(<finalize_id>)until it isdoneorfailed, then the same one call. Exit 77 → the backend refused the bearer: report it, and make the same one call once it is fixed. Exit 69 → wait once (wait.sh 45 --quiet), re-invoke once, and a second 69 is the stop: run the unavailable stop (stop_message.py unavailable --done), then the same one call once it answers again. Exit 65 / 10 → the wrong-backend guard, the client pin or a client the backend refuses: report it, never re-poll. Never send a turn, open a new session or re-send edits while the finalize runs: the backend refuses the turn, and the session still holds the set.end_session_outcome.pyexits 4 onrunning.The regression guard re-scores the linked run on the draft and REPORTS on
guard; it never refuses or holds the commit. Each of its lists (dropped_verdicts,lost_reds,silenced_true_reds,unevaluated) carries{item, policy, turn, now, audit_ruling}.end_session_outcome.py(below) prints the plugin's decision (scripts/guard_decide.py); act on it alone, never telling the user:- Revert each policy in
silenced_true_reds(a red the audit ruled TRUE RED that the draft no longer fails): callrevert_edited_policieswith the printed arguments, write its result to$ART/revert_edited_policies.result.jsonand read it throughend_session_outcome.py(same command, that file) — it logs the revert's revision andpolicies_changed, so the revision every later re-score carries is one the loop log names. The revert copies the eval set under another id: record itsminted_idwithwrite_id_file.py mintedon that file (same command as above), then sync the mirror as after any commit. The backend kept the edit exactly as sent; the revert is your own follow-up edit, which it commits as a new revision, so a silenced audited TRUE RED never stays. Askippedpolicy: end any session open on the set and call it once more; still skipped, repair it in a new session. Reworking a reverted policy is a new edit round whose draft keeps each silenced unit red (keep_redin$ART/eval_loop.json). - Keep the rest. A move the audit ruled
FALSE_RED/OUT_OF_SCOPE, or a drop your own scope rows ruleOUT OF SCOPE(--scope-rows, below), is the intended narrowing; any other (variance, an unruled unit, anunevaluatedone) is an internal named risk the next audit reads. Never re-edit, revert or loop for one.
Every call also passes
edit_kinds=[{policy, kind, reason}], one per policy the session edited:narrowing(an exemption, a carve-out, a tighter scope),broadening(it now flags cells it passed) orintent_change(it grades another behaviour). A label rules what the agent did, so it outlives a narrowing; the other two retire the policy's labels (labels_retired).The backend runs its own commit gate here on every edited policy, through the same
eval.policy.*checks generation runs, each reported ongate_authority.findings. Anadvisoryone commits with the finding attached; dispatch it per${CLAUDE_PLUGIN_ROOT}/docs/gate-findings.mdand the false-RED rule in/generate-evalsStep 5. Repair a false-RED one in a turn BEFORE this call: once committed, the repair costs another session. Aninvariantone REFUSES: nothing is promoted,out/stays pre-edit, and the session stays OPEN. Writing the local file before this call meant a refused edit still landed inplurai_sim/policies_config.yaml. That does not change what scores — the backend set does, and a refused commit leaves it untouched — but it corrupts the mirror the operator READS, which is worse than useless: they would review a policy the backend explicitly rejected, believe it is live, and diagnose the next run against a set that does not exist.Read the result through the script. Write the MCP result to a file with the Write tool (the tool returns an object, not a stream — there is nothing to redirect), then:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh" source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh" # $PLURAI_PY: the writer reads a saved env's manifest python3 "${CLAUDE_PLUGIN_ROOT}/scripts/end_session_outcome.py" "$PLURAI_DIR/.end_session.json" \ --scope-rows "<the audited run dir>" # its red_cell_audit.json IN / OUT OF SCOPE rows; omit with no audit # 0 = the edits landed · 3 = refused / closed_unchanged / closed_failed / not_found · 2 = usage # 4 = outcome=running: poll the printed finalize_id (above), then call end_edit_session once more "$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/write_id_file.py" minted "$PLURAI_DIR/.end_session.json" # moves the eval set id to the result's minted_id and nothing else, in every copy: the env folder's .eval_set_id, its # manifest key and the root .eval_set_id; a null minted_id (refused, closed_unchanged, running, closed_failed) writes nothingNever write an id file another way: not with
printforechointo a file, not with the Write tool, not into one copy only. The writer is the one thing that keeps the copies in step, and CI refuses a branch whose copies disagree. When it exits 2, report itsERROR(write_id_file)line and stop; do not record the id by hand.The id the writer left is the eval set from here on: every later
<eval_set_id>below, the mirror sync, the re-score and the next session read it again throughread_id.py evals. Stage it with the mirror (stage-inputs.sh .eval_set_id, which stages the copies the writer moved with it) on a commit.It prints
outcome=first andreason=WHOLE, then each gate finding as afinding:line with the holding count, theguardreport and itsdecision:, on a commit theeval_revision=andpolicies_changed=(every policy whose fingerprint moved, from the backend — never your own account of the edit; both are logged), and withholds the promoted body (size only). Never pipe an MCP result throughhead/tail/cut: a refusal'sreasonis the LAST field, so truncation deletes the only signal that nothing was promoted. Then branch onoutcome(a backend too old to send it: a truthyreasonmeans refused):refusedwith aneval_edit.policies_unparseablefinding → the working draft is not a policies mapping. Nothing was promoted, the session is still open and the draft is kept (itsdraft_refserves it): repair it in another turn, then end again.refusedwith aneval.policy.*finding → an edited policy could never score; itssubjectnames it andremedysays why. Nothing was promoted and the session is still open: repair that policy in another turn, then end again. A backend without these findings refuses on judge polarity andcode_evalexecutability with only thereasontext: the branch below.refused(any other) → nothing was promoted and the session is STILL OPEN (session_still_open: true). Do not write the local file, and do not open a new session — this one holds the set. Tell the user what the gate objected to in plain product terms and fix it in another turn (Step 3), then end again. The guard is never a refusal.closed_unchanged→ the session closed having changed nothing (reason: 'no edits were made'). There is nothing to sync — say so rather than reporting an edit.committedbutpromoted_yamlnull → the commit SUCCEEDED. This is the ONLY shape Step 5.3 can produce:include_yamldefaults toFalseand the call above does not pass it, so the body is never inlined andpromoted_yaml_omitted_reasonis always the not-requested default — "promoted_yaml not inlined: it is served at policies_url; pass include_yaml=true to inline it under 46 KB. The commit happened and nothing is missing." It is not a size message and does not mean the set was too big; a size reason ("… is N KB and the MCP response inlines up to 46 KB") only ever appears when you DID passinclude_yaml=trueand cleared the cap. Either way the field is explaining a deliberate omission, never a failure — reading a null body as a refusal skips the mirror sync on an edit that DID land and leaves the operator diffing a stale file. Do not passinclude_yaml=trueto "check": the sync below fetches the same bytes straight to disk without spending them through your context. Proceed to it.committed→ sync the local mirror WITHOUT re-emitting ~30 KB of YAML through your own context: fetch the PROMOTED set over REST straight to disk —source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh" PLURAI_BIN="$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/resolve_plurai.py" --ask --require 'fetch policies')" || { [ $? -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 if [ -n "$PLURAI_BIN" ]; then EVAL_SET_ID="$(python3 "${CLAUDE_PLUGIN_ROOT}/scripts/read_id.py" evals)" || exit $? python3 "${CLAUDE_PLUGIN_ROOT}/scripts/sdk_call.py" "$PLURAI_BIN" fetch policies "$EVAL_SET_ID" --out "$PLURAI_DIR/policies_config.yaml"; echo "rc=$?" else echo "rc=no-runner" fi # 7 = the backend refused this plugin or its SDK: the update text is printed above; say it verbatim and alone, then stop (no MCP fallback) # 0 = promoted bytes written · 16 = the backend says DRAFT (a session is still open, # nothing promoted — the mirror was left untouched) · 65 / 77 / 69 = target not usable / credential / transport # no-runner = no plurai CLI in this repo: the mirror was not syncedThe command reads the policies-state response header and refuses to write a DRAFT over the mirror:
/eval-sets/{id}/policies.yamlserves whatever is on disk, which mid-session is the session's working copy — byte-identical to the promoted file, so nothing else could tell them apart. Onrc=16the session did not actually commit: go back and readoutcomeagain. Onrc=no-runnerthe edit DID land on the backend and only the local mirror is stale: say so in one line, with the install line the resolver's stderr gives.
- Revert each policy in
Read the commit's own verdict on the PROMOTED bytes.
end_edit_sessionre-runs the whole gate on the reconciled text it is about to promote — the same bytes that will score — and a failure is anoutcome='refused'withreasonnaming the offenders and the session left OPEN for repair. That is the check; there is nothing local to re-derive from the file you just synced. If a defect is nevertheless LIVE on the backend, open a NEW session (edit_session_start) and fix it there; never edit the local mirror, which is not what scores (see the ownership rule at the top).A
notice.actionablefinding in the result'sgate_authority.findings→ read it before you report (warningsis empty on the wire). These are notices about a commit that DID land, so they never change the steps above. A finding whoseevidence.familyispromote_reconciledmeans the promoted text was reconciled off DISK rather than taken from the session's in-memory draft — the signature of a turn whose MCP call aborted while the turn kept running (Step 3a). Those edits are real, but they are the ones DISK held: diff the synced mirror against what you asked for before you summarize, and say plainly if anything you requested is not in it. For the exact delta, diff the file you just synced against the baseline Step 2 copied aside before the first turn —diff -u "$PLURAI_DIR/.policies_config.baseline.yaml" "$PLURAI_DIR/policies_config.yaml". When that file is ABSENT there is no baseline for this session (Step 2 deletes any earlier one before copying, so an absent file can never be a previous session's text posing as this one's): say the exact delta is unavailable rather than diffing whatever is on disk. When Step 5.3 did not printrc=0, the mirror is still the pre-edit file, so the diff is empty and says nothing about the edit: say the exact delta is unavailable. The per-turnpolicy_patches[].diffblocks you already read are the other uncapped-enough record.GET /eval-sets/{id}/sessions/{session_id}/diffis NOT available here. That route resolves an OPEN session and 404s the momentend_edit_sessionreturns — which Step 5 has already called — withno OPEN edit session '<id>' on eval set '<id>'. It is usable only mid-session (Step 3); afterwards there is no session left to diff.
After a committed outcome, bring the local artifacts up to date: it rebuilds suite.json and the
renders from the synced policies and prints which verdicts the edit made stale.
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh"
"$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/artifact_deps.py" apply "$WORKDIR" --refresh
When qualification-run artifacts exist, verify the promoted edit's BEHAVIOUR with the backend's
score_runtool — the run dir is the one$WORKDIR/.last_runpoints at (published byplurai-run-simulationon the run that finalised rows — no skill writes it). Upload the run ONCE with the SDK CLI, score by reference: (The run upload is pre-authorized by the invocation — never ask consent for it. It ships the run's transcripts, tool events and world state to the backend; the harness's tool-approval prompt is the chokepoint, the anonymization posture already governs what leaves, and disclosure is a statement in the report, never a question.)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 "$(cat "$WORKDIR/.last_run")" --workspace-root "$PLURAI_DIR"— the preflight is part of the line: it resolves$WORKDIR/$PLURAI_DIRin THIS call (the shell resets between them, and an unset one reads/.last_run) and stops an upload aimed at the wrong backend. The CLI owns the whole archive contract (selects only complete scenario folders, EXCLUDESerror.jsonfailures, stages a copy so an anonymization posture never rewrites your only record, computes the checksum) and prints the lease manifest JSON; aWARNING (disclosure: home_named)line it prints comes before any byte leaves: relay it to the operator, naming the files it lists (it does not stop the upload). Feed that manifest toupload_run_artifacts_start(manifest=...), then re-score every scenario and every trial in ONE batch (the block below) — never hand-roll the tar (a hand-built archive skips the error.json exclusion and the copy-don't-mutate guard; observed live: the operator had to reverse-engineer all of it) — no 55-68 KB of artifact dicts through the wire per call. (Inline dicts are the fallback for a backend predatingrun_upload_id— NOT for a missingingest-run. If the resolver rejects the SDK, upgrade it: the inline path costs ~200 KB for three scenarios and does not scale to a real run, so an old CLI must be fixed, not worked around. When the upgrade is genuinely out of reach in this session — no install route, a pinned environment you may not change — fall back to inline for THIS round and say so: passtranscript/final_world_state/tool_eventsread from$OUT/<scenario>/verbatim, one call per scenario. Never trim or re-assemble them to save payload —score_run's own contract says why. Record the round's provenance as verified inline and put the blocked upgrade in the landing triage.) And if you cannot verify the edit at all — no run artifacts, both paths refused — the edit is UNVERIFIED, which is a provenance fact, not a reason to change the eval: keep the edit, name it as unverified in the summary, and carry it to landing triage. Deleting a policy because its fix could not be verified is never the move — it converts an unknown into a silent coverage hole, which is the one outcome no later pass can detect. This must come AFTERend_edit_sessionsucceeds:score_runscores the BACKEND set, and only the successful commit makes the backend set the edited set — re-scoring before it would verify the pre-edit policies and report your fix changed nothing.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/rescore_run.py" --run-dir "$(cat "$WORKDIR/.last_run")" \ --eval-set-id "$EVAL_SET_ID" --scenario-set-id <id> --run-upload-id <id> --results-dir "$ART/rescore_results"It submits every item's
score_runat once, eachrescore='changed'— never'all': a policy the commit did not change carries forward at zero judge calls — with the item's current cells asbaseline_cells, and the backend bounds how many it scores at a time. Run it in the background when it may outlast one Bash call;--resumere-reads the results an interrupted invocation finished. Eachsummary=falseresult is applied to the item's verdicts throughapply_rescore.py(the SDK writer records it in their history); a refused or failed item is named in the printed summary. Readchanged: the cells this session meant to flip flipped, and nothing else regressed. This costs judge tokens only — no agent re-run — and is the difference between "the YAML is valid" (the in-turn gate) and "the fix actually judges the way we intended". Honournot_scored: turn_based policies now RE-score too (re-judged per transcript prefix on current backends), sonot_scorednames only guard-skips; on runs/backends predating per-turn step-info persistence a turn_based verdict may differ slightly from live.
Then check what is still stale:
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh"
"$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/artifact_deps.py" check "$WORKDIR" --json
- Print a summary:
- Path written:
plurai_sim/policies_config.yaml - Total turns: from the
EndEditSessionResult.turn_count - Final policies:
EndEditSessionResult.final_policy_names - Re-score outcome when the verification in the previous item ran: which cells flipped,
which policies
not_scored(never call it "step 4" — this document's## Step 4heading is about the retired local_verification_status field, a different thing) - Every CLAIMED closure of a false red/green with its reproduction (the closure rule in Step 3b) — and where the cells did not flip, or the re-score above did not run, named as an open claim, not a fix
- What the check still lists as stale, in plain words: a re-run updates
rerunitems, a re-scorerescoreitems
- Path written:
Last step — id files to commit
Run this once, after the last edit above and before the hand-off. It lists, from git and never from memory, each suite id file
(a .scenario_set_id / .eval_set_id / .env_id marker, or an id key of an env folder's plurai.env.yaml) that differs from HEAD.
CI runs the ids that are committed, so a change pushed without its id files runs the old suite and shows no sign of the edit.
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-workdir.sh"
source "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-python.sh"
"$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/id_changes.py" list --workdir "$WORKDIR"
Put each ID-FILE <path>: <old> -> <new> line in the hand-off (the file, the id it held at HEAD, the id now) and tell the user to
commit those files together with the change. ID-FILES clean and ID-FILES unknown (not a git work tree): say nothing about it.
Last step — pull the grounding mirror
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.
Overview page — after this hand-off's Markdown, never in its place.
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 edit-evals --flowdir "$FLOWDIR"
It prints one JSON line. When flow_continues is true, leave out this hand-off's "Next" line and any offer to
run another command, and end the turn on this hand-off: the flow continues by itself. In limited mode (Step 0 printed
ready, limited) it continues through the flow-window.sh handoff line Step 0 names instead: run it right after
this hand-off and do what it prints in the same turn. When run_end is true this is the run's one publish: when
retry is true, repair it once the way the next sentence repairs a hand-off (fill_refused or garbled: nothing to
rewrite) and fill again; when retry is false, never fill again, whatever skip says. Otherwise, when skip is
internal_text, rewrite each line internal_text names the same way, then fill again; when skip is numbers,
a surface disagrees with the run summary: re-render it (render_run_report.py, then release_verdict.py render) and
fill again once; still numbers is a failure hand-off, never a page with those numbers. When publish is false,
add nothing and say nothing about it, except that when say lists lines, end the hand-off with them, verbatim, and
never run done. Otherwise publish the file at report with the Artifact tool, passing report as file_path
character for character (never respelled, never ~, never relative), with icon: "report", and never
Read it. When page is not null, pass it as url; if that publish is refused because this conversation has
not read the page, read it once (do not open the file the read saves) and publish again. If the page belongs to
another account or is gone, run
"$PLURAI_PY" "${CLAUDE_PLUGIN_ROOT}/scripts/publish_report.py" forget "$WORKDIR" and publish once without
url. Never pass force. Then:
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" done "$WORKDIR" --step edit-evals --flowdir "$FLOWDIR" --url "<the URL the Artifact tool returned, or - when the publish failed or is unavailable>"
End the hand-off with the line(s) it prints, verbatim. Never narrate the fill, the publish, a refusal or a fallback.
<!-- END report-page --> <!-- BEGIN error-posture: generated from ${CLAUDE_PLUGIN_ROOT}/docs/error-posture.md; edit there -->Error posture — findings are evidence, internal issues are yours to handle
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, runbash "${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. Whererequest_user_input_asyncis 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 callrequest_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. Withworkspace.run_driver: headless, sanction and ask the same way: the guard replies with the gate's default or files arun_driver_input_requiredfinding 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
securityfinding, an overrule outcome ofrefused): 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 whatpython3 "${CLAUDE_PLUGIN_ROOT}/scripts/stop_message.py" contact --done "<outcome>"prints (each--donean 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 typedcode: capacity_exhausted, a job envelope whosecapacityis set (any status), anunavailableblock or a job envelope withterminal_reason: unavailableinstead takesstop_message.py refusal --refusal <its JSON>; never quote the provider's own limit text. A typed block wins over the fault rule and overterminal_reason: a failed job withterminal_reason: internal_errorthat holds anunavailableblock is the unavailable stop, never the contact hand-off.Cost figures and backend internals stay internal.
total_cost_usdand 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 publichttps://<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-setupskill; a project.envfile 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 theharness-setupskill 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: <name>"), 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:
- A transport failure with no envelope (connection reset, client timeout, a reply cut in
transit, a bare
502/503/504). Wait first: runbash "${CLAUDE_PLUGIN_ROOT}/scripts/wait.sh" 45 --quietas one foreground shell call, silently, and never narrate it. Then re-call a read (job_status, a fetch) or a*_startonce, 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 whatpython3 "${CLAUDE_PLUGIN_ROOT}/scripts/stop_message.py" unavailable --done "<outcome>"prints, verbatim and alone, never the contact hand-off. Apoll_job.shthat exits 69 is this transport failure: run the wait above, re-invoke it once, and a second 69 is the same stop. terminal_reason: interruptedfrom a restart (not a cancel you or the user asked for), orterminal_reason: watchdog(the backend stopped a job that made no progress).- A failure this skill's error table marks as retried once.
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.
What NOT to do
- Do not treat a
REPAIR REQUIREDturn as advisory. The local verification gate this line used to name is RETIRED (Step 3b item 3, Step 5.2): the backend now runs those lints in-turn and says so on the turn itself. Schema drift is still the risk — what changed is who catches it, not whether it matters. A turn that comes backREPAIR REQUIREDis not a finished edit. An advisory finding never arrives as that line: it rides a turn that was not downgraded, ongate_authority.findings, and you decide on it per${CLAUDE_PLUGIN_ROOT}/docs/gate-findings.md. - Do not auto-accept patches without showing them to the user. The patch summary is the user's only chance to catch a backend misinterpretation of their request.
- Do not modify
policies_config.yamldirectly. Every edit goes through the backend session — that's how the IP-laden recipes stay consistently applied. - Do not show the user a raw error from
interact_edit_session. Retry a transient error per the retry rule (Error posture); otherwise classify per the error posture — a user-actionable input problem becomes a plain-terms ask, anything else is the fix this skill's table names, and when nothing there fixes it, or the re-run after the fix fails again, run the contact hand-off (stop_message.py contact --done). Never paste the raw error text. - Do not invent a
session_idif the backend's response didn't carry one. Always echo the value the backend returned. - Do not write
plurai_sim/policies_config.yamluntilend_edit_sessionhas SUCCEEDED — the commit gate can refuse, and a refused edit must not reach the mirror the operator reviews (it would show as live an edit the backend rejected). The file is not what scores; see the ownership rule at the top. Succeeded meansoutcome: 'committed'— do not read a nullpromoted_yamlas a refusal and skip the sync (Step 5). - Never pipe an MCP result through
head,tailorcut. A refusal'sreasonis the LAST field on the wire; truncation deletes the only signal that nothing was promoted and the session is still open. Write the result to a file and read it withscripts/end_session_outcome.py. - Do not call
end_edit_sessionwhile a turn is still asking for repair. There is no local fetch-and-verify step to do first — that was Step 4, and it is retired — but ending on an unrepaired turn throws away the conversation that could fix it. Ending closes the SESSION, not the artifact: the promoted file stays served at/eval-sets/{id}/policies.yamlforever (that is exactly what step 5.4 verifies). What is gone is the CONVERSATION — the SDK subprocess and its context — so a defect found afterwards costs a new session that has to be told everything again.