gsd-mempalace-recall

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
STOP -- DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by the command system. Using the Read tool on this file wastes tokens. Begin executing Step 0 immediately.
STOP -- 请勿阅读此文件。你正在阅读它。此提示由命令系统注入到你的上下文环境中。使用Read工具读取此文件会浪费token。请立即开始执行第0步。

Step 0 -- Banner

第0步 -- 横幅

Before ANY tool calls, display this banner:
GSD > MEMPALACE RECALL
Then proceed to Step 1.
在进行任何工具调用之前,显示此横幅:
GSD > MEMPALACE RECALL
然后继续执行第1步。

Step 1 -- Config Gate

第1步 -- 配置校验

Check whether the MemPalace capability is enabled by reading
.planning/config.json
directly with the Read tool.
DO NOT use
gsd-tools config get-value
-- it hard-exits on missing keys.
  1. Read
    .planning/config.json
    with the Read tool.
  2. If the file does not exist: write the "unavailable" stub (Step 4) and STOP.
  3. Parse the JSON. Proceed to Step 2 only if
    config.mempalace && config.mempalace.enabled === true
    and
    config.mempalace.recall_on_plan !== false
    . Otherwise display the disabled message and STOP (
    recall_on_plan: false
    turns plan-time recall off while leaving the rest of the capability enabled).
Disabled message:
GSD > MEMPALACE RECALL

MemPalace memory is disabled. To activate:

  node <runtime-home>/gsd-core/bin/gsd-tools.cjs config-set mempalace.enabled true

Recall is opt-in; the loop proceeds normally without it.
This step is
onError: skip
at
plan:pre
-- recall never blocks planning.
通过Read工具直接读取
.planning/config.json
,检查MemPalace功能是否已启用。
请勿使用
gsd-tools config get-value
——该命令在遇到缺失的键时会强制退出。
  1. 使用Read工具读取
    .planning/config.json
  2. 如果文件不存在:写入“不可用”存根(第4步)并停止
  3. 解析JSON。仅当
    config.mempalace && config.mempalace.enabled === true
    config.mempalace.recall_on_plan !== false
    时,才继续执行第2步。否则显示禁用提示并停止
    recall_on_plan: false
    会关闭规划阶段的回忆功能,但保留MemPalace的其他功能)。
禁用提示:
GSD > MEMPALACE RECALL

MemPalace记忆功能已禁用。如需激活:

  node <runtime-home>/gsd-core/bin/gsd-tools.cjs config-set mempalace.enabled true

回忆功能为可选开启;即使不启用,流程也会正常运行。
此步骤在
plan:pre
阶段设置为
onError: skip
——回忆功能绝不会阻塞规划流程。

Step 2 -- Resolve wing, mode, and transport

第2步 -- 确定分支(Wing)、模式和传输方式

  1. Wing. Use
    config.mempalace.wing
    if non-empty; otherwise derive from
    config.project_code
    ; otherwise fall back to the repository directory name.
  2. Mode. Read
    config.mempalace.memory_mode
    (
    augment
    |
    kg_backend
    |
    replace
    , default
    augment
    ). It sets how authoritative the palace is during recall:
    • augment
      — the palace is an additional layer; read native memory (
      .planning/graphs/
      , STATE) too and treat the palace as supplementary.
    • kg_backend
      — for knowledge-graph facts, query the palace's temporal KG first, as the primary source; fall back to
      .planning/graphs/
      when the palace is unreachable. Non-KG drawer recall stays additive.
    • replace
      — resolve recall through the palace as the source of truth; consult native artifacts only as a fallback when the palace is unreachable. In every mode an unreachable palace degrades to native memory — recall never blocks (
      onError: skip
      ).
  3. Transport. Prefer the MCP tools (
    mempalace_*
    ) in interactive runs when your MemPalace MCP server is registered and your runtime permits those tools. Otherwise — headless/cron/autonomous runs, or runtimes that don't grant the MemPalace MCP tools — use the CLI (
    mempalace wake-up
    ,
    mempalace search
    ), which this skill's
    Bash
    allow-tool always covers. If neither is reachable, go to Step 4.
  4. Topic. Read the phase
    CONTEXT.md
    (the consumed artifact). Derive a short search query from its title, goal, and key decisions.
  1. 分支(Wing):如果
    config.mempalace.wing
    不为空则使用该值;否则从
    config.project_code
    推导;如果仍无法获取,则回退为仓库目录名称。
  2. 模式:读取
    config.mempalace.memory_mode
    (可选值:
    augment
    |
    kg_backend
    |
    replace
    ,默认值
    augment
    )。该参数用于设置回忆过程中MemPalace的权威性:
    • augment
      —— MemPalace作为附加层;同时读取原生记忆(
      .planning/graphs/
      、STATE),将MemPalace的内容作为补充。
    • kg_backend
      —— 对于知识图谱相关事实,优先查询MemPalace的时序知识图谱作为主要来源;当MemPalace无法访问时,回退到
      .planning/graphs/
      。非知识图谱抽屉的回忆仍为附加模式。
    • replace
      —— 将MemPalace作为唯一可信来源进行回忆;仅当MemPalace无法访问时,才将原生制品作为回退方案。 在所有模式下,若MemPalace无法访问,都会降级为使用原生记忆——回忆功能绝不会阻塞流程(
      onError: skip
      )。
  3. 传输方式:在交互式运行中,优先使用MCP工具
    mempalace_*
    ),前提是你的MemPalace MCP服务器已注册且运行环境允许使用这些工具。否则——在无头/定时任务/自主运行场景,或运行环境不支持MemPalace MCP工具时——使用CLI命令
    mempalace wake-up
    mempalace search
    ),该技能的
    Bash
    允许工具始终支持此方式。如果两种方式都无法访问,执行第4步。
  4. 主题:读取阶段文件
    CONTEXT.md
    (已加载的制品)。从其标题、目标和关键决策中提炼简短的搜索查询词。

Step 3 -- Retrieve (read-only)

第3步 -- 检索(只读)

All calls in this step are side-effect-free. On any error or timeout, stop retrieving and write whatever was gathered (or the stub) -- never raise. This skill reads only the palace; GSD's planner reads native memory (
.planning/graphs/
, STATE) regardless. So under
kg_backend
/
replace
an unreachable palace falls back to that native memory automatically — reflect that in the stub (Step 4) rather than implying memory is gone.
  1. Wake up (cheap, ~600--900 tokens):
    • Interactive: read the wing identity/summary, then
      mempalace_search
      .
    • Headless:
      mempalace wake-up --wing <wing>
      .
  2. Targeted search:
    • Interactive:
      mempalace_search(query=<topic>, wing=<wing>)
      .
    • Headless:
      mempalace search "<topic>" --wing <wing>
      .
  3. Knowledge-graph facts (unless
    config.mempalace.mirror_kg !== false
    — registry default is true, an absent key means enabled):
    mempalace_kg_query
    /
    mempalace_kg_timeline
    for decisions relevant to the topic and their validity windows. Under
    augment
    the palace KG supplements GSD's native
    .planning/graphs/
    — combine both, do not treat the palace as the sole source. Under
    kg_backend
    or
    replace
    the palace KG is the primary graph source — query it first and use
    .planning/graphs/
    only as a fallback when the palace is unreachable.
  4. Dedup the returned drawers/facts; keep the top results.
此步骤中的所有调用均无副作用。若出现任何错误或超时,停止检索并写入已收集到的内容(或存根)——绝不要抛出异常。本技能仅读取MemPalace的内容;GSD的规划器会自行读取原生记忆(
.planning/graphs/
、STATE)。因此在
kg_backend
/
replace
模式下,若MemPalace无法访问,会自动回退到原生记忆——在第4步的存根中需体现这一点,而非暗示记忆功能失效。
  1. 唤醒(成本低,约600--900 token):
    • 交互式:读取分支标识/摘要,然后执行
      mempalace_search
    • 无头模式:执行
      mempalace wake-up --wing <wing>
  2. 定向搜索
    • 交互式:执行
      mempalace_search(query=<topic>, wing=<wing>)
    • 无头模式:执行
      mempalace search "<topic>" --wing <wing>
  3. 知识图谱事实(除非
    config.mempalace.mirror_kg !== false
    ——注册表默认值为true,若该键缺失则表示启用):执行
    mempalace_kg_query
    /
    mempalace_kg_timeline
    ,获取与主题相关的决策及其有效时间范围。在
    augment
    模式下,MemPalace的知识图谱是GSD原生
    .planning/graphs/
    补充——需结合两者内容,不要将MemPalace视为唯一来源。在
    kg_backend
    replace
    模式下,MemPalace的知识图谱是主要图谱来源——优先查询它,仅当MemPalace无法访问时才回退到
    .planning/graphs/
  4. 去重返回的抽屉/事实;保留排名靠前的结果。

Step 4 -- Write MEMORY-RECALL.md

第4步 -- 写入MEMORY-RECALL.md

Write
MEMORY-RECALL.md
in the current phase directory. The planner consumes it.
When recall succeeded, structure it as:
markdown
undefined
在当前阶段目录下写入
MEMORY-RECALL.md
,供规划器使用。
当回忆成功时,按以下结构编写:
markdown
undefined

Memory Recall (MemPalace)

记忆调取(MemPalace)

Wing: <wing> · Mode: <mode> · Transport: <mcp|cli>
分支:<wing> · 模式:<mode> · 传输方式:<mcp|cli>

Prior decisions

过往决策

  • <decision> — <provenance: drawer id / kg fact, valid_from>
  • <决策内容> —— <来源:抽屉ID / 知识图谱事实,生效时间>

Patterns

模式

  • <pattern><provenance>
  • <模式内容> —— <来源>

Surprises / gotchas

意外情况/注意事项

  • <surprise><provenance>

When MemPalace is unreachable, write the stub and continue. Under `kg_backend`/`replace`, name the native fallback so the planner knows memory is not gone — only un-augmented by the palace this run:

```markdown
  • <意外内容> —— <来源>

当MemPalace无法访问时,写入存根并继续流程。在`kg_backend`/`replace`模式下,需注明原生回退方案,让规划器知晓记忆功能并未失效——只是本次运行未使用MemPalace进行增强:

```markdown

Memory Recall (MemPalace)

记忆调取(MemPalace)

MemPalace unavailable at recall time — falling back to GSD native memory (
.planning/graphs/
, STATE). No palace recall this run.
undefined
调取时MemPalace不可用——回退到GSD原生记忆(
.planning/graphs/
、STATE)。本次运行未使用MemPalace进行回忆。
undefined

Anti-Patterns

反模式

  1. DO NOT let any MemPalace error fail the step -- recall is
    onError: skip
    .
  2. DO NOT write to the palace from this skill -- recall is read-only; capture is a separate skill.
  3. DO NOT paste raw search output into the file -- distil to decisions/patterns/surprises with provenance.
  4. DO NOT skip the config gate.
  1. 绝不要让MemPalace的任何错误导致步骤失败——回忆功能设置为
    onError: skip
  2. 绝不要通过本技能向MemPalace写入内容——回忆是只读操作;内容捕获由单独的技能负责。
  3. 绝不要将原始搜索输出直接粘贴到文件中——需提炼为带来源信息的决策/模式/意外情况记录。
  4. 绝不要跳过配置校验步骤。