Architecture

Catalogs in, documents out, with every model call classified before it leaves and recorded after it returns:

Control catalogsNIST · HIPAA · FedRAMPARC-AMPE · HITRUST · GovRAMP mapcrosswalk synthesizeone topic, merged generatePolicy · Standard · Procedure publishConfluence or the repo model call boundarymay this content goto this provider? ledgerprovider, model, subject,tokens, cost, prompt hash
Diagram source (Mermaid)
flowchart LR
  C["Control catalogs<br/>NIST · HIPAA · FedRAMP<br/>ARC-AMPE · HITRUST · GovRAMP"] --> M["map<br/>crosswalk"]
  M --> S["synthesize<br/>one topic, merged"]
  S --> G["generate<br/>Policy · Standard · Procedure"]
  G --> P["publish<br/>Confluence or the repo"]

  S -.-> LLM(["model call"])
  G -.-> LLM
  B["boundary<br/>may this content go<br/>to this provider?"] --> LLM
  LLM --> L["ledger<br/>provider, model, subject,<br/>tokens, cost, prompt hash"]

  classDef gate fill:#fff3cd,stroke:#8a6d3b,color:black
  class B,L gate

map makes no model call. The boundary check runs before each call and raises rather than warns; the ledger records metadata and never content. Both are described in Security, compliance and responsible use.

config/                  Your local config (model, API key env var name, chosen frameworks)
data/frameworks/         Bundled, redistributable framework data (NIST, FedRAMP, ARC-AMPE, HIPAA, ...)
docs/                    The content tree: drafted Policies, Standards and Procedures
local_content/           Gitignored. Drop your own HITRUST/GovRAMP exports here.
src/policyforge/
  llm/                    Provider abstraction. Ships Anthropic, Amazon Bedrock
                          (`pip install "policyforge[bedrock]"`), Google Cloud
                          Vertex AI Model Garden (`pip install "policyforge[vertex]"`),
                          and Gemini via an AI Studio key (no extra needed) —
                          adding another provider means one new class, no changes to
                          calling code.
  ingest/                 Parses framework sources (bundled markdown, BYOC exports) into
                          a common Control/Element schema.
  mapping/                Cross-framework control crosswalk logic.
  synthesis/              Topic-themed merge/dedupe engine (the "30 synthesis docs" pattern).
  generate/               Turns synthesized requirements + org context into draft
                          policies/standards/procedures.
  edit/                   LLM-driven editing of live Confluence pages
                          (`policyforge edit-confluence`, `edit-topic`): plan.py
                          turns an instruction into a reviewable plan, apply.py
                          carries it out and checks nothing else was damaged, and
                          session.py runs the fetch/plan/rewrite sequence over a
                          whole topic's document set. See "Editing a live page".
  content/                The markdown content tree: documents as files, resolved
                          into tier/owner/published-page whether or not they carry
                          frontmatter, plus check.py's offline pull-request gate.
                          Shared, not Zardoz-specific — it's the reading half of a
                          repo-backed document set, and talks to no network.
  zardoz/                 The conversational read side (`policyforge zardoz`):
                          art.py is the floating head and every persona string,
                          shell.py the REPL, corpus.py the local document
                          snapshot over markdown and/or Confluence, retrieve.py
                          the chunking and ranking that finds the passage a
                          question is about, answer.py the grounded answering
                          and the checks that verify its citations, and
                          conversation.py the follow-up resolution that makes it
                          a conversation, paraphrase.py the vocabulary expansion
                          that runs only after a miss, and discover.py the topic
                          proposal for an uncatalogued space. Never imports the
                          publish path.
  ssp/                    Builds a NIST 800-53 System Security Plan as an .xlsx
                          workbook (`policyforge ssp`), with LLM-drafted
                          implementation narratives. See "System Security Plan" below.
  export/                 Markdown / Confluence exporters, the Confluence importer
                          (pulls a page's content back out, converts it to markdown,
                          restoring the links/mentions/images markdownify drops),
                          and confluence_search.py for finding pages by CQL.
  history/                Local, offline version history of generated/imported
                          documents (output/.history/) — see "Confluence import and
                          local version history" above.
scripts/
  vault_to_data_etl.py    One-time helper: converts an existing Obsidian vault's NIST
                          control notes (public-domain content only) into this project's
                          data schema.