Skip to content

Persistent memory blocks, journal entries, and history events for agent sessions. Use these endpoints to manage structured memory (global and workspace scopes), search and write journal entries, and audit memory changes over time.

All endpoints are scoped to a workspace via the {workspaceID} path parameter.


GET /api/v1/workspaces/{workspaceID}/memory/config

Section titled “GET /api/v1/workspaces/{workspaceID}/memory/config”

Retrieve the memory system configuration for the workspace, including whether memory is enabled and the journal subsystem status.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
{
"enabled": true,
"journal": {
"provider": "anthropic",
"model": "claude-3-5-sonnet"
}
}
const config = await client.agent.memory.getConfig({
workspaceID: "ws_01HXYZ..."
});

Memory blocks are named, bounded text containers that agents can read from and write to. Each block has a label, a scope (global or workspace), an optional limit, and a value.

GET /api/v1/workspaces/{workspaceID}/memory/blocks

Section titled “GET /api/v1/workspaces/{workspaceID}/memory/blocks”

List all memory blocks. Use the ?scope=global or ?scope=workspace query parameter to filter.

NameInTypeRequiredDescription
workspaceIDpathstringYesworkspaceID path parameter
[
{
"label": "persona",
"scope": "global",
"description": "Default agent persona and tone",
"limit": 2000,
"readOnly": false,
"value": "You are a careful, concise coding assistant.",
"projectID": null,
"lastModified": 1717000000000,
"charCount": 47
},
{
"label": "user_prefs",
"scope": "workspace",
"description": "User preferences for the current workspace",
"limit": 5000,
"readOnly": true,
"value": "Prefers TypeScript. Avoid emojis.",
"projectID": "proj_abc123",
"lastModified": 1717100000000,
"charCount": 33
}
]
const blocks = await client.agent.memory.listBlocks({
workspaceID: "ws_01HXYZ..."
});

GET /api/v1/workspaces/{workspaceID}/memory/blocks/{label}

Section titled “GET /api/v1/workspaces/{workspaceID}/memory/blocks/{label}”

Retrieve a single memory block by its label.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
labelpathstringYesThe memory block label.
{
"label": "persona",
"scope": "global",
"description": "Default agent persona and tone",
"limit": 2000,
"readOnly": false,
"value": "You are a careful, concise coding assistant.",
"projectID": null,
"lastModified": 1717000000000,
"charCount": 47
}
const block = await client.agent.memory.getBlock({
workspaceID: "ws_01HXYZ...",
label: "persona"
});

PUT /api/v1/workspaces/{workspaceID}/memory/blocks/{label}

Section titled “PUT /api/v1/workspaces/{workspaceID}/memory/blocks/{label}”

Create or overwrite a memory block. If a block with the given label and scope already exists, its value (and any other provided fields) are replaced.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
labelpathstringYesThe memory block label.
NameTypeRequiredDescription
scopestringYesBlock scope. One of: global, workspace.
valuestringYesThe block’s text content.
descriptionstringNoHuman-readable description of the block’s purpose.
limitnumberNoMaximum character count for the block’s value.
readOnlybooleanNoWhen true, the block cannot be modified by the agent.
{
"scope": "workspace",
"value": "User prefers TypeScript and concise responses.",
"description": "User coding preferences",
"limit": 5000,
"readOnly": true
}
{
"label": "user_prefs",
"scope": "workspace",
"description": "User coding preferences",
"limit": 5000,
"readOnly": true,
"value": "User prefers TypeScript and concise responses.",
"projectID": "proj_abc123",
"lastModified": 1717200000000,
"charCount": 49
}
const block = await client.agent.memory.setBlock({
workspaceID: "ws_01HXYZ...",
label: "user_prefs",
scope: "workspace",
value: "User prefers TypeScript and concise responses.",
description: "User coding preferences",
limit: 5000,
readOnly: true
});

PATCH /api/v1/workspaces/{workspaceID}/memory/blocks/{label}

Section titled “PATCH /api/v1/workspaces/{workspaceID}/memory/blocks/{label}”

Surgically replace a substring within a memory block’s value without rewriting the entire block. The old_str must match exactly once within the current value.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
labelpathstringYesThe memory block label.
NameTypeRequiredDescription
scopestringYesBlock scope. One of: global, workspace.
old_strstringYesThe exact substring to find in the current value.
new_strstringYesThe replacement string.
{
"scope": "workspace",
"old_str": "TypeScript",
"new_str": "TypeScript and Go"
}
{
"label": "user_prefs",
"scope": "workspace",
"description": "User coding preferences",
"limit": 5000,
"readOnly": true,
"value": "User prefers TypeScript and Go and concise responses.",
"projectID": "proj_abc123",
"lastModified": 1717300000000,
"charCount": 53
}
const block = await client.agent.memory.replaceBlock({
workspaceID: "ws_01HXYZ...",
label: "user_prefs",
scope: "workspace",
old_str: "TypeScript",
new_str: "TypeScript and Go"
});

DELETE /api/v1/workspaces/{workspaceID}/memory/blocks/{label}

Section titled “DELETE /api/v1/workspaces/{workspaceID}/memory/blocks/{label}”

Delete a custom memory block. Always pass the scope explicitly via the ?scope=global or ?scope=workspace query parameter to disambiguate which block to remove.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
labelpathstringYesThe memory block label.
{
"success": true
}
const result = await client.agent.memory.deleteBlock({
workspaceID: "ws_01HXYZ...",
label: "user_prefs"
});

Journal entries are dated, tagged, free-form text records. Use them for session notes, decisions, and context the agent should retain across sessions.

GET /api/v1/workspaces/{workspaceID}/memory/journal

Section titled “GET /api/v1/workspaces/{workspaceID}/memory/journal”

List journal entries with optional filters (e.g. by project, tags, or date range).

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
[
{
"id": "jrn_01HABC...",
"title": "Refactored auth middleware",
"body": "Migrated from session cookies to JWT. Updated middleware in src/auth.ts.",
"tags": ["refactor", "auth"],
"created": 1717400000000,
"projectID": "proj_abc123",
"model": "claude-3-5-sonnet",
"provider": "anthropic",
"filePath": "memory/journal/2024-06-01-jrn_01HABC.md"
}
]
const entries = await client.agent.memory.listJournalEntries({
workspaceID: "ws_01HXYZ..."
});

GET /api/v1/workspaces/{workspaceID}/memory/journal/{id}

Section titled “GET /api/v1/workspaces/{workspaceID}/memory/journal/{id}”

Retrieve a single journal entry by its ID.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
idpathstringYesThe journal entry ID.
{
"id": "jrn_01HABC...",
"title": "Refactored auth middleware",
"body": "Migrated from session cookies to JWT. Updated middleware in src/auth.ts.",
"tags": ["refactor", "auth"],
"created": 1717400000000,
"projectID": "proj_abc123",
"model": "claude-3-5-sonnet",
"provider": "anthropic",
"filePath": "memory/journal/2024-06-01-jrn_01HABC.md"
}
const entry = await client.agent.memory.getJournalEntry({
workspaceID: "ws_01HXYZ...",
id: "jrn_01HABC..."
});

GET /api/v1/workspaces/{workspaceID}/memory/journal/count

Section titled “GET /api/v1/workspaces/{workspaceID}/memory/journal/count”

Return the number of journal entries for the current project. Useful for dashboards and quota checks.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
{
"count": 42
}
const { count } = await client.agent.memory.countJournalEntries({
workspaceID: "ws_01HXYZ..."
});

POST /api/v1/workspaces/{workspaceID}/memory/journal

Section titled “POST /api/v1/workspaces/{workspaceID}/memory/journal”

Create a new journal entry. The title and body are required; tags, projectID, model, and provider are optional metadata.

NameInTypeRequiredDescription
workspaceIDpathstringYesworkspaceID path parameter
NameTypeRequiredDescription
titlestringYesShort title for the entry (max 1000 characters).
bodystringYesThe entry body (max 100000 characters).
tagsarrayNoTags to associate with the entry (max 50, each max 100 characters).
projectIDstringNoProject scope for the entry.
modelstringNoModel identifier that produced the entry.
providerstringNoProvider identifier (e.g. anthropic, openai).
{
"title": "Decided on Vitest for unit tests",
"body": "Vitest selected over Jest for better ESM support and faster startup.",
"tags": ["testing", "decision"],
"projectID": "proj_abc123",
"model": "claude-3-5-sonnet",
"provider": "anthropic"
}
{
"id": "jrn_01HDEF...",
"title": "Decided on Vitest for unit tests",
"body": "Vitest selected over Jest for better ESM support and faster startup.",
"tags": ["testing", "decision"],
"created": 1717500000000,
"projectID": "proj_abc123",
"model": "claude-3-5-sonnet",
"provider": "anthropic",
"filePath": "memory/journal/2024-06-02-jrn_01HDEF.md"
}
const entry = await client.agent.memory.createJournalEntry({
workspaceID: "ws_01HXYZ...",
title: "Decided on Vitest for unit tests",
body: "Vitest selected over Jest for better ESM support and faster startup.",
tags: ["testing", "decision"],
projectID: "proj_abc123",
model: "claude-3-5-sonnet",
provider: "anthropic"
});

POST /api/v1/workspaces/{workspaceID}/memory/journal/search

Section titled “POST /api/v1/workspaces/{workspaceID}/memory/journal/search”

Search journal entries by free-text query and/or tag filters. All fields in the request body are optional; omit them to broaden the search.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
NameTypeRequiredDescription
textstringNoFree-text query matched against title and body (max 1000 characters).
projectIDstringNoRestrict results to a specific project.
tagsarrayNoRestrict results to entries with all of the specified tags (max 50, each max 100 characters).
limitnumberNoMaximum number of results to return.
{
"text": "Vitest",
"tags": ["testing"],
"projectID": "proj_abc123",
"limit": 20
}
[
{
"id": "jrn_01HDEF...",
"title": "Decided on Vitest for unit tests",
"body": "Vitest selected over Jest for better ESM support and faster startup.",
"tags": ["testing", "decision"],
"created": 1717500000000,
"projectID": "proj_abc123",
"model": "claude-3-5-sonnet",
"provider": "anthropic",
"filePath": "memory/journal/2024-06-02-jrn_01HDEF.md"
}
]
const results = await client.agent.memory.searchJournalEntries({
workspaceID: "ws_01HXYZ...",
text: "Vitest",
tags: ["testing"],
projectID: "proj_abc123",
limit: 20
});

DELETE /api/v1/workspaces/{workspaceID}/memory/journal/{id}

Section titled “DELETE /api/v1/workspaces/{workspaceID}/memory/journal/{id}”

Delete a journal entry by ID.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
idpathstringYesThe journal entry ID.
{
"success": true
}
const result = await client.agent.memory.deleteJournalEntry({
workspaceID: "ws_01HXYZ...",
id: "jrn_01HDEF..."
});

The history is an append-only audit log of memory mutations. Each event records the action (set, replace, delete, create_journal, delete_journal), its origin (tool, ui, system), and contextual metadata.

GET /api/v1/workspaces/{workspaceID}/memory/history

Section titled “GET /api/v1/workspaces/{workspaceID}/memory/history”

List memory change history events with cursor-based pagination.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
{
"items": [
{
"id": "evt_01HGHI...",
"timestamp": 1717500000000,
"action": "replace",
"origin": "tool",
"sessionID": "ses_abc123",
"projectID": "proj_abc123",
"scope": "workspace",
"label": "user_prefs",
"oldCharCount": 47,
"newCharCount": 53,
"journalID": null,
"journalTitle": null,
"journalTags": null
},
{
"id": "evt_01HJKL...",
"timestamp": 1717400000000,
"action": "create_journal",
"origin": "tool",
"sessionID": "ses_abc123",
"projectID": "proj_abc123",
"scope": null,
"label": null,
"oldCharCount": null,
"newCharCount": null,
"journalID": "jrn_01HABC...",
"journalTitle": "Refactored auth middleware",
"journalTags": ["refactor", "auth"]
}
],
"total": 128,
"hasMore": true,
"nextCursor": "eyJ0cyI6MTcxNzUwMDAwMDAwMH0="
}
const page = await client.agent.memory.listHistory({
workspaceID: "ws_01HXYZ..."
});

GET /api/v1/workspaces/{workspaceID}/memory/history/{id}

Section titled “GET /api/v1/workspaces/{workspaceID}/memory/history/{id}”

Retrieve a single history event with its full payload, including the old and new values, and any associated journal or block metadata.

NameInTypeRequiredDescription
workspaceIDpathstringYesThe workspace identifier.
idpathstringYesThe history event ID.
{
"id": "evt_01HJKL...",
"timestamp": 1717400000000,
"action": "create_journal",
"origin": "tool",
"sessionID": "ses_abc123",
"projectID": "proj_abc123",
"scope": null,
"label": null,
"oldCharCount": null,
"newCharCount": null,
"journalID": "jrn_01HABC...",
"journalTitle": "Refactored auth middleware",
"journalTags": ["refactor", "auth"],
"oldValue": null,
"newValue": null,
"blockDescription": null,
"blockLimit": null,
"blockReadOnly": null,
"journalBody": "Migrated from session cookies to JWT. Updated middleware in src/auth.ts.",
"journalModel": "claude-3-5-sonnet",
"journalProvider": "anthropic"
}
const event = await client.agent.memory.getHistoryEvent({
workspaceID: "ws_01HXYZ...",
id: "evt_01HJKL..."
});