github / github/copilot-cli

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

Đang mở
#4,365 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:configuration area:sessions
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

### 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_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với tài liệu về hook sessionStart và theo dõi cách các lệnh /new và /clear xử lý các nguồn hook. Xác nhận hành vi hiện tại của các prompt hook và xác định liệu các chuyển đổi này nên sử dụng sessionStart hay một sự kiện riêng biệt. Công việc được hoàn tất khi ngữ nghĩa sự kiện, các giá trị nguồn và tài liệu nhất quán, đồng thời các chuyển đổi bị ảnh hưởng được bao phủ bởi các bài kiểm thử.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
shell
Lĩnh vực
cli, developer-experience
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.