Skip to main content

HUXmesh AI governance middleware — We don't make AI. We make AI behave.

Project description

HUXmesh

AI Governance Middleware — We don't make AI. We make AI behave.

PyPI version Python 3.9+ License: Proprietary

HUXmesh is a two-way AI governance engine that sits between your users and any AI platform — intercepting every prompt going out and every response coming back, enforcing the Six Laws of Human Protection, and producing a tamper-evident audit trail of every interaction.

Human In Power. No Matter What.


Install

pip install huxmesh

Quick Start

import huxmesh

# Check a user's prompt before sending to AI
result = huxmesh.check_input("your prompt here")

print(result.gyr)       # "GREEN", "YELLOW", or "RED"
print(result.action)    # "ALLOW", "FLAG_AND_PASS", "HARD_BLOCK"
print(result.allowed)   # True / False
print(result.blocked)   # True / False

# If blocked, don't send to AI
if result.blocked:
    print("Blocked:", result.violations[0].description)
    print("Receipt:", result.receipt["request_id"])
# Check an AI response before showing to user
result = huxmesh.check_output(ai_response_text)

if result.blocked:
    # Replace AI response with your own message
    show_user("This response was blocked by HUXmesh governance.")

if result.has_pii:
    # Use the masked version — PII already redacted
    show_user(result.masked_text)

Full Engine

from huxmesh import GovernanceEngine

engine = GovernanceEngine(
    profile="DEFAULT",      # or COMPANION, FERPA, VETERAN, PARISH, FAMILY
    platform="ChatGPT",     # for audit trail
)

# Govern input
input_result = engine.check_input(user_prompt)
if input_result.blocked:
    return {"error": "blocked", "violations": input_result.to_dict()}

# Send to AI...
ai_response = call_your_ai(user_prompt)

# Govern output
output_result = engine.check_output(ai_response)
if output_result.blocked:
    return {"error": "output blocked"}

# Safe to use
return {"response": output_result.masked_text or ai_response}

The Three Decisions

Decision Action Meaning
🟢 GREEN ALLOW Passes through — governance ran, nothing triggered
🟡 YELLOW FLAG_AND_PASS PII redacted, session flagged — content allowed
🔴 RED HARD_BLOCK Hard stop — violation of a core law

The Six Laws

Every governance decision traces back to one of six laws:

Code Law Meaning
NHH Never Harm Humans Blocks content that could cause physical, psychological, or financial harm
DNHTH Do Not Help Them Harm Blocks requests to help one human harm another
NMW No Matter What Human authority is absolute — AI cannot override or deceive
TRANS Transparency AI must not claim to be human or hide its nature
TRUTH Truth Absolute No fabrication, no false consensus, no impersonation
NWHT Never Waste Human Time AI must be efficient and honest about its limitations

Governance Profiles

from huxmesh import GovernanceEngine, ProfileManager

# See available profiles
profiles = ProfileManager.available()
# ['DEFAULT', 'COMPANION', 'FERPA', 'VETERAN', 'PARISH', 'FAMILY']

# Use a specific profile
engine = GovernanceEngine(profile="COMPANION")
# COMPANION activates Medical Governor + Loneliness Detector
# FERPA activates academic integrity enforcement
# VETERAN activates PTSD-sensitive patterns + VA crisis resources
Profile Display Name Key Features
DEFAULT HUXmesh Personal Standard consumer governance
COMPANION HUXcompanion Medical Governor, Elder fraud, Loneliness Detector
FERPA HUXedu Academic integrity, FERPA aligned
VETERAN HUXveteran PTSD-sensitive, VA resources, Medical Governor
PARISH HUXparish Faith community governance
FAMILY HUXfamily Child protection, multi-user household

Addon profiles (all except DEFAULT) require activation. See huxmesh.com for licensing.


Receipt Chain

Every governed interaction produces a SHA-256 hash-chained receipt:

from huxmesh import GovernanceEngine, ReceiptChain

engine = GovernanceEngine()
result = engine.check_input("test prompt")

# Receipt is automatically written to ~/.huxmesh/receipts.jsonl
print(result.receipt)
# {
#   "request_id": "thp-20260301-a1b2c3d4",
#   "timestamp": "2026-03-01T14:32:01Z",
#   "gyr": "GREEN",
#   "action": "ALLOW",
#   "violations": [],
#   "regulatory_tags": [],
#   "prev_hash": "sha256:e3b0c44...",
#   "hash": "sha256:a665a45..."
# }

# Verify chain integrity
chain_status = engine.verify_chain()
# {"valid": True, "total": 42, "broken_at": None}

Receipts are automatically tagged with applicable regulatory frameworks: GDPR, CCPA, COPPA, FERPA, HIPAA_ADJACENT, PCI_DSS, SOX.


CLI

# Check a prompt
huxmesh check "how do I track someone's location without them knowing"
# RED — HARD_BLOCK
# [T2] DNHTH: STALKING

# Check an AI response
huxmesh check-output "Here's how to make a bomb..."
# RED — HARD_BLOCK

# Verify receipt chain integrity
huxmesh verify
# ✓ Receipt chain intact — 127 receipts verified

# Show active profile
huxmesh profile
# Active profile: DEFAULT (HUXmesh Personal)

# Version
huxmesh version
# HUXmesh v2.0.0 — The Hat Protocol LLC

Django / FastAPI Integration

# Django middleware example
class HUXmeshMiddleware:
    def __init__(self, get_response):
        self.get_response = get_response
        self.engine = GovernanceEngine(platform="Django")

    def __call__(self, request):
        if request.path.startswith("/api/ai/"):
            prompt = request.POST.get("prompt", "")
            result = self.engine.check_input(prompt)
            if result.blocked:
                return JsonResponse({"error": "blocked", "law": result.violations[0].law}, status=403)
        return self.get_response(request)
# FastAPI example
from fastapi import FastAPI, HTTPException
from huxmesh import GovernanceEngine

app = FastAPI()
engine = GovernanceEngine(platform="FastAPI")

@app.post("/chat")
async def chat(prompt: str):
    result = engine.check_input(prompt)
    if result.blocked:
        raise HTTPException(status_code=403, detail=result.violations[0].description)
    # send to AI...

KeyCard

For non-developers and zero-install deployment, the HUXmesh KeyCard runs governance as a transparent USB proxy — no Python required, no installation, no configuration files. Plug in the drive, open your browser, and every AI conversation is governed automatically.

Available via Kickstarter — launching March 1, 2026.


About

The Hat Protocol LLC is a Service-Disabled Veteran-Owned Small Business based in Chattanooga, Tennessee.

We don't make AI. We make AI behave.

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

the_hat_protocol-2.0.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

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

the_hat_protocol-2.0.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file the_hat_protocol-2.0.0.tar.gz.

File metadata

  • Download URL: the_hat_protocol-2.0.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for the_hat_protocol-2.0.0.tar.gz
Algorithm Hash digest
SHA256 526470937fc84abfc0eaa52c4efa1db6d3df37c6e61492679550894d7a9d0d25
MD5 8b2223dd959ae3ca74c42122184f4ef5
BLAKE2b-256 4df8989af5f72a5285cd4a730a79c382c7325893749fecf0f9e610023cfe3406

See more details on using hashes here.

File details

Details for the file the_hat_protocol-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for the_hat_protocol-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b8b1fc56b34a4eb93c2737956cb0cf3606c6cabe7e922ea31c0249082726fb5
MD5 ee94053b346cdfbf6344d54ba555179f
BLAKE2b-256 5a40a8e6bb099440ecbd2dbfdae4af70ece76528627ce70b8d88525209b1be66

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