Skip to content

nizos/conduct

Repository files navigation

Conduct

npm version npm downloads CI Security License: MIT

Process discipline for AI coding agents.

Overview

Conduct is a policy engine that sits between coding agents and your codebase, evaluating each attempted action against configurable rules. It generalizes tdd-guard beyond TDD and across coding agents.

Conduct demo showing TDD enforcement
Click to watch Conduct enforce TDD

Features

  • Multi-Agent Support - Works with Claude Code, OpenAI Codex, and GitHub Copilot
  • TDD Enforcement - Blocks code without a failing test, works with any test runner
  • Pattern Rules - Block command or content patterns by string or regex
  • Deterministic and AI Rules - Deterministic checks when possible, model validation when needed
  • Custom Rules - Define your own rules alongside the built-in ones

Getting started

Install Conduct as a dev dependency, then wire it into your agent:

npm install -D @nizos/conduct

Create a conduct.config.ts config file at the root of your project.

Example Configuration

A few rules in action. See the rules reference for the full list.

import {
  defineConfig,
  enforceTdd,
  enforceFilenameCasing,
  forbidCommandPattern,
  forbidContentPattern,
} from '@nizos/conduct'

export default defineConfig({
  rules: [
    forbidCommandPattern({
      match: 'npm install',
      reason: 'Use pnpm install instead',
    }),
    {
      files: ['src/**', 'test/**'],
      rules: [
        enforceTdd(),
        enforceFilenameCasing({ style: 'kebab-case' }),
        forbidContentPattern({
          match: 'setTimeout',
          reason: 'No timers in source code',
        }),
        forbidContentPattern({
          match: 'eslint-disable',
          reason: 'Fix the lint violation rather than disabling the rule',
        }),
      ],
    },
    {
      files: ['**/*.md'],
      rules: [
        forbidContentPattern({
          match: /\p{Extended_Pictographic}/u,
          reason: 'No emojis in documentation',
        }),
      ],
    },
  ],
})

Contributing

Contributions are welcome! See the contributing guidelines to get started.

License

MIT