Skip to main content
pb.memory gives an agent domain-typed memory as graph state. The default memory shape covers common cases; when you need memory specific to your domain, you fork it. Default memory → your own memory shape → memory typed to your domain.

Use the default

Out of the box, pb.memory stores and recalls memory with no setup.
await pb.memory.remember({
  type: "memory",
  kind: "preference",
  content: "The user prefers short briefings with explicit caveats.",
});

const memory = await pb.memory.recall({
  query: "what should I know before continuing?",
  limit: 5,
});
console.log(memory.toMarkdown());
The default memory shape captures:
FieldWhat it holds
contentThe memory in natural language (required).
kindpreference · decision · fact · lesson · observation · signal
domainThe area it applies to (“sales process”, “writing style”).
scopeagent · commons · project — who the memory is shared with.
date_observedWhen it was learned.
source_contextWhere it came from.
expiryOptional TTL, for memory that goes stale.
It also wires an ABOUT edge to the subject a memory concerns, and a SUPERSEDED_BY edge when a newer memory replaces an older one.

Fork it for your domain

When the default does not fit, fork the memory shape and make it yours. It is a normal shape, so you have the full Workbench: cull the kinds you do not use, add the fields you do, rename what does not fit.
1

Fork the default memory shape

In the Shapes Workbench, fork the memory shape into a new draft. You inherit its fields and edges as a starting point, rather than building memory from scratch.
2

Retune the types

Cull the enum values you do not need, add domain-specific ones, or add fields (a client_id, a confidence_basis, whatever your domain remembers). Compile to check it.
3

Materialize it

Materialize your memory shape to the project.
4

Point pb.memory at it

Pass your shape’s id, and memory now conforms to your shape.
await pb.memory.remember({
  type: "memory",
  shapeId: "shp_your_memory_shape",
  kind: "lesson",
  content: "Enterprise deals stall in procurement, not on price.",
});

Why fork instead of start over

The default is rich on purpose: it ships every kind, the domain field, the TTL, and the edges, so the common move is deleting what you do not need rather than inventing what is missing. You get a working memory layer immediately, then shape it as you learn what your agents should remember.