Chattree is an AI chat app with on-device model support, remote provider integrations, built-in Notes and Reminders, and slash-command tools inside a WebAssembly sandbox. With local inference selected, prompts are processed on-device; remote provider use sends request context to the selected provider.
Chattree is structured into decoupled, modular layers:
┌─────────────────────────────────────────────────────────────┐
│ Flutter UI Layer │
│ Chat Screen · Command Palette · Settings · Marketplace │
└──────────────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Chat Controller │
│ Intent Routing · Token Streaming · Prompt Assembly │
└───────────────┬──────────────────────────────┬──────────────┘
│ │
▼ ▼
┌─────────────────────────────┐ ┌─────────────────────────────┐
│ Local Inference Engine │ │ External AI Subsystem │
│ LlamaFlutterEngine (GGUF) │ │ RemoteInferenceEngine │
│ On-Device Embeddings │ │ OpenAI / Gemini / Claude │
└───────────────┬─────────────┘ └──────────────┬──────────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────────────────────┐
│ Vector RAG Subsystem │
│ Notes & Reminders Store (SQLite + Local Vector Index) │
└──────────────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ WebAssembly Plugin Runtime (WASM) │
│ PluginLoader · Linear Memory Sandbox · Fuel Metering │
└──────────────────────────────┬──────────────────────────────┘
│ host_call()
▼
┌─────────────────────────────────────────────────────────────┐
│ ChattreeHostApi Bridge │
│ PermissionGateway · Namespace Handlers (Storage/Net) │
└─────────────────────────────────────────────────────────────┘
At the core of Chattree is its local inference engine:
Chattree incorporates an on-device vector search pipeline:
ai.embeddings), an on-device embedding model produces a dense vector representation.To extend chat capabilities without exposing device security, Chattree runs plugins as isolated WebAssembly modules:
ChattreeHostApi)Plugins communicate with Chattree through a single imported function:
(import "chattree" "host_call" (func (param i32 i32 i32 i32) (result i32)))
reqPtr.host_call(reqPtr, reqLen, resPtr, resMaxLen).PermissionGateway intercepts the call and verifies that the plugin possesses the declared and user-granted capability.storage.*, core.*): Executed immediately. The return value is the byte length written to resPtr.network.*, chattree.notes.*): Returns 0 immediately. The host performs the operation asynchronously and invokes the plugin's exported resume(resPtr, resLen) function once complete.reqLen or resMaxLen exceeds allocated memory boundaries, host_call returns -1 and aborts.ui.components can emit rich interactive cards (badges with color or monochrome variants, progress bars, key-value tables and list items up to 40 entries, hideText: true card-only responses, and button rows up to 8 buttons) with built-in security modals for sensitive command confirmation.network.websocket, up to 10 sockets, 16 MB frame cap, 500 queued frames buffer), scheduled Cron tasks with anti-battery drain protection (scheduler.task, minimum 60s interval, up to 25 tasks), and dedicated private relational SQLite databases (database.sql, up to 200 MB quota with atomic transactions and sandbox isolation).Chattree implements a capability-based security model:
storage.private or share.text) granted automatically./visual)Chattree integrates a specialized vector design pipeline:
/visual.For full architectural details and developer APIs, refer to the Visual Design Architecture Guide.
Chattree incorporates a secure event pipeline for integrating local workflows, terminal tools, and external automation:
127.0.0.1 by default (InboundHttpServer) with an optional user-enabled LAN/Wi-Fi mode (0.0.0.0), configurable port, and persistent user preferences.EventJournal) with deduplication by idempotency keys, guaranteeing delivery even across app restarts.HostEventBus and routed to registered WebAssembly plugin handlers without blocking the UI.For comprehensive protocol and integration details, see the Inbound Webhooks Guide.
Chattree adheres to strict Android battery and resource guidelines:
flutter_local_notifications. When a reminder fires, the Android OS delivers the notification immediately without requiring Chattree to run a persistent background service./note, /reminder, /visual, and third-party plugins). The AI model does not covertly trigger side-effects during conversational text generation.