Skip to content

Platform

Architecture & Code

The platform & agent system

Service boundary and responsibilities, interaction modes, and the cross-cutting concerns — deployment, security, the code map, and design rules.

The platform shape and the agent system. Use the Full screen button above, or open the platform diagram in a new tab ↗.

System Boundary

LifeOSAI is a cross-platform agent operating system. The same product model runs in two deployment modes:

  • Cloud mode: browser traffic is served by cloud services, and agent runtimes run in cloud infrastructure.
  • Local mode: the Tauri desktop app starts local sidecars and uses local files and local data stores.

The high-level service boundary is:

User / channel / operator
apps/web or external channel transport
apps/user-management
apps/api
packages/agent runtime adapter
Claude Code agent or Pi agent

apps/user-management is the browser-facing routing hub. It validates the user session and forwards product requests to the correct backend service. Agent execution is owned by apps/api, especially the orchestration engine and runtime invoker.

Service Responsibilities

LayerOwnerResponsibility
Product entryapps/webLifeOSAI chat, companies, apps, files, settings, and static-export compatible shell
Desktop shellapps/tauriLocal desktop wrapper, updater, sidecar process management
Routing hubapps/user-managementUser-authenticated API gateway, session reader, orchestration proxy, file proxy
Agent APIapps/apiAgent runtime APIs, company orchestration, wakeups, schedulers, channels, secrets
Runtime SDKpackages/agentRuntime abstraction, Claude Code adapter, Pi Agent adapter, normalized streaming events
Shared contractspackages/sharedOrchestration types, live event constants, env normalization, validators
Persistent dataPrisma DBCompanies, agents, issues, runs, routines, activity, secrets, channel state
Workspace dataFilesystem or mounted volumeChat workspaces, company project files, artifacts, skills, logs

LifeOSAI Agent System

The agent system covers normal chat, direct company-agent chat, and live run transcripts. It is intentionally separate from company task orchestration, although both paths can use the same runtime adapters.

Agent Interaction Modes

ModeDescriptionPrimary state
LifeOSAI chatUser chats with the selected runtime outside a company taskChat session id, runtime, model
Direct company-agent chatUser talks directly to a company agentCompany id, agent id, remembered session id
Live run transcriptUI follows an active orchestration runRun id, session id, runtime log stream
Completed transcript replayUI reads a previous run/sessionStored session messages
Channel conversationWhatsApp, Telegram, or another transport talks to an agentChannel session key, channel metadata, runtime session id

The frontend may present these modes differently, but the backend contract is the same idea: a session is attached to a runtime, the runtime streams events, and those events become transcript records or live run events.

Agent Capabilities

LifeOSAI agents can be extended by:

  • Skills: bundled, company-scoped, or user-uploaded capability folders.
  • Plugins: installed runtime extensions and tool bundles.
  • Connectors: external account or service integrations.
  • MCP servers: tool servers such as channels, browser, Slack, or custom tools.
  • Files: allowed workspace roots and company/project file roots.
  • Channels: transport-specific inbound messages and outbound replies.

The runtime process receives these capabilities through a combination of:

  • Runtime options passed by apps/api.
  • Environment variables assembled before invocation.
  • MCP server definitions.
  • Additional skill directories.
  • Adapter-specific command or SDK options.

Chat Session Flow

User sends message
apps/web
apps/user-management session/chat route
apps/api or runtime handler
packages/agent runtime
Claude Code or Pi Agent
normalized stream events
persisted transcript and/or live response

Session discovery and session message lookup are separate concerns. Listing sessions should stay limited to the known LifeOSAI root. Message lookup can resolve known company-agent transcript paths when a run/session already points there.

Local And Cloud Deployment

Local Mode

Local mode is built around the Tauri app and sidecar services:

PortService
3000apps/web
3001apps/user-management
3002apps/auth
4000apps/api

Important local roots:

  • ~/LIFEOSAI
  • ~/.lifeosai/companies
  • local database, usually SQLite or local Postgres depending on mode

Cloud Mode

Cloud mode uses GCP and CI/CD:

  • GCP project: lifeosai-481608
  • region: asia-south-1
  • Artifact Registry repo: docker-images
  • Cloud Run services: web, auth, user-management
  • Compute Engine or runtime containers for agent execution
  • workspace root: /workspace/LIFEOSAI

The product API surface should remain the same between local and cloud. Only the execution locality, filesystem root, and infrastructure backing services change.

Security Boundaries

BoundaryEnforcement
User sessionapps/user-management validates browser/desktop requests
Company accessOrchestration services assert company access before reads/writes
Agent run APIsRun-scoped bearer token validates company, agent, and run
SecretsCompany-scoped secret refs validated on write and resolved at invocation
FilesSession and file readers allow only known LifeOSAI roots
LogsSecret-backed env values are redacted before persistence
ChannelsTransport plugins and channel sessions map inbound messages to known company/agent context

Code Map

AreaMain files
Runtime interfacepackages/agent/src/runtimes/types.ts
Claude Code runtimepackages/agent/src/runtimes/claude-code-runtime.ts
Pi Agent runtimepackages/agent/src/runtimes/pi-agent-runtime.ts
Runtime event normalizationpackages/agent/src/runtimes/event-normalizer.ts
Agent invokerapps/api/src/orchestration/engine/agent-invoker.ts
Wakeup queueapps/api/src/orchestration/engine/wakeup.ts
Heartbeat schedulerapps/api/src/orchestration/engine/heartbeat.ts
Routine schedulerapps/api/src/orchestration/engine/routine-scheduler.ts
Event busapps/api/src/orchestration/engine/event-bus.ts
Run authapps/api/src/orchestration/auth/run-token.ts
Agent API guardapps/api/src/orchestration/routes/middleware.ts
Issuesapps/api/src/orchestration/services/issues.ts
Agentsapps/api/src/orchestration/services/agents.ts
Projectsapps/api/src/orchestration/services/projects.ts
Routinesapps/api/src/orchestration/services/routines.ts
Activityapps/api/src/orchestration/services/activity-log.ts
Secretsapps/api/src/orchestration/services/secrets.ts
Env configpackages/shared/src/orchestration/env-config.ts
Live event typespackages/shared/src/orchestration/types/live.ts
Channels dispatchapps/api/src/channels/dispatch.ts
Channels message toolapps/api/src/channels/message-tool.ts
WhatsApp channelapps/api/src/channels/plugins/whatsapp.ts
Telegram channelapps/api/src/channels/plugins/telegram.ts
Session readerapps/user-management/src/sessions/reader.ts