Give the agent Stoffel docs access
Before a large implementation task, install the Stoffel skills and connect the live docs MCP server so the agent can use current docs instead of training-data guesses. Install the skills:https://docs.stoffelmpc.com/.well-known/agent-skills/index.jsonhttps://docs.stoffelmpc.com/.well-known/mcphttps://docs.stoffelmpc.com/.well-known/mcp/server-card.json
Mandatory portability contract
Before changing files or dependencies, the agent must:- Discover and confirm the project root from its current working directory and repository markers such as
Stoffel.toml,Cargo.toml, or.git. It must not invent or require a machine-specific path such as/workspace/.... - Select Stoffel and related project dependencies from public, reproducible sources in this order: the current crates.io release, then the official GitHub repository pinned to a full immutable commit SHA when the needed change is not published.
- Never use a floating branch or require a local path, sibling checkout, or other external filesystem checkout in the default app implementation.
- Use a local Stoffel checkout only when the user explicitly requests framework development. Mark that route nonportable and keep it separate from the default public-dependency implementation.
- Stop and report the unavailable dependency and attempted public sources if no suitable public dependency exists. Never silently fall back to a local checkout.
Start with the application trust architecture
For client-owned private input, the input owner’s device or process is the Stoffel MPC client. It submits directly through the client protocol to the separately deployed MPC service. An application backend may manage public metadata, authorization, session configuration, non-sensitive receipts, lifecycle, and explicitly authorized opened aggregates, but it must not receive or persist participant plaintext. A backend gateway that receives raw input is a separate, weaker trust model. Do not introduce it implicitly or use it to work around missing browser/client support. Before asking an agent to write code, require it to answer:- Which values are secret and public.
- Who owns each plaintext input and where that plaintext exists before protection.
- Which participant-owned process executes the Stoffel client protocol.
- Which components are forbidden from receiving, logging, queueing, caching, analyzing, or persisting plaintext.
- What the application control plane may receive and persist.
- Who receives each output.
- Whether each output is an opened value, client-output share, public commitment, curve-encoded value, or signature-related artifact.
- Whether the requested participant runtime supports direct client-protocol submission.
- Which backend is selected and why.
- Which command proves the program is valid.
- Which command proves local MPC works.
- Which command proves the production private-data path bypasses the application service.
- Which artifacts and configs are required before deployment.
- Which discovered project root the agent will modify.
- Which public dependency source satisfies the portability contract.
- Whether framework development was explicitly requested; otherwise local checkout use is forbidden.
Backend selection context
Give the agent the backend decision in terms of value representation and output boundary. Use HoneyBadgerMPC when:- the program computes over secret integers, fixed-point values, or field-compatible shares;
- the main cost questions are multiplication count, multiplication depth, comparisons, and reveal boundaries;
- public parameters can stay public while private inputs remain ordinary MPC shares;
- the outside system consumes an opened result or client-output shares from private computation.
- the program needs public commitments to secret shares;
- the backend must use a curve that matches an external verifier or protocol;
- public transcript bytes must become curve-field challenges;
- the outside system consumes a commitment, curve-encoded value, opened scalar response, or signature-related artifact.
Prompt template
HoneyBadgerMPC agent guidance
Ask the agent to inspect circuit shape before optimizing code:- Count secret × secret multiplications.
- Separate multiplication count from multiplication depth.
- Keep public weights, thresholds, normalization factors, and lookup tables public when possible.
- Treat comparisons, bit decomposition, and nonlinear functions as expensive until measured.
- Use
MpcOutputwhen a client should receive result shares instead of opening the result to the host application. - Size preprocessing for the largest expected input shape if the program runs on a network deployment.
ClientStore.get_number_clients()ClientStore.take_share(...)ClientStore.take_share_fixed(...)Mpc.has_capability("client-output")MpcOutput.send_to_client(...)Share.add,Share.mul,Share.mul_scalar- opened values via
.reveal(),Share.open(...), oropen_fixed()where appropriate
AVSS agent guidance
Ask the agent to keep the cryptographic transcript explicit:- Choose the curve based on the external verifier or protocol.
- Keep transcript bytes public until they become a scalar challenge with
Crypto.hash_to_field(..., Mpc.curve()). - Use
get_commitment(0)when the outside system needs a public commitment or public key point. - Persist long-lived key shares with
LocalStoragewhen the workflow requires stable key material. - Do not persist or reuse per-signature nonces unless the protocol explicitly requires and protects that state.
- Minimize openings; open scalar responses only when the protocol boundary requires it.
Share.random()LocalStorage.exists(...)LocalStorage.store(...)LocalStorage.load(...)LocalStorage.load_share(...)secret_key.get_commitment(0)Mpc.curve()Crypto.hash_to_field(...)Crypto.point_to_sec1(...)MpcOutput.send_to_client(...)
Common corrections to give the agent
- Do not treat
client,app,backend,gateway, and participant-side Tauri Rust as interchangeable roles. - Do not send participant plaintext through an application endpoint in the default client-owned-input architecture; a gateway that does this is a separately approved degraded-trust design.
- Do not use local
.with_client_input(...)fixture injection as production private-data-plane evidence. - Do not compensate for unsupported browser/WASM submission by silently adding a plaintext backend gateway.
- Do not use AVSS for generic private arithmetic unless the task needs commitments or curve-compatible artifacts.
- Do not reveal intermediate secret values just to make the program easier to write.
- Do not turn public transcript material into secret shares earlier than necessary.
- Do not assume a curve selector applies to HoneyBadgerMPC.
- Do not stop after writing code; run the relevant validation command and report the real output.