Ordo
CLAUDE.md41 starsChanged 10 months agoMITView on GitHub
Ordo is an internal infrastructure service — it serves business-side applications within trusted networks, not public internet traffic. Design decisions should reflect this: Run ./scripts/setup-hooks.sh once after cloning to enable the pre-commit hook that auto-runs cargo fmt. Ordo is a high-performance rule engine. The Rust backend and TypeScript frontend are two separate subsystems in one monorepo. ordo-core — The rule engine library. All other crates depend on this. - rule/model.rs — RuleSet and RuleSetConfig (the top-level rule container) - rule/step.rs…
- Installs packages
In this repository6 other files it gives its agents.
- ordo-editor-componentSkill
- ordo-expression-syntaxSkill
- ordo-jit-optimizationSkill
- ordo-rule-developmentSkill
- ordo-server-deploymentSkill
- ordo-testingSkill
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Keep it lean: Don't over-engineer for hypothetical threats on the public internet.
- Very specific: line 76
Run ./scripts/setup-hooks.sh once after cloning to enable the pre-commit hook that auto-runs cargo fmt.
- Very specific: line 129
Important: Always call RuleSet::from_json_compiled() / from_yaml_compiled() (or ruleset.compile()) after loading, to pre-parse all …
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Design Philosophy
Ordo is an internal infrastructure service — it serves business-side applications within trusted networks, not public internet traffic. Design decisions should reflect this:
- Speed and efficiency first. Sub-microsecond latency is a core value. Avoid adding overhead (middleware layers, serialization steps, runtime checks) unless the gain clearly justifies the cost. When in doubt, benchmark.
- Keep it lean. Don't over-engineer for hypothetical threats on the public internet. Auth, TLS, and tenant isolation should be available but not mandatory — trust the deployment environment.
- Developer experience for business teams. SDK ergonomics, clear error messages, and low integration friction matter more than exhaustive admin UI features.
- Stability over features. A crash or silent data corruption is worse than a missing feature. Prioritize graceful degradation, proper shutdown, and execution correctness.
Commands
Rust (Backend)
# Build
cargo build
cargo build --release
# Run tests (all crates)
cargo test
# Run tests for a specific crate
cargo test -p ordo-core
cargo test -p ordo-server
# Run a single test
cargo test -p ordo-core test_full_workflow
cargo test -p ordo-core -- test_ruleset_validation
# Lint
cargo clippy -- -D warnings
# Format (enforced by pre-commit hook)
cargo fmt
# Run the server
cargo run -p ordo-server -- --rules-dir ./rules
# Run benchmarks
cargo bench -p ordo-coreFrontend (ordo-editor)
cd ordo-editor
# Install dependencies
pnpm install
# Run playground (dev server)
pnpm dev
# Build all packages
pnpm build
# Build individual packages (must build in order: core → vue/react)
pnpm build:core
pnpm build:vue
pnpm build:react
# Lint / typecheck
pnpm lint
pnpm typecheck
# Tests
pnpm testGit Hooks
Run ./scripts/setup-hooks.sh once after cloning to enable the pre-commit hook that auto-runs cargo fmt.
Architecture
Ordo is a high-performance rule engine. The Rust backend and TypeScript frontend are two separate subsystems in one monorepo.
Rust Workspace (crates/)
ordo-core — The rule engine library. All other crates depend on this.
rule/model.rs—RuleSetandRuleSetConfig(the top-level rule container)rule/step.rs—Step,StepKind(Decision / Action / Terminal),Branch,Condition,TerminalResultrule/executor.rs—RuleExecutor: walks the step graph against a JSON inputValuerule/compiled.rs/rule/compiler.rs/rule/compiled_executor.rs— Binary.ordoformat for protecting rule logic (MAGIC headerORDO, CRC32 integrity, optional ED25519 signature)expr/— Expression pipeline:parser.rs→ AST (ast.rs) →optimizer.rs→ bytecodecompiler.rs+vm.rs→ optional Cranelift JIT (jit/)context/—Value(JSON-compatible),Context,Schemasignature/— ED25519 sign/verify for rule files (feature-gated)trace/—ExecutionTrace/StepTracefor step-by-step debugging
Features: default = ["derive", "jit", "signature"]. JIT is not available on wasm32.
ordo-derive — Proc-macro crate. Provides #[derive(TypedContext)] which generates the typed schema needed by the JIT compiler.
ordo-proto — gRPC protobuf definitions (via tonic/prost). Defines OrdoService with Execute, BatchExecute, Eval, ListRuleSets, GetRuleSet, Health.
ordo-server — Binary that exposes all three transports simultaneously:
- HTTP REST (Axum, default
:8080) — full CRUD for rulesets, execute, batch execute, version management, tenant management, Prometheus metrics at/metrics - gRPC (Tonic, default
:50051) — multi-tenancy viax-tenant-idmetadata, batch execute, max 1000 items per batch - Unix Domain Socket (gRPC-over-UDS, Unix only, opt-in via
--uds-path)
Key server modules:
config.rs—ServerConfig(Clap + env vars, all prefixedORDO_*)store.rs—RuleStore: in-memory (DashMap) or file-backed (.json/.yaml/.yml), with version historytenant.rs—TenantManager/TenantStore: per-tenant QPS limits, burst limits, timeoutsaudit.rs— JSON Lines audit log with configurable sampling ratetelemetry.rs— Tracing subscriber init + optional OTLP export (ORDO_OTLP_ENDPOINT)middleware/tenant.rs— Extracts tenant fromX-Tenant-IDHTTP headerdebug/— Debug API (SSE session streaming, inline execution, VM trace dump); only mounted when--debug-modeis active
ordo-wasm — WebAssembly bindings for running the engine in browsers (used by the visual editor playground).
Rule Execution Model
A RuleSet is a directed graph of Steps with a single entry step:
- Decision step: evaluates ordered
Branchconditions, jumps to the first matchingnext_step, falls through todefault_next - Action step: mutates context fields, then jumps to
next_step - Terminal step: produces the final
ExecutionResult(code, message, outputs)
Expression evaluation pipeline (per condition string):
ExprParserparses toExprASTExprOptimizerconstant-folds and eliminates dead branchesExprCompilercompiles to register-based bytecode (CompiledExpr)BytecodeVMexecutes at runtime — or the Cranelift JIT emits native code for hot numeric expressions
Important: Always call RuleSet::from_json_compiled() / from_yaml_compiled() (or ruleset.compile()) after loading, to pre-parse all expressions. Using from_json() leaves expressions as raw strings that are re-parsed on every execution.
Frontend (ordo-editor/)
pnpm workspace with two apps and four packages:
packages/core(@ordo-engine/editor-core) — Framework-agnostic rule editor logicpackages/vue(@ordo-engine/editor-vue) — Vue 3 componentspackages/react(@ordo-engine/editor-react) — React componentspackages/wasm(@ordo-engine/wasm) — WASM bindings (wrapsordo-wasm)apps/playground— Live demo appapps/docs— VitePress documentation site
Build order matters: core must be built before vue/react.
Multi-tenancy
Enabled with --multi-tenancy-enabled. Tenant is identified by:
- HTTP:
X-Tenant-IDheader (extracted bymiddleware/tenant.rs) - gRPC:
x-tenant-idmetadata key
With persistence enabled (--rules-dir), tenant rules are stored under <rules-dir>/tenants/<tenant-id>/. Tenant configs (QPS, burst, timeout) are stored separately under --tenants-dir (defaults to <rules-dir>/tenants.json).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

