Files
system-dev-template/template/.claude/hooks/session-start-recall.sh
T
Leo 39783cccc8 feat: 接關 hook + SDD 強制 hook(實作 wishlist 兩項)
§1 接關機制(雙保險):
- session-start-recall.sh:SessionStart 自動注入 status 重點 + 快照核實提醒
- /wiki-recall:fallback 命令,hook 失效時手動接關

§2 軟規範 → 硬攔截:
- sdd-guard.sh:動 code 檔但無 SDD → exit 2 擋(/sdd-check 自動版)
- pre-write-guard.sh:專案自訂禁令骨架(預設停用)
- settings.json:掛 SessionStart + PreToolUse

配套:install.sh 下載 hooks/settings(settings 比照 CLAUDE.md 不覆蓋);
README/CLAUDE.md 補文件 + 誠實限制聲明。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 16:04:58 +08:00

33 lines
1.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# SessionStart hook — 開 session 自動注入 status.md 重點
# wishlist §1 主路徑:不靠 CC 自覺、不用人說,開 session 就把進度推到眼前。
#
# 掛在 settings.json 的 SessionStartmatcher: startup|resume|clear)。
# stdout 會被當成 context 注入給 CC。
#
# 鐵律:status 是 point-in-time 快照,非即時狀態。
# 這個 hook 只負責「把快照推到眼前」,核實快照是 CC 的責任——下面的提醒就是要它別盲信。
set -euo pipefail
STATUS_FILE=".claude/wiki/status.md"
# 沒有 wiki 就安靜退出(exit 0),不干擾還沒 /wiki-init 的專案
if [ ! -f "$STATUS_FILE" ]; then
exit 0
fi
echo "════════════════════════════════════════════════"
echo "📍 接關:上次進度(來自 $STATUS_FILE 快照)"
echo "════════════════════════════════════════════════"
echo ""
cat "$STATUS_FILE"
echo ""
echo "────────────────────────────────────────────────"
echo "⚠️ 以上是 point-in-time 快照,非即時狀態。"
echo " 動手前先核實:快照寫的事項是否真的還沒做完?"
echo " 需要完整脈絡(decisions / mistakes / SDD)→ 執行 /wiki-recall"
echo "════════════════════════════════════════════════"
exit 0