Skip to content

Add bd rules audit + compact commands#2810

Open
anupamchugh wants to merge 1 commit intosteveyegge:mainfrom
anupamchugh:feat/rules-audit-v2
Open

Add bd rules audit + compact commands#2810
anupamchugh wants to merge 1 commit intosteveyegge:mainfrom
anupamchugh:feat/rules-audit-v2

Conversation

@anupamchugh
Copy link

Summary

  • Adds bd rules audit — scans .claude/rules/*.md for contradictions, near-duplicates, and merge opportunities using Jaccard similarity, antonym detection, and scope analysis
  • Adds bd rules compact — merges related rules into composites (manual --group or --auto mode, with --dry-run)
  • Adds CheckReadonly guard to compact for consistency with other write commands
  • 20 tests, no new dependencies (stdlib + cobra only)
  • Design doc at docs/RULES_AUDIT_DESIGN.md

Context

Resubmission of #1625, which was closed pending the Dolt-native work (now landed in v0.62.0). This PR is rebased cleanly on current main — exactly 3 new files, zero modifications to existing files.

The commands are filesystem-only (no Dolt storage dependency). They address a real pain point: projects with 40+ rule files accumulate contradictions and duplicates that waste tokens on every Claude session.

Test plan

  • go build ./cmd/bd/ succeeds
  • go test -v -run TestRules ./cmd/bd/ — all 20 tests pass
  • PR diff shows exactly 3 new files, no existing files modified

🤖 Generated with Claude Code

Filesystem-only tooling to detect contradictions, near-duplicates,
and merge opportunities in .claude/rules/*.md files.

- `bd rules audit` scans rules for contradictions and merge candidates
  using Jaccard similarity, antonym detection, and scope analysis
- `bd rules compact` merges related rules into composites (manual or auto)
- 20 tests, no new dependencies (stdlib + cobra only)
- CheckReadonly guard on compact for consistency with other write commands

Resubmission of steveyegge#1625, rebased cleanly on current main.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant