Skip to content

feat: add SOD validation, audit reporting, and init scaffolding#12

Merged
shreyas-lyzr merged 2 commits intoopen-gitagent:mainfrom
patel-lyzr:feat/sod-2-cli-commands
Feb 27, 2026
Merged

feat: add SOD validation, audit reporting, and init scaffolding#12
shreyas-lyzr merged 2 commits intoopen-gitagent:mainfrom
patel-lyzr:feat/sod-2-cli-commands

Conversation

@patel-lyzr
Copy link
Contributor

Summary

Adds CLI support for segregation of duties across three commands:

  • validate.ts: 16 validation rules for SOD including:
    • Roles ≥ 2 with unique IDs
    • Conflict pairs reference defined role IDs, no self-conflicts
    • Assignments reference defined role IDs
    • Core SOD check: no agent holds conflicting roles (error in strict mode, warning in advisory)
    • Handoff required_roles with ≥ 2 distinct roles
    • Risk tier recommendations for high/critical systems
  • audit.ts: New "8. Segregation of Duties" section reporting roles, conflicts, assignments, isolation, handoffs, enforcement, and violation detection
  • init.ts: DUTIES.md scaffolding in the full template

Context

Part 2 of 4 for the SOD feature (#10). Depends on #11 (spec + schema + types).

Test plan

  • npm run build passes cleanly
  • node dist/index.js validate -d examples/full --compliance — passes with SOD section
  • node dist/index.js audit -d examples/full — shows "Segregation of Duties" section
  • node dist/index.js init -t full -d /tmp/test-agent — creates DUTIES.md

PR Stack

  1. Spec + Schema + Types (feat: add segregation of duties schema, types, and spec #11)
  2. CLI support (this PR)
  3. Adapter support
  4. Examples + docs

🤖 Generated with Claude Code

Add the `segregation_of_duties` subsection to the compliance schema with
support for roles, conflict matrix, assignments, isolation levels,
handoff workflows, and enforcement modes.

- JSON Schema definition in agent-yaml.schema.json
- TypeScript types in loader.ts ComplianceConfig interface
- Spec documentation including DUTIES.md convention, validation rules,
  and regulatory reference table

Closes open-gitagent#10 (part 1 of 4)
- validate.ts: 16 validation rules for SOD (role uniqueness, conflict
  detection, assignment integrity, handoff validation, risk tier checks)
- audit.ts: new "Segregation of Duties" section in audit report
- init.ts: DUTIES.md scaffolding in full template

Part 2 of 4 — depends on feat/sod-1-spec-schema
Copy link
Contributor

@shreyas-lyzr shreyas-lyzr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validation logic is thorough — 16 checks covering:

  • Role uniqueness and minimum count
  • Conflict pair integrity (no self-conflicts, references defined roles)
  • Assignment validation with core SOD violation detection
  • Handoff role validation with minimum 2 distinct roles
  • Risk tier recommendations (strict enforcement + full isolation for high/critical)
  • Advisory vs strict enforcement mode handling

The audit section is clean — shows assignments, conflicts, violations, and handoffs clearly. DUTIES.md scaffolding in init --template full is a nice touch.

One note: the audit section numbering shifts existing sections (8→9, 9→10) — make sure the final merged order makes sense if other PRs also touch audit.ts.

LGTM — approving.

@shreyas-lyzr shreyas-lyzr merged commit c10d431 into open-gitagent:main Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants