Authoring Your Company with an AI Assistant
A Crewlet company is YAML: a mission, an org chart, seats with backstories, policies, integrations. Crewlet ships the pieces an AI assistant needs to write it with you and check its own work. Each works on its own:
| Piece | What it gives you |
|---|---|
crewlet schema | JSON Schema generated from the models: the authoritative field list, for your editor, CI or an agent |
crewlet validate -json | Machine-readable problems with exact field paths and kinds, their text as written, so a fix loop converges |
The company-architect skill | An interview script, the invariants, and the write → validate → fix loop |
Walkthrough
Section titled “Walkthrough”From nothing to a running company. The quickstart builds the same shape by hand, every field explained.
1. Give your assistant the skill
Section titled “1. Give your assistant the skill”Claude Code discovers skills on disk. From a checkout:
mkdir -p ~/.claude/skills && cp -r skills/company-architect ~/.claude/skills/No checkout, or a different assistant? The skill is one self-contained markdown file with absolute links: fetch it and paste or attach it. See Installing the skill.
2. Say what you want
Section titled “2. Say what you want”Set up a Crewlet company for a small dev-tools startup — a CEO, a CTO with two engineers, and a PM.
3. Answer the interview
Section titled “3. Answer the interview”It asks what the company does, who is on it, where you sit in the chart,
which surfaces the work lives on, and what model and budget to use: whose
models, and whether you pay with a plan or a key, since every model runs
through that vendor’s own harness (Claude Code, Codex, or OpenCode for open
models; only Claude Code, Codex, Gemini CLI, Qwen Code, OpenCode, Cursor Agent, Copilot, Grok Build, Muse Code, Kimi Code, Hermes Agent and Pi can run a seat’s executor, in a box from
providers.sandbox, which the company then needs; see
LLM Backends). Rough answers
are fine: it proposes an org chart and you correct it. Unasked, it should:
- put you in the chart as a human seat managing the top agent (the seat you join the company on, since every person holds one)
- keep every secret as a
${VAR}, never a literal - skip integrations on the first pass (step 8 adds them)
- warn you that handles are effectively permanent
4. It writes and checks its own work
Section titled “4. It writes and checks its own work”You get company.yaml (Tier B, the company) and crewlet.yaml (Tier A, the
infrastructure). After every edit it runs:
crewlet validate company.yaml -jsonand fixes each reported path until valid is true. It should say which rung
of the validation ladder it used: full crewlet
fidelity, a plain JSON Schema validator, or reading the schema. None of this
needs your API keys, so the whole design pass happens before you set up an
account.
5. Fill in the environment
Section titled “5. Fill in the environment”The config references variables; you supply the values. Ask the assistant to
list every ${VAR} it used: a missing one resolves to an empty string and
fails later, deep in a turn.
# nothing to bring up: the engine embeds its stream and creates its store
crewlet secrets keygen -key-id 2026-01 # the id crewlet.yaml's secrets: names; # prints the export line belowexport CREWLET_SECRET_KEY_2026_01="<the base64 key it printed>"export CREWLET_API_TOKEN_FOUNDER="$(openssl rand -hex 32)"export ANTHROPIC_API_KEY="sk-ant-..." # a Claude Code entry on auth.mode api-keyexport OPENAI_API_KEY="sk-..." # embeddingsexport MATTERMOST_FOUNDER_USERNAME="you" # your chat usernameThe model’s own key is the one variable the config may not mention: an entry
on auth.mode: api-key reads its harness’s key variable (ANTHROPIC_API_KEY
for Claude Code, CODEX_API_KEY for Codex) when it names none. An entry on a
plan needs no variable, but a login on the engine host:
crewlet llm login <key> -from-host adopts the one your own harness already
has. Then check the model end to end before the first turn; unlike validate,
this reads the environment and makes real calls:
crewlet llm doctor6. Run it
Section titled “6. Run it”crewlet run crewlet.yaml -company company.yaml7. Watch the first turn
Section titled “7. Watch the first turn”Open http://localhost:8000/, sign in with the API token your crewlet.yaml
declares, then put yourself on your human seat: open it from
Company › Structure and press Invite, as in the
quickstart’s step 4. A company
with no integrations has no inbound work, so the first pass puts a five-minute
schedule on the top seat to prove the loop:
schedules: - name: hello-crewlet cron: "*/5 * * * *" task: "Write a short note on what the company should focus on this week."Within five minutes the CEO goes Working, steps through Execute →
Review (with Onboarding before them on its first turn), and returns to
Idle, every prompt and tool call inspectable. That confirms the engine, your
model and your config, with no external account. Delete the schedule once real
work arrives: every fire continues, and pays for, the session the last one
left (Scheduling),
so each fire costs more as that session grows, up to the harness’s window.
8. Add one integration at a time
Section titled “8. Add one integration at a time”Add Mattermost so the team can talk in channels and DM me.
Pick your stack in Choosing your stack, create the accounts it names (the assistant writes config; it can’t stand up a Mattermost server or create a Slack app), then let it wire the config and re-validate. One integration per pass, so a failure is unambiguous, and each lands working before the next.
Tier B is live-editable: apply a change with
crewlet config import company.yaml, no restart. A worked seven-seat company
with every setting’s reasoning in a comment, the full stack on a tracker, a
wiki, chat and a code host:
examples/nimbus.company.yaml.
Why not just point an assistant at the docs
Section titled “Why not just point an assistant at the docs”The surface is large and strict. Tier B validates against typed config
models that forbid unknown keys, so an invented field name (responsibilites,
leed, commnad) is a hard error, not a silent no-op. An assistant working
from prose will occasionally invent one.
The expensive mistakes aren’t type errors. Choosing a handle you later
rename, putting a secret in the config file, or confusing a unit’s space
(routing identity) with knowledge.scope (read scope) all give a valid
config that behaves wrong. Those judgement calls are what the skill
front-loads.
The schema fixes the first problem. The skill fixes the second.
Without Crewlet installed
Section titled “Without Crewlet installed”Authoring happens before installation, so the schema is a static file with
no dependency on the crewlet binary: an assistant fetches it from a URL and
validates with any standards-compliant JSON Schema validator (jsonschema,
ajv), or by reading it.
It is generated from the Go types the engine parses with, which forbid unknown keys, so a schema-only check catches:
- unknown keys, at every level including roles, units, and MCP servers
- wrong shapes (a list where a map belongs, text where a number belongs) and
bad enums (
kind: robot,harness: claud-code) - malformed handles and unit ids, and numbers out of range
Every field, list member or map value that holds a credential carries
"x-crewlet-secret": true. It is an annotation, not a check (a literal there
still validates), so the assistant reads it and writes a ${VAR} reference
without guessing from a field’s name. See
Credential positions.
It does not flag a number or boolean written into a text field: YAML reads
name: 2024 as a number and org_webhook: false as a boolean, the engine
takes each as the text written, and the schema does too (an editor underlining
a config the engine runs would teach its author to ignore it). An empty value
(~ or "") is accepted wherever the engine reads it as unset.
A human seat with no contact identity passes both checks: a person who works
only through the dashboard has no chat account. crewlet validate warns at the
seat’s contact that it cannot be @-mentioned. A company with no kind: human
seat passes too (its agents may run it alone through the deployment’s API
tokens), and crewlet validate warns at roles that nobody can be invited
into it or created in it, since every person holds a human seat.
Anything turning on more than one field, or on what a value means, needs the binary; the skill tells the assistant to check it by reading:
| Gap | Why the schema can’t |
|---|---|
lead / manages naming a seat handle or unit id that exists | Reference integrity across the document: not expressible in JSON Schema |
A knowledge.* scope naming a backend the config configures | The rule turns on whether a block is present, which JSON Schema can state only by enumerating every shape the block can take, and a subtly wrong one would flag configs the engine runs |
| Real IANA timezone | Needs the timezone database |
A cron expression — its field count as well as its values (99 * * * *) | The schema takes a cron as text; crewlet validate runs a cron parser |
internal/config/schema_test.go runs every rule through both encodings and
fails if they disagree.
The validation loop
Section titled “The validation loop”crewlet validate company.yaml -json{ "valid": false, "tier": "company", "file": "company.yaml", "problems": [ { "path": "roles[1].llm", "segments": ["roles", 1, "llm"], "kind": "unknown_value", "seat": "cto", "message": "roles[1].llm: value not in the allowed set: \"nonexistent\" is not a configured provider. Use one of providers.llm's: \"primary\". A key that misses is not an error at run time: the seat falls back to another model and bills against it, so this is the only place the typo can be seen" }, { "path": "units[0].roles[0].name", "segments": ["units", 0, "roles", 0, "name"], "kind": "conflict", "seat": "software-engineer", "message": "duplicate handle \"software-engineer\": 2 seats derive it (seat \"Software Engineer\" in unit \"Engineering\"; seat \"Software Engineer\" in unit \"Engineering\"). The handle is the canonical seat identity, naming its inbox, its agent id and its external accounts, so give each of these seats a distinct name or an explicit handle" }, { "path": "units[0].roles[1].name", "segments": ["units", 0, "roles", 1, "name"], "kind": "conflict", "seat": "software-engineer", "message": "duplicate handle \"software-engineer\": 2 seats derive it (seat \"Software Engineer\" in unit \"Engineering\"; seat \"Software Engineer\" in unit \"Engineering\"). The handle is the canonical seat identity, naming its inbox, its agent id and its external accounts, so give each of these seats a distinct name or an explicit handle" } ], "warnings": [ { "kind": "dangling_reference", "ref": "lead", "path": "units[0].lead", "segments": ["units", 0, "lead"], "seat": "", "unit": "Engineering", "from": "Engineering", "to": "tech-lead", "message": "unit \"Engineering\" names lead \"tech-lead\", which is no seat's handle, so the unit and every descendant inheriting its lead run with no lead. Correct the handle or add a seat that derives it" } ]}Every offending field comes with its exact path, all at once, so an assistant
fixes them in one pass. A rule broken inside a seat or a unit names that
seat’s handle or that unit too, and a seat is located where it was written even
when its unit: reference moves it into a unit.
A document the parser refuses (an unknown key, a value of the wrong shape) reports every such key at once, at the key as it sits in the file, with its line. The rules above run once it parses:
{ "path": "roles[0].backstroy", "segments": ["roles", 0, "backstroy"], "kind": "unknown_field", "line": 6, "message": "roles[0].backstroy: unknown field: \"backstroy\" isn't a setting. Check the spelling and the block it's under (line 6)" }Each problem carries:
| Field | What it is |
|---|---|
path | Where it is, as the document spells it. Empty only for a failure that belongs to no place in the document, such as a file that is not YAML at all. |
segments | The same place taken apart: strings for keys, numbers for list indexes. A map key can contain a dot (a provider called claude-3.5), so read these rather than splitting path. null when path is empty. |
kind | One of missing, out_of_range, conflict, shape, unknown_field, unknown_value, or invalid for anything this build does not classify. |
message | The whole line, exactly as the prose output prints it. |
seat, unit | The handle of the seat, or the name of the unit, the problem is about. Omitted when it is about neither. |
line | The line in the file, for a problem the parser found. Omitted otherwise. |
kind is a closed set with a fallback so a loop branching on it never gets an
empty string. Two seats sharing a handle are one message and one problem per
seat, each at the field that seat wrote (its handle, or its name where
the handle is derived from it), so problems can hold more entries than the
prose output has lines (which leads such a message with every path it applies
to). Two seats sharing only a name are fine: the example above is refused
because neither seat declares a handle, so both derive the same one.
warnings are references that resolve to nothing: a unit lead (a seat
handle), a root seat’s unit (a unit key), a manages entry (either), or a
GitLab access level naming no seat. The engine runs a company with one (live
configuration assembles an organization in pieces), so a warning never fails
validation, but one surviving in a finished document is a misspelling nothing
else will report. kind is dangling_reference, ref says which kind of
reference, from and to are what holds it and what it names, and path,
segments, seat and unit locate it as they do a problem. Both lists are
always arrays, empty rather than absent.
Exit code is 0 when valid and 1 otherwise, in both output modes, so
crewlet validate company.yaml -json || exit 1 gates. Nothing is echoed on
stderr in -json mode: the payload already carries every problem.
It needs no credentials, no database, and no network. Tier B stores
${VAR} references verbatim and resolves them at engine start (see
Configuration § Environment variables),
so a complete config validates before any secret exists.
Validation is deep: it builds the Organization, so duplicate handles,
duplicate unit keys, bad cron expressions, invalid timezones and a knowledge
scope with no backend all fail here rather than at run time, and a unit lead
that is no seat’s handle is a warning.
-tier auto (the default) picks the tier from the document’s keys, not its
filename. The tiers share no top-level key: name / roles / units /
providers / integrations mean Tier B, node / stream / store /
coordination / api mean Tier A. A document carrying neither, or an equal
count of both, is refused naming the flag rather than guessed at (a wrong
guess reports every field as invalid, which a fix loop can’t tell from a
genuinely broken document). Force it with -tier company / -tier bootstrap.
The same loop checks a repository’s .crewlet/checks.yaml, told apart by a
checks: beside no key of either tier, whatever else it carries, or forced with
-tier checks. Every problem is located at its field and line in the same
payload (the first 128, and one more counting the rest); a typo’d key beside
checks: is refused at its own line rather than reported as an undecidable
document (The checks
file).
Editor autocomplete
Section titled “Editor autocomplete”The same schema drives your editor. Add a modeline at the top of the file; with the YAML Language Server (in VS Code’s YAML extension, Neovim, JetBrains, Helix) you get completion, inline docs from the field docstrings, and typo squiggles:
# yaml-language-server: $schema=https://docs.crewlet.com/engine/next/schema/company.schema.jsonname: "Acme AI"Or generate it locally and point at the file:
crewlet schema company -o schema/company.schema.jsoncrewlet schema bootstrap -o schema/bootstrap.schema.jsonBoth are also checked into schema/. A test regenerates and
compares them, so they cannot drift from what the loader accepts.
To catch a bad config in CI:
crewlet validate company.yaml -json || exit 1The company-architect skill
Section titled “The company-architect skill”skills/company-architect/SKILL.md
is a provider-neutral prompt (a markdown file, not a vendor format) carrying
the interview script, the invariants the schema can’t express, and the
validation loop above.
Claude Code discovers skills automatically. Install for one project or for every project:
# this project onlymkdir -p .claude/skills && cp -r skills/company-architect .claude/skills/
# every projectmkdir -p ~/.claude/skills && cp -r skills/company-architect ~/.claude/skills/Then say what you want:
Set up a Crewlet company for a 5-person dev-tools startup.
Any other assistant (Cursor, Copilot, Codex, the ChatGPT/Claude web apps): paste or attach the file, or add it to your rules/context directory. Without a repo checkout, fetch it from GitHub.
What it will do
Section titled “What it will do”- Interview you about the company before writing anything.
- Start you integration-free with one scheduled task, so you see a real agent turn within minutes, then layer integrations one at a time.
- Keep every secret as a
${VAR}reference, never a literal. - Put you in the org chart as a human seat, the seat you are invited onto once the company runs.
- Warn you that handles are effectively permanent (see below).
- Validate after every edit, and not claim success until it passes.
What it can’t do
Section titled “What it can’t do”It writes config; it doesn’t provision. Standing up the Mattermost server (or Slack workspace), the Atlassian site, the GitLab group, the API keys, and the harness your model runs through (installed on the engine host) is your job; Choosing your stack lists what to create by hand for each. Once those exist, each integration’s Agents tab turns each agent on there, and the engine creates the per-seat accounts and seals their tokens itself. Atlassian and GitHub issue no credential on a provisioner’s behalf, so their commands report which account each hand-created credential turned out to be.
The one thing to get right before you run
Section titled “The one thing to get right before you run”Handles are effectively permanent. An agent’s durable id is a UUIDv5 over
"<company name>:<handle>" (org.DeriveAgentID), so renaming a seat’s
handle, or the company name, mints a new id and orphans what the agent
keeps under it: its diary and onboarding markers. A handle rename also
orphans what is kept under the handle itself (episodes, skills, counterparty
profiles, conversations’ sessions), so the seat starts with no memory at all.
Either way the seat keeps working, without what was orphaned.
Settle the company name and each handle before the company runs. See Agent Runtime § Seat Definition and the Runner.
Next steps
Section titled “Next steps”- Quickstart — the minimal four-seat company, by hand
- Choosing your stack — every external dependency, hosted vs self-hosted
- Configuration reference — the full field list in prose
- Configure via API — the same config
over
/config/*instead of a file
Part of Crewlet. Generated from crewlet/crewlet main at 3f5565e.