← Back to Plugins
Tools

Pragma Openclaw

s0nderlabs By s0nderlabs 👁 8 views ▲ 0 votes

pragma plugin for OpenClaw — on-chain trading and market intelligence on monad

GitHub

Install

openclaw plugins install pragma-openclaw

Configuration Example

{
  "plugins": {
    "pragma-openclaw": {
      "mode": "x402",
      "configPath": "~/.pragma/config.json",
      "sessionKeyPath": "~/.pragma/session-key.json"
    }
  }
}

README

# pragma

> Vibetrading for OpenClaw

[![OpenClaw](https://img.shields.io/badge/OpenClaw-plugin-FF6B35?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTEyIDJMMiAyMmgyMEwxMiAyeiIgZmlsbD0id2hpdGUiLz48L3N2Zz4=)](https://openclaw.ai)
[![Monad](https://img.shields.io/badge/Monad-live-836EF9)](https://monad.xyz)
[![npm](https://img.shields.io/npm/v/pragma-openclaw)](https://www.npmjs.com/package/pragma-openclaw)
[![Version](https://img.shields.io/badge/version-0.1.1-green.svg)](CHANGELOG.md)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

> **Beta Software.** pragma is experimental and under active development. Trading involves risk of loss — use at your own discretion and never trade more than you can afford to lose.

pragma is an [OpenClaw](https://openclaw.ai) plugin that turns OpenClaw agents into on-chain trading agents. Swap tokens, trade perpetuals, scalp memecoins, analyze markets, and run autonomous trading agents — all through natural conversation.

**Currently live on [Monad](https://monad.xyz).** Built with [MetaMask Smart Accounts Kit](https://docs.metamask.io/smart-accounts-kit/) and [x402](https://www.x402.org/) (pay-per-API-call with USDC — no keys to configure).

> **Headless by design.** pragma-openclaw runs on Linux servers without macOS, Touch ID, or Keychain. Session keys are stored as encrypted files. Delegations are approved through a web flow at [pr4gma.xyz](https://pr4gma.xyz) — the user signs with their passkey in the browser, and the agent retrieves the signed delegation via polling.

## Table of Contents

- [pragma vs pragma-openclaw](#pragma-vs-pragma-openclaw)
- [Features](#features)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Commands](#commands)
- [Modes](#modes)
- [Tools](#tools)
- [How It Works](#how-it-works)
  - [Architecture](#architecture)
  - [Session Keys](#session-keys)
  - [Delegations](#delegations)
  - [Web Delegation Flow](#web-delegation-flow)
  - [Autonomous Agents](#autonomous-agents)
  - [Security Model](#security-model)
  - [x402 Protocol](#x402-protocol)
- [Pricing](#pricing)
- [Requirements](#requirements)
- [Troubleshooting](#troubleshooting)
- [Acknowledgments](#acknowledgments)
- [Support](#support)
- [License](#license)

---

## pragma vs pragma-openclaw

pragma exists as two plugins for two different agent runtimes. Same wallet, same tools, different platforms.

|                        | pragma (Claude Code)               | pragma-openclaw (OpenClaw)                |
| ---------------------- | ---------------------------------- | ----------------------------------------- |
| **Runtime**            | Claude Code CLI / Desktop / Cowork | OpenClaw                                  |
| **Platform**           | macOS only                         | Linux servers (headless)                  |
| **Key storage**        | macOS Keychain + Touch ID          | File-based (`~/.pragma/session-key.json`) |
| **Delegation signing** | Touch ID (local biometric)         | Web approval at pr4gma.xyz                |
| **Autonomous agents**  | Claude Code agent teams            | OpenClaw `sessions_spawn`                 |
| **Package**            | `pragma` (Claude Code marketplace) | `pragma-openclaw` (npm)                   |
| **MCP bridge**         | Native (runs MCP server directly)  | Child process (stdio transport)           |

If you're on macOS and using Claude Code, use [pragma](https://github.com/s0nderlabs/pragma). If you're running OpenClaw agents on a server, you're in the right place.

---

## Features

**Trading**

- Token swaps via DEX aggregator (best route, batch support)
- Perpetual futures on [LeverUp](https://leverup.xyz) (up to 1001x leverage, 20 pairs)
- Memecoin trading on [nad.fun](https://nad.fun) bonding curves
- Wrapping and transfers

**Market Intelligence**

- OHLCV charts from Pyth oracles (all timeframes)
- Economic calendar, central bank speeches, critical news
- Currency strength matrix, FX reference rates
- Funding rates, open interest, squeeze detection

**Autonomous Trading**

- Three specialized agents: Kairos (perps), Thymos (memecoins), Pragma (general)
- Background trading via OpenClaw `sessions_spawn`
- On-chain budget enforcement via smart contract caveats
- Multi-agent coordination with independent wallets

**On-Chain Analysis**

- Transaction decoding and explanation
- Contract analysis (ABI, proxy detection, security notes)
- Activity history with token flow tracking

---

## Installation

Install via OpenClaw CLI:

```bash
openclaw plugins install pragma-openclaw
```

On first load, the plugin automatically:

1. Creates a session key at `~/.pragma/session-key.json` (secp256k1, `0600` permissions)
2. Creates a config at `~/.pragma/config.json` (Monad mainnet, chainId 143)
3. Spawns the pragma MCP server as a child process
4. Discovers and registers all available tools with the OpenClaw API

Then run setup through the agent:

```
Set up pragma
```

The agent will guide you through linking your Smart Account and creating a trading delegation.

### Plugin Configuration

Optional settings in your OpenClaw config:

```json
{
  "plugins": {
    "pragma-openclaw": {
      "mode": "x402",
      "configPath": "~/.pragma/config.json",
      "sessionKeyPath": "~/.pragma/session-key.json"
    }
  }
}
```

| Option           | Default                      | Description                                                   |
| ---------------- | ---------------------------- | ------------------------------------------------------------- |
| `mode`           | `x402`                       | API mode: `x402` (paid) or `byok` (free, bring your own keys) |
| `configPath`     | `~/.pragma/config.json`      | Path to pragma config file                                    |
| `sessionKeyPath` | `~/.pragma/session-key.json` | Path to session key file                                      |

---

## Quick Start

Once set up, just talk to the agent:

```
What's my balance?
```

```
Swap 1 MON for USDC
```

```
Show me the BTC chart on the 4H timeframe
```

```
Open a 10x long on ETH with 5 LVUSD margin, SL at $2,200
```

```
What's trending on nad.fun?
```

```
Run kairos with $50 budget for 7 days — trade perps, focus on macro setups
```

pragma activates automatically when you mention anything related to trading, wallets, tokens, or on-chain operations.

---

## Commands

| Skill               | Description                                   |
| ------------------- | --------------------------------------------- |
| `pragma-setup`      | First-time onboarding and wallet setup        |
| `pragma-delegation` | Create, renew, and manage trading delegations |
| `pragma-core`       | Trading, market intelligence, wallet ops      |
| `pragma-autonomous` | Background agent trading with sub-agents      |
| `pragma-mode`       | Switch between BYOK and x402 modes            |

For everything else — swaps, transfers, balances, trading — just describe what you want in plain English. Skills activate automatically based on intent.

---

## Modes

pragma operates in two modes.

### x402 Mode (Default)

Pay-per-API-call using USDC from your session key. No API keys to configure — everything works out of the box.

New wallets get **50 free API calls** to bootstrap (enough to swap MON for USDC and fund your session key). After that, calls cost fractions of a cent each.

### BYOK Mode (Free)

Bring Your Own Keys. You provide RPC, bundler, quote, and data API endpoints. The plugin is free — you only pay your own API providers.

---

## Tools

pragma provides **54+ MCP tools** across 12 categories, bridged from the pragma-mcp server to the OpenClaw API.

| Category    | Tools | Description                                                                             |
| ----------- | ----- | --------------------------------------------------------------------------------------- |
| Setup       | 4     | Wallet setup, mode switching, provider config                                           |
| Balance     | 3     | Token balances, portfolio, account info                                                 |
| Tokens      | 2     | Token lookup, verified token list                                                       |
| Trading     | 2     | DEX quotes (single + batch), swap execution                                             |
| Transfers   | 3     | Send tokens, wrap/unwrap MON                                                            |
| Session Key | 3     | Gas funding, balance check, withdrawal                                                  |
| Blockchain  | 2     | Block info, gas price                                                                   |
| Analysis    | 3     | Transaction decoding, activity history, contract analysis                               |
| nad.fun     | 7     | Status, discover, quote, buy, sell, positions, token info                               |
| LeverUp     | 12    | Pairs, positions, quotes, open/close, margin, TP/SL, limit orders, stats, funding rates |
| Market      | 8     | Charts, economic events, news, FX rates, currency strength, CB speeches                 |
| Delegation  | 4     | Web-based delegation request, poll, retrieve, session setup                             |
| Sub-Agents  | 8     | Create, fund, revoke, status, journal, wallet pool                                      |

**Blocked tools:**

| Tool | Why Blocked | Alternative |
|------|-------------|-------------|
| `create_root_delegation` | Requires passkey signing via macOS Touch ID (`pragma-signer` binary). The delegation struct must be signed by the P-256 passkey stored in macOS Keychain — there's no headless equivalent for this signature type. | Use `request_delegation` → web approval at pr4gma.xyz (user signs with passkey in browser) |
| `nadfun_create` | Deploying a new token on nad.fun requires a direct passkey signature from the smart acco

... (truncated)
tools

Comments

Sign in to leave a comment

Loading comments...