0xmiden/agent-tools/advice-provider-hygiene
Claude Code and agent skill by 0xmiden/agent-tools
- community
Checking that the SKILL.md file is still in the repository.
Use when writing kernel, account, or note MASM code that reads from or writes to the advice provider (advice stack / advice map) — validate advice data.
Install
npx vskill@latest install 0xmiden/agent-tools/advice-provider-hygieneSKILL.md
Advice Provider Hygiene
Rules
The advice provider is untrusted input supplied by the (potentially adversarial) prover. Any kernel, account, or note procedure that touches it must follow three rules.
1. Validate advice data against a commitment
Before consuming data loaded from the advice provider:
- Read the data from the advice stack / advice map into memory.
- Compute its hash with Poseidon2 over the loaded region.
- Assert the computed hash equals an expected commitment that the kernel already trusts — on-chain storage, a prior input, or a value already on the stack.
Do not consume advice data before this check passes. The advice provider's only role is to supply witness data for commitments the kernel has already received.
2. Key advice map entries by content hash
When inserting into the advice map, the key must be a hash of the value it indexes (or a derived commitment of the same data):
- Use
Poseidon2(value)(or whichever commitment matches the consumer's check) as the key. - Do not hard-code keys like
0x0000_0000_0000_0001,ADVICE_KEY_NOTE_DATA, or per-procedure magic constants.
Readers retrieve the entry by recomputing the same hash from data they already trust; rule 1's commitment check binds the lookup result to that trusted hash.
3. Missing advice is an error
A missing advice-map entry, an empty advice stack, or an absent required value is an error — not a default. Surface it with assert.err=ERR_.... Don't substitute zero / empty / a fallback and continue.
Why
The advice provider is filled by a potentially adversarial prover. Validating every value against a commitment the kernel already trusts, keying map entries by content hash, and erroring on missing entries are what stop untrusted advice from silently corrupting the kernel's invariants.
Examples
Advice data is tied to a commitment by piping it into memory. There are two mechanisms, and they differ in whether the commitment check happens for you.
Piping words to memory — you must validate
adv_pipe, adv_loadw, and mem::pipe_double_words_to_memory copy advice data into memory but do not check it against any commitment. Hash the loaded region with Poseidon2 yourself and assert it equals a commitment the kernel already trusts.
Piping a preimage to memory — validated for you
mem::pipe_preimage_to_memory takes the commitment on the stack, copies the preimage from the advice stack into memory, and asserts its sequential Poseidon2 hash equals that commitment — all in one step.
Content-addressed keys and missing entries
Illustrative fragments (with the key already on the operand stack):
For the Rust analog (returning Err on bad/missing external input rather than panicking or defaulting), see return-error-not-panic.
In VM 0.35, AdviceInputs fields are private: use with_stack (formerly with_advice_stack), with_map, and with_merkle_store. Advice stack, map, and Merkle store share one default 16 MiB byte budget; review total advice size when migrating.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/advice-provider-hygiene/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/0xmiden/agent-tools/advice-provider-hygiene)