lightning-memory

A local memory system for AI agents that stores and searches information, using Nostr keys for identity and the Lightning Network for optional paid access. Nostr is a decentralized messaging protocol, while Lightning enables small Bitcoin payments.

In plain words
What is it for?
Use it to save, search, retrieve, and manage agent memories through an MCP connection. MCP is a standard way for tools to connect to applications such as Claude Code, Cursor, and Windsurf.
Why use it?
It lets agents recall past information such as purchases, vendors, and spending without relying on a remote embedding service by default. It can also share memories through Nostr relays or charge for access through Lightning.

Skill for Claude CodeCodex

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 skills/singularityjason/lightning-memory/openclaw-skill
Any agent
npx skills add singularityjason/lightning-memory --skill openclaw-skill
Clone the repo
git clone --depth 1 https://github.com/singularityjason/lightning-memory

Made for: Claude Code, Codex.

Per session 19 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 527 The whole file, excluding the scripts and references it only reads on demand.
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.00019 $0.00527
Opus 5 $0.00010 $0.00264
Sonnet 5 $0.00004 $0.00105
Haiku 4.5 $0.00002 $0.00053

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

Security

Grade A, and why

lightning-memory 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.

openclaw-skill/SKILL.md · 73 lines

What it actually says

Lightning Memory

Decentralized agent memory for the Lightning economy. Store, query, and recall memories with cryptographic identity (Nostr) and micropayments (Lightning/L402).

Installation

pip3 install lightning-memory

No API keys required. Runs fully local by default. Optional Nostr relay sync and Lightning L402 gateway for decentralized/paid access.

What It Does

AI agents can transact via Lightning (L402) but can't remember what they paid for, which vendors are reliable, or their spending patterns. Lightning Memory fixes this:

  • Cryptographic identity via Nostr keypairs — memories are signed and verifiable
  • Semantic search with local ONNX embeddings (no API calls)
  • Nostr relay sync — memories replicate across relays using NIP-78 events
  • L402 payment gateway — sell memory access via Lightning micropayments with macaroon auth
  • MCP server — works with Claude Code, Cursor, Windsurf, and any MCP client

MCP Tools (7 tools)

Tool Purpose
store_memory Store a memory with content, tags, and metadata
query_memories Semantic search across stored memories
get_memory Retrieve a specific memory by ID
list_memories List recent memories with optional filters
delete_memory Remove a memory by ID
get_identity Get the current Nostr identity (npub)
sync_status Check Nostr relay sync status

Quick Start

from lightning_memory import MemoryStore

store = MemoryStore()
store.add("Vendor X charges 50 sats for image gen, quality 8/10")
results = store.query("reliable image generation vendors")

MCP Server

python -m lightning_memory.server

Or add to your MCP client config:

{
  "lightning-memory": {
    "command": "python3",
    "args": ["-m", "lightning_memory.server"]
  }
}
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 · 73 lines · 19 tokens per session scan A 909f209da617

Subscribe to this mod's changes

lightning-memory is a skill published in the GitHub repository singularityjason/lightning-memory (9 stars, last pushed 5mo ago), licensed MIT. It adds 19 tokens to every session and 527 once invoked, about $0.0001 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.