Architecture
End-to-end pipeline, stack decision, milestones, and the live endpoint table.

The Anything Engine — One Front Door, Fourteen Classes
The reference implementation of the Anything Engine. Once this works, the same pattern ports to the other 13 classes.
Stack decision (Apr 28 PM — Mark's directive)
"Stack pivot: aggressively migrating off Xano onto GCP / AlloyDB. Xano stays as orchestration layer until full migration. New business logic lands on AlloyDB." — Apr 28 Mark sync, recorded in
~/.claude/projects/.../memory/april-28-mark-sync.md
So: Xano is the orchestrator. AlloyDB is the data plane. Next.js sandbox is the UI + thin BFF.
| Layer | Tech | Role |
|---|---|---|
| UI | Next.js 14 (this repo) on Vercel | Crayon chat, SSE consumer, thin BFF (auth pass-through only) |
| Orchestration | Xano API group: Anything Engine (new) | Classify → extract thesis → call AlloyDB → call OpenRouter → stream Crayon templates |
| Data | AlloyDB ScaNN (Mark spinning up) | Hybrid SQL: hard filters + 6-vector cosine in one call |
| Memory | Zep Cloud (@getzep/zep-cloud) | Per-user thread + auto-extracted facts; Xano calls Zep server-side |
| LLM | OpenRouter (Fireworks → Together fallback) | Classify, extract, synthesize. Called from Xano. |
| Auth | WorkOS AuthKit | Browser → WorkOS token → Xano exchanges for backend token (existing pattern) |
High-level flow
Legend: UI (slate) · Orchestration (indigo) · LLM (amber) · Data plane (emerald) · Pending migration (dashed grey). The dashed SSE stream arrow back to the Browser indicates the streaming response channel; the dashed AlloyDB edge marks the migration boundary — find_investors runs against FalkorDB today and ports to AlloyDB ScaNN once Mark's instance is live.
Request lifecycle — one find_investors call
The flowchart above shows topology. This sequence shows one request walking the pipeline, with rough latency targets so we can budget the user-perceived delay.
Budget: ~10–15s wall-clock for a full 25-card response, but the first card streams to the user inside ~6s thanks to the parallel WHY-pass fan-out. The Zep ingest at the end is fire-and-forget — it does not block the SSE close.
Why Xano (not Next.js API routes)
Mark's Apr 28 directive — verbatim above. Reinforcing reasons:
- Xano already holds all auth + user state (the existing token-exchange pattern, the user table, audit logs). New backend logic in Next.js means duplicating that surface.
- Xano can call AlloyDB directly via lambda or external API once Mark exposes it. No reason to round-trip browser → Vercel → AlloyDB.
- Prompt edits as
.mdfiles still work — Xano endpoints can read prompt files from apromptstable or call a Cloudflare Pages-hosted prompt URL. We keep the "prompts as docs" rule. (TBD with Mark Apr 29 — store prompts as Xanotextfield, or fetch from this repo's GitHub raw URL.) - The Xano Robert Lab pattern already exists (api group
LITebdJ-, endpoints 8338-8361). This is the same shape — register a new groupAnything Engine, port the find_investors logic from Robert Labagent(8349) and rebuild against AlloyDB instead of FalkorDB.
What Next.js sandbox does
Just three things:
- Mount the Crayon UI — chat input, template renderer, SSE consumer.
- Thin BFF route —
POST /api/find-investorsthat:- Reads WorkOS session cookie via authkit-nextjs
- Forwards request to Xano
POST /anything-engine/dispatchwith bearer token - Pipes SSE response straight through to the browser
- No business logic, no LLM calls, no DB calls.
- Be deployable on Vercel so Mark can poke at the URL.
If Mark on Apr 29 says "actually call Xano direct from browser, skip the BFF" — fine, we delete the route. The sandbox is throwaway.
What lives where
| Concern | Owner |
|---|---|
| Auth check | Xano (via WorkOS token exchange — existing pattern) |
| Classifier prompt | This repo's prompts/anything_engine/classify.md, fetched by Xano |
| Synthesize prompt | This repo's prompts/find_investors/synthesize.md, fetched by Xano |
| Voice rules | This repo's prompts/find_investors/voice-rules.md, prepended to every synthesize call |
| AlloyDB schema | docs/alloydb-schema.md (Robert draft) + Mark draft → reconcile Apr 29 |
| AlloyDB SQL | Inside Xano endpoint as XanoScript external query, OR Xano lambda function |
| Zep client | Xano-side (server-to-server, Zep API key in Xano env) |
| OpenRouter calls | Xano-side (existing pattern in 8349 — swap Groq → OpenRouter per Apr 20 directive) |
| Crayon template registry | This repo, src/app/components/crayon/ (port from main app) |
Sandbox milestones
v1 (Apr 28 PM)
- Stub BFF route ✓
- Wire BFF → real Xano
Anything Enginegroup ✓ - Mount real Crayon UI ✓ (sandbox-grade ports of scanning_card, contact_card, error_message, loading_indicator)
- Vercel deploy ✓ —
https://orbiter-sandbox.vercel.app - Memory layer (Zep) ✓ —
$env.zepset in Xano workspace; dispatch fetchesthread.get_user_contextand ingests turns - find_investors against FalkorDB ✓
v2 (Apr 29 PM → Apr 30) — Anything Engine end-to-end
- Interview gate ✓ — endpoint 8411, per-class
interview.mdprompts,ready=truegates dispatch - Live summary panel ✓ — right-rail panel updates every turn with shimmer + Updated chip + dirty-state protection
- Pixel-match outcome screen ✓ — bullseye brand chip, real top-nav icons, 14 multicolor tiles, 3-tab right rail, integrated composer
- All 4 tool endpoints LLM-rich ✓ — 8401/8402/8406/8407 all produce LLM-generated WHY paragraphs
- 3-tier resilience ✓ — Anthropic → OpenRouter (Fireworks→Together) → placeholder across all 4 tool endpoints,
synth_sourceobservability field added - Prompt sync workflow extended ✓ —
synthesize.mdslots now syncable across all 4 tool classes (was interview-only) - Generative UI quality ✓ — typewriter streaming, card stagger, skeleton placeholders, sidebar→rail interaction, hover/focus/press states
- Agentation in-app feedback ✓ — installed at all 3 layers (Claude Code skill, MCP server, React dev widget)
v3 (next)
- Lock canonical 14 class names — UI ↔ classifier divergence (Apr 30 sync)
- AlloyDB cluster — pending Mark
- AlloyDB ScaNN backfill — 6-vector pattern, embed-model swap to
gemini-embedding-001 - File-upload pipeline integration — pending Kenya team
- Synthetic Persona Profile — Mark's V1 schema → stress-test → matchmaking integration
- Vercel auto-deploy reconnect — repo moved
roboulos/orbiter-sandbox→M-Pederson/orbiter-sandbox, auto-deploy broken
Live Xano endpoints (group 1270 / UgP1h6uR)
| Endpoint | ID | Role | Resilience |
|---|---|---|---|
POST /anything-engine/dispatch | 8399 | Front door — Zep context fetch → classify → tool branch → Zep ingest | n/a |
POST /anything-engine/classify | 8400 | 14-class classifier; accepts optional context (memory). Confidence-gated at 0.7 → ask_back. | Anthropic Haiku 4.5 (no fallback yet) |
POST /anything-engine/interview | 8411 | Per-class clarifying-question gate. Returns {ready, summary, next_question, missing_fields}. Loops until ready=true gates dispatch. | Anthropic Haiku 4.5 |
POST /anything-engine/build-summary | 8410 | Summary refiner | Anthropic Haiku 4.5 |
POST /anything-engine/find-investors | 8401 | FalkorDB Cypher (VC_Firm + Angel + portfolio/co-inv/board hops) → LLM WHY synthesis → contact cards | 3-tier: Anth Haiku 4.5 → OpenRouter Llama 3.3 70B (Fireworks→Together) → placeholder. synth_source field. |
POST /anything-engine/find-talent | 8402 | Title-match Cypher (Person + C_Suite + colleagues) → role extraction → LLM WHY synthesis → candidate cards | 3-tier on BOTH role extractor AND WHY synth. role_synth_source + synth_source. |
POST /anything-engine/find-customers | 8406 | Vector search → Cypher → LLM WHY synthesis → prospect cards | 3-tier, synth_source |
POST /anything-engine/research-person | 8407 | Vector search → Cypher → single-card LLM synthesis | 3-tier, synth_source |
All four tool endpoints (8401, 8402, 8406, 8407) produce LLM-generated WHY paragraphs with the same 3-tier resilience pattern. Schema is consistent across all four — synth_source ∈ {"anthropic", "openrouter", "placeholder"}.
Class-name divergence (open Apr 30 sync topic)
The classifier (8400) still emits the OLD class names (research_topic, find_warm_intros, summarize_meeting, etc.). The UI tile grid uses Mintlify canonical names (find_collaborators, find_acquisition, make_purchase, find_speakers, get_advice, find_cofounder, find_job, find_deal_flow). Lock canonical 14 with Mark, then mass-update classifier prompt + dispatch routing + interview prompts + prompts/anything_engine/registry.json.
Other 13 classes
Beyond the 4 wired tool endpoints, dispatch returns a not_implemented error_message until each class is ported. Same 3-tier resilience pattern applies when added.
Edge cases
See docs/find-investors-edge-cases.md.
References
- Anything Engine:
docs/anything-engine.md - AlloyDB ScaNN:
docs/alloydb-scann.md - AlloyDB schema draft:
docs/alloydb-schema.md - Zep memory:
docs/zep-memory.md - Crayon SDK:
skills/crayon/SKILL.md - Apr 28 sync:
~/.claude/projects/.../memory/april-28-mark-sync.md - Existing Xano pattern (Robert Lab): MEMORY.md "Robert Lab" section, endpoint 8349