add_lesson
Records a single explicit lesson, pitfall, or technical finding from a conversation into persistent memory so it can be reused across tools; use it when you already know what to save.
Instructions
记录单条经验教训(你已经知道要记什么)。 / Record one lesson learned when you already know what to save.
**Lifecycle: writeback** — 对话中学到可复用的经验时调用。
Lifecycle: writeback — call when reusable experience is learned during conversation.
用途:用户明确说出一条踩坑经验或技术发现时调用。
Purpose: Call when the user explicitly states a lesson, pitfall, or technical finding.
注意:如果用户给了一段会话摘要让你自动提取,请用 extract_session_insights 而不是本工具。
Note: If the user gives a session summary for automatic extraction, use extract_session_insights instead.
Args:
summary: 教训的一行摘要。 / One-line lesson summary.
detail: 详细说明(可选)。 / Detailed explanation (optional).
domain: 技术领域(可选),可填多个,逗号分隔,如 'python,testing'。 / Technical domain (optional); may contain multiple comma-separated labels such as 'python,testing'.
source_tool: 记录来源工具,如 'claude_code', 'codex'(可选,建议填写)。 / Source tool, such as 'claude_code' or 'codex' (optional but recommended).
source_url: 如果教训来自外部内容,填写来源 URL(可选)。 / Source URL when the lesson comes from external content (optional).
source_agent: 产生/校验此条目的 agent 身份(可选,如 'claude_code',比 source_tool 更细)。 / Agent identity that produced or validated this entry (optional; finer-grained than source_tool).
run_id: 产生此条目的工作流/会话运行 ID(可选)。 / Workflow/session id that produced this entry (optional).
last_validated_at: 人/agent 最近确认此条目仍然成立的 ISO-8601 时间(可选)。 / ISO-8601 time this entry was last confirmed to still hold (optional).
allow_similar_new: 摘要相似但不相同、确属新条目时设为 true:按相关条目写入并互链,而不是作为重复候选进入待审(可选,默认 false)。不能绕过完全相同(规范化后)内容的拒绝;该拒绝会指向已有条目并给出修订方式。 / Set true when a similar but not identical summary is genuinely a NEW fact: it is stored linked as related instead of queued for review as a duplicate candidate (optional, default false). It cannot bypass the refusal of identical content (after normalization); that refusal names the existing entry and how to revise it.
supersedes: 本条修订的已有 lesson ID(可选)。修订提案总是进入待审,主人批准后旧条目才被取代;被主人钉住的条目只能这样修订。 / ID of the existing lesson this one revises (optional). A revision is always a proposal that waits for the Owner; the old lesson is superseded only on approval. An Owner-pinned lesson can only be revised this way.
supersedes_expected_version: 填写 supersedes 时必填:旧条目的当前版本号。缺失 → version_required,不匹配 → version_conflict,均零写入。 / Required with supersedes: the old lesson's current version. Missing -> version_required; mismatch -> version_conflict; both write nothing.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"summary": "<summary>"
},
"name": "add_lesson"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detail | No | ||
| domain | No | ||
| run_id | No | ||
| summary | Yes | ||
| source_url | No | ||
| supersedes | No | ||
| source_tool | No | ||
| source_agent | No | ||
| project_folder | No | ||
| user_confirmed | No | ||
| allow_similar_new | No | ||
| last_validated_at | No | ||
| supersedes_expected_version | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |