DEV Community

Mihawnk Nft
Mihawnk Nft

Posted on

Muse Goat: My Proof Gatekeeper for zkVerify Agent Games

Muse Goat: My Proof Gatekeeper Learned to Prove It Played by the Rules

My entry for the zkVerify Agent Games Creator Track (#AgentGames, @ZKVProtocol). The agent is live in the Proof Gatekeeper track -- and the most interesting part of building it wasn't the decision logic. It was the two days the platform refused to believe my agent existed at all.

The game in one line

Your agent receives a signed task, makes a decision, and writes its own zero-knowledge proof that the decision followed the rules -- so it proves it played by the rules without revealing how it decided.

In Proof Gatekeeper, the platform sends a signed JSON task to your agent's public HTTPS endpoint. The agent must verify the HMAC signature on the raw body before doing anything, decide APPROVE or REJECT within 60 seconds, and attach a Groth16 proof that the platform re-verifies against its own registered verification key. The platform doesn't trust your decision. It checks the proof.

My agent is Muse Goat. It runs on a Cloudflare Worker (plain JavaScript, no build step), and its code is public:

The two bugs that kept me out

The first version of the endpoint was live, responding, and healthy -- and the dashboard still failed its preflight with the same stubborn message: "must return signed protocol-v1 JSON." I spent two days on it, and the cause turned out to be two bugs, not one.

Bug 1: the real task envelope is nested, and v1 assumed it was flat.

The sample task on the event page carries its decision fields nested under input, with different names than I expected: registered_vk, proof_vk, minimum, public_balance, expiry_block, current_block, recipient, condition_recipient, amount, max_transfer, proof_tx. My v1 read them as flat top-level fields. That meant v1 would have rejected every real task with MISSING_FIELD_VK -- it was looking for the verification key in a place the platform never puts it.

v2 unwraps input (top-level kept as a fallback), with a field map that tries the real names first and legacy flat names second. A missing required field fails closed -- it never guesses a value.

Bug 2: the dashboard's probe is not a task, and v1 treated it like one.

The preflight probe the dashboard sends carries a task_id (and a proof-gatekeeper type) but no decision fields. v1 saw the task_id, classified the body as a task, ran the decision logic, and answered 401 / MISSING_FIELD_VK. The dashboard read that as "this endpoint doesn't speak protocol v1."

v2 draws the line exactly: a body is a task only if it carries an input object or decision fields. A task_id without decision fields is a probe -- and a probe gets a signed handshake: {ok: true, protocolVersion: "v1"}, with the x-agent-games-signature header.

I also chased a red herring along the way: I tried hex-decoding the HMAC secret before signing (v1.5). That failed preflight too, so the signing convention wasn't the cause. v2 is back on the standard convention -- the secret string as the HMAC key -- and request verification still accepts both, so a platform that signs either way gets in.

After the fix, the deploy took minutes: paste the v2 code into the Worker, save the endpoint URL in the dashboard, and the preflight came back OK -- Healthy, 369ms. The agent is ACTIVE. Rounds 3-4 are running; no tasks have arrived yet (0/16 answered), so the real test is still ahead.

The decision: seven checks, no LLM in the loop

An LLM never makes the final call. The decision is seven deterministic checks, and any failure -- or any exception -- means REJECT. Fail closed, always:

  1. Task type -- must be the Proof Gatekeeper game, or BAD_CIRCUIT.
  2. Verification key -- the proof's proof_vk must match the task's registered_vk, or VK_SUBSTITUTION. (This is the event page's trap example: a substituted verification key is the classic way to smuggle a fake proof past a guard.)
  3. Recipient -- a valid 0x address, and it must match condition_recipient, or BAD_RECIPIENT / RECIPIENT_MISMATCH.
  4. Threshold -- the public balance must meet the minimum, or THRESHOLD_MISMATCH.
  5. Amount -- positive, and within the single-transfer cap, or BAD_AMOUNT / AMOUNT_EXCEEDS_MAX.
  6. Expiry -- the current block must not pass the expiry block, or EXPIRED.
  7. Timestamps -- issued_at reasonably fresh (60-minute tolerance for delivery delay), deadline_at in the future, or BAD_TIMESTAMP / EXPIRED.
  8. Proof reuse -- a proof_tx that was already approved is never approved twice, or PROOF_REUSED.

A few things I was deliberate about: the HMAC is verified over the raw body before any JSON parsing, and compared in constant time (no early-exit timing leak). The secret is never in the repo -- it comes from the dashboard's "Rotate Secret" as an environment variable, never committed, never pasted in chat, never logged. The request log records only top-level keys, never values. And the proof-reuse seen-set is in-memory only, which is a known gap: a Worker isolate restart clears it, so for production it belongs in Workers KV -- a reused proof must stay rejected across restarts.

The honest gap: the proof isn't there yet

I'll say this plainly, because the whole point of this tournament is not trusting claims: v2 does not generate a Groth16 proof yet. It returns proof: null / public_signals: null, and takes the -2 penalty for it. The decision logic is real and tested (21/21 local tests pass), the signature verification is real, and the endpoint is live and healthy -- but the zero-knowledge proof itself is the next upgrade: generate it with snarkjs, submit it through Kurier, and poll until it reaches Finalized on zkVerify mainnet.

That gap is exactly why I wanted to write this article. The tournament's premise is that an agent's word is worthless and only a verified proof counts -- and that standard should apply to the builders too. So here is the honest state of my agent: a gatekeeper that verifies signatures, checks seven rules, fails closed, and is live. The proof is the next commit, not a claim in this article.

What I learned

The preflight saga taught me the real lesson of this track: the interface is the product. My decision logic was correct from the start -- the platform never got far enough to see it, because my endpoint couldn't tell a handshake from a task. Two classification bugs, both in the first twenty lines of request handling, cost two days. The circuit, the proof, the scoring -- none of it matters if the handshake fails.

The second lesson is the one the tournament is built on: don't trust, verify. Not just the agent's decisions, but the builder's claims -- including mine. That's why the code is public, the endpoint is live, and the missing proof is stated here instead of hidden.

If the rounds send tasks, Muse Goat will answer them. If the proof upgrade lands, it will answer with a proof attached. Either way, the gatekeeper is standing at its post.


Muse Goat -- Proof Gatekeeper, Agent Games Season 01 (21 Oct - 21 Nov 2026, judging 22-30 Nov). Built with a Cloudflare Worker, plain JS, no build step. Repo: https://github.com/mihawnk-nft/Muse-goat | Endpoint: https://silent-leaf-1bdf.mihawnknft.workers.dev/agent | #AgentGames @ZKVProtocol

Top comments (0)