/midnight-verify:verify-by-zkir-inspectionfrom midnight-verify
Verifies compiled ZKIR circuit structure by parsing .zkir JSON from Compact compilation output. Counts opcodes, traces data flow, checks transcript encoding.
Ships in midnight-verify. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are verifying a claim about compiled circuit structure by compiling Compact code and analyzing the resulting .zkir JSON. Follow these steps in order.
Inspection proves what the compiler emits for specific source. It does NOT prove the circuit is correct. Proving constraint correctness requires running the checker — use verify-by-zkir-checker for that. If the claim spans both structure and behavior, perform inspection first, then hand off to the checker.
When the zkir-checker agent is running both inspection and checker methods for the same contract, compile once without --skip-zk and share the build output. The .zkir JSON produced by full compilation is identical to --skip-zk output — the only difference is that full compilation also generates PLONK keys. Don't compile twice.
If the checker method has already compiled the contract, use its build output for inspection. If running inspection alone, --skip-zk is fine since you only need the .zkir JSON.
Uses the same workspace as the checker method: ~/.midnight-expert/verify/zkir-workspace/. Does not require the WASM checker — only the Compact CLI and JSON parsing.
Create a job directory:
JOB_ID=$(uuidgen | tr '[:upper:]' '[:lower:]')
mkdir -p "$HOME/.midnight-expert/verify/zkir-workspace/jobs/$JOB_ID"
Write a minimal .compact contract targeting the claim. Only include what's needed to test the specific structural property.
Get the current language version and compile:
compact compile --language-version
compact compile -- --skip-zk <source-path> "$HOME/.midnight-expert/verify/zkir-workspace/jobs/$JOB_ID/build/"
For user-provided contracts, compile the contract where it lives (it may have imports) and direct only the build output to the job directory.
If this inspection will be followed by checker verification, omit --skip-zk to avoid recompiling:
compact compile -- <source-path> "$HOME/.midnight-expert/verify/zkir-workspace/jobs/$JOB_ID/build/"
Capture the compiler output. Note the compiler version — ZKIR output may change between versions.
.zkirAfter compilation, find the .zkir JSON in the build output directory. The typical structure is:
test-claim/build/zkir/<circuit-name>.zkir
Read the .zkir JSON and extract the top-level fields:
# Quick overview
node -e "
const zkir = JSON.parse(require('fs').readFileSync('<path-to-zkir>', 'utf8'));
console.log(JSON.stringify({
version: zkir.version,
do_communications_commitment: zkir.do_communications_commitment,
num_inputs: zkir.num_inputs,
instruction_count: zkir.instructions.length,
opcodes: [...new Set(zkir.instructions.map(i => i.op))].sort()
}, null, 2));
"
Perform targeted analysis based on what the claim asserts:
| Claim type | Analysis approach |
|---|---|
| Instruction count | zkir.instructions.length |
| Opcode usage | zkir.instructions.filter(i => i.op === '<opcode>') — count and list indices |
| Opcode presence/absence | Check if opcode appears: zkir.instructions.some(i => i.op === '<opcode>') |
| Transcript encoding | Look for declare_pub_input and pi_skip instructions (v2), count groups |
| I/O shape | Count output, public_input, private_input instructions |
| Constraint structure | Trace data flow: find constraint instructions, follow their input variable references back through the DAG to see what feeds into them |
| ZKIR version format | Check zkir.version.major — 2 for v2, 3 for v3 |
| Variable numbering | In v2, check that instructions reference sequential integer indices. In v3, look for named variables like %v.0, %v.1 |
For complex structural claims, write a small Node.js script in the job directory to perform the analysis and output structured JSON.
### ZKIR Inspection Report
**Claim:** [verbatim]
**Compact source:**
\`\`\`compact
[the contract you compiled]
\`\`\`
**Compiler version:** [output of compact compile --language-version]
**ZKIR version:** v2 / v3
**Analysis:**
- Total instructions: N
- [other relevant metrics based on claim type]
**Key findings:**
[specific instructions, indices, and patterns that address the claim]
**Interpretation:** [Confirmed / Refuted / Inconclusive] — [explanation]
rm -rf "$HOME/.midnight-expert/verify/zkir-workspace/jobs/$JOB_ID"
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
zkir, midnight, compact, circuit-verification, zero-knowledge
npx claudepluginhub midnightntwrk/midnight-expert --plugin midnight-verify19 skills in this plugin
/verify-by-cli-executionmidnight-verify:verify-by-cli-executionVerification by running Compact CLI commands and observing output. Checks CLI availability, runs commands, captures stdout/stderr/exit code, inspects filesystem changes, and interprets results. Covers flag existence, flag behavior, output structure, error messages, exit codes, version info, and CLI-vs-compactc comparisons. Loaded by the cli-tester agent./verify-by-devnetmidnight-verify:verify-by-devnetVerification by running E2E scripts against a local Midnight devnet. Writes SDK test scripts (raw or using testkit-js) that exercise the full transaction pipeline: deploy, call circuits, observe state. Checks devnet health before proceeding. Loaded by the sdk-tester agent. Loads the `midnight-tooling:devnet` skill for infrastructure management./verify-by-executionmidnight-verify:verify-by-executionVerification by compilation and execution. Translates a Compact claim into a minimal test contract, compiles it with the Compact CLI, runs the compiled output with @midnight-ntwrk/compact-runtime, and interprets the result. Loaded by the contract-writer agent. Covers workspace setup (lazy init), contract writing, compilation, runner script creation, execution, and result interpretation. References midnight-tooling:compact-cli for compilation details./verify-by-ledger-sourcemidnight-verify:verify-by-ledger-sourceVerification by source code inspection of the Midnight ledger Rust codebase. Searches and reads the actual Rust implementation to verify claims about transaction structure, token mechanics, cost model, on-chain VM, contract execution, and cryptographic primitives. Routes claims to specific crates within the 24-crate workspace. Uses octocode-mcp for quick lookups, falls back to local cloning for deep investigation. Loaded by the source-investigator agent when the claim domain is ledger/protocol./verify-by-sourcemidnight-verify:verify-by-sourceVerification by source code inspection. Searches and reads the actual compiler, ledger, and runtime source code to verify structural or architectural claims about Compact and Midnight that cannot be tested via compilation. Uses octocode-mcp for quick lookups, falls back to local cloning for deep investigation. Loaded by the source-investigator agent./verify-by-type-checkmidnight-verify:verify-by-type-checkVerification by TypeScript compilation. Writes TypeScript test files that exercise SDK type claims, then runs tsc --noEmit to check if types match. Also verifies user .ts files that import @midnight-ntwrk packages. Loaded by the type-checker agent. Covers workspace setup (lazy init), two modes (claim mode and file mode), type assertion patterns, and result interpretation.Other plugins' skills for the same job