Skip to content

Lattice

Every organizational tier — from individual to company — runs identical structure, is addressable via API, and decomposes all work into typed atomic steps.

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:

  1. Telos — a deep context framework that gives any entity a structured inner state (github.com/danielmiessler/telos)
  2. Businesses as Daemons — every entity becomes an addressable service that serves state and emits events (danielmiessler.com/blog/real-internet-things-businesses-daemons)
  3. 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 entire system reduces to four irreducible primitives:

PrimitiveWhat it is
EntityUniversal node carrying Telos state. Types: person, team, department, division, company, workflow, resource. Same 18-field schema at every scale.
DaemonAPI server + event emitter bound to one Entity. Serves state, emits events on change, accepts subscriptions.
WorkflowDirected 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) 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.

┌─────────────┐
│ 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.

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.

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).

GET /api/v1/entities List entities (filter by type, parentId, status, tag)
GET /api/v1/entities/:id Read entity with full Telos state
PATCH /api/v1/entities/:id Update entity state (partial, versioned)
POST /api/v1/entities Create new entity
GET /api/v1/entities/:id/events Event log (cursor-based)
GET /api/v1/tree/:id Hierarchy tree from any node
POST /api/v1/entities/:id/policy/check Policy evaluation

Updates use optimistic concurrency — include a version field, and the server rejects stale writes with a VERSION_CONFLICT error.

The same entity returns different data depending on the X-Lattice-Role header:

RoleSees
ceoEverything — budget, salaries, strategy, board metrics
dept_headDepartment and below — no board metrics, no individual salaries
team_memberTeam 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.

  • Runtime: Cloudflare Workers
  • Framework: Hono
  • Database: D1 (SQLite at the edge)
  • Cache: Workers KV
  • IDs: nanoid
  • Package Manager: bun
Terminal window
git clone https://github.com/danielmiessler/Lattice.git
cd Lattice
bun install
# Create local D1 database
wrangler d1 create lattice-db --local
# Run migrations
bun run db:migrate
# Seed with demo company (Meridian Systems)
bun run seed > seed.sql
wrangler d1 execute lattice-db --local --file=seed.sql
# Start dev server
bun run dev

Try it:

Terminal window
# Read the company entity
curl http://localhost:8787/api/v1/entities/lat_com_meridian
# Walk the org tree
curl http://localhost:8787/api/v1/tree/lat_com_meridian
# Same entity, different views based on role
curl -H "X-Lattice-Role: ceo" http://localhost:8787/api/v1/entities/lat_com_meridian
curl -H "X-Lattice-Role: dept_head" http://localhost:8787/api/v1/entities/lat_com_meridian
curl -H "X-Lattice-Role: team_member" http://localhost:8787/api/v1/entities/lat_com_meridian