What Mastra already keeps
Mastra agents can keep conversation history and working memory per thread through a storage adapter. That covers thread continuity; it doesn’t track supersession across sources.
Where Auld fits
Create Mastra tools with createTool for recall and remember, and keep Mastra’s thread memory for the conversation itself.
| Concern | Mastra | Auld |
|---|---|---|
| Current conversation | Yes | Not needed |
| Facts across sessions and channels | Your code | Yes |
| Which fact is current after a change | Your code | Yes, with history |
| What was true on a date | Your code | Yes (asOf) |
| Who may see a memory | Your code | Identities and audiences |
| Source for each statement | Your code | Returned with every memory |
Implementation sequence
Add the fetch helper
Two functions around the REST API.
Create tools
Zod schemas for inputs; the user id comes from runtime context.
Attach to the agent
Add both tools to the agent definition.
Ingest from workflows
Workflow steps can send records when business events happen.
Example
const AULD = process.env.AULD_API_BASE!; // e.g. https://YOUR-AULD-HOST
const headers = { Authorization: `Bearer ${process.env.AULD_API_KEY}`, "Content-Type": "application/json" };
async function auldPost(path: string, body: unknown) {
const res = await fetch(`${AULD}/v1/${path}`, { method: "POST", headers, body: JSON.stringify(body) });
if (!res.ok) throw new Error(`Auld ${path} failed: ${res.status}`);
return res.json();
}
export const remember = (text: string, userId: string, sourceId: string, occurredAt: string) =>
auldPost("records", { sourceId, text, occurredAt, author: userId, visibility: `user:${userId}` });
export const recall = (query: string, userId: string, maxTokens = 2000) =>
auldPost("recall", { query, viewer: userId, maxTokens });import { createTool } from "@mastra/core/tools";
import { z } from "zod";
import { recall } from "./auld"; // the helper above
export const recallMemory = createTool({
id: "recall-memory",
description: "Recall durable facts about the current user, with dates and sources",
inputSchema: z.object({ query: z.string() }),
execute: async ({ context, runtimeContext }) => {
const userId = runtimeContext.get("userId") as string;
const res = await recall(context.query, userId);
return { memories: res.memories.map((m: any) => `${m.text} (${m.validFrom.slice(0, 10)})`) };
},
});Illustrative example · standard HTTP · check the framework’s current docs for exact signatures
Or connect the MCP server
If your Mastra setup can use MCP tools, point it at the Auld MCP endpoint instead of writing wrappers. The model gets remember, recall, forget and memory_status. Use wrappers when you need to inject the user id yourself or post-process results; use MCP for speed of setup.
Custom integration recipe using standard HTTP/MCP tools
- This recipe wires Mastra’s own tool interface to the Auld REST API or MCP server; there is nothing Auld-specific to install.
- Bind the viewer id from your authentication layer, not from model output.
- Ingestion is asynchronous — poll the job before depending on a just-sent fact in tests.
- Recall returns up to your plan’s token limit (8,000 on Pay as you go and Flex).
Frequently asked questions
Thread memory and Auld together?
Yes. Thread memory for the current chat, Auld for facts that persist across threads and channels.
Edge runtime?
The helper only uses fetch, so it runs on edge runtimes that allow outbound requests.