## 経緯
昨年末に[[GitHub Copilot CLI]]を試しに使ってみた。仕事で使えるかどうかを探ってみたかったからだ。
<div class="link-card-v2">
<div class="link-card-v2-site">
<img class="link-card-v2-site-icon" src="https://publish-01.obsidian.md/access/35d05cd1bf5cc500e11cc8ba57daaf88/favicon-64.png" />
<span class="link-card-v2-site-name">Minerva</span>
</div>
<div class="link-card-v2-title">
📜2025-12-07 GitHub Copilot CLIを使ってみる
</div>
<div class="link-card-v2-content">GitHub Copilot CLIをmise経由でインストールし、デバイスコード認証でログインした。初期モデルはClaude Sonnet 4.5で、GPT-5.1-Codex-Maxに変更した。Vueコンポーネントのフィルタリングロジック改良を依頼したところ、500エラーが発生しつつも日本語で高品質なコード提案を返した一方、通知が地味な挙動を示した。</div>
<img class="link-card-v2-image" src="https://publish-01.obsidian.md/access/35d05cd1bf5cc500e11cc8ba57daaf88/Notes/attachments/activity.webp" />
<a data-href="📜2025-12-07 GitHub Copilot CLIを使ってみる" class="internal-link"></a>
</div>
%%[[📜2025-12-07 GitHub Copilot CLIを使ってみる]]%%
当時の軽いまとめは以下の通りで『通知が地味で気づきにくい』というデメリットがあった。
> ### 良い点
>
> - 特に指示をしなくても日本語で返答してくれた
> - [[AGENTS.md]]も見られてそう
>
> ### 気になる点
>
> - 通知が地味
> - [[Claude Code]]や[[Codex CLI]]みたいにOS通知を利用する方法もある?
他にもpublic previewということもあり安定性に欠けたし、[[Codex CLI]]を使ったり、[[VSCode]]から[[GitHub Copilot]]を使ったほうが遥かに便利だったのでそっと蓋をした気がする。
ただ、最近[[cmux]]というものに巡り合ってしまった。
<div class="link-card-v2">
<div class="link-card-v2-site">
<img class="link-card-v2-site-icon" src="https://publish-01.obsidian.md/access/35d05cd1bf5cc500e11cc8ba57daaf88/favicon-64.png" />
<span class="link-card-v2-site-name">Minerva</span>
</div>
<div class="link-card-v2-title">
📜2026-02-22 cmuxを試してみる
</div>
<div class="link-card-v2-content">ZellijとCodex CLI併用時のスクロール不具合をきっかけに、libghostty採用のcmuxをHomebrewで導入し、ワークスペースとサーフェイス中心の運用方針を試行した。</div>
<img class="link-card-v2-image" src="https://publish-01.obsidian.md/access/35d05cd1bf5cc500e11cc8ba57daaf88/Notes/attachments/activity.webp" />
<a data-href="📜2026-02-22 cmuxを試してみる" class="internal-link"></a>
</div>
%%[[📜2026-02-22 cmuxを試してみる]]%%
これがメチャクチャ良かったので、[[Ghostty]]や[[Zellij]]は使いつつも[[cmux]]を本気で応援していくことにした。2020年末の[[Obsidian]]にBetしたときと同じ感覚。その間、もう5年もの月日が経っていたとは。。
### 環境
| 対象 | バージョン |
| ---------------------- | ------- |
| [[macOS]] | 15.7.3 |
| [[Ghostty]] | 1.2.3 |
| [[GitHub Copilot CLI]] | 0.0.414 |
| [[cmux]] | 0.60.0 |
## 通知の方法について
hooksの仕組みは既に導入されていそうなので使おうと思った......
<div class="link-card-v2">
<div class="link-card-v2-site">
<img class="link-card-v2-site-icon" src="https://github.githubassets.com/favicons/favicon.svg" />
<span class="link-card-v2-site-name">GitHub</span>
</div>
<div class="link-card-v2-title">
Feature Request: Hooks system for notifications (similar to Claude Code) · Issue #971 · github/copilot-cli
</div>
<div class="link-card-v2-content">
Summary Add a hooks system that allows users to run custom shell commands when certain events occur, such as whe ...
</div>
<img class="link-card-v2-image" src="https://opengraph.githubassets.com/046a0ef8dda77f8015010f141f338ea767cc768cf230c6cf3ec7a812e8bcbccb/github/copilot-cli/issues/971" />
<a href="https://github.com/github/copilot-cli/issues/971"></a>
</div>
が、どうやらユーザーレベルのhooksは使えないという回答が[[Codex CLI]]から返ってきた。
> [!left-bubble] ![[chappy.webp]]
> • 結論として、現状はユーザー全体の hooks 共通ディレクトリ(例: ~/.copilot/hooks)は公式サポートされていません。
> Copilot CLI の hooks は、作業中ディレクトリ側の .github/hooks/*.json から読み込まれます。
>
> 実運用の回避策はこの2つが現実的です。
>
> 1. 共通実体を ~/.config/copilot-hooks に置き、各リポジトリの .github/hooks にシンボリックリンクする
> 2. 新規リポジトリ作成時に .github/hooks を自動生成するスクリプトを用意する
>
> ~/.github/hooks をグローバル扱いで使う方法は、$HOME で CLI を起動する必要があり、権限スコープ的に非推奨です。
>
> 参考:
>
> - https://docs.github.com/en/copilot/tutorials/copilot-cli-hooks
> - https://docs.github.com/pt/copilot/how-tos/copilot-cli/customize-copilot/use-hooks
> - https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli
Issueで同様のことを確認しているコメントはある。
> [@RyanHecht](https://github.com/RyanHecht) any chance you could support hooks being defined at the system/global level when you roll out too?
>
> *[Feature Request: Hooks system for notifications (similar to Claude Code) · Issue #971 · github/copilot-cli](https://github.com/github/copilot-cli/issues/971#issuecomment-3755438062) *
ドキュメントの記載。パスを見るとユーザーレベルっぽいが、本文を見るとリポジトリ内とあるので.....。
> This is an example configuration file that lives in `~/.github/hooks/project-hooks.json` within a repository.
>
> *[About hooks - GitHub Docs](https://docs.github.com/en/copilot/concepts/agents/coding-agent/about-hooks#example-hook-configuration-file)*
ただ、ユーザーレベルはやはり対応されてなさそうに見える。
> I was actually looking for **user level** notifications.
>
> I found that [Feature Request: Hooks system for notifications (similar to Claude Code)](https://github.com/github/copilot-cli/issues/971) might meet my needs.
> Referring to this file [Example hook configuration file](https://docs.github.com/en/copilot/concepts/agents/coding-agent/about-hooks#example-hook-configuration-file) to set up hooks and use [Toasty](https://github.com/shanselman/toasty) to send notifications,
> I found that the same hook configuration file only works at the repo level ({repo_path}/.github/hooks/_.json) and currently has no effect at the user level (~/.github/hooks/_.json).
>
> *[Feature Request: User Level Toast Notification · Issue #905 · github/copilot-cli](https://github.com/github/copilot-cli/issues/905#issuecomment-3766158517)*
このissueが該当しそう。直近では実装される気配はなさそう。
<div class="link-card-v2">
<div class="link-card-v2-site">
<img class="link-card-v2-site-icon" src="https://github.githubassets.com/favicons/favicon.svg" />
<span class="link-card-v2-site-name">GitHub</span>
</div>
<div class="link-card-v2-title">
Feature Request: User Level Hooks · Issue #1067 · github/copilot-cli
</div>
<div class="link-card-v2-content">
Describe the feature or problem you'd like to solve No response Proposed solution Based on the following user re ...
</div>
<img class="link-card-v2-image" src="https://opengraph.githubassets.com/f5761d088cffb3ac7b9bcbc17ebb0d56fabd59aa66ea166c19a145a20b70ecc7/github/copilot-cli/issues/1067" />
<a href="https://github.com/github/copilot-cli/issues/1067"></a>
</div>
### プラグインをつくってみる
[[🦉copilot-plugin-notify]]を作ってみた。
<div class="link-card-v2">
<div class="link-card-v2-site">
<img class="link-card-v2-site-icon" src="https://github.githubassets.com/favicons/favicon.svg" />
<span class="link-card-v2-site-name">GitHub</span>
</div>
<div class="link-card-v2-title">
GitHub - tadashi-aikawa/copilot-plugin-notify: Copilot CLI hook events are emitted as OSC 777 notification escape sequences; listeners such as cmux can consume these notifications.
</div>
<div class="link-card-v2-content">
Copilot CLI hook events are emitted as OSC 777 notification escape sequences; listeners such as cmux can consume ...
</div>
<img class="link-card-v2-image" src="https://opengraph.githubassets.com/075add3b68367bccb400f4dc59cafe1388070d78bc7f58180b0e614bcd7c7644/tadashi-aikawa/copilot-plugin-notify" />
<a href="https://github.com/tadashi-aikawa/copilot-plugin-notify"></a>
</div>
詳しくはこちら。
<div class="link-card-v2">
<div class="link-card-v2-site">
<img class="link-card-v2-site-icon" src="https://publish-01.obsidian.md/access/35d05cd1bf5cc500e11cc8ba57daaf88/favicon-64.png" />
<span class="link-card-v2-site-name">Minerva</span>
</div>
<div class="link-card-v2-title">
📜2026-02-22 GitHub Copilot CLIで人間が確認待ちの状態になっている場合に通知する
</div>
<div class="link-card-v2-content">GitHub Copilot CLIで人間の確認待ち状態を通知する目的で、cmuxフック断念後にOSC 777シーケンス出力のプラグインを作成し、cmuxの不安定さやpreToolUse通知乱発、許可済みコマンドの通知抑制を環境変数とフック設定で対処した経緯と実装内容を記録した</div>
<img class="link-card-v2-image" src="https://publish-01.obsidian.md/access/35d05cd1bf5cc500e11cc8ba57daaf88/Notes/attachments/activity.webp" />
<a data-href="📜2026-02-22 GitHub Copilot CLIで人間が確認待ちの状態になっている場合に通知する" class="internal-link"></a>
</div>
%%[[📜2026-02-22 GitHub Copilot CLIで人間が確認待ちの状態になっている場合に通知する]]%%
エッジケースでは期待通り動作しないこともあると思うが、8割以上のケースでは支障ない動きをしていると思う。[[cmux]]で動作確認しているが、[[Ghostty]]など[[OSC 777 シーケンス]]に対応している[[ターミナル]]ならば動くはず。