modscode JA

modscode / Code / Toast

Show a toast

$.ui.toast(text) shows a short notice with the mod's name at the top right of the transcript, gone after a few seconds (4 by default, or { timeoutMs }). It starts no turn, so it suits telling the user a job finished or failed.

$.ui.toast(text, { timeoutMs })$.ui.log(text)

The smallest form

hooks/register.js
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
  })
}

Written by modscode with the API of the official docs. Free to use.

Real mods' code (6)

Quoted as is from public mods on GitHub, at the commit the gallery read. The heading leads to the mod's page (what it does, its good points, its design, what its code reaches); the file name leads to the lines on GitHub.

Check the code yourself before you copy or install it. Mods run unsandboxed, with your permissions. modscode does not vouch for what the code does.

lane-stack VKirill · Terminal + desktop · ★ 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 licence. Keep its notice when you copy the code. Its code and design

Licence text (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 · Terminal + desktop · ★ 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 licence. Keep its notice when you copy the code. Its code and design

Licence text (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 · Terminal + desktop · ★ 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 licence. Keep its notice when you copy the code. Its code and design

Licence text (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 · Terminal + desktop · ★ 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 licence. Keep its notice when you copy the code. Its code and design

Licence text (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 · Terminal + desktop · ★ 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 licence. Keep its notice when you copy the code. Its code and design

Licence text (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 · Terminal + desktop · ★ 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 type

MIT licence. Keep its notice when you copy the code. Its code and design

Licence text (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.

Start building

Put a .claude-plugin/plugin.json ({"name": "my-mod"}) and a hooks/hooks.json ({"modules": ["register.js"]}) in a folder, save the code above as hooks/register.js, and run claude --plugin-dir . to load it for one session. claude plugin validate . lists the events it hooks and the APIs it calls.

Other patterns