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 serialization Human-authored. YAML frontmatter + typed fenced blocks. Optimized for reading, writing, git diffs, and AI agent comprehension.
  • .lagom.json — JSON serialization Machine-canonical. Strict schema structure. Optimized for programmatic access, validation, rendering engines, and automation pipelines.
  • Lossless round-trip Both 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.md LagomDocument .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, giving Lagom documents a consistent internal shape while allowing them to be authored naturally in Markdown.

LagomDocument
interface LagomDocument {
  $schema: string;
  lagomVersion: string;
  kind: "LagomDocument";
  id: string;
  title: string;
  description?: string;
  documentType:
    | "sop"
    | "policy"
    | "playbook"
    | "decision"
    | "guide"
    | "workflow";
  status: "draft" | "active"
    | "deprecated" | "archived";
  owner?: OwnerRef;
  sections: LagomSection[];
  variables?: LagomVariable[];
  entities?: BusinessEntityRef[];
  connectors?: ConnectorRef[];
  actions?: AgentAction[];
  governance?: GovernanceMetadata;
}
LagomSection + LagomElement
interface LagomSection {
  id: string;
  title: string;
  elements: LagomElement[];
}

type LagomElement =
  | MarkdownBlock
  | StepBlock
  | ChecklistBlock
  | DecisionBlock
  | PolicyRuleBlock
  | PromptBlock
  | AgentActionBlock
  | DataReferenceBlock
  | ApprovalBlock
  | SystemReferenceBlock
  | MermaidBlock
  | TableBlock;

Element types

Markdown
Step
Checklist
Decision
PolicyRule
Prompt
AgentAction
DataReference
Approval
SystemReference
Mermaid
Table

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

Trapped in documents that go stale, systems that do not talk to each other, and processes that only live in someone's head. Lagom turns knowledge into a durable operational layer.

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

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

Ready to get started?

See lagom.md in action — edit, validate, and render documents live.

Open the Playground