gsd-mempalace-capture
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSTOP -- 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.
停止——请勿阅读此文件。您已经在阅读它了。此提示由命令系统注入到您的上下文环境中。使用Read工具读取此文件会浪费token。请立即开始执行步骤0。
Step 0 -- Banner
步骤0 —— 横幅
Before ANY tool calls, display this banner:
GSD > MEMPALACE CAPTUREThen proceed to Step 1.
在调用任何工具之前,显示以下横幅:
GSD > MEMPALACE CAPTURE然后继续执行步骤1。
Step 1 -- Config Gate
步骤1 —— 配置检查
Check whether the MemPalace capability is enabled by reading directly with the Read tool.
.planning/config.json- Read with the Read tool.
.planning/config.json - If the file does not exist, or is absent, or
config.mempalace, orconfig.mempalace.enabled !== true: display the disabled message and STOP.config.mempalace.capture_artifacts === false - Otherwise proceed to Step 2.
Disabled message:
GSD > MEMPALACE CAPTURE
MemPalace capture is disabled (mempalace.enabled / mempalace.capture_artifacts).
Nothing was filed; the loop proceeds normally.This step is at / / -- capture never fails a phase.
onError: skipdiscuss:postplan:postverify:post使用Read工具直接读取,检查MemPalace功能是否已启用。
.planning/config.json- 使用Read工具读取。
.planning/config.json - 如果文件不存在,或字段缺失,或
config.mempalace,或config.mempalace.enabled !== true:显示禁用提示并停止。config.mempalace.capture_artifacts === false - 否则继续执行步骤2。
禁用提示信息:
GSD > MEMPALACE CAPTURE
MemPalace capture is disabled (mempalace.enabled / mempalace.capture_artifacts).
Nothing was filed; the loop proceeds normally.此步骤在//阶段设置为——捕获操作不会导致阶段失败。
discuss:postplan:postverify:postonError: skipStep 2 -- Resolve target
步骤2 —— 确定目标
- Artifact. Take the artifact from . If absent, infer from the loop point:
$ARGUMENTS→discuss:post,CONTEXT.md→plan:post,PLAN.md→verify:post.SUMMARY.md - Room. Map artifact → room:
- →
CONTEXT.mddecisions - →
PLAN.mdplanning - →
SUMMARY.md(Confirmed problem→fix pairs go tomilestones— see theproblemsfragment used atcapture-problems.)execute:wave:post
- Wing. if non-empty, else
config.mempalace.wing, else the repo directory name.config.project_code - Mode / transport. Read . Prefer MCP (
config.mempalace.memory_mode) when your MemPalace MCP server is registered and your runtime permits those tools; otherwise use themempalace_*CLI (covered by this skill'smempalaceallow-tool), as inBash.mempalace-recall
- 工件:从中获取工件。如果不存在,则根据循环节点推断:
$ARGUMENTS→discuss:post,CONTEXT.md→plan:post,PLAN.md→verify:post。SUMMARY.md - 空间(Room):将工件映射到对应空间:
- →
CONTEXT.md(决策空间)decisions - →
PLAN.md(规划空间)planning - →
SUMMARY.md(里程碑空间) (已确认的问题→修复配对将存入milestones(问题空间)——详见problems阶段使用的execute:wave:post片段。)capture-problems
- 分区(Wing):若非空则使用该值,否则使用
config.mempalace.wing,再否则使用仓库目录名称。config.project_code - 模式/传输方式:读取。若已注册MemPalace MCP服务器且运行时允许使用相关工具,则优先使用MCP(
config.mempalace.memory_mode);否则使用mempalace_*CLI(此技能的mempalace允许工具已覆盖该命令),例如Bash。mempalace-recall
Step 3 -- File verbatim (idempotent)
步骤3 —— 原样归档(幂等性)
On any error or timeout, stop and let the phase continue -- capture is best-effort.
-
Dedup first. Interactive:on the artifact's deterministic drawer id. Headless: rely on
mempalace_check_duplicate's content-hash idempotency.mempalace mine -
Add the drawer (verbatim). File the exact artifact text intoof
room: <room>with provenance (wing: <wing>, phase id). Interactive:source_file. Headless: see below.mempalace_add_drawerhas nomempalace mineflag — only--roomacceptssearch(CLI reference: https://mempalaceofficial.com/reference/cli.html). Room assignment is driven by--roommatching folder-path segments against thedetect_room()list inrooms:(mining guide: https://mempalaceofficial.com/guide/mining.html — "Rooms are auto-detected from your folder structure"; config reference: https://mempalaceofficial.com/guide/configuration.html). Stage the artifact under a room-named folder somempalace.yamlassigns it correctly:detect_room()bashSTAGE=".planning/.mempalace-stage" # One-time: declare the GSD room taxonomy so detect_room() recognizes these folders mkdir -p "$STAGE" [ -f "$STAGE/mempalace.yaml" ] || cat > "$STAGE/mempalace.yaml" <<'YAML' # Each entry MUST be a dict with a `name` key (the miner's detect_room() # indexes room["name"] — a bare-string list crashes _mine_impl with # TypeError: string indices must be integers, not 'str'). Optional fields: # `description`, `keywords` (matched against folder-path segments). rooms: - name: decisions - name: planning - name: milestones - name: problems - name: general YAML # Suppress MemPalace cache artifacts written into the scanned tree [ -f "$STAGE/.gitignore" ] || echo "mempalace_embedder.json" > "$STAGE/.gitignore" # Stage under <room>/<phase-id>/<basename> — stable path so mine's content-hash # idempotency (file_already_mined keys on absolute source_file + mtime) deduplicates # instead of creating duplicate drawers on re-runs. ROOM_DIR="$STAGE/<room>/<phase-id>" mkdir -p "$ROOM_DIR" cp "<artifact-path>" "$ROOM_DIR/<basename>" # Mine with --wing only — no --room flag; detect_room() assigns from the folder path mempalace mine "$STAGE" --wing <wing> -
Mirror KG facts unless(registry default is true — an absent key means enabled): extract decision/delivery facts and
config.mempalace.mirror_kg === falsethem withmempalace_kg_add= the phase date (e.g.valid_fromfrom CONTEXT;(<project>, decided, <decision>)from SUMMARY). Under(<phase>, delivered, <capability>)these are an additive mirror of GSD's nativeaugment. Under.planning/graphs//kg_backendthe palace KG is the authoritative fact store — GSD still producesreplacethrough its normal graphify, so an unreachable palace never loses a fact..planning/graphs/ -
Re-running a phase MUST NOT create duplicate drawers (deterministic ids +).
check_duplicate
若出现任何错误或超时,停止操作并让阶段继续——捕获操作仅做最大努力尝试。
-
先去重:交互式模式:对工件的确定性抽屉ID执行。无头模式:依赖
mempalace_check_duplicate的内容哈希幂等性。mempalace mine -
添加抽屉(原样):将工件的精确文本连同来源信息(、阶段ID)归档至
source_file下的wing: <wing>。交互式模式:使用room: <room>。无头模式:详见下文。mempalace_add_drawer没有mempalace mine参数——只有--room命令接受search参数(CLI参考文档:https://mempalaceofficial.com/reference/cli.html)。空间分配由--room函数驱动,该函数会将文件夹路径片段与detect_room()中的mempalace.yaml列表进行匹配(挖掘指南:https://mempalaceofficial.com/guide/mining.html ——“空间会从您的文件夹结构中自动检测”;配置参考文档:https://mempalaceofficial.com/guide/configuration.html)。将工件暂存到以空间命名的文件夹下,以便rooms:正确分配空间:detect_room()bashSTAGE=".planning/.mempalace-stage" # One-time: declare the GSD room taxonomy so detect_room() recognizes these folders mkdir -p "$STAGE" [ -f "$STAGE/mempalace.yaml" ] || cat > "$STAGE/mempalace.yaml" <<'YAML' # Each entry MUST be a dict with a `name` key (the miner's detect_room() # indexes room["name"] — a bare-string list crashes _mine_impl with # TypeError: string indices must be integers, not 'str'). Optional fields: # `description`, `keywords` (matched against folder-path segments). rooms: - name: decisions - name: planning - name: milestones - name: problems - name: general YAML # Suppress MemPalace cache artifacts written into the scanned tree [ -f "$STAGE/.gitignore" ] || echo "mempalace_embedder.json" > "$STAGE/.gitignore" # Stage under <room>/<phase-id>/<basename> — stable path so mine's content-hash # idempotency (file_already_mined keys on absolute source_file + mtime) deduplicates # instead of creating duplicate drawers on re-runs. ROOM_DIR="$STAGE/<room>/<phase-id>" mkdir -p "$ROOM_DIR" cp "<artifact-path>" "$ROOM_DIR/<basename>" # Mine with --wing only — no --room flag; detect_room() assigns from the folder path mempalace mine "$STAGE" --wing <wing> -
镜像KG事实,除非(注册表默认值为true——缺失该键意味着功能启用):提取决策/交付事实,并使用
config.mempalace.mirror_kg === false命令添加,设置mempalace_kg_add为阶段日期(例如从CONTEXT中提取valid_from;从SUMMARY中提取(<project>, decided, <decision>))。在(<phase>, delivered, <capability>)模式下,这些事实是GSD原生augment的增量式镜像。在.planning/graphs//kg_backend模式下,MemPalace的KG是权威事实存储——GSD仍会通过正常的图形化流程生成replace,因此即使MemPalace不可访问,也不会丢失任何事实。.planning/graphs/ -
重新运行阶段时不得创建重复抽屉(通过确定性ID +实现)。
check_duplicate
Step 4 -- Report
步骤4 —— 报告
Print a one-line summary: or .
Filed <artifact> → <wing>/<room> (<n> KG facts)MemPalace unavailable — capture skipped打印一行摘要:(已归档<工件>至<分区>/<空间>(共<n>条KG事实))或(MemPalace不可用——已跳过捕获操作)。
Filed <artifact> → <wing>/<room> (<n> KG facts)MemPalace unavailable — capture skippedAnti-Patterns
反模式
- DO NOT let any MemPalace error fail the step -- capture is .
onError: skip - DO NOT write lossy summaries -- store the verbatim artifact text (AAAK compression is a separate, optional index).
- DO NOT prune or delete drawers here -- pruning () is the curator agent's job at
sync --apply, wing-scoped only.ship:post - DO NOT skip the config gate or the dedup check.
- 请勿让任何MemPalace错误导致步骤失败——捕获操作设置为。
onError: skip - 请勿编写有损摘要——存储工件的原始文本(AAAK压缩是独立的可选索引)。
- 请勿在此处修剪或删除抽屉——修剪操作()是curator agent在
sync --apply阶段的工作,且仅针对指定分区。ship:post - 请勿跳过配置检查或去重验证。