🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

code-warden

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-warden

Verifiable governance for AI-assisted development — checks, hooks, and evidence.

Source
npmnpm
Version
3.3.2
Version published
Weekly downloads
355
Maintainers
1
Weekly downloads
 
Created
Source

code-warden

Portable AI Coding Governance Layer

Code-Warden provides verifiable governance for AI-assisted development. It does not just ask agents to follow rules — it adds Scope Gates, Plan Gates, local checks, CI enforcement, runtime hooks where supported, and governance artifacts that show what was checked before code was accepted.

Four Layers

Code-Warden Four Layers

LayerWhat it does
Skill governanceScope Gate, Plan Gate, blast-radius checks, patch-first editing, research gates, drift signals, verification evidence
Local verificationwarden-lint, verify-secrets, get-context — directory-aware, no external deps
Installer and healthCross-app auto-installer, manifest-backed installs, --doctor, --verify-target, Windsurf adapter
Hard enforcementClaude Code PreToolUse hooks — block oversized writes and hardcoded secrets before the file system is touched

Governance Evidence

Generate a machine-readable governance report that can be stored in CI, attached to PRs, or used as audit evidence:

node tools/governance-report.js .                   # write .code-warden-report.json + summary
node tools/governance-report.js . --format=json      # JSON to stdout
node tools/governance-report.js . --format=md        # Markdown to stdout

The report runs all checks in a single pass (file length, secrets, behavioral tests, source integrity) and produces a structured artifact:

{
  "tool": "code-warden",
  "version": "3.3.2",
  "checks": {
    "fileLength":      { "status": "pass", "filesScanned": 34, "violations": 0 },
    "secrets":         { "status": "pass", "filesScanned": 34, "violations": 0 },
    "behavioralTests": { "status": "pass", "tests": 9, "failures": 0 },
    "installHealth":   { "status": "pass" }
  },
  "result": "pass"
}

In CI, the Markdown format pipes directly into $GITHUB_STEP_SUMMARY for PR-visible evidence:

CheckResultDetails
File lengthPASS34 files scanned, 0 violations
Hardcoded credentialsPASS34 files scanned, 0 violations
Behavioral testsPASS9 tests, 0 failures
Install healthPASSAll source files present

See templates/ci/github-actions.yml for the full CI template with artifact upload.

Install

npx code-warden init

Or install globally:

npm install -g code-warden
code-warden init

CLI commands

CommandPurpose
code-warden initInstall to all detected AI runtimes
code-warden reportGenerate governance report
code-warden report --format=mdMarkdown output for PR summaries
code-warden doctorVerify source integrity + install health
code-warden listShow detected runtimes
code-warden hooks claudeInstall Claude Code PreToolUse hooks
code-warden hooks codexInstall Codex PreToolUse hooks (partial)
code-warden uninstall-hooks claudeRemove Claude Code hooks
code-warden uninstall-hooks codexRemove Codex hooks

Direct installer commands

CommandPurpose
node install.jsScan, prompt, install to detected apps
node install.js --allInstall without prompt
node install.js --dry-runPreview installs, write nothing
node install.js --listShow detected apps and detection method
node install.js --doctorVerify source integrity + per-target install health
node install.js --target=claude,cursorForce specific targets (warns if not detected)
node install.js --verify-target=claudeStrict health check — exits nonzero if not installed
node install.js --hooks=claudeInstall PreToolUse hooks into ~/.claude/settings.json
node install.js --uninstall-hooks=claudeRemove code-warden hook entries from settings

Supported targets: Claude Code, Cursor, Warp, OpenAI Codex, Windsurf, Generic Agents.

Each install writes a .code-warden-install.json manifest (version, target, format, timestamp).

npm scripts

npm run lint            # warden-lint on full project tree
npm run check-secrets   # verify-secrets on full project tree
npm run report          # governance report, writes .code-warden-report.json
npm run report:json     # governance report as JSON to stdout
npm run report:md       # governance report as Markdown to stdout
npm run install-auto    # node install.js
npm run install-dry-run # node install.js --dry-run
npm run install-list    # node install.js --list
npm run install-doctor  # node install.js --doctor
npm run test            # behavioral tests (9 scanner/hook pass/fail cases)
npm run ci              # lint + secrets + test + doctor

Usage

Load at the start of any coding session. Trigger phrases:

  • "load code-warden" / "load protocol"
  • "begin coding" / "new session" / "governance check"
  • "start a new module" / "review this before we write"

The session sequence is enforced before any implementation:

Code-Warden Session Start Sequence

  • Architecture State (Re-injection Rule)
  • Session Scope (Session Scoping Rule)
  • Reference Files (Blueprint Rule)
  • Scope Gate — goal, non-goals, files in/out, verify commands, rollback
  • Plan Gate — patch order, blast radius class, post-patch checks

See examples/governed-session.md for an annotated example.

Optional Claude Code Hooks

Code-Warden Hook Enforcement Flow

Install hard enforcement that runs at the PreToolUse level — before writes happen:

# Requires Claude Code target to be installed first
node install.js --hooks=claude
HookTriggerPolicy
warden-lint-hook.jsWrite or EditBlocks if resulting file exceeds line limit
warden-secrets-hook.jsWrite or EditHardcoded credential scanner — blocks if content matches any secret pattern

Both hooks use exec form (node /path/to/hook.js) — no shell differences across platforms.

Thresholds are read from codewarden.json in the installed skill directory.

node install.js --uninstall-hooks=claude  # remove hook entries from settings.json

Doctor and --verify-target=claude validate hook script paths when hooks are registered.

Configuration

All thresholds in codewarden.json:

SettingDefaultWhat it controls
thresholds.max_file_length400Lines before warden-lint.js flags a file
thresholds.pre_flight_trigger_lines150Lines before a pre-flight manifest is required
thresholds.human_checkpoint_files2Files touched before [AWAITING CONFIRMATION] is required
safety.exempt_from_blast_radiustests/, docs/, scripts/Paths excluded from rollback-plan rule

See CONFIGURE.md for team-size profiles and tuning rationale.

Reference Files

FileDomain
references/planning-gates.mdScope Gate and Plan Gate contracts
references/architecture.mdBlueprint Rule, Re-injection, State Update
references/safety.mdBlast Radius, Patch-First, Zero-Trust, Dependency Freeze
references/cognition.mdThink Before Coding, Don't Guess Syntax, Human Checkpoint
references/cleanup.mdTech Debt format, Test Contract, Decision Log
references/anti-drift.mdAnchor Check, Session Scoping, Drift Trigger Protocol
references/operations.mdVerification, source-control hygiene, dependency control
references/research-and-fit.mdLive research gate, stack fit, product-shape guardrails

Note for contributors

If testing npx code-warden from inside the Code-Warden source checkout, npm may prefer the local package context. Test from a separate directory for the same behavior users will see.

Author

Justin Davis — MIT License

Keywords

ai

FAQs

Package last updated on 19 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts