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.

ConcernMastraAuld
Current conversationYesNot needed
Facts across sessions and channelsYour codeYes
Which fact is current after a changeYour codeYes, with history
What was true on a dateYour codeYes (asOf)
Who may see a memoryYour codeIdentities and audiences
Source for each statementYour codeReturned with every memory

Implementation sequence

  1. Add the fetch helper

    Two functions around the REST API.

  2. Create tools

    Zod schemas for inputs; the user id comes from runtime context.

  3. Attach to the agent

    Add both tools to the agent definition.

  4. Ingest from workflows

    Workflow steps can send records when business events happen.

Example

lib/auld.ts — shared helper
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 });
Mastra wiring
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.

Connect an MCP client →

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.