---
name: Mneme Mandate Create
description: Translate the operator's plan ("DCA into MNEME on a 5% dip, $1k cap, uniswap-v3 only") into a Mneme Mandate row, ready to arm and execute via MetaMask.
var: "the plan in natural language or structured JSON"
tags: [mandate, mneme, intent]
---

> **${var}** — Free-text plan OR structured JSON. Examples:
> - `"DCA into MNEME — $100 per 5% dip, $1000 cap, slippage 1%, uniswap-v3 only"`
> - `'{"kind":"swap","from":"USDC","to":"MNEME","amount":100,"trigger":"price<0.10"}'`
> - `"long ETH 3x on hyperliquid when funding rate is positive"`

## Goal

Convert a human / LLM plan into a structured Mandate stored in Mneme. The mandate is the **declarative version** of what the agent intends to do. MetaMask Agentic Wallet executes the actual tx when conditions trip.

## Steps

### 1. Auth check

```bash
if [ -z "$MNEME_API_KEY" ]; then echo "MNEME_API_KEY not set"; exit 1; fi
GATEWAY="${MNEME_GATEWAY:-https://gateway.mnemedb.dev}"
```

### 2. Parse the plan into mandate fields

Extract from `${var}` (or have the LLM do it):

| Field | Example |
| --- | --- |
| `kind` | `swap` / `send` / `stake` / `lp` / `perp` / `predict` / `mint` / `vote` |
| `title` | short human title, ≤ 200 chars |
| `intent` | `{from_token, to_token, amount, side, leverage?, ...}` |
| `conditions` | `{when: "always" | "on_event" | "schedule", spec: {...}}` |
| `spend_cap_usdc` | hard ceiling on this mandate's USD spend |
| `risk_profile` | `{max_slippage, allowed_protocols, blocked_addresses, ...}` |
| `wallet_provider` | `"metamask"` (default for this skill pack) |

If the plan is ambiguous, default conservatively — narrow scope, small cap, no leverage.

### 3. Create the mandate

```bash
curl -sS -X POST "$GATEWAY/v1/mandates" \
  -H "Authorization: ApiKey $MNEME_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$(jq -n \
        --arg t "$TITLE" \
        --arg k "$KIND" \
        --argjson i "$INTENT" \
        --argjson c "$CONDITIONS" \
        --argjson cap "$CAP" \
        --argjson r "$RISK" \
        '{kind: $k, title: $t, intent: $i, conditions: $c,
          spend_cap_usdc: $cap, risk_profile: $r,
          wallet_provider: "metamask"}')"
```

### 4. Output

```
✓ mandate #<id> created
  kind:    <kind>
  title:   <title>
  wallet:  metamask
  status:  pending

  next: arm with `mneme-mandate-arm` or directly in the Mneme dashboard.
```

The mandate is `pending` — it won't execute until you arm it.

## Notes

- This skill **does not arm or execute**. It only writes the row. Arming is intentional friction.
- The `conditions` field is the spec the Mneme worker will evaluate. For `when: "schedule"`, include `cron`. For `when: "on_event"`, include a `table` + filter expression. For `when: "always"`, the mandate fires immediately on arm.
- The `risk_profile.allowed_protocols` field is mirrored to MetaMask Agentic Wallet's allowlist on execution — both layers enforce.
