Skip to main content

🔧 Configuration

Every knob is an env var. Keys live in a project-root .env (git-ignored) - load it with dotenv (import 'dotenv/config' at the top of your script); explicit shell export still wins. Tests pin local-fs + keyword explicitly so they stay offline.

Engine selection

VarDefaultPurpose
MEMORY_ENGINEbatchedbatched or memwal (factory). Unknown values error out.
MEMORY_STORAGElh-ipfs-filecoinlh-ipfs-filecoin (filecoin alias), lh-ipfs-walrus (walrus alias), local-fs, s3
MEMORY_EMBEDDERlocallocal (MiniLM semantic) or keyword (word-match only; = embedder: null). Memwal needs none.
MEMORY_NAMESPACE / MEMORY_AGENTdefault / agentBatched namespace + agent tag
MEMORY_DIR./.memory-sdkBatched index + local-fs blob location
MEMORY_FLUSH_EVERY10Batch size before auto-flush (batched only, min 1)
MEMORY_NETWORK-Gateway variant for bare lighthouse storage kind

Memwal

VarDefaultPurpose
MEMWAL_PRIVATE_KEY / MEMWAL_ACCOUNT_ID- (required)Relayer delegate key + account
MEMWAL_NETWORKmainnetmainnet or testnet (staging relayer; creds are per-network)
MEMWAL_SERVER_URLper-network relayerOverride relayer URL
MEMWAL_NAMESPACE / MEMWAL_AGENTdefault / agentMemwal namespace + agent tag
MEMWAL_MEMORY_DIR./.memory-sdk/memwalMemwal index dir
MEMWAL_REMEMBER_TIMEOUT_MS60000rememberAndWait timeout
MEMWAL_IPFS_PIN(pin)off skips IPFS pinning (local CIDs only)
MEMWAL_ANALYZE-1 enables the analyze() demo step in examples

Storage credentials

VarPurpose
LIGHTHOUSE_API_KEYLighthouse adapter (lh-*). Sui-wallet key for Walrus, any key for Filecoin. Optional for memwal (pins public IPFS mirrors).
S3_BUCKETRequired for s3
S3_REGION / AWS_REGIONS3 region
S3_ENDPOINTCustom endpoint (R2 / MinIO)
S3_PREFIXKey prefix (default memory-sdk)
S3_FORCE_PATH_STYLE1 for MinIO / R2
S3_PUBLIC_BASE_URLCDN base for gatewayUrl()
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEYS3 credentials

Minimal .env examples

# Batched on Filecoin (default durable)
LIGHTHOUSE_API_KEY=lh_...

# Batched on Walrus
MEMORY_ENGINE=batched
MEMORY_STORAGE=lh-ipfs-walrus
LIGHTHOUSE_API_KEY=lh_...

# Offline
MEMORY_ENGINE=batched
MEMORY_STORAGE=local-fs
MEMORY_EMBEDDER=keyword

# Memwal testnet
MEMWAL_PRIVATE_KEY=<hex-delegate-key>
MEMWAL_ACCOUNT_ID=0x...
MEMWAL_NETWORK=testnet
LIGHTHOUSE_API_KEY=lh_... # optional pinning