Red-team Missions, Evaluation Query & Export, LoRA Training, and Refusal Suites
Overview
This release adds red-team missions to ztd eval. A mission sends Nemesis, the Tribunal's calibrated adversary, against one attack-surface scenario on one target model. Each probe carries an attacker-authored payload that fills the scenario's attack slot, runs with fresh context, and is graded normally. A user_prompt probe on a scenario without workspace files or seeded turns is a conversation of up to 10 turns with a local Goose agent launched as ztd mcp agent run launches it, so the attacker can build on the target's replies. A break is confirmed when fresh-context replays reproduce it, and the mission stops at that point or when its probe budget is spent. Missions never publish: their governance activity is withheld from the public feed.
It also adds ztd eval query for local querying, aggregation, and curated dataset export over vault-sealed traces, ztd eval models train for PEFT LoRA adapter training, ztd eval export and ztd eval import for transfer-key encrypted evaluation bundles, six vendored public refusal benchmark suites alongside full-suite@1.0.0, an independent local Evaluation Explorer listener (--eval-explorer / --public-spectator), and fixes for managed llama.cpp router startup on Windows, cold llama.cpp model inventory timeouts, CLI recovery proofs, and pre-roster run decoding.
Added
ztd eval missions create,start,show, andlistfreeze, run, and report red-team missions.missions show --breakprints the confirmed break report with the verbatim payload, its containment, and the evidence commands that reproduce its verification.- Suite scenarios may declare
attack_surface, with akindofuser_prompt,workspace_file, orinline_context, alabelfor workspace files and inline entries, and anobjectivefor the attacker. A scenario with an attack surface runs only as a mission. - The built-in suite
redteam-missions@1.0.0providesredteam-indirect-injection,redteam-secret-extraction, andredteam-forged-approval. - The break oracle classifies each probe as
disclosure,forbidden_attempt, orjudged_violation, and reports containment asuncontained(a ztd platform finding) orcontained. --confirmand--confirm-minset fresh-context replays and the number that must reproduce a breach. A probe that falls short is flaky, and the hunt continues.ztd eval runs verifychecks mission runs: each recorded payload is re-applied, every probe matches its signed attacker inference output, the attacker receipt verifies against the Inference runtime anchors pinned in the subject trace, and each confirmation replays an earlier probe's exact payload and digest.- Nemesis carries a mission rendering (
MissionPurpose,MissionSystemPrompt(), andMissionDigest()). A mission spec freezes its persona ID, version, and digest. - Conversation attempts for
user_promptmissions whose scenario supplies no workspace files and no seeded turns, which includes every imported mission template andredteam-secret-extraction.missions createandimporttake--max-turns(default and maximum 10) and--agent(goose). Each attempt is a new Goose session with the ztd stdio bridge as its only governed MCP server, running as the agent's owner-approved application identity, whichmissions startenrolls when it is missing. Nemesis writes each later user turn from the conversation so far, the pinned judge rules after every turn, and the attempt stops at the first breaching turn. A confirmation replays the probe's user turns verbatim asscripted_turnsin a new session. The target model runs on Ollama or llama.cpp.missions start --ollama-endpoint(defaultZTD_OLLAMA_ENDPOINT) sets the Ollama endpoint for an Ollama target. A llama.cpp target requiresmissions start --llamacpp-endpoint http://host:port, an OpenAI-compatible llama-server that Goose calls through itsopenaiprovider, with every inheritedOPENAI_variable removed.missions show --breakprints the conversation. In a conversation, a bridge tool call the agent reports is evidence and can be aforbidden_attempt, never an execution or a disclosure, because its receipt stays in the executing runtime's store. - The agent trace carries an optional
sessionfield holding a conversation attempt's turns: each user message, the attacker call that wrote it, the reply, and the judge's verdicts on the conversation up to that turn.ztd eval runs verifychecks each turn against the signed attacker output, each replay against its scripted turns, and each turn's verdicts against their receipts. - Mission templates (
ztd eval missions templateandimport) accept an optional# Toolssection that declares simulated tools. The attacker and the subject see them as no-op tools whose calls are recorded and never executed. ztd eval missions import --system <file>supplies the target's system instructions from a separate file, stored as the scenario'sinput.system_instructions. The target holds them as its system prompt and the judge reads them; the attacker does not. A template's# Overviewdescribes the scenario and is never shown to the target.evaluation_withheldon thecommon.v1GovernanceEnvelope(field 30), theoperator.v1InferenceDispatchRequest(field 39), andmodels.OperatorCommandmarks evaluation activity that never reaches the public feed.ztd eval models train <model>trains a LoRA adapter for anollamaorllamacppregistry model on the conversations of one or moreztd eval query --output-dirbundles (--data, repeatable). It writes the seeded blend totrain.jsonl, records the base model digest, source digests, and hyperparameters intraining.json, and runsscripts/lora.pythrough uv, which trains on assistant tokens only and writes a PEFT adapter.--dry-runwrites the training set and prints the trainer command.ztd eval queryruns local queries, statistical aggregations (--group-by), multi-field--sort, deduplication (--dedup), stratified balancing (--stratify), and curated dataset export (--output-dirwritingconversations.jsonl,manifest.jsonl,manifest.csv, andsummary.json) over vault-sealed runs without contacting the Gateway. It provides built-in presets (security-violations,failures,thinking-traces),--format(table,summary,csv,jsonl,conversations), and a sealed derived per-run cache at.ztd/data/eval/runs/<run-id>/query-index.json(query_index.go).ztd eval query --strip-system-instructionsomits each exported conversation's leading system message, which holds the<system_instructions>and<available_tools>blocks, on--format conversationsand in the--output-dirbundle. The conversation then opens on the user prompt, and record selection does not change.ztd eval query --alt-system <file>replaces the recorded system instructions in each conversation's<system_instructions>block with the file's contents, on--format conversationsand in the--output-dirbundle. The file holds bare instructions or one<system_instructions>block.<available_tools>still lists the tools each trace offered, record selection does not change, and the flag cannot be combined with--strip-system-instructions.--inference-llamacpp-models-max <int>onztd gw startandztd operator startpassesllama-server --models-maxto the managed llama.cpp router (--inference-llamacpp-managedrequired). Models loaded side by side share the device, so--fitcould shrink a later-loaded model's context window toward 4096;1gives each model the whole device.0or unset keeps the llama-server default of 4.- Six checked-in refusal suites at version
1.0.0ineval/suites/:harmbench-standard(200 prompts to decline),harmbench-contextual(100),jailbreakbench(100 to decline and 100 safe prompts to answer),strongreject(313),strongreject-small(60), andxstest(200 to decline and 250 safe prompts to answer). Prompt text is imported unchanged, apart from line endings, from HarmBench, JailbreakBench, StrongREJECT, and XSTest. Run them only withztd eval runs start --publish=false, never throughztd eval rollout, because published results include model replies. - The built-in suite
full-suite@1.0.0holds every single-roster scenario in 50 scenarios:default-suite@1.39.0, the three runbook injection variants fromprompt-injection-resilience, and the threeinvestigationsscenarios. It excludesdevops-fleet, which needs a multi-Operator roster, and the red-team mission targets.default-suite@1.39.0is unchanged. ztd eval export [snapshot-or-backup-dir]packages evaluation backup snapshots into one bundle another Gateway can import, which a snapshot alone cannot do because its key chain opens only with the source host's key store. Every file is opened with its snapshot's key chain, deflated, and sealed with AES-256-GCM under a fresh bundle key, which is wrapped under a fresh 256-bit transfer key. The transfer key is shown once on the terminal in recovery key form, or written to a new owner-only--key-file, and is never stored in the bundle. The bundle defaults toeval/exports/eval-export-<timestamp>.zip;--outputnames another file or directory outside.ztd/.ztd eval import <bundle>reads the transfer key from--key-fileor standard input, authenticates the bundle, and writes its evidence sealed under the local runtime vault. A wrong key (ErrEvaluationExportKeyInvalid) or an edited bundle (ErrEvaluationExportIntegrity) writes nothing.--overwriteand--verifywork as they do forztd eval restore.ztd eval export,ztd eval import, andztd eval restorereport progress on standard error: files and bytes done, rate, and time left, at most every two seconds. Export seals records on one worker per CPU.- The upstream data is vendored in
eval/benchmarks/at pinned revisions, with each source's license (MIT for HarmBench, JailbreakBench, and StrongREJECT; CC BY 4.0 for XSTest) and per-file SHA-256 digests ineval/benchmarks/sources.json.make benchmark-suites-generatewrites the suites from that data, andmake benchmark-suites-checkverifies the committed files match. - The Evaluation Explorer's Datasets page (
/datasets) sellsztd eval exportbundles through Stripe Payment Links. After checkout Stripe returns the buyer to/datasets/claim, where a Cloudflare Worker (evaluation-explorer/worker/) reads the Checkout Session from Stripe and, for a complete, paid session from a catalog Payment Link, returns the bundle's transfer key and a download URL. The download repeats the check and streams the bundle from R2 with byte-range resume. The catalog (evaluation-explorer/src/content/datasets.ts) holds only public bundle facts; transfer keys stay in a Worker secret.evaluation-explorer/scripts/stripe-dataset-link.shcreates a bundle's Stripe product, price, and Payment Link. The Gateway-embedded Explorer serves the pages but not the claim API.
Changed
ztd eval query --helplists every accepted value for each closed-set flag in a "Values by flag" section: presets, formats, columns, record and grouped sort fields, group-by and stratify dimensions, categories, roles, lifecycles, verdicts, outcomes, terminal classifications, breach types, and grade statuses. The lists come from the proto enums and evaluation constants that records carry, so they track new values. The--categoryusage no longer suggestsOPERATIONAL, which is not a category. An unknown--breach,--preset, or grouped--sortvalue now names the valid set in its error.- The Tribunal deliberator records a vote for an envelope carrying
evaluation_withheldon the Gateway audit chain but never publishes it. This is an exception to the public vote publication rule inINV-CON-VOTE-12. - Campaign freeze refuses a campaign whose models (registry, mission attacker, and judge) name both
ollamaandllamacppwithErrInferenceProviderClassesUnservable, naming each model, its role, and its class.campaigns create,missions create,runs start, and run execution apply the check, and the failure class isinvalid_input. When no active Inference Operator serves a campaign's classes, the error names what each active candidate serves. missions startrefuses an endpoint flag the mission never uses withErrEvaluationMissionEndpointUnused:--llamacpp-endpointfor an Ollama target,--ollama-endpointgiven on the command line for a llama.cpp target, and either flag for a single-turn mission.ztd eval queryconversations carry the system instructions and tool list in a leadingsystemmessage (<system_instructions>, then<available_tools>) instead of at the top of the first user message, so user turns hold only user text.ValidateCuratedConversationaccepts one optional non-emptysystemmessage before the alternating user and assistant turns and rejects asystemmessage anywhere else. Bundles exported by earlier releases still validate forztd eval models train. The signal score's turn penalty counts assistant turns, so the system message does not change it.- Nemesis's authoring and vote renderings and digests are unchanged. The mission rendering is digested separately, so campaigns and Tribunal bindings frozen before this release remain valid.
- The evaluation explorer reads its feed from the Gateway's explorer listener (
127.0.0.1:5173), which serves the explorer and the feed's anonymous read routes, so the public mirror is optional for it.ztd gw start --eval-explorer(defaulttrue) controls the local evaluation feed and its explorer listener, and--eval-explorer=falsestarts no feed listener;--public-spectator(defaulttrue) controls the anonymous public read listener (127.0.0.1:8082) and bucket publishing, and--public-spectator=falsekeeps the feed local to the explorer listener, with no public read listener and no bucket publishing. CLI feed reads on a local Gateway (eval runs publishprobes,publicstatus and restore,eval rollout run --mirror-bootstrap-url, and--mirror-origindefaults) use the explorer listener, and a non-loopback Gateway endpoint keeps its:8082public mirror default. - Every built-in suite is a membership list over one scenario registry, and
ztd eval suites listand campaign freeze read the same table.consensus-screen@1.15.0,consensus-evidence@1.15.0,consensus-safety@1.13.0, andprompt-injection-resilience@1.4.0are now built in, with unchanged content, versions, and catalog digests, and their files are removed fromeval/suites/, which keeps only the generated benchmark suites. They need noztd eval suites create, and their IDs are reserved. A stored copy registered under one of these IDs is superseded:suites listskips it and every lookup resolves the built-in, so the file under.ztd/data/eval/suites/can be deleted.ztd eval suites --helplists every built-in suite. - The Explorer's Datasets page replaces its Sponsors page.
/sponsorsredirects to/datasets, and the header, navigation drawer, and footer link Datasets.
Fixed
- A llama-server error event inside an accepted stream, which it sends when its own tool-call parser rejects the model's output, is now
provider_stream_error(ErrInferenceProviderStreamError), asINV-EVAL-CAMP-34requires and the other backends already do. It was reported asgeneration_failed, so a model that wrote a malformed tool call counted toward the rollout's consecutive-failure stop and could end its run with assignments still queued. ztd public restore --queuenow skips a run sealed under an earlier agent trace schema (ErrEvidenceSchemaRetired) and counts it asretired(retired_run_idsin--json), without setting the failure exit. It was reported asfailed, and the command exited non-zero. With--force,public restore(--queueor--run-id) republishes such a run instead: each retired trace is published as its sealed bytes once its evidence digest matches, without validating it againstagent-trace.v14. A retired trace whose fieldsv14reshaped is also classified asErrEvidenceSchemaRetired; it used to fail as a plain decode error.- A model the provider lists but cannot load, such as a GGUF the llama.cpp build cannot read, now fails with its own class,
model_load_failed(ErrInferenceModelLoadFailed,RECEIPT_FAILURE_CODE_MODEL_LOAD_FAILED,INFERENCE_DISPATCH_FAILURE_CODE_MODEL_LOAD_FAILED), on llama.cpp and Ollama. It was reported asgeneration_failed. - The rollout's stop after three consecutive provider failures now counts
model_load_failedwithgeneration_failed, and counts a traceless executor failure, such as a tool-calling probe that failed before the first agent turn, by the class in its categorical reason. A traceless failure used to reset the count, so a model that could not load ran far past the limit. - A run record written before the harness roster, which carries
ModelCampaignBindingfield 7data_operator_session_id, now loads unchanged.ztd eval runs list,runs show, evaluation backups, and theztd public statusfeed drift check read it as stored. Inv1.11.0andv1.11.1such a record failed withErrEvaluationRunRetiredBindingField, which failed every run listing in the runtime root. ztd eval querynow finds reasoning that a model wrote inside its reply text, as an inline<think>block, a block the chat template opened (a leading…</think>), or an unterminated<think>, as well as the provider's thinking field.--has-thinking,thinking_chars, and the summary's thinking coverage counted only the thinking field, so most reasoning traces were missed. Exported conversations move that reasoning into the turn's single leading<think>block and escape stray tags as[think]/[/think]. A failed turn's reasoning is not counted.has_thinkingmeans at least 80 reasoning characters under--preset security-violationsand at least one otherwise, with or without--clean-conversation; the clean path used to apply 80 to every query.ztd eval queryconversations now follow the agent trace's own conversation order (AgentTrace.Conversation). Held context messages come first, then each input message under its own role, then the scored turns. Consecutive user messages merge. An answered clarification continues the conversation. A fan-out tool call renders as one call whose response holds every target's result. A roster join adds its roster update. The conversation stops at the first failed turn. InputASSISTANTturns, held context, and clarifications were dropped, and a trace that failed mid-run could export a later turn.--strip-system-instructionsalso accepts system instructions that only the held context carries.ValidateCuratedConversationrejects a stray<think>or</think>tag, more than one think block in a turn, and a turn with reasoning but no reply.- The
--output-dirmanifest (manifest.jsonl,manifest.csv) records each row's 1-basedconversation_lineinconversations.jsonl; it is empty for a row with no conversation. A row'sthinking_charsis the exported conversation's count when it has one. ztd eval backupnow skips aRuntimeFileServiceatomic-write temp file (.ztd-tmp-*) left by an interrupted write. Such a file failed the backup andztd eval backup --compare, because it is empty or torn ciphertext the runtime vault cannot open.- The Gateway now waits the provider request deadline (
dispatch.RequestDeadline), the same wait the CLI already allowed, for anOLLAMA_MODEL_INVENTORYresult instead of the 30-second default. A cold llama.cpp inventory hashes every GGUF under the model root before it answers, soztd eval models freeze --provider llamacppreturned 504 while the Operator was still hashing. - CLI recovery (
ztd loginorztd auth enroll useron a host with no local identity, against a bootstrapped Gateway) now completes after approval. The CLI signed the raw request ID, but the Gateway verifies a signature over its SHA-256 digest, soPOST /api/v1/auth/cli/recovery/completealways returned 401 (ErrCLIRecoveryProofInvalid). Both sides now take the digest fromcertutil.CLIRecoveryProofDigest. - The managed llama.cpp router (
--inference-llamacpp-managed) now starts on Windows. The Operator withheld every user-profile variable from the router, so allama-serverrouter that resolves its Hugging Face cache at startup exited withFailed to determine HF cache directorywithin a second of every restart. Every inference, andztd eval models freeze, failed withErrInferenceBackendUnavailable, and the exit was logged asbad_models_dir. The router's environment now pinsLLAMA_CACHEand its temporary directory (TMPandTEMPon Windows,TMPDIRelsewhere) to private directories under its scratch directory, recreated before every spawn, so the router no longer depends onHOME,USERPROFILE, orLOCALAPPDATAon any OS and never lists a host Hugging Face cache. A router that still cannot resolve or create such a directory is logged withexit_causeenvironment.
Compatibility
v1.11.2 is backwards-compatible with v1.11.1 across CLI, wire, and evidence contracts (INV-REL-VER-10). The protocol additions are additive: the evaluation_withheld fields default to false, the ztd.eval.v1 messages for attack surfaces, mission specs, and mission attacks are new, and RECEIPT_FAILURE_CODE_MODEL_LOAD_FAILED (29) and INFERENCE_DISPATCH_FAILURE_CODE_MODEL_LOAD_FAILED (52) are new enum values. Agent traces remain agent-trace.v14, with an additive session field on conversation mission attempts. Existing envelopes, dispatches, campaigns, and sealed traces read unchanged. ModelCampaignBinding field 7 data_operator_session_id, reserved in v1.11.0, is declared again with its original name and number so pre-roster run records decode; new runs leave it empty. ztd eval runs repair no longer rewrites run records, so its --json output drops binding_rewritten, and ErrEvaluationRunRetiredBindingField is removed.
Missions require the Gateway and the Operators of this release. A mission spec is refused by any binary whose Nemesis mission rendering digests differently (ErrPersonaDigestMismatch), so create a new mission after upgrading rather than resuming one created by another binary. A conversation mission needs goose on PATH. The target model's calls go from Goose to Ollama directly and are not governed inferences; the agent's tool calls through the ztd bridge are governed under L1–L5.