npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

seim0

v1.2.6

Published

Decentralized Memory Layer on Sei Blockchain

Readme

Seim0 - Decentralized Memory Layer on Sei Blockchain

Seim0 is a revolutionary memory layer that stores AI memories directly on the Sei blockchain, ensuring decentralized, immutable, and globally accessible memory storage. Built on top of Sei's high-performance EVM-compatible blockchain, Seim0 combines the power of decentralized storage with IPFS for content and smart contracts for indexing.

🌟 Features

  • 🔗 Blockchain-Native: Memories stored directly on Sei blockchain with immutable transaction hashes
  • 📡 IPFS Integration: Content stored on IPFS for decentralized, censorship-resistant access
  • ⚡ High Performance: Built on Sei's optimized blockchain for fast transaction processing
  • 🔍 Smart Contract Indexing: Efficient memory discovery through on-chain smart contracts
  • 💰 Cost Effective: Leverages Sei's low transaction costs for affordable memory operations
  • 🛡️ Decentralized: No central authority - your memories are truly yours
  • 🔐 Cryptographic Security: All operations secured by blockchain cryptography

📦 Installation

npm install seim0

🚀 Quick Start

1. Setup Environment

Create a .env file in your project root:

PINATA_API_KEY=your_pinata_api_key
PINATA_SECRET_KEY=your_pinata_secret_key

# Required for on-chain transactions
PRIVATE_KEY=your_wallet_private_key
GOOGLE_API_KEY="your_gemini_or_openai_api_key"

2. Basic Usage

import { MemoryClient } from "seim0";
import { ethers } from "ethers";

const provider = new ethers.providers.JsonRpcProvider(
  "https://evm-rpc-testnet.sei-apis.com",
);

const signer = new ethers.Wallet(process.env.PRIVATE_KEY, provider);

const memory = new MemoryClient({
  network: "testnet",
  signer: signer,
  llm: {
    provider: "google",
    config: {
      apiKey: process.env.GOOGLE_API_KEY,
      model: "gemini-2.0-flash",
    },
  },
  embedder: {
    provider: "google",
    config: {
      apiKey: process.env.GOOGLE_API_KEY,
      model: "text-embedding-004",
    },
  },
});

3. Adding Memories

// Add a memory to the blockchain
const conversation = [
  {
    role: "user" as const,
    content:
      "Hi, I'm David and I work as a blockchain developer at Ethereum Foundation. I specialize in smart contract security and love DeFi protocols.",
  },
  {
    role: "assistant" as const,
    content:
      "Nice to meet you David! Smart contract security is crucial in DeFi. What are your favorite protocols to work with?",
  },
  {
    role: "user" as const,
    content:
      "I really enjoy working with Uniswap and Compound. I also contribute to OpenZeppelin's security audits on weekends.",
  },
];

const addResult = await memory.add(conversation, {
  user_id: "david_blockchain_dev",
  agent_id: "sei-assistant",
  run_id: "onboarding-001",
  metadata: { topic: "intro", project: "sei_memory_test" },
});

console.log("Memory stored on blockchain!");
console.log("Transaction Hash:", addResult.txHash);
console.log("IPFS CID:", addResult.cid);

4. Searching Memories

// Search memories on the blockchain
const searchResults = await memory.search("What do you know about me?", {
  user_id: "david_blockchain_dev",
  agent_id: "sei-assistant", // optional
  run_id: "onboarding-001", // optional
  limit: 3,
});

console.log(`Found ${searchResults.length} memories:`);
searchResults.forEach((memory, index) => {
  console.log(`${index + 1}. ${memory.memory}`);
});

5. Getting All Memories

// Get all memories for a user
const allUserMemories = await memory.getAll({
  user_id: "david_blockchain_dev",
});
// Get all memories for a user for a specific agent
const agentMemories = await memory.getAll({
  user_id: "david_blockchain_dev",
  agent_id: "sei-assistant",
});
// Get all memories for a specific conversation/run
const runMemories = await memory.getAll({
  user_id: "david_blockchain_dev",
  run_id: "onboarding-001",
});
// Narrow to a specific agent + run
const scopedMemories = await memory.getAll({
  user_id: "david_blockchain_dev",
  agent_id: "sei-assistant",
  run_id: "onboarding-001",
});

console.log(
  `Totals: user=${allUserMemories.length}, agent=${agentMemories.length}, run=${runMemories.length}, scoped=${scopedMemories.length}`,
);

🧭 Scoped Organization (user_id, agent_id, run_id)

All writes go on-chain/IPFS. Use the trio of identifiers to control organization and retrieval.

// Store with full context
await memory.add("User prefers vegetarian food", {
  user_id: "alice",
  agent_id: "diet-assistant",
  run_id: "consultation-001",
});

// Retrieve memories with different scopes
const allUser = await memory.getAll({ user_id: "alice" });
const byAgent = await memory.getAll({
  user_id: "alice",
  agent_id: "diet-assistant",
});
const byRun = await memory.getAll({
  user_id: "alice",
  run_id: "consultation-001",
});
const agentRun = await memory.getAll({
  user_id: "alice",
  agent_id: "diet-assistant",
  run_id: "consultation-001",
});

// Search with context
const general = await memory.search("What do you know about me?", {
  user_id: "alice",
});
const agentSearch = await memory.search("What do you know about me?", {
  user_id: "alice",
  agent_id: "diet-assistant",
});
const runSearch = await memory.search("What do you know about me?", {
  user_id: "alice",
  run_id: "consultation-001",
});

🔧 Configuration

That's it! The package automatically handles:

Network Selection: Just specify "testnet" or "mainnet"
Smart Contracts: Pre-deployed contracts are used automatically
IPFS Gateway: Your Pinata credentials are used for storage
Blockchain RPC: Optimal RPC endpoints are selected automatically

No contract addresses, no RPC URLs, no complex setup needed!

🏗️ Architecture

Seim0 uses a multi-layered architecture:

  1. Smart Contracts: Pre-deployed contracts handle:

    • Memory indexing and metadata management
    • Access control and permissions
    • Transaction fees and payments
  2. IPFS Storage: Your Pinata account stores:

    • Decentralized content storage
    • Immutable content addressing
    • Global accessibility
  3. Blockchain Integration: Sei testnet/mainnet provides:

    • Fast transaction processing
    • Immutable transaction history
    • Cryptographic verification

�️ Development

Building the Project

npm run build

Running Examples

npm run sei:example

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License.

🆘 Getting Help

If you have any questions or need assistance: