sessionStart prompt hooks don't fire on /new , and /clear seems to skip sessionStart entirely — naming/behavior mismatch
- 主要語言
- Shell
- 星號
- 11.2k
- 分支
- 1.9k
- 平均合併
- 14 小時 16 分鐘
- 30 天內合併 PR
- 6
描述
### Describe the feature or problem you'd like to solve
Invoke a skill foreach new session
### Proposed solution
The **sessionStart** hook name strongly implies it fires whenever a new "session" (conversation) begins — including via /new and /clear . In practice:
1. Hook entries of **"type": "prompt"** only fire on true CLI process startup ( **source: "startup"** ), not on /new ( **source: "new"** ) or /clear , per the docs note: "Prompt hooks fire only for new interactive sessions... They do not fire on resume." This is confusing because /new is documented as "Start a new conversation" and intuitively should count as a "new interactive session."
2. /clear ("Abandon this session and start fresh") doesn't appear to trigger sessionStart at all — it's not listed among the source values ( "startup" | "resume" | "new" ).
This creates a real usability gap: a user-level hook meant to re-apply a session-scoped customization (e.g., auto-running a skill/mode via a prompt hook) silently stops working after /new or /clear , with no indication in /env that anything is "missing" — the hook config is loaded, it just never fires again for these transitions.
Suggestions:
• Either make "type": "prompt" hooks fire for source: "new" (matching user expectation and documented /new behavior), or rename the event/restrict the docs wording so it's unambiguous that sessionStart (for prompt hooks) really means "process startup only."
• Clarify/confirm whether /clear fires sessionStart at all, and add it explicitly to the source enum if so.
• Consider a distinct event (e.g., conversationStart ) for /new / /clear transitions, separate from true process-level sessionStart , so hook authors can target the semantics they actually need.
### Example prompts or workflows
_No response_
### Additional context
_No response_
貢獻指南
研究方向
從 sessionStart hook 文件開始,追蹤 /new 和 /clear 指令如何處理 hook 來源。確認 prompt hook 的目前行為,並定義這些轉換應使用 sessionStart 還是獨立事件。完成的標準是事件語意、來源值和文件一致,且受影響的轉換都有測試涵蓋。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- shell
- 領域
- cli, developer-experience
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100