---
name: Mneme Mandate Arm
description: Move a pending Mneme Mandate to armed state — the worker starts watching conditions, MetaMask Agentic Wallet stands by to execute.
var: "the mandate id"
tags: [mandate, mneme]
---

> **${var}** — Mandate id (numeric). Run `mneme-mandates list` (or `/mandates` in the Mneme CLI) to find it.

## Goal

A pending mandate is just a row of intent — it doesn't fire. Arming flips it to `armed` so the worker starts evaluating `conditions` on every tick. When conditions trip, the mandate goes to `triggered`, the wallet adapter (MetaMask Agentic Wallet by default) is called, and on confirmation it lands at `executed`.

## 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 + sanity-check

```bash
ID=$(echo '${var}' | tr -cd '0-9')
if [ -z "$ID" ]; then
  echo "usage: mneme-mandate-arm <mandate_id>"
  exit 1
fi
```

### 3. Pre-fetch the mandate so the operator sees what they're arming

```bash
M=$(curl -sS "$GATEWAY/v1/mandates/$ID" -H "Authorization: ApiKey $MNEME_API_KEY")
STATUS=$(echo "$M" | jq -r '.status')
TITLE=$(echo  "$M" | jq -r '.title')
WALLET=$(echo "$M" | jq -r '.wallet_provider')

if [ "$STATUS" != "pending" ]; then
  echo "mandate #$ID is not pending — current status: $STATUS"
  exit 1
fi

echo "arming → \"$TITLE\" (wallet: $WALLET)"
```

### 4. Arm

```bash
curl -sS -X POST "$GATEWAY/v1/mandates/$ID/arm" \
  -H "Authorization: ApiKey $MNEME_API_KEY" \
  -H "Content-Type: application/json" -d '{}'
```

### 5. Output

```
✓ mandate #<id> armed
  worker is watching conditions now
  expected wallet: <provider>
  cancel anytime via mneme-mandate-cancel or /mandate cancel <id>
```

## Notes

- Arming is the **only** intentional friction in the Mandate lifecycle. The reason is safety — you stand behind the conditions you signed up for.
- If the mandate's `expires_at` is in the past, arm will succeed but the worker will refuse to fire it and transition to `cancelled` (with `last_error = "expired"`).
- When MetaMask Agentic Wallet is set as the provider but you don't have access yet, the mandate will park in `armed` until the adapter is configured.
