Skip to content

Nostr

Nostr (Notes and Other Stuff Transmitted by Relays) is a decentralized social protocol that’s grown quickly as a censorship-resistant alternative to Twitter/X. It has no central server, no company, no content moderation beyond what individual relays choose to enforce. AI Butler’s Nostr adapter lets you receive and send NIP-04 encrypted direct messages, making it the first self-hosted AI agent on Nostr that you own end-to-end.

  • Receive NIP-04 encrypted DMs from any Nostr user
  • Reply with encrypted messages via your relay set
  • Multi-relay fan-out (publish to 3+ relays for reliability)
  • No rate limits imposed by a single company
  • Works with any Nostr client (Damus, Amethyst, Iris, Nostrudel, etc.)

If you don’t already have a Nostr identity:

Terminal window
# Use any Nostr client or CLI tool. For example, with noscl:
noscl key-gen
# Saves to ~/.config/noscl/config.json

Or copy your existing nsec (secret key) and npub (public key) from your Nostr client. Butler uses your nsec to sign outgoing messages and decrypt incoming DMs.

Nostr is only as reliable as the relays you use. Popular public relays:

  • wss://relay.damus.io
  • wss://nos.lol
  • wss://relay.nostr.band
  • wss://nostr.wine (paid, higher reliability)
  • wss://relay.primal.net

Recommendation: start with 3–5 relays. The adapter publishes to all of them in parallel and reads DMs from the union.

Terminal window
aibutler vault set nostr_nsec nsec1...your_secret_key

This is your signing key — treat it like a password. Anyone with your nsec can impersonate you on Nostr. The vault stores it encrypted at rest in your OS keyring.

configurations:
channels:
active:
- nostr
nostr:
relays:
- wss://relay.damus.io
- wss://nos.lol
- wss://relay.nostr.band
- wss://relay.primal.net
reconnect_interval: 30s
Terminal window
aibutler run

You should see log lines like:

nostr: connected to wss://relay.damus.io
nostr: connected to wss://nos.lol
nostr: subscribed to NIP-04 DMs for <your npub>
nostr: 4/4 relays connected

From any Nostr client:

  1. Find the bot’s npub (Butler prints it at startup, or run aibutler auth list)
  2. Send it an encrypted DM
  3. Butler decrypts, processes through the agent, and replies with an encrypted response to the same thread
FeatureSupported
NIP-04 encrypted DMs (receive)Yes
NIP-04 encrypted DMs (send)Yes
Multi-relay publishYes (fan-out to all configured relays)
Public notes (kind 1)No — Butler is DM-only for privacy
NIP-17 private DMs (newer spec)v0.2 roadmap
Reactions / zapsNo
Media attachments (NIP-94)No in v0.1 — text only

AI Butler on Nostr is intentionally limited to direct messages, not public kind-1 notes, for two reasons:

  1. Privacy — DMs are end-to-end encrypted (NIP-04), so only you and Butler can read them. Public notes are broadcast in plaintext.
  2. Trust model — a public AI bot that posts on Nostr would be fair game for prompt injection attacks from anyone who can reach the bot’s inbox. DM-only limits the attack surface to people who actively initiate the conversation.

If you want to publish public notes from Butler, write a plugin or subprocess bridge that explicitly calls the Nostr publish flow with clear capability gating.

“0/N relays connected”. Check that the relay URLs are valid WebSocket URLs (wss://, not https://), and that your network allows outbound WebSocket connections.

Messages received but no reply. Check the outbound publish result in logs. Some relays require proof-of-work (NIP-13), paid membership, or authentication (NIP-42) — the adapter doesn’t yet support all three. Stick to permissive public relays for v0.1.

Decryption fails on incoming DMs. NIP-04 encryption is strict about key formatting. Make sure the nsec in your vault is the canonical bech32-encoded format (starts with nsec1...), not a hex-encoded secret.