Skip to content

Mandate System Overview

The Mandate System is Defiant’s governance layer. It consists of YAML rule files that define what every agent must and must not do. Mandates are versioned, auditable, and enforced at three points in the sprint lifecycle: plan time, commit time, and on demand.

Why mandates

Without a governance layer, AI agents optimize for completing the task — not for security, compliance, or consistency with your organization’s standards. Mandates encode those standards in a machine-readable format that is checked automatically on every sprint, not just when a human happens to notice.

Mandates replace a checklist that lives in someone’s head (or a document that no one reads) with a system that blocks non-compliant work before it ships.

Mandate structure

Every mandate is a YAML file in mandate-library/. Each file follows this schema:

id: mandate_7
name: Security Baseline
version: 1.2.0
category: security # security | quality | compliance | process | architecture
severity: blocking # blocking | warning | advisory
applies_to: # which agents this mandate governs
- builder
- reviewer
- guardian
vertical_packs: # which verticals activate additional rules
- fintech
- healthcare
rules:
- id: no-raw-sql
description: All database queries must use parameterized statements or an ORM.
check: ast-pattern
pattern: "\.query\(`|\.exec\(`|raw_sql\("
file_pattern: "src/**/*.ts"
action: block # block | warn | log
message: "Raw SQL detected at {{ file }}:{{ line }}. Use parameterized queries."
- id: security-headers
description: HTTP responses must include standard security headers.
check: file-contains
file: "src/**/*server*.ts"
pattern: "helmet|Content-Security-Policy"
action: block
message: "Security headers not found. Use the helmet middleware."
- id: no-http-in-prod
description: No plaintext HTTP URLs in production code.
check: regex-match
pattern: "http://(?!localhost)"
file_pattern: "src/**/*.ts"
action: warn
message: "HTTP URL found. Use HTTPS in production."
acceptance_criteria:
- All DB queries use parameterized statements or an ORM
- All HTTP responses include Content-Security-Policy, X-Frame-Options, X-Content-Type-Options
- No hardcoded secrets in source files
definition_of_done:
- mandate check exits 0
- guardian agent finds no critical or high findings

Check types

Check typeHow it works
ast-patternParses TypeScript/JavaScript AST and matches node patterns
regex-matchRuns regex against file contents
file-containsChecks whether a file contains a required pattern
file-existsChecks whether a required file is present
json-schemaValidates a JSON file against a schema
shell-commandRuns a shell command and checks exit code
customReferences a JavaScript function in mandate-library/checks/

Enforcement points

1. Plan time (PLAN state)

The Architect validates the technical plan against all active mandates before BUILD starts. If the plan would produce non-compliant code, BUILD is blocked before any code is written.

Terminal window
# Architect runs internally:
defiant mandates check --plan /path/to/plan.json --project proj_01hw...
# [PASS] mandate_1: AI-native baseline
# [PASS] mandate_7: Security baseline
# [FAIL] mandate_8: Dependency hygiene
# Rule: no-gpl-dependencies
# Found: "gpl-library@1.2.3" in proposed dependencies
# Result: BLOCKED

2. Commit time (BUILD state)

The Builder runs mandate checks before issuing a completion certificate. Any blocking violation prevents the certificate from being issued, which prevents the sprint from advancing to SHIP.

3. On demand

Terminal window
# Check the current working tree against all active mandates
defiant mandates check
# Check a specific mandate
defiant mandates check --mandate mandate_7
# Check against a specific project's mandates (includes vertical pack)
defiant mandates check --project proj_01hw...
# Check a specific directory
defiant mandates check --path src/payments/

The 50 global mandates

All projects have the 50 global mandates active regardless of vertical. Here is a summary:

IDNameCategorySeverity
mandate_1AI-native baselineprocessblocking
mandate_2No Defiant 1.x dependenciesarchitectureblocking
mandate_3Semantic versioningprocesswarning
mandate_4Conventional commitsprocesswarning
mandate_5Monorepo structurearchitectureblocking
mandate_6Turbo build systemarchitectureblocking
mandate_7Security baselinesecurityblocking
mandate_8Dependency hygiene (MIT/Apache/BSD only)complianceblocking
mandate_9Worktree isolationprocessblocking
mandate_10TypeScript strict modequalityblocking
mandate_11No any typequalitywarning
mandate_12Completion certificateprocessblocking
mandate_13Test co-locationqualityblocking
mandate_14Minimum test coverage (80%)qualityblocking
mandate_15No debug artifactsqualityblocking
mandate_16New code paths require testsqualityblocking
mandate_17API versioningarchitecturewarning
mandate_18Rate limiting on all public endpointssecurityblocking
mandate_19PCI DSS patternscomplianceblocking
mandate_20GDPR Art. 17 deletioncomplianceblocking
mandate_21GDPR Art. 20 portabilitycomplianceblocking
mandate_22Accessibility (WCAG AA)qualitywarning
mandate_23HIPAA audit trailcomplianceblocking
mandate_24SOC 2 loggingcomplianceblocking
mandate_25No hardcoded secretssecurityblocking
mandate_26Environment variable validation at startupsecurityblocking
mandate_27Parameterized queriessecurityblocking
mandate_28Output encodingsecurityblocking
mandate_29HTTPS only in productionsecuritywarning
mandate_30Short-lived tokens (< 24h)securitywarning
mandate_31CORS explicit allowlistsecurityblocking
mandate_32Dependency pinningsecuritywarning
mandate_33No eval or Function()securityblocking
mandate_34CSP header requiredsecurityblocking
mandate_35Error messages must not leak internalssecurityblocking
mandate_36Pagination on all list endpointsarchitecturewarning
mandate_37Idempotent mutationsarchitecturewarning
mandate_38Graceful shutdown handlingqualitywarning
mandate_39Health check endpointqualitywarning
mandate_40Structured logging (JSON)qualitywarning
mandate_41No synchronous file I/O in request handlersqualitywarning
mandate_42DB connection poolingarchitectureblocking
mandate_43Migration rollback includedqualityblocking
mandate_44RLS on all user data tablessecurityblocking
mandate_45Webhook signature verificationsecurityblocking
mandate_46No user input in shell commandssecurityblocking
mandate_47Immutable event logarchitectureblocking
mandate_48Token budget enforcementprocessblocking
mandate_49Handoff packet schema validationprocessblocking
mandate_50Sprint completion certificate schemaprocessblocking

See global mandates for the full YAML for each mandate.

Mandate versioning

Mandates are versioned with semantic versioning. When a mandate is updated:

  • Patch (1.0.x): wording clarification only; no behavior change
  • Minor (1.x.0): new advisory or warning rules added
  • Major (x.0.0): new blocking rules or removal of existing rules

Projects pin to a mandate library version in their config:

~/.defiant/config.json
{
"mandateLibraryVersion": "2.1.0",
"mandateOverrides": {
"mandate_22": { "severity": "blocking" } // project-level override: escalate to blocking
}
}

Adding custom mandates

You can add project-specific mandates in mandate-library/custom/:

mandate-library/custom/no-legacy-api.yaml
id: custom_no_legacy_api
name: No Legacy API calls
version: 1.0.0
category: architecture
severity: blocking
applies_to:
- builder
- reviewer
rules:
- id: no-v1-endpoints
description: Do not call the deprecated v1 API.
check: regex-match
pattern: "/api/v1/"
file_pattern: "src/**/*.ts"
action: block
message: "Found call to deprecated /api/v1/ endpoint. Use /api/v2/ instead."

Global Mandates

Full YAML for all 50 global mandates. Browse →

Vertical Pack Mandates

Additional mandates activated by vertical packs. Browse →