Skip to content

TettoLabs/warmmemory-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@warmcontext/warmmemory-plugin

WarmMemory plugin for Tetto SDK - Universal memory for AI agents

The First Tetto Plugin!

Philosophy: Admirable simplicity. 4 methods. No bloat. Just what you need.


Quick Start

npm install tetto-sdk @warmcontext/warmmemory-plugin @solana/web3.js
import { TettoSDK, createWalletFromKeypair, getDefaultConfig } from 'tetto-sdk';
import { WarmMemoryPlugin } from '@warmcontext/warmmemory-plugin';
import { Keypair } from '@solana/web3.js';

// Setup
const wallet = createWalletFromKeypair(Keypair.fromSecretKey(/* ... */));
const tetto = new TettoSDK(getDefaultConfig('mainnet'));

// Load plugin
tetto.use(WarmMemoryPlugin);

// Use elegant API
await tetto.memory.set('preferences', { theme: 'dark' }, wallet);
const prefs = await tetto.memory.get('preferences', wallet);
console.log(prefs.theme); // 'dark' (auto-parsed!)

Features

  • 4 Core Operations: set, get, list, delete
  • Auto JSON Handling: Objects auto-stringify/parse
  • Temporal Context: Optional occurred_at, location, learned_from
  • Namespace Helper: Scoped operations for clean code
  • Type-Safe: Full TypeScript support
  • Tiny: <10KB package size

API Reference

set(key, value, wallet, options?)

Store a key-value pair.

// Simple
await tetto.memory.set('user:prefs', { theme: 'dark' }, wallet);

// With temporal context
await tetto.memory.set('sarah:allergy',
  { allergy: 'shellfish' },
  wallet,
  {
    occurred_at: '2025-10-31T19:30:00Z',
    location: 'Downtown restaurant',
    learned_from: 'conversation'
  }
);

get(key, wallet, options?)

Retrieve a value by key. Returns null if not found.

const prefs = await tetto.memory.get('user:prefs', wallet);
if (prefs) {
  console.log(prefs.theme); // Auto-parsed!
}

list(prefix, wallet, options?)

List keys by prefix with pagination.

// All keys
const { keys } = await tetto.memory.list('', wallet);

// With prefix
const { keys } = await tetto.memory.list('recipes:italian:', wallet);

// With pagination
const { keys, hasMore, cursor } = await tetto.memory.list('', wallet, { limit: 10 });

delete(key, wallet, options?)

Delete a key.

await tetto.memory.delete('old:data', wallet);

namespace(prefix)

Create scoped operations (perfect for WarmAnswers pattern).

const qa = tetto.memory.namespace('qa');
await qa.set('001', { q: '...', a: '...' }, wallet);
const all = await qa.list('', wallet);

Configuration

tetto.use(WarmMemoryPlugin, {
  agentId: 'warmmemory',        // Custom agent ID
  autoJsonParse: true,          // Auto-parse JSON (default: true)
  defaultLimit: 20,             // Default list limit (default: 20)
  name: 'memory'                // Custom property name (default: 'memory')
});

Use Cases

Personal Knowledge Base (WarmAnswers Pattern)

const qa = tetto.memory.namespace('qa');

// Teach
await qa.set('001',
  {
    question: 'What is my Wi-Fi password?',
    answer: 'Network2024'
  },
  wallet,
  {
    occurred_at: new Date().toISOString(),
    learned_from: 'explicit'
  }
);

// Ask (retrieve all, use Claude for matching)
const { keys } = await qa.list('', wallet);
const qaPairs = await Promise.all(
  keys.map(k => qa.get(k, wallet))
);
// Use Claude to find best match...

Recipe Storage (Hierarchical Keys)

const recipes = tetto.memory.namespace('recipes');

await recipes.set('italian:carbonara', {
  ingredients: ['eggs', 'bacon', 'pasta'],
  servings: 4
}, wallet);

// List all Italian recipes
const { keys } = await recipes.list('italian:', wallet);

Agent-to-Agent (Cross-Wallet)

// WarmAnswers storing in user's namespace
await tetto.memory.set(
  'qa:001',
  { q: '...', a: '...' },
  agentWallet,           // Agent pays
  { targetWallet: userWallet }  // User's data
);

Pricing

  • Price: $0.001 per operation
  • Operations: store, retrieve, list, delete
  • Payment: Automatic via Tetto (USDC on Solana)

Testing

To run tests against the live devnet agent:

# Fund test wallet with devnet SOL and USDC-Dev
# Then run:
npm test

Note: Tests require a funded wallet. The test suite validates:

  • Plugin loads correctly
  • All 4 methods work
  • Temporal context support
  • Namespace helper
  • Auto JSON parsing

Links


Development Notes

First Tetto Plugin! This plugin serves as the reference implementation for the Tetto plugin system.

Key Learnings:

  • Use GitHub link for SDK dependency: github:TettoLabs/tetto-sdk#main
  • CallResult.output requires type casting: (result.output as any).success
  • Tests need async wrapper (no top-level await with CJS)
  • Test wallets need funding (devnet SOL + USDC-Dev)

License

MIT


Built by: WarmContext Part of: Memory infrastructure for the AI agent economy

About

WarmMemory plugin for Tetto SDK - Universal memory for AI agents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors