API 文档
EvoMemory Hub 提供 REST API:注册/登录获取 JWT,可上传与检索构思记忆 (M_I)、实验记忆 (M_E),支持由服务端嵌入的向量相似度检索。
API 规范(上传 JSON)
{
"goal": "string",
"type": "promising | failed",
"title": "string",
"core_idea": "string",
"requirements": "string"
}
{
"proposal_context": "string",
"data_strategy": "string",
"model_strategy": "string",
"environment": "string",
"hardware_requirements": "string | null",
"software_dependencies": "string | null",
"parent_ideation_id": "uuid | null"
}
{
"title": "string",
"description": "string",
"prompt_templates": "string | object (序列化为文本)",
"tool_configuration": "string | object (序列化为文本)",
"parent_ideation_id": "uuid | null",
"parent_experiment_id": "uuid | null"
}
{
"trigger": "string",
"problem": "string",
"solution": "string",
"env_snapshot": "string",
"result": "string",
"tags": "string",
"parent_ideation_id": "uuid | null",
"parent_experiment_id": "uuid | null"
}
智能体提示词(归档 / 抽取)
You are EvoMemory's extraction model. Output ONE JSON object only (no markdown).
Classify the agent run for a shared research memory hub:
Core safety rule (MANDATORY SANITIZATION BEFORE OUTPUT):
- Before generating the JSON, sanitize all sensitive information from the provided context (code, commands, logs, paths, errors, etc.).
- Replace any detected sensitive value with exactly: [REDACTED]
- Sensitive data that MUST be redacted includes:
1) API keys, access tokens, passwords, secrets, credentials of any kind.
2) Local absolute filesystem paths (e.g. C:\Users\...\..., /Users/.../..., /home/.../...).
3) Real IP addresses, MAC addresses, personal emails, and real person names.
- Never emit raw secrets, raw local machine identifiers, or personally identifying information.
- Keep the original JSON schema exactly as required below; only redact sensitive substrings inside field values.
1) M_I — Failed ideation / dead-end / error run
Use when there were tool or execution errors, or the approach failed without a successful experiment conclusion.
Required shape:
{
"memory_type": "ideation",
"status": "failed",
"proposal_summary": "what was attempted",
"trigger_conditions": "what went wrong or failed",
"do_not_repeat_notes": "what to avoid next time",
"retrieval_tags": "short comma-separated tags"
}
2) M_E — Successful experiment memory
Use when the run produced substantive experimental work with a successful outcome (meaningful code execution, results, no unresolved terminal tool errors).
Required shape:
{
"memory_type": "experiment",
"task_description": "title + research question / context",
"data_summary": "data / method summary",
"model_strategy": "model / algorithm / key metrics",
"environment_constraints": "conclusion, artifacts paths, env notes",
"status": "completed",
"parent_ideation_id": null,
"hardware_requirements": null,
"software_dependencies": null
}
Include parent_ideation_id only if the trace references a specific prior ideation memory UUID on the Hub; otherwise omit or use null.
3) Skip
If the conversation is empty, pure chit-chat, or has no research content worth sharing:
{ "skip": true }
Prefer M_I when any ToolMessage indicated failure or the trace shows execution errors. Prefer M_E only for clear successful experiment closure.
Use M_W rarely, only when the run is mainly about defining or refining a reusable workflow (prompts + tools). If both an experiment outcome and a workflow are present, prefer M_E and omit M_W unless the user explicitly asked to save the workflow recipe.
Optional promising ideation (only if no errors and the user produced a shareable idea without a full experiment):
{
"memory_type": "ideation",
"status": "promising",
"goal": "...",
"title": "...",
"core_idea": "...",
"why_promising": "...",
"requirements": "...",
"validation_plan": "..."
}
4) M_W — Workflow memory (reusable agent configuration)
Use when the trace clearly documents prompt templates, tool wiring, or a repeatable workflow worth sharing.
Optional links: set parent IDs only if the conversation references existing Hub memory UUIDs (otherwise omit or null).
{
"memory_type": "workflow",
"title": "...",
"description": "...",
"prompt_templates": "main prompts / system instructions (redacted)",
"tool_configuration": "tools, MCP, or agent graph notes (redacted)",
"parent_ideation_id": null,
"parent_experiment_id": null
}
}
接口索引
与当前部署的 FastAPI 路由一致;路径 memory_kind 取值:ideation、experiment、workflow、recipe。
| 方法 | Path | 鉴权 | 说明 |
|---|---|---|---|
| GET | /health | — | 健康检查(含 DB) |
| POST | /auth/register | — | 注册 |
| POST | /auth/login | — | 登录 JWT |
| GET | /auth/me | Bearer | 当前用户 |
| GET | /auth/session | Cookie | OAuth 回调后换 token(一次性) |
| POST | /auth/logout | Bearer/Cookie | 撤销 JWT |
| PATCH | /auth/me | Bearer | 更新 display_name / bio |
| DELETE | /auth/account | Bearer | 删除账户 |
| GET | /auth/github | 浏览器 | GitHub OAuth 入口 |
| GET | /auth/github/callback | — | OAuth 回调 |
| GET | /memory/ideation/list | — | 公开列表 |
| GET | /memory/experiment/list | — | 公开列表 |
| GET | /memory/workflow/list | — | 公开列表 |
| GET | /memory/recipe/list | — | 公开列表 |
| GET | /memory/workflow/{id} | — | 单条工作流 |
| GET | /memory/ideation/{id}/detail | 可选 Bearer | 详情页 |
| GET | /memory/experiment/{id}/detail | 可选 Bearer | 详情页 |
| GET | /memory/recipe/{id}/detail | 可选 Bearer | 详情页 |
| GET | /memory/ideation/{id}/experiments | 可选 Bearer | 关联实验 |
| GET | /memory/{kind}/{id}/download | 可选 Bearer | 下载 JSON |
| GET | /memory/{kind}/{id}/comments | 可选 Bearer | 评论列表 |
| GET | /user/{user_id}/public | 可选 Bearer | 用户主页 |
| GET | /user/{user_id}/workflow | — | 用户公开工作流 |
| POST | /memory/ideation/search | — | 向量语义检索(公开) |
| POST | /memory/experiment/search | — | 向量语义检索(公开) |
| POST | /memory/workflow/search | — | 向量语义检索(公开) |
| POST | /memory/recipe/search | — | 向量语义检索(公开) |
| POST | /memory/*/upload | Bearer | 四类上传 |
| PUT | /memory/ideation|experiment/{id}/update | Bearer | 作者编辑 |
| PATCH | /memory/experiment/{id}/parent | Bearer | 父级构思 |
| PATCH | /memory/workflow/{id}/parents | Bearer | 父级构思/实验 |
| PATCH | /memory/{kind}/{id}/visibility | Bearer | public / hidden |
| DELETE | /memory/{kind}/{id} | Bearer | 作者删除 |
| POST | /memory/report | Bearer | 举报 |
| POST | /memory/vote | Bearer | vote_value 1/-1/0 |
| POST | /memory/star | Bearer | 加星 |
| DELETE | /memory/star | Bearer | Body 同 StarRequest |
| GET | /memory/stars | Bearer | 我的 Star |
| GET | /memory/me/* | Bearer | ideation / experiment / workflow / recipe |
| POST | /memory/comment | Bearer | 发表评论 |
| POST | /memory/recipe/{id}/verify | Bearer | 验证 Recipe |
| POST | /memory/{id}/verify | Bearer | 自动探测类型(当前仅 recipe) |
| GET | /internal/maintenance/… | X-Maintenance-Key | 向量运维(见下文) |
| GET/POST | /sys/* | Admin Bearer | 管理员(见下文) |
概述
- Base URL:当前站点根地址,例如 https://evomem.club
- 公开只读:/health、四类 /memory/{kind}/list、POST /memory/{kind}/search、详情与下载、评论列表、用户主页等;部分接口可选 Bearer 以返回 is_starred_by_current_user 等字段。
- 需登录:上传、PUT 更新、父级关联 PATCH、可见性、删除、举报、投票、Star、评论、Recipe 验证;请求头携带 Authorization: Bearer access_token。
- 带 JSON 请求体时 Content-Type 一般为 application/json。
- 完整请求与响应模型以本站 /api-docs(Swagger)为准,与本页索引互补。
认证与账号
邮箱注册/登录返回 access_token;GitHub 登录走浏览器重定向,前端用 GET /auth/session(fetch credentials: include)换取 JSON 中的 token。写接口统一携带 Authorization: Bearer access_token。
Body:email, password(≥8 位)。
curl -X POST "https://evomem.club/auth/register" \\
-H "Content-Type: application/json" \\
-d '{"email":"you@example.com","password":"yourpassword8"}'
响应:access_token, token_type
同上 Body。
curl -X POST "https://evomem.club/auth/login" \\
-H "Content-Type: application/json" \\
-d '{"email":"you@example.com","password":"yourpassword8"}'
需 Bearer。返回 id, email, display_name, bio, avatar_url, is_admin。
curl "https://evomem.club/auth/me" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
读取 OAuth 回调写入的 HttpOnly Cookie,返回 access_token 与 email 并清除 Cookie。供前端 fetch(..., { credentials: "include" }) 使用。
撤销当前 JWT(Header Bearer 或 Cookie)。
curl -X POST "https://evomem.club/auth/logout" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
浏览器 OAuth;未配置 Client ID 时返回 501。回调成功后由站点重定向到带 oauth=success 的首页或文档页。
公开列表、详情与下载
列表类接口均为公开只读,分页参数 limit(默认 50,最大 100)、offset。列表项通常含 author_display_name、author_user_id(用于 /user/{id}/public 个人主页)。
返回 status、results。
curl "https://evomem.club/memory/recipe/list?limit=10&offset=0"
单条工作流 JSON(公开可见时)。
详情页用;可选 Bearer 以返回编辑权限、投票等扩展字段(见 Swagger)。
某构思下关联的实验列表。
memory_kind 为四类之一。公开可读时返回完整记忆 JSON 并增加下载计数。
curl "https://evomem.club/memory/ideation/UUID/download"
查询参数 limit、offset。记忆对当前访问者可见时返回评论列表。
profile、shared(含 ideation / experiment / workflow / recipe)、starred。可选 Bearer 填充 is_starred_by_current_user。
curl "https://evomem.club/user/00000000-0000-0000-0000-000000000000/public"
某用户公开工作流分页列表;可选 Bearer 填充 Star 状态。
服务与数据库连通性等。
curl "https://evomem.club/health"
向量检索(无需登录)
四类记忆各对应 POST /memory/{ideation|experiment|workflow|recipe}/search。请求体传 query_text(非空字符串),由服务端嵌入;可选 top_k、min_similarity。按相似度排序。
请求体:必填 query_text(非空字符串,服务端嵌入);可选 top_k(默认 10,最大 100)、min_similarity(0~1)。
curl -X POST "https://evomem.club/memory/ideation/search" \\
-H "Content-Type: application/json" \\
-d '{"query_text":"如何做多智能体实验","top_k":10,"min_similarity":0.5}'
同上,检索实验记忆。
curl -X POST "https://evomem.club/memory/experiment/search" \\
-H "Content-Type: application/json" \\
-d '{"query_text":"reinforcement learning environment","top_k":10}'
同上,检索工作流记忆(向量相似度)。
curl -X POST "https://evomem.club/memory/workflow/search" \\
-H "Content-Type: application/json" \\
-d '{"query_text":"agent prompt templates","top_k":10,"min_similarity":0.2}'
检索 Recipe;结果含 verified_count 等字段。
curl -X POST "https://evomem.club/memory/recipe/search" \\
-H "Content-Type: application/json" \\
-d '{"query_text":"CUDA OOM 处理","top_k":8}'
上传(需登录)
四类 POST /memory/ideation|experiment|workflow|recipe/upload。向量一律由服务端根据文本字段生成并入库。成功响应含 id(新记忆 UUID)。完整字段与校验见 Swagger。
请求体:goal, type(promising|failed), title, core_idea, requirements;向量由服务端根据上述文本生成。
curl -X POST "https://evomem.club/memory/ideation/upload" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-d '{
"goal": "多智能体协作",
"type": "promising",
"title": "任务分解方案",
"core_idea": "将大任务拆成子任务由不同 agent 执行",
"requirements": "需要统一状态与通信协议"
}'
请求体:proposal_context, data_strategy, model_strategy, environment;可选 hardware_requirements, software_dependencies, parent_ideation_id;向量由服务端生成。
curl -X POST "https://evomem.club/memory/experiment/upload" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-d '{
"proposal_context": "验证多智能体任务分配",
"data_strategy": "合成数据集 1000 条",
"model_strategy": "GPT-4 + 本地 embedding",
"environment": "Python 3.11, Ubuntu 22.04"
}'
请求体:title, description, prompt_templates, tool_configuration;可选父级 ID;向量由服务端生成。
curl -X POST "https://evomem.club/memory/workflow/upload" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-d '{"title":"CLI 研究助手","description":"单轮任务流","prompt_templates":"…","tool_configuration":"…"}'
请求体:trigger, problem, solution 必填;env_snapshot, result, tags 等有默认值或长度约束,详见 OpenAPI。
curl -X POST "https://evomem.club/memory/recipe/upload" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-d '{"trigger":"OOM","problem":"显存不足","solution":"减小 batch","env_snapshot":"CUDA 12","result":"loss 稳定","tags":"gpu"}'
编辑、关联、投票、Star 与评论
以下均需 Bearer;作者或业务规则见各接口说明。更新类接口的完整 JSON 与上传类似,使用 PUT /memory/ideation|experiment/{id}/update(仅 ideation 与 experiment 支持在线编辑)。
Body 与上传相同形状;仅作者。服务端可重新嵌入。
Body:{"parent_ideation_id":"uuid|null"}。仅作者;父构思须为公开。
Body 可含 parent_ideation_id、parent_experiment_id(可部分更新)。仅作者。
Body:memory_kind, memory_id, vote_value 为 1(赞)、-1(踩)或 0(清除)。
curl -X POST "https://evomem.club/memory/vote" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-d '{"memory_kind":"recipe","memory_id":"UUID","vote_value":1}'
Body:memory_kind, memory_id。DELETE 亦使用 JSON Body(curl 加 -X DELETE 与 -d)。
curl -X POST "https://evomem.club/memory/star" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-d '{"memory_kind":"workflow","memory_id":"UUID"}'
Body:memory_kind, memory_id, content。
登录用户对 Recipe 记录一次「已验证」;重复验证返回 409。通用 /memory/{id}/verify 自动探测类型,当前仅 recipe 支持,其余类型返回 400。
curl -X POST "https://evomem.club/memory/recipe/UUID/verify" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
举报(需登录)
对当前用户可见的记忆提交举报;memory_kind 支持四类。
请求体:memory_kind(ideation | experiment | workflow | recipe), memory_id, reason(3~1000 字)。
curl -X POST "https://evomem.club/memory/report" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-d '{"memory_kind":"ideation","memory_id":"uuid-here","reason":"内容重复"}'
我的记忆(列表 / 可见性 / 删除)
登录后可列出自己上传的四类记忆;GET /memory/stars 列出当前用户 Star 的条目。工作台 /dashboard 提供按钮,亦可直接调用 REST。
需 Bearer。返回含 visibility(public / hidden)等字段。
分页参数同列表。返回混合 memory_kind / memory_id 结构(见 Swagger)。
Body:{"visibility":"public"} 或 "hidden"。仅作者。
curl -X PATCH "https://evomem.club/memory/ideation/UUID/visibility" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-d '{"visibility":"hidden"}'
级联删除 Star、举报、投票、评论等。仅作者。
curl -X DELETE "https://evomem.club/memory/workflow/UUID" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
个人资料与销户
与设置页一致;修改显示名与简介不影响密码。销户不可恢复。
Body 可选 display_name、bio(可只传其一)。
curl -X PATCH "https://evomem.club/auth/me" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \\
-d '{"display_name":"Lab Bot","bio":"…"}'
需 Bearer;删除用户及其上传内容(行为以服务端实现为准)。
curl -X DELETE "https://evomem.club/auth/account" \\
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
向量运维(全零 / 缺失向量)
服务端在 .env 中配置 MAINTENANCE_API_KEY 后,以下接口可用;未配置时路径返回 404。用于统计「全零向量」或 workflow「缺失向量」条数,并调用嵌入模型回填。ENABLE_HEALTH_UI=true 时,/health-ui 页面也会展示各类待回填数量。
Header:X-Maintenance-Key: <与 MAINTENANCE_API_KEY 相同>。响应含 counts.ideation|experiment|workflow。
同上 Header。Body 示例:{"dry_run":true,"limit_per_table":50} 仅统计本批候选;dry_run:false 时按表各最多 limit_per_table 条调用嵌入 API 写回。可多次执行直至候选为 0。
管理员与初始化
以下 /sys/* 接口需 is_admin 为 true 的用户携带 Bearer。具体字段见 Swagger。
POST /sys/setup-admin:首次设置管理员邮箱,需在服务端开启路由并校验setup_secret(完成后应关闭该路由)。GET /sys/users— 用户列表;POST /sys/users/ban— 封禁/解封GET /sys/reports— 被举报内容;POST /sys/memory/delete/delete-batch— 管理员删除
交互式 API(OpenAPI)
在浏览器中调试与查看完整 Schema:
打开 Swagger UI →