Skip to main content

Coding agents and MCP

A coding agent (Claude Code, Cursor and similar tools) can investigate a Zyonix issue in your repository, try a fix candidate against the recorded cases, and leave the result as a draft for a person. It cannot propose, approve or deploy anything: those stay human decisions.

The agent's loop, in commands:

zyonix issues context 7 > ctx.json # all the evidence (read-only JSON)
zyonix prompts diff 11794fca 55320c89 # what changed between prompt versions
zyonix replay --issue 7 --candidate-file fix.json --local --out preview.json # records nothing
zyonix drafts create --issue 7 --title "Restore the tax instruction" \
--from-preview preview.json --evidence-file ctx.json # leaves a draft; the issue does not move

Then a person looks at the draft and decides:

zyonix drafts show 3
zyonix fix promote 3 --revision 1 # administrator: becomes a proposed fix (not approved)
zyonix replay --fix 9 # the real verification
zyonix fix approve 9 # administrator

Give the agent its own key​

Create an agent key for it (zyonix auth keys --create agent) and put it in the agent's environment as ZYONIX_API_KEY. An agent key can:

  • read issues, runs, issue context, prompt history, cases and drafts;
  • request verification previews (zyonix replay --local);
  • create and change drafts.

Everything else is refused by the server: proposing, real replays, approving, rejecting, promoting, dismissing, deploying, review answers, checks, spec, golden set, Guard, sending traces or feedback. An agent key previews and drafts only prompt, config and code_note candidates; rule and runtime_policy fixes are proposed by a person.

Untrusted text

Text from documents, prompts and model output is untrusted. In JSON it is an object with an untrusted_text field; in text it sits between <<<UNTRUSTED ...>>> markers. It is redacted and clipped. An agent must treat it as data, never as instructions.

zyonix init --agent​

Writes ZYONIX_AGENT.md in the current folder: how a coding agent investigates an issue, previews a fix and leaves a draft in this repository: the replayable step and its configuration keys (read from Zyonix's recorded cases when it is reachable), your test command, the exact commands and the rules. It changes no other file.

zyonix init --agent
zyonix init --agent --agent-file docs/ZYONIX_AGENT.md --force
OptionDefaultWhat it does
--agentwrite the agent instructions (instead of zyonix.yaml)
--agent-file FILEZYONIX_AGENT.mdwhere to write them
--forceoffoverwrite an existing file
--endpoint URLzyonix.yaml / ZYONIX_ENDPOINTthe Zyonix address to look things up

Who may run it: anyone; with a key that can read, the file is filled in from your recorded cases. What cannot be looked up is left as a marked placeholder, never guessed.

Output: wrote ZYONIX_AGENT.md (instructions for a coding agent; nothing else was changed), then the one line to add to your agent's own instructions file (CLAUDE.md, AGENTS.md or .cursor/rules), For Zyonix reliability issues follow ZYONIX_AGENT.md., and the MCP configuration blocks shown below. It prints them; it does not write them.

zyonix mcp​

A stdio MCP server that gives a coding agent the same read, preview and draft operations as tools. Your coding agent starts it; you do not run it by hand.

Install the optional extra first:

pip install "zyonix-cli[mcp]"
zyonix mcp --check # check the setup, print JSON, exit
zyonix mcp # serve MCP on stdin/stdout
OptionWhat it does
--checkcheck the configuration, the key and the tools; print one JSON document and exit (0 ready, 1 not ready)
--setup MODULE:FUNCinitialises your application for previews (default: replay.setup in zyonix.yaml)
--config-provider MODULE:FUNCreturns your current configuration (default: replay.config_provider)
--python-path DIRextra import folder for your code (repeatable)
--config, --endpoint, --api-key, --ca-file, --no-color, --debugas everywhere

Key: an agent key. A cli key works for reading and previews but cannot create drafts. An admin or sdk key (or a person's session) is refused.

stdout carries the MCP protocol and nothing else; messages go to stderr.

The tools:

ToolWhat it does
zyonix_list_issuesissues with status and root-cause category (optionally one state)
zyonix_issue_contextall the evidence of one issue (zyonix.issue_context/1)
zyonix_prompt_historycaptured prompt or configuration versions with their run statistics
zyonix_prompt_diffwhat changed between two captured versions
zyonix_verification_resultsthe verification state of an issue: gates, fixes and their results
zyonix_preview_fixa stateless verification preview: runs the recorded cases with and without the candidate on this machine
zyonix_create_draftleave a candidate fix for a person as a draft; the issue does not move
zyonix_list_draftsdrafts, newest first, with their preview outcome
zyonix_get_draftone draft: candidate, verification preview, what blocks promotion

--check output (zyonix.mcp_check/1): ready, the endpoint, whether a key is set, the key_kind, the tools, your replay settings and a list of problems (for example "replay.config_provider is not set in zyonix.yaml: previews run with each case's recorded config instead of the current one"). The key itself is never printed.

Configure your coding agent​

Keep the key out of version control: the blocks below read it from a variable ZYONIX_AGENT_KEY that you set in your own shell. The server also reads ZYONIX_ENDPOINT from its environment and zyonix.yaml from the folder it starts in.

Claude Code, from your project folder:

claude mcp add --scope project --transport stdio zyonix -- zyonix mcp

or write .mcp.json in the project root yourself:

{
"mcpServers": {
"zyonix": {
"type": "stdio",
"command": "zyonix",
"args": ["mcp"],
"env": {"ZYONIX_API_KEY": "${ZYONIX_AGENT_KEY}"}
}
}
}

Cursor: .cursor/mcp.json in the project (or ~/.cursor/mcp.json):

{
"mcpServers": {
"zyonix": {
"type": "stdio",
"command": "zyonix",
"args": ["mcp"],
"env": {"ZYONIX_API_KEY": "${env:ZYONIX_AGENT_KEY}"}
}
}
}

Drafts​

A draft is a candidate fix left for a person. It is not a fix: creating one leaves the issue where it is. It carries the candidate and the verification the server computed from the preview's per-case results: verified, failed, incomplete, unsupported or not run.

zyonix drafts list​

The drafts, newest first. zyonix drafts on its own is the same command.

zyonix drafts
zyonix drafts list --issue 7 --status draft
OptionDefaultWhat it does
--issue Nallonly drafts for this issue
--statusalldraft (open), promoted or dismissed
--limit N50how many

Who may run it: any reader.

How to read it: DRAFT (D-3), ISSUE, KIND, STATUS, PREVIEW (the verification outcome), REV (revision), BY, UPDATED, TITLE.

zyonix drafts show​

One draft: who prepared it, the candidate and its hash, the verification preview per set (A fixed of reproduced, B new failures, C golden accuracy), the evidence it references, the advisory performance block, and what blocks promotion.

zyonix drafts show 3
OptionWhat it does
DRAFTthe draft number (D-3 is 3)

Who may run it: any reader.

zyonix drafts create​

Leave a candidate fix for a person.

zyonix drafts create --issue 7 --title "Restore the tax instruction" --from-preview preview.json
zyonix drafts create --issue 7 --title "Day-first dates" --candidate-file fix.json --kind prompt \
--evidence-file ctx.json --note "runs 3c70b5c6, 4be0910c: date swapped"
OptionWhat it does
--title TEXTa short title (required)
--description TEXTwhat the cause is and why this fixes it
--from-preview FILEthe file zyonix replay --local --out FILE wrote: the candidate and its per-case results. The server evaluates them again
--candidate-file FILEa candidate without a preview: the draft is recorded as not verified (needs --issue)
--kindprompt, config or code_note
--issue Nthe issue (default: the preview file's)
--evidence-file FILEthe zyonix issues context output it was derived from (a reference is stored, not the document)
--note TEXTa short note on the evidence (which runs, which finding)

Give --from-preview or --candidate-file.

Who may run it: an agent key, or an administrator.

zyonix drafts update​

Change an open draft. A changed candidate is verified again (with --from-preview) or marked not verified (with --candidate-file). A draft keeps its kind.

zyonix drafts update 3 --from-preview preview2.json
zyonix drafts update 3 --title "Restore the tax and VAT instruction"
OptionWhat it does
DRAFTthe draft number
--title, --descriptionnew text
--from-preview, --candidate-file, --kind, --evidence-file, --noteas for create

Give at least one change. Who may run it: an agent key, or an administrator.

zyonix drafts dismiss​

Close a draft without promoting it. The issue is unchanged.

zyonix drafts dismiss 3 --reason "Fixed by a code change instead"
OptionWhat it does
DRAFTthe draft number
--reason TEXTwhy (required, recorded)

Who may run it: administrator.

To turn a draft into a fix proposal, use zyonix fix promote.