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, agent list |
| Shell | completion, version, help |
init
rcas init [dir] [--name <name>] [--id-prefix <prefix>] [--lang ts,python,java,go,other] [--from <path>]
[--agent <tools>|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 and skills for these tools (as agent install --for; AI coding agents) |
--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 ...] [--module <m>]... [--feature <f>]... [--include <glob>]... [--exclude <glob>]... [--changed <ref>]
[--baseline <file>] [--write-baseline <file>] [--min-confidence <0..1>] [--max-files <n>] [--max-hits <n>]
[--format md|json|sarif] [-o <file>] [--derive]Inventories a code base for rule extraction. It reads and never runs code, and skips dependencies
and build output. It reads TypeScript, JavaScript, Python, Java, Kotlin, Scala, Go, C#, Razor, Ruby, PHP, Rust, Swift,
Dart, C and C++, the Angular, Vue and Svelte templates, Drools .drl and DMN files:
| Language | Libraries and frameworks |
|---|---|
| TypeScript, JavaScript | Zod, Joi, Yup, class-validator, ajv, react-hook-form, Angular Validators, NestJS @Roles; conditions in React, Angular, Vue and Svelte templates |
| Python | Pydantic, marshmallow, Django validators, clean() and permissions |
| Java, Kotlin, Scala | Bean Validation, Spring validators, Spring Security, Kotlin require, Jetpack Compose |
| Go | validate: and binding: struct tags, ozzo-validation |
| C#, Razor | data annotations, FluentValidation, ModelState.AddModelError, ASP.NET [Authorize], Blazor conditions |
| Ruby | Rails validates and errors.add, Pundit and CanCanCan |
| PHP | Laravel validation rules and gates |
| Rust | the validator crate, Err(...) and bail! |
| Swift, Dart | SwiftUI .disabled(...), Flutter validators |
| C, C++ | #define and constexpr limits, throw std::invalid_argument |
| Any | rule engines in use (Drools, DMN, json-rules-engine, NRules, Grule ...), checks that throw or raise a validation error, named limits (MAX_QUANTITY = 10, const MaxQuantity = 10), a name compared with a number (amount > 10000), branches on a status (case "GOLD":, when :gold, Tier::Gold =>) |
API schemas (OpenAPI 3, JSON Schema) are listed with their schema names, which derive
turns into rules.
Every hit has file:line, a confidence between 0 and 1, its module (the nearest directory with a build
file: pom.xml, build.gradle, build.sbt, package.json, go.mod, pyproject.toml, Cargo.toml,
*.csproj, composer.json, Gemfile, Package.swift, pubspec.yaml or CMakeLists.txt), its feature
(see analyze.features in rcas.yaml), a fingerprint, and, when the line
compares a name with a number, that name, operator and value.
The report also lists candidates: one name compared with a number in more than one language,
such as Field(le=10) in a Python service and v-if="quantity > 20" in a Vue page, or
[Range(1, 10)] in C# and Validators.max(20) in Angular. A candidate has
drift when the languages share no value. A hit or a candidate whose name a project ruleset
already uses (a params name, or the last segment of a rule's target field) shows that ruleset as
coveredBy. Both are name matches: a hint to check, not a proof.
| Flag | Meaning |
|---|---|
path ... | Directories or files to scan (default: the project). Every path in the report is relative to the project (the directory of rcas.yaml) |
--module | Only this module, by path (backend/order-service) or name (order-service); repeatable |
--feature | Only the globs of analyze.features.<name> in rcas.yaml; repeatable |
--include, --exclude | Glob patterns, relative to the project or to the path given, repeatable; ** matches directories. analyze.include / analyze.exclude of rcas.yaml add to them |
--changed | Only the files changed since the merge base with a git ref, committed or not, and new files git does not ignore: --changed origin/main in a pull request |
--baseline | Leave out the hits recorded in a file written by --write-baseline (default: analyze.baseline when that file exists) |
--write-baseline | Record the fingerprint of every hit found, so later runs show only new hits. A fingerprint is the file, the detector and the code, not the line, so moving code does not make a hit new |
--min-confidence | Leave out hits below this confidence (default 0; RCAS_ANALYZE_MIN_CONFIDENCE, analyze.minConfidence) |
--max-files | Stop after n files (default 20000; RCAS_ANALYZE_MAX_FILES, analyze.maxFiles) |
--max-hits | Stop after n hits (default 5000; RCAS_ANALYZE_MAX_HITS, analyze.maxHits) |
--format | md (default) for people, json for tools, sarif (2.1.0) for GitHub code scanning: every hit is a note, every site of a candidate with drift a warning |
-o | Write the report to a file |
--derive | Propose a ruleset for every schema found (see proposals) |
A flag wins over the environment variable, which wins over rcas.yaml. A hit is a candidate, not a
rule: what it decides is for a person or an agent reading the code.
In a pull request, upload the SARIF report to show new candidates on the changed lines:
- run: npx -y @rules-cascade/cli analyze --changed origin/${{ github.base_ref }} --format sarif -o rcas.sarif
- uses: github/codeql-action/upload-sarif@v4
with: { sarif_file: rcas.sarif, category: rcas-analyze }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] [--hosted] [--list-tools]
[--http <addr> [--allow-origin <origins>] [--no-sse]]Serves the Model Context Protocol. Without --http, on standard input and output: AI coding tools
start it. With --http, as an HTTP server other programs connect to. Every protocol revision from
2024-11-05 to 2026-07-28 is served, on both transports, without sessions. See the tools, the
transports and the safety model in MCP server.
| Flag | Meaning |
|---|---|
--root <dir> | The project (default: the working directory; rcas.yaml is looked up from there) |
--read-only | Leave out propose_ruleset (also mcp.readOnly: true in rcas.yaml) |
--hosted | Serve no project: each tool takes the ruleset files as its files argument and nothing is kept. analyze and the proposal tools are left out. This is what https://mcp.rulescascade.com/mcp runs |
--list-tools | Print the tools and exit |
--http <addr> | Serve over HTTP: Streamable HTTP at /mcp, the deprecated HTTP+SSE transport at /sse, and /health (also /healthz). <addr> is host:port; without a port, $PORT, else 8765; the host defaults to 127.0.0.1 (this machine only) |
--allow-origin <origins> | Browser origins that may call the HTTP server, comma separated, or *. A request without Origin (every non-browser client) is always served; a loopback page may call a loopback server |
--no-sse | Leave out the deprecated HTTP+SSE transport |
RCAS_MCP_TOKEN, when set, makes the HTTP server require Authorization: Bearer <token>.
RCAS_MCP_MAX_BODY_BYTES, RCAS_MCP_MAX_SSE_SESSIONS, RCAS_MCP_MAX_FILES,
RCAS_MCP_READ_TIMEOUT_SECONDS and RCAS_MCP_IDLE_TIMEOUT_SECONDS change the limits (see
Environment variables). A client gets 10 seconds to send the request
headers and 30 to send a body (408 after that); an idle keep-alive connection is closed after 620
seconds, after the idle timeout of common load balancers. Streams are not bound by these timeouts.
mcp install
rcas mcp install <client>...|all [--scope project|user] [--print] [--file] [--command npx|binary] [--url <url>] [--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) |
--url | Register a server reached over HTTP instead of a command: the hosted https://mcp.rulescascade.com/mcp, or a local http://127.0.0.1:8765/mcp |
--name | The server name (default rules-cascade) |
--force | Replace an existing entry of that name that differs |
| Client | Project file | User file |
|---|---|---|
claude | .mcp.json (or claude mcp add when installed) | through claude mcp add -s user |
codex | ~/.codex/config.toml or $CODEX_HOME/config.toml (or codex mcp add) | |
cursor | .cursor/mcp.json | ~/.cursor/mcp.json |
vscode (Copilot agent mode) | .vscode/mcp.json (key servers) | |
copilot-cli | .mcp.json | ~/.copilot/mcp-config.json |
gemini | .gemini/settings.json | ~/.gemini/settings.json |
kiro | .kiro/settings/mcp.json | ~/.kiro/settings/mcp.json |
devin (Devin Desktop and CLI, formerly Windsurf) | .devin/mcp_config.json | ~/.config/devin/mcp_config.json |
windsurf (the earlier file) | ~/.codeium/windsurf/mcp_config.json | |
junie | .junie/mcp/mcp.json | ~/.junie/mcp/mcp.json |
cline | ~/.cline/data/settings/cline_mcp_settings.json | |
opencode | opencode.json (key mcp) | ~/.config/opencode/opencode.json |
kilo | kilo.json (key mcp) | |
factory | .factory/mcp.json | ~/.factory/mcp.json |
amp | .amp/settings.json (key amp.mcpServers; approve with amp mcp approve) | ~/.config/amp/settings.json |
zed | .zed/settings.json (key context_servers) | ~/.config/zed/settings.json |
warp | .warp/.mcp.json | ~/.warp/.mcp.json |
augment | ~/.augment/settings.json | |
amazonq | .amazonq/mcp.json | ~/.aws/amazonq/mcp.json |
muse (Meta Muse Code) | ~/.config/muse/settings.json (key mcp_servers) |
Other settings and servers in the file are kept. A file with comments is not changed: add the printed entry by hand.
With --url, each tool gets the entry its documentation gives for a Streamable HTTP server: type: http
(Claude Code, VS Code, Copilot CLI, Factory, Augment, Amazon Q), type: streamableHttp (Cline),
type: remote (OpenCode, Kilo), httpUrl (Gemini CLI, where url means the older SSE transport),
serverUrl (Devin, Windsurf), url = ... (Codex), or url alone (Cursor, Kiro, Junie, Amp, Zed,
Warp). Muse is not supported with --url. Goose (goose configure) and the GitHub Copilot cloud agent (repository
settings) are configured by hand; --print shows the entry.
agent install
rcas agent install [--for <tools>|all] [--stack ts,python,java,go,other] [--print] [--force] [--dry-run]Writes AGENTS.md (a managed block) and the skills in .agents/skills/, which most tools read as
they are, plus what each chosen tool needs on top, in that tool's own format: instructions scoped to
the rulesets and to the application code of the project's languages, the commands /rcas-capture
and /rcas-review (as commands, prompt files or workflows, or the rules-cascade-capture skill
where a tool has none), and the sub-agents rcas-analyst, rcas-author, rcas-reviewer and
rcas-tester, each limited to the tools its role needs. For example .claude/ for Claude Code,
.github/instructions/, .github/prompts/ and .github/agents/ for Copilot, .gemini/commands/
and .gemini/agents/ for Gemini CLI, .kiro/ for Kiro.
| Flag | Meaning |
|---|---|
--for | The tools: claude, codex, copilot, cursor, gemini, kiro, devin, junie, cline, opencode, factory, amazonq, tabnine, muse, amp, goose, warp, zed, kilo, augment, or all. Default: agents.tools in rcas.yaml, else the tools the project shows signs of |
--stack | The languages whose skills to write. Default: languages in rcas.yaml, else the languages found in the project |
--print | Print every file; write nothing |
--force | Replace files that exist and differ, even without the rcas-managed line |
--dry-run | Say what would be written |
Managed blocks (between rcas:begin and rcas:end) are replaced on every run; the rest of those
files is kept. Other files are refreshed while they carry the line rcas-managed; delete that line
to keep your own edits. The files for each tool, and how to adapt them: AI coding agents.
agent list
rcas agent listEvery tool: whether the project uses it, what agent install writes for it, and what it reads of
AGENTS.md and .agents/skills/; then the languages found and their skills.
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.11 (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.