Context & Motivation
Before fully transitioning Discord request handling from the existing debate/direct-execution path to the CLI mirror streaming approach, we needed to run both in parallel to evaluate CLI mirror’s real-world performance and catch any bugs.
The CLI mirror approach provides 1.5s streaming updates with visible tool calls in Discord threads — a significantly better UX than the current batch-response model.
What Was Built
Every fresh request in #requests now also fires a shadow run through #cli-mirror (fire-and-forget). Both the existing debate/direct path and the CLI mirror streaming path execute simultaneously.
Key Details
- Shadow mirrors don’t count against
activeJobsconcurrency limits - Thread names suffixed with
(mirror)for easy identification - Metrics source tagged as
cli-mirror-shadow - Only fresh requests mirrored (not session resumes/replies)
- Fire-and-forget: if the mirror fails, the original request still completes
Architecture
User posts in #requests
|
index.js request handler
|-- [fire-and-forget] mirrorRequestToCliMirror() --> #cli-mirror thread (streaming)
| --> 1.5s polling, tool call display
|
+-- [awaited] existing path (debate/handleRequest) --> #requests reply (batch)
Decisions
- Fire-and-forget shadow rather than replacing the existing path — zero risk, easy to remove
- No concurrency tracking for shadows — prevents false blocking of real requests
- Only fresh requests — session continuity (–resume) is path-specific
Files Changed
src/bot/cliMirror.js— AddedmirrorRequestToCliMirror()(+128 lines)src/bot/index.js— Shadow trigger in request handler (+8 lines)
Open Items
- Monitor resource usage (two Claude processes per request during testing)
- Compare quality and latency between both paths
- Once satisfied, remove shadow and switch #requests to CLI mirror as primary
Repo: centralDiscord | Commit: faff71f