SuperAPIAI Directory

arai

github.com · AI agents

Enforces rules from existing agent instruction files (CLAUDE.md, .cursorrules) by blocking prohibited tool calls and logging per-rule compliance verdicts.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

Ārai solves the problem of "AI assistants reading instruction files but violating them anyway." It turns instruction files from suggestions into enforcement: it discovers and extracts rules from files such as CLAUDE.md, AGENTS.md, .cursorrules, classifies them by intent, scans the codebase for context, and then registers native hooks. Rules derived from prohibitive phrasing (never, forbids, must_not) directly block tool calls; advisory rules inject relevant constraints when applicable.

Main capabilities: discover instruction files in the project and home directory; extract imperative-sentence rules using pattern matching; classify rule intent (which actions they govern, which tools they apply to, when they trigger); scan the codebase with tree-sitter to determine directory ownership; track session state (such as whether tests have already been run); and trigger rules only when relevant. It also supports intent classification, code graphs, content sniffing, session awareness, and timing routing, recognizing never/always/don't/must, should/shouldn't, conditional phrasing, and Use X style guidance patterns, with severity levels mapped to Block/Warn/Inform.

Usage: after installation, run arai init to register hooks. In Codex, project hooks must be reviewed and enabled via /hooks; Claude Code requires trusting the workspace first, otherwise hooks in .claude/settings.json will not take effect. A pre-commit hook can be used at the git commit stage to block violating diffs. After modifying instruction files during a session, on hosts without file events you must manually run arai scan.

Support: Claude Code, Grok Build, Codex, and Cursor support PreToolUse hooks, can issue deny, and truly block calls; MCP clients such as Windsurf and Cline only provide agent-facing tools (arai_list_guards, arai_add_guard, arai_check_action, arai_recent_decisions) and do not automatically inject or block. GitHub Copilot currently does not register native hooks, but its instruction files are still read.

Auditing and compliance: local JSONL audit logs are bucketed by day, tamper-proofed with a hash chain, and can be verified with arai audit --verify; it supports arai audit --ship to send to your own collector, --purge retention policies, per-rule compliance determination (Obeyed/Ignored/Unclear), and arai stats --by-rule summaries. It also provides arai test to replay scenarios and arai record to record real triggers as fixtures. The hook hot path has no network, and the telemetry and audit log code paths are separate. Installation paths are verified by SHA-256 by default, with optional cosign and SLSA L3 verification.

Limitations: blocking capability depends on whether the host provides native PreToolUse hooks; Grok's warn/inform injection is best-effort; Codex requires manual hook enablement; on Windows, project state uses the resolved directory path. Ārai itself is not a certification product; it only provides control and an evidence chain.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools