feat(rules,guard): compile machine-readable note rules into deterministic PreToolUse checks (#240) - #251
Conversation
…stic PreToolUse checks (#240) New omind.rules module: fenced omind-rule YAML blocks in vault notes parse (per-file mtime/size cache, invalid blocks breadcrumbed) into deny/warn checks evaluated in check_action before everything else. v1 conditions: repo_visibility (gh, 24h cache, fail-open on unknown) and branch; except_repos matches the origin repo name. omind rules list prints the compiled table. One seed rule (public main/master push); repo deletion was already covered by policy.SEED_RULES. Closes #240 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 3 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| try: | ||
| path.parent.mkdir(parents=True, exist_ok=True) | ||
| paths.atomic_write_text(path, json.dumps(cache) + "\n", mode=0o600) | ||
| except OSError: |
Implements #240: every rule a hook can decide never depends on model attention.
src/omind/rules.py: parser (PyYAML, already a dep), per-file(mtime_ns, size)cache,evaluate()with tool + glob match,when.repo_visibility/when.branch,except_repos; visibility viagh repo viewwith a 24h on-disk cache and fail-open UNKNOWN (logged, never denied).guard.check_actionahead ofdecide(); denies log through the existing compliance path asnote-rule:<id>, warns/unknowns log decision events without blocking; the whole layer never raises.omind rules listCLI; README section; seed rule for the public-main-push incident class (note rules replace seeds by id so per-repo exceptions live in the vault). Repo-deletion was already a policy seed.rules.py(cold-start safe, likepolicy.SEED_RULES) rather than provisioned vault notes;warnlogs a compliance decision instead of injecting context (the PreToolUse bash adapter has no allow-with-context channel).9 new tests; 966 passed; ruff clean. Version 8.6.0.
Closes #240
🤖 Generated with Claude Code