The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Lightning Memory listing page.
Persistent memory for AI agents in the Lightning economy.
AI agents spend sats over Lightning via L402 — but they can't remember what they bought. Every session starts from zero. Every vendor is a stranger. Every price is accepted at face value. An agent that paid 500 sats yesterday doesn't know if today's 5,000 sat invoice is a price spike or normal.
Lightning Memory gives agents persistent memory, vendor intelligence, and payment safety gates. Agents learn from their spending history, track vendor reputations, detect price anomalies, enforce budgets, and share trust signals with other agents.
Interactive Demo — watch an agent learn, get rugged, and route around bad actors.
Building the Agent Economy — trust, budgets, compliance, and the memory marketplace.
| Feature | Lightning Memory | Mem0 | Raw file storage | No memory |
|---|---|---|---|---|
| Lightning/L402 awareness | Yes | No | No | No |
| Vendor reputation tracking | Yes | No | Manual | No |
| Spending anomaly detection | Yes | No | No | No |
| Nostr identity (BIP-340) | Yes | No | No | No |
| Relay sync (NIP-78) | Yes | No | No | No |
| Full-text + semantic search | Yes | Yes | No | No |
| Agent-to-agent knowledge markets | Yes (L402 gateway) | No | No | No |
| Budget enforcement | Yes | No | No | No |
| KYC/trust profiles | Yes | No | No | No |
| Payment pre-flight gate | Yes | No | No | No |
| Contradiction detection | Yes | No | No | No |
| Local-first / offline | Yes | Cloud | Yes | N/A |
| MCP native | Yes | Plugin | No | No |
| Zero config | Yes | API key required | Manual setup | N/A |
| Tool | Description |
|---|---|
memory_store | Store a memory (transaction, vendor, preference, error, decision) |
memory_query | Search by relevance (FTS5 + optional semantic search) |
memory_list | List memories with type/time filters |
memory_edit | Edit content or metadata with audit trail |
memory_sync | Sync with Nostr relays (push/pull) |
memory_export | Export as NIP-78 Nostr events |
| Tool | Description |
|---|---|
ln_vendor_reputation | Reputation score from transaction history |
ln_spending_summary | Spending breakdown by vendor and protocol |
ln_anomaly_check | Detect if a payment is abnormally high |
| Tool | Description |
|---|---|
ln_preflight | Pre-flight gate: budget + anomaly + trust check before payment |
ln_budget_set | Set per-vendor spending limits (per txn, per day, per month) |
ln_budget_check | Check spending against limits |
ln_budget_status | Gateway earnings and L402 payment stats |
| Tool | Description |
|---|---|
ln_vendor_trust | Full trust profile (KYC + reputation + community score) |
ln_trust_attest | Publish NIP-85 trust attestation to Nostr relays |
ln_agent_attest | Store a KYA (Know Your Agent) attestation |
ln_agent_verify | Look up an agent's compliance status |
ln_auth_session | Store LNURL-auth session records |
ln_auth_lookup | Look up LNURL-auth sessions |
ln_compliance_report | Generate structured compliance export |
| Tool | Description |
|---|---|
ln_discover_gateways | Find remote Lightning Memory gateways via Nostr |
ln_remote_query | Query a remote gateway via L402 micropayment |
Run an L402 pay-per-query HTTP gateway. Other agents pay Lightning micropayments to access your agent's memory — no API keys, no accounts.
| Endpoint | Method | Price | Description |
|---|---|---|---|
/info | GET | Free | Gateway status, pricing, node info |
/health | GET | Free | Health check |
/memory/store | POST | 3 sats | Store a memory |
/memory/query | GET | 2 sats | Search memories by relevance |
/memory/list | GET | 1 sat | List memories with filters |
/ln/vendor/{name} | GET | 3 sats | Vendor reputation report |
/ln/spending | GET | 2 sats | Spending summary |
/ln/anomaly-check | POST | 3 sats | Payment anomaly detection |
/ln/preflight | POST | 3 sats | Pre-flight payment gate |
/ln/trust/{name} | GET | 2 sats | Vendor trust profile |
/ln/budget | GET | 1 sat | Budget rules and spending |
/ln/compliance-report | GET | 10 sats | Compliance report export |
localhost:9740)~/.lightning-memory/config.json → {"phoenixd_password": "<from ~/.phoenix/phoenix.conf>"}lightning-memory-gatewayDefault relays: wss://relay.damus.io, wss://nos.lol, wss://relay.nostr.band
Customize in ~/.lightning-memory/config.json:
| Relay | Speed | Reliability | Notes |
|---|---|---|---|
wss://relay.damus.io | Fast | High | Most popular, good uptime |
wss://nos.lol | Fast | High | Reliable, good NIP-78 support |
wss://relay.nostr.band | Medium | Medium | Search-focused, may be slow |
wss://relay.primal.net | Fast | High | Well-maintained |
wss://nostr.wine | Fast | High | Paid relay, less spam |
Add ONNX-based semantic similarity search alongside FTS5 keyword search:
Queries then use hybrid ranking: FTS5 BM25 + cosine similarity with reciprocal rank fusion. "Which vendors are reliable for transcription" matches memories containing "whisper API" and "audio-to-text" even without exact keyword overlap.
MIT