-
Notifications
You must be signed in to change notification settings - Fork 0
Chat Pipeline
Yash Aryan edited this page Aug 8, 2026
·
1 revision
End-to-end path for a chat turn inside the desktop app.
Renderer (chat.ts) calls into main via preload. Start is typically an IPC send (chat:start) with a payload including:
- Conversation / project / thread ids
- Model name
- Messages
- Attachments
useTools-
skillOverrides(per-conversation skill enablement, e.g. URL chip → web research)
Responses stream back on channels such as chat:chunk, chat:activity, chat:governance, tool confirm / ask-user, file cards, and completion/error events. Exact channel names live in preload.ts + ipc.ts + api.d.ts.
governance / policy engine:
- Org/user limits (cooperative)
- Model allowlists
- Content / PII evaluation
- Warnings pushed to UI without always hard-blocking (policy-dependent)
Typical ingredients (order can vary; read ipc.ts for the source of truth):
- Project instructions
- Retrieved RAG chunks (
context.retrieve) or reference summaries - Cross-thread memory (
memory.recall) - Optional general/org vectorstore hits
- Attachment text
- Skills
instructionsBlock - Workspace / project-coding block
- User Customize context (
user-context.ts) - Document-intent nudges when relevant
If agents are enabled in settings and complexity classification says so → multi-agent path (agents/*).
Exceptions:
- Project-coding intent forces single-agent for that turn.
- Soft-fail planning carefully — comments in
ipc.tswarn against falling back into single-agent after tools already ran (side effects).
- Build
OllamaToolDef[]from tools registry + skills registry (if tools on). -
ollama.chatStreamwith messages + tools. - Forward tokens / reasoning to renderer.
- On tool calls: confirm if risky → execute → append tool results → loop.
- Stop when no tool calls or
rounds >= 15. - Recovery: parse pasted JSON tool calls from weaker models when needed.
- Classify / plan (
agents/plan,classify). - Run workers with clamped concurrency and 3 tool rounds each.
- Synthesize final answer.
- Emit agent trail activity for the UI (collapsed by default).
- Load-guard can soft-stop when RAM crosses threshold.
- Save assistant/tool messages to project thread or standalone chat store.
- Embed/remember into Chroma memory collections.
- Knowledge-graph extraction (
graph/).
- Maintain conversation UI state (
state.ts) - Render streaming tokens and activity strip
- Show tool confirm / ask_user modals and reply via IPC
- Handle file/artifact cards
- Respect Tools toggle and skill chips
| Knob | Location |
|---|---|
| Tools default per project | Project settings / model lock specs |
| Agents enable + limits | Settings → Agents → llmeter-settings.json
|
| Load protection | Settings + load-guard/
|
| Embed model | ANYLM_EMBED_MODEL |
| Proxy (separate path) | Does not use this pipeline’s tools |
- Confirm Ollama tool support for the selected model.
- Watch activity trail for tool names and errors (
Error: …strings from exec). - If RAG empty: check Chroma startup logs / embedding model pulled.
- If skills “do nothing”: skill enabled? Tools toggle on? Connector connected?
- Deny confirm once — ensure auto-deny timing still feels right for your change.
| Page | Description |
|---|---|
| Home | Overview and navigation |
| Getting-Started | Local setup |
| Architecture | System design |
| Code-Structure | Directory map |
| Features | Feature inventory |
| Contributing | PR workflow |
| How-to-Change | Common change recipes |
| Gotchas | Footguns |
| Chat-Pipeline | Turn lifecycle |
| IPC-Contract | window.api |
| Auth-and-Firebase | Identity + rules |
| RAG-and-Knowledge | Vectors + graph |
| Agents | Multi-agent |
| Proxy-and-Governance | :3227 + policies |
| Configuration | Env + settings |
| Testing | bun test |
| Build-and-Release | Packaging |
| Skills | Build skills |
| Tools | Build tools |
| MCP-and-Extensions | MCP status + options |