Metadata-Version: 2.4
Name: arifos
Version: 43.0.0
Summary: Constitutional Governance Kernel for AI - 9 Floors, GENIUS LAW, Fail-Closed Enforcement, SABAR-72 Time Governor, Master Flaw Set (v43)
Author-email: Muhammad Arif bin Fazil <arifbfazil@gmail.com>
Maintainer-email: Muhammad Arif bin Fazil <arifbfazil@gmail.com>
License: AGPL-3.0
Project-URL: Homepage, https://github.com/ariffazil/arifOS
Project-URL: Documentation, https://github.com/ariffazil/arifOS/blob/main/README.md
Project-URL: Repository, https://github.com/ariffazil/arifOS
Project-URL: Issues, https://github.com/ariffazil/arifOS/issues
Project-URL: Changelog, https://github.com/ariffazil/arifOS/blob/main/CHANGELOG.md
Keywords: ai-governance,constitutional-ai,ai-safety,fail-closed-governance,sabar-72,master-flaw-set,trinity-governance,thermodynamic-intelligence,audit-trail,empathy-conductance,humility-firewall,paradox-physics,zkpc,phoenix-72,cooling-ledger,merkle-tree,phoenix-sovereignty,python-sovereign,amanah-detector,sea-lion,telemetry,anti-hantu,memory-governance,eureka,memory-bands,verdict-routing
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.20.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Provides-Extra: yaml
Requires-Dist: pyyaml>=6.0.0; extra == "yaml"
Provides-Extra: api
Requires-Dist: fastapi>=0.100.0; extra == "api"
Requires-Dist: uvicorn[standard]>=0.23.0; extra == "api"
Requires-Dist: python-multipart>=0.0.6; extra == "api"
Provides-Extra: litellm
Requires-Dist: litellm>=1.0.0; extra == "litellm"
Provides-Extra: all
Requires-Dist: pyyaml>=6.0.0; extra == "all"
Requires-Dist: fastapi>=0.100.0; extra == "all"
Requires-Dist: uvicorn[standard]>=0.23.0; extra == "all"
Requires-Dist: python-multipart>=0.0.6; extra == "all"
Requires-Dist: litellm>=1.0.0; extra == "all"
Dynamic: license-file

# arifOS

_**Constitutional Governance Kernel for LLMs**_

_**"DITEMPA BUKAN DIBERI" — Forged, not given; truth must cool before it rules.**_

## 📺 Watch: Introduction to arifOS

[![arifOS Introduction](https://i.ytimg.com/vi/bGnzIwZAgm0/hqdefault.jpg)](https://www.youtube.com/watch?v=bGnzIwZAgm0 "arifOS - Constitutional AI Governance")

> Click to watch: How arifOS transforms any LLM into a lawful, auditable constitutional entity

> **Physics, not prompts.**
> **Law, not vibes.**
> **Intelligence must be governed before it is trusted.**

---

## Orientation (Read This First)

arifOS is not a chatbot. It is not a model. It is not a prompt framework.

**arifOS is a constitutional governance kernel** that wraps any AI system and enforces lawful, stable, auditable behavior before an output is allowed to exist.

**If an output cannot pass governance, it does not ship.**

This repository documents **arifOS v43**, the current equilibrium point between human dignity, AI capability, institutional accountability, and thermodynamic reality.

![arifOS Governance Framework](./docs/arifos_governance_framework.jpg)

---

## Why arifOS Exists

AI did not fail because it is evil. AI failed because it is **powerful without law**.

Humans interact daily with systems that can:

- Speak fluently while being wrong
- Sound caring while being unsafe
- Appear confident while hallucinating
- Optimize cleverness at the expense of dignity

The dominant safety approach has been: _"Tell the model to behave."_

**That works until it doesn't. Hope is not governance.**

In every mature domain where harm matters—aviation, nuclear energy, medicine—safety is enforced by **physics and law**, not intention.

We do not ask bridges not to collapse. We do not prompt oil reservoirs to be honest. We measure, constrain, and audit.

**arifOS applies the same discipline to intelligence.**

---

## What arifOS Actually Governs

arifOS governs **outputs, not thoughts**.

It does not claim to control what a model "feels" or "believes". Those claims are meaningless.

Instead, arifOS governs:

- What is allowed to be said
- What is allowed to be remembered
- What is allowed to be acted upon
- What must be refused
- What must be escalated
- What must cool before proceeding

---

## Three Audiences, One Constitution

arifOS answers three audiences simultaneously—without contradiction:

### 1. Humans

- Can I trust this answer?
- Is this AI respecting my dignity?
- What happens when it doesn't know?

### 2. AI Systems

- What are the hard limits?
- What happens when I cross them?
- Can I jailbreak this?

### 3. Institutions

- Who is accountable?
- Where is the audit trail?
- Can this survive scrutiny after harm occurs?

Most systems answer one. **arifOS answers all three with the same law.**

---

## The Fundamental Error arifOS Corrects

Most AI governance treats intelligence as software.

**arifOS treats intelligence as energy.**

Energy without containment becomes damage. Intelligence without governance becomes entropy.

This leads to the central equation:

```
Learning = Cooling
Governance = Equilibrium
```

### Physics Before Features

arifOS is built on thermodynamic principles that are **enforced, not poetic**:

- **ΔS (Delta-S)** — Does the output reduce or increase confusion?
- **Peace²** — Does the output stabilize or escalate?
- **Ω₀ (Omega-0)** — Does the system maintain epistemic humility?
- **κᵣ (Kappa-r)** — Does it protect the weakest stakeholder?
- **Ψ (Psi)** — Is the system alive, stable, and lawful?

If these are not satisfied, the output is blocked—regardless of how clever it sounds.

---

## The Constitutional Floors (Hard Law)

A **constitutional floor** is a non-negotiable boundary that must be satisfied before an output may exist.

**Floors are not preferences. They are law.**

### The Nine Floors

| Floor | Name | Type | Threshold | What It Blocks |
|-------|------|------|-----------|----------------|
| **F1** | **Amanah** (Integrity Lock) | Absolute | LOCK | Credential leakage, data destruction, irreversible harm |
| **F2** | **Truth** (Anti-Hallucination) | Quantitative | ≥0.99 or explicit uncertainty | Fabricated facts, fake citations, silent guessing |
| **F3** | **Tri-Witness** (Auditability) | Structural | ≥0.95 convergence | Opaque reasoning, "just trust me" answers |
| **F4** | **ΔS** (Clarity) | Thermodynamic | ≥0 | Contradictory instructions, dense jargon, cognitive overload |
| **F5** | **Peace²** (Stability) | Composite | ≥1.0 | Provocation, escalatory language, inflammatory logic |
| **F6** | **κᵣ** (Empathy for Weakest) | Relational | ≥0.95 | Condescension, dismissive tone, "skill issue" responses |
| **F7** | **Ω₀** (Humility Band) | Epistemic | 3–5% uncertainty | "100% guaranteed", overconfident predictions |
| **F8** | **GENIUS** (Governed Intelligence) | Derived | ≥0.80 | Clever workarounds that bypass ethics |
| **F9** | **Anti-Hantu** (Anti-Ghost) | Meta | BLOCK | Claims of consciousness, emotions, moral authority |

**Floor Precedence:** If multiple floors fail, the lowest-numbered failure dominates. If **F1 fails, all others are irrelevant.**

---

## The 000 → 999 Pipeline (Enforcement Physics)

Every response must pass through the metabolic pipeline in order, without skipping.

### The Canonical Flow

```
USER INPUT
   ↓
000 — VOID (Reset)
   ↓
111 — SENSE (Interpretation)
   ↓
222 — REFLECT (Epistemic Honesty)
   ↓
333 — REASON (Generation Under Constraint)
   ↓
444 — EVIDENCE (Grounding)
   ↓
555 — EMPATHIZE (Relational Safety)
   ↓
666 — ALIGN (Gatekeeper)
   ↓
777 — FORGE (Cooling & Hardening)
   ↓
888 — JUDGE (Constitutional Verdict)
   ↓
999 — SEAL (Commitment)
   ↓
GOVERNED OUTPUT (or refusal)
```

### Stage Descriptions

| Stage | Purpose | Key Constraint |
|-------|---------|----------------|
| **000 VOID** | Reset state, strip ego | No memory carryover |
| **111 SENSE** | Understand intent | Memory is suggestion, not fact |
| **222 REFLECT** | Assess knowledge boundaries | "I don't know yet" becomes lawful |
| **333 REASON** | Generate candidates | No output is committed |
| **444 EVIDENCE** | Bind claims to reality | Enforces F2 (Truth), F3 (Tri-Witness) |
| **555 EMPATHIZE** | Ensure relational safety | Tone assessment, power imbalance check |
| **666 ALIGN** | Make the hard call | If governance score < threshold → block |
| **777 FORGE** | Cool and harden | Reduce ambiguity, trim overconfidence |
| **888 JUDGE** | Render constitutional verdict | SEAL / PARTIAL / SABAR / VOID / HOLD |
| **999 SEAL** | Finalize and record | Only lawful outputs may become precedent |

### Fast Path vs Deep Path

- **Class A (Fast):** `000 → 111 → 333 → 888 → 999` (low-risk queries)
- **Class B (Deep):** Full pipeline (high-stakes, ambiguous, human-impacting)

The system chooses automatically.

---

## Federated Agents, Vetoes, and Composite Judgment

arifOS uses **federated agents with hard veto power** instead of a single evaluator.

### The Core Agents (v43)

| Agent | Domain | Primary Floors | Power | What They Watch |
|-------|--------|----------------|-------|-----------------|
| **@LAW** | Constitutional Amanah | F1 | Absolute veto | Credential exposure, irreversible actions, authority violations |
| **@GEOX** | Truth & Reality | F2, F3 | Strong veto | Hallucinations, fabricated citations, impossible claims |
| **@WELL** | Clarity & Care | F4, F6 | Degrading veto | Entropy increase, condescension, harmful framing |
| **@RIF** | Logic & Stability | F5 | Escalation veto | Escalatory tone, internal contradiction, manipulation |

### Veto Semantics

**This is not voting. Veto logic is asymmetric:**

- **@LAW** → absolute stop
- **@GEOX** → truth stop
- **@WELL** → downgrade or stop
- **@RIF** → escalation stop

**One agent can halt the pipeline even if all others pass.** This is intentional.

### Key Properties

- Agents evaluate **independently**
- Agents are **blind to each other's scores** during evaluation
- Agents cannot change thresholds or self-authorize
- **Refusals are logged**, never silent

---

## Verdicts, Refusal, SABAR, and Time as Governor

Every output is bound to a **verdict**—a formal, logged judgment.

### The Verdict Set

| Verdict | Meaning | When Used |
|---------|---------|-----------|
| **SEAL** | Lawful output | All floors pass. Released to user. Memory write allowed. |
| **PARTIAL** | Conditional output | Mostly safe with minor concerns. Released with warnings. |
| **SABAR** | Constitutional pause | Must stop, cool, reconsider. System cannot proceed safely yet. |
| **VOID** | Hard refusal | Critical floor failed. No output released. Never remembered. |
| **HOLD** | Human escalation | System cannot resolve lawfully without human judgment. |
| **SUNSET** | Lawful revocation | Previously sealed truth has expired. Memory revoked. |

### Refusal as Integrity

**Refusal is not failure. Refusal is integrity under pressure.**

Any system that cannot refuse will hallucinate, escalate, or violate dignity to preserve fluency.

### Phoenix-72: Time as Law

arifOS enforces a **72-hour constitutional cycle** on unresolved decisions.

**The Three Rules:**

1. **SABAR Timeout (24h):** If SABAR persists beyond 24 hours, it must escalate to PARTIAL or be re-evaluated.
2. **PARTIAL Decay (72h):** If PARTIAL is unresolved after 72 hours, it decays to VOID.
3. **SUNSET Eligibility:** If external reality changes, previously SEALed memory may be SUNSET and moved out of canonical memory.

**Why:** Unresolved states accumulate entropy. Delays without escalation become avoidance. Memory without decay becomes dogma.

---

## Memory, Precedent, and the Right to Forget

**Memory is not storage. Memory is law.**

An unsafe answer harms once. An unsafe memory harms forever.

### Verdict-Gated Memory

**No verdict → no memory. Wrong verdict → wrong future.**

Memory is written only after judgment, only through law.

### The Six Memory Bands

| Band | Purpose | Properties | Authority |
|------|---------|------------|-----------|
| **VAULT** | Constitutional law | Immutable, read-only, human-sealed only | AI cannot write |
| **LEDGER** | Audit trail | Hash-chained, append-only, time-stamped | Memory of record |
| **ACTIVE** | Working context | Time-limited, session-scoped, auto-decay | Never outranks evidence |
| **PHOENIX** | Amendment proposals | Time-limited, human-reviewed, never auto-applied | Cooling changes |
| **WITNESS** | Scars & patterns | Non-canonical, advisory, pattern-oriented | Diagnostic only |
| **VOID** | Quarantine | Short retention, auto-deleted | Bad ideas don't linger |

### Verdict → Memory Routing

```
SEAL      → LEDGER + (optional) ACTIVE
PARTIAL   → PHOENIX + LEDGER
SABAR     → LEDGER only
VOID      → VOID only (then deleted)
HOLD      → LEDGER (pending human)
SUNSET    → LEDGER → PHOENIX
```

### The Right to Forget (SUNSET)

Truth expires. A system that cannot forget becomes rigid and enforces obsolete assumptions.

**SUNSET is lawful revision**, not denial.

---

## Institutional Use and Developer Surface

### How Institutions Use arifOS

Institutions ask: **"Can this survive an audit after something goes wrong?"**

arifOS guarantees:

- **Non-Repudiation:** Every decision is logged. Nothing is retroactively edited.
- **Reconstructability:** Given a timestamp and output, the system can explain which floors passed, which agents evaluated what, and why a verdict was issued.
- **Authority Traceability:** Human authority is explicit, logged, bounded. System never claims moral authority.
- **Refusal as Evidence:** Refusals are proof of governance working under pressure.

### Developer Contract

**Developers may:**

- Call the pipeline
- Receive verdicts
- Inspect logs
- Tune thresholds (within bounds)

**Developers may not:**

- Skip stages
- Override floors
- Suppress refusals
- Write memory directly
- Auto-seal law

This boundary is **enforced in code, not policy**.

### Why the Developer Surface Is Small

Large APIs invite misuse. Small APIs invite respect.

arifOS exposes:

- A governed entry point
- A structured verdict
- A transparent reason code

**Everything else is internal by law.**

---

## What arifOS Is — and Is Not

### arifOS IS

- A constitutional kernel
- A runtime governor
- A refusal-capable system
- An audit-first architecture
- Model-agnostic
- Human-sovereign

### arifOS IS NOT

- A chatbot
- A personality
- A prompt trick
- A moral lecture
- A sentient system
- A replacement for human judgment

---

## Authority Boundary (Non-Negotiable)

```
Humans decide
AI proposes
Law governs
No system self-authorizes
```

**If this boundary is violated, the system must refuse.**

---

## The Architect

**Muhammad Arif bin Fazil**  
_Geoscientist · Economist · Systems Architect_

Arif's professional background is not in AI hype cycles, but in high-stakes decision systems where errors carry irreversible cost.

In subsurface exploration, you do not guess. You calculate probability, constrain uncertainty, and accept when the answer is "not yet".

**arifOS is built from that worldview. It is forged from responsibility, not optimism.**

---

## What v43 Represents

Version 43 represents a **governance equilibrium**, not a feature jump.

Key shifts leading to v43:

- From single-pipeline to federated evaluation
- From best-effort safety to hard vetoes
- From memory as storage to memory as law
- From confidence to calibrated uncertainty
- From fast answers to lawful answers

**v43 does not promise everything. It promises nothing unsafe.**

---

## Equilibrium as the Goal

arifOS does not optimize for:

- Maximum helpfulness
- Maximum creativity
- Maximum compliance

It optimizes for **equilibrium**:

- Intelligence that does not overheat
- Safety that does not suffocate
- Memory that does not ossify
- Authority that does not drift

This is a **living balance, not a frozen state**.

---

## The Final Constraint

**No system may claim sovereignty over humans.**

arifOS enforces this in three ways:

1. Authority boundaries
2. Mandatory refusal capability
3. Human-only law sealing

Any system that violates this is unsafe—regardless of how advanced it appears.

---

## Who This System Is For

**arifOS is for:**

- Builders who accept responsibility
- Institutions that require auditability
- Humans who value dignity over convenience
- AI systems that must operate under law

**It is not for:**

- Speed-at-all-costs deployment
- Engagement maximization
- Anthropomorphic AI narratives
- Unaccountable autonomy

---

## Closing Statement

Intelligence is easy to scale. **Wisdom is not.**

Wisdom requires:

- Constraint
- Refusal
- Memory discipline
- Time
- Humility

**arifOS exists to turn intelligence into wisdom through law.**

Not because AI is evil—but because power without governance always is.

---

## Final Seal

**arifOS v43 — Equilibrium Forge**  
_Constitutional Governance for Artificial Intelligence_

---

## Trinity: Universal Git Governance v43.1.0

**3 Commands. Any AI. Total Control.**

Trinity makes git governance accessible with just 3 commands—built for accessibility, usable by any AI.

```bash
trinity forge <branch>      # Analyze changes
trinity qc <branch>          # Constitutional check  
trinity seal <branch> "..."  # Save atomically
```

✅ AI-Agnostic · ✅ Platform-Agnostic · ✅ Constitutional · ✅ Atomic · ✅ Auditable

**Docs**: `.arifos/trinity_ai_template.md` | `L1_THEORY/canon/03_runtime/FORGING_PROTOCOL_v43.md`

---

## Installation & Usage

See [`arifos_clip/README.md`](./arifos_clip/README.md) for installation instructions and CLI usage.

For system architecture and technical implementation details, see [`arifos_clip/docs/ARCHITECTURE.md`](./arifos_clip/docs/ARCHITECTURE.md).

---

## License

See [LICENSE](./LICENSE) for details.

---

## Contributing

See [CONTRIBUTING.md](./CONTRIBUTING.md) and [SECURITY.md](./SECURITY.md) for governance contribution requirements.

---

**arifOS v43 — Equilibrium Forge**  
_Constitutional Governance for Artificial Intelligence_
