SAFi: Open-source runtime governance and OS sandboxing for AI agents SAFi launched an open-source runtime governance platform that enforces written policies on AI agent tool calls in real time and keeps a hash-chained audit trail across workstations. The system pairs a thin terminal client, safi-cli, with a central SAFi Governance Gateway that holds identity (SSO/LDAP/SCIM), RBAC and immutable policies, and sandboxes agents with Linux bubblewrap on Linux/WSL and Apple sandbox-exec on macOS so no agent can write outside its project workspace by default. SAFi says the full server can be self-hosted via Docker with MySQL in three steps, supports local llama.cpp/OpenAI-compatible models plus OpenAI, Anthropic, Gemini, Groq, Mistral, DeepSeek, Cerebras and Zhipu API keys, and can be tested against a live demo server in under two minutes. 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 → https://runsafi.com/assets/saficli demo.mp4 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 You can test safi-cli in under two minutes against the live demo server https://demo.runsafi.com , or self-host the entire SAFi governance server on your own machine with Docker. 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 1. 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 . 2. Sign in with a local account , type sso for Google/Microsoft browser login, or press Enter to paste a Policy API key sk-safi-... . 3. 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. 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 . SAFi Core runsafi.com https://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 https://runsafi.com/start . - 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. - 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 https://runsafi.com for current pricing. 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: | Agent | CLI Key | Governing Policy | What It Does | |---|---|---|---| | SAFi Coding Agent | software engineer | Software Policy | Inspects repositories, traces architecture, edits code, writes tests, and runs build/test commands locally. | | Security Engineer | security engineer | Security Engineer Policy | Runs authorized web/API assessments, OWASP Top 10 code audits, header/SSL/port checks, and defensive hardening. | | Systems Admin | sysadmin | Systems Admin Policy | Diagnoses servers, inspects services/logs/disk/firewalls, and manages Linux, Windows, Azure, and M365 fleets via SSH & tools. | - 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 https://github.com/jnamaya/SAFi/blob/main/docs/DEVELOPER GUIDE.md 9-the-evaluate-gateway to enforce policy and record hash-chained audit evidence without rebuilding your orchestration. 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. 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 . - 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 https://github.com/jnamaya/SAFi/blob/main/docs/DEVELOPER GUIDE.md and formalized in the SAFi Math Specification https://selfalignmentframework.com/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. | Field | What SAFi is designed to support | Readiness 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 https://github.com/jnamaya/SAFi/blob/main/docs/SEC COMPLIANCE READINESS.md | | EU AI Act | Limited-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 https://github.com/jnamaya/SAFi/blob/main/docs/EU AI ACT READINESS.md | | 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 https://github.com/jnamaya/SAFi/blob/main/docs/HIPAA READINESS.md | | 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 https://github.com/jnamaya/SAFi/blob/main/docs/DATA ERASURE AND RETENTION.md | | 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 https://github.com/jnamaya/SAFi/blob/main/docs/ISO 42001 READINESS.md | 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. 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. | Check | Validation | Example detected | |---|---|---| | Payment card numbers | Luhn mod 10 | 4111 1111 1111 1111 | | IBAN | ISO 13616 mod-97 | GB82WEST12345698765432 | | Bank routing numbers ABA | 3-7-1 weighted checksum | 021000021 | | US social security numbers | SSA allocation rules, formatted only | 123-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 https://github.com/jnamaya/SAFi/blob/main/docs/SENSITIVE DATA CONTROLS.md 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. | Capability | member | auditor | editor | admin | |---|---|---|---|---| | Chat with org agents, use safi-cli , view own turn verdicts & governing Charter/Policy | Yes | Yes | Yes | Yes | | Audit Hub — KPIs, drift trends, log explorer, hash-chain verification, export | — | Yes | Yes | Yes | | Supervisory review — sampled queue, dispositions, coverage reports | — | Yes | — | Yes | | Authoring — create/edit agents, policies, versions, tools, and Policy API keys | — | — | Yes | Yes | | 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 https://github.com/jnamaya/SAFi/blob/main/docs/ENTERPRISE FEATURES.md and safi app/core/rbac.py https://github.com/jnamaya/SAFi/blob/main/safi app/core/rbac.py for full details and documented limitations. Working on the code or building integrations? Start with the Developer Guide https://github.com/jnamaya/SAFi/blob/main/docs/DEVELOPER GUIDE.md , the Context Window Architecture https://github.com/jnamaya/SAFi/blob/main/docs/CONTEXT ARCHITECTURE.md how SAFi budgets memory, history, and tool loops inside a 64k local context window , and the Governance Artifact Specification https://github.com/jnamaya/SAFi/blob/main/docs/GOVERNANCE ARTIFACT SPECIFICATION.md field-by-field contract for per-turn records, conscience ledgers, tool-call entries, hash chain, and integrity stamps . SAFi ships on a 12-week quarterly release cadence . For production, install a tagged release https://github.com/jnamaya/SAFi/releases/latest and pin its published TCB Fingerprint . See the Release Process https://github.com/jnamaya/SAFi/blob/main/docs/RELEASE PROCESS.md . SAFi is licensed under AGPL-3.0 https://github.com/jnamaya/SAFi/blob/main/LICENSE , 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 https://github.com/jnamaya/SAFi/blob/main/docs/SAFi%20License%20%26%20Governance%20Agreement.md - 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 https://selfalignmentframework.com/license/ : the philosophy and framework are free to use with attribution.