Quickstart
Documentation · updated 9 November 2026
In short: Start building: sign up or sign in, and answer four questions about what you are building. Then let your coding agent do the rest with the prompt below, or do it by hand: pair your terminal for a test key, install the SDK, make a test customer, write a memory and recall it. Test keys reach only test customers, so nothing you try touches your live ones.
Set up with your agent
Paste this prompt into your coding agent. It holds no secret: the key reaches your terminal by pairing, which you approve in the browser. Team → API shows the same prompt with your project's id.
Open your coding agent in your product's folder (in Cursor, a chat in Agent mode) and paste this: It works the same in Claude Code, Cursor, Codex.
Add localmem memory to this project.
1. Read https://localmem.org/llms.txt, the Memory API quickstart and "Use it well" it links: what localmem already does (duplicates, retries, history), so this code does not do it again.
2. Run `npx @localmem/memory login` (or `pip install localmem-memory` then `localmem-memory login` in a Python project). Tell me the code it prints; I will approve it in the browser.
3. Install the SDK for this project's language (@localmem/memory or localmem-memory).
4. Ask me: which of our users or companies is one localmem customer, and what data we send (documents, chat turns, facts). Ask whether any of it is health data; if yes or unsure, stop and tell me.
5. Create a test customer, write one memory for it, recall it, and show me the result.
6. Tell me which files you changed. Never print or commit LOCALMEM_KEY_SECRET.
7. Then propose how to wire it into this product, as the quickstart's "Wire it into your product" says: one module that holds the client, writes where the product learns something, reads where it needs context. Ask me what the app is and what one customer is before writing more code.
By hand
1. Pair your terminal
In your product's folder:
npx @localmem/memory login
It prints a code such as WDJB-MJHT and opens app.localmem.org/pair. Check the code matches, choose the project, and approve. The terminal then writes LOCALMEM_PROJECT, LOCALMEM_KEY_ID and LOCALMEM_KEY_SECRET into .env (or the file --env-file names) and adds that file to .gitignore. The code lasts 10 minutes. In a Python project, pip install localmem-memory then localmem-memory login does the same.
Made a key in Team → API instead? When it is made, the app shows LOCALMEM_PROJECT, LOCALMEM_KEY_ID and LOCALMEM_KEY_SECRET together, with one copy for all three. The secret is shown only then; the project's page keeps the other two under Connect your backend.
2. Install the SDK
npm install @localmem/memory # TypeScript, Node 18.17 or later
pip install localmem-memory # Python 3.9 or later
Both read the three variables, sign every request and retry safely; see the SDKs. Use them from your backend only: a secret must never reach a browser or an app.
3. Write a memory and recall it
import { Memory } from "@localmem/memory";
const lm = new Memory();
const { tenant } = await lm.customers.create("cust-42"); // your own id for the customer
await lm.documents.send(tenant, {
text: "Ada Byron joined Acme as head of research on 3 March.",
as_of: "2026-03-03T09:00:00Z",
});
const { facts } = await lm.recall(tenant, { entity: "Ada Byron" });
console.log(facts);
from localmem_memory import Memory
lm = Memory()
tenant = lm.customers.create("cust-42")["tenant"]
lm.documents.send(tenant, "Ada Byron joined Acme as head of research on 3 March.",
as_of="2026-03-03T09:00:00Z")
print(lm.recall(tenant, "Ada Byron")["facts"])
Each fact comes back with its source document and the date it became true. Ask for at_time to hear what was true on a past date.
Wire it into your product
After the first memory, this is the shape that works. Your coding agent reads this section too: the prompt above ends by asking it to propose these steps for your code.
- One module holds the client. Make one file (for example
memory.tsormemory.py) that createsMemoryonce and maps your own user or company id to its localmem customer withcustomers.create(yourId), which answers the same customer for the same id, so it is safe to call each time. Route handlers import that module; none creates its own client. - Write where your product learns something. After a chat turn or a session, when a note or document is saved, when a fact is confirmed. Prose goes to
documents.sendwithas_ofset to when it was true; data you already hold in fields goes tofacts, with no model involved. A document over 20 KB is read in the background:documents.waitif the next step needs its facts. - Read where your product needs context. Before an agent answers,
searchwith the question and put the facts in its prompt; to show a customer's profile,recallthe subject orprofilefor a short summary. Each fact carries its source and date, so your agent can cite them. - Keep health data out in code. If no customer may hold protected health information, make sure what feeds
documents.sendcannot pick it up; a customer markedphiwaits for a business associate agreement, and its documents are refused until then (409 no_baa_provider). - Handle errors once. The SDK retries what is safe to retry. In your module, catch
LocalmemErrorand act on itserrorcode: amonthly_limitpauses that kind of call until the 1st (the SDK holds it back for you; reads still answer), anything else is logged with itsrequest_id. - Test, then live. Everything above runs on a test key against test customers. Going live changes the three variables, not the code.
Then
- One customer per tenant. Decide which of your users or companies is one localmem customer, and make each with your own id. Never put a name or other content in that id.
- Health data waits. If a customer's documents may hold protected health information, mark it
phiand tell us before you go live: it waits for a business associate agreement. - Go live from Team → API when your first customer is ready. We answer within one working day; live keys are then made on the project's page by an admin, never paired.
- What it costs. Test keys are free, always; live, one flat monthly or yearly plan with your customers free. See pricing, and use cases by kind of product.