You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+83-6Lines changed: 83 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -396,6 +396,42 @@ Your repository's own `.gitignore` is never touched.
396
396
397
397
## Your team's standards
398
398
399
+
Everything lives in `.diffmind/`, committed to your repo:
400
+
401
+
```
402
+
.diffmind/
403
+
├── config.toml # settings — model, base branch, gate thresholds
404
+
├── rules.toml # regex rules: free, deterministic, never vary
405
+
└── rules/*.md # written rules: judgement, read by the model
406
+
```
407
+
408
+
### Set it up
409
+
410
+
```bash
411
+
diffmind rules init # writes a starter .diffmind/rules/default.md
412
+
# edit it, then:
413
+
diffmind rules list # shows what loads, its severity ceiling and its globs
414
+
diffmind # review with them applied
415
+
```
416
+
417
+
**A complete worked example lives in
418
+
[`examples/nextjs-app-router/`](examples/nextjs-app-router/)** — three scoped
419
+
rule sets plus 13 regex rules for a real React/Next.js project. Copy the folder
420
+
and edit.
421
+
422
+
### Which file does a rule go in?
423
+
424
+
**If a regex can decide it, it goes in `rules.toml`.** It costs nothing, never
425
+
changes between runs, and is safe to block a build on. Only judgement goes in a
426
+
`.md`.
427
+
428
+
| | `rules.toml` | `rules/*.md` |
429
+
| --- | --- | --- |
430
+
| Read by | regex, before the model runs | the model, in the prompt |
431
+
| Cost | free | tokens, every review |
432
+
| Same answer every run | always | depends on the model |
433
+
| Good for | `next/router` in `app/`, `@ts-ignore`, hardcoded secrets | "is this abstraction earning its keep" |
434
+
399
435
### Written rules — `.diffmind/rules/*.md`
400
436
401
437
For rules that need judgement instead of a pattern. They live in the repo and
@@ -405,7 +441,8 @@ people carry.
405
441
406
442
```markdown
407
443
---
408
-
scope: ["src/api/**/*.ts"]
444
+
description: Conventions for the public API layer
445
+
scope: ["src/api/**/*.ts", "!src/api/legacy/**"]
409
446
severity: high
410
447
---
411
448
@@ -416,11 +453,25 @@ severity: high
416
453
- Reject changes that widen a response struct without a version bump.
417
454
```
418
455
419
-
`scope` is a glob for the files the rule set applies to (leave it out for the
420
-
whole repo). `severity` is a **maximum** for findings from that rule set — it can
421
-
lower a finding's severity but never raise it. `id` defaults to the filename.
422
-
Create a starter file with `diffmind rules init`, and see what loads with
423
-
`diffmind rules list`.
456
+
| Field | Meaning |
457
+
| --- | --- |
458
+
| `id` | Suppression handle, `rulebook.<id>`. Defaults to the filename. |
459
+
| `description` | One line, for humans. Shown by `rules list`; never sent to the model. |
460
+
| `scope` | Globs this governs. Omit for the whole repo. A `!` prefix excludes, and beats every include. |
461
+
| `always` | Apply to every file regardless of `scope`. Paid for on every review — make it deliberate. |
462
+
| `severity` | A **maximum** for findings from this set. Can lower a finding's severity, never raise it. Also the drop order when the budget is tight. |
463
+
464
+
`globs:`and `alwaysApply:` are accepted as aliases, so a rule ported from
465
+
`.cursor/rules/`loads without an edit.
466
+
467
+
Create a starter file with `diffmind rules init`, see what loads with
468
+
`diffmind rules list`, and validate the lot with `diffmind rules check` —
0 commit comments