plan-archive
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/plan-archive — 歸檔已完成的 Plan
/plan-archive — Archive Completed Plans
將 中已完成的 plan 移至 ,並補上驗證結果。
plans/active/plans/completed/ECC 資源感知: 若有可用的 code-reviewer agent,可輔助驗證 plan 中的實作結果。
Move completed plans in to and add verification results.
plans/active/plans/completed/ECC Resource Awareness: If a usable code-reviewer agent is available, it can assist in verifying the implementation results in the plan.
Step 1:找出要歸檔的 Plan
Step 1: Locate the Plan to Archive
如果有傳入引數(檔名或路徑),直接使用。
否則,列出 下的所有 :
plans/active/.mdbash
ls plans/active/*.md 2>/dev/null若有多個,依 mtime 排序,問使用者選哪一個。
若只有一個,直接用。
若目錄不存在或空,輸出「找不到待歸檔的 plan」並結束。
If an argument (filename or path) is passed in, use it directly.
Otherwise, list all files under :
.mdplans/active/bash
ls plans/active/*.md 2>/dev/nullIf there are multiple files, sort them by mtime and ask the user which one to select.
If there is only one, use it directly.
If the directory does not exist or is empty, output "No plan to be archived found" and exit.
Step 2:讀取 Plan 內容
Step 2: Read Plan Content
讀取目標 plan 檔案,確認:
- 是否有 或
## Phase段落(實作步驟)## Step - 是否有 或
## 驗證段落## Verification - 是否有 段落
## Industry & Standards Reference
Read the target plan file and confirm:
- Whether there is a or
## Phasesection (implementation steps)## Step - Whether there is a or
## 驗證section## Verification - Whether there is a section
## Industry & Standards Reference
Step 3:補充驗證結果
Step 3: Supplement Verification Results
在 plan 檔案頂部(緊接 frontmatter 後)加上:
---markdown
**狀態:✅ 完成(YYYY-MM-DD)**
再追加或更新 段落,填入:
## 驗證結果- 測試通過數(若有)
- 實際執行結果(對照 plan 中的「預期」)
- 業界/學術參照落實情況 — 對照 plan 的 Industry & Standards Reference,確認各項參照是否已實際應用
- 任何偏差或補充說明
Add the following at the top of the plan file (right after the frontmatter):
---markdown
**Status: ✅ Completed (YYYY-MM-DD)**
Then add or update the section, fill in:
## Verification Results- Number of passed tests (if any)
- Actual execution results (compared with "expectations" in the plan)
- Implementation status of industry/academic references — compare with the Industry & Standards Reference of the plan to confirm whether each reference has been actually applied
- Any deviations or supplementary explanations
Step 4:移動檔案
Step 4: Move the File
bash
mkdir -p plans/completed
mv plans/active/<filename>.md plans/completed/<filename>.md確認移動成功後輸出:
✅ 已歸檔:plans/completed/<filename>.mdbash
mkdir -p plans/completed
mv plans/active/<filename>.md plans/completed/<filename>.mdAfter confirming the move is successful, output:
✅ Archived: plans/completed/<filename>.md自動化(Hook 設定)
Automation (Hook Configuration)
若希望每次 後自動將 plan 存至 ,
可設定 PostToolUse hook:
ExitPlanModeplans/active/If you want to automatically save the plan to after each ,
you can configure the PostToolUse hook:
plans/active/ExitPlanMode1. 建立 hook script
1. Create the hook script
~/.claude/hooks/save-plan-on-exit.shbash
#!/bin/bash~/.claude/hooks/save-plan-on-exit.shbash
#!/bin/bashPostToolUse hook for ExitPlanMode
PostToolUse hook for ExitPlanMode
Reads JSON from stdin, copies plan file to project's plans/active/
Reads JSON from stdin, copies plan file to project's plans/active/
INPUT=$(cat)
INPUT=$(cat)
Extract plan_file path from tool response
Extract plan_file path from tool response
PLAN_FILE=$(echo "$INPUT" | python3 -c "
import sys, json
try:
d = json.load(sys.stdin)
# ExitPlanMode tool_response may contain the plan file path
resp = d.get('tool_response', d)
print(resp.get('plan_file', resp.get('planFile', '')))
except Exception:
print('')
" 2>/dev/null)
if [ -z "$PLAN_FILE" ] || [ ! -f "$PLAN_FILE" ]; then
exit 0
fi
PLAN_FILE=$(echo "$INPUT" | python3 -c "
import sys, json
try:
d = json.load(sys.stdin)
# ExitPlanMode tool_response may contain the plan file path
resp = d.get('tool_response', d)
print(resp.get('plan_file', resp.get('planFile', '')))
except Exception:
print('')
" 2>/dev/null)
if [ -z "$PLAN_FILE" ] || [ ! -f "$PLAN_FILE" ]; then
exit 0
fi
Only act if we're inside a git repo with a plans/ directory pattern
Only act if we're inside a git repo with a plans/ directory pattern
if [ ! -f "$(pwd)/.git/HEAD" ] && [ ! -d "$(pwd)/.git" ]; then
exit 0
fi
DEST_DIR="$(pwd)/plans/active"
mkdir -p "$DEST_DIR"
SLUG=$(basename "$PLAN_FILE")
cp "$PLAN_FILE" "$DEST_DIR/$SLUG"
echo "[plan-archive] Plan saved to plans/active/$SLUG" >&2
```bash
chmod +x ~/.claude/hooks/save-plan-on-exit.shif [ ! -f "$(pwd)/.git/HEAD" ] && [ ! -d "$(pwd)/.git" ]; then
exit 0
fi
DEST_DIR="$(pwd)/plans/active"
mkdir -p "$DEST_DIR"
SLUG=$(basename "$PLAN_FILE")
cp "$PLAN_FILE" "$DEST_DIR/$SLUG"
echo "[plan-archive] Plan saved to plans/active/$SLUG" >&2
```bash
chmod +x ~/.claude/hooks/save-plan-on-exit.sh2. 設定 ~/.claude/settings.json
~/.claude/settings.json2. Configure ~/.claude/settings.json
~/.claude/settings.jsonjson
{
"hooks": {
"PostToolUse": [
{
"matcher": "ExitPlanMode",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/hooks/save-plan-on-exit.sh"
}
]
}
]
}
}json
{
"hooks": {
"PostToolUse": [
{
"matcher": "ExitPlanMode",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/hooks/save-plan-on-exit.sh"
}
]
}
]
}
}3. Rule(搭配使用)
3. Rule (for combined use)
在專案 加入,確保 Claude 在實作完成後主動呼叫 :
CLAUDE.md/plan-archivemarkdown
undefinedAdd to the project's to ensure that Claude actively calls after the implementation is completed:
CLAUDE.md/plan-archivemarkdown
undefinedCommit 前知識沉澱清單
Knowledge Precipitation Checklist Before Commit
- 歸檔 plan — 若本次工作有對應的 plan,實作完成後執行 將
/plan-archive移至plans/active/<name>.md,補上驗證結果plans/completed/
---- Archive plan — If there is a corresponding plan for this work, execute after the implementation is completed Move
/plan-archivetoplans/active/<name>.md, add verification resultsplans/completed/
---目錄規範
Directory Specification
plans/
├── active/ # 進行中(Hook 自動存入 / /plan 手動建立)
├── completed/ # 已實作完成(/plan-archive 歸檔)
└── archived/ # 長期封存(不再參考的舊 plan)plans/
├── active/ # In progress (automatically saved by Hook / manually created via /plan)
├── completed/ # Implemented and completed (archived via /plan-archive)
└── archived/ # Long-term archived (old plans no longer referenced)