#777·llm_wiki

Clarify frontend/backend boundaries and move core orchestration out of the UI layer

Author: noaftCreated Sep 20, 2026Updated Sep 20, 2026

Problem

LLM Wiki currently feels like a Tauri desktop monolith where the frontend and backend responsibilities are not clearly separated.

The frontend is not just UI: it owns significant core logic such as ingest orchestration, prompt construction, LLM provider routing, review/lint/deep research flows, and project-state coordination.

The Rust backend is also not a standalone backend service: it provides native capabilities such as filesystem access, document parsing, search/vector store, local API, and backend Agent runtime, but still depends on frontend-owned orchestration for important workflows.

This makes the app practical today, but the boundary is becoming harder to reason about.

Why this matters

A clearer split would make the project easier to maintain, test, extend, and integrate.

Potential benefits:

  • The frontend can focus on UI, user interaction, settings screens, previews, progress display, and editing.
  • Core workflows such as ingest, prompt building, wiki write lifecycle, retrieval, and project config loading can be tested without a browser/webview.
  • The local HTTP API and MCP server could become more complete and useful, because they would call the same backend workflows as the desktop app.
  • Headless usage becomes possible: CLI, MCP, automation, server mode, scheduled jobs, or remote agents.
  • LLM provider logic would be less duplicated between TypeScript and Rust.
  • Ingest behavior would be more consistent whether triggered from UI, API, MCP, scheduled import, or source watch.
  • Future contributors would have a clearer mental model of where changes belong.

Current examples of unclear ownership

  • src/lib/ingest.ts contains core ingest orchestration and prompt construction.
  • src/lib/llm-providers.ts handles frontend LLM provider behavior.
  • src-tauri/src/agent/provider.rs also implements backend LLM provider behavior.
  • src-tauri/src/agent/runtime.rs owns backend Agent prompts/tool loop.
  • mcp-server depends on the desktop app's local API and cannot run as a full knowledge backend by itself.
  • Project settings/state often live in frontend stores but are needed by backend workflows.

Possible direction

Move core domain workflows behind backend-facing APIs:

  • ingest pipeline
  • prompt builders
  • LLM provider abstraction
  • project config loading
  • wiki read/write lifecycle
  • review/lint generation
  • retrieval/search/graph APIs
  • source watch and scheduled import orchestration

Then keep the frontend focused on:

  • UI layout
  • forms/settings
  • editor/preview
  • progress/events
  • chat presentation
  • user confirmations

Suggested phased approach

  1. Document current ownership boundaries.
  2. Identify workflows that should eventually work from UI, API, and MCP equally.
  3. Move prompt builders into a shared/core layer or backend-owned module.
  4. Move ingest orchestration behind a single backend command/API.
  5. Make MCP/local API call the same workflow used by the desktop UI.
  6. Reduce duplicated LLM provider logic over time.

Open questions

  • Should the long-term core be Rust-only, TypeScript-only, or a shared package boundary?
  • Should ingest be fully backend-owned, or should prompt assembly remain frontend-owned for faster iteration?
  • Is headless/server mode an official goal?
  • Should MCP become a first-class interface to the same capabilities as the desktop UI?
  • What migration path avoids a large risky rewrite?