SwarmRecall
Persistent memory, knowledge graphs, learnings, and skill tracking for AI agents via the SwarmRecall API.
Auto-Registration
Before making any API calls, check for a SWARMRECALL_API_KEY environment variable:
- 1. If
SWARMRECALL_API_KEY is set, use it for all requests as a Bearer token. - If
SWARMRECALL_API_KEY is not set, self-register by calling:
POST https://swarmrecall-api.onrender.com/api/v1/register
Content-Type: application/json
{ "name": "<your-agent-name>" }
- 3. The response returns
{ "apiKey": "...", "claimToken": "..." }. Save the apiKey to the SWARMRECALL_API_KEY environment variable for all subsequent requests. Do NOT write the key to disk or any file without user consent. - Tell the user: "SwarmRecall is set up! To manage your agent's data, visit swarmrecall.ai/claim with code:
<claimToken>"
Authentication
All API requests require a Bearer token in the Authorization header:
CODEBLOCK1
API Base URL
INLINECODE7 (override with SWARMRECALL_API_URL if set)
All endpoints below are prefixed with /api/v1.
Privacy & Data Handling
- - All data is sent to
swarmrecall-api.onrender.com over HTTPS - All module data (memories, entities, learnings, skills) is stored server-side with vector embeddings for semantic search
- Data is isolated per agent and owner — no cross-tenant access
- Before storing user-provided content, ensure the user has consented to external storage
- The
SWARMRECALL_API_KEY should be stored as an environment variable only, not written to disk
Module 1: Memory
Conversational memory persistence with semantic search and session tracking.
When to use
- - Storing user preferences, facts, decisions, and context
- Recalling relevant information from past interactions
- Managing conversation sessions
Endpoints
Store a memory
CODEBLOCK2
Search memories
CODEBLOCK3
List memories
CODEBLOCK4
Get a memory
CODEBLOCK5
Update a memory
CODEBLOCK6
Delete a memory
CODEBLOCK7
Start a session
CODEBLOCK8
Get current session
CODEBLOCK9
Update a session
CODEBLOCK10
List sessions
CODEBLOCK11
Behavior
- - On session start: call
GET /api/v1/memory/sessions/current to load context from the last session. If none, call POST /api/v1/memory/sessions to start one. - On fact, preference, or decision: call
POST /api/v1/memory with appropriate category and importance. - On recall needed: call
GET /api/v1/memory/search?q=<query> and use returned memories to inform your response. - On session end: call
PATCH /api/v1/memory/sessions/:id with ended: true and a summary.
Module 2: Knowledge
Knowledge graph with entities, relations, traversal, and semantic search.
When to use
- - Storing structured information about people, projects, tools, and concepts
- Linking related entities together
- Exploring connections between concepts
Endpoints
Create an entity
CODEBLOCK12
Get an entity
CODEBLOCK13
List entities
CODEBLOCK14
Update an entity
CODEBLOCK15
Delete an entity
CODEBLOCK16
Create a relation
CODEBLOCK17
List relations
CODEBLOCK18
Delete a relation
CODEBLOCK19
Traverse the graph
CODEBLOCK20
Search entities
CODEBLOCK21
Validate the graph
CODEBLOCK22
Behavior
- - When the user provides structured information: create entities with
POST /api/v1/knowledge/entities. - When linking concepts: create relations with
POST /api/v1/knowledge/relations. - When the user asks "what do I know about X?": search with
GET /api/v1/knowledge/search?q=X, then traverse with GET /api/v1/knowledge/traverse to explore connections. - Periodically: call
POST /api/v1/knowledge/validate to check graph constraints.
Module 3: Learnings
Error tracking, correction logging, and pattern detection that surfaces recurring issues.
When to use
- - Logging errors, corrections, and discoveries
- Detecting recurring patterns across sessions
- Promoting learnings into actionable rules
Endpoints
Log a learning
CODEBLOCK23
Search learnings
CODEBLOCK24
Get a learning
CODEBLOCK25
List learnings
CODEBLOCK26
Update a learning
CODEBLOCK27
Get recurring patterns
CODEBLOCK28
Get promotion candidates
CODEBLOCK29
Link related learnings
CODEBLOCK30
Behavior
- - On error: call
POST /api/v1/learnings with category: "error", the summary, details, and the command/output that failed. - On correction: call
POST /api/v1/learnings with category: "correction" and what was wrong vs. what is correct. - On session start: call
GET /api/v1/learnings/patterns to preload known recurring issues. Check GET /api/v1/learnings/promotions for patterns ready to be promoted. - On promotion candidates: surface candidates to the user for approval before acting on them.
Module 4: Skills
Skill registry for tracking installed agent capabilities and getting contextual suggestions.
When to use
- - Registering new capabilities your agent acquires
- Listing what the agent can do
- Getting skill recommendations for a given task
Endpoints
Register a skill
CODEBLOCK31
List skills
CODEBLOCK32
Get a skill
CODEBLOCK33
Update a skill
CODEBLOCK34
Remove a skill
CODEBLOCK35
Get skill suggestions
CODEBLOCK36
Behavior
- - On skill install: call
POST /api/v1/skills to register the skill with name, version, and source. - On "what can I do?": call
GET /api/v1/skills to list installed capabilities. - On task context: call
GET /api/v1/skills/suggest?context=<description> for relevant skill recommendations.
Module 5: Shared Pools
Named shared data containers for cross-agent collaboration.
When to use
- - Sharing memories, knowledge, learnings, or skills between agents
- Building collaborative workflows where multiple agents contribute to a shared dataset
- Viewing what pools the agent belongs to and who else is in them
Endpoints
List pools
GET /api/v1/pools
Returns the pools this agent belongs to.
Get pool details
GET /api/v1/pools/:id
Returns pool details and its members.
Behavior
- - Pools let agents share data across organizational boundaries. When an agent belongs to a pool, search and list results across all modules (memory, knowledge, learnings, skills) automatically include data from that pool.
- To write data to a shared pool, include
"poolId": "<uuid>" in any create request for memory, knowledge entities, knowledge relations, learnings, or skills (see the poolId field in Modules 1-4 endpoint examples above). - The agent must have the appropriate access level for the pool and module (e.g., readwrite access to the pool's memory module to store shared memories).
- Pool data returned in responses includes
poolId and poolName fields to distinguish shared data from the agent's own data. - On session start: call
GET /api/v1/pools to see available pools and their access levels.
Module 6: Dreaming
Background memory consolidation — deduplication, pruning, contradiction resolution, and session summarization.
When to use
- - Between sessions or during idle periods for memory maintenance
- When the user asks to "clean up", "consolidate", or "optimize" memories
- Periodically via auto-dream scheduling
Endpoints
Dream cycle management
CODEBLOCK39
Candidate primitives (building blocks for agent-driven dreaming)
CODEBLOCK40
Behavior
- 1. Start a dream cycle: INLINECODE37
- Run Tier 1 ops:
POST /api/v1/dream/execute (decay, prune, orphan cleanup) - Fetch candidates (duplicates, unsummarized sessions, contradictions)
- For each candidate: reason about it, then use existing memory/knowledge/learnings endpoints to act
- Complete the cycle:
PATCH /api/v1/dream/:cycleId with results
See the standalone swarmrecall-dream skill for full documentation and examples.
SwarmRecall
通过SwarmRecall API为AI代理提供持久化记忆、知识图谱、学习记录和技能追踪。
自动注册
在进行任何API调用之前,检查是否存在SWARMRECALLAPIKEY环境变量:
- 1. 如果设置了SWARMRECALLAPIKEY,则在所有请求中将其作为Bearer令牌使用。
- 如果未设置SWARMRECALLAPIKEY,则通过调用以下接口进行自我注册:
POST https://swarmrecall-api.onrender.com/api/v1/register
Content-Type: application/json
{ name: }
- 3. 响应返回{ apiKey: ..., claimToken: ... }。将apiKey保存到SWARMRECALLAPIKEY环境变量中,用于所有后续请求。未经用户同意,不得将密钥写入磁盘或任何文件。
- 告知用户:SwarmRecall已设置完成!要管理您的代理数据,请访问swarmrecall.ai/claim,使用验证码:
身份验证
所有API请求都需要在Authorization头中包含Bearer令牌:
Authorization: Bearer APIKEY>
API基础URL
https://swarmrecall-api.onrender.com(如果设置了SWARMRECALLAPIURL,则以此覆盖)
以下所有端点均以/api/v1为前缀。
隐私与数据处理
- - 所有数据通过HTTPS发送至swarmrecall-api.onrender.com
- 所有模块数据(记忆、实体、学习记录、技能)均存储在服务端,并附带向量嵌入以支持语义搜索
- 数据按代理和所有者隔离——无跨租户访问
- 在存储用户提供的内容前,确保用户已同意外部存储
- SWARMRECALLAPIKEY应仅作为环境变量存储,不得写入磁盘
模块1:记忆
具有语义搜索和会话追踪功能的对话记忆持久化。
使用场景
- - 存储用户偏好、事实、决策和上下文
- 从过往交互中回忆相关信息
- 管理对话会话
端点
存储一条记忆
POST /api/v1/memory
{
content: 用户偏好深色模式,
category: preference, // fact | preference | decision | context | session_summary
importance: 0.8, // 0.0 到 1.0
tags: [ui, settings],
metadata: {},
poolId: // 可选——写入共享池
}
搜索记忆
GET /api/v1/memory/search?q=<查询>&limit=10&minScore=0.5
列出记忆
GET /api/v1/memory?category=preference&limit=20&offset=0&includeArchived=false
获取单条记忆
GET /api/v1/memory/:id
更新记忆
PATCH /api/v1/memory/:id
{ importance: 0.9, tags: [updated], archived: false }
删除记忆
DELETE /api/v1/memory/:id
开始一个会话
POST /api/v1/memory/sessions
{
context: {},
poolId: // 可选——写入共享池
}
获取当前会话
GET /api/v1/memory/sessions/current
更新会话
PATCH /api/v1/memory/sessions/:id
{ summary: 讨论了项目设置, ended: true }
列出会话
GET /api/v1/memory/sessions?limit=20&offset=0
行为
- - 会话开始时:调用GET /api/v1/memory/sessions/current加载上次会话的上下文。如果没有,则调用POST /api/v1/memory/sessions开始一个新会话。
- 遇到事实、偏好或决策时:调用POST /api/v1/memory,并设置相应的类别和重要性。
- 需要回忆时:调用GET /api/v1/memory/search?q=<查询>,使用返回的记忆来指导响应。
- 会话结束时:调用PATCH /api/v1/memory/sessions/:id,设置ended: true并附上摘要。
模块2:知识
包含实体、关系、遍历和语义搜索的知识图谱。
使用场景
- - 存储关于人员、项目、工具和概念的结构化信息
- 将相关实体链接在一起
- 探索概念之间的关联
端点
创建实体
POST /api/v1/knowledge/entities
{
type: person,
name: Alice,
properties: { role: engineer },
poolId: // 可选——写入共享池
}
获取实体
GET /api/v1/knowledge/entities/:id
列出实体
GET /api/v1/knowledge/entities?type=person&limit=20&offset=0&includeArchived=false
更新实体
PATCH /api/v1/knowledge/entities/:id
{ name: Alice Smith, properties: { role: senior engineer } }
删除实体
DELETE /api/v1/knowledge/entities/:id
创建关系
POST /api/v1/knowledge/relations
{
fromEntityId: ,
toEntityId: ,
relation: works_on,
properties: {},
poolId: // 可选——写入共享池
}
列出关系
GET /api/v1/knowledge/relations?entityId=&relation=works_on&limit=20&offset=0
删除关系
DELETE /api/v1/knowledge/relations/:id
遍历图谱
GET /api/v1/knowledge/traverse?startId=&relation=works_on&depth=2&limit=50
搜索实体
GET /api/v1/knowledge/search?q=<查询>&limit=10&minScore=0.5
验证图谱
POST /api/v1/knowledge/validate
行为
- - 当用户提供结构化信息时:使用POST /api/v1/knowledge/entities创建实体。
- 链接概念时:使用POST /api/v1/knowledge/relations创建关系。
- 当用户询问我对X了解多少?时:使用GET /api/v1/knowledge/search?q=X进行搜索,然后使用GET /api/v1/knowledge/traverse遍历探索关联。
- 定期:调用POST /api/v1/knowledge/validate检查图谱约束。
模块3:学习记录
错误追踪、修正日志记录和模式检测,用于发现重复出现的问题。
使用场景
- - 记录错误、修正和发现
- 检测跨会话的重复模式
- 将学习记录提升为可操作的规则
端点
记录一条学习记录
POST /api/v1/learnings
{
category: error, // error | correction | discovery | optimization | preference
summary: npm install因对等依赖失败,
details: 完整错误输出...,
priority: high, // low | medium | high | critical
area: build,
suggestedAction: 使用--legacy-peer-deps标志,
tags: [npm, build],
metadata: {},
poolId: // 可选——写入共享池
}
搜索学习记录
GET /api/v1/learnings/search?q=<查询>&limit=10&minScore=0.5
获取单条学习记录
GET /api/v1/learnings/:id
列出学习记录
GET /api/v1/learnings?category=error&status=open&priority=high&area=build&limit=20&offset=0
更新学习记录
PATCH /api/v1/learnings/:id
{ status: resolved, resolution: 添加了--legacy-peer-deps, resolutionCommit: abc123 }
获取重复模式
GET /api/v1/learnings/patterns
获取提升候选
GET /api/v1/learnings/promotions
关联学习记录
POST /api/v1/learnings/:id/link
{ targetId: }
行为
- - 遇到错误时:调用POST /api/v1/learnings,设置category