Replaces /btw's blocking side panel with a plain, scrollable transcript answer.

/btw(現在の作業を中断せずに聞ける side question 機能)は、回答を待っている間メインの会話がスクロールできなくなり、その画面を閉じると回答がキャンセルされてしまう。
この mod は /btw を自前の実装で肩代わりする。command.run を { command: 'btw' } でフックし、next() を呼ばずに答えてしまうことで、ブロッキングなサイドパネルを使うビルトイン実装そのものを素通りさせる。回答は普通のトランスクリプトの行として出る($.model.fork で、現在の会話を文脈にしたツールなしの一回限りの応答を取り、それをコマンドの出力テキストとして返すだけ)ので、ロックするパネルも、閉じて中断するものも存在しない。
/btw <質問> は今まで通り。質問が空なら使い方を返す。
claude plugin validate mods/btw-fix
claude plugin test mods/btw-fix
セッションでホットリロードを有効にして実機で試す場合は、このフォルダをそのまま dev-mods フォルダ(plugin-authoring スキルが教える場所)にコピーすればよい。
hooks/register.ts 36 lines1import type { Register } from 'claude-code'
2
3// The built-in /btw opens a blocking side panel: the main transcript can't be
4// scrolled while it's pending, and closing the panel cancels the answer.
5// Answering `command.run` here ourselves (without calling `next`) shadows
6// that built-in behavior entirely — our `{ text }` prints as a normal
7// transcript row instead, so there's nothing to lock the screen or to close.
8export const register: Register = on => {
9 on('command.run', { command: 'btw' }, async ($, e) => {
10 const question = e.args.trim()
11
12 if (question === '') {
13 return {
14 text: 'Usage: /btw <question> — answers a quick side question from the current conversation, without opening a side panel.',
15 }
16 }
17
18 $.ui.toast('💭 /btw: answering…')
19
20 const result = await $.model.fork({ prompt: question })
21
22 if (result.isAnswered) return { text: result.text }
23
24 switch (result.reason) {
25 case 'nothing-to-fork':
26 return { text: '/btw has nothing to go on yet — send a message first.' }
27 case 'empty-reply':
28 return { text: '/btw got no answer back.' }
29 case 'aborted':
30 return { text: '/btw was interrupted.' }
31 case 'api-error':
32 return { text: `/btw failed to reach the model (${result.error}).` }
33 }
34 })
35}
36