Quickstart · v0.10.2
See RuleOak decide before execution
Run the safe local demo first, then put RuleOak in front of one real supported process or tool boundary.
1. Run the 60-second demo
npx @ruleoak/cli@latest demo quickstartThe demo makes no destructive or external calls. It shows ALLOW, NEEDS_APPROVAL, and DENY, then writes local evidence and an offline HTML report under .ruleoak-demo-output/.
2. Protect an existing Node.js process
npx @ruleoak/cli@latest protect -- node agent.jsRuleOak can initialize a conservative workspace, recommend a policy pack, run diagnostics, intercept supported stdio/JSON-RPC tool calls, surface approvals, consume one-time grants, and write evidence.
protect does not inspect arbitrary subprocess internals. The process must communicate through a supported guarded boundary, such as MCP/JSON-RPC stdio or an explicit SDK integration.
ruleoak protect --learn -- node agent.js
ruleoak protect --approval-mode prompt -- node agent.js
ruleoak protect --policy-pack mcp-server-safe -- node mcp-server.js3. Inspect the local workspace
ruleoak doctor
ruleoak workspace status
ruleoak policy lint
ruleoak replay --verify4. Review approvals and policy suggestions
ruleoak approve
ruleoak approve inbox
ruleoak learn summary
ruleoak learn reviewPersistent approval choices and learning mode can produce reviewable suggestions. They do not silently broaden active policy.
5. Add the Node.js SDK
npx @ruleoak/cli@latest init --dir . --policy-pack cautious
npm install @ruleoak/coreimport { readFile } from 'node:fs/promises'
import { createRuleOak } from '@ruleoak/core'
const ruleoak = await createRuleOak({ workspace: '.' })
const guardedRead = ruleoak.guardFunction({
name: 'filesystem.read',
category: 'file',
operation: 'read',
resource: ([path]) => path,
scope: 'local',
sensitivity: 'public',
execute: readFile
})
console.log(await guardedRead('./README.md', 'utf8'))The executor is called only after RuleOak allows the action and, in execution-aware flows, after the one-time grant is consumed.
6. Choose another supported integration path
| Need | Start here |
|---|---|
| MCP stdio | ruleoak mcp wrap -- <server> |
| MCP Streamable HTTP | ruleoak mcp http --upstream <url> |
| Local authorization service | ruleoak serve --listen 127.0.0.1:7331 |
| Verifiable evidence bundle | ruleoak audit bundle and ruleoak audit verify-bundle |
| Policy authoring | ruleoak policy author, lint, testing, migration, and Policy v2 |
Before production-like use
Read the security boundary, test deny behavior, confirm every high-impact execution path actually passes through RuleOak, and check the compatibility matrix for the transport/runtime you plan to use.
