Skip to content

Workspace Kinds

llms.txt lists every page for an agent

A member’s kind in chant.workspace.json says how chant reads its directory (#2524 D3). The list of kinds is closed, since each one is either built in or supplied by a package the declaration pins, and a member of any other kind fails chant workspace check with WSP003, which lists the known kinds.

Kinds are plain data. Besides its name and description, each kind carries a probe that looks for files in the member’s directory and a precedence that settles overlaps between probes. Probes run no code, and reading a package’s kinds never imports the package, so listing a workspace never loads a lexicon.

KindPrecedenceThe directory holds
workspace1000a nested workspace, with its own chant.workspace.json or .jsonc
reponever claims a directorynothing here: the member names another repository’s workspace by URL and pinned revision. See repo members
chant500a chant project, with chant.config.ts or chant.config.json directly in it
designnever claims a directorythe design artifacts the workspace owns, as data. chant reads the files and builds nothing
othernever claims a directoryanything chant does not read. The member needs because
examplesnever claims a directorythe kind of an example group, not of a member

Each kind also says which outputs its members expose to member links. A chant member exposes the outputs its source declares, a nested workspace or a repo member exposes none, and an other or design member exposes what its entry lists.

A design member is the data member of D18 (#2549, ws-062). It needs no because, and WSP009 does not report it. Its probe, like the one of other, only checks that the directory exists. Records pin its files by hash, chant workspace graph --intent shows them, and the per-member commands leave it out with kind-not-run. A declaration that uses the kind needs chant 0.101.0, since an older chant lists the member with unknown-kind.

The probe of other only checks that the directory exists, and it never claims a directory from another kind. chant workspace check reports every other member as a WSP009 warning, and chant doctor shows the same warning. The check fails with WSP008 when a registered kind’s probe claims an other member’s directory, since that member should be declared as the kind that claims it.

A package supplies kinds by exporting a JSON file at its ./workspace-kinds subpath. This follows the slim ./detect entry every lexicon exports (#426), except that the target is a data file, not a module.

{
"exports": {
".": "./src/index.ts",
"./workspace-kinds": "./workspace-kinds.json"
},
"files": ["src/", "dist/", "workspace-kinds.json"]
}

The subpath may also be a conditions object, in which case chant reads its default condition. A lexicon can export the subpath from its own package, or a kinds-only package can carry nothing but package.json and the kinds file.

chant reads the key ./workspace-kinds literally. A ./* pattern in exports maps the subpath to code, so chant ignores it. A target that isn’t a .json file inside the package is refused and never run.

{
"schema": 1,
"kinds": [
{
"name": "terraform",
"description": "a Terraform root module, with a main.tf in its directory",
"precedence": 400,
"probe": { "anyFile": ["main.tf", "versions.tf"] }
}
]
}
FieldValue
schema1
kinds[].name^[a-z][a-z0-9-]{0,39}$. It can’t be chant, workspace, repo, design, other or examples, and a package lists each name once
kinds[].descriptionOne line saying what the directory holds, shown in listings and messages
kinds[].precedenceAn integer from 1 to 999
kinds[].probe.anyFileFile names. The probe passes when a file matching one of them sits directly in the member’s directory. A * matches any run of characters in a name, so *.tf matches every .tf file, and [0-9] matches one digit
kinds[].probe.anyBlockin, file names as in anyFile, and blocks, block names. The probe passes when a file directly in the directory whose name matches in has a line that opens one of those blocks with no label, such as live {. Leading space is allowed, and no file is parsed
kinds[].probe.anyJsonKeyin, file names as in anyFile, and pointers, JSON Pointers such as /scripts/start. The probe passes when a file directly in the directory whose name matches in parses as JSON and has a value at one of the pointers. A file that isn’t JSON is no evidence either way. Added in chant 0.103.0 (#3151)
kinds[].probe.anyLinein, file names as in anyFile, and starts, line openings. The probe passes when a file directly in the directory whose name matches in has a line that starts with one of them, after leading space and ignoring case. A goose directory is found by -- +goose up (#4400)
kinds[].probe.anyDocumentin, file names as in anyFile, and match, a list of entries that each map JSON Pointers to the values allowed there. The probe passes when a file directly in the directory whose name matches in parses as YAML or JSON, and one of its documents (a YAML file may hold several) has every pointer of one entry at a value matching one of that pointer’s patterns. A * in a pattern matches any run of characters, so ["*"] means the pointer has a value. A file that doesn’t parse is no evidence either way. Added for #3179
kinds[].outputsOptional. Output names every member of the kind exposes to member links. A member entry of the kind can list more in its own outputs
kinds[].graphOptional. How chant workspace graph reads a member of the kind. See below
kinds[].driftOptional. A drift reader module chant workspace drift --member runs for a member of the kind. See A drift reader. Added in chant 0.124.96
kinds[].fieldsOptional. The fields a member of the kind may set, each with a type and a default. See Fields. Added in chant 0.103.0
kinds[].readerOptional. The link reader chant runs over a member’s own files. See Links read from a member’s files
kinds[].memberFileOptional. A file every member has and the JSON Schema it must pass. See A member’s own file

A probe needs at least one of anyFile, anyBlock, anyJsonKey and anyLine, and it passes when any one does. All four only look at files directly in the directory, never below it.

Fields whose names start with x- are allowed on the file and on each kind. Anything else is refused. The JSON Schema ships in @intentius/chant at src/workspace/workspace-kinds.schema.json, with the $id https://intentius.io/chant/schemas/workspace/kinds/v1/workspace-kinds.schema.json.

A kind can declare the conventions its members follow as fields, each with a default, so a member states only where it differs and a reader such as an orchestrator gets every value from the read contract (#3151, ws-093).

{
"name": "svc",
"fields": {
"port": { "type": "integer", "description": "The port it listens on", "default": 8080 },
"env": {
"type": "object",
"description": "The variables it reads",
"properties": { "data": { "type": "string", "description": "Its data directory", "default": "DATA_DIR", "pattern": "^[A-Z_][A-Z0-9_]*$" } }
}
}
}
FieldValue
fields.<name>A name matching ^[a-z][A-Za-z0-9]{0,39}$
fields.<name>.typestring, integer, boolean or object
fields.<name>.descriptionOne line saying what the field holds
fields.<name>.defaultOptional, for a string, integer or boolean field. The value a member that doesn’t set the field gets; without it the field reads as null
fields.<name>.patternOptional, for a string field. A regular expression the value must match
fields.<name>.propertiesFor an object field, its own string, integer or boolean fields, each declared the same way

A default of the wrong type, or a pattern that isn’t a regular expression, is a WSP002 problem. A member entry sets values under fields, and chant workspace check fails a field the kind doesn’t declare, or a value of the wrong type or pattern, with WSP005. chant workspace status --json prints members[].fields with every declared field, the entry’s value or the default, and null for a member whose kind declares no fields.

A kind’s members are directories chant can probe, but a directory of .tf files has no chant config, so there is nothing for chant graph to run in it. The optional graph block says how to read one (#2874):

{
"name": "terraform",
"graph": {
"lexicon": "terraform",
"config": {
"moduleRoot": "{workspace}",
"roots": { "{member}": { "dir": "{dir}" } }
}
}
}
FieldValue
graph.lexiconThe lexicon that reads the member, by name. The package that supplies the kind must be @intentius/chant-lexicon-<lexicon>, so the lexicon chant loads is the one the declaration pins. A kind whose package has another name keeps its probe and loses its graph block, with a WSP002 problem. Not with graph.reader
graph.readerA graph reader module, as a path inside the supplying package. Any package may supply it. Not with graph.lexicon
graph.configThe lexicon’s config namespace for the reader project (required with lexicon), or the config the reader module is called with (optional with reader). In every string key and value, {member} becomes the member’s name, {dir} its absolute directory and {workspace} the absolute workspace root. Nothing else is interpreted

For each member, chant workspace graph writes a reader project in a temporary directory: a chant.config.json with lexicons: [<lexicon>] and config under the lexicon’s key, and a node_modules link to the directory that holds the pinned package. The member’s chant graph --format ir runs there, and the project is removed afterwards. Nothing is written under the workspace. The block is data like the rest of the file: listing a workspace still imports nothing, and only graph loads the lexicon.

A lexicon is not the only package with something to draw. A package that is not a lexicon, such as a forge warden, can supply a graph reader instead (#4413). The kind’s graph block names a module in the package, in place of a lexicon:

{
"name": "forge-governance",
"graph": { "reader": "dist/graph-reader.mjs", "config": { "dir": "{dir}" } }
}

The module is an ES module inside the package, so a path that leaves it, or a file that is missing, is a WSP002 problem and the kind keeps its probe without a graph block. Its default export takes { dir, config }, with config as the block gives it (placeholders substituted) and dir taken from config.dir, and returns graph IR, { nodes, edges } with optional groups and meta. It may be async.

The reader project works as it does for a lexicon. Its chant.config.json declares no lexicon and sets graph.reader to the module and its config. The module is loaded by the member’s own chant graph --format ir, so it runs under the member’s toolchain. The temporary project is deleted when that finishes. A chant from before the field can’t read a kinds file that uses it, and a member’s own chant from before it ignores graph.reader and has nothing to print, so the member fails.

The reader is code from the package the declaration pins, and the contract is that it reads files and returns data: it takes no forge or network call, and writes nothing. chant enforces the part it can. The module must sit inside the package, it is imported only by chant graph and never when the kinds are read or the workspace is listed or checked, and its output is validated as graph IR like any member’s. The graph cache keys a reader member on the module’s size and modification time, so an edit shows without a new package version.

A kind can also name a drift reader, so chant workspace drift --member <name> reads a member of the kind (#5068). The drift block sits beside graph and names a module in the package the same way:

{
"name": "forge-governance",
"graph": { "reader": "dist/graph-reader.mjs", "config": { "dir": "{dir}" } },
"drift": { "reader": "dist/drift-reader.mjs", "config": { "dir": "{dir}", "file": "governance.yml" } }
}
FieldValue
drift.readerRequired. The module, as a path inside the supplying package. A path that leaves the package, or a file that is missing, is a WSP002 problem, and the kind keeps its probe without a drift block
drift.configOptional. The object the module is called with. {member}, {dir} and {workspace} are substituted in every string key and value, as in graph.config. Nothing else is interpreted

The module’s default export is a DriftReader from @intentius/chant/workspace/drift-reader. It may be async, and it is called with one object:

InputValue
dirThe member’s directory, absolute: config.dir when the config sets it as a string, else the member’s own directory
configThe block’s config, placeholders substituted
memberThe workspace member’s name
observedAtRFC 3339, for every record the reader builds
read, resource, stack--read, --resource and --stack, when given

It returns DriftReaderOutput, the answer a lexicon’s readDrift gives chant lifecycle drift. That is either { lines }, the drift record stream lines of each read it ran (a drift-start, its records and a drift-settle), or { refused: { code, message } } with read-unsupported, resource-unsupported or no-drift-read. A read that ran and failed is not a refusal. Its addresses are records with status not-observed and a reason. The schema ships in @intentius/chant at src/workspace/drift-reader.schema.json, $id https://intentius.io/chant/schemas/workspace/drift-reader/v1/drift-reader.schema.json. driftStart, driftSettle, driftRecord and driftRecordLine from @intentius/chant/drift-record build the lines.

import { driftRecord, driftRecordLine, driftSettle, driftStart } from "@intentius/chant/drift-record";
export default async function readDrift({ dir, config, member, observedAt }) {
const found = await readTheForge(dir, config.file);
const start = driftStart({ member, engine: "warden", read: "live-read", at: observedAt, expected: found.map((f) => f.address) });
const records = found.map((f) =>
driftRecord({ member, engine: "warden", address: f.address, node: null, observedAt, read: "live-read", status: f.differs ? "drifted" : "in-sync", evidence: { tool: "github-warden" } }),
);
const settled = driftSettle(start, records, observedAt);
return { lines: [start, ...settled.records.map(driftRecordLine), settled.line] };
}

chant workspace drift imports the module in its own process, which is the workspace root’s chant, and calls it once. The reader gets that process’s environment, so it reads its own credentials, such as a forge token, from there. chant passes nothing else and makes no forge call for it. Each line it returns is checked with the drift record’s codec, so a state read that says in-sync, or a not-observed record with no reason, fails the read with command-failed. A module that can’t be loaded, has no default export or throws fails the same way. chant then puts the workspace member’s name on every line and places each record on the member’s graph as it does for any member. Unlike a graph reader, a drift reader may call the forge or the network, since reading live state is its job, and it still writes nothing.

A kind with a drift block is read by it ahead of chant’s own reads, and a kind with none answers no-drift-read, as before. The block is data like the rest of the file: the module is imported only by chant workspace drift, never when the kinds are read or the workspace is listed or checked. A chant before 0.124.96 can’t read a kinds file that uses the field. The floor is KIND_DRIFT_READER_FLOOR in @intentius/chant/release-floors.

Some members already say what they read, in files of their own. A dbt project names the tables it reads in its sources: YAML. A kind can name a link reader with reader, and chant runs it over each member’s directory to derive the member’s links (#3932).

The readers are chant’s code, and the kinds file only names one. The file stays data, and chant still never imports the package that supplies it. A reader runs offline. It parses files as data and never runs the tool that owns them, so chant workspace check still starts no process and reaches no network. chant has five readers. One is dbt-project; the other four read migration directories. A kind that names a reader this chant doesn’t have is kept without one, with a WSP002 problem, and its members’ links are only those their entries state.

A reader returns links, each with the file and line that state it, and gaps: the places it could not read without guessing. It can also return outputs, names its member’s files state, which other members link to (#3935). resolveLinks adds them to the member’s own outputs (withReaderOutputs in packages/core/src/workspace/links.ts). A gap flagged as leaving an output out makes the member’s output list incomplete. The links are resolved beside the declared ones with origin kind-reader, so a missing output fails with WSP093 and an unreadable one is kept as WSP094, both at the member’s file and line. Each gap is a WSP099 finding. chant workspace graph lists the same rows in links, with reader, file and line.

A link names its producer when the member’s fields say which member that is. When they don’t, chant picks the one other member that exposes the output the link is anchored on (for a dbt column, its table). If none does and exactly one other member exposes outputs at all, the link goes to that member, so a dropped table is reported as missing from the only place it could be. Any other case is ambiguous (WSP095), and the message names the field that settles it.

Records are checked against their kind, and a kind can also check a file each of its members carries, such as the terragucci.yml of a terragucci control repo (#3672).

{
"name": "control",
"memberFile": { "path": "terragucci.yml", "schema": "schemas/terragucci.schema.json" }
}
FieldValue
memberFile.pathThe file, relative to the member’s directory, with forward slashes and no ..
memberFile.schemaA draft 2020-12 JSON Schema, a .json file inside the supplying package, relative to the package’s directory

The schema is read along with the package’s kinds, as data, the same way as the kinds file. A schema that is missing, isn’t JSON or doesn’t compile is a WSP002 problem. chant workspace check reads each member’s file, as YAML when its name ends in .yml or .yaml and as JSON otherwise. A member whose file is missing or doesn’t parse fails with WSP012, and so does one that doesn’t pass the schema, with one finding per reason. A $ref to another file is not followed. A chant older than this field fails a kinds file that uses it, so ship the schema in the package’s files and raise the chant floor with it.

Kinds come only from the declaration’s pins. chant does not look at other installed packages.

PinWhere chant looks
{ "package": "...", "version": "..." }node_modules/<package> in the workspace root or the nearest directory above it that has one, the way Node resolves a bare import. The installed version must equal the pinned one
{ "path": "..." }That directory inside the workspace

A pin that isn’t installed, is installed at another version, or publishes a kinds file that doesn’t validate is a WSP002 error. Its kinds are left out, so members of those kinds also fail with WSP003. A pin on a package with no subpath (@intentius/chant itself, for one) supplies no kinds and is no error. A kind name that two pins both supply is an error, and neither package’s version of it is used.

chant workspace ls --at <rev> reads kinds from the packages installed in the working tree, not from the revision.

A package can also name principal classes for the declaration’s writeScope (#2524 D5, #3080, ws-079). The four core classes are human, agent, runner and service. A domain class, such as reviewer or operator, is the set of principals holding one role in the trust policy at base (roles in .chant/trust.json). The package exports the classes as a JSON file at its ./workspace-principals subpath, beside or instead of ./workspace-kinds. The subpath follows the rules for kinds above, so chant reads only that literal key and only a .json target inside the package, as data.

{
"exports": { "./workspace-principals": "./workspace-principals.json" }
}
{
"schema": 1,
"classes": [
{ "name": "reviewer", "description": "people who review decisions", "role": "reviewer" }
]
}
FieldValue
schema1, the version of this format
classes[].name^[a-z][a-z0-9-]{0,39}$, not starting x-. It can’t be a core class, and a package lists each name once
classes[].descriptionOne line saying who is in the class
classes[].roleThe role whose grant at base puts a principal in the class. It can’t be agent, runner or service, which put a principal in the core class of that name, and one role belongs to one class

Its schema is src/workspace/workspace-principals.schema.json in @intentius/chant ($id https://intentius.io/chant/schemas/workspace/principals/v1/workspace-principals.schema.json), and x- fields are allowed on the file and on each class.

Classes are read from the declaration’s pins the way kinds are, with one difference: write scope reads a path-pinned package at the base revision, beside the declaration and the trust policy, so a change can’t remap a class by editing its own copy of the plugin. A package pin is read from the installed package, which must be at the version the base pins. A file that doesn’t validate is a WSP002 error, and a class name or a role two pins both supply is an error that leaves every class involved out.

The core roles are tried first, in the order agent, runner, service. The domain classes follow in pin order, and within a package in file order. The first class whose role the principal holds is the one write scope judges it by, and anyone else is human. A writeScope key no pinned package supplies fails chant workspace check with WSP003. Nothing then says who is in that class, so chant refuses every write judged human with write-scope-class-unknown until the package is installed or the entry removed.

chant ships an app member kind as a data-only kinds file in @intentius/chant, at src/workspace/reference-kinds/app (#3151, ws-093). It is a directory with a package.json that exports ./workspace-kinds and the kinds file. A workspace copies the directory and pins the copy by path, as the reference workspace does at kinds/app, so only a workspace that asks for apps has the kind.

{
"pins": [{ "path": "kinds/app" }],
"members": [
{ "name": "app", "dir": "app", "kind": "app", "fields": { "health": "/healthz" } },
{ "name": "delivery", "dir": "delivery", "kind": "chant", "links": [{ "member": "app", "output": "source" }] }
]
}
PartValue
Precedence100, below chant, so a chant project with a start script stays chant
ProbeanyJsonKey for /scripts/start in package.json: a Node package with a start script. A package with scripts but no start, such as a repository root, is not claimed
Outputssource, the directory a delivery member builds from, and url, where the running app answers
fields.scriptsWhich package.json script plays each part: start (default start), dev (dev), test (test) and migrate (migrate). A script that doesn’t exist means the app has none, such as no migrations
fields.envThe variables the app reads, by name: port (PORT), data (APP_DATA) and revision (APP_REVISION)
fields.healthThe path the running app answers on once it is up, default /health

An orchestrator reads these from status --json rather than assuming them: it runs npm run <scripts.start> with the port in the variable env.port names and waits for health to answer. Once a workspace pins the kind, WSP008 fails any other member that is a Node package with a start script. Declare that member as an app.

Two kinds ship from the terraform lexicon, since a choudoufu estate is a Terraform root that the lexicon’s choudoufu mode reads. behold used to keep both in its closed list of member kinds (#2545), and each keeps behold’s probe, narrowed to the member’s own directory, and behold’s order: a chant project first, then choudoufu, then terraform.

KindPackagePrecedenceProbe
choudoufu@intentius/chant-lexicon-terraform450anyFile: ["estate.chdf.hcl"], or anyBlock for a live block in a *.tf file
terraform@intentius/chant-lexicon-terraform400anyFile: ["*.tf"]

A choudoufu root also passes the terraform probe, and the higher precedence makes it a choudoufu member. A workspace that uses either kind pins the lexicon.

Both kinds carry a graph block, so chant workspace graph reads their members through the lexicon. Each member becomes one root named after the member, so a resource’s id is <member>/<member>/<address>, and a local module’s is <member>/<member>/module.<name>/<address>. The block sets the lexicon’s moduleRoot to the workspace root, so a root that calls ../modules/x keeps its modules as long as they sit inside the workspace. The choudoufu block also sets binary: "choudoufu", so the estate the root declares is read as a live root.

{
"pins": [
{ "package": "@intentius/chant-lexicon-terraform", "version": "0.81.0" }
],
"members": [
{ "name": "network", "dir": "estates/network", "kind": "terraform" },
{ "name": "prod", "dir": "estates/prod", "kind": "choudoufu" }
]
}

The chant repo pins both by path and declares examples/terraform-carve-out/terraform as a terraform member.

Forges, CI systems and wardens says what a warden is and why only forges have one.

The three wardens, github-warden, gitlab-warden and forgejo-warden, each ship a forge-governance kind as a data-only kinds file (#3180). A repo that holds a warden policy declares the policy’s directory as a member of that kind, so the forge state the warden keeps appears in chant workspace ls and chant workspace graph with the rest of the estate. It needs no new field: the kind uses a probe, outputs and a memberFile, and a workspace pins the one warden whose forge it governs.

WardenProbe and member fileOutputs
@intentius/github-wardengovernance.yml, by convention in .github/repos, teams
@intentius/gitlab-wardengovernance.yamlrepos, teams
@intentius/forgejo-wardengovernance.ymlrepos, teams
{
"pins": [{ "package": "@intentius/github-warden", "version": "<release with the kind>" }],
"members": [{ "name": "forge", "dir": ".github", "kind": "forge-governance" }]
}

Each package checks its file against a JSON Schema it ships, so chant workspace check fails a policy with a misspelled or misplaced field as WSP012 before the warden reconciles it. repos and teams are the names a member link can point at. For gitlab-warden, repos stands for projects and teams for groups.

Each kind carries a graph.reader block (above), since a warden is not a lexicon. The reader turns the governance YAML into graph IR with no forge call. The org and its repos and teams are nodes. Rulesets (branch protection on gitlab-warden and forgejo-warden) and apps are nodes too. An edge is a team’s access to a repo or a ruleset’s reach over a repo. It draws the policy as declared. Coloring a node by drift needs the warden’s live read, which a kind supplies as a drift reader; a member whose pinned warden ships none answers no-drift-read in chant workspace drift. Binding a reconcile to a gate, and a warden generating or checking the org-level workspace that repo members describe, are separate work.

The sql lexicon ships a dbt kind, since a dbt project reads the tables a sql member declares (#3932). A workspace that uses it pins @intentius/chant-lexicon-sql.

PartValue
Package@intentius/chant-lexicon-sql
Precedence300
ProbeanyFile: ["dbt_project.yml"]
Readerdbt-project
fields.sqlMemberThe member whose tables the project’s sources read. Unset, each source table links to the one member that exposes it
fields.dialectpostgres (the default) or clickhouse: how source and model names are cased
fields.modelSchemaThe schema the project’s models land in. Set, each model is the output <modelSchema>.<model> (#3935)

The kind lists no outputs of its own. The reader finds the project’s models and exposes them as outputs, so a downstream member can link to a model (How models become outputs).

The dbt-project reader parses dbt_project.yml and every .yml and .yaml file under the project’s model-paths (source-paths in older projects, models when it names neither). It never runs dbt, never renders Jinja and never reads profiles.yml or a target, so the links are the same in every environment. A sql member exposes <schema>.<table> and <schema>.<table>.<column> for Postgres, and <database>.<table> and <database>.<table>.<column> for ClickHouse (#3931). The reader turns each enabled source table into a link to the first, and each of its columns into a link to the second.

dbtOutput name part
sources[].schemaThe schema, or for ClickHouse the database, which is how dbt-clickhouse reads a source’s schema. Unset, the source’s name, which is dbt’s own fallback
sources[].databaseNot used. A Postgres output name has no database
sources[].tables[].identifierThe table, when set
sources[].tables[].nameThe table, when identifier is unset
sources[].tables[].columns[].nameThe column

With the postgres dialect, names follow Postgres: an unquoted name folds to lowercase and a quoted one keeps its case. dbt quotes a source’s schema and identifier on Postgres unless quoting: turns it off, in dbt_project.yml, on the source or on the table, and it quotes a column only with quote: true. With clickhouse, every name is kept as written.

A source, table or column whose value is a Jinja template, such as schema: "{{ target.schema }}" or {{ env_var('SCHEMA') }}, is not resolved. The reader reports it as a WSP099 gap at its line and leaves out the links it would state, rather than guess what a target would render. An enabled that is templated is a gap too, and an entry with enabled: false is skipped.

When the sql member marks a column with a -- previously: comment, a source that still names the old column fails with a message that names the new one.

dbt sources often point at views. A sql member exposes a view and its columns as outputs, and when a view’s columns can’t be read statically its outputs are incomplete. A link to such a column is then unresolved (WSP094), not missing.

The same reader exposes each model as an output (#3935): <schema>.<model>, and <schema>.<model>.<column> for each column the model’s YAML lists. Names follow the same case and quoting rules as sources. A model is a .sql file under the project’s model-paths, and its name is the file’s name or its alias. Python models, seeds and snapshots are not read. A model with enabled: false is skipped. alias, schema and enabled come from the first of the model’s own {{ config(...) }}, the config: of its entry in a model YAML, and the + keys of dbt_project.yml that match its directory (the deepest wins). The code is packages/core/src/workspace/dbt-models-reader.ts.

Which schema a model lands in is the hard part, because dbt’s default generate_schema_name joins the target’s schema to a custom one (<target_schema>_<custom>), and a model with no custom schema lands in the target’s schema. Both depend on a target that chant never reads. So the schema is declared first:

CaseResult
fields.modelSchema is setEvery model is <modelSchema>.<model>. dbt’s config is not read for the schema, so a templated +schema is not a gap
Not set, the project overrides generate_schema_name the usual way (the custom schema as it stands, the target’s schema when there is none), and the model sets a custom schema<custom>.<model>
Not set, any other case: the default macro, a model with no custom schema, a macro override chant does not evaluate, or a templated schemaA WSP099 gap at the model’s file, with a hint to set modelSchema. The model is not an output

A templated alias or enabled is a gap in every case. A gap on a model leaves the member’s outputs incomplete, so a link to a model the reader could not name is unresolved (WSP094), not missing. A model that is simply not in the project is missing (WSP093), and the finding lists the outputs the member does have.

{
"pins": [{ "package": "@intentius/chant-lexicon-sql", "version": "<installed version>" }],
"members": [
{ "name": "db", "dir": "db", "kind": "chant" },
{ "name": "analytics", "dir": "analytics", "kind": "dbt", "fields": { "sqlMember": "db" } }
]
}

db is a chant project that declares public.orders with id and customer_id columns through the sql lexicon. The dbt project reads it as a source:

analytics/models/staging/sources.yml
version: 2
sources:
- name: shop
schema: public
tables:
- name: orders
columns:
- name: id
- name: customer_id

chant workspace check resolves three links from analytics to db: public.orders, public.orders.id and public.orders.customer_id. Drop customer_id from the table in db and the check fails with WSP093 at analytics/models/staging/sources.yml:10, the line that names the column.

Set modelSchema on the dbt member, and any other member can link to a model:

{
"members": [
{ "name": "analytics", "dir": "analytics", "kind": "dbt", "fields": { "modelSchema": "analytics" } },
{ "name": "dashboard", "dir": "dashboard", "kind": "other", "because": "reads the orders model", "links": [{ "member": "analytics", "output": "analytics.orders" }] }
]
}

With analytics/models/orders.sql in the project, the link resolves. Delete the file and chant workspace check fails with WSP093 on dashboard’s link.

The sql lexicon ships four kinds for migration directories a team already has (#4400): goose, golang-migrate, clickhouse-migrations and flyway. Each has a probe and a reader that lists the directory’s migrations in the order its tool applies them, with their dialect. A reader parses file names and a few annotations. It never runs the tool or a server, so chant workspace check still starts no process.

KindPrecedenceProbeReader
goose300anyLine: a .sql file with a line starting -- +goose upgoose-dir
golang-migrate300anyFile: ["*.up.sql"]golang-migrate-dir
clickhouse-migrations100anyFile: ["[0-9]*_*.sql"]clickhouse-migrations-dir
flyway300anyFile: ["flyway.toml", "flyway.conf", "V*__*.sql", "R__*.sql"]flyway-dir

The clickhouse-migrations probe is the weakest, because a ClickHouse migration is plain SQL with a numbered name. Its precedence is 100, so a directory that another migration kind also claims goes to that kind. A directory of 1_name.sql files that nothing else claims is clickhouse-migrations, and a member entry can name the kind outright.

The goose, golang-migrate and clickhouse-migrations kinds take a migrationsDir field, the directory under the member’s own that holds the files (default .). Only the member’s own directory is probed, so a member whose files sit in a subdirectory names its kind in its entry.

The dialect field is postgres or clickhouse. goose and golang-migrate get their dialect from a driver or a URL that the directory does not hold, so those members set it. Flyway’s is read from the JDBC URL in flyway.toml or flyway.conf when the field is unset, and is postgres without one. clickhouse-migrations is always ClickHouse and has no field.

Each layout was checked against the tool’s own source or documentation.

KindFilesOrder
goose<version>_<name>.sql directly in the directory. The version is a positive integer before the first _ (NumericComponent, migration.go:363 in pressly/goose). A file needs -- +goose Up, may have a later -- +goose Down, and -- +goose NO TRANSACTION runs it outside a transaction (internal/sqlparser/parser.go, annotations). A .go migration is code, so it is a gapBy version number, so 00002 comes before 00010 and a timestamp version sorts with a sequential one
golang-migrate<version>_<name>.up.<ext> and .down.<ext>, matched by ^([0-9]+)_(.*)\.(down|up)\.(.*)$ (source/parse.go:22 in golang-migrate/migrate; MIGRATIONS.md). The up files are the migrations, each paired with its down fileBy version, a 64-bit unsigned integer
clickhouse-migrations<version>_<name>.sql, with an optional <version>_<name>.down.sql rollback. The Python tool (zifter/clickhouse-migrations) and the Node tool (clickhouse-migrations on npm) both read a numbered file and run it, and both are in ClickHouse’s list of schema migration tools. The Python tool treats 001_a.sql and 1_b.sql as one versionAscending by version as a number
flywayV<version>__<description>.sql, R__<description>.sql, B<version>__... and U<version>__..., with the prefixes, separator and suffixes from the configuration (Flyway migrations). Locations come from flyway.toml or flyway.conf and are read recursively. A Java or Kotlin migration is a gap. Callbacks are not migrationsVersioned and baseline files by version, compared part by part as numbers, then repeatable files by description. An undo file is the down of the versioned file with its version

The Flyway layout code (configuration, locations, placeholders) is packages/core/src/workspace/flyway-layout.ts. It was moved from SQL Yodeler’s src/check/flyway.ts and works on a workspace tree instead of the file system, so the kind and yodel check can share one reader.

A reader returns the list in migrations. Each entry carries its position, version, name, type, file, line, down file and dialect, as KindReadMigration in packages/core/src/workspace/kind-link-readers.ts defines.

What the migrations produce is not in their files. A kind reader is static, so the schema comes from a replay:

Terminal window
chant sql replay db --kind goose --env dev

--env names the sql profile of the empty server to replay into. Statements run in the reader’s order. From a goose file only the Up section runs. A Flyway project runs its versioned files and then its repeatable ones, with placeholders substituted; baseline and undo files do not run. Afterwards the command reads the server’s tables, views and columns and writes them to chant.replay.json beside the migrations, under the output names of #3931, the same ones a sql member exposes. Run it against a throwaway server or an emulator. It refuses a server that already has tables, and it runs the migrations’ SQL.

The file also holds a SHA-256 digest of the migration files it ran, and for Flyway of the configuration file too (migrationDigest in packages/core/src/workspace/migration-dirs.ts). The reader returns the recorded names as the member’s outputs only when the digest still matches the files. A directory with no chant.replay.json, or a changed digest, is a gap flagged as leaving outputs out (withReplay), so a link into the member is unresolved (WSP094), not missing. Replay again to refresh it. In CI, chant sql replay --check replays and exits 1 when the committed file differs. A migration that drops a column then shows up as a missing output (WSP093) on every member that links to it.

{
"pins": [{ "package": "@intentius/chant-lexicon-sql", "version": "<installed version>" }],
"members": [
{ "name": "db", "dir": "db", "kind": "goose", "fields": { "dialect": "postgres" } },
{ "name": "analytics", "dir": "analytics", "kind": "dbt", "fields": { "sqlMember": "db" } }
]
}

Eight kinds cover the files a platform repository holds besides Terraform (#3179). Each is data in the kinds file of the package that knows the substrate. All eight have a graph block, so chant workspace graph draws their members (see below).

KindPackagePrecedenceProbe
argo-app@intentius/chant-lexicon-k8s360a YAML file with apiVersion: argoproj.io/* and kind: Application, ApplicationSet or AppProject
flux-kustomization@intentius/chant-lexicon-k8s350a YAML file with apiVersion: kustomize.toolkit.fluxcd.io/* and kind: Kustomization. kustomize’s own kustomization.yaml uses another apiVersion and isn’t claimed
kustomize@intentius/chant-lexicon-k8s340kustomization.yaml, kustomization.yml or Kustomization
helm-chart@intentius/chant-lexicon-helm330Chart.yaml, which the kind also checks (apiVersion, name, version)
cloudformation@intentius/chant-lexicon-aws320a .yaml, .yml, .json or .template file with AWSTemplateFormatVersion or Resources at its top, or a cloudformation-stacks.json that names deployed stacks. YAML short-form tags such as !Ref are allowed
cdk@intentius/chant-lexicon-aws315cdk.json, which the kind also checks (app)
pulumi@intentius/chant-lexicon-pulumi310Pulumi.yaml, which the kind also checks (name, runtime). The kind was in @intentius/chant-lexicon-terraform until #4453; a workspace that reads Pulumi members pins the pulumi lexicon
manifests@intentius/chant-lexicon-k8s305a YAML file with an apiVersion and a kind, whatever their values. Every kind above outranks it, so a directory with a kustomization.yaml, a Chart.yaml or an Argo CD document goes to that kind

chant workspace init proposes these kinds, and pins the packages, when the packages are installed at the root.

KindWhat the graph holdsNeeds
argo-appan Application, ApplicationSet or AppProject per document, as a node, and an Argo CD cluster Secret cut down to its name and server; with chart sources, the chart and values nodes they namenothing; the manifests are read as data
flux-kustomizationa Flux Kustomization per document, as a nodenothing
manifestsa node per document with an apiVersion and a kind, including custom resources the k8s lexicon has no class for, with its spec at --detail 3. A file that does not parse, or holds {{ ... }} template syntax, is named in the member’s warnings and the other files are still read. A directory that a kustomization.yaml in the workspace lists in resources is left to the kustomize member (coveredBy on meta.k8sMember), so its objects are not drawn twicenothing
cloudformationa node per resource; an edge per Ref, Fn::GetAtt, Fn::Sub reference and DependsOn between resources of the template. With a cloudformation-stacks.json, the same for each deployed stack it names, as belownothing for a template file. Deployed stacks need AWS credentials and a region
kustomizethe objects kustomize build renders, as nodes; with helmCharts, the kustomization, its chart and its values files, read as data. The charts render only with CHANT_K8S_ENABLE_HELM=1, and a chart missing from the chart home is pulled only with CHANT_K8S_FETCH_CHARTS=1 (network); otherwise the member says rendered: false and whykustomize, or kubectl, for the rendered objects; helm for charts
helm-chartthe objects helm template renders, as nodeshelm
cdkthe same as cloudformation, over the templates in the app’s cloud assembly (cdk.out, or the output of cdk.json)an assembly the app already synthesized. chant does not run the app
pulumithe resources of the stack’s pulumi stack export, as nodes: the export the last pulumi-up apply wrote to the index store (refs/chant/snapshots by default, secrets stripped), else the one checked in beside Pulumi.yaml as stack-export.json; an edge per dependencies entry and parent between them. A node’s id is <member>/<qualified type>::<name>, the URN without its stack and project, such as web/aws:s3/bucket:Bucket::assets; a change set or drift record over the same stack uses the same rule (@intentius/chant/pulumi-urn). Provider resources and the root pulumi:pulumi:Stack are left out, and inputs are not copiedan apply through pulumi-up, or an export the member has checked in. The graph read does not run the program or pulumi; the member’s change set and drift run pulumi preview and pulumi refresh --preview-only

A node’s id is <member>/<kind><name>, such as web/deploymentWeb. A member whose render or assembly is missing is still listed, with no nodes, and its graph says why under meta: k8sMember for kustomize (rendered: false), helmMember for helm (rendered: false), awsMember for cdk (synthesized: false), pulumiMember for pulumi (exported: false), each with a reason. A render the tool ran and refused, such as a broken overlay, fails the member with command-failed.

A cloudformation member reads a template in its directory, or a stack another pipeline deployed whose template is not in the repository. For the second form the member’s directory holds a cloudformation-stacks.json:

{ "stacks": ["shared-network"], "region": "eu-west-1" }
FieldValue
stacksOne or more stack names
regionThe stacks’ region. Without it the read uses AWS_REGION, then AWS_DEFAULT_REGION

For each stack the read makes three calls: DescribeStacks, GetTemplate (the processed stage, so the resources a transform adds are in it) and DescribeStackResources. They only read, and need cloudformation:DescribeStacks, cloudformation:GetTemplate and cloudformation:DescribeStackResources for the credentials the AWS CLI’s chain finds. The template goes through the reader a template file uses, so the nodes and edges are the same ones. A directory may hold templates and a cloudformation-stacks.json together, and the nodes of several templates are named <member>/<stack or file>/<LogicalId>. In a node’s attributes, a Ref or Fn::GetAtt that names a resource of the same template names it by that node id, so the member’s lint checks find the resource the reference means; parameters and pseudo parameters keep their names.

meta.awsMember.stacks has one entry per stack: name, region, read, status (the StackStatus), outputs, and resources, each with the node it is drawn as, its logicalId, type, physicalId and status. A stack that cannot be read has read: false and a reason, such as no stack named <name> in <region>, or the AWS error followed by the credentials, calls and region the read needs. The other stacks are still read and the graph does not fail. A cloudformation-stacks.json that is not { "stacks": [...], "region": "..." } is reported in the member’s warnings and the member draws nothing from it.

workspace graph --live reads each node drawn from a named stack from that stack, in the file’s region, by its logical id, whatever --env is. A resource the stack lists is present with its physical id and status; one it does not list is absent. A node from a template file beside the stacks is read from the stack named after the environment, as for a member with no cloudformation-stacks.json.

Several kinds can claim one directory. A chant project that also holds a main.tf passes the probes of chant and terraform. The highest precedence decides.

SituationResult
One kind has the highest precedence among those that claim the directoryThat kind is the directory’s kind. A member declared as another kind fails with WSP007
Two or more claiming kinds share the highest precedenceA tie. The member fails with WSP006, and one of the kinds needs a different precedence
No kind’s probe claims the directoryOnly other fits

The root member "." always holds the workspace’s own declaration, so the workspace kind never claims it.

@intentius/chant-test-utils exports describeWorkspaceKindConformance. It checks the export and the file, runs each kind’s probe over directories you describe, and fails on a tie.

import { describeWorkspaceKindConformance } from "@intentius/chant-test-utils";
describeWorkspaceKindConformance({
packageDir: import.meta.dirname + "/..",
scenarios: [
{ name: "a root module", kind: "terraform", files: { "main.tf": "" }, claims: true },
{ name: "a nested module only", kind: "terraform", files: { "modules/net/main.tf": "" }, claims: false },
],
});

Every kind needs one scenario it claims and one it does not. For a lexicon, chant dev check-lexicon also checks that any ./workspace-kinds subpath holds valid kind data that ships in the package.

chant