Skip to main content
Glama

add_lesson

Record a lesson learned, pitfall, or technical finding with optional detail, domain tags, and source info. Keep knowledge persistent across MCP tools for future reference.

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: 相似摘要但确属新条目时,显式绕过去重门存为新条目并互链(可选,默认 false;同摘要不同正文时去重拒绝会带修订指引)。 / When the similar summary is genuinely a NEW fact, explicitly bypass the duplicate gate and store it linked as related (optional, default false; same-summary-different-body rejections carry revision guidance).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
detailNo
domainNo
run_idNo
summaryYes
source_urlNo
source_toolNo
source_agentNo
project_folderNo
user_confirmedNo
allow_similar_newNo
last_validated_atNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv4.19.1
    • addedInput schema / properties / allow_similar_new
      Added value: +{
      +  "default": false,
      +  "title": "Allow Similar New",
      +  "type": "boolean"
      +}
  2. Changed2 schema fields changedv4.13.0
    • addedInput schema / properties / project_folder
      Added value: +{
      +  "default": "",
      +  "title": "Project Folder",
      +  "type": "string"
      +}
    • addedInput schema / properties / user_confirmed
      Added value: +{
      +  "default": false,
      +  "title": "User Confirmed",
      +  "type": "boolean"
      +}
  3. Changed3 schema fields changedv3.48.0
    • addedInput schema / properties / last_validated_at
      Added value: +{
      +  "default": "",
      +  "title": "Last Validated At",
      +  "type": "string"
      +}
    • addedInput schema / properties / run_id
      Added value: +{
      +  "default": "",
      +  "title": "Run Id",
      +  "type": "string"
      +}
    • addedInput schema / properties / source_agent
      Added value: +{
      +  "default": "",
      +  "title": "Source Agent",
      +  "type": "string"
      +}
  4. Addedv3.29.1

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden and mostly meets it: it labels the lifecycle as writeback, implies persistence through 'Record', and discloses the duplicate gate plus the allow_similar_new bypass and the revision-guidance rejection behavior. It does not mention confirmation or project-folder scoping, but the core write and dedub behaviors are made explicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded: purpose, lifecycle, trigger condition, and alternative all appear near the top. The Args block uses a compact one-line-per-parameter format, and the bilingual duplication is functional for clarity. It is long but every section earns its place; no filler is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 11-parameter tool with no annotations and no schema descriptions, the description is remarkably complete: it covers usage boundary, alternative routing, dedub behavior, and most parameter semantics. The main gaps are project_folder and user_confirmed semantics and a description of side effects beyond 'writeback', but the output schema covers return-value expectations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides meaningful semantics for 9 of 11 parameters, with concrete examples ('python,testing', 'claude_code'), optionality/defaults, and the relationship between source_tool and source_agent. The omissions are project_folder and user_confirmed, which are present in the schema but not explained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a clear verb and object: 'Record one lesson learned' / '记录单条经验教训', and immediately states the precondition 'when you already know what to save'. It also names the sibling alternative extract_session_insights, making the distinction visible without inspecting other tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly says when to call: 'when reusable experience is learned during conversation' and 'when the user explicitly states a lesson, pitfall, or technical finding'. It also gives an explicit exclusion: if the user provides a session summary for automatic extraction, use extract_session_insights instead.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.