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

Claude Code now supports 240+ models via NVIDIA NIM gateway — including Nemotron-3 120B for agentic coding
Claude Code can switch mid-session to 240+ NVIDIA NIM models via the /model command. The Nemotron-3 Super 120B thinking variant shows strong results for multi-file refactoring and agentic tasks.

Axe: A 12MB CLI for Single-Purpose LLM Agents
Axe is a lightweight Go binary that runs focused AI agents defined in TOML files. It treats agents like Unix programs, supporting stdin piping, sub-agent delegation, and multi-provider LLM integration.

OpenClaw Browser Relay Chrome Extension Alternative to Manual Configs
A Reddit user reports success with a Chrome extension for OpenClaw browser relay after manual configuration attempts caused system crashes and debugging headaches.

NexQuant: Rust-native 3-bit KV-cache engine for edge deployment
NexQuant is a production-hardened Rust engine that enables running high-context models on consumer hardware with 3-5x memory reduction. It supports Metal, CUDA, Vulkan, and CPU backends.