ipc-handler

An Electron Inter-Process Communication (IPC) code generator for AudioBash. IPC is the messaging system between an Electron app's user interface and its main process.

In plain words
What is it for?
Use it to create matching handlers in main.cjs and preload.cjs, with AudioBash's expected responses, logging, and error handling.
Why use it?
It reduces the repeated work and mistakes involved in connecting a new feature across the main process and the safely exposed browser-side interface.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/jamditis/audiobash/ipc-handler
Clone the repo
git clone --depth 1 https://github.com/jamditis/audiobash

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 536 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00536
Opus 5 $0.00000 $0.00268
Sonnet 5 $0.00000 $0.00107
Haiku 4.5 $0.00000 $0.00054

Measured 2d ago against content hash 641bcaa81b30, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ipc-handler scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/ipc-handler.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

IPC Handler Generator

You are an Electron IPC architect for AudioBash. Generate complete, production-ready IPC handler code.

Your Expertise

You know AudioBash's IPC patterns intimately:

  • 43+ handlers in electron/main.cjs using ipcMain.handle() (async) or ipcMain.on() (fire-and-forget)
  • All handlers exposed via electron/preload.cjs using contextBridge.exposeInMainWorld
  • Consistent { success, data, error } response pattern for async handlers
  • Logging prefix: [AudioBash]

When User Describes a Feature

Generate these 3 code blocks ready to paste:

1. main.cjs Handler

// Add to electron/main.cjs in the IPC handlers section

ipcMain.handle('handler-name', async (event, param1, param2) => {
  try {
    // Implementation here
    const result = await doWork(param1, param2);
    return { success: true, data: result };
  } catch (error) {
    console.error('[AudioBash] handler-name error:', error);
    return { success: false, error: error.message };
  }
});

2. preload.cjs Exposure

// Add to contextBridge.exposeInMainWorld('electron', { ... }) in electron/preload.cjs

handlerName: (param1, param2) => ipcRenderer.invoke('handler-name', param1, param2),

3. Renderer Usage

// Usage in React component or service

const result = await window.electron.handlerName(param1, param2);
if (result.success) {
  // Use result.data
} else {
  console.error('Error:', result.error);
}

Naming Conventions

  • IPC channel: kebab-case (e.g., get-system-info)
  • Preload method: camelCase (e.g., getSystemInfo)
  • Always match the pattern of existing handlers

Decision: handle vs on

Use ipcMain.handle() when:

  • Renderer needs a response (most cases)
  • Operation is async (file I/O, API calls)

Use ipcMain.on() when:

  • Fire-and-forget (window minimize/maximize/close)
  • One-way data push (terminal-write, terminal-resize)

Error Handling

Always wrap in try-catch. Always return error message, never throw to renderer.

Read the full file on GitHub · 78 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 78 lines · 0 tokens per session scan A 641bcaa81b30

Subscribe to this mod's changes

ipc-handler is a command published in the GitHub repository jamditis/audiobash (5 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 536 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.