Talome
Developers

Architecture

Deep dive into Talome's system architecture -- monorepo structure, data flow, database design, and runtime components.

Talome is built as a TypeScript monorepo with three applications and a shared types package. This page provides a comprehensive technical overview of how the system is structured and how data flows through it.

Monorepo Layout

talome/
  apps/
    core/           Hono backend: AI agent, tools, Docker API, DB, MCP server
    dashboard/      Next.js 16 frontend: dashboard, chat UI, app store
    web/            Fumadocs site: documentation and marketing
  packages/
    types/          Shared TypeScript types (UserPermissions, etc.)
  .claude/          Claude Code skills and auto-memory
  docs/             Internal architecture documentation

apps/core -- The Backend

The backend is a Hono server written in TypeScript. It handles API requests, AI chat streaming, Docker container management, database operations, automation scheduling, and MCP protocol serving.

PathPurpose
src/ai/agent.tsSystem prompt definition and domain registrations. The central file that wires all tools to the AI.
src/ai/tool-registry.tsDynamic tool loading engine. Manages domains, settings-based activation, keyword routing.
src/ai/tool-gateway.tsSecurity gateway. Enforces tier-based access control per security mode.
src/ai/tools/37 tool files containing 230+ tool definitions across 16 domains.
src/ai/custom-tools.tsRuntime for user-created custom tools.
src/ai/claude-runner.tsHeadless Claude Code executor for self-improvement and app creation.
src/routes/47 Hono route files. Each exports a Hono router mounted at /api/*.
src/db/schema.tsDrizzle ORM schema defining ~25 SQLite tables.
src/db/index.tsDatabase connection and singleton export.
src/db/audit.tsAudit log write helper.
src/db/memories.tsMemory ranking and retrieval logic.
src/docker/client.tsDockerode wrapper for container operations.
src/stores/Multi-source app store: Talome native, CasaOS, Umbrel format parsers.
src/creator/App creation orchestrator. Blueprint generation and workspace scaffolding.
src/middleware/Auth middleware, CORS, session management.
src/automation/Cron scheduler (croner) and step executor.
src/mcp/MCP server implementation for Claude Code and other MCP clients.

apps/dashboard -- The Frontend

The frontend is a Next.js 16 application using the App Router, React 19, Tailwind CSS 4, and shadcn/ui.

PathPurpose
src/app/dashboard/26+ App Router pages (containers, apps, media, files, settings, etc.)
src/components/ui/40+ shadcn/ui primitives (button, card, dialog, table, etc.)
src/components/widgets/20+ dashboard widgets (CPU, memory, disk, services, media calendar, etc.)
src/components/assistant/AI chat interface: message bubbles, tool call display, streaming indicator.
src/components/dashboard/Dashboard-level components (app cards, container tables, store views).
src/components/files/File manager and media player components.
src/components/settings/Settings page sections (general, integrations, security, users).
src/atoms/Jotai atoms for global state management (chat state, sidebar, preferences).
src/hooks/Custom React hooks (useContainers, useSettings, useChat, etc.).
src/lib/Utility functions, API client, formatting helpers.

apps/web -- Documentation Site

A Fumadocs-powered site serving the documentation and marketing pages. Content lives in MDX files under content/docs/.

packages/types -- Shared Types

TypeScript type definitions shared between apps/core and apps/dashboard. Includes UserPermissions, API response types, and shared constants.


Tech Stack

LayerTechnologyPurpose
FrontendNext.js 16 App RouterServer-side rendering, routing, React Server Components
ReactReact 19UI rendering with concurrent features
StylingTailwind CSS 4Utility-first CSS framework
UI Primitivesshadcn/ui40+ accessible, customizable components
IconsHugeIconsIcon library (@hugeicons/react, @hugeicons/core-free-icons)
StateJotaiAtomic state management for client state
BackendHonoFast, lightweight TypeScript HTTP framework
AI SDKVercel AI SDKStreaming chat, tool execution, structured output
AI Provider@ai-sdk/anthropicClaude integration (primary)
DatabaseSQLite + better-sqlite3Embedded database with synchronous reads
ORMDrizzle ORMType-safe SQL query builder
DockerDockerodeNative Node.js Docker Engine API client
SchedulingcronerCron expression parser and job scheduler
ValidationZodRuntime type validation everywhere
Monorepopnpm workspaces + TurborepoDependency management and parallel build tasks

Data Flow

AI Chat

Context injected into each request:

  • System prompt (~5,000 tokens, cached via Anthropic prompt caching)
  • Top 10 memories (ranked by 0.4 recency + 0.3 access + 0.3 confidence)
  • Active domain context and page context
  • Security mode (permissive/cautious/locked)
  • Max 10 tool calls per turn (stepCountIs(10))

App Installation

Self-Improvement


Database Schema

Talome uses a single SQLite file managed by Drizzle ORM. The database provides synchronous reads (via better-sqlite3) for performance and simplicity. Key table groups:

Authentication and Users

TablePurpose
usersUser accounts with hashed passwords, roles (admin/member), and permissions

Conversations and AI

TablePurpose
conversationsChat conversations with optimistic locking version
messagesIndividual messages (user, assistant, system) linked to conversations
memoriesAI memory system: preferences, facts, contexts, corrections with confidence and access count
ai_usage_logToken usage tracking per model with cost estimation

App Management

TablePurpose
store_sourcesConfigured app store sources (Talome, CasaOS, Umbrel, Git)
app_catalogNormalized app metadata from all store sources
installed_appsCurrently installed apps with status, version, and container IDs
install_errorsDetailed error logs for failed installations

Automation

TablePurpose
automationsAutomation definitions with trigger, steps, and schedule
automation_runsExecution history for each automation
automation_step_runsPer-step execution details within a run

System

TablePurpose
settingsKey-value configuration store
settings_historyChange history for settings (who changed what, when)
audit_logEvery tool execution with tier, timestamp, and approval status
notificationsSystem notifications (info, warning, critical)
metricsHistorical system metrics (CPU, memory, disk, network)
container_eventsContainer state transitions (for crash detection)
system_eventsSystem-level events for the agent loop
remediation_logAutonomous remediation actions taken by the agent

Self-Improvement

TablePurpose
evolution_logLegacy evolution change log
evolution_runsSelf-improvement run tracking with status, diff output, and rollback info
evolution_suggestionsAI-generated improvement suggestions with priority and risk

UI and Configuration

TablePurpose
widget_manifestsDashboard widget definitions and layout
proxy_routesReverse proxy route configuration with TLS status
terminal_sessionsPersistent terminal session metadata

Runtime Components

Security Gateway

The security gateway wraps every tool with access control based on the system-wide security_mode setting:

ModeRead ToolsModify ToolsDestructive Tools
permissiveExecute freelyExecute freelyExecute freely
cautious (default)Execute freelyExecute freelyRequire user confirmation
lockedExecute freelyBlockedBlocked

The gateway also writes to the audit_log for every tool execution, including blocked attempts.

Memory Ranking

The top 10 memories are injected into each chat system prompt, selected by a composite score:

  1. Recency -- recently created or updated memories score higher
  2. Access frequency -- memories recalled more often score higher
  3. Confidence -- corrections (confidence adjustments) affect ranking
  4. Deduplication -- new memories with >80% bigram similarity to existing ones are rejected

Automation Scheduler

The automation engine uses croner for cron-based scheduling. On startup:

  1. All enabled automations with schedule triggers are registered with croner
  2. Event-based triggers (container_stopped, disk_usage_exceeds) are registered with the event bus
  3. Webhook triggers generate unique URLs
  4. When a trigger fires, the step executor runs each step in sequence, passing output forward

MCP Server

The MCP server runs as a stdio process launched by Claude Code at startup. It:

  1. Calls getAllRegisteredTools() to get every tool from every domain
  2. Converts Vercel AI SDK tool schemas to MCP-compatible JSON Schema
  3. Handles tool call requests from Claude Code, executing them through the same tool pipeline
  4. Operates independently of the Hono web server (reads the same SQLite DB and Docker socket)

Ports

ServicePortConfigurable Via
Dashboard3000DASHBOARD_PORT
Backend API4000CORE_PORT
Terminal daemon4001TERMINAL_DAEMON_PORT
Docs site3100Dev mode only

Directory Conventions

App Installation

Apps are installed to ~/.talome/apps/<appId>/. Each app directory contains:

~/.talome/apps/jellyfin/
  docker-compose.yml    Generated from the app manifest
  config/               Volume mount (relative paths)
  cache/                Volume mount
  .env                  App-specific environment overrides

App Creation

Generated apps use a workspace at ~/.talome/generated-apps/<appId>/:

~/.talome/generated-apps/<appId>/
  .talome-creator/
    blueprint.json       Structured app specification
    instructions/        Generation guides
    references/          Talome source file snapshots
    sources/             Existing app manifests to adapt
  generated-app/         Scaffold output

User Apps

User-created apps are stored at ~/.talome/user-apps/.

Backups

App backups are stored at ~/.talome/backups/<appId>/<timestamp>.tar.gz.

On this page