Memory API
API endpoints for querying the vector store stats and resolving user identities across channels.
Memory API
CodeSpar agents maintain contextual memory via a vector store (embeddings of conversations, code, and project context) and an identity resolution system that maps users across multiple channels.
Vector Store Stats
Retrieve memory and vector store statistics for the current instance.
Request
Response
Response Schema
| Field | Type | Description |
|---|---|---|
vectorStore.totalEmbeddings | number | Total number of stored embedding vectors |
vectorStore.storageMB | number | Disk usage in megabytes |
vectorStore.lastSync | string | ISO 8601 timestamp of last sync |
vectorStore.dimensions | number | Embedding vector dimensions |
vectorStore.backend | string | Storage backend: file, postgres, redis |
conversations.totalMessages | number | Total conversation messages stored |
conversations.uniqueUsers | number | Distinct users who have interacted |
conversations.channels | object | Message count per channel |
conversations.retentionDays | number | How long messages are kept |
projectContext.filesIndexed | number | Number of repo files indexed |
projectContext.lastIndexed | string | When the repo was last indexed |
projectContext.repo | string | Linked repository |
User Identity Lookup
Look up a user's resolved identity by their channel-specific identifier. This is used internally for cross-channel identity resolution and can be useful for debugging identity issues.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
channelType | string | Yes | Channel type: slack, whatsapp, discord, telegram |
channelUserId | string | Yes | Channel-specific user ID |
Request
Response (registered user)
Response (unregistered user)
Response (not found)
Identity Schema
| Field | Type | Description |
|---|---|---|
id | string | Unique identity identifier |
displayName | string | null | Registered display name (null if not registered) |
role | string | RBAC role: owner, maintainer, operator, reviewer, read-only, emergency_admin |
channels | object[] | Array of linked channel identities |
channels[].type | string | Channel type |
channels[].userId | string | Channel-specific user ID |
channels[].username | string | null | Channel-specific username |
channels[].linkedAt | string | When this channel was linked |
registeredAt | string | null | When the user registered (null if auto-created) |
lastSeen | string | Last interaction timestamp |
How Identity Resolution Works
When a user sends a message from any channel, CodeSpar resolves their identity through these steps:
- Channel lookup — Find the identity record matching the
channelTypeandchannelUserId - Cross-channel merge — If the user has registered via
@codespar register <name>, all their channel identities are merged under a single identity record - Role assignment — The resolved identity carries the user's RBAC role, which determines command permissions
- Audit attribution — All actions are logged against the resolved identity
This allows a user to approve a deploy from WhatsApp that was requested from Slack, as long as both channels are linked to the same identity.
Next Steps
- Multi-Channel Setup — Link identities across channels
- Security — RBAC roles and permissions
- Agent API — Agent memory and stats