Spatial workspace for patching AI signal graphs — wire markdown, PDFs, code, and multi-provider LLM calls into a canvas; the terminal cells are your answer.
One source RFC fans out to four AI cells (Claude, GPT, Grok, Sonnet) — each with a different instruction. The Mix on the right aggregates every terminal output into one panel. That's your answer.
Patchbay is a Next.js app for composing AI workflows the way a modular synthesist composes sound: drop atomic cells, patch their inputs and outputs, and watch signals cascade through the graph. The terminal cells — the ones with no outgoing connections — surface in a persistent panel called The Mix. That's your answer.
Three cell primitives, one connection model:
- Source holds text, markdown, or a PDF
- AI runs an LLM call (Anthropic, OpenAI, xAI, Google) with optional structured output
- Code runs a JavaScript transform in a Web Worker
No predefined pipelines. Identity emerges from how cells are wired, not from type declaration.
Cells are a discriminated union (src/kernel/entities/cell.ts) with a single lastInputHash field driving freshness. When you trigger a cell, the orchestrator builds a topological schedule downstream (src/client/domain/use-cases/execute-cascade.ts), re-resolves inputs, and re-runs cells in dependency order. Stale cells render visually distinct via pure-function staleness propagation (src/kernel/transforms/compute-staleness.ts).
The Mix is a right-side panel that aggregates every terminal cell's output — your answer, in real time, regardless of how the upstream graph evolves (src/client/ui/components/MixPanel.tsx). Double-click any cell and The Scope opens at the bottom: a focused three-column editor with Inputs | Editor | Output (src/client/ui/hooks/use-scope-state.ts). Two panels, two altitudes — the canvas for shape, The Scope for surgery.
A single /api/chat endpoint (src/app/api/chat/route.ts) dispatches to Anthropic, OpenAI, xAI, or Google via a runtime registry (src/server/adapters/providers.ts). AI cells don't know which provider they're hitting; the user picks per cell. Structured output mode supports both single-object and collection schemas — useful for any "extract a list of N things" pattern.
- Port topology, not node type, is the identity system. A
SourceCellDataconnected as input to an AI cell is a different thing than aSourceCellDataconnected to a Code cell — even though it's the same data shape. Wiring is meaning. - Clean Architecture wall. The kernel (
src/kernel/) imports zero frameworks. No React, no Next.js, no@xyflow. It's testable, replaceable, and outlives any UI choice. The boundary is enforced by directory. - Strangler-fig migration boundary. Legacy
WorkspaceNodetypes and new signal-fieldCelltypes share the same canvas but cannot be wired across the boundary (src/kernel/transforms/validate-connection.ts,src/client/adapters/canvas/flow-node-mapper.ts). This is how the codebase migrates without a flag day.
- Multi-model comparison — one question → three AI cells (Claude, GPT, Grok) → The Mix shows all three side-by-side
- PDF summarization chain — PDF source → AI cell ("summarize") → Code cell (extract bullets) → terminal output
- Transform pipeline — markdown notes → Code cell (parse) → AI cell (tag) → Code cell (dedupe) → tagged list
- Iterative refinement — AI (draft) → Code (cleanup) → AI (improve tone) → Code (format), output visible at each step
- Information cascade — multiple PDF sources → Code cell (merge) → AI cell (synthesize) → single synthesis
Next.js 16 (App Router) · TypeScript 5 · Tailwind CSS 4 · @xyflow/react · Vercel AI SDK · Anthropic · OpenAI · xAI · Google Gemini · Monaco · Clerk · Supabase · Clean Architecture
cp .env.example .env.local
# fill in at least one LLM provider key
npm install
npm run devOpen http://localhost:3000. Any single provider key is enough to start — the others are optional.
This repo ships its own spec history. Every meaningful feature lives in .specs/features/ (active), .specs/archive/ (shipped), and .specs/rejected/ (designed and declined). The deliberation protocol — expert roundtables, structural linting, adversarial spec-audit — is the Feature Architect Claude Code skill, applied to this codebase from the inside.
If you're evaluating this as a portfolio piece for an AI SDLC role: the application of AI to building this app is the story. The .specs/ directory is the artifact.
See CLAUDE.md for the Clean Architecture rules and the strangler-fig boundary, and context.md for the current state of the codebase.
MIT — Paul Luckey, 2026.

