Mosaic one model, many lenses

Assistant & Mosaic Aide

Every app that declares a vector_dbs gets a RAG assistant for free. When the app is a normal (non-proxy) app, the assistant is also given a stable brand and its own surfaces — Mosaic Aide (ADR 0029).

The assistant

  • POST /api/assistant/chat — the core RAG chat. It streams over SSE: sources → page_sources → delta (token chunks) → done ({answer, sources, page_sources, llm, conversation_id}).
  • Grounding. Each turn runs chat_with_context: the conversation history window + the viewed page's context are assembled, retrieval happens first, and the final answer is post-processed to rewrite raw doc references into real page URLs (deterministic citation rewrite).
  • History. Multi-turn memory with a MOAIC_ASSISTANT_HISTORY_* / MOAIC_CHAT_HISTORY_* budget (turns + max chars) and optional summarization of dropped turns. Memory is in-process (single replica).
curl -N localhost:8080/api/assistant/chat \
  -H 'content-type: application/json' \
  -d '{"message":"what is an event-sourced ledger?","stream":true}'

Mosaic Aide

For a normal app, the same assistant is promoted to a branded helper:

  • GET /api/aide/profile — the Aide's identity + capabilities.
  • POST /api/aide/chat — an alias of the assistant chat.
  • GET /aide — a self-contained helper page.
  • aide_chat — an MCP tool so agents can use the Aide too.

Aide is auto-derived (there is no assistant: DSL key): it appears whenever ≥1 vector_db is declared, so the capability and the brand can't drift apart.

Web chat (web lens)

The web lens adds a built-in /chat page + POST /api/chat:

  • App facts (its commands, models, workflows) are ingested into a dependency-free memvid-core memory file; retrieval is lexical, with an optional LLM via MOAIC_CHAT_* and a grounded no-LLM fallback.
  • Browser voice (ADR 0033): dictation into the input via the Web Speech API (SpeechRecognition) and "speak reply" via speechSynthesis — client-side only, no backend, no provider key.
  • An app that mounts its own /api/chat or /chat opts out of the built-in (app_owns_chat).

Configuration

EnvMeaning
MOAIC_CHAT_BASE_URL / MOAIC_CHAT_API_KEY / MOAIC_CHAT_MODELthe assistant LLM
MOAIC_EMBED_*embeddings (see overview)
MOAIC_RERANK_*optional re-rank seam
MOAIC_ASSISTANT_HISTORY_TURNS / ..._MAX_CHARShistory budget

Honest gaps

  • Aide is gated on a vector_db and has no dedicated assistant: DSL block — the capability and the brand can't be configured independently.
  • The assistant does ground on the viewed page (a second retrieval scoped to the page_id + a "you are viewing page …" system note); the standalone /aide page itself sends no page context (ADR 0029).
  • Conversation memory is in-process (HashMap, cap 200 messages) — no cross-replica, no long-term memory across sessions (EE's ee-memory equivalent is absent).
  • The chat path has no tool-calling loop (the voice search_docs loop and the workflow agent node have one); there are no attachments, and no guardrails / content-safety checks (EE's ee-ai guardrails equivalent is absent).
  • No token-usage / quota tracking — completion usage is never read (EE's ee-balance equivalent is absent).
  • No ReAct / Plan-Execute planner and no multi-agent orchestrator on the chat path (both are tracked as ideas to adopt in the sync/ee.md learning ledger).