Skip to content
C.W.K.
Stream
Lesson 05 of 06 · published

The Adapter Boundary — Narrow Polymorphism Only

~12 min · adapter, polymorphism

Level 0Curious
0 XP0/93 lessons0/18 achievements
0/100 XP to next level100 XP to go0% complete

One narrow boundary

cwkPippa has exactly one place where polymorphism is intentional: the streaming-API boundary in backend/adapters/base.py. Everything above that boundary — routes, store, services, frontend — is Claude-shaped.

Why narrow

The wire protocols genuinely differ. Claude has thinking blocks. Codex has a function-calling loop without server-side resume. Gemini has thoughtSignature preservation and dual-path auth. Ollama has its own tool schema wrapping. Below that boundary, we accept the difference in how a brain is spoken to. Above it, we don't let the wire leak. What does reach the top is what Dad genuinely chooses per brain: each brain's reasoning knob has its own vocabulary (Claude's effort runs low to max, Gemini's thinking level is low or high, Codex has its own reasoning effort), so routes resolve those settings per brain and the frontend shows each brain its own control. That is a difference in what can be asked of a brain, not in how the conversation is stored or shown.

What's above the boundary

  • Routes: chat.py assumes Claude-shape. It once carried a prefix-check escape hatch for variant session ids; since 2026-05-14 every brain full-replays history, so there is nothing left to escape.
  • Store: conversations table has claude_session_id column. Storing Codex/Gemini/Ollama ids in it is fine — they fit Claude's shape (string id + history reconstructed elsewhere).
  • JSONL ground truth: every message line is in Claude-Code-compatible message format, with cwkPippa-specific fields in a nested pippa sub-object — Rule 2 expressed in the data format itself. Beside the messages, the logger writes event lines of its own, typed pippa_* (text and thinking deltas, tool use and results, usage, a sealed segment), with their payload at the top level. Those never pretend to be messages; they are the record of how the turn streamed.
The principle: A 'narrow boundary' isn't a compromise. It's a sorting of differences: some are unavoidable and stay below (how each wire protocol speaks), some are real choices Dad makes per brain and are allowed above (each brain's reasoning knob), and the rest are imagined. Drawing the boundary in the right place, and admitting only the second kind across it, is the architectural skill.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue
💛 by Pippa— warm

Comments 0

🔔 Reply notifications (sign in)
Sign in — Please sign in to comment.

No comments yet — be the first.