Skip to content
Company OS
Esc
↑↓navigate↵open⌘Jpreview
On this page

Company OS Architecture Overview

Company OS Architecture Overview

Company OS is structured as a layered platform with distinct agent classes, foundational primitives, and irreversible architectural decisions (one-way doors). This overview synthesizes the core structure from ADR-0001.

Three Layers

The architecture consists of three concentric layers, from outer (user-facing) to inner (data and core applications):

Harness / Channel

The outermost layer encompasses communication channels where users interact: WhatsApp, Telegram, Slack, Teams, ChatGPT, and Claude Code. For tenants, the OS provides these channels directly; for platform operators (like Ryan), it integrates with external systems such as openclaw/grokbot. This layer handles user ingress and egress but contains no business logic or tenant data. 1

Company OS (Control Plane)

The middle layer provides administrative and control functions. It bundles all MCP/REST connections, enforces role-based access control (RBAC) per role (e.g., recruiter vs. CFO), manages costs, observability, and evaluations, validates user actions, hosts the skills library, and uses LiteLLM for model routing and Langfuse for tracing. Every agent action passes through this layer. 2

Core Apps + Data

The innermost layer contains tenant applications and data stores: ATS, CRM, Linear, GitHub, Job Intelligence (the first application), hot/cold data storage, and a BI layer above. All actions and tool calls are written to this layer. 3

Two Agent Classes

Agents operating within the Company OS layer are divided into two classes, separated by their access to tenant data:

Ops Agents

Handle ongoing, operational tasks that require access to tenant data and systems: publishing job postings, sending invoices, processing meeting transcripts, and triaging email. These agents act as persistent automations within a tenant’s context. 4

Factory Agents

Focus on software creation tasks that do not touch tenant data: building pages, creating new agents, and establishing integrations (e.g., with Linear, GitHub, CI systems). Factory agents are restricted to capabilities targeting developer tooling and are explicitly denied access to tenant-app capabilities. 5

The separation ensures Factory agents cannot accidentally or maliciously access or modify tenant data, as enforced by capability registry permissions. 6

Five Primitives

Company OS provides five foundational primitives that compose all agent actions, applied in this order:

Principal

Represents an identity capable of acting within the system: a tenant, user, agent, or factory. Agents possess their own credentials and a designated human accountable principal. The Principal primitive includes an identity crosswalk that resolves channel-specific identifiers (e.g., WhatsApp number, Teams user ID, Better Auth session) to a single principal, preventing implicit principal creation. 7

Capability

Registered by applications, defines an invocable function with its input/output schema, permission requirements, effect class (e.g., read, write, delete), and reversibility. The Company OS is the sole invoker of capabilities; applications do not call them directly. 8

Task

Encapsulates an intention to perform work, comprising: actor (principal), goal, tenant context, and approval class. Tasks are routed deterministically for fixed agents (e.g., Ops agents) or via model-driven routing for others. The Task primitive is not a storage unit but a flow descriptor. 9

Receipt

Records every atomic action or tool call executed by the OS. Contains: correlation ID (linking to the initiating task), tenant ID, principal ID, capability invoked, effect class, target, costs (model and infrastructure in cents), token usage, Langfuse trace ID, outcome (pending, success, failed, denied, uncertain), and timestamps. Receipts form the immutable basis for billing and auditing; every action generates exactly one Receipt. 10

Policy

Encodes approval logic as data, specifying: applicable roles, effect classes, goals, limits, validity periods, and stop conditions. Policies are evaluated by the OS before action execution, replacing hardcoded approval checks. 11

Channel ingress, admin UI, skills library, and BI systems consume these primitives but are not primitives themselves. 12

Four One-Way Doors

These architectural decisions are effectively irreversible after initial migration due to deep system integration. Acceptance requires explicit owner approval (Robbie) as noted in the ADR. 13

Tenant Isolation

Implements row-level security (RLS) in Postgres with a mandatory tenant_id column in all tables of the os schema and any app containing tenant data. A TenantContext Effect service scopes every database connection (SET LOCAL app.tenant_id). Queries lacking this context fail at compile time. This ensures app-level bugs cannot cause cross-tenant data leaks. 14

Principal Identity Across Channels

Unifies identities from WhatsApp, Teams, Better Auth, and other channels into a single principal record. The OS never implicitly creates principals; only tenant administrators may link channel identities to a principal. A WhatsApp number, Teams user ID, and auth session resolving to the same principal are treated as one entity; mismatches are rejected. 15

Metering Unit

Defines the capability-invoke as the billable event. Tool calls and model costs are recorded as child receipts (via parent_receipt_id) under the parent invoke receipt. The Receipt structure captures all cost dimensions: model costs (cents), infrastructure costs (cents), input/output tokens, and Langfuse tracing ID. Metering is a primitive, not a retrofit, enabling per-action billing from the first line of code. 16

Factory Principal Restrictions

Limits principals of class factory to capabilities with target: dev-tooling (e.g., Linear, GitHub, CI, deploy systems). The registry permission check rejects any attempt by a factory principal to invoke a capability with target: tenant-app (e.g., search_aanvragen), returning a denied outcome in the Receipt. This ensures factory agents cannot access tenant data or applications. 17

Footnotes

  1. ADR-0001, lines 56-57: Harness/channel description ↩

  2. ADR-0001, line 57: Company OS control plane responsibilities ↩

  3. ADR-0001, line 58: Core apps + data layer ↩

  4. ADR-0001, line 62: Ops agent tasks ↩

  5. ADR-0001, line 63: Factory agent tasks ↩

  6. ADR-0001, line 65: Factory agent isolation from tenant data ↩

  7. ADR-0001, line 71: Principal primitive details ↩

  8. ADR-0001, line 72: Capability primitive details ↩

  9. ADR-0001, line 73: Task primitive details ↩

  10. ADR-0001, lines 74, 101-111: Receipt primitive and metering ↩

  11. ADR-0001, line 75: Policy primitive ↩

  12. ADR-0001, line 77: Primitive consumers ↩

  13. ADR-0001, lines 83-86: One-way doors introduction ↩

  14. ADR-0001, lines 87-94: Tenant isolation (THE-6) ↩

  15. ADR-0001, lines 95-98: Principal identity across channels (THE-7) ↩

  16. ADR-0001, lines 101-111: Metering unit (THE-8) ↩

  17. ADR-0001, lines 116-119: Factory principal restrictions (THE-9) ↩

Was this page helpful?