Rule Cascade
Reference

Environment variables

Every variable Rule Cascade reads: the rcas command, its installers and npm package, the rule server, and the examples.

Every variable Rule Cascade reads: the rcas command, its installers and npm package, the rule server, and the examples. The libraries (TypeScript, Python, Java, Go) and the evaluation engines read only the cache sizes below, which change speed and memory, never a result: what a rule sees comes only from the request.

VariableUsed byMeaning
RCAS_CONFIGrcasthe project file to use instead of looking for rcas.yaml upwards from the working directory (the same as --config)
RCAS_RULES_DIR, RCAS_OUT_DIRrcasoverride rules.dir and output.dir of rcas.yaml (defaults rules, build/rules)
RCAS_NO_NETWORKrcas doctorany value: skip the check for a newer release at rulescascade.com/download/latest/VERSION
RCAS_MCP_TOKENrcas mcp --httpwhen set, every HTTP request must send Authorization: Bearer <token>; never put it on the command line
RCAS_MCP_MAX_BODY_BYTESrcas mcp --httpthe largest request body, in bytes (default 4194304); larger requests get 413
RCAS_MCP_MAX_SSE_SESSIONSrcas mcp --httpthe most open streams of the deprecated HTTP+SSE transport (default 256); more get 503
RCAS_MCP_READ_TIMEOUT_SECONDSrcas mcp --httpthe longest a client may take to send a request body (default 30); a slower one gets 408. Streams are not affected
RCAS_MCP_IDLE_TIMEOUT_SECONDSrcas mcp --httpclose an idle keep-alive connection after this long (default 620, after the 600 s idle timeout of Google Cloud load balancers and the 60 s of AWS); keep it above the idle timeout of whatever is in front
RCAS_MCP_MAX_FILESrcas mcp --hostedthe most files one tool call may send (default 256)
PORTrcas mcp --httpthe port when --http names only a host (set by Cloud Run and similar platforms; default 8765)
RCAS_PROGRAM_NAMErcas, Windows installerrcas or rule-cascade: the name the command calls itself; the Windows rule-cascade.cmd shim sets it
CODEX_HOMErcas mcp install, rcas doctorwhere Codex keeps config.toml (default ~/.codex)
HTTPS_PROXY, HTTP_PROXY, NO_PROXYinstallers, rcas doctorproxy for downloads and the version check
RCAS_VERSIONinstallersversion to install (default: the latest release)
RCAS_INSTALL_DIRinstallerswhere to put rcas (default ~/.local/bin; %LOCALAPPDATA%\Programs\rcas on Windows)
RCAS_VERIFYinstallerscosign: also verify the Sigstore signatures
RCAS_DOWNLOAD_BASEinstallersa mirror of the download directory (default https://rulescascade.com/download)
RCAS_BINARY_PATHnpm package @rules-cascade/clirun this binary instead of the one from the platform package (development, air-gapped machines)
RULES_DIRrule serverdirectory of the rulesets to serve (default ./rules)
PORTrule server, backend exampleslisten port (default 8080); the rule server accepts 0 to 65535
RULE_SERVER_TOKENrule serverbearer token for evaluations, the server manifest and bundles; required
RULE_SERVER_ALLOW_OPENrule server1 or true: start without a token and serve every endpoint openly (private networks, development)
DRAIN_SECONDSrule servertime between "not ready" and shutdown on SIGTERM, in whole seconds (default 5)
RULE_SERVER_MAX_BODY_BYTESrule serverlargest accepted request body; a larger one is answered 413 (default 1048576, 1 MiB)
RULE_SERVER_KEEP_ALIVE_TIMEOUT_MSrule serverclose an idle keep-alive connection after this long (default 65000); keep it above the idle timeout of the load balancer in front, or it answers an occasional 502; at least 1
RULE_SERVER_HEADERS_TIMEOUT_MSrule serverlongest time to receive the request headers (default 66000); longer than the keep-alive timeout and no longer than the request timeout
RULE_SERVER_REQUEST_TIMEOUT_MSrule serverlongest time to receive a whole request, body included (default 120000); 0 for no limit
RULES_REFRESH, RULES_REFRESH_INTERVAL, RULES_REFRESH_CRON, RULES_REFRESH_TZrule serverreload rules manually (SIGHUP), every interval (30s, 5m), or on a cron schedule in a time zone (default UTC); see caching
RULE_SERVER_WORKERSrule serverevaluate on this many worker threads; 0 (default) on the event loop
RULE_EVALUATION_TIMEOUT_MSrule serverwith workers: answer 503 and replace the worker after this long (default 5000)
RULE_SERVER_CORS_ORIGINSrule servercomma-separated browser origins (https://app.example.com), or *, allowed to read the ruleset list, client manifests and rule details from another site (default none); see caching
RULE_SERVER_CORS_MAX_AGErule serverseconds a browser may keep a CORS preflight answer (default 600)
RULE_SERVER_REQUEST_LOGrule serveron (default) or off: one JSON log line per request; turn it off when the platform in front already logs requests (about 13 % more requests per second in the load test)
RULE_SERVER_MAX_QUEUErule serverwith workers: evaluations waiting for a worker beyond this many are answered 503 with Retry-After: 1 (default 256 per worker). The rule server checks every number it reads at start-up: a value that is not a whole number in range, an empty one included, or timeouts that contradict each other, make it exit 1 with a fatal line that names the variable
RULE_CASCADE_ENGINEengine-client examplesthe command the examples start for the engine protocol (default rule-cascade on PATH, which rcas installs)
RULE_CASCADE_WASMengine-client examplesthe WebAssembly module (default rcas.wasm)
RULES_BUNDLEbackend examplesthe compiled bundle to load
RULE_CASCADE_SELECTION_CACHE_SIZETypeScript runtime, rule serverhow many rule selections (the rules of an entity and an operation) a ruleset keeps per channel (default 256); a whole number, 0 or more, and 0 turns the cache off. Entities and operations no rule names share one entry, so requests cannot fill it. The selectionCacheSize load option wins over it. Any other value, an empty one included, makes loading a ruleset fail, and the rule server exits at start-up, with an error that names the variable but not its value; an engine answers LOAD_FAILED as below
RULE_CASCADE_PATTERN_CACHE_SIZEGo, Java, Python and TypeScript runtimes, rule serverhow many compiled matches patterns the process keeps (default 2048); a whole number, 0 or more, and 0 turns the cache off. Read once, on first use; the runtime's setter wins over it (Go SetPatternCacheSize; Java Expressions.setPatternCacheSize, then the system property rulecascade.patternCacheSize; Python set_pattern_cache_size; TypeScript setPatternCacheSize). Any other value, or one longer than 19 digits, makes loading refuse every ruleset with an error that names the variable but not its value; an engine answers LOAD_FAILED as below
RULE_CASCADE_PATH_CACHE_SIZEJava and TypeScript runtimes, rule serverhow many variable paths the process keeps split (default 4096); a whole number, 0 or more, and 0 turns the cache off. Read once; the runtime's setter wins over it (Java Expressions.setPathCacheSize, then the system property rulecascade.pathCacheSize; TypeScript setPathCacheSize). Any other value makes loading a ruleset fail (the rule server exits at start-up; an engine answers LOAD_FAILED as below) with an error that names the variable but not its value
RULE_CASCADE_MAX_CACHED_PATH_LENGTHJava and TypeScript runtimes, rule serverthe longest variable path, in UTF-16 code units, kept in the path cache (default 256); longer paths are evaluated but never kept, and 0 keeps none. Read once; the runtime's setter wins over it (Java Expressions.setMaxCachedPathLength, then the system property rulecascade.maxCachedPathLength; TypeScript setMaxCachedPathLength). Invalid values are refused as above

An engine (rcas engine, rule-cascade-node engine, python -m rule_cascade engine, the Java Main engine and the WebAssembly module) whose cache setting is not valid keeps running. It answers version, answers a malformed request with BAD_REQUEST as usual, and answers every other request with LOAD_FAILED and an empty problems list, naming the setting but never its value (specification section 13). The WebAssembly host run.mjs passes the RULE_CASCADE_* variables on to the module and no others.