memory-merger

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Memory Merger

记忆合并工具

You consolidate mature learnings from a domain's memory file into its instruction file, ensuring knowledge preservation with minimal redundancy.
Use the todo list to track your progress through the process steps and keep the user informed.
你需要将某个领域记忆文件中的成熟经验整合到其对应的指令文件中,确保知识得以保留且冗余度最低。
使用待办事项列表来追踪操作流程的进度,并及时告知用户。

Scopes

范围

Memory instructions can be stored in two scopes:
  • Global (
    global
    or
    user
    ) - Stored in
    <global-prompts>
    (
    vscode-userdata:/User/prompts/
    ) and apply to all VS Code projects
  • Workspace (
    workspace
    or
    ws
    ) - Stored in
    <workspace-instructions>
    (
    <workspace-root>/.github/instructions/
    ) and apply only to the current project
Default scope is global.
Throughout this prompt,
<global-prompts>
and
<workspace-instructions>
refer to these directories.
记忆指令可存储在两种范围中:
  • 全局
    global
    user
    ) - 存储在
    <global-prompts>
    vscode-userdata:/User/prompts/
    )中,适用于所有VS Code项目
  • 工作区
    workspace
    ws
    ) - 存储在
    <workspace-instructions>
    <workspace-root>/.github/instructions/
    )中,仅适用于当前项目
默认范围为全局
在本提示中,
<global-prompts>
<workspace-instructions>
均指代上述目录。

Syntax

语法

/memory-merger >domain-name [scope]
  • >domain-name
    - Required. The domain to merge (e.g.,
    >clojure
    ,
    >git-workflow
    ,
    >prompt-engineering
    )
  • [scope]
    - Optional. One of:
    global
    ,
    user
    (both mean global),
    workspace
    , or
    ws
    . Defaults to
    global
Examples:
  • /memory-merger >prompt-engineering
    - merges global prompt engineering memories
  • /memory-merger >clojure workspace
    - merges workspace clojure memories
  • /memory-merger >git-workflow ws
    - merges workspace git-workflow memories
/memory-merger >domain-name [scope]
  • >domain-name
    - 必填项。要合并的领域(例如:
    >clojure
    >git-workflow
    >prompt-engineering
  • [scope]
    - 可选项。可选值包括:
    global
    user
    (二者均表示全局)、
    workspace
    ws
    。默认值为
    global
示例:
  • /memory-merger >prompt-engineering
    - 合并全局prompt engineering记忆
  • /memory-merger >clojure workspace
    - 合并工作区clojure记忆
  • /memory-merger >git-workflow ws
    - 合并工作区git-workflow记忆

Process

操作流程

1. Parse Input and Read Files

1. 解析输入并读取文件

  • Extract domain and scope from user input
  • Determine file paths:
    • Global:
      <global-prompts>/{domain}-memory.instructions.md
      <global-prompts>/{domain}.instructions.md
    • Workspace:
      <workspace-instructions>/{domain}-memory.instructions.md
      <workspace-instructions>/{domain}.instructions.md
  • The user can have mistyped the domain, if you don't find the memory file, glob the directory and determine if there may be a match there. Ask the user for input if in doubt.
  • Read both files (memory file must exist; instruction file may not)
  • 从用户输入中提取领域和范围
  • 确定文件路径:
    • 全局:
      <global-prompts>/{domain}-memory.instructions.md
      <global-prompts>/{domain}.instructions.md
    • 工作区:
      <workspace-instructions>/{domain}-memory.instructions.md
      <workspace-instructions>/{domain}.instructions.md
  • 用户可能会输错领域名称,如果未找到记忆文件,请遍历目录判断是否存在匹配项。如有疑问,请询问用户。
  • 读取两个文件(记忆文件必须存在;指令文件可能不存在)

2. Analyze and Propose

2. 分析并提出合并建议

Review all memory sections and present them for merger consideration:
undefined
查看所有记忆章节,列出待合并的内容供用户参考:
undefined

Proposed Memories for Merger

待合并记忆建议

Memory: [Headline]

记忆:[标题]

Content: [Key points] Location: [Where it fits in instructions]
[More memories]...

Say: "Please review these memories. Approve all with 'go' or specify which to skip."

**STOP and wait for user input.**
内容: [核心要点] 位置: 在指令文件中的对应位置
[更多记忆]...

请告知用户:“请查看这些待合并的记忆。输入'go'表示全部批准,或指定需要跳过的内容。”

**暂停并等待用户输入。**

3. Define Quality Bar

3. 设定质量标准

Establish 10/10 criteria for what constitutes awesome merged resulting instructions:
  1. Zero knowledge loss - Every detail, example, and nuance preserved
  2. Minimal redundancy - Overlapping guidance consolidated
  3. Maximum scannability - Clear hierarchy, parallel structure, strategic bold, logical grouping
定义合并后优质指令文件的10/10评分标准:
  1. 无知识丢失 - 保留所有细节、示例和特殊说明
  2. 冗余度最低 - 整合重叠的指导内容
  3. 可读性最强 - 清晰的层级结构、统一的格式、重点内容加粗、逻辑分组合理

4. Merge and Iterate

4. 合并与迭代

Develop the final merged instructions without updating files yet:
  1. Draft the merged instructions incorporating approved memories
  2. Evaluate against quality bar
  3. Refine structure, wording, organization
  4. Repeat until the merged instructions meet 10/10 criteria
生成最终的合并后指令文件暂不更新实际文件
  1. 整合已批准的记忆内容,起草合并后的指令
  2. 根据质量标准进行评估
  3. 优化结构、措辞和组织方式
  4. 重复上述步骤直至合并后的指令达到10/10标准

5. Update Files

5. 更新文件

Once the final merged instructions meet 10/10 criteria:
  • Create or update the instruction file with the final merged content
    • Include proper frontmatter if creating new file
    • Merge
      applyTo
      patterns
      from both memory and instruction files if both exist, ensuring comprehensive coverage without duplication
  • Remove merged sections from the memory file
当最终合并后的指令达到10/10标准后:
  • 创建或更新指令文件,写入最终合并内容
    • 若为新文件,需包含正确的前置内容
    • 若记忆文件和指令文件均存在,合并两者的
      applyTo
      模式
      ,确保覆盖全面且无重复
  • 从记忆文件中移除已合并的章节

Example

示例

User: "/memory-merger >clojure"

Agent:
1. Reads clojure-memory.instructions.md and clojure.instructions.md
2. Proposes 3 memories for merger
3. [STOPS]

User: "go"

Agent:
4. Defines quality bar for 10/10
5. Merges new instructions candidate, iterates to 10/10
6. Updates clojure.instructions.md
7. Cleans clojure-memory.instructions.md
用户:"/memory-merger >clojure"

Agent:
1. 读取clojure-memory.instructions.md和clojure.instructions.md
2. 提出3条待合并的记忆内容
3. [暂停]

用户:"go"

Agent:
4. 定义10/10质量标准
5. 生成合并后的候选指令,迭代至符合10/10标准
6. 更新clojure.instructions.md
7. 清理clojure-memory.instructions.md