github / github/copilot-cli

sessionStart  prompt hooks don't fire on  /new , and  /clear  seems to skip sessionStart entirely — naming/behavior mismatch

未关闭
#4,365 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

area:configuration area:sessions
主要语言
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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 sessionStart hook 文档开始,跟踪 /new 和 /clear 命令如何处理 hook 源。确认 prompt hook 的当前行为,并确定这些转换应使用 sessionStart 还是一个独立事件。完成的标准是事件语义、源值和文档保持一致,并且受影响的转换都有测试覆盖。

由索引模型根据 Issue 内容生成。

评估

技术栈
shell
领域
cli, developer-experience
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。