# Company as Code

> An open standard to describe your company's goals, roles, processes, and policies as plain markdown files in git, so every AI agent session can follow your rules.

Company as Code is an open standard created and maintained by Pirol Labs that lets you write down how your company works — goals, roles, processes, and policies — as plain markdown files stored in git. The core insight is that every AI agent session starts fresh with no context, and this project gives agents a structured, validated knowledge graph to work from. The reference toolchain, `charta`, is written in Rust and released under Apache-2.0.

## What It Is

Company as Code treats organizational knowledge the same way software teams treat infrastructure: as versioned, validated, machine-readable files. Each resource (a role, a goal, a process, a policy) lives in its own markdown file with a small typed YAML header. The header fields connect files into a graph — a process is owned by a role, serves a goal, and follows a policy. The `charta` CLI checks every reference: if a reference points to something that does not exist, validation fails. The text body below the header is plain language, readable by people and consumable by AI agents.

## The `charta` Toolchain

The `charta` binary provides a focused set of commands:

- **`charta validate`** — checks that all files are well-formed, every reference resolves, and required fields exist
- **`charta graph` / `charta query`** — outputs the company graph as JSON, Mermaid, or Graphviz DOT; finds orphans and backlinks
- **`charta plan`** — compares the working tree with the last git commit and shows what a pending change would affect before it is committed
- **`charta mcp`** — starts an MCP server so any MCP-capable AI agent can read and query the company graph as tools
- **`charta init`** — scaffolds a new company description with a root `company.yaml`

Installation is available via Homebrew (`brew install pirol-ai/tap/charta`), npm (`npm i -g @pirol/charta`), or pre-built binaries on the releases page. The tool runs on macOS, Linux, and Windows, and can be built from source with Cargo.

## How the Graph Model Works

Every resource file carries an `api: company-as-code.org/v0` key and a `type` field (company, goal, role, process, policy). References between files use a `type/id` addressing scheme. The tool builds a directed graph from these references and can render it as a Mermaid flowchart (natively rendered by GitHub) or Graphviz DOT. The design deliberately keeps the schema small: only references and required fields are enforced. The meaning lives in normal language; agents handle the prose. Files without the `api:` key are ignored, so notes and other documents can coexist in the same repository.

## OKF Compatibility

The README states that Company as Code is fully compatible with Google's Open Knowledge Format (OKF). Every resource file is also a valid OKF concept, sharing the `type`, `title`, `description`, and `tags` fields with the same meaning. Unknown fields are preserved exactly — read and write operations never change a file. On top of OKF, Company as Code adds: an `id`, `type/id` addressing, references that must resolve, and required fields per type.

## Update: charta v0.4.0

The latest release is **charta v0.4.0**, published on 2026-09-12. The repository was created in September 2026 and last updated on 2026-09-23, indicating active early development. The specification is described as a working draft, with the format intended to be frozen at 1.0. The project follows a "conformance test suite defines the standard" philosophy, with test fixtures in the `conformance/` directory serving as the authoritative definition of correct behavior.

## Features
- Describe company goals, roles, processes, and policies as plain markdown files in git
- Typed YAML header connects files into a validated reference graph
- charta validate: checks all references resolve and required fields exist
- charta plan: shows what a pending change would affect before committing
- charta graph: outputs company graph as JSON, Mermaid, or Graphviz DOT
- charta query: find orphans and backlinks in the company graph
- charta mcp: built-in MCP server for AI agent access to the company graph
- charta init: scaffolds a new company description
- Compatible with Google's Open Knowledge Format (OKF)
- Install via Homebrew, npm, or pre-built binaries
- Build from source with Cargo (Rust)
- Works on macOS, Linux, and Windows
- Files without api: key are ignored — notes coexist safely
- Unknown fields preserved exactly on read/write
- Agent-assisted authoring workflow supported

## Integrations
MCP (Model Context Protocol), Google Open Knowledge Format (OKF), Git, GitHub (Mermaid graph rendering), Graphviz DOT, Homebrew, npm, Cargo / Rust toolchain

## Platforms
WINDOWS, MACOS, LINUX, API, CLI

## Pricing
Open Source

## Version
v0.4.0

## Links
- Website: https://github.com/Pirol-ai/company-as-code
- Documentation: https://github.com/Pirol-ai/company-as-code/tree/main/spec
- Repository: https://github.com/Pirol-ai/company-as-code
- EveryDev.ai: https://www.everydev.ai/tools/company-as-code
