Skip to main content

The Federated Governance Engine for AI (Universal Multi-Language)

Project description

Anchor โ€” Governance Engine for AI

License: Apache 2.0 Python 3.8+ PyPI Version: 5.0.0

"Governance without enforcement is documentation."

Anchor is the surveillance and enforcement layer for AI. It audits AI-adjacent code against a cryptographically sealed constitutional rule set, mapping every violation to the exact statute it breaches โ€” enforced deterministically via AST analysis, runtime interceptors, and behavioral verification (Diamond Cage).

๐ŸŒ anchorgovernance.tech


Why Anchor Exists

Event Date Amount
Goldman Sachs CFPB enforcement โ€” AI explainability failure Oct 2024 $45M
EU AI Act full enforcement begins โ€” credit scoring, AML, fraud Aug 2026 Mandatory
SEC AI Governance โ€” named #1 examination priority, above crypto 2026 Mandatory
RBI FREE-AI โ€” 26 mandatory recommendations, per-decision audit trails Aug 2025 Mandatory

The regulators have started counting. Anchor enforces.


What Anchor Does

  • Sovereign Multi-Tenancy (Layer 05) โ€” [NEW in v5.0] Decentralized identity for the enterprise. Organizations (Sovereign Hubs) manage their own staff and sub-projects via the Anchor Master Node, ensuring strict data isolation and regulatory jurisdiction (IN, EU, US).
  • Static Code Analysis (Layer 01) โ€” Tree-sitter AST scanning against a cryptographically sealed constitutional rule set. Every violation gets a violation_id mapped to the exact regulation it breaches.
  • Diamond Cage (Layer 02) โ€” WASM-based behavioral verification sandbox. Proves security invariants at scan time, not just static pattern matching. Reports as Diamond Cage: ACTIVE.
  • Hybrid Healer (Sovereign Scalpel) โ€” Goes beyond detection to remediation. Proposes file-specific AST patches, applied via anchor heal --apply.
  • Interceptor SDK โ€” First-party support for 20+ LLM providers. Secure prompts and responses mid-flight with AnchorGuard.
  • Federated Governance Workspace โ€” Structured .anchor/ directory with mandatory core domains and opt-in frameworks/regulators declared in constitution.anchor.

The Federated Model

Anchor operates on a three-layer constitutional architecture:

Layer File Purpose
Constitution constitution.anchor Defines WHAT risks exist. Domain + framework + regulator manifest. SHA-256 sealed via remote GOVERNANCE.lock.
Mitigation Catalog mitigation.anchor Defines HOW to detect each risk. Regex + AST patterns. Cloud-synced.
State Law policy.anchor Your local overrides. Change severity, add company-specific rules.

Merge Strategy: State Law overrides Constitution by rule ID, but only within the constitutional floor. Critical security rules (e.g., ANC-007) are locked at blocker. Local policy can make rules stricter, never weaker.


Coverage โ€” V4.3.5

Tier Content Count
Domain Rules SEC, ETH, PRV, ALN, AGT, LEG, OPS, SUP, SHR 43 rules
Standards Bodies FINOS AI Governance, OWASP LLM Top 10 ยท 2025, NIST AI RMF 1.0 3 frameworks
Government Regulators RBI FREE-AI 2025, EU AI Act 2024/1689, SEBI AI/ML 2025, CFPB Reg B, FCA 2024, SEC 2026 6 regulators
Total Regulatory Mappings 170 mappings

Quick Start

Install from PyPI

pip install anchor-audit

Or install from source

git clone https://github.com/Tanishq1030/Anchor.git
cd Anchor
pip install -e .

Initialize your project

anchor init

Sets up .anchor/, syncs the constitution & mitigation catalog, and installs the Git pre-commit hook.

Scan your code

# Full governance audit
anchor check ./src

# Scan with all frameworks and regulators
anchor init --all && anchor check ./src

Review and apply fixes

anchor heal          # Review suggested fixes
anchor heal --apply  # Apply all auto-fixable issues

Full command reference: USAGE.md


CI/CD Integration

Anchor acts as the enforcement gate in GitHub Actions. If a PR violates the constitution, Anchor blocks the merge with a detailed violation report.

# .github/workflows/anchor-audit.yml
- name: Run Governance Check
  run: |
    pip install anchor-audit
    anchor check --dir ./src --severity error --json-report --github-summary

Suppressing Findings

When a finding is a justified use (e.g., your governance tool legitimately needs subprocess), suppress it with an inline comment:

# Per-rule suppression
result = subprocess.run(cmd, capture_output=True)  # anchor: ignore ANC-018

# Suppress all rules on a line
os.environ.get("SECRET_KEY")  # anchor: ignore-all
Feature Details
Scope Line-level only
Audit Trail Anchor uses git blame to record who authorized each suppression
Visibility Suppressed findings appear in the report with the author's name

Project Structure

Anchor/
โ”œโ”€โ”€ anchor/                     # Core package
โ”‚   โ”œโ”€โ”€ cli.py                  # CLI entry point (click)
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ engine.py           # PolicyEngine โ€” AST scanning via tree-sitter
โ”‚   โ”‚   โ”œโ”€โ”€ healer.py           # Hybrid Healer โ€” fix suggestion and patching
โ”‚   โ”‚   โ”œโ”€โ”€ constitution.py     # SHA-256 integrity verification
โ”‚   โ”‚   โ”œโ”€โ”€ loader.py           # Federated policy merger
โ”‚   โ”‚   โ””โ”€โ”€ mapper.py           # GenAI threat model โ†’ rule mapper
โ”‚   โ”œโ”€โ”€ runtime/                # Interceptor SDK
โ”‚   โ”‚   โ”œโ”€โ”€ guard.py            # AnchorGuard application safety API
โ”‚   โ”‚   โ””โ”€โ”€ interceptors/       # SDK and HTTP library patches
โ”‚   โ””โ”€โ”€ adapters/               # Language-specific tree-sitter adapters
โ”œโ”€โ”€ tests/                      # Test suite
โ”œโ”€โ”€ .anchor/                    # Governance workspace (committed)
โ”‚   โ”œโ”€โ”€ domains/                # Core domain rules (SEC, ETH, PRV ...)
โ”‚   โ”œโ”€โ”€ frameworks/             # FINOS, OWASP, NIST
โ”‚   โ””โ”€โ”€ government/             # RBI, EU AI Act, SEBI, CFPB, FCA, SEC
โ”œโ”€โ”€ constitution.anchor         # Active framework/regulator manifest
โ”œโ”€โ”€ mitigation.anchor           # Detection pattern catalog
โ”œโ”€โ”€ case-studies/               # Real-world audit case studies
โ””โ”€โ”€ docs/                       # Architecture documentation

Security Architecture โ€” SHA-256 Tamper Proofing

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  GitHub Raw (Source of Truth)                    โ”‚
โ”‚  constitution.anchor  โ†’  SHA-256: 3745014B...   โ”‚
โ”‚  mitigation.anchor    โ†’  SHA-256: E3E32531...   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚ fetch + verify
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  .anchor/cache/ (Local)                         โ”‚
โ”‚  Hash mismatch โ†’ INTEGRITY VIOLATION            โ”‚
โ”‚  Hash match    โ†’ Proceed with audit             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

No developer can weaken the rules to pass the audit. The hashes are baked into the Python package itself.


Configuration

Variable Default Description
ANCHOR_CONSTITUTION_URL GitHub Raw URL Override for air-gapped/mirror setups
ANCHOR_MITIGATION_URL GitHub Raw URL Override for the mitigation catalog
ANCHOR_VERBOSE false Enable detailed debug output
ANCHOR_FETCH_TIMEOUT 10 Timeout (seconds) for cloud sync

Contributing


License

Apache 2.0 โ€” Open source. Built for the era of AI-Assisted Engineering.


Anchor V4.3.5 ยท anchorgovernance.tech ยท Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anchor_audit-5.0.0.tar.gz (138.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anchor_audit-5.0.0-py3-none-any.whl (166.0 kB view details)

Uploaded Python 3

File details

Details for the file anchor_audit-5.0.0.tar.gz.

File metadata

  • Download URL: anchor_audit-5.0.0.tar.gz
  • Upload date:
  • Size: 138.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for anchor_audit-5.0.0.tar.gz
Algorithm Hash digest
SHA256 ead90aa1d5e565db2f7c0e5e0824e3e655ebabf3c43316151160edc308257cb6
MD5 643e6b9114e4cdb105242865cef35258
BLAKE2b-256 5eced679d7e19114b6d0cdd3ae740eabda5eb33740c1dbc918fd9fdef268f53e

See more details on using hashes here.

File details

Details for the file anchor_audit-5.0.0-py3-none-any.whl.

File metadata

  • Download URL: anchor_audit-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 166.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for anchor_audit-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6bebe3f6fb3659c8be8013758719cf17bf58fd2645abb6f8fe3dda0e1308cd2f
MD5 6f4f65dc2e088cb067bcd2fb41593718
BLAKE2b-256 a8cc566d58b1a8ba95058648e387065745589e465e1006f71077052150f34f7f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page