rcas command reference
rcas is the Rule Cascade command: it checks, compiles and evaluates rulesets, serves the engine protocol to other languages, scaffolds projects, derives rules from API schemas, finds rules in existing code, and serves the Model Context ...
rcas is the Rule Cascade command: it checks, compiles and evaluates rulesets, serves the engine
protocol to other languages, scaffolds projects, derives rules from API schemas, finds rules in
existing code, and serves the Model Context Protocol to AI coding tools. One static binary for Linux,
macOS and Windows (x86-64 and ARM64), and rcas.wasm for any WASI host.
The install scripts and go install also provide it as rule-cascade (its earlier name): the same
binary, which then names itself rule-cascade in its messages. The npm package provides rcas
only, so that npx -y @rules-cascade/cli <command> knows which command to run.
Invocation
rcas [-C <dir>] [--config <rcas.yaml>] [--no-color] <command> [arguments]
rcas help <command> rcas <command> --helpFlags may come before or after file arguments, --flag=value works, and -- ends the flags.
Global options
| Option | Effect |
|---|---|
-C <dir> | Run as if started in dir: relative paths and the project file are resolved from there |
--config <file> | The project file to use, instead of looking for rcas.yaml (also RCAS_CONFIG) |
--no-color | Accepted for scripts that pass it; rcas prints no colour |
-h, --help | Help for rcas or a command |
-V, --version | The version |
The project file is the first rcas.yaml, rcas.yml or rcas.json found in the working directory or
above it. Its format is in project configuration; every environment variable is
in environment variables.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Problems found: a ruleset that does not load, a failing golden test, a stale file with --check, a refused proposal, a failed write |
| 2 | Usage: an unknown command or flag, a missing argument |
| 3 | Configuration: rcas.yaml is invalid |
Command map
| Group | Commands |
|---|---|
| Project | init, doctor |
| Rules | check, test, compile, manifest |
| Evaluate | evaluate, engine |
| From existing code | analyze, derive, proposals |
| AI coding tools | mcp, mcp install, agent install |
| Shell | completion, version, help |
init
rcas init [dir] [--name <name>] [--id-prefix <prefix>] [--lang ts,python,java,go,other] [--from <path>]
[--agent claude,codex,cursor,copilot,gemini|all] [--mcp <client>|all] [--ci github|none] [--force] [--dry-run]| Flag | Meaning |
|---|---|
dir | Where to create the project (default: the current directory) |
--name | The project name (default: the directory name) |
--id-prefix | The prefix of ruleset ids: dot-separated lower-case segments, e.g. acme.payments (default: from the name) |
--lang | Languages that load the rules: ts, python, java, go, other |
--from | Analyze an existing code base and propose a ruleset for every API schema found |
--agent | Also write agent instructions for these tools (as agent install --for) |
--mcp | Also register the MCP server with these tools (as mcp install) |
--ci | github writes .github/workflows/rules.yml (the default inside a git repository); none does not |
--force | Replace files that exist and differ |
--dry-run | Print what would be written; write nothing |
What gets created:
| File | Purpose |
|---|---|
rcas.yaml | The project configuration |
rules/example.ruleset.yaml | A first ruleset with two rules, a parameter, messages and golden tests; it passes check |
rules/order.schema.json | The JSON Schema of the example's entity |
rules/LOADING.md | How each chosen language loads the compiled bundle |
.rcas/.gitignore | Keeps proposals and reports out of version control (and .rcas/ is added to .gitignore) |
.github/workflows/rules.yml | CI: check and compile --all with npx -y @rules-cascade/cli |
rcas init --name "Acme Payments" --lang ts,java --agent all --mcp claudecheck and test
rcas check [file|dir]... [--json]
rcas test [file|dir]... [--json]For each ruleset: validates it against the schema, loads it (inheritance, override policies, the
static checks of the specification), reports YAML and numbers that are not portable, checks OpenAPI
bindings, and runs its golden tests with the conformance operators. Without arguments, every ruleset
under rules.dir of rcas.yaml; a directory means every *.ruleset.* file under it.
| Flag | Meaning |
|---|---|
--json | One report per file: id, version, checksum, rule counts, problems, failed tests |
$ rcas check
acme.payments.example@0.1.0 sha256:ebacd52bdbea... 2 rules (2 client-safe), 1 params
3 golden tests, 0 failedExit status 1 when any file has a problem or a failing test.
compile
rcas compile <file> [-o out.bundle.json]
rcas compile --all [-o <dir>]Compiles a ruleset into a bundle: plain JSON, checksummed, loaded by every runtime without YAML or
schema validation. With --all, every ruleset of the project into output.dir (default
build/rules) as <id>.bundle.json, and <id>.<channel>.manifest.json for each channel in
output.manifests. A bundle holds server-only rules: deploy it to backends, never to browsers.
manifest
rcas manifest <ruleset-or-bundle> | --bundle <bundle.json> | --manifest <manifest.json> [--channel client|server] [-o out.manifest.json]Prints or writes one manifest. The default channel is client (what a browser or app may receive),
or the channel of the manifest given.
evaluate
rcas evaluate --bundle <bundle.json> | --manifest <manifest.json> [--channel server|client] [--conformance-operators] [request.json|-]Evaluates one request, read from a file or standard input (-, the default), and prints the result:
decision, findings, effects, commands. The default channel is the server's.
echo '{"entity":"Order","operation":"create","data":{"quantity":11}}' | rcas evaluate --bundle build/rules/acme.payments.example.bundle.json -engine
rcas engine [--conformance-operators]Serves the engine protocol of specification section 13
on standard input and output: one JSON request per line, one JSON response per line. This is how a
language without a native runtime (C#, Rust, PHP, Ruby, Swift, C++ ...) evaluates: start it once as a
child process. --conformance-operators registers the operators the conformance suite uses.
analyze
rcas analyze [path] [--format md|json] [-o <file>] [--derive] [--include <glob>]... [--exclude <glob>]... [--max-files <n>]Inventories a code base for rule extraction: API schemas (OpenAPI 3, JSON Schema) with their schema
names, and decisions in code with file:line: Zod, Joi, Yup, class-validator, Pydantic, marshmallow,
Django validators, Bean Validation, Spring validators, Go validate: tags, ozzo-validation,
FluentValidation, data annotations, Rails, Laravel, the Rust validator crate, rule engines in use,
and hand-written checks that throw or return a validation error. It reads and never runs code, and
skips dependencies and build output.
| Flag | Meaning |
|---|---|
--format | md (default) for people, json for tools |
-o | Write the report to a file |
--derive | Propose a ruleset for every schema found (see proposals) |
--include, --exclude | Glob patterns relative to path, repeatable; ** matches directories. analyze.include / analyze.exclude of rcas.yaml add to them |
--max-files | Stop after n files (default 20000) |
A hit is a candidate, not a rule: what it decides is for a person or an agent reading the code.
derive
rcas derive <openapi.yaml|schema.json> --id <ruleset.id> [--schema <Name> | --pointer </$defs/X>] [--entity <Name>]
[--scope level:id]... [--version <v>] [--title <t>] [--tests <file>] [--codes-from <file>] [-o <file>] [--check] [--propose]Builds a validation ruleset from the constraints of a schema: required members, types, enums, lengths, patterns, ranges, item counts. What cannot be expressed is listed on standard error, not guessed. The output is deterministic and identical to the reference implementation.
| Flag | Meaning |
|---|---|
--schema | OpenAPI: the component schema |
--pointer | JSON Schema: a JSON pointer to the entity schema (/$defs/Order); required for a JSON Schema |
--id | The ruleset id (required) |
--entity | The entity name (default: the schema name) |
--scope | level:id pairs, comma-separated or repeated |
--version, --title | Of the ruleset (default 1.0.0, and a title naming the schema) |
--tests | A file of golden tests to attach |
--codes-from | An earlier derivation, whose rules keep their finding codes |
-o | Write the ruleset (default: standard output); the entity's $ref is relative to it |
--check | Fail when the file given by -o is stale (for CI) |
--propose | Store it as a proposal instead of writing it |
Details of the mapping: OpenAPI.
proposals
rcas proposals list [--status pending|invalid|accepted|rejected] [--json]
rcas proposals show <id> [--diff] [--json]
rcas proposals accept <id> [--force]
rcas proposals reject <id> [--reason <text>]A proposal is one or more ruleset files that an AI agent (through rcas mcp) or
derive --propose / analyze --derive suggested. It waits in .rcas/proposals/ with its rationale,
its sources and the problems check found. A proposal holds only ruleset and schema files
(*.ruleset.yaml, .yml, .json, *.schema.json) under the rules directory. accept writes the
files into the project; it refuses
when a target file changed after the proposal was made, or when the proposal does not pass check
(invalid); --force overrides both. Accepting is the only way a proposal reaches the rules.
mcp
rcas mcp [--root <dir>] [--read-only] [--list-tools]Serves the Model Context Protocol on standard input and output. AI coding tools start it; see the tools and the safety model in MCP server.
mcp install
rcas mcp install <claude|codex|cursor|windsurf|gemini|vscode|all>... [--scope project|user] [--print] [--file]
[--command npx|binary] [--name <name>] [--force]| Flag | Meaning |
|---|---|
--scope | project (committed, shared; the default where the tool has a project file) or user |
--print | Print each configuration and the equivalent command; change nothing |
--file | Write the file even when the tool's own command (claude mcp add, codex mcp add) is available |
--command | npx (default: npx -y @rules-cascade/cli mcp, works for everyone) or binary (this binary's path) |
--name | The server name (default rules-cascade) |
--force | Replace an existing entry of that name that differs |
| Client | File |
|---|---|
claude | .mcp.json (project), via claude mcp add when installed |
codex | ~/.codex/config.toml or $CODEX_HOME/config.toml, via codex mcp add when installed |
cursor | .cursor/mcp.json; user scope ~/.cursor/mcp.json |
windsurf | ~/.codeium/windsurf/mcp_config.json |
gemini | .gemini/settings.json; user scope ~/.gemini/settings.json |
vscode | .vscode/mcp.json |
Other settings and servers in the file are kept. A file with comments is not changed: add the printed entry by hand.
agent install
rcas agent install [--for claude,codex,cursor,copilot,gemini|all] [--print] [--force] [--dry-run]| File | For |
|---|---|
AGENTS.md | every tool: a managed block with the code-to-rules workflow and the engineering rules |
CLAUDE.md, .claude/agents/rcas-{analyst,author,reviewer,tester}.md, .claude/skills/rules-cascade/SKILL.md | Claude Code |
.agents/skills/rules-cascade/SKILL.md | Codex |
.cursor/rules/rules-cascade.mdc | Cursor |
.github/copilot-instructions.md | GitHub Copilot |
GEMINI.md | Gemini CLI |
Managed blocks (between rcas:begin and rcas:end) are replaced on every run; the rest of those
files is kept. Other files are written when missing, or with --force.
doctor
rcas doctor [--json]Checks the command (version, PATH, a newer release unless RCAS_NO_NETWORK is set), the project
(rcas.yaml, every ruleset passes check, .rcas/ ignored, proposals waiting), the MCP configuration
of every AI tool it knows, and the agent instructions. Exit status 1 when a check fails; warnings do
not fail.
completion
rcas completion bash|zsh|fish|powershell| Shell | Install |
|---|---|
| bash | rcas completion bash > ~/.local/share/bash-completion/completions/rcas |
| zsh | rcas completion zsh > "${fpath[1]}/_rcas" |
| fish | rcas completion fish > ~/.config/fish/completions/rcas.fish |
| PowerShell | rcas completion powershell | Out-String | Invoke-Expression (add it to $PROFILE) |
version
rcas version [--json]$ rcas version
rcas 1.0.0-alpha.5 (specification 1.0.0, bundle format 1.0.0)Other languages
The same two evaluations from Python, Node.js, Ruby, PHP, Java, shell, Rust, C# and PowerShell through the command, and from Node.js and Python through the WebAssembly module.
Project configuration (rcas.yaml)
rcas.yaml tells the rcas command where a project keeps its rules and what to do with them. rcas init writes one.