How one user message travels through rho.
User prompt (TUI or rho exec)
│
▼
┌───────────────────┐
│ buildSystemPrompt │ AGENTS.md + prompt templates (practices.md)
└─────────┬─────────┘
│
▼
┌───────────────────┐ ┌─────────────┐
│ local memory │◄────│ ~/.rho/ │ conventions, decisions, lessons
│ recall │ │ memories │
└─────────┬─────────┘ └─────────────┘
│
▼
┌───────────────────┐ ┌─────────────┐
│ token budget │ │ embedded │ CountTokens, CompressForContext
│ (context sizing) │ │ library │
└─────────┬─────────┘ └─────────────┘
│
▼
┌───────────────────┐ ┌─────────────┐
│ Rho ChatClient │────►│ flux/engine│ catalog, credentials, routing
│ port + adapter │ │ generate/ │────► provider API
└─────────┬─────────┘ │ stream │
└─────────────┘
│
▼
Tool calls (Read, Edit, Bash, …)
│
▼
Response to user
│
▼ (when context grows)
┌───────────────────┐
│ token Compress │ fast path before LLM summarization
│ + flux compact │
└───────────────────┘
- flux: The Rho composition root creates an
flux/engine.Enginewith Flux-owned state paths, an injected secret store, and per-engine custom gateway metadata. The engine loads provider state and the model catalog, then builds transport behind Rho'sChatClientport. - memory:
configureSessioninitializes the local memory manager (core, auto, evolving, zen, retrieval metrics, continuity). If the state directory is unavailable, rho runs without persistent memory. - token: No startup step — embedded at compile time.
- Rho templates (
internal/prompts/templates/*.md) define behavior, tools, and practices. - Project
AGENTS.mdis appended viarhoconfig.BuildContextWithDirs. - memory:
Memory.Recallinjects relevant stored memories into the system prompt.
Each turn:
- memory — recall memories matching the latest user message (token budget ~2000).
- flux — Rho's adapter calls engine generate/stream with Rho-owned tool definitions; Flux normalizes provider events and tool requests.
- Tools run with the session's memory service in context.
- memory — post-session bookkeeping records the session goal and outcome.
When messages exceed limits (internal/engine/compact.go):
- token —
token.Compress()tries a fast compression path for summaries. - flux — if token reduction is insufficient, rho calls the LLM to summarize, then keeps recent messages.
internal/engine/token/tokenizer.gowraps the embedded token engine for precise and fast estimates used in budget UI and compaction decisions.
rho doctor # ecosystem panel + flux preflight
./scripts/smoke-rho.sh # build + quick tests| Module | Role in rho | Required? |
|---|---|---|
| flux | LLM APIs, catalog, credentials, routing | Yes |
| internal/token | Token estimate + context compression + secrets + usage | Yes (embedded, no config) |
flux is an independent sibling checkout; the parent go.work wires the
local Go workspace.
Production Rho code imports Flux only through flux/engine. Conversation
history, WAL/resume, permissions, tool execution, and memory remain in Rho;
provider credentials, discovery, selection, transport, resilience, and
normalized streaming remain in Flux.