jnamaya/SAFi
GitHub: jnamaya/SAFi
Stars: 44 | Forks: 3
[](requirements.txt)
[](LICENSE)
[](https://safi.selfalignmentframework.com)
[](https://github.com/jnamaya/SAFi/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
# SAFi: Self-Alignment Framework Interface
## Table of Contents
- [The Problem](#the-problem)
- [Quick Start](#quick-start)
- [How SAFi Compares](#how-safi-compares)
- [How Does It Work?](#how-does-it-work)
- [Mathematical Specification](#mathematical-specification)
- [Benchmarks & Validation](#benchmarks--validation)
- [Technical Implementation](#technical-implementation)
- [Application Structure](#application-structure)
- [Configuration Reference](#configuration-reference)
- [Authentication Setup](#authentication-setup)
- [Permissions](#permissions)
- [Headless Governance Layer](#headless-governance-layer)
- [Agent Capabilities](#agent-capabilities)
- [Developer Guide](#developer-guide)
- [Manual Installation](#manual-installation)
- [Contributing](#contributing)
- [Live Demo](#live-demo)
- [About the Author](#about-the-author)
### The Problem
Your organization is deploying AI agents. Your legal and compliance teams are asking hard questions: What policies govern every response? Who audits the decisions? What happens when the model drifts, gets jailbroken, or gives advice it shouldn't?
The standard answer -- a system prompt and a hope -- is not an answer. The industry's next move was to wrap the model in more LLM calls to police itself: monolithic guardrails that are slow, expensive, and just as susceptible to adversarial prompts as the model they are trying to constrain.
There is a better way.
### What SAFi Is
SAFi is an open-source runtime governance engine that does not just watch what your AI does; it enforces, audits, and shapes every decision *before* it reaches a user. Think of it as the **separation of powers for AI agents.**
Instead of a single model trying to be smart, compliant, and ethical all at once, SAFi splits cognition into five specialized faculties -- each with a distinct job, each operating in its own security layer:
| Faculty | Role | Security Property |
| :--- | :--- | :--- |
| **Synderesis** | The constitution compiler: defines immutable rules and value weights. | Read-only after deployment. |
| **Intellect** | The generative engine: drafts responses and tool proposals. | Air-gapped from execution. |
| **Will** | The deterministic gatekeeper: pure Python, zero LLM. | Immune to prompt injection. |
| **Conscience** | The analytical auditor: scores every draft against rubrics. | Secondary validation layer. |
| **Spirit** | The long-term memory: detects drift using exponential moving averages. | Non-LLM mathematical integrity. |
ServerName your-domain.com
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
8. **Open** `http://localhost:5000` (or your server's domain).
## Live Demo
[safi.selfalignmentframework.com](https://safi.selfalignmentframework.com)
## About the Author
**Nelson Amaya** is a Cloud & Infrastructure IT Director and AI Architect specializing in Enterprise Governance and Cognitive Architectures. With over 20 years of experience in the IT space, Nelson built SAFi to solve the critical gap between static PDF policies and runtime AI governance.
- **Read the Philosophy:** [SelfAlignmentFramework.com](https://selfalignmentframework.com)
- **Connect on LinkedIn:** [linkedin.com/in/amayanelson](https://www.linkedin.com/in/amayanelson/)
- **Follow on X:** [@nelsonamaya_](https://x.com/nelsonamaya_)
- **Follow on Reddit:** [u/forevergeeks](https://www.reddit.com/user/forevergeeks/)