Lattice
What is Lattice?
Section titled “What is Lattice?”Lattice is the infrastructure layer that makes “Companies Are Graphs of Algorithms” real. It provides a universal schema and runtime where every organizational tier — from individual contributor to the company itself — runs identical structure, is addressable via API, and decomposes all work into typed atomic steps.
The core insight: a person has goals, challenges, strategies, metrics, and work items. So does a team. So does a department. So does the company. The structure is fractal — the same 18-field Telos state applies at every level of the hierarchy. Lattice encodes this self-similarity into a typed schema and serves it through a uniform API. You query an individual the same way you query a division. You filter by role the same way at every tier. The shape never changes; only the content does.
Lattice unifies three ideas:
- Telos — a deep context framework that gives any entity a structured inner state (github.com/danielmiessler/telos)
- Businesses as Daemons — every entity becomes an addressable service that serves state and emits events (danielmiessler.com/blog/real-internet-things-businesses-daemons)
- Companies Are Graphs of Algorithms — every business process is a directed graph of decomposable, typed steps (danielmiessler.com/blog/companies-graph-of-algorithms)
The result: a company is not an org chart. It is a graph of addressable nodes, each carrying rich state, connected by typed workflows and governed by policy.
The Four Primitives
Section titled “The Four Primitives”The entire system reduces to four irreducible primitives:
| Primitive | What it is |
|---|---|
| Entity | Universal node carrying Telos state. Types: person, team, department, division, company, workflow, resource. Same 18-field schema at every scale. |
| Daemon | API server + event emitter bound to one Entity. Serves state, emits events on change, accepts subscriptions. |
| Workflow | Directed graph of typed steps (decision, action, tool, verification, gate) with typed executors (human, ai, hybrid, system). Is itself an Entity. |
| Policy | {subject, action, object, condition} evaluated to allow or deny. Checked at the daemon level on every request. |
Everything else — monitoring, vision systems, unified entity context, agent harnesses — emerges from combining these four.
C3 (Company 3.0)
Section titled “C3 (Company 3.0)”C3 (Company 3.0) is the organizational transformation framework that Lattice implements, just as H3 (Human 3.0) is the personal one. Where H3 gives individuals a structured operating system for their lives, C3 gives organizations the same thing — a universal schema, a daemon interface, algorithmic workflows, and policy-based access control. Lattice is C3’s reference implementation.
Lattice = Telos + Daemon + “Graph of Algorithms” + Policy, unified into one system.
Architecture
Section titled “Architecture” ┌─────────────┐ │ Gateway │ <- Routes by entity ID │ Worker │ Hono-based, all endpoints └──────┬──────┘ │ ┌────────────┼────────────┐ │ │ ┌─────┴─────┐ ┌──────┴──────┐ │ D1 │ │ KV │ │ (SQLite) │ │ (cache) │ │ │ │ TTL: 300s │ │ entities │ └─────────────┘ │ telos_* │ │ events │ │ policies │ └───────────┘Built on Cloudflare Workers, D1 (SQLite), and KV. The gateway routes requests by entity ID to the appropriate worker, which reconstructs the entity from relational tables and JSON fields, evaluates policy, and returns the result.
Telos State
Section titled “Telos State”Every entity — regardless of type — carries the same 18-field state:
problems mission narratives goals challenges strategies projects journal ideas beliefs skills budget team work documentation sops metrics logs
A person has goals and challenges. So does a team. So does a department. So does the company. The schema is the same at every level, which means tooling, queries, and dashboards work uniformly across the entire hierarchy.
Entity ID Format
Section titled “Entity ID Format”lat_<type>_<id>Examples: lat_com_meridian, lat_per_chen, lat_dep_eng, lat_tem_frontend
Type prefixes: per (person), tem (team), dep (department), div (division), com (company), wfl (workflow), res (resource).
API Overview
Section titled “API Overview”GET /api/v1/entities List entities (filter by type, parentId, status, tag)GET /api/v1/entities/:id Read entity with full Telos statePATCH /api/v1/entities/:id Update entity state (partial, versioned)POST /api/v1/entities Create new entityGET /api/v1/entities/:id/events Event log (cursor-based)GET /api/v1/tree/:id Hierarchy tree from any nodePOST /api/v1/entities/:id/policy/check Policy evaluationUpdates use optimistic concurrency — include a version field, and the server rejects stale writes with a VERSION_CONFLICT error.
Role-Based Views
Section titled “Role-Based Views”The same entity returns different data depending on the X-Lattice-Role header:
| Role | Sees |
|---|---|
ceo | Everything — budget, salaries, strategy, board metrics |
dept_head | Department and below — no board metrics, no individual salaries |
team_member | Team context — no budget details, no strategy documents, no salary data |
This is not authentication. It is a demonstration of how policy primitives shape what the same daemon reveals to different consumers.
Tech Stack
Section titled “Tech Stack”- Runtime: Cloudflare Workers
- Framework: Hono
- Database: D1 (SQLite at the edge)
- Cache: Workers KV
- IDs: nanoid
- Package Manager: bun
Quick Start
Section titled “Quick Start”git clone https://github.com/danielmiessler/Lattice.gitcd Lattice
bun install
# Create local D1 databasewrangler d1 create lattice-db --local
# Run migrationsbun run db:migrate
# Seed with demo company (Meridian Systems)bun run seed > seed.sqlwrangler d1 execute lattice-db --local --file=seed.sql
# Start dev serverbun run devTry it:
# Read the company entitycurl http://localhost:8787/api/v1/entities/lat_com_meridian
# Walk the org treecurl http://localhost:8787/api/v1/tree/lat_com_meridian
# Same entity, different views based on rolecurl -H "X-Lattice-Role: ceo" http://localhost:8787/api/v1/entities/lat_com_meridiancurl -H "X-Lattice-Role: dept_head" http://localhost:8787/api/v1/entities/lat_com_meridiancurl -H "X-Lattice-Role: team_member" http://localhost:8787/api/v1/entities/lat_com_meridian