Install

Terminal
npm install sigil-memory

One ES module with the Sigil core inside, with types. It runs in the browser and in Node 20 or later. MIT licence.

In the browser

JavaScript
import { requestAccess, SigilClient } from "sigil-memory";

// From a click: the person allows a memory of your own, and picks what else you may read.
const access = await requestAccess({ vault: "https://sigilvault.fun", appName: "Tutor", memory: true });
const sigil = new SigilClient(access);

await sigil.remember("Learning Spanish, prefers short lessons in the morning.");

const context = await sigil.context("plan today's lesson"); // one block of text for your prompt
const hits = await sigil.recall("spanish");                 // the memories, in full
await sigil.forget(hits[0].id);                             // only in your own folder

On your server or in your agent

JavaScript
import { SigilClient } from "sigil-memory";

// The same key works from your server, a worker or an agent (Node 20 or later).
const sigil = new SigilClient({ vault: "https://sigilvault.fun", appKey: process.env.SIGIL_APP_KEY, appName: "Tutor" });

const context = await sigil.context(message);
const reply = await model.answer({ system: context, user: message });
await sigil.remember(`Asked about ${topic}. Liked the short version.`);

Keep the app key the way you keep a password. It opens only your own folder and what the person ticked, and it stops working the moment they revoke it.

The path of one memory

  1. 01

    The person allows it

    A window from their vault shows your app's name and address. They allow a memory of your own and tick any folders you may also read. Their vault makes one folder for you, named after your app, and an app key for you alone.

  2. 02

    Your app remembers

    Each memory is encrypted where your code runs, with your folder's key. The server stores ciphertext and checks that you write only your own folder. The write goes into the person's read log, sealed every hour.

  3. 03

    Your app recalls

    In any later session, on any device, recall decrypts and searches on your side. The question you search with is never sent; the server only learns that the index was read.

  4. 04

    The person stays in charge

    They read, edit and delete what you remembered in their vault, under Agents. One click cuts you off, and your next call fails.

The calls

CallWhat it does
requestAccess({ vault, appName, memory: true })Opens the consent window from a click. The person allows a memory of your own and ticks any folders you may also read. Resolves with your app key.
memory()Your own folder and what you may do in it, or null when the person gave you reading only.
remember(text | { text, title, tags, expiresAt })Writes one memory to your own folder, encrypted on your side with that folder's key.
recall(question, { limit })The memories that best match, in full, from your own folder and the folders you were given. The search runs on your side; an empty question gives the newest.
context(question, { limit, maxChars })The same matches as one block of text, ready for a model's prompt. Empty when nothing matches.
forget(ids)Deletes memories for good, only in your own folder. Anything else comes back as refused.
folders(), search(), read(), suggest(), requestProof()Everything Sign in with Sigil already did: read what was given, suggest to the inbox, ask for a proof instead of the data.

What it changes for you

No user database to run

What your app knows about each person lives in their own vault, not in a database you have to run, back up and protect.

Memory that follows the person

The same memory on their phone, their laptop and your server, from the first session to the hundredth, with nothing to sync yourself.

Free

Up to 300 memories an hour per app on any vault, and 1,000, 3,000 or 10,000 for holders of the token, by tier. No key to buy, no plan.

More

The whole consent flow, proofs and keys are in the docs. The source of the package is in the open repository, next to a complete example app.