coderClaw

Nostr

Status: Optional plugin (disabled by default).

Nostr is a decentralized protocol for social networking. This channel enables CoderClaw to receive and respond to encrypted direct messages (DMs) via NIP-04.

Install (on demand)

Install defaults:

You can always override the choice in the prompt.

Manual install

coderclaw plugins install @coderclaw/nostr

Use a local checkout (dev workflows):

coderclaw plugins install --link <path-to-coderclaw>/extensions/nostr

Restart the Gateway after installing or enabling plugins.

Quick setup

  1. Generate a Nostr keypair (if needed):
# Using nak
nak key generate
  1. Add to config:
{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}"
    }
  }
}
  1. Export the key:
export NOSTR_PRIVATE_KEY="nsec1..."
  1. Restart the Gateway.

Configuration reference

Key Type Default Description
privateKey string required Private key in nsec or hex format
relays string[] ['wss://relay.damus.io', 'wss://nos.lol'] Relay URLs (WebSocket)
dmPolicy string pairing DM access policy
allowFrom string[] [] Allowed sender pubkeys
enabled boolean true Enable/disable channel
name string - Display name
profile object - NIP-01 profile metadata

Profile metadata

Profile data is published as a NIP-01 kind:0 event. You can manage it from the Control UI (Channels -> Nostr -> Profile) or set it directly in config.

Example:

{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}",
      "profile": {
        "name": "coderclaw",
        "displayName": "CoderClaw",
        "about": "Personal assistant DM bot",
        "picture": "https://example.com/avatar.png",
        "banner": "https://example.com/banner.png",
        "website": "https://example.com",
        "nip05": "[email protected]",
        "lud16": "[email protected]"
      }
    }
  }
}

Notes:

Access control

DM policies

Allowlist example

{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}",
      "dmPolicy": "allowlist",
      "allowFrom": ["npub1abc...", "npub1xyz..."]
    }
  }
}

Key formats

Accepted formats:

Relays

Defaults: relay.damus.io and nos.lol.

{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}",
      "relays": ["wss://relay.damus.io", "wss://relay.primal.net", "wss://nostr.wine"]
    }
  }
}

Tips:

Protocol support

NIP Status Description
NIP-01 Supported Basic event format + profile metadata
NIP-04 Supported Encrypted DMs (kind:4)
NIP-17 Planned Gift-wrapped DMs
NIP-44 Planned Versioned encryption

Testing

Local relay

# Start strfry
docker run -p 7777:7777 ghcr.io/hoytech/strfry
{
  "channels": {
    "nostr": {
      "privateKey": "${NOSTR_PRIVATE_KEY}",
      "relays": ["ws://localhost:7777"]
    }
  }
}

Manual test

  1. Note the bot pubkey (npub) from logs.
  2. Open a Nostr client (Damus, Amethyst, etc.).
  3. DM the bot pubkey.
  4. Verify the response.

Troubleshooting

Not receiving messages

Not sending responses

Duplicate responses

Security

Limitations (MVP)