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

@cmdoss/memwal-sdk

v0.6.2

Published

TypeScript SDK for Personal Data Wallet - Decentralized memory system with AI embeddings, HNSW vector search, SEAL encryption and Walrus storage

Downloads

281

Readme

@cmdoss/memwal-sdk

npm version License: MIT

MemWal (Memory + Walrus) - TypeScript SDK for decentralized memory storage on Sui blockchain with Walrus.

Installation

npm install @cmdoss/memwal-sdk @mysten/sui

Quick Start

Node.js (with Keypair)

import { SimplePDWClient } from '@cmdoss/memwal-sdk';
import { Ed25519Keypair, decodeSuiPrivateKey } from '@mysten/sui/keypairs/ed25519';

// Setup keypair
const { secretKey } = decodeSuiPrivateKey(process.env.SUI_PRIVATE_KEY!);
const keypair = Ed25519Keypair.fromSecretKey(secretKey);

// Initialize client
const pdw = new SimplePDWClient({
  signer: keypair,
  network: 'testnet',
  packageId: process.env.PACKAGE_ID!,
  embedding: {
    provider: 'openrouter',
    apiKey: process.env.OPENROUTER_API_KEY!,
  }
});

await pdw.ready();

// Create memory
const memory = await pdw.memory.create('I work at CommandOSS as a developer');
console.log('Memory ID:', memory.id);

// Search memories
const results = await pdw.search.vector('work experience', { limit: 5 });

Browser (with dapp-kit + Slush/Sui Wallet)

import { DappKitSigner, SimplePDWClient } from '@cmdoss/memwal-sdk/browser';
import { useCurrentAccount, useSignAndExecuteTransaction, useSuiClient } from '@mysten/dapp-kit';

function MyComponent() {
  const account = useCurrentAccount();
  const suiClient = useSuiClient();
  const { mutateAsync: signAndExecute } = useSignAndExecuteTransaction();

  const handleSave = async () => {
    // Create signer from dapp-kit hooks
    const signer = new DappKitSigner({
      address: account.address,
      client: suiClient,
      signAndExecuteTransaction: async ({ transaction }) => {
        const result = await signAndExecute({ transaction });
        return { digest: result.digest, effects: result.effects };
      },
    });

    // Initialize client
    const pdw = new SimplePDWClient({
      signer,
      network: 'testnet',
      userAddress: account.address,
      sui: { packageId: process.env.NEXT_PUBLIC_PACKAGE_ID! },
      features: { enableLocalIndexing: false }, // Disable for browser
    });

    // Create memory - wallet popup appears for signing
    const memory = await pdw.memory.create('Hello from browser!');
  };
}

Features

| Feature | Description | |---------|-------------| | Memory CRUD | Create, read, update, delete memories on Sui + Walrus | | Vector Search | Semantic search with HNSW (3072 dimensions) | | AI Classification | Auto-categorize memories (fact, event, preference, etc.) | | SEAL Encryption | Optional identity-based encryption | | Batch Upload | ~90% gas savings with Quilt batching | | Knowledge Graph | Entity and relationship extraction |

Environment Variables

SUI_PRIVATE_KEY=suiprivkey1...
PACKAGE_ID=0x...
OPENROUTER_API_KEY=sk-or-v1-...

# Optional
WALRUS_AGGREGATOR=https://aggregator.walrus-testnet.walrus.space
WALRUS_PUBLISHER=https://publisher.walrus-testnet.walrus.space

API Overview

// Memory operations
await pdw.memory.create(content, { category, importance });
await pdw.memory.createBatch([...contents]);
await pdw.memory.get(id);
await pdw.memory.delete(id);

// Search
await pdw.search.vector(query, { limit });
await pdw.search.byCategory('fact');
await pdw.search.hybrid(query, { category });

// AI
await pdw.ai.embed(text);
await pdw.ai.classify(content);
await pdw.ai.shouldSave(content);

// Knowledge Graph
await pdw.graph.extract(content);

Vector Search (HNSW)

The SDK uses HNSW for fast vector search:

| Implementation | Environment | Performance | |----------------|-------------|-------------| | hnswlib-node | Node.js | Fastest (native C++) | | hnswlib-wasm | Browser + Node.js | Good (fallback) |

The SDK auto-detects and uses the best available implementation.

For best performance in Node.js:

# Requires C++ build tools
npm install hnswlib-node

| Platform | Command | |----------|---------| | Windows | Install VS Build Tools with C++ workload | | macOS | xcode-select --install | | Linux | sudo apt-get install build-essential python3 |

Benchmarks

Tested on localhost with Option A+ (local content retrieval enabled):

| Operation | Time | Description | |-----------|------|-------------| | Vector Search + RAG | ~2.3s | Chat with semantic search | | Create Memory | ~2.3s | Classify + embed + upload + index | | AI Classification | ~2.3s | Categorize content | | Batch Upload (2 items) | ~2.3s | Quilt batching | | Blockchain Query | ~2.3s | List memories from Sui |

Average query time: ~2.3s (with OpenRouter API latency included)

Documentation

License

MIT