By nizos
Enforce process discipline for AI coding agents by blocking file writes, reads, and execution based on git worktree and tracking conditions, running bash scripts to guard Edit, Write, Read, and Bash tool calls against policy violations.
Probity blocks AI coding agents from breaking your rules — adding production code without a failing test, disabling lint rules instead of fixing the issue, reaching for rm -rf when something more targeted would do. It works through your agent's existing hook system.
Probity is the successor to TDD Guard (~2k stars, ~200k downloads), now with one config across Claude Code, Codex, and GitHub Copilot CLI.
Each agent action (file write, shell command) fires a hook. Probity evaluates the action and either lets it through or sends back a reason and a path forward:
Probity: you're adding production code before a failing test has been
observed.
The next TDD-legal step is to add one focused test in src/cart.test.ts
and run it to a clean assertion failure before implementing only the
minimum code to pass it.
The agent receives the message and corrects course. Rules can be deterministic (string or regex match on commands or file content) or AI-validated. AI-validated rules reuse your agent's existing authentication, so Probity doesn't need its own API key.
npm install -D @nizos/probity
Create probity.config.ts at your project root:
import {
defineConfig,
enforceTdd,
forbidCommandPattern,
forbidContentPattern,
} from '@nizos/probity'
export default defineConfig({
rules: [
forbidCommandPattern({
match: /rm\s+-rf/,
reason: '`rm -rf` is too broad; remove specific paths instead.',
}),
{
files: ['src/**', 'test/**'],
rules: [
enforceTdd(),
forbidContentPattern({
match: 'eslint-disable',
reason: 'Fix the lint violation rather than disabling the rule.',
}),
],
},
],
})
Then wire it into your agent. One-time setup per agent.
enforceTdd(): enforces the TDD cycle — failing test first, minimal implementation, refactor on green. Reads recent session activity, so refactors and multi-step edits don't trip false positives.forbidCommandPattern(): blocks shell commands by string or regex match. For destructive commands or steering agents to the right tool.requireCommand(): gates a command on a prior one in session history (e.g., block commits unless tests have run since the last edit).forbidContentPattern(): blocks file writes whose content matches a pattern (e.g., no eslint-disable or setTimeout in src/).enforceFilenameCasing(): blocks writes whose filename does not match a configured casing style.Custom rules are a few lines of TypeScript. File scoping uses ESLint-style globs, including negations.
Does it work with my agent? Probity currently works with Claude Code, Codex, and GitHub Copilot CLI, with more coming.
Does it work with my language? Probity reads each agent's session transcript directly, so there are no per-framework reporters to install. It works with any language and test runner that your agent can work with.
Does Probity need its own API key or subscription? No. AI-validated rules use each vendor's official SDK and reuse whatever authentication your agent already has, so Probity doesn't require its own access or billing.
I'm already using TDD Guard. Should I switch? Probity's TDD validation reads the session transcript, which lets it handle refactors and multi-step edits more reliably. It also supports more agents and is safe with parallel sessions. The one gap: TDD Guard has a lint integration that Probity doesn't yet match.
Contributions are welcome. See the contributing guidelines to get started.
Executes bash commands
Hook triggers when Bash tool is used
Modifies files
Hook triggers on file write and edit operations
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
Automated Test-Driven Development enforcement
npx claudepluginhub nizos/probity --plugin probityAutomated Test-Driven Development enforcement
Analyze and enforce best practices for AI coding agent projects. Assess codebase readiness across 8 pillars with /readiness, then scaffold enforcement with /setup: TDD, secret scanning, file size limits, auto-generated docs, and git hooks.
PLAN/ACT/EVAL workflow with auto-detection, specialist agents, and reusable skills for systematic TDD development
SDLC enforcement for AI agents — TDD, planning, self-review, CI shepherd
Test-Driven Development (TDD) principles and red-green-refactor cycle enforcement.
AI-First SDLC — zero-debt development with validators, enforcement, and workflows