Skip to main content
Glama

memory_reconcile_apply

Apply LLM-confirmed reconciliation operations in batches to merge, invalidate, score, or promote memory memos deterministically and idempotently.

Instructions

按需整理·应用:批量执行 LLM 精判确认后的操作(确定性,幂等)。

每条操作是一个 dict,按 op 字段分派(未知/缺字段返回 error,不阻断其余):

  • merge:{op:"merge", content:合并后新内容, memo_ids:[被并各条], memo_type?:"summary", scope_path?} —— 建新 memo,把被并各条置 invalid、 invalidated_by 指向新条(Zep 失效语义不删除)。

  • invalidate:{op:"invalidate", memo_ids:[...]} —— 逐条失效(矛盾/被推翻)。

  • score:{op:"score", memo_id, quality_score:1-10, reason} —— 补质量分, reason 入 meta。

  • promote:{op:"promote", content, kind:constraint/design/directive/preference, scope?:"project"/global/user, source_refs?:[源 memo id]} —— 蒸馏提升为方向层 条目;红线照常生效(单条 ≤400 字 + 桶字符配额 global 1200 / project 1500 / user 300,超限该条返回 error 带用量;安全扫描同样生效)。

  • keep / noop:不动(可省略)。

幂等:对已失效条目重复 invalidate/merge 返回 noop 不报错。应用后自动刷新 项目 last_reconcile_at(整理分界线;写入路径不再据此推送提示,见 api/routes/task_memo.py 顶部注释)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationsYes操作列表,每条一个 dict,按 op 字段分派为 merge / invalidate / score / promote / keep(各字段见工具说明)。 一次可混装多种 op;单条出错只返回该条 error,不阻断其余。

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.11.2
    • changedInput schema / properties / operations / description
      Previous value: -"操作列表(见上)"New value: +"操作列表,每条一个 dict,按 op 字段分派为\nmerge / invalidate / score / promote / keep(各字段见工具说明)。\n一次可混装多种 op;单条出错只返回该条 error,不阻断其余。"
  2. First observedv1.9.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and does so richly: it documents Zep-style invalidation semantics (merge sets memo_ids invalid with invalidated_by rather than deleting), per-op error isolation, idempotency on already-invalidated items, and the enforce red-line quotas (≤400 chars per entry, global 1200 / project 1500 / user 300) with over-limit errors returning usage. That is exactly the behavioral context an agent needs before invoking.

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 purpose and determinism/idempotency claim are front-loaded, then each op type is a compact bullet with its fields. It is dense but every bullet maps to a distinct dispatch branch, so the length is largely justified; a small amount of explanatory padding (the code-path reference) could be trimmed.

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

Completeness5/5

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

An output schema exists, so return-value explanation is unnecessary, and the description fills the remaining gaps: per-op semantics, mixed-op batching, per-item error isolation, red-line constraints, and the side effect of refreshing last_reconcile_at. Nothing an agent needs to invoke it correctly appears to be missing.

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

Parameters5/5

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

Schema coverage is 100%, but the schema only declares an array of unconstrained objects with an 'op' discriminator. The description goes well beyond the schema by fully specifying the item shapes for merge, invalidate, score, promote (including kind enum values and scope options) and keep/noop, which is essential disambiguation the schema cannot provide.

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

Purpose4/5

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

The description states a specific verb+resource: batch-applying LLM-adjudicated memory reconciliation operations, with explicit determinism and idempotency. It distinguishes itself contextually from the candidate-generation flow ('LLM 精判确认后'), but it names no sibling tool directly, so the differentiation is implied rather than stated.

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

Usage Guidelines4/5

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

It clearly positions the tool: use it to apply operations after LLM adjudication has confirmed them, and it explains that keep/noop can be omitted and that unknown-field/unknown-op cases return an error without blocking. It does not explicitly name an alternative (e.g. memory_reconcile_candidates or memory_invalidate) or state when not to use it.

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

Deploy Server

Other Tools