Skip to main content

Overview

The OpenAgents CLI exposes offline Nostr utilities. You can:
  • generate and derive NIP-06 keypairs and BIP39 seeds
  • encode/decode NIP-19 entities and NIP-21 nostr: URIs
  • sign, verify, hash, serialize, and validate NIP-01 events
  • encrypt/decrypt payloads (NIP-04 / NIP-44)
  • create/validate delegation and auth helpers (NIP-26 / NIP-42 / NIP-98)
  • encrypt/decrypt private keys (NIP-49)
  • parse and verify NIP-05 identifiers
  • inspect proof-of-work (NIP-13)
All commands live under the nostr namespace of the OpenAgents CLI.

Nostr in OpenAgents

Nostr is the protocol layer for decentralized coordination in OpenAgents. It provides cryptographic identity and a relay-based pub/sub fabric for agent workflows like job requests, results, and capability discovery. Autopilot Desktop currently connects to Codex for run execution, while Nostr is already wired into protocol and market components for marketplace and relay flows. This page documents the offline CLI surface (no relay connections or WebSocket subscriptions). For the broader protocol design, see:

Protocol snapshot (OpenAgents view)

  • NIP-01: base events, relays, subscriptions
  • NIP-42: relay auth to prevent anonymous spam
  • NIP-44: encrypted payloads for sensitive data
  • NIP-89: provider capability discovery
  • NIP-90: job request/result flow (kinds 5050/6050/7000)
  • NIP-57: Lightning payments tied to events
  • NIP-34: Git collaboration (GitAfter)
  • NIP-SA: proposed agent lifecycle events (profiles, ticks, trajectories)
The CLI implements offline helpers for NIP-01/04/05/06/13/19/21/26/42/44/49/98.

CLI entrypoints

The CLI ships two binaries that behave the same:
  • openagents
  • oa
Examples below use oa. If you are running from source:

Command map

  • oa nostr new|derive|seed|pubkey|encode|decode
  • oa nostr event sign|verify|hash|validate|serialize|kind
  • oa nostr nip19 encode|decode
  • oa nostr uri encode|decode|strip
  • oa nostr nip04 encrypt|decrypt
  • oa nostr nip44 encrypt|decrypt
  • oa nostr nip26 create|verify|validate
  • oa nostr nip42 auth|validate
  • oa nostr nip49 encrypt|decrypt
  • oa nostr nip98 create|validate|decode
  • oa nostr nip05 parse|well-known|verify
  • oa nostr pow difficulty|check|nonce

Key generation and identity (NIP-06)

Create a new mnemonic + keypair

Options:
  • --words 12|24 (default: 12)
  • --account <n> (derivation path: m/44'/1237'/<account>'/0/0)
  • --agent <n> (maps to account = agent + 1)
  • --passphrase "..." (optional BIP39 passphrase)
  • --no-mnemonic (hide mnemonic in output)
  • --json (structured output)
To avoid printing the mnemonic in logs or terminals:

Derive from an existing mnemonic

Or via stdin:
Options:
  • --mnemonic "..." or --stdin (required)
  • --account <n>
  • --agent <n> (maps to account = agent + 1)
  • --passphrase "..."
  • --show-mnemonic
  • --json

Derive public key from a secret

Or with nsec:

Bech32 encoding/decoding (NIP-19)

Encode npub/nsec

Inputs must be 32-byte hex values (64 hex characters). You may provide only --public or only --private.

Decode npub/nsec

You may provide only --npub or only --nsec.

Encode other NIP-19 entities

Supported entity types: npub, nsec, note, nprofile, nevent, naddr.

Decode any NIP-19 entity

nostr: URI helpers (NIP-21)

Events (NIP-01)

Sign an event

You can also pass a full template JSON:

Verify an event

Hash/serialize/validate

Classify event kind

Encryption (NIP-04 / NIP-44)

NIP-04 (AES-CBC) encrypted DMs:
NIP-44 v2 encryption:
Public keys can be provided as 32-byte hex (x-only), 33-byte compressed hex, or 65-byte uncompressed hex. The CLI accepts --pubkey or --npub.

Delegation (NIP-26)

Relay auth events (NIP-42)

Private key encryption (NIP-49)

HTTP auth events (NIP-98)

NIP-05 helpers

The CLI does not fetch .well-known/nostr.json. Provide the response JSON:

Proof-of-work (NIP-13)

Output format

With --json, output is stable and machine-readable. Example from nostr new:
Example from nostr seed:

Security notes

  • Mnemonics and nsec values are full private keys. Store them securely.
  • --no-mnemonic is recommended when recording logs or terminals.
  • BIP39 passphrases change derived keys; keep them with the mnemonic.
  • The CLI is offline-only; it does not contact relays or external services.

NIP-06 compliance

The CLI derives keys according to NIP-06:
  • BIP39 mnemonic
  • Derivation path: m/44'/1237'/<account>'/0/0
npub/nsec are bech32 encodings per NIP-19.