Skip to content

Commit e7df71e

Browse files
add workflow skills
* add workflow skills * revery symlink * update workflows
1 parent 16cef2a commit e7df71e

12 files changed

Lines changed: 559 additions & 2 deletions

File tree

skills/metamask-agent-wallet/workflows/bridge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mm-dev swap quote --from ETH --to USDC --amount 1 --from-chain 1 --to-chain 137
2020

2121
Required flags: `--from`, `--to`, `--amount`, `--from-chain`, and `--to-chain`.
2222

23-
Persist the quote for execution. Show the quote to the user before execution.
23+
Persist the quote id for execution. Show the quote to the user before execution.
2424
Confirm source token, destination token, amount, source chain, destination chain, slippage, expected output, fees, and route.
2525

2626
## Execute

skills/metamask-agent-wallet/workflows/swap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mm-dev swap quote --from ETH --to USDC --amount 1 --from-chain 1
2020

2121
Required flags: `--from`, `--to`, `--amount`, and `--from-chain`.
2222

23-
Persist the quote for execution. Show the quote to the user before execution.
23+
Persist the quote id for execution. Show the quote to the user before execution.
2424
Confirm source token, destination token, amount, chain, slippage, expected output, fees, and route.
2525

2626
## Execute
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: metamask-agent-workflows
3+
description: Use when the user needs to perform multi-step operations with the MetaMask Agentic CLI such as onboarding, login, swapping tokens, bridging across chains, opening/closing/modifying perpetual positions, prediction market trading, or troubleshooting CLI issues.
4+
license: MIT
5+
metadata:
6+
author: metamask
7+
version: "1.0.0"
8+
---
9+
10+
# MetaMask Agent Workflows
11+
12+
Repeatable multi-step patterns for the `mm-dev` CLI. Load a workflow file when the user's request is a pattern, not a single command.
13+
14+
## Workflow Routing
15+
16+
| Pattern | Workflow |
17+
| --- | --- |
18+
| First time setup and onboarding | [onboarding.md](workflows/onboarding.md) |
19+
| Login flow | [login.md](workflows/login.md) |
20+
| Troubleshooting decision tree | [troubleshooting.md](workflows/troubleshooting.md) |
21+
| Swap quote-review-execute flow | [swap.md](workflows/swap.md) |
22+
| Bridge quote-review-execute flow | [bridge.md](workflows/bridge.md) |
23+
| Open a perpetual position flow | [perps-open-position.md](workflows/perps-open-position.md) |
24+
| Close a perpetual position flow | [perps-close-position.md](workflows/perps-close-position.md) |
25+
| Modify a perpetual position flow | [perps-modify-position.md](workflows/perps-modify-position.md) |
26+
| Predict setup-fund-quote-place flow | [predict-trading.md](workflows/predict-trading.md) |
27+
28+
## Preflight
29+
30+
Always run preflight before any CLI operation.
31+
32+
```bash
33+
mm-dev auth status
34+
```
35+
36+
If the user is not authenticated, follow `workflows/onboarding.md` for first time setup, or `workflows/login.md` for login.
37+
38+
## Command Discovery
39+
40+
Before constructing any command, run `mm-dev <command> --help` to confirm the exact flags, syntax, and defaults. Do not guess flags from memory.
41+
42+
## Output Rules
43+
44+
- Route silently. Do not announce which workflow you are loading.
45+
- Surface errors from commands verbatim. Do not mask or reword them.
46+
- If a command fails, check `mm-dev <command> --help` and guide from there.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Bridge Workflow
2+
3+
Use this workflow when the user wants to bridge tokens across chains.
4+
5+
Reference command syntax in `references/swap.md`. The CLI uses the same `swap` commands for bridging — set `--to-chain` to a different chain than `--from-chain`.
6+
7+
## Flow
8+
9+
1. Quote.
10+
2. Confirm with the user.
11+
3. Execute and track status.
12+
13+
Do not skip the quote review step. It is where the user sees output amount, fees, route, and slippage.
14+
15+
## Quote
16+
17+
```bash
18+
mm-dev swap quote --from ETH --to USDC --amount 1 --from-chain 1 --to-chain 137 --slippage 0.5
19+
```
20+
21+
Required flags: `--from`, `--to`, `--amount`, `--from-chain`, and `--to-chain`.
22+
23+
Persist the quote id for execution. Show the quote to the user before execution.
24+
Confirm source token, destination token, amount, source chain, destination chain, slippage, expected output, fees, and route.
25+
26+
## Execute
27+
28+
```bash
29+
mm-dev swap execute --quote-id "QUOTE_ID"
30+
```
31+
32+
Prefer executing by quote ID. Re-quote-and-execute flags exist, but quote ID execution keeps the reviewed quote tied to the submitted action.
33+
34+
## Status
35+
36+
```bash
37+
mm-dev swap status --quote-id "QUOTE_ID"
38+
mm-dev swap status --quote-id "QUOTE_ID" --tx-hash 0xabc123
39+
```
40+
41+
Use status polling for bridges where the destination side can lag behind the source transaction.
42+
43+
## Edge Cases
44+
45+
- Quote expired: re-quote and ask the user to review the new quote.
46+
- Insufficient balance: surface the error verbatim.
47+
- Slippage exceeded: only increase `--slippage` if the user explicitly accepts more slippage. Always warn the user if slippage
48+
is increased above 1% that it will affect the minimum received.
49+
- Missing chain: use `mm-dev chains list` before guessing a chain ID.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Login Workflow
2+
3+
Use this workflow when the user needs to log in to the CLI.
4+
5+
Reference command syntax in `references/auth.md`.
6+
7+
## Flow
8+
9+
1. Ask the user which login method they want: Google, Email, or QR.
10+
2. Execute login.
11+
3. Verify with token.
12+
13+
## Login
14+
15+
QR login (`mm-dev login qr`) does not support `--no-wait`. If the user wants QR, they must complete the login flow themselves.
16+
17+
```bash
18+
mm-dev login google --no-wait
19+
mm-dev login email --no-wait
20+
```
21+
22+
Use `--no-wait` for non-interactive environments. The command prints a sign-in URL.
23+
24+
## Verify
25+
26+
Once the user completes sign-in, verify with:
27+
28+
```bash
29+
mm-dev login --token "<TOKEN>"
30+
```
31+
32+
## Confirm
33+
34+
```bash
35+
mm-dev auth status
36+
```
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Onboarding Workflow
2+
3+
Use this workflow when the user is setting up the MetaMask Agentic CLI for the first time.
4+
5+
Reference command syntax in `references/auth.md` and `references/wallet.md`.
6+
7+
## Flow
8+
9+
1. Check CLI installation.
10+
2. Login.
11+
3. Initialize wallet mode.
12+
4. Verify auth status.
13+
5. Show wallet address.
14+
15+
## Check CLI Installation
16+
17+
```bash
18+
mm-dev --version
19+
```
20+
21+
If this fails, the CLI is not installed. Guide the user to install it before proceeding.
22+
23+
## Login Flow
24+
25+
Ask the user which login method they want to use: Google, Email, or QR.
26+
QR login (`mm-dev login qr`) does not support `--no-wait`. If the user wants QR, they must complete the onboarding flow themselves.
27+
28+
### Login
29+
30+
```bash
31+
mm-dev login google --no-wait
32+
mm-dev login email --no-wait
33+
```
34+
35+
Use `--no-wait` for non-interactive environments. The command prints a sign-in URL.
36+
37+
### Verify
38+
39+
Once the user completes sign-in, verify with:
40+
41+
```bash
42+
mm-dev login --token "<TOKEN>"
43+
```
44+
45+
## Initialize Project
46+
47+
First check if the project is already initialized:
48+
49+
```bash
50+
mm-dev init show
51+
```
52+
53+
If already initialized, skip this step. Otherwise, ask the user which wallet mode they want:
54+
- `server-wallet` (recommended) — keys are hosted by MetaMask infrastructure. No need to manage private keys or mnemonics.
55+
- `byok` — bring your own mnemonic. The user manages their own keys locally.
56+
57+
Ask the user which trading mode they want:
58+
- `safe` — enforces outflow and whitelist policies. When a policy is violated, the CLI requires MFA confirmation before proceeding.
59+
- `yolo` — skips all policy checks and confirmations. Useful for scripting or experienced users who want faster execution.
60+
61+
Server wallet:
62+
63+
```bash
64+
mm-dev init --wallet server-wallet --mode safe
65+
```
66+
67+
BYOK:
68+
69+
```bash
70+
mm-dev init --wallet byok --mnemonic "word1 word2 ..."
71+
```
72+
73+
## Verify Auth Status
74+
75+
```bash
76+
mm-dev auth status
77+
```
78+
79+
Confirm the session is authenticated, the wallet mode is correct, and the token is valid.
80+
81+
## Show Wallet Address
82+
83+
```bash
84+
mm-dev wallet address
85+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Perps Close Position Workflow
2+
3+
Use this workflow when the user wants to close a perpetual position.
4+
5+
Reference command syntax in `references/perps.md`.
6+
7+
## Flow
8+
9+
1. Check open positions.
10+
2. Dry run the close.
11+
3. Confirm with the user and close.
12+
13+
## Check Positions
14+
15+
```bash
16+
mm-dev perps positions --venue hyperliquid
17+
```
18+
19+
## Dry Run
20+
21+
Preview the close before executing:
22+
23+
```bash
24+
mm-dev perps close --venue hyperliquid --symbol BTC --dry-run
25+
```
26+
27+
For partial close, include `--size <amount>`.
28+
29+
## Close
30+
31+
Remove `--dry-run` only after explicit user confirmation:
32+
33+
```bash
34+
mm-dev perps close --venue hyperliquid --symbol BTC
35+
mm-dev perps close --venue hyperliquid --symbol BTC --size 0.005
36+
```
37+
38+
`--all` closes every open position. Require explicit confirmation that the user wants all positions closed.
39+
40+
```bash
41+
mm-dev perps close --venue hyperliquid --all
42+
```
43+
44+
Do not add `--yes` unless the user explicitly asked for unattended execution.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Perps Modify Position Workflow
2+
3+
Use this workflow when the user wants to modify leverage, take-profit, or stop-loss on an existing position.
4+
5+
Reference command syntax in `references/perps.md`.
6+
7+
## Flow
8+
9+
1. Check open positions.
10+
2. Dry run the modification.
11+
3. Confirm with the user and modify.
12+
13+
## Check Positions
14+
15+
```bash
16+
mm-dev perps positions --venue hyperliquid
17+
```
18+
19+
## Dry Run
20+
21+
Preview the modification before executing:
22+
23+
```bash
24+
mm-dev perps modify --venue hyperliquid --symbol BTC --leverage 10 --dry-run
25+
mm-dev perps modify --venue hyperliquid --symbol ETH --tp 3000 --sl 2000 --dry-run
26+
```
27+
28+
At least one of `--leverage`, `--tp`, or `--sl` must be provided.
29+
30+
## Modify
31+
32+
Remove `--dry-run` only after explicit user confirmation:
33+
34+
```bash
35+
mm-dev perps modify --venue hyperliquid --symbol BTC --leverage 10
36+
mm-dev perps modify --venue hyperliquid --symbol ETH --tp 3000 --sl 2000
37+
```
38+
39+
Do not add `--yes` unless the user explicitly asked for unattended execution.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Perps Open Position Workflow
2+
3+
Use this workflow when the user wants to open a new perpetual position.
4+
5+
Reference command syntax in `references/perps.md`.
6+
7+
## Flow
8+
9+
1. Check balance and deposit if needed.
10+
2. Quote the position.
11+
3. Dry run.
12+
4. Confirm with the user and open.
13+
14+
## Check Balance
15+
16+
```bash
17+
mm-dev perps balance --venue hyperliquid
18+
```
19+
20+
If available margin is zero or insufficient, deposit USDC before proceeding:
21+
22+
```bash
23+
mm-dev perps deposit --venue hyperliquid --amount <amount> --asset USDC
24+
```
25+
26+
The default `--source-chain` is Arbitrum mainnet (`eip155:42161`). Do not assume other chains are supported unless the CLI confirms it.
27+
28+
To confirm a deposit, wait briefly and poll `mm-dev perps balance`.
29+
30+
## Quote
31+
32+
Always quote before opening:
33+
34+
```bash
35+
mm-dev perps quote --venue hyperliquid --symbol BTC --side long --size 0.01 --leverage 5
36+
```
37+
38+
Show the user estimated entry, notional, fees, liquidation price, side, size, leverage, and venue before proceeding.
39+
40+
## Dry Run
41+
42+
Preview the order before signing:
43+
44+
```bash
45+
mm-dev perps open --venue hyperliquid --symbol BTC --side long --size 0.01 --leverage 5 --dry-run
46+
```
47+
48+
For limit orders, include `--type limit --limit-px <price>`.
49+
50+
`--max-slippage-bps` is the slippage cap in basis points for IOC market pricing.
51+
52+
## Open
53+
54+
Remove `--dry-run` only after explicit user confirmation:
55+
56+
```bash
57+
mm-dev perps open --venue hyperliquid --symbol BTC --side long --size 0.01 --leverage 5
58+
```
59+
60+
Do not add `--yes` unless the user explicitly asked for unattended execution.

0 commit comments

Comments
 (0)