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

@olivaresai/alma-sdk

v1.3.2

Published

JavaScript/TypeScript SDK for Alma by OlivaresAI — persistent memory for AI agents

Readme

@olivaresai/alma-sdk

JavaScript/TypeScript SDK for Alma — persistent memory for AI agents.

npm TypeScript Node


TypeScript client for the Alma REST API. The SDK focuses on the persistent-memory core — memories, chat, and context assembly — with typed convenience wrappers for common secondary surfaces (images, voice, cowork, video, export). For any Alma API endpoint not covered by a typed resource, a raw HTTP escape hatch is provided so you never have to drop to fetch().

Install

npm install @olivaresai/alma-sdk

Requires Node.js 18+ and ESM ("type": "module" in your package.json).

Quick Start

import { AlmaClient } from '@olivaresai/alma-sdk';

const alma = new AlmaClient({
  apiKey: 'alma_sk_...',
  // baseUrl: 'https://alma.olivares.ai/api/v1',  // default
  // environmentId: 'env_...',                      // optional
});

Assemble context for an LLM

const ctx = await alma.context.assemble({ user_message: 'Tell me about my project' });
console.log(ctx.system_prompt);
// Pass ctx.system_prompt as the system message to any LLM

Store a memory

const memory = await alma.memories.create({
  content: 'User prefers TypeScript over JavaScript',
  category: 'preference',
  importance: 8,
});

Search memories

const results = await alma.memories.search({
  q: 'programming preferences',
  mode: 'hybrid', // keyword, semantic, or hybrid
});
for (const memory of results.memories) {
  console.log(memory.content);
}

Chat with streaming

const conversation = await alma.chat.createConversation({ title: 'Hello' });

const abort = await alma.chat.send(conversation.id, 'Hi Alma!', {
  onChunk: (text) => process.stdout.write(text),
  onDone: (event) => {
    console.log(`\n[${event.model} | ${event.inputTokens}+${event.outputTokens} tokens]`);
  },
  onError: (error) => console.error('Stream error:', error),
});

// Call abort() to cancel the stream at any time

Chat without streaming

const response = await alma.chat.sendAndWait(conversation.id, 'What do you know about me?');
console.log(response.content);

Typed resources

The AlmaClient exposes typed wrappers around 14 sections of the Alma API.

Core — persistent memory

These are the reason to use Alma. They are first-class in the SDK, covered by integration tests, and kept stable across minor versions.

| Resource | Description | |----------|-------------| | alma.memories | Create, list, search, update, delete, and extract memories | | alma.chat | Conversations CRUD, send messages (streaming + non-streaming), retry, budget | | alma.context | Assemble context, preview prompts, set focus, continue sessions |

Convenience wrappers

These map 1:1 to their API routes and are kept in sync, but the surface is smaller. If a method you need is missing, prefer the raw HTTP client below rather than waiting for a release.

| Resource | Description | |----------|-------------| | alma.episodes | Conversation episode summaries | | alma.procedures | Learned procedures | | alma.blocks | Soul memory blocks | | alma.soul | Soul version history, snapshots, and restore | | alma.environments | Separate memory spaces | | alma.images | AI image generation (Flux, Leonardo) | | alma.voice | Speech-to-text and text-to-speech | | alma.export | Export conversations, memories, soul, full data dumps | | alma.admin | Dashboard stats | | alma.cowork | Agent workspaces (code edit, review, test, explain) | | alma.video | Runway video generation, projects, stitching |

Uncovered endpoints — use alma.http

Several API routes are intentionally not wrapped as typed resources — they're either niche, rarely used, or still being shaped. Rather than wait for a future release, call them with the built-in HTTP client:

const alma = new AlmaClient({ apiKey: 'alma_sk_...' });

// GET /flashcards/due  →  array of Flashcard rows
const due = await alma.http.get<{ flashcards: Array<{ id: string; question: string }> }>(
  '/flashcards/due',
);

// POST /ideas  →  create a quick note
const idea = await alma.http.post<{ idea: { id: string } }>('/ideas', {
  title: 'Refactor chat-service',
  content: 'P0-2 done, audit P0-1 next',
});

// DELETE /templates/xyz
await alma.http.delete<{ deleted: true }>('/templates/xyz');

alma.http methods:

  • get<T>(path) — resolves to parsed JSON body of type T
  • post<T>(path, body?)
  • put<T>(path, body?)
  • delete<T>(path)

Errors throw AlmaApiError just like the typed resources — status, code, and message are populated from the server response.

Routes currently only reachable via alma.http (15 groups):

flashcards, ideas, tasks, templates, writing, trends, teams, teams/billing, stats, share, files, music, audio, search, byok, context/documents, billing (subscription management is expected to happen inside the Alma web app, not via SDK).

If you find yourself writing the same HTTP wrapper in multiple projects, file an issue — the most-used ones get promoted to typed resources.

Memory Extraction

const extracted = await alma.memories.extract({
  conversation: 'User said they prefer dark mode and use React 19...',
  auto_save: true,
});

console.log(extracted.memories); // [{ content: '...', category: 'preference', importance: 7 }, ...]
console.log(extracted.episode);  // { summary: '...', topics: ['UI', 'React'] }

Soul Blocks

// List all soul blocks
const blocks = await alma.blocks.list();

// Update a block
await alma.blocks.update('rules', {
  value: 'Always respond in Spanish. Be concise.',
});

Image Generation

const image = await alma.images.generate({
  prompt: 'A peaceful mountain landscape at sunset',
  style: 'natural',
  size: 'landscape',
});
console.log(image.url);

Environments

Target a specific environment by passing environmentId at client initialization:

const alma = new AlmaClient({
  apiKey: 'alma_sk_...',
  environmentId: 'env_abc123',
});

Or manage environments programmatically:

const envs = await alma.environments.list();
const newEnv = await alma.environments.create({ name: 'Work Project' });

Error Handling

import { AlmaClient, AlmaApiError } from '@olivaresai/alma-sdk';

try {
  await alma.memories.create({ content: '' });
} catch (error) {
  if (error instanceof AlmaApiError) {
    console.error(`API error ${error.status}: [${error.code}] ${error.message}`);
  }
}

TypeScript

All types are re-exported from @olivaresai/alma-types:

import type {
  Memory,
  MemoryCategory,
  Episode,
  Procedure,
  Conversation,
  Message,
  MemoryBlock,
  Environment,
  AssembleResult,
  BudgetStatus,
  ChatStreamEvent,
  ChatStreamCallbacks,
} from '@olivaresai/alma-sdk';

Authentication

// API Key (recommended for scripts and backend integrations)
const alma = new AlmaClient({ apiKey: 'alma_sk_...' });

// JWT Bearer Token (for web applications)
const alma = new AlmaClient({ token: 'eyJ...' });

API keys can be created in the Alma settings. Requires an Advanced plan or above.

Links


Built by olivares.ai — Give your AI a soul.