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.
  • Conversation memory is in-process (multi-replica needs an external store).
  • The chat path has no tool-calling loop (the voice and workflow agent node do); Aide is not yet page-grounded, and there are no attachments or guardrails/content-check.