mwcyu stops maintaining its AI plumbing in triplicate

This fork ran three near-identical pipelines to talk to its AI models - now they share one.

infrastructureintegration

Mike can speak to more than one AI provider - Claude, OpenAI, and Gemini are the big general-purpose model makers behind tools like this. The catch is that supporting all three usually means three separate hand-built connections that slowly drift apart, each needing its own fixes. mwcyu has pulled the shared logic into a single core and turned each provider into a thin plug-in, while carefully keeping the small quirks each one demands.

Nothing changes for anyone using the fork today - same behaviour, same results. The payoff is downstream: a cleaner foundation that's far easier to keep stable as models and providers come and go. The one honest caveat is that the cleanup is so far checked only by a code-level pass, not by live streaming tests.

So what Worth a look for anyone running Mike against multiple AI providers who's tired of fixing the same bug three times - and for buyers who value not being locked to one model vendor.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

3 commits from mwcyu/Mike-fork, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
e688ccbc Use OpenAI SDK for Responses API streaming Claude 2026-05-31 ↗ GitHub
commit body
Replace the hand-rolled fetch + SSE parsing in the OpenAI adapter with the
official openai package. client.responses.create({ stream: true }) returns a
typed async-iterable of events, eliminating the manual TextDecoder/buffer and
extractSseJson machinery. Behavior, exports, and the tool-call loop are
unchanged.
9dfb6fd5 Extract shared streaming loop into a provider-agnostic driver Claude 2026-05-31 ↗ GitHub
commit body
The Claude, OpenAI, and Gemini adapters each re-implemented the same
agentic streaming loop (iterate to maxIterations, stream a turn,
accumulate fullText, run tools, feed results back). That triplication
let the loop logic drift between providers.

Introduce backend/src/lib/llm/driver.ts owning the loop, break
conditions, the runTools call, and the single fullText accumulation.
Each provider becomes a thin session factory (create{Claude,OpenAI,
Gemini}Session) that owns its SDK call, event parsing, follow-up
message state, and all callback firing. Public stream* signatures are
unchanged, so callers stay untouched.

Behavior is preserved: per-provider callback ordering, the OpenAI
pre-tool preamble drop, Claude's stop_reason hard-stop, Gemini's
verbatim thoughtSignature replay, and OpenAI instructions-on-iter-0.
Chat history persistence (route-level, fed by callbacks + fullText) is
unaffected. Typecheck passes.
85d3b9bb Merge pull request #1 from mwcyu/claude/chat-stream-mechanics-pqHS8 Marco Yu 2026-05-31 ↗ GitHub
Use OpenAI SDK for Responses API streaming

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-616.md from inside the repo you want the changes in.

⬇ Download capture-thread-616.md