Internals
Architecture
How the frontend, backend, agent, model providers and Shadow fit together, and how one turn of the conversation flows.
Shadow is Meridian's privacy layer. Every model call passes through it: your company name, people, emails and secrets are swapped for consistent stand-ins on the way out, and the real values are restored in the answer. See Shadow privacy layer.
| Folder | Responsibility |
|---|---|
backend/core | Business rules: loads content/, generates roadmaps, levels and badges. No other IO |
backend/llm | One streaming, tool-using interface over every model provider; retries; the Shadow wrapper |
backend/agent | Tool definitions, the system prompt, the tool loop (stops when a card needs you), the offline guide, the card protocol |
backend/server | HTTP API, sessions, SQLite storage, streaming chat, uploads, audit room, ledger |
cli | The meridian command |
frontend | Next.js app: these docs at /, the product at /app. It proxies /api to the backend so cookies stay same-origin |
content | Frameworks, policy templates and training courses, as plain JSON and Markdown |
A turn, step by step
- The browser POSTs a message, or an answer to a card, to
/api/threads/:id/messagesand reads the streamed response. - The backend applies the card answer. That may run an approved action, such as completing a task. It then stores your message.
- It builds the system prompt from a fresh programme snapshot and replays the conversation as history.
- The agent streams the model through Shadow. Text, tool status and cards are forwarded to the browser as they happen.
- Tool calls run against the database. A tool that asks you something ends the turn.
- The agent's reply is saved and the stream closes. Everything meaningful is written to the ledger.
