Four features to complete the open-source governance tier:
1. Policy Presets (presets.ts): Built-in rule sets (permissive, safety,
strict, audit-only) users can reference by name. Merge order:
preset defaults → top-level overrides → additional rules appended.
2. Rate Limiting (rate-limiter.ts): Sliding window counters per key
(tool or category). RateLimiter integrated into PolicyEngine —
rate limit rules only match when threshold exceeded within window.
Memory-only, resets on session restart.
3. Audit Query (audit.ts filter()): Filter audit records by tool,
category, status, target pattern (glob), time range (ISO or
relative like "1h"), and limit. CLI: moltbot audit query.
4. Audit Reporter (reporter.ts): Aggregates audit data into tool stats,
category breakdown, policy decisions, error summaries, and
per-minute timeline. Text and JSON output formats.
All wired into index.ts with CLI commands (policy presets, audit query,
audit report) and plugin.json schema updated with preset field.
151 tests pass across 9 test files.
Co-authored-by: dp-web4 <dp@metalinxx.io>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>