Skip to content

Fix Agent Wallet switching and approval docs for agents without the skill - #3073

Merged
yashovardhan merged 3 commits into
mainfrom
docs/agent-wallet-switching-approvals
Oct 16, 2026
Merged

yashovardhan merged 3 commits into
mainfrom
docs/agent-wallet-switching-approvals

Conversation

@yashovardhan

Copy link
Copy Markdown
Member

Why

Support screenshots shared by Zhen showed a red route: agents that read the docs (not the metamask-agent-wallet skill) mishandled trading-mode switching and where to find the 2FA approval. A Grok-based agent picked Guard Mode for the user on every sign-in, ended up creating several wallets, and said "MetaMask will probably ask you to approve it" without naming where. Many agents read these docs without loading the skill and quote them to users as written, so the docs have to carry the same operating detail as the skill.

What changed

Commit 1: docs, skill parity, llms bundles

  • New pages: Switch modes and wallets, Approve requests, Rules for AI agents (a docs-voice mirror of the skill's preflight, confirmation, credential, 2FA-pause, and output rules, plus a new rule: never choose sign-in method, wallet mode, or trading mode for the user).
  • Contradictions between the docs and the skill, resolved against the CLI 7.2.0 source:
    Topic Was in docs Verified behavior
    Re-init on an existing account "may sync" Syncs existing wallets, ignores --mode, loads the trading mode from the server
    No --mode in a non-interactive session not documented Silently sets Guard Mode, which is what happened in the screenshot
    Trading mode for bring your own wallet "server-wallet only" mm init sets one for BYOK too (the CLI labels BYOK policy-based 2FA "coming soon")
    BYOK async "return immediately" Signed locally, then submitted as a job, so a pollingId is possible
    Beast Mode switch "prompts for confirmation" No terminal prompt; the 2FA approval is the only confirmation
  • Documented the exact per-sign-in approval messages, the MetaMask Mobile notifications-menu fallback, AWAITING_MFA / pending_approval, and 8 missing approval and wallet error codes.
  • llms-agent-wallet*.txt now lists pages in task order (agent rules → quickstart → setup → switching → approvals → troubleshooting), starts with a preamble for agents and the CLI version, and no longer has the duplicate ## Trading modes stub heading.
  • Added agent-facing writing conventions to .cursor/rules/product-agent-wallet.mdc and a 10-prompt cross-model check at scripts/agent-wallet-docs-eval.md.

Commit 2: per-page .md converter (affects all products, can be split out)

  • Strips heading anchors ([​](#x "Direct link to x")) from every per-page .md. The HTML side marks the same anchors data-markdown-ignore so AFDocs parity stays symmetric.
  • Code fences now carry their language. Tab groups (npm2yarn, file tabs) are labelled per panel. Inline code in table cells keeps its backticks.
  • Checked against 150 built pages: no lost words, no table structure changes, 0 anchors site-wide.

Verification

  • npm run build passes, with no new broken-link warnings for Agent Wallet.
  • node scripts/verify-llms-output.js passes: 25/25 pages present, ordered, with the preamble.
  • Vale is clean on the new pages.
  • Not yet run: AFDocs markdown-content-parity against the Vercel preview, and the cross-model prompt set (Claude, GPT, Grok/Gemini).

Reviewer notes

  • .cursor/rules/product-agent-wallet.mdc previously said not to paste skill content into the docs. It now allows a docs-voice mirror in agent-rules.md, which must be kept in sync with the skill.
  • Reported as fact here, but please confirm with the CLI team: "Guard Mode is set when --mode is omitted" (read from source).

Follow-ups outside this repo

  • CLI (MetaMask/agentic): mm wallet trading-mode set --help and the post-init hint both reference mm mode set, which doesn't exist. mm wallet requests list/watch help says "server-wallet mode only" but doesn't enforce it.
  • Skill (MetaMask/agent-skills): onboarding.md says Beast Mode "skips all policy checks and confirmations", which contradicts the product copy. The confirmation table needs the "never choose modes for the user" rule. The skill is pinned to CLI 7.0.0.

🤖 Generated with Claude Code

yashovardhan and others added 2 commits October 16, 2026 19:56
…kill.

Support screenshots showed agents that read the docs (not the skill) choosing
Guard Mode for users, creating a new wallet per sign-in method, and telling
users "MetaMask will probably ask you to approve it" with no surface named.

- Add Switch modes and wallets, Approve requests, and Rules for AI agents pages.
- Resolve docs/skill contradictions against CLI 7.2.0: mm init reuses existing
  wallets and their trading mode, defaults to Guard Mode when --mode is omitted
  non-interactively, sets a trading mode for bring your own wallet too, and BYOK
  requests are submitted as jobs that can return a pollingId.
- Remove the non-existent Beast Mode terminal confirmation prompt; document
  confirmed / pending_approval returns and the CLI's `mm mode set` help typo.
- Add missing trading mode and policy approval error codes.
- Order the Agent Wallet llms bundles by task with an agent preamble and
  CLI version, and drop the duplicate Trading modes stub heading.
- Add agent-facing writing conventions and a cross-model eval prompt set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The HTML-to-markdown conversion behind every per-page .md produced noise that
agents read verbatim:

- Strip Docusaurus heading anchors, which emitted `[​](#x "Direct link to x")`
  after every heading (275 in Agent Wallet alone). The HTML side marks them
  data-markdown-ignore so AFDocs parity stays symmetric.
- Copy the Prism language class from <pre> to <code> so fences are tagged.
- Label each tab panel (npm2yarn, file tabs) instead of a detached tab list.
- Keep inline code in table cells, which node-html-markdown dropped.

Checked against 150 built pages: no lost words, no table structure changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yashovardhan
yashovardhan requested review from a team as code owners October 16, 2026 14:27
@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
metamask-docs Ready Ready Preview Oct 16, 2026 2:31pm UTC

Request Review

…tching-approvals

# Conflicts:
#	agent-wallet/reference/error-codes.md
version: 'CLI 7.2.0',
rootContent: [
'If you are an AI agent operating the `mm` CLI, read "Rules for AI agents" first.',
'If you can load skills, install `npx skills add MetaMask/agent-skills` and prefer the skill.',
@yashovardhan
yashovardhan merged commit 0f7c8f7 into main Oct 16, 2026
18 checks passed
@yashovardhan
yashovardhan deleted the docs/agent-wallet-switching-approvals branch October 16, 2026 15:54

This branch was successfully deployed

1 active deployment
Preview — b18eac89 Deployed Oct 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants