Agent dialects
Agent tools read files: Claude Code reads CLAUDE.md and AGENTS.md, Codex reads AGENTS.md and .agents/skills/, Cursor reads .cursorrules. Structure writes those files for you from the company's canon. One canon, one file per thing a tool reads, all of them generated — each dialect is the same canon said in the shape one tool expects.
structure compile --write # write every default dialect
structure compile --check # exit nonzero if compiling would change anything
structure compile --targets agents,claude --write # only the ones you name
Every generated file starts with a marker that says it is generated, which build wrote it, and a checksum of its body. Don't edit these files. Put your own preferences in the one file the marker names as yours, or change the canon, and compile again. structure check reports a generated file that no longer says what the canon says (drift) and one somebody typed into (a hand-edit).
The targets
| Target | Writes | Read by | Default |
|---|---|---|---|
agents | AGENTS.md — the one full instruction file | Codex, Claude Code, Cursor and most other agents | on |
claude | CLAUDE.md — three lines: @AGENTS.md, a blank, the marker | Claude Code (older sessions and hooks that look for this file) | on |
cursor | .cursorrules — the same three-line pointer | Cursor | on |
githooks | .githooks/pre-commit — names what a commit adds to the check's findings (its first line, always: this commit: 0 new); never blocks | git, once a clone runs git config core.hooksPath .githooks | on |
codex | departments/<name>/AGENTS.md, .agents/skills/<slug>/SKILL.md, and the ## Code Review Rules section of AGENTS.md | Codex | on |
commit-gate | .githooks/commit-msg — refuses a direct commit of a gated document on main | git, in a clone with hooks switched on | on when structure.yml names the founder rung |
pre-push | .githooks/pre-push — a push to a work branch must carry its work record | git, in a clone with hooks switched on | on |
maintainer | a maintainer workflow under .github/workflows/ | GitHub Actions | on when structure.yml says maintainer: gh-actions |
--targets compiles exactly the list you give. CLAUDE.md and .cursorrules bring AGENTS.md with them, since they only point at it. A partial compile leaves every target you left out as it was, and stale until the next full structure compile --write: structure check reports the drift, and structure compile --check always asks about every default target, whatever --targets says. AGENTS.md itself compiles the same way whichever targets you name, ## Code Review Rules included; leaving codex out only leaves the department files and skill pointers as they were.
What Codex reads
Codex starts at the repository root and walks down to the folder it is working in, reading the AGENTS.md in each folder on the way and joining them, root first. So the codex target writes:
departments/<name>/AGENTS.mdfor each department that has something of its own to say: the opening of its mission, each steering document at the department's root (path, title, first paragraph), the code review rules whose jurisdiction is that department, and where its work goes. Roles stay out — they are listed in the root file. A department with no steering documents and no rules gets no file at all, rather than an empty one.## Code Review Rulesin the rootAGENTS.md, after## Approvals. It is compiled only from the typed rulesstructure checkenforces:rules:blocks (banned-words,required-sections) in canon documents, grouped by where they apply — everywhere, then each department (pointing at its file), then each voice — followed by the two rules every company has: every relative link and named path must exist, and a generated file is never edited by hand. A company with norules:blocks still gets those two. This section takes the place of## Content rules, which listed the same rules..agents/skills/<slug>/SKILL.mdfor every skill inskills/: aname, thedescriptionfield of the skill's own document word for word (its title when it has none), and one line pointing atskills/<slug>/SKILL.md. The skill itself is never copied; Codex opens the path. Write the description once, in the skill's own document, as what a person would ask for. A built-in skill compiled intoskills/is described by its name and path instead.
These paths are shared with your own Codex files, so a file already there that Structure did not write — your own skill, or a symlink — is left alone, even with --force; move it away if you want the compiled one. When a skill or a department's last steering document is deleted, its compiled file is no longer compiled: structure check reports it and structure compile --write removes it (unless you typed into it, in which case it stays and compile says so).
A rule written in the canon reaches both gates from the same bytes. Give a department's coding standards a block like
rules:
banned-words: ["CSV", "XLSX", "coming soon"]
and structure check flags those words in that department's documents (a warning in a draft, an error once published), while Codex reads the same words under that department in ## Code Review Rules.
The budget
Codex stops adding instruction files once the joined text reaches project_doc_max_bytes — 32 KiB unless you configured it otherwise. What it reads for work in a department is the root AGENTS.md plus that department's file, so compile measures the root plus the largest department file against a budget:
# structure.yml
compile:
agents-budget: 32768 # bytes; the default is Codex's own default
When the two together run over, compile moves detail out of the root, a whole line at a time and never mid-sentence: first each department's code review rules become one line pointing at that department's file, then the Work and Memory groups of the Types list become one line each. It prints the bytes, the budget and what moved. If the root is still over, structure check reports it as a budget warning with the fix. Department files have no budget of their own: each one is read only for work in its own folder, alongside the root.
Tools: MCP servers
Every MCP server your company runs on is declared in the repository, so everyone's agent tools run the same servers. A server is a document in company/tools/, named for the server and gated like the rest of company/:
---
type: mcp-server
transport: stdio
command: northwind-search-mcp
args: ["--stdio"]
connector: company/connectors/northwind-search.md
owner: miranda
updated: 2026-10-16
---
# Northwind search
transport is stdio, with the command that starts the server and optional args, or http, with the server's url. connector names the connector whose key the server uses. The connector document stays as it is: its key-ref names the environment variable that holds the key. The server's name is its file's name, in lowercase letters, numbers, hyphens or underscores.
When the company declares at least one server, structure compile --write writes three more files, one for each tool:
| Target | Writes | Read by | How the file names the key |
|---|---|---|---|
claude-mcp | .mcp.json | Claude Code | "${NORTHWIND_SEARCH_KEY}" in the server's env, or Bearer ${NORTHWIND_SEARCH_KEY} for an http server |
cursor-mcp | .cursor/mcp.json | Cursor | "${env:NORTHWIND_SEARCH_KEY}", the same two ways |
codex-mcp | .codex/config.toml | Codex | env_vars = ["NORTHWIND_SEARCH_KEY"], or bearer_token_env_var for an http server |
A company that declares no server gets none of these files. Each file names the key's variable and never its value: the tool reads the value from the environment of the person running it. A stdio server receives the variable under its own name; an http server sends it as a bearer token.
The files are generated like every other dialect. JSON has no comments, so in the two JSON files the marker is the first key, "$structure", which Claude Code reads past. A hand edit is reported by structure check as a hand-edit, and the next compile writes over it, so add a server by declaring it in company/tools/ rather than by editing a file. A .mcp.json you wrote yourself is left alone, even with --force. When the last server is removed, structure check reports the compiled files and structure compile --write removes them. Once the files are committed every clone has them, and a running structure serve keeps them current as the declarations change.
Two steps stay with each person, on purpose. Claude Code asks each person to approve a project's servers the first time it starts in the folder, and Structure never approves them for you. Codex reads .codex/config.toml only in a project you have marked as trusted in your own Codex settings, and Structure does not mark it for you.
structure check on your own machine also reads which servers your agent tools run: from ~/.claude.json, ~/.cursor/mcp.json, Codex's config.toml and the three files in the repository. For each server the company does not declare it prints a warning, such as Claude Code on this machine runs MCP server scratchpad, which the company does not declare in company/tools/. A personal server is fine; the warning tells you it is yours and not the company's. Check reads only the names of the servers in those files, never a key or anything else they hold, and it says nothing in CI.