vibe-guard
CLAUDE.md2 starsChanged 8 months agoApache-2.0View on GitHub
VGuard (VibeGuard) is a runtime-enforced AI coding guardrails framework. It generates hook scripts for AI agents (Claude Code, Cursor, Codex, OpenCode) that enforce security, quality, and workflow rules during AI coding sessions. Use these project commands for common development tasks: Use these skills for scaffolding and release:
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- new-adapterSkill
- new-presetSkill
- new-ruleSkill
- releaseSkill
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 62
Use these project commands for common development tasks:
- Distinctive: line 74
Use these skills for scaffolding and release:
- Very specific: line 85
Use the /new-rule skill or follow manually:
- Very specific: line 87
Create src/rules/{category}/{rule-name}.ts exporting a Rule object
- Very specific: line 90
Add to relevant presets in src/presets/
≈ “Common” is an estimate: at least 1 in 5 of the 27,641 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
VGuard — Project Instructions
What is VGuard?
VGuard (VibeGuard) is a runtime-enforced AI coding guardrails framework. It generates hook scripts for AI agents (Claude Code, Cursor, Codex, OpenCode) that enforce security, quality, and workflow rules during AI coding sessions.
Architecture
Layer 5: ANALYTICS (reports, drift detection)
Layer 4: LEARNING (convention extraction from codebases)
Layer 3: WORKFLOW (git flow, PR templates, commit conventions)
Layer 2: QUALITY (imports, naming, anti-patterns, file structure)
Layer 1: SECURITY (branch protection, secrets, destructive commands)
Layer 0: CORE ENGINE (hook runner, config parser, rule resolver)Key Directories
src/engine/— Core hook execution: runner, resolver, context, scanner, tracker, edit-rule-factorysrc/rules/{security,quality,workflow}/— Built-in rules. Each rule exports aRuleobjectsrc/config/— Config loading, Zod validation, preset merging, pre-compilationsrc/adapters/— Output generators per agent (claude-code, cursor, codex, opencode, github-actions)src/learn/— Convention learning engine (analyzers, promoter, walker)src/cli/commands/— CLI commands (init, add, remove, generate, doctor, lint, learn, report, eject, upgrade)src/presets/— Ecosystem presets (nextjs-15, typescript-strict, react-19, tailwind, supabase, django, fastapi, laravel)src/plugins/— Plugin loader and validatortests/— Vitest tests mirroring src/ structure
Development Commands
npm run build # Build with tsup (dual ESM/CJS)
npm run dev # Watch mode build
npm test # Run tests
npm run test:coverage # Run tests with coverage
npm run lint # ESLint
npm run type-check # TypeScript strict type checking
npm run format # PrettierConventions
- TypeScript strict mode — no
any, no unused vars (leading_allowed) - Dual ESM/CJS output — import paths use
.jsextension (e.g.,from './types.js') - Rule pattern: export a
Ruleobject withid,name,description,severity,events,match,check() - Fail-open philosophy — every
try/catchexits 0. Internal errors never block developer work - Edit rule factory —
createEditVariant()auto-generates Edit variants that only flag newly introduced issues - Conventional commits enforced by commitlint:
feat(scope): message - Test files mirror source structure:
src/rules/security/foo.ts→tests/rules/security/foo.test.ts - Prettier: semicolons, single quotes, trailing commas, 100 char width
Critical Design Decisions
- Hook scripts are pre-compiled to
.vguard/cache/resolved-config.jsonfor fast execution (<100ms target) - Tracker (
.vguard/data/rule-hits.jsonl) is append-only JSONL with 10MB auto-rotation — this is the data layer Cloud will consume - Config resolution: defaults → presets → user rules. Severity can only be downgraded, never upgraded by presets
- Claude Code adapter generates hooks and merges into
.claude/settings.json— it does NOT overwrite existing settings
Slash Commands
Use these project commands for common development tasks:
| Command | Purpose |
/project:add-rule | Scaffold a new rule with file, test, and registration |
/project:add-preset | Scaffold a new preset for a tech stack |
/project:run-tests | Run test suite and analyze failures |
/project:build | Build, type-check, lint, and verify dist output |
/project:adapter-check | Verify all adapter outputs are correct |
Skills
Use these skills for scaffolding and release:
| Skill | Trigger | What It Does |
/new-rule | "create a rule", "add rule" | Rule file + test + registration |
/new-preset | "create a preset", "add preset" | Preset file + registration |
/new-adapter | "add adapter", "support new agent" | Adapter file + type updates |
/release | "release", "publish", "bump version" | Full release: version bump, changelog, checks, PR, CI monitoring, changelog discussion |
Adding a New Rule
Use the /new-rule skill or follow manually:
- Create
src/rules/{category}/{rule-name}.tsexporting aRuleobject - Register in
src/rules/{category}/index.ts - Create
tests/rules/{category}/{rule-name}.test.ts - Add to relevant presets in
src/presets/
Adapter System
Each adapter in src/adapters/ generates agent-specific files:
| Adapter | Generated Files | Strategy |
claude-code | .vguard/hooks/*.js, .claude/settings.json, .claude/commands/vguard-*.md, .claude/rules/vguard-enforcement.md | hooks: overwrite, settings: merge, commands: create-only, rules: overwrite |
cursor | .cursorrules, .cursor/rules/*.mdc | overwrite |
codex | AGENTS.md, .codex/instructions.md | overwrite / create-only |
opencode | .opencode/instructions.md | overwrite |
github-actions | .github/workflows/vguard.yml | create-only |
Git Workflow
master— production, squash merges fromdevvia PR onlydev— integration branch, all work merges here first- Branch from
dev:feature/<name>,fix/<name>,chore/<name>
Enforcement Rules
Pre-Commit Hooks (.husky/pre-commit)
- Lint + Type-check — always runs on every commit
- CHANGELOG.md required — on
dev,master,mainbranches,CHANGELOG.mdmust be staged - Version bump required — on
master/mainbranches,package.jsonmust be staged (version bump)
CI Checks (.github/workflows/ci.yml)
release-checksjob — runs only on PRs targetingmaster:- Fails if
package.jsonversion matches the currentmasterversion (no bump) - Fails if
CHANGELOG.mdhas no diff compared tomaster
- Fails if
Publish Workflow (.github/workflows/publish.yml)
- Triggers on push to
master(PR merge) preflight— checks if PR merge, version unpublished, tag missingvalidate— full CI (lint, format, type-check, test, build)publish— npm publish with OIDC provenance, git tag, GitHub Release
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

