Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By NodeNestorv1.0.0In 1 marketplace
Self-learning convention enforcer — watches your project patterns, auto-generates rules, prevents architectural drift.
Run automatically on Claude Code events. Claude doesn't decide.
2 cautions to review before installing
A hook runs when Claude uses the Bash tool
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Self-learning project convention enforcer for Claude Code. Watches what Claude does, learns your project's patterns (naming, structure, imports, error handling), auto-generates .claude/rules/*.md files, and enforces them.
Pure Python stdlib. Zero dependencies.
Guardian operates in three phases based on how many sessions you've had in a project:
| Phase | Sessions | Behavior |
|---|---|---|
| OBSERVE | 1–5 | Silently collects events. No enforcement. |
| SUGGEST | 6–10 | Warns about convention violations but allows them. |
| ENFORCE | 11+ | Blocks edits that violate learned conventions. |
A pattern is promoted to a rule only when:
Rules are written as .claude/rules/guardian-*.md files with frontmatter globs for file matching. They're human-readable and editable — Guardian will never overwrite a rule you've manually edited.
# Clone or install as a Claude Code plugin
# Then run:
bash install.sh # Linux/macOS
# or
powershell install.ps1 # Windows
This creates ~/.claude/guardian/ for storing events, state, and learned patterns.
All data lives in ~/.claude/guardian/:
| File | Purpose |
|---|---|
events.jsonl | Raw events (one JSON per line) |
state.json | Session count, current phase |
patterns.json | Learned patterns with confidence scores |
Create a .guardianignore file in your project root to skip enforcement on specific files. Uses glob patterns:
# Generated files
dist/**
build/**
# Config files
*.config.js
# Migrations
migrations/**
See .guardianignore.example for a full template.
On the first session in a project, Guardian walks the project tree (up to 500 files) to bootstrap patterns from existing code. This means it has useful conventions learned before you even start coding.
.claude-plugin/plugin.json — Plugin metadata
hooks/
hooks.json — Hook definitions
run_hook.sh — Shell runner
session_start.py — Increment session, determine phase
collect_edit.py — Collect Edit/Write events (async)
collect_bash.py — Collect Bash events (async)
enforce.py — PreToolUse enforcement (5s timeout)
analyze.py — Run analyzers on Stop (async)
server/
store.py — JSONL event store + JSON state
analyzers.py — Pattern detection (frequency counting + regex)
rule_generator.py — .claude/rules/ markdown generator
MIT
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
claude-guardian@nestor-plugins is listed by nodenestor/nestor-plugins — review the source before installing
npx claudepluginhub nodenestor/nestor-plugins --plugin claude-guardianPlugins from other owners that cover similar ground