AIFeed

SAFi: Open-source runtime governance and OS sandboxing for AI agents

Original text(via HN AI)

SAFi: The governance gateway for AI agents

Enforce written policies in real time, govern every tool call, and keep a tamper-evident audit trail of what your AI agents do.

SAFi CLI running live in the terminal — every tool call and answer is audited in real time against the governing policy. Watch full HD video →

SAFi CLI live terminal demo showing governed agent execution, tool calls, and real-time Conscience audit verdicts
SAFi CLI live terminal demo showing governed agent execution, tool calls, and real-time Conscience audit verdicts

Table of Contents

  • Client-Server Architecture
  • Quick Start: Install SAFi 1. Install the SAFi CLI (safi-cli) 2. Self-Host the SAFi Server (Docker) 3. Prefer a Turnkey Hardware Appliance?
  • 1. Install the SAFi CLI (safi-cli)
  • 2. Self-Host the SAFi Server (Docker)
  • 3. Prefer a Turnkey Hardware Appliance?
  • Built-in Agents
  • The Governance Your Policies as the Supreme Law The Four Pillars of Runtime Governance
  • Your Policies as the Supreme Law
  • The Four Pillars of Runtime Governance
  • Regulatory Readiness
  • Sensitive Data Controls
  • Roles & Permissions
  • For Developers
  • License & Governance

Client-Server Architecture

If you are an IT professional, think of SAFi as a domain controller for AI agents: a central server that holds your accounts, groups, and policies and applies them to every agent running across your machines. The agents run as thin clients in your terminal (sandboxed with Linux bubblewrap on Linux/WSL and Apple sandbox-exec on macOS), executing only what the server allows. By default, no agent can write outside its project workspace, and home directories, runtime/container sockets, and credential stores are hidden from all agents except the Sysadmin agent, which retains read-only host inspection access.


        [ Workstation: safi-cli ] ──HTTPS──▶ [ SAFi Governance Gateway (Server / Appliance) ] ──▶ [ Local / Cloud Models ]
 • Thin terminal client               • Central Identity (SSO / LDAP / SCIM) & RBAC
 • Executes repo & ops tools           • Immutable Charters & Policies (no local overrides)
 • Zero LLM API keys on laptop         • Deterministic policy & risk gates (R0–R4) + audit scoring
                                       • Unified hash-chained Audit Hub across every workstation
      

Quick Start: Install SAFi

You can test safi-cli in under two minutes against the live demo server, or self-host the entire SAFi governance server on your own machine with Docker.

1. Install the SAFi CLI (safi-cli)

safi-cli runs on your workstation and connects to any SAFi server or appliance so your agents can inspect repositories, run tests, audit endpoints, and manage infrastructure under real-time policy governance.

Windows 10 / 11 (PowerShell) (automatically configures WSL and core operational tools):


        irm https://runsafi.com/install.ps1 | iex
      

Linux & macOS (Terminal):


        curl -sSL https://runsafi.com/install.sh | bash
      

Connect to a SAFi server or try the live demo:


        safi --setup
      
  • Enter your SAFi server URL. Use https://demo.runsafi.com to try the live demo immediately, or your own self-hosted / appliance URL (e.g., https://192.168.1.200).
  • Sign in with a local account, type sso for Google/Microsoft browser login, or press Enter to paste a Policy API key (sk-safi-...).
  • Start issuing tasks directly from your project directory. Use /agents to switch agents, /models to switch AI models, and /audit to inspect the full governance ledger for any turn.

2. Self-Host the SAFi Server (Docker)

The fastest way to run your own SAFi governance server locally. Includes MySQL; no external database needed.


        # 1. Clone and enter the repo
git clone https://github.com/jnamaya/SAFi.git
cd SAFi

# 2. Configure your environment (generates secrets & validates your LLM key)
python3 scripts/setup.py

# 3. Start SAFi + MySQL
docker compose up
      

The setup wizard asks four things: what the instance is for, which AI provider to use, what port and URL to serve on, and an admin email. It then writes a complete .env with freshly generated session, encryption, and database secrets. It needs nothing beyond Python 3 and Docker.

Supported AI Providers (out of the box): Local models (llama.cpp / OpenAI-compatible), OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, GROQ_API_KEY, MISTRAL_API_KEY, DEEPSEEK_API_KEY, CEREBRAS_API_KEY, and ZHIPU_API_KEY.

3. Prefer SAFi Core, the Turnkey Appliance?

SAFi Core (runsafi.com) brings software engineering, systems administration, and security agents into your organization on dedicated on-premise hardware — powered by local AI models and governed by SAFi:

  • 15-Minute Plug-and-Play Setup: Connect power and Ethernet, log into the web portal, and pair safi-cli (Quick Start Guide).
  • No Cloud Dependency / Runs Fully Offline: Your data, credentials, and IP never leave your physical network. Pull the network cable and all models, agents, and governance tools still run 100% locally.
  • 3 Pre-Loaded Local Reasoning Models: Ships ready on day one with zero cloud API keys required. Optional bring-your-own-key cloud providers are supported and disabled by default. Qwen 27B — Deep security analysis, code refactoring, and multi-step troubleshooting. GPT-OSS 20B — High-speed PowerShell/Bash scripting, log triage, and documentation. Gemma 4 (26B) — Fast, structured tool execution and policy-checked diagnostics.
  • Qwen 27B — Deep security analysis, code refactoring, and multi-step troubleshooting.
  • GPT-OSS 20B — High-speed PowerShell/Bash scripting, log triage, and documentation.
  • Gemma 4 (26B) — Fast, structured tool execution and policy-checked diagnostics.
  • Pre-Loaded IT Agent Triad: Software Engineering, Systems Administration, and Security agents operating inside your written policies with OS-level sandboxes (Linux bubblewrap / macOS sandbox-exec) and a tamper-evident local audit trail (plus unlimited custom agents via the web portal).
  • Predictable Economics: Whisper-quiet edge hardware (high-bandwidth unified memory, 16-Core / 32-Thread CPU with dedicated AI acceleration, 1 TB NVMe SSD, 2.5 GbE + Wi-Fi 7, <120W) — one-time hardware purchase, zero cloud token bills. See runsafi.com for current pricing.

Built-in Agents

SAFi ships out of the box with three production CLI agents, each bound to an active, versioned governance policy that enforces strict operational boundaries at runtime:

AgentCLI KeyGoverning PolicyWhat It Does
SAFi Coding Agentsoftware_engineerSoftware PolicyInspects repositories, traces architecture, edits code, writes tests, and runs build/test commands locally.
Security Engineersecurity_engineerSecurity Engineer PolicyRuns authorized web/API assessments, OWASP Top 10 code audits, header/SSL/port checks, and defensive hardening.
Systems AdminsysadminSystems Admin PolicyDiagnoses servers, inspects services/logs/disk/firewalls, and manages Linux, Windows, Azure, and M365 fleets via SSH & tools.

Build Your Own Agents — or Govern Existing Ones

  • Web Control Panel: Author custom agents, attach internal Knowledge Bases (RAG), and bind them to your organization's Charter and domain Policies.
  • External Agent Gateway (/evaluate): Already have an agent stack? Route its drafts through SAFi's /evaluate gateway to enforce policy and record hash-chained audit evidence without rebuilding your orchestration.

The Governance

Governance in SAFi is not an afterthought or a filter, but the natural result of how the system works. Every agent action is checked against your rules before it runs, and every decision leaves evidence you can audit.

Your Policies as the Supreme Law

In SAFi, every agent action is governed by an explicit policy written and owned by your organization. The Policy controls the identity and the actions the agent is allowed to take. Ready-to-use default policies ship with the built-in SysAdmin, Security Engineer, and Software Engineer agents, and you can tune these rules or author new role policies at any time in the web admin portal (Control Panel → Policies).

The Four Pillars of Runtime Governance

  • Controlled Execution: The AI can never run commands on your servers directly. It can only propose actions, which must pass your policy rules and approvals before anything executes.
  • Model Independence: Your policies, agent roles, and history belong to you, not a cloud vendor. Upgrade or swap AI models at any time — your governance rules stay intact.
  • Built-In Threat Defense: Incoming prompts and commands are screened for attacks, prompt injections, and sensitive-data exposure before they are processed, keeping your systems safe.
  • Complete Audit Trail: Every action, tool call, and policy decision is permanently recorded in a tamper-evident, hash-chained audit log — powering the Audit Hub, Supervisory Review Queue, and custody-logged exports — giving compliance officers and auditors the exact proof they need.

The formal architecture behind these guarantees — the five faculties (Synderesis, Intellect, Will, Conscience, Spirit) and the seven-phase turn loop — is documented in the Developer Guide and formalized in the SAFi Math Specification. For regulator-facing capabilities, see Regulatory Readiness.

Regulatory Readiness

SAFi's governance architecture was designed for auditability first, mapping onto major AI and record-keeping frameworks. Each readiness document states plainly what ships today and what remains on the roadmap — no certification claims.

FieldWhat SAFi is designed to supportReadiness document
Financial services (SEC / FINRA)SEA 17a-4 audit-trail alternative (hash-chained, tamper-evident records with re-creatable originals), Reg S-P incident response with notification clocks, retention & legal hold, examiner production exports, and FINRA 3110/3120-style supervisory review with auditable human sign-off.SEC / FINRA Readiness
EU AI ActLimited-risk transparency tier: Art. 50(1) AI-interaction disclosure, Art. 50(2) machine-readable output marking, Art. 12 logging, Art. 13 per-decision explanations, Art. 14 human oversight, Art. 72 post-market monitoring, and Art. 73 incident clocks.EU AI Act Readiness
Healthcare (HIPAA)Per-org LLM provider allow-list with BAA-capable and zero-data-retention badges (fail-closed at every model call), application-layer encryption at rest, MFA and revocable sessions, §164.524 right-of-access export, breach-notification clocks, and device-copy kill switch.HIPAA Readiness
Data protection (GDPR)Self-service Art. 15 access export and written position reconciling Art. 17 erasure with retention obligations and legal-hold precedence.Data Erasure & Retention
AI management systems (ISO/IEC 42001)Machine-enforced versioned policy, role accountability with journaled sign-off, per-turn operation logs stamped with a deployment integrity fingerprint, continuous drift monitoring, and evidence exports.ISO/IEC 42001 Readiness
The honest fine print: these are platform capabilities designed to support a compliance program, not substitutes for one. Contractual items such as BAAs and zero-data-retention agreements with model providers remain the deploying organization's responsibility.

Sensitive Data Controls

SAFi can block sensitive personal and financial identifiers before they reach a model and before a response containing one is delivered. Detection is deterministic code — three of the four checks are verified by arithmetic checksums so anyone holding the audit record can recompute the verdict.

CheckValidationExample detected
Payment card numbersLuhn (mod 10)4111 1111 1111 1111
IBANISO 13616 mod-97GB82WEST12345698765432
Bank routing numbers (ABA)3-7-1 weighted checksum021000021
US social security numbersSSA allocation rules, formatted only123-45-6789

Every check is off by default and enabled per identifier under Settings → Organization → AI Standards. When a turn is blocked, the identifier is removed from the governance record in full while recording which check fired and at which stage.

Read the sensitive data controls documentation

Roles & Permissions

SAFi enforces four organization-scoped roles (admin > editor > auditor > member) with one deliberate separation-of-duties exception: editors cannot perform supervisory review. Because editors author agents and policies, FINRA 3110/3120 supervision requires an independent auditor or admin to sign off on turns.

Capabilitymemberauditoreditoradmin
Chat with org agents, use safi-cli , view own turn verdicts & governing Charter/PolicyYesYesYesYes
Audit Hub — KPIs, drift trends, log explorer, hash-chain verification, export—YesYesYes
Supervisory review — sampled queue, dispositions, coverage reports—Yes—Yes
Authoring — create/edit agents, policies, versions, tools, and Policy API keys——YesYes
Org administration — members, SSO/SCIM, MFA mandate, retention, legal hold, provider allow-list, examiner exports———Yes
  • Organization scoping: Enforced in both API routes and SQL queries.
  • Immediate session revocation: Role changes revoke active sessions and journal the change in the same transaction.
  • Supervisory separation: Reviewers cannot dispose of turns from their own conversations (enforced in the data layer).
  • See Enterprise Features and safi_app/core/rbac.py for full details and documented limitations.

For Developers

Working on the code or building integrations? Start with the Developer Guide, the Context Window Architecture (how SAFi budgets memory, history, and tool loops inside a 64k local context window), and the Governance Artifact Specification (field-by-field contract for per-turn records, conscience ledgers, tool-call entries, hash chain, and integrity stamps).

Releases

SAFi ships on a 12-week (quarterly) release cadence. For production, install a tagged release and pin its published TCB Fingerprint. See the Release Process.

License & Governance

SAFi is licensed under AGPL-3.0, with a Section 7 exception that keeps an organization's own charter, policies, tools, branding, and data fully private. The copyleft applies to the Core Loop, not to what you configure on top of it.

  • SAFi License & Governance Agreement
  • Verify a deployment: python scripts/verify_integrity.py recomputes the Core Loop's TCB Fingerprint against the release manifest and checks structural invariants.
  • The SAF License: the philosophy and framework are free to use with attribution.

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗