This document summarizes the current backend and frontend package layout with ownership, public exports, allowed importers, and off-limits imports for each package.
The backend lives under src/fleet_rlm/ and consists of eight canonical packages plus additional utility packages.
| Package | Ownership | Public Exports | Allowed Importers | Off-Limits Imports |
|---|---|---|---|---|
api/ |
FastAPI transport shell: app factory, auth, routers, schemas, websocket transport, runtime services, event shaping. Includes evaluations.py router (M-C) for MLflow GenAI evaluation endpoints and stream_summary.py (M-A) for final_artifact reconstruction. |
main.py, bootstrap.py, routers/ (including ws/stream_summary.py with build_execution_completion_summary), runtime_services/ (including evaluations.py), schemas/ (including evaluations.py), events/, config.py, dependencies.py |
cli/, tests |
None (top-level transport) |
runtime/ |
Runtime core: DSPy agent, execution helpers, tools, streaming events, content helpers. Includes RuntimeEventKind.TURN_INPUTS and RuntimeEvent.turn_inputs(rows) factory (M-B) for surfacing assembled model inputs in chat transcript. code_preview handling in runtime_helpers.py (M-A) ensures sandbox code blocks render actual code. |
events.py (with TURN_INPUTS, turn_inputs factory), factory.py, agent/ (with runtime_helpers.py code_preview extraction), execution/ (with interpreter_support.py), modules/ (with escalating.py per-route row emission), tools/, lm.py, config.py |
api/, cli/, quality/, tests |
api.routers (may import api.events, api.config but not routers) |
integrations/ |
External integrations: Daytona substrate, database, LLM profiles, observability, config, local store | daytona/, database/, llm_profiles/, observability/, config/, local_store.py, persistence_protocol.py |
api/, runtime/, cli/, quality/, tests |
None (shared integration layer) |
config/ |
Centralized constants and configuration | constants.py |
All packages | None (leaf package) |
quality/ |
Offline DSPy evaluation and optimization (not on live request path); includes eval/ subpackage for MLflow GenAI evaluation |
eval/ (judges, metrics, evaluate, report, trace_record), optimization_runner.py, module_registry.py, scorers.py, datasets.py, gepa_evidence.py, mlflow_evaluation.py |
cli/, api/runtime_services/, tests |
api.routers, api.runtime_services (may import api.schemas for data structures and may import runtime/ and integrations/ but not api/ business logic) |
cli/ |
Operator surface: fleet and fleet-rlm entrypoints, command registration, terminal UX |
main.py, fleet_cli.py, runners.py, commands/, terminal/, api_client/ |
Tests, package entrypoints | None (top-level operator surface) |
migrations/ |
Alembic migrations (lives at repo-root migrations/, not src/fleet_rlm/migrations/) |
env.py, versions/, script.py.mako |
Alembic tooling only | No intra-backend imports (vendored/build tooling) |
ui/ |
Packaged UI assets: built frontend artifacts for installed distributions | build.py, dist/ |
api/spa.py (mounts UI), build tooling |
No intra-backend imports (vendored/build tooling) |
| Package | Role | Notes |
|---|---|---|
utils/ |
Shared helpers: identity, logging, marker search, paths, preview, sandbox ownership, session titles, time, volume tree | Imported by multiple packages; not a primary boundary but a utility layer |
scaffold/ |
Scaffold skills and skill authoring reference | Contains skills/ with DSPy/MLflow/Daytona skill definitions; used by runtime and CLI but not a primary package boundary |
The frontend lives under src/frontend/src/ and consists of six canonical packages plus additional utility and component packages.
| Package | Ownership | Public Exports | Allowed Importers | Off-Limits Imports |
|---|---|---|---|---|
features/ |
Feature modules: workspace, optimization, volumes, settings, layout. Includes workspace/inspection/eval-gauge.tsx (M-C) for MLflow GenAI evaluation gauge display. |
workspace/ (including inspection/eval-gauge.tsx), optimization/, volumes/, settings/, layout/ |
routes/, app/, tests |
Direct imports into src/fleet_rlm/** (must use lib/rlm-api/ for backend types); may import from components/, lib/, hooks/, stores/ |
components/agent-elements/ |
Agent Elements design system: chat UI, tool renderers, input bar, message list, markdown, icons. Includes tools/turn-input-tools/ (M-B) with 5 row renderers: request-row.tsx, skills-row.tsx, history-row.tsx, core-memory-row.tsx, context-row.tsx. |
agent-chat.tsx, input-bar.tsx, message-list.tsx, tools/ (including turn-input-tools/ and bash-tool.tsx), input/, icons/, utils/, types.ts |
features/, routes/, tests |
Direct imports into src/fleet_rlm/** (must use lib/rlm-api/ for backend types); may import from lib/, hooks/, stores/ |
lib/workspace/ |
Workspace runtime: WS adapter, tool parts, step router, artifact store, chat store, session turns | backend-chat-event-adapter.ts, backend-chat-event-tool-parts.ts, agent-tool-parts.ts, backend-chat-event-step-router.ts, chat-store.ts, workspace-types.ts, use-workspace-runtime.ts |
features/workspace/, components/agent-elements/, tests |
Direct imports into src/fleet_rlm/**; may import from lib/rlm-api/, lib/utils/, hooks/, stores/ |
routes/ |
TanStack Router route tree (generated routeTree.gen.ts plus hand-written route files) |
routeTree.gen.ts, __root.tsx, app.tsx, app/, $.tsx, 404.tsx, login.tsx, signup.tsx |
app/, TanStack Router tooling |
Direct imports into src/fleet_rlm/**; may import from features/, components/, lib/ |
lib/rlm-api/ |
OpenAPI-generated client for backend HTTP and WebSocket APIs | generated/openapi.ts, client.ts, types.ts, use-rlm-api.ts |
features/, components/, lib/workspace/, tests |
None (backend API gateway); this is the ONLY path for frontend to import backend types |
config/ |
Frontend configuration and environment variables | env.ts, constants.ts |
All packages | None (leaf package) |
| Package | Role | Notes |
|---|---|---|
app/ |
App shell: App.tsx, providers.tsx |
Thin wrapper mounting routes and providers; imports from routes/, components/, lib/ |
hooks/ |
Shared React hooks: use-app-navigate.ts, runtime/, ui/ |
Imported by features/, components/, lib/ |
stores/ |
Zustand stores: navigation-store.ts, theme-store.ts, navigation-types.ts |
Imported by features/, components/, lib/, routes/ |
styles/ |
Global CSS: globals.css |
Imported by app/, main.tsx |
test/ |
Test setup: setup.ts |
Imported by test files only |
lib/auth/ |
Auth utilities: Neon Auth integration, JWT handling | Imported by features/, routes/, lib/workspace/ |
lib/utils/ |
Shared utilities: formatting, validation, helpers | Imported by all packages |
lib/mlflow/ |
MLflow trace formatting and display helpers | Imported by features/workspace/, components/agent-elements/tools/ |
lib/telemetry/ |
Telemetry and analytics helpers | Imported by features/, lib/workspace/ |
lib/data/ |
Data transformation and normalization helpers | Imported by features/, lib/workspace/ |
components/product/ |
Product-specific UI components (non-agent-elements) | Imported by features/, routes/ |
components/ui/ |
Vendored shadcn/ui components | Imported by features/, components/agent-elements/, components/product/ |
graph TB
CLI["cli/"] --> API
CLI --> RUNTIME
CLI --> INTEGRATIONS
API["api/"] --> RUNTIME["runtime/"]
API --> INTEGRATIONS["integrations/"]
API --> UI["ui/"]
RUNTIME --> DAYTONA["integrations/daytona/"]
RUNTIME --> QUALITY["quality/"]
QUALITY --> RUNTIME
- Incoming:
- CLI server entrypoints
- frontend HTTP and websocket clients
- tests
- Outgoing:
src/fleet_rlm/runtime/*src/fleet_rlm/integrations/*
Key files:
api/main.pyowns app factory, lifespan, route registration, and SPA mountingapi/bootstrap.pyhandles startup wiring, critical state, and optional warmupapi/routers/ws/endpoint.pyowns the two websocket surfacesapi/routers/ws/connection_loop.py,turn_setup.py,turn_runner.py, andstream_loop.pycoordinate websocket chat turnsapi/routers/ws/stream_summary.pyownsbuild_execution_completion_summary(M-A) which always reconstructsfinal_artifactfromrun_result.final_answeror trajectory outputapi/runtime_services/chat_runtime.pyprepares execution turns and runtime contextapi/runtime_services/chat_persistence.pywrites turn/session lifecycle dataapi/runtime_services/evaluations.pyownsPOST /api/v1/evaluationsandGET /api/v1/evaluations/{run_id}(M-C)api/events/events.pyshapes execution-event payloads for passive subscribers
-
Incoming:
api/*cli/runners.py
-
Outgoing:
src/fleet_rlm/integrations/database/*- external Daytona SDK and provider systems
Key files:
runtime/factory.pybuilds the canonical Daytona-backed chat agentruntime/events.pydefinesRuntimeEvent,RuntimeEventKind(includingTURN_INPUTSadded in M-B), and theRuntimeEvent.turn_inputs(rows)factoryruntime/modules/escalating.pyemitsRuntimeEvent.turn_inputs(...)once per route (RLM: 5 rows, ReAct/CoT: 3 rows) before reasoning/tool events (M-B)runtime/agent/agent.pyandruntime/agent/runtime.pycontain the main cognition loopruntime/agent/runtime_helpers.pyextractscode_previewfrom interpreter payloads for sandbox code block rendering (M-A)runtime/agent/runtime_helpers.py,runtime_mcp.py,runtime_history.py, andruntime_streaming.pyhold extracted runtime concernsruntime/execution/*contains execution helpers, interpreter support (InterpreterExecutionEventDatawithcode_preview), and streaming event constructionruntime/modules/*contains escalation, workspace, and module registry codequality/module_registry.pyandquality/optimization_runner.pyown offline optimizationquality/eval/(M-C) containstrace_record.py,judges.py,metrics.py,prompts/,evaluate.py,report.pyintegrations/daytona/interpreter.pyis the public Daytona interpreter facadeintegrations/daytona/workspace_manager.py,sandbox_executor.py, andisolation.pyown workspace/session state, sandbox execution, and recursive child/evidence/context policy behind that facadeintegrations/daytona/runtime.py,workspace_runtime.py, andsdk_ops.pyown workspace bootstrap, repo/session reconciliation, and Daytona SDK runtime helpers
See also: dspy-daytona-interpreter-boundary.md
- Incoming:
- package entrypoints
- tests
- Outgoing:
api/*runtime/*integrations/*
Key files:
cli/main.pyis the lightweightfleetlaunchercli/fleet_cli.pydefines thefleet-rlmsurfacecli/runners.pyassembles shared runtime helperscli/commands/eval_cmd.pyregisters thefleet-rlm evalsubcommand (M-C) with--trace-ids,--limit,--from-last-daysflags- Runtime construction is shared through
cli/runners.pyandruntime/factory.py; there is no separate CLI runtime-factory module in the current tree
| Task | Read first |
|---|---|
| Websocket or runtime contract change | api/main.py, api/routers/ws/endpoint.py, api/runtime_services/chat_runtime.py, api/routers/ws/turn_runner.py |
| Session/history change | api/routers/sessions.py, integrations/local_store.py, api/runtime_services/chat_persistence.py |
| Runtime settings or diagnostics | api/routers/runtime.py, api/runtime_services/settings.py, api/runtime_services/diagnostics.py |
| Daytona execution change | runtime/factory.py, runtime/agent/agent.py, integrations/daytona/interpreter.py, integrations/daytona/sandbox_executor.py, integrations/daytona/runtime.py |
| Daytona workspace/session change | integrations/daytona/interpreter.py, integrations/daytona/workspace_manager.py, integrations/daytona/models.py |
| Recursive child sandbox change | runtime/tools/rlm_delegate.py, integrations/daytona/isolation.py |
| Offline optimization change | quality/module_registry.py, quality/optimization_runner.py |
| DSPy RLM + Daytona async boundary | docs/reference/dspy-daytona-interpreter-boundary.md, runtime/agent/runtime.py |
Older transition notes may still refer to retired websocket or runtime-quality ownership paths. The websocket loop is split across connection_loop.py, turn_setup.py, turn_runner.py, and stream_loop.py; offline optimization lives under top-level quality/.
Older docs may still refer to bridge packages that are no longer present in the tree. Treat those references as historical context only; do not use them as current ownership labels.