-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
feat: add config-health — runtime config integrity monitoring #2496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
YuhaoLin2005
wants to merge
3
commits into
affaan-m:main
Choose a base branch
from
YuhaoLin2005:feat/config-health
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+67
−0
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
704ff78
feat: add config-health — runtime config integrity monitoring
YuhaoLin2005 79b0e34
fix: add When to Activate, How It Works, Examples sections per codera…
YuhaoLin2005 db78a1a
fix: clarify boundary naming + add install merge warning per coderabb…
YuhaoLin2005 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| --- | ||
| name: config-health | ||
| description: Runtime configuration integrity monitoring for Claude Code. Detects config drift, rule staleness, and hook wiring gaps during sessions. Complements delivery-gate with session-duration soft monitoring. | ||
| metadata: | ||
| origin: ECC | ||
| --- | ||
|
|
||
| # Config Health | ||
|
|
||
| A real-time monitoring layer. delivery-gate blocks at session end; config-health catches problems during the session — when cheap to fix. | ||
|
|
||
| ## When to Activate | ||
|
|
||
| - After installing delivery-gate and wanting defense in depth | ||
| - When hooks silently stop firing | ||
| - When config rules accumulate but you're unsure which still work | ||
| - At session startup for config integrity scan | ||
| - Before high-risk Edit/Write operations | ||
|
|
||
| ## How It Works | ||
|
|
||
| Session Start → config-health scans rules/hooks (soft warnings, never blocks) | ||
| Session Work → config-health monitors hook wiring (PreToolUse guard) | ||
| Session End → delivery-gate verifies (hard block, exit 2) | ||
|
|
||
| Boundary: "Can this be fixed retroactively?" Config drift → config-health warns. Missing growth-log → delivery-gate blocks (hard exit 2). | ||
|
|
||
| ## What It Monitors | ||
|
|
||
| 1. Rule Health: scans rules, checks hook wiring, detects dead rules | ||
| 2. Hook Wiring Audit: verifies scripts exist and are wired before high-risk calls | ||
| 3. Guard Script Staleness: checks maintenance windows | ||
|
|
||
| ## Examples | ||
|
|
||
| Catching silent hook failure: | ||
| SessionStart → health-check.py referenced in 3 docs, wired 0 times → WARN: dead references | ||
|
|
||
| PreToolUse guard: | ||
| three-questions-guard.py: referenced in BODY.md, exists on disk, wired in settings.json → Allow | ||
|
|
||
| Rule staleness: | ||
| rule "双池强制触发" last fired 15 sessions ago → WARN: may be dead | ||
|
|
||
| ## Install | ||
| **Important:** Merge these hook entries into your existing `hooks` object — do not replace it, or you will lose hooks like delivery-gate. Also copy `scripts/config-health.py` to `~/.claude/scripts/config-health.py` and verify it exists before enabling. | ||
|
|
||
| ```json | ||
| { | ||
| "hooks": { | ||
| "SessionStart": [{"hooks": [{"type": "command", "command": "python3 ~/.claude/scripts/config-health.py --startup", "timeout": 5000}]}], | ||
| "PreToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "python3 ~/.claude/scripts/config-health.py --pretool", "timeout": 3000}]}] | ||
| } | ||
| } | ||
| ``` | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| ## Design Principles | ||
|
|
||
| 1. Never block on process monitoring — config-health warns; delivery-gate blocks | ||
| 2. Check what delivery-gate can't — config behavior vs filesystem state | ||
| 3. Zero false positives on hook wiring — missing script = fact, not heuristic | ||
|
|
||
| ## Files | ||
|
|
||
| | File | Purpose | Hook | | ||
| |------|---------|------| | ||
| | scripts/config-health.py | Rule health, hook audit, staleness | SessionStart + PreToolUse | | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scripts/config-health.pybefore enabling the hooks, but this change still does not include that source script. When a user follows the instructions, there is no file to copy into~/.claude/scripts/config-health.py, so the SessionStart and PreToolUse commands still run a nonexistent Python file instead of starting the config-health monitor.Rule Used: Review for prompt injection, tool-permission creep... (source)