Document spec

A New Kind Of Document, built for Humans & Agents

Lagom.md is a Markdown-first, JSON-backed, schema-valid, agent-readable, workflow-aware knowledge document system. Built to bridge the gap between human and agent intelligence to empower teams and organizations to achieve more.

When your knowledge base is built from the ground up for human consumption and machine readability, every SOP, policy, checklist, decision, playbook, prompt, and automation can become:

  • Readable by humans
  • Editable in Markdown
  • Validated by software
  • Enhanced by agents
  • Backed by business data
  • Rendered into multiple surfaces
  • Checked for staleness
  • Shared safely and securely
  • Connected to workflows
  • Executed by governed AI Agents

Markdown that's stored like a document but works like an app

A .lagom.md file is not a webpage and not just a text file. It is a typed, declarative knowledge artifact — a portable document spec that carries structure, ownership, tooling, and agent-ready context inside plain Markdown. The definition on the left produces the rendered output on the right.

client-onboarding.lagom.md
---
type: sop
owner: customer-success
status: active
reviewCadence: quarterly
systems:
  - HubSpot
  - Google Drive
  - Slack
---

# Client Onboarding
This process begins when a new
customer signs a contract.

```lagom.step
id: confirm-closed-won
title: Confirm deal status
owner: account-manager
system: HubSpot
requiredEntity: Deal
```

```lagom.step
id: create-client-folder
title: Create onboarding workspace
tool: google_drive.create_folder
requiresApproval: false
inputMap:
  folderName: "{{client.name}} - Onboarding"
```

```lagom.agent_action
id: send-welcome-email
tool: gmail.create_draft
requiresApproval: true
inputMap:
  recipient: "{{client.primary_contact.email}}"
  template: "client-welcome"
```
Rendered output
Active SOP customer-success Quarterly review

Client Onboarding

This process begins when a new customer signs a contract.

Step 1
Confirm deal status
account-manager HubSpot Deal
Step 2
Create onboarding workspace
google_drive.create_folder No approval needed
Agent action
Send welcome email
gmail.create_draft Requires approval
This spec doesn't suppose styling — the rendered view above is illustrative only. To see the full experience of this primitive in action, visit the knowledge platform at withlagom.com.

Why we forked Chartifact

We forked Microsoft's Chartifact because it proved an important idea: documents do not have to be static blobs. They can be portable, declarative artifacts that combine Markdown, structured JSON, data references, variables, and renderable components. Lagom extends that idea from interactive analytics documents into operational knowledge documents for SOPs, policies, playbooks, workflows, prompts, decisions, and agent-ready business context.

Markdown-first

Documents remain readable, diffable, and easy for humans and AI agents to understand.

JSON-backed

Documents can be generated, validated, migrated, indexed, and rendered programmatically.

Typed blocks

Content is not trapped in one large Markdown body. Each block has a typed contract.

Portable rendering

The same source document can power multiple experiences across surfaces.

Schema-driven

A processor turns a document into something software can safely understand and transform.

New question

How do we make company knowledge readable by humans, usable by software, and actionable by AI agents?

One document, two serializations

Every Lagom document is a single typed knowledge artifact that can be serialized in two interchangeable formats. The filename convention name.lagom.md or name.lagom.json identifies a topic in the Lagom document format — the suffix determines the serialization, not the content.

  • .lagom.md — Markdown serializationHuman-authored. YAML frontmatter + typed fenced blocks. Optimized for reading, writing, git diffs, and AI agent comprehension.
  • .lagom.json — JSON serializationMachine-canonical. Strict schema structure. Optimized for programmatic access, validation, rendering engines, and automation pipelines.
  • Lossless round-tripBoth serializations compile to the identical LagomDocument object tree. Convert freely between formats without data loss — they are equivalent representations of the same artifact.
customer-onboarding.lagom.md
---
type: sop
owner: customer-success
status: active
reviewCadence: quarterly
systems:
  - HubSpot
  - Google Drive
---

# Client Onboarding

```lagom.step
id: create-client-folder
title: Create client folder
tool: google_drive.create_folder
```
customer-onboarding.lagom.json
{
  "type": "sop",
  "owner": "customer-success",
  "status": "active",
  "reviewCadence": "quarterly",
  "systems": ["HubSpot", "Google Drive"],
  "title": "Client Onboarding",
  "elements": [
    {
      "elementType": "step",
      "id": "create-client-folder",
      "title": "Create client folder",
      "tool": "google_drive.create_folder"
    }
  ]
}
.lagom.mdLagomDocument.lagom.json
LagomDocument->validate->enrich->render->assist

Reads like a wiki page.
Works like a process engine.

A Lagom document renders just like a wiki page — anyone on the team can read it, understand the process, and follow along. But beneath the surface, every step, tool binding, and approval gate is structured so that an agent can parse the document, understand the workflow, and execute it autonomously.

The left panel is what every knowledge base gives you — prose that a human can read but a machine cannot act on. The right panel is the same process as a Lagom document: still human-readable, but now with typed steps, explicit tool bindings, ownership, and agent actions that turn documentation into automation.

wiki page human-readable only
# Client Onboarding

When a client signs, create a folder,
schedule kickoff, and send the
welcome packet.

← no structure for agents to parse
← no defined steps or owners
← no tool bindings or approval rules
← no way to automate
lagom document human + agent readable
── metadata: who owns this, what systems are involved ──
type: sop
owner: customer-success
status: active
reviewCadence: quarterly
systems:
  - HubSpot
  - Google Drive
  - Slack

── step: agent knows what to do and which tool to call ──
step:
  id: create-client-folder
  title: Create client folder
  owner: account-manager
  tool: google_drive.create_folder
  requiresApproval: false

── agent_action: autonomous execution with approval gate ──
agent_action:
  id: send-welcome-packet
  tool: gmail.send_email
  requiresApproval: true

The LagomDocument object

At the center of Lagom is the LagomDocument. Each document is composed of sections and typed elements organized into 6 categories, giving Lagom documents a consistent internal shape while allowing them to be authored naturally in Markdown.

LagomDocument
interface LagomDocument {
  $schema?: string;
  title: string;
  description?: string;
  icon?: DocumentIcon;
  cover?: DocumentCover;
  documentType?: string;
  tags?: string[];
  status?: "draft" | "active"
    | "deprecated" | "archived";
  owner?: string;
  reviewCadence?: string;
  systems?: string[];
  triggers?: Trigger[];
  variables: Variable[];
  groups: Group[];
  dag?: ProcessDAG;
  governance?: GovernanceMetadata;
}
ProcessDAG
interface ProcessDAG {
  nodes: DAGNode[];
  edges: DAGEdge[];
}

interface DAGNode {
  id: string;
  elementType: ProcessElementType;
  label?: string;
  retry?: RetryPolicy;
  timeout?: string;
  approval?: ApprovalConfig;
}

interface DAGEdge {
  from: string;
  to: string;
  condition?: string;
  type: "sequential" | "conditional"
    | "parallel" | "join";
}
DocumentIcon & Cover
interface DocumentIcon {
  type: "emoji" | "icon";
  value: string;
  iconSet?: string;
  color?: string;
}

interface DocumentCover {
  src: string;
  alt?: string;
  position?: number;
}

Element categories

All element types are organized into 6 categories. Each category serves a distinct role in the document system.

Basic — Markdown primitives
Heading
Paragraph
Markdown
Blockquote
List
Horizontal Rule
Advanced — Variable-bound interactive elements
Code
Table
Checklist
Radio
Dropdown
Number
Slider
Textbox
Visual — Structured visuals (Treebark)
Card
Grid
Chart
Mermaid
Image
Tabulator
Treebark
Data — Business data references
Connector
Entity
Data Reference
Agent — AI-native workflow primitives
Instruction
Skill
Asset
Script
Process — Execution primitives (feeds DAG)
Step
Condition
Decision
Evidence
Flow
Approval Gate
Policy Rule

The ProcessDAG

Documents with process elements automatically derive a DAG — a directed acyclic graph. A DAG is a structure where tasks flow in one direction without cycles, making it possible to model execution order, parallelism, and conditional branching in a way that agents and orchestrators can follow without re-parsing prose.

The ProcessDAG is serialized as document-level metadata. Process elements declare retry policies, timeouts, approval gates, triggers, and parallel flows. See the Flows & Process Engine reference for the full specification.

Human-readable by design

Lagom documents are designed to remain useful even without the Lagom application.

Markdown stays readable in any editor or viewer.
Structured blocks use familiar YAML or JSON.
Business context is explicit, not hidden.
Agent instructions are visible and reviewable.
Owners, systems, and review rules are part of the document.
Automation does not hide inside opaque code.

This makes Lagom documents easy to review in GitHub, edit in a text editor, generate with AI, inspect during audits, and migrate over time.

Built for AI agents

AI agents need more than prose. They need context, constraints, tools, and structure. Lagom documents can describe:

Process

What a process is and what steps must happen.

Ownership

Who owns it and when it applies.

Systems

What systems it touches and what inputs it needs.

Tools

What tools may be used and what can be automated.

Approval

What requires approval before proceeding.

Governance

When the knowledge should be reviewed.

That makes each document both a human guide and an agent-readable instruction layer.

Company knowledge is usually trapped. Not anymore.

Stale documents, disconnected systems, processes that only live in someone's head. Lagom gives knowledge a shape that humans can read, software can validate, and AI agents can act on.

Readable by humans.
Structured for software.
Governed by the business.
Actionable by AI agents.

That is the foundation for an AI-native knowledge base. Not a wiki with a chatbot bolted on. A living company brain built on a document spec that both people and machines can trust.

Ready to get started?

Explore element types progressively — from basic Markdown to full multi-category definitions.

Open the Playground