cd /news/developer-tools/i-turned-federal-compliance-regulati… · home topics developer-tools article
[ARTICLE · art-69261] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=· neutral

I Turned Federal Compliance Regulations Into JSON So My AI Coding Agent Could Actually Use Them

A developer built a Python pipeline that converts CMMC Level 1 and NIST SP 800-171 Rev 2 compliance regulations into structured JSON, enabling AI coding agents to enforce compliance rules automatically. The pipeline produces 125 rules with agent-specific guidance that can be injected into system prompts, CI/CD gates, or GRC platforms. The developer notes that the hardest part was handling inconsistent source data from NIST's API.

read3 min views1 publishedJul 22, 2026

If you've ever had to check code or infrastructure against a compliance framework, you know the drill: someone reads a 100-page PDF, then reads your codebase, then makes a judgment call. It's slow, inconsistent, and it can't be automated. So I built a pipeline to fix that — for real.

The problem

CMMC Level 1 and NIST SP 800-171 Rev 2 are two of the most common compliance frameworks small defense contractors and government-adjacent companies have to meet. Both exist only as dense regulatory text. There's no official machine-readable version.

That means every compliance check is manual. Every AI coding assistant reviewing your infrastructure has zero built-in awareness of these requirements. Every CI/CD pipeline has to skip compliance checks entirely or rely on someone remembering to look.

** What I built**

A Python pipeline that:

Here's what one rule actually looks like:

\

json

{

"rule_id": "nist_sp_800-171_rev_2_3.1.1",

"framework": "NIST SP 800-171 Rev 2",

"control_id": "3.1.1",

"title": "ACCESS CONTROL — 3.1.1",

"requirement": "Limit system access to authorized users, processes acting on behalf of authorized users, and devices.",

"agent_guidance": "When generating or reviewing code/infrastructure, ensure compliance with NIST SP 800-171 Rev 2 control 3.1.1. Flag any implementation that does not satisfy: Limit system access to authorized users, processes acting on behalf of authorized users, and devices.",

"generated_at": "2026-07-15T16:42:56.026218+00:00"

}

``

That agent_guidance

field is the interesting part — it's written specifically to drop straight into an AI coding agent's system prompt as a compliance guardrail.

Three ways to actually use this

1. AI coding agent system prompt

\

`python

import json

with open("nist_800-171_rules.json") as f:

rules = json.load(f)

guardrails = "\n".join(r["agent_guidance"] for r in rules)

system_prompt = f"Apply these compliance rules when writing or reviewing code:\n{guardrails}"

```

2. CI/CD compliance gate — iterate the rules as a pipeline step, flag PRs that touch relevant systems without addressing applicable controls, use rule_id

as a stable reference for tracking exceptions over time.

3. GRC platform import — most GRC tools have their own framework mappings; control_id

gives you a clean join key.

What I learned building the pipeline

The hardest part wasn't the rule generation — it was source data. NIST's REST API for CPRT returns a 403 for direct automated access, so it has to be manually exported from their catalog first. And their JSON schema is genuinely inconsistent between versions — I had a bug where severity data was silently defaulting to "UNKNOWN" for weeks because CVSS v3 nests baseSeverity

inside cvssData

, while CVSS v2 puts it as a sibling field. Classic "the data looked fine until I actually checked it" bug.

Where this is going

I ended up with 125 rules across both frameworks — full coverage, not a sample. I've packaged the complete output (both JSON files) as a one-time license if anyone wants the finished dataset instead of building the pipeline themselves: [link]. But honestly, the more interesting part to me is the pattern itself — turning static regulatory text into something an AI agent can actually reason about, rather than a document a human has to remember to check.

Curious if anyone else has tackled compliance-as-code for other frameworks (SOC 2, ISO 27001, HIPAA) — would love to compare notes on parsing approaches in the comments.

── more in #developer-tools 4 stories · sorted by recency
── more on @nist 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-turned-federal-com…] indexed:0 read:3min 2026-07-22 ·