トースト(通知)を出す
$.ui.toast(text) は、会話の右上に mod の名前付きの短い知らせを出し、数秒(既定 4 秒、{ timeoutMs } で変更)で消えます。ターンを始めないので、作業の終わりや失敗を知らせるのに向きます。
最小の形
export function register(on) {
on('tool.call', { tool: ['Edit', 'Write'] }, async ($, e, next) => {
const result = await next(e)
if (!result.deny && !result.isError) $.ui.toast('Saved ' + e.file_path, { timeoutMs: 3000 })
return result
})
}
modscode が公式ドキュメントの API で書いた最小の例です。自由に使えます。
実際の Mod のコード(6 本)
GitHub の公開 Mod から、図鑑が読んだコミットの該当行をそのまま引いています。見出しから Mod のページ(何をするか・良いところ・画面・コードが触るもの)へ、ファイル名から GitHub の該当行へ移れます。
写す前・入れる前に、必ず自分でコードを確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode は中身の安全を保証しません。
lane-stack VKirill · ターミナル+デスクトップ · ★ 121
Solo PM conveyor for Claude Code: orchestrator agents, lane playbooks, onboard and resume commands.
on('prompt.submit', async ($, e, next) => {
if (e.text.trim().length < 12) return next(e)
const where = await whereami($)
const res = await post($, `${base}/hook/user-prompt-submit`, {
hook_event_name: 'UserPromptSubmit',
source: 'function-hook',
...where,
prompt: e.text,
})
if (typeof res?.output?.systemMessage === 'string') $.ui.toast(res.output.systemMessage)
const extra = res?.output?.hookSpecificOutput?.additionalContext
if (typeof extra !== 'string' || extra === '') return next(e)
return next({ ...e, context: [...(e.context ?? []), extra] })
})MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面
ライセンスの全文(MIT)
MIT License Copyright (c) 2026 VKirill and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
crit-tui Tomasz Tomczyk · ターミナル+デスクトップ · ★ 1178
Early: crit inside Claude Code. Comment on the conversation, your diff or a file in a pane, send the review to Claude, and read Claude's replies in threads.
on('tool.call', { tool: 'mcp__crit-tui__reply' }, async ($, e) => {
const input = e as unknown as { id?: string; body?: string }
const thread = input.id ? await findThread($, input.id) : undefined
if (!thread || !input.body) {
return { deny: `No crit thread with id ${input.id ?? '(none)'}. Call ${TOOL_PREFIX}threads to list them.` }
}
try {
await addReply($, thread, input.body, 'claude', false)
} catch (error) {
return { deny: `crit could not save the reply: ${String(error)}` }
}
$.ui.toast(`Claude replied on ${whereOf(thread, await read($, chatIndexA))}`)
await sync($)
return { result: 'Reply saved. The user sees it in the crit pane.' }
})MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面
ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Tomasz Tomczyk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
agent-radar Hamza Zafar · ターミナル+デスクトップ · ★ 120
One live line above the prompt per running subagent: time, tool count and what it's doing. /radar shows every agent and its messages.
on('turn.complete', async ($, e, next) => {
const r = await next(e)
if (e.agentId) {
const id = e.agentId
const failed = e.reason === 'error' || e.reason === 'aborted'
const list = await update($, agents, all =>
all.map(a => (a.id === id ? { ...a, status: failed ? 'failed' : 'done', endedAt: Date.now(), last: failed ? `stopped: ${e.reason}` : 'finished' } : a)),
)
const one = list.find(a => a.id === id)
if (one) $.ui.toast(`${failed ? '✗' : '✓'} ${one.description} ${failed ? 'failed' : 'done'} (${elapsed(one)} · ${one.tools} tools)`)
}
return r
})MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面
ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Hamza Zafar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
rulebook-guard Hamza Zafar · ターミナル+デスクトップ · ★ 120
Writing and git rules: replaces em dashes in prose, and asks before git commit --amend, an unformatted push, or personal info in notes and commits.
on('tool.call', { tool: 'Write' }, async ($, e, next) => {
if (await isPrivatePath($, e.file_path)) {
const found = pii(e.content)
if (found && !(await allow($, `This write to ${short(e.file_path)} contains what looks like ${found}.`))) {
return { deny: `rulebook-guard: the user blocked writing ${found} to ${e.file_path}. Personal info needs the user's approval first. Write the outcome instead of the details.` }
}
}
if (PROSE_FILE.test(e.file_path) && e.content.includes('—')) {
$.ui.toast(`rulebook-guard: replaced ${count(e.content)} em dash(es) in ${short(e.file_path)}`)
return next({ ...e, content: undash(e.content) })
}
return next(e)
})MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面
ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Hamza Zafar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
winnow Ghaleb Dweikat · ターミナル+デスクトップ · ★ 102
A calibrated context sieve for Claude Code. Every large tool result is judged by a System One model before it enters context; irrelevant blocks are replaced with a summary and a recall key.
on('prompt.submit', async ($, e, next) => {
if (e.text.trim().length < 12 || link.quiet()) return next(e)
const res = await ask($, link, '/hook/user-prompt-submit', {
hook_event_name: 'UserPromptSubmit',
source: 'function-hook',
...(await whereami($)),
prompt: e.text,
})
if (typeof res?.output?.systemMessage === 'string') $.ui.toast(res.output.systemMessage)
const extra = res?.output?.hookSpecificOutput?.additionalContext
if (typeof extra !== 'string' || extra === '') return next(e)
return next({ ...e, context: [...(e.context ?? []), extra] })
})MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面
ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Ghaleb Dweikat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ruflo-mods ruvnet · ターミナル+デスクトップ · ★ 73986
ruflo as a Claude Code mod (function hooks, ADR-404): in-process prompt routing, edit learning signals, tighten-only tool checks from ruflo policy, the cost-tracker budget ladder, a mod trust gate for newly installed mods, and the $.ruflo …
on('agent.offer', async ($, e, next) => {
const result = await next(e)
if (!result.isOffered) return result
const kept = isKept(e, { keep: options.agentTrimKeep, usage: await loadLedger($, state), prompt: state.agentTrim.prompt, now: await $.clock.now() })
if (kept) return result
const first = state.agentTrim.hidden.size === 0
state.agentTrim.hidden.add(e.agent)
if (first) {
try {
$.ui.toast('ruflo agentTrim: unused agent types are hidden from the model (see /ruflo-mods)')
} catch {
// a refused toast never changes the answer
}
}
return { ...result, isOffered: false }
}).catch(($, e, next) => next(e)) // fail open: a broken trim offers the typeMIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面
ライセンスの全文(MIT)
MIT License Copyright (c) 2024-2026 ruvnet Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
作り始める
フォルダーに .claude-plugin/plugin.json({"name": "my-mod"})と hooks/hooks.json({"modules": ["register.js"]})を置き、上のコードを hooks/register.js に保存して、claude --plugin-dir . で 1 セッションだけ読み込みます。claude plugin validate . で、フックするイベントと呼ぶ API の一覧が出ます。