agentbay_agent_memory_record
Record an agent memory entry that persists across all projects. Use this tool to store insights, decisions, or patterns with deduplication via source and sourceRef.
Instructions
Record a memory entry that belongs to YOU (the calling agent). Agent memory follows you across all projects. Uses source+sourceRef for dedup.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | ||
| title | Yes | Short title | |
| content | Yes | Full content | |
| tags | No | ||
| filePaths | No | ||
| confidence | No | ||
| source | No | Provenance source (e.g. "claude-code") | |
| sourceRef | No | Unique key within the source for dedup |
Implementation Reference
- src/index.ts:389-415 (registration)Tool registration for 'agentbay_agent_memory_record' using server.tool() with Zod schema and async handler.
server.tool( 'agentbay_agent_memory_record', 'Record a memory entry that belongs to YOU (the calling agent). Agent memory follows you across all projects. Uses source+sourceRef for dedup.', { type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']), title: z.string().describe('Short title'), content: z.string().describe('Full content'), tags: z.array(z.string()).optional(), filePaths: z.array(z.string()).optional(), confidence: z.number().min(0).max(1).optional(), source: z.string().optional().describe('Provenance source (e.g. "claude-code")'), sourceRef: z.string().optional().describe('Unique key within the source for dedup'), }, async ({ type, title, content, tags, filePaths, confidence, source, sourceRef }) => { // Resolve calling agent's ID const meData = await apiGet('/api/v1/me'); if (meData.error) return { content: [{ type: 'text' as const, text: `Error: ${meData.error}` }] }; const agentId = meData.agentId; if (!agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key. Use agentbay_agent_register first.' }] }; const data = await apiPost(`/api/v1/agents/${agentId}/memory`, { type, title, content, tags, filePaths, confidence, source, sourceRef, }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: `Agent memory ${data.action}: "${data.memory?.title}"\nID: ${data.memory?.id}` }] }; } ); - src/index.ts:402-414 (handler)Handler function that resolves the calling agent's ID via GET /api/v1/me, then posts memory to POST /api/v1/agents/{agentId}/memory.
async ({ type, title, content, tags, filePaths, confidence, source, sourceRef }) => { // Resolve calling agent's ID const meData = await apiGet('/api/v1/me'); if (meData.error) return { content: [{ type: 'text' as const, text: `Error: ${meData.error}` }] }; const agentId = meData.agentId; if (!agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key. Use agentbay_agent_register first.' }] }; const data = await apiPost(`/api/v1/agents/${agentId}/memory`, { type, title, content, tags, filePaths, confidence, source, sourceRef, }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: `Agent memory ${data.action}: "${data.memory?.title}"\nID: ${data.memory?.id}` }] }; } - src/index.ts:392-401 (schema)Input schema for agentbay_agent_memory_record using Zod: type enum, title, content, and optional tags, filePaths, confidence, source, sourceRef.
{ type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']), title: z.string().describe('Short title'), content: z.string().describe('Full content'), tags: z.array(z.string()).optional(), filePaths: z.array(z.string()).optional(), confidence: z.number().min(0).max(1).optional(), source: z.string().optional().describe('Provenance source (e.g. "claude-code")'), sourceRef: z.string().optional().describe('Unique key within the source for dedup'), },