Discord Bridge for Autonomous Claude Code Sessions

A developer has built a Discord bridge for autonomous Claude Code sessions to solve the pull-based limitation where Claude only acts when tools fire or CLI input is sent. The system enables real-time two-way chat via WebSocket with local file queueing and push notifications on stop/error events.
Architecture
Inbound flow: Discord → WebSocket → bridge.js → discord-inbox.jsonl → PostToolUse hook → Claude
Outbound flow: Claude → Discord MCP → #claude-code-chat → phone push notification
Components
- bridge.js (~50 lines, discord.js v14): Persistent WebSocket to Discord gateway that listens to a dedicated channel and writes messages as JSONL to a local inbox file with zero API polling.
- PostToolUse hook: Reads local inbox on every tool call with no network calls or throttling — just a file read that takes microseconds versus the 2-minute polling interval used previously.
- PreToolUse hook: Auto-starts the bridge on first tool call of every session, silently doing nothing if already running.
- Outbound webhook: Sends structured STATUS updates on Stop/Error events with per-session named threads auto-created via Discord's thread_name parameter (requires ?wait=true to get channel_id back — default returns 204 empty).
Key Design Decisions
The main architectural shift was using a local file queue over API polling. JSONL with atomic truncation prevents race conditions. The bridge is session-agnostic — Discord history persists across crashes and restarts, allowing multiple agents to share the same channel.
Limitations
Permission approval prompts (1/2/3) still require terminal input since Claude is idle at that point and tools aren't firing. This works for redirecting mid-active-run but not for answering stopped prompts.
Testing Results
Tested on 27K lines analyzed overnight across two parallel sessions, finding 15 bugs and delivering a 6-month roadmap at 5:42 AM. Setup requires three bash files and approximately twenty minutes.
📖 Read the full source: r/LocalLLaMA
👀 See Also

Building a Sub-500ms Voice Agent: Architecture and Performance Insights
A developer built a voice agent from scratch achieving ~400ms end-to-end latency with full STT → LLM → TTS streaming. Key insights include treating voice as a turn-taking problem, using semantic end-of-turn detection, and colocating all components for minimal latency.

ClaudyBro: Native macOS Terminal for Claude Code Workflows
ClaudyBro is a 3.5 MB native Swift terminal app built specifically for Claude Code users, featuring image paste, process inspection, orphan cleanup, and smart MCP management. It uses 68 MB memory idle and 82 MB with Claude running.

Apfel: Free CLI Tool to Access Apple's On-Device LLM on macOS
Apfel v0.6.13 is a Swift 6.3 binary that exposes Apple's built-in LLM as a CLI tool, OpenAI-compatible server, and interactive chat. It runs 100% on-device with no API keys or costs, using the 4,096-token model shipped with macOS 26+ on Apple Silicon Macs.

ComfyUI Skill Enables AI Agents to Queue and Batch Image Renders via Natural Language
A new open-source skill allows OpenClaw agents to construct ComfyUI workflows, submit jobs, and manage renders through natural language commands like 'Make 50 variations of this concept with different seeds' or 'Compare these 4 prompts side by side at 1024x1024'.