Skip to main content
Glama

memory_reconcile_apply

Applies confirmed memory reconciliation operations (merge, invalidate, score, promote) to update or invalidate entries, ensuring idempotent changes and lease release.

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(整理分界线)。

两道闸:① memo id 只认当前项目的,含别的项目 memo 的那条操作整条报错不执行; ② 须持有 memory_reconcile_candidates 发的整理权(peek 不发),否则整批不执行 (先不带 peek 重新 candidates)。本批全部成功即释放整理权;有报错则保留,修正后重试即可; 判完无需改动也提交一次空批(operations=[])释放整理权。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lease_idNocandidates 返回的 reconcile_lease.lease_id;CC 会话与 HTTP MCP 连接(如 Codex)自动识别本人可不传,其他调用方须传
keep_leaseNo分批应用时非最后一批传 true,本批全部成功也不释放整理权
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. Changed2 schema fields changedv1.15.0
    • addedInput schema / properties / keep_lease
      Added value: +{
      +  "default": false,
      +  "description": "分批应用时非最后一批传 true,本批全部成功也不释放整理权",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / lease_id
      Added value: +{
      +  "default": "",
      +  "description": "candidates 返回的 reconcile_lease.lease_id;CC 会话与 HTTP MCP\n连接(如 Codex)自动识别本人可不传,其他调用方须传",
      +  "type": "string"
      +}
  2. 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,不阻断其余。"
  3. First observedv1.9.0

TDQS

A4.9/5.0
Behavior5/5

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

No annotations are provided, so the description carries the full burden, and it delivers: idempotency (repeated invalidate/merge returns noop, not an error), the non-deleting Zep invalidation semantics (invalid + invalidated_by pointer), per-op non-blocking errors, automatic refresh of last_reconcile_at, and the lease lifecycle (released on full success, retained on any error). It also discloses red-line constraints on promote (400-char limit, bucket quotas) and that safety scanning applies.

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 long, but the length is justified by the operation-type dispatch table and the two-gate/lease rules. It is front-loaded (purpose, then op dispatch, then idempotency, then gates) and uses bullets, so density rather than bloat is the issue.

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 documentation is unnecessary, and the description still covers everything an agent needs to invoke correctly: operation types, error isolation, idempotency, lease acquisition/release, and project scoping. Nothing material for a correct call is 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?

Although schema description coverage is 100%, the operations schema only declares an array of free-form dicts and explicitly defers field semantics to the tool description ('各字段见工具说明'). The description therefore supplies the actual dispatch contract: the op field values and the exact fields for merge, invalidate, score, promote, and keep/noop, which the schema alone does not convey.

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 opening line states a specific verb and resource: batch-apply the operations that LLM reconciliation review confirmed, and it explicitly flags the properties (deterministic, idempotent). It distinguishes itself from the sibling memory_reconcile_candidates by casting that tool as the lease issuer and this one as the executor.

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 states the two gates (memo ids must belong to the current project; the caller must hold the lease issued by memory_reconcile_candidates), the alternative when the lease is missing (re-run candidates without peek), and the case for submitting an empty batch (operations=[]) to release the lease. When-to-use and prerequisites are spelled out rather than inferred.

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