Skip to main content

🚀 Quick Start

Store and recall your first agent memory in a few minutes.

1. Get a Lighthouse API key

Sign in to the Lighthouse Files App and create an API key from the API Keys section. For Walrus-backed memory, sign in with your Sui wallet (see the IPFS Walrus quick start); for IPFS/Filecoin-backed memory any Lighthouse API key works.

info

Treat your API key like a password. Do not share it publicly or commit it to version control.

2. Install

npm install @lighthouse-web3/memory

Prefer to run from source? Clone lighthouse-web3/memory, then npm install and npm test (the test suite runs offline, no API key needed).

3. Store and recall a memory

import { Memory } from '@lighthouse-web3/memory'

const memory = Memory.fromEnv() // reads LIGHTHOUSE_API_KEY

// Store — buffers locally, flushes to the network in batches
await memory.remember(
'The user prefers TypeScript with strict mode and deploys to Vercel.',
{ tags: ['preference', 'deployment'] }
)

// Force pending memories onto the network now
const { cid, gatewayUrl } = await memory.flush()
console.log('Stored durably at:', gatewayUrl)

// Recall by meaning — no keyword overlap needed
const matches = await memory.recall('how does the user ship code?')
console.log(matches[0].content)

Run it:

LIGHTHOUSE_API_KEY=YOUR_API_KEY node your-agent.mjs

The first recall/remember downloads a small (~25 MB) embedding model once; it is cached afterwards and runs fully locally.

4. Connect an AI agent (MCP)

Give any MCP-capable agent persistent memory with one command — for example Claude Code:

claude mcp add lighthouse-memory \
--env LIGHTHOUSE_API_KEY=YOUR_API_KEY \
-- npx -y @lighthouse-web3/memory

Then just talk to the agent: "remember that our staging URL is …", "what do you know about my deployment setup?". See Connect Agents via MCP for the full tool list.

5. What's next?