DocsArchitecture
Anything Engine · Architecture

Architecture

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

The Anything Engine

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.

LayerTechRole
UINext.js 14 (this repo) on VercelCrayon chat, SSE consumer, thin BFF (auth pass-through only)
OrchestrationXano API group: Anything Engine (new)Classify → extract thesis → call AlloyDB → call OpenRouter → stream Crayon templates
DataAlloyDB ScaNN (Mark spinning up)Hybrid SQL: hard filters + 6-vector cosine in one call
MemoryZep Cloud (@getzep/zep-cloud)Per-user thread + auto-extracted facts; Xano calls Zep server-side
LLMOpenRouter (Fireworks → Together fallback)Classify, extract, synthesize. Called from Xano.
AuthWorkOS AuthKitBrowser → 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 .md files still work — Xano endpoints can read prompt files from a prompts table or call a Cloudflare Pages-hosted prompt URL. We keep the "prompts as docs" rule. (TBD with Mark Apr 29 — store prompts as Xano text field, 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 group Anything Engine, port the find_investors logic from Robert Lab agent (8349) and rebuild against AlloyDB instead of FalkorDB.

What Next.js sandbox does

Just three things:

  1. Mount the Crayon UI — chat input, template renderer, SSE consumer.
  2. Thin BFF routePOST /api/find-investors that:
    • Reads WorkOS session cookie via authkit-nextjs
    • Forwards request to Xano POST /anything-engine/dispatch with bearer token
    • Pipes SSE response straight through to the browser
    • No business logic, no LLM calls, no DB calls.
  3. 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

ConcernOwner
Auth checkXano (via WorkOS token exchange — existing pattern)
Classifier promptThis repo's prompts/anything_engine/classify.md, fetched by Xano
Synthesize promptThis repo's prompts/find_investors/synthesize.md, fetched by Xano
Voice rulesThis repo's prompts/find_investors/voice-rules.md, prepended to every synthesize call
AlloyDB schemadocs/alloydb-schema.md (Robert draft) + Mark draft → reconcile Apr 29
AlloyDB SQLInside Xano endpoint as XanoScript external query, OR Xano lambda function
Zep clientXano-side (server-to-server, Zep API key in Xano env)
OpenRouter callsXano-side (existing pattern in 8349 — swap Groq → OpenRouter per Apr 20 directive)
Crayon template registryThis repo, src/app/components/crayon/ (port from main app)

Sandbox milestones

v1 (Apr 28 PM)

  1. Stub BFF route
  2. Wire BFF → real Xano Anything Engine group
  3. Mount real Crayon UI ✓ (sandbox-grade ports of scanning_card, contact_card, error_message, loading_indicator)
  4. Vercel deploy ✓ — https://orbiter-sandbox.vercel.app
  5. Memory layer (Zep) ✓ — $env.zep set in Xano workspace; dispatch fetches thread.get_user_context and ingests turns
  6. find_investors against FalkorDB

v2 (Apr 29 PM → Apr 30) — Anything Engine end-to-end

  1. Interview gate ✓ — endpoint 8411, per-class interview.md prompts, ready=true gates dispatch
  2. Live summary panel ✓ — right-rail panel updates every turn with shimmer + Updated chip + dirty-state protection
  3. Pixel-match outcome screen ✓ — bullseye brand chip, real top-nav icons, 14 multicolor tiles, 3-tab right rail, integrated composer
  4. All 4 tool endpoints LLM-rich ✓ — 8401/8402/8406/8407 all produce LLM-generated WHY paragraphs
  5. 3-tier resilience ✓ — Anthropic → OpenRouter (Fireworks→Together) → placeholder across all 4 tool endpoints, synth_source observability field added
  6. Prompt sync workflow extended ✓ — synthesize.md slots now syncable across all 4 tool classes (was interview-only)
  7. Generative UI quality ✓ — typewriter streaming, card stagger, skeleton placeholders, sidebar→rail interaction, hover/focus/press states
  8. Agentation in-app feedback ✓ — installed at all 3 layers (Claude Code skill, MCP server, React dev widget)

v3 (next)

  1. Lock canonical 14 class names — UI ↔ classifier divergence (Apr 30 sync)
  2. AlloyDB cluster — pending Mark
  3. AlloyDB ScaNN backfill — 6-vector pattern, embed-model swap to gemini-embedding-001
  4. File-upload pipeline integration — pending Kenya team
  5. Synthetic Persona Profile — Mark's V1 schema → stress-test → matchmaking integration
  6. Vercel auto-deploy reconnect — repo moved roboulos/orbiter-sandboxM-Pederson/orbiter-sandbox, auto-deploy broken

Live Xano endpoints (group 1270 / UgP1h6uR)

EndpointIDRoleResilience
POST /anything-engine/dispatch8399Front door — Zep context fetch → classify → tool branch → Zep ingestn/a
POST /anything-engine/classify840014-class classifier; accepts optional context (memory). Confidence-gated at 0.7 → ask_back.Anthropic Haiku 4.5 (no fallback yet)
POST /anything-engine/interview8411Per-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-summary8410Summary refinerAnthropic Haiku 4.5
POST /anything-engine/find-investors8401FalkorDB Cypher (VC_Firm + Angel + portfolio/co-inv/board hops) → LLM WHY synthesis → contact cards3-tier: Anth Haiku 4.5 → OpenRouter Llama 3.3 70B (Fireworks→Together) → placeholder. synth_source field.
POST /anything-engine/find-talent8402Title-match Cypher (Person + C_Suite + colleagues) → role extraction → LLM WHY synthesis → candidate cards3-tier on BOTH role extractor AND WHY synth. role_synth_source + synth_source.
POST /anything-engine/find-customers8406Vector search → Cypher → LLM WHY synthesis → prospect cards3-tier, synth_source
POST /anything-engine/research-person8407Vector search → Cypher → single-card LLM synthesis3-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