bray CLAUDE.md

Project instructions for bray, an MCP server that gives AI agents Nostr identities. Nostr is a decentralized messaging protocol, and the project includes tools for identity, trust, and relay operations.

In plain words
What is it for?
Use them to build, test, lint, start, and modify bray, including its TypeScript handlers, identity management, trust checks, and relay connections.
Why use it?
They explain the project's commands, architecture, dependencies, tests, and required secrets so code changes follow its established design.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/forgesworn/bray/claude-md
Clone the repo
git clone --depth 1 https://github.com/forgesworn/bray
Per session 1,049 This file is loaded in full into every session.
When invoked 1,049 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01049 $0.01049
Opus 5 $0.00524 $0.00524
Sonnet 5 $0.00210 $0.00210
Haiku 4.5 $0.00105 $0.00105

Measured 2d ago against content hash e351af28ee96, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

bray CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 67 lines

How it starts

The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md — nostr-bray

MCP server giving AI agents sovereign Nostr identities. 238 tools across 27 groups.

Commands

  • npm run build — compile TypeScript to dist/
  • npm test — run all tests (vitest, 1098 tests)
  • npm run test:watch — watch mode
  • npm run lint — type-check without emitting (tsc --noEmit)
  • npm start — run the MCP server (requires NOSTR_SECRET_KEY + NOSTR_RELAYS)
  • node dist/cli.js --help — CLI help

Architecture

Single-process MCP server. Entry points:

  • src/index.ts — MCP server (config → IdentityContext → RelayPool → tool registration → transport)
  • src/cli.ts — CLI wrapper (same handlers, no MCP)

Central spine: IdentityContext in src/context.ts manages the nsec-tree root, LRU identity cache with cryptographic zeroing, and signing. TrustContext in src/trust-context.ts aggregates trust signals across verification (Signet), proximity (WoT), and access (Dominion) dimensions.

Handler extraction pattern: Each tool group has:

  • src/<group>/handlers.ts — pure logic functions (testable without MCP)
  • src/<group>/tools.ts — Zod schemas + server.registerTool() wiring
  • test/<group>/handlers.test.ts — unit tests for handlers

Source directories (16): identity/, social/ (includes blossom, dm, groups, nips, notifications), trust/, relay/, zap/, safety/, signet/, vault/, util/, workflow/ (trust-score, feed-discover, verify-person, identity-setup, identity-recover, relay-health), dispatch/ (13 tools: send, check, reply, ack, status, cancel, refuse, failure, query, propose, capability-publish, capability-discover, capability-read), handler/, marketplace/, moderation/, privacy/, widgets/. The 27 user-facing groups in README/llms.txt split social/ into sub-groups (dm, blossom, articles, calendar, badges, communities, groups, wiki, search, scheduling, community NIPs).

Shared modules:

  • src/config.ts — env var + file secret loading, format detection
  • src/relay-pool.ts — relay connections with SOCKS5h proxy, write queue, Tor policy
  • src/nip65.ts — NIP-65 relay list fetch with signature verification + TTL cache
  • src/validation.ts — Zod validators (hexId, relayUrl)

Read the full file on GitHub · 67 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 67 lines · 1,049 tokens per session scan A e351af28ee96

Subscribe to this mod's changes

bray CLAUDE.md is an instructions file published in the GitHub repository forgesworn/bray (1 stars, last pushed 9d ago), licensed MIT. It adds 1,049 tokens to every session, about $0.0052 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.