Commit db71e70
committed
feat: cheap Rust audit + mmctl audit, gate tick on real issues
src/audit.rs (new, 8 unit tests passing)
- AuditReport with deterministic checks: missing frontmatter, invalid
metadata.type, dangling MEMORY.md entries, files not in index,
broken [[wikilinks]], feedback/project entries missing Why/How,
duplicate descriptions, MEMORY.md >200 lines.
- run_audit(memory_root) is sub-millisecond on realistic input.
src/tick.rs
- Runs audit::run_audit BEFORE deciding to spawn claude.
- If total_issues == 0 → skip the spawn, log "audit clean — files=N ...",
save ~30-80k tokens and ~30-60s wallclock per tick.
- When the tick does run, the agent receives the audit JSON in the
prompt so it never re-scans the directory.
cmmd audit / mmctl audit
- New subcommands. Sub-second, no claude call, no quota cost.
- --json for machine-readable output.
- On real ~/.claude/projects/-home-deadpool/memory/ today: 4 issues
(3 broken wikilinks, 1 feedback missing Why/How).
Verified
- cargo test --lib: 20/20 passing (8 new audit tests + 12 existing)
- cargo clippy --bins -- -D warnings: clean
- cmmd audit against test-fixtures/memory: catches missing
frontmatter + dangling MEMORY.md entry as expected1 parent 5fafd1d commit db71e70
6 files changed
Lines changed: 575 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments