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: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
## [Unreleased]
9
9
10
10
### Added
11
+
- U-32 live constraint budget tooling: `count_active_constraints.sh`, `scripts/constraints/count_active_constraints.py`, and GC downgrade-candidate reporting
11
12
- CI doc command path validator (`scripts/ci/validate-doc-command-paths.sh`) to catch stale `~/vibeguard/...` shell examples
12
13
-`setup.sh --check` now emits a structured rollup (counts of OK/INFO/WARN/FAIL/BROKEN/MISSING and a final verdict line) so a single broken probe is not lost in 40+ healthy rows
13
14
-`setup.sh --check --quiet` filters output to problems-only plus the rollup, for fast triage in long install logs
Copy file name to clipboardExpand all lines: docs/rule-reference.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ Canonical source of truth: `rules/claude-rules/`
53
53
| U-29 | Error-driven downgrade paths must be observable at error level | Strict | If an error causes user-visible missing data or incorrect output, you must log it at `error` level or raise it. |
54
54
| U-30 | Cross-boundary Pydantic models must use `extra="allow"`| Strict | Any Pydantic model that receives external or cross-boundary data must set `extra="allow"` so `model_validate()` does not silently drop un... |
55
55
| U-31 | Cache keys must include code version | Strict | When builder or generation logic changes, old cache entries must invalidate automatically. |
56
-
| U-32 | Rule overload threshold + absolute-language detection | Strict |If one rule file contains more than 30 active constraints, raise an overload warning. |
56
+
| U-32 | Rule overload threshold + absolute-language detection | Strict |Keep the effective constraint set for a single agent task at 15 or fewer items. |
57
57
| U-33 | Code search defaults to glob/grep; vector DB requires written justification | Strict | For agent code retrieval, plain glob/grep driven by the model has empirically beaten vector indexes in production. |
Copy file name to clipboardExpand all lines: hooks/CLAUDE.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ AI coded agent hooks script, automatically triggered before and after the operat
16
16
|`post-edit-guard.sh`| PostToolUse(Edit) | Detect quality problems after editing: unwrap, console.log, hard-coded path, Go error discard, oversized diff, repeated editing of the same file (churn), W-15 consecutive same-file edit loop. | unsupported |
17
17
|`post-write-guard.sh`| PostToolUse(Write) | Detect duplicate definitions and files with the same name after creating a new file. | unsupported |
18
18
|`analysis-paralysis-guard.sh`| PostToolUse(Read|Glob|Grep) | Detect excessive exploration without progress and prompt the agent to act. | unsupported |
19
+
|`count_active_constraints.sh`| SessionStart | Count effective task constraints loaded into agent context and enforce the U-32 live-context budget in strict profile. | unsupported |
19
20
|`post-build-check.sh`| PostToolUse(Edit/Write) | Automatically run the build check corresponding to the language after editing. | native |
20
21
|`skills-loader.sh`| Manual optional | Optional first read prompt script; not registered to hooks by default. | unsupported |
21
22
|`stop-guard.sh`| Stop | Verify access control before completion and check for uncommitted source code changes. | native |
MESSAGE="VIBEGUARD U-32 ${STATUS}: effective task constraints=${TOTAL} (warn>${WARN_THRESHOLD}, block>${BLOCK_THRESHOLD}). Split low-frequency rules into path-scoped files, skills, or hooks before adding more persistent instructions. Top sources: ${SUMMARY}"
If one rule file contains more than 30 active constraints, raise an overload warning. When a rule uses absolute language such as "always", "never", or "must", it also needs a downgrade path so the system does not create an illusion of control.
100
+
Keep the effective constraint set for a single agent task at 15 or fewer items. If the live task context exceeds 15 constraints, warn and split lower-frequency material into path-scoped child files, skills, hooks, or verify scripts. If it exceeds 30 constraints, block and require decomposition before continuing. When a rule uses absolute language such as "always", "never", or "must", it also needs a downgrade path so the system does not create an illusion of control.
- arXiv 2605.06445 (Constraint Decay, 2026-05-09 RSS scout): across 80 greenfield and 20 feature tasks over 8 web frameworks, stronger agents lost about 30 assertion-pass-rate points as structured constraints accumulated; data-layer defects were the dominant failure mode.
103
104
- Addy Osmani, "How to Write a Good Spec": the curse of instructions. Ten rules can be obeyed less reliably than five.
104
105
- Anthropic Claude Code Best Practices: a bloated `CLAUDE.md` causes Claude to ignore the instructions that actually matter.
105
106
- Martin Fowler, "Context Engineering": illusion of control is an anti-pattern. LLMs are probabilistic systems, so absolute language creates false guarantees.
106
107
107
108
**Mechanical checks**:
108
-
1. If a rule file contains more than 30 entries, recommend decomposing it into path-scoped child files (for example, only load Rust rules for `*.rs`).
109
-
2. If a rule uses absolute phrasing such as "ensure X", "never do Y", or "must be 100%", attach both:
109
+
1. Count the actual task-loaded constraint set: global memory files, project `AGENTS.md`/`CLAUDE.md`, active skill files, and path-scoped native rules that match the current task files.
110
+
2. If the live task context contains more than 15 effective constraints, emit a U-32 warning and recommend moving lower-frequency material to path-scoped child files, skills, hooks, or verify scripts.
111
+
3. If the live task context contains more than 30 effective constraints, block the task until the constraint set is decomposed.
112
+
4. If a rule file contains more than 30 entries, recommend decomposing it into path-scoped child files (for example, only load Rust rules for `*.rs`).
113
+
5. If a rule uses absolute phrasing such as "ensure X", "never do Y", or "must be 100%", attach both:
110
114
- A downgrade path: "If X is not feasible, fall back to Y and mark it stale."
111
115
- An observability hook: a verification command or guard script that proves whether the rule is actually being followed.
112
-
3. If a global `CLAUDE.md` or `AGENTS.md` file grows beyond 100 lines, move material into skills or path-scoped rule files.
116
+
6. If a global `CLAUDE.md` or `AGENTS.md` file grows beyond 100 lines, move material into skills or path-scoped rule files.
117
+
7. Run `bash hooks/count_active_constraints.sh` through the strict hook profile, or run `python3 scripts/constraints/count_active_constraints.py --root . --include-canonical-rules --gc-report` manually, to inspect the current budget and downgrade candidates.
113
118
114
119
**Repair order**:
115
-
1. Audit the current rule set and annotate trigger frequency for each rule from access logs.
116
-
2. Candidate low-frequency rules (zero hits in the last 30 days) for removal or demotion into a skill.
117
-
3. Verify whether high-frequency rules use absolute language without a downgrade path.
118
-
4. Split large files by language or domain (`common/`, `rust/`, `python/`, `security/`).
120
+
1. Count the current task's effective constraints before adding any new persistent instruction.
121
+
2. Audit the current rule set and annotate trigger frequency for each rule from access logs.
122
+
3. Candidate low-frequency rules (zero hits in the last 30 days) for removal or demotion into a skill.
123
+
4. Verify whether high-frequency rules use absolute language without a downgrade path.
124
+
5. Split large files by language or domain (`common/`, `rust/`, `python/`, `security/`) and attach path frontmatter where possible.
119
125
120
126
**Additional checks**:
121
-
4. Before adding a persistent rule, first confirm it is a high-frequency, stable, cross-task constraint; otherwise prefer a skill, hook, or verify script.
122
-
5. Long workflow templates, one-off playbooks, and low-frequency knowledge should not live permanently in `CLAUDE.md` or `AGENTS.md`; convert them into an index plus on-demand documents.
127
+
1. Before adding a persistent rule, first confirm it is a high-frequency, stable, cross-task constraint; otherwise prefer a skill, hook, or verify script.
128
+
2. Long workflow templates, one-off playbooks, and low-frequency knowledge should not live permanently in `CLAUDE.md` or `AGENTS.md`; convert them into an index plus on-demand documents.
123
129
124
130
**Anti-patterns**:
125
131
- A single file accumulates 50+ rules and expects all of them to remain active at once.
0 commit comments