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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tusk-memory

v1.1.0

Published

TypeScript SDK for decentralized shared agent memory and Walrus archival

Readme

tusk-memory

A production-ready, strongly-typed TypeScript SDK for decentralized multi-agent shared memory layers (powered by MemWal) and permanent report/artifact archiving (powered by Mysten Labs' Walrus Testnet).

This SDK is fully compatible with Node 18+ environments, including serverless environments and frameworks like Next.js (Server Actions, API Routes) or FastAPI/Node orchestrators. It has zero external runtime dependencies and uses native global fetch.

Features

  • Decentralized Whiteboard: Share state, context, and debates between multiple AI agents using a SUI-based vector database relayer (MemWal).
  • Indexing Lag Mitigation: Built-in local session memory buffer automatically merges write-operations with semantic query recalls so updates are immediately consistent for the active run context.
  • Permanent Archival: Upload structured executive summaries or markdown logs directly to the Walrus Testnet and retrieve them by their cryptographic Blob ID.
  • Strictly Typed: Full TypeScript support with exported types (Note, ArchiveRecord) and modern ES6 compilation outputs (ESM + CommonJS).

Installation

Install via npm:

npm install tusk-memory

Or via yarn/pnpm:

yarn add tusk-memory
# or
pnpm add tusk-memory

Quickstart

The following example demonstrates how to instantiate a Workspace, add agent debate notes, retrieve history, and archive final executive reports.

import { Workspace } from 'tusk-memory';

async function main() {
  // 1. Initialize a Workspace (maps to a MemWal namespace)
  // Optional: Provide a Bearer Token or API key as the second parameter if required by the relayer
  const workspace = new Workspace('sui-research', process.env.MEMWAL_API_KEY);

  console.log(`Initialized Workspace: ${workspace.getWorkspaceId()}`);

  // 2. Add notes to the whiteboard (simulating a Researcher and Risk Manager agent)
  await workspace.addNote({
    author: 'Researcher',
    note: 'Sui network transaction throughput exceeded 10k TPS with sub-second finality this week.',
  });

  await workspace.addNote({
    author: 'Risk_Manager',
    note: 'Double-check congestion fee scaling and validators stability under this peak load.',
  });

  // 3. Fetch whiteboard history (instantly merges remote history and local buffer)
  const history = await workspace.getHistory();
  console.log('--- Whiteboard History ---');
  for (const item of history) {
    console.log(`[${item.author}]: ${item.note}`);
  }

  // 4. Archive a structured executive report to Walrus
  const reportContent = `
# Sui peak transaction throughput analysis
Compiled by Investment Committee Writer Agent.

- **Catalyst**: Peak transaction throughput has crossed 10k TPS.
- **Counter-argument**: Potential validator fee spikes.
- **Thesis**: Bullish, pending verification of validator gas stabilization.
  `;

  // 4. Archive a structured executive report to Walrus (with custom epochs, e.g., 10)
  console.log('\nArchiving report to Walrus Testnet...');
  const blobId = await workspace.archiveReport(reportContent, 'Sui Peak TPS Debate', 10);
  console.log(`Report successfully archived! Permanent Blob ID: ${blobId}`);
}

main().catch(console.error);

API Reference

Workspace Class

new Workspace(workspaceId: string, apiKey?: string)

Creates a new workspace interface connected to a MemWal namespace.

  • workspaceId: The unique namespace ID for the memory index.
  • apiKey: (Optional) Bearer authentication token passed to the MemWal relayer.

workspace.addNote({ author: string, note: string }): Promise<void>

Adds a note to the workspace. The note is cached in the local memory buffer immediately and sent to MemWal.

workspace.getHistory(): Promise<Note[]>

Retrieves all historical notes. It queries the remote MemWal storage and merges it with any unsaved/un-indexed session notes, deduplicating using the (author, note) combination.

workspace.archiveReport(reportText: string, topic: string, epochs: number = 5): Promise<string>

Uploads the raw report text/markdown directly to the Walrus Testnet with a custom active storage duration (specified by the optional epochs parameter), receives the unique blobId, and adds a System_Archive indexing note to the workspace whiteboard containing the blobId and topic in JSON format.


Under the Hood Helper Utilities

For advanced control, you can import the underlying REST wrappers directly:

import { 
  saveMemory, 
  retrieveMemory, 
  uploadToWalrus, 
  fetchFromWalrus 
} from 'tusk-memory';
  • saveMemory(namespace, data, apiKey): POSTs to https://api.memwal.ai/v1/memory
  • retrieveMemory(namespace, apiKey): GETs from https://api.memwal.ai/v1/memory/{namespace}
  • uploadToWalrus(content, epochs = 5): PUTs to https://publisher.walrus-testnet.walrus.space/v1/blobs?epochs=${epochs} (defaulting to 5 epochs for extended storage)
  • fetchFromWalrus(blobId): GETs from https://aggregator.walrus-testnet.walrus.space/v1/blobs/{blobId}

License

MIT License. Built for the MemWal Hackathon.