NOURI–IAERAU .COM — Modules

NOURI-IAERAU OS  ·  The Brain

NOURIIAERAU
The Brain

A dual-hemisphere orchestration engine that runs missions, generates and validates patches, logs its behavior, snapshots state, and can roll back — operating in manual, assist, or auto modes.

Not a chatbot. Not a prompt interface. The Brain is the execution and governance layer of the NOURI-IAERAU OS — a runtime that keeps the system alive, plans structured missions, constrains its own autonomy by file scope, and maintains a full audit trail of every action it takes.

For Builders · Technical Operators · AI-Curious Founders · OS Power Users

Enter the OS — $29 / Month Explore Brain Architecture →

Instant access  ·  All modules  ·  Cancel anytime  ·  Browser-based

BF-EW Workshop · PBA Module · Eye-Tech · Guest Life · All future modules included

NOURI
Consciousness evolution
Memory integration
Mission-driven task proposal
Event Bus
lib/brain/  ·  /api/brain/*
IAERAU
Autonomous code generation
Mission-aware execution
Client intelligence layer

Architecture

Built from
OS-grade
primitives

The Brain is not a wrapper around a language model. It is a governed orchestration engine composed of discrete, auditable subsystems — each with an explicit role, persistence layer, and safety gate.

At runtime, a brain bus receives signals from OS labs: mount · unmount · error · metric · action. These signals update active lab tracking, recent errors, and per-lab health metrics — giving the Brain live situational awareness of what is running and how it is performing.

NOURI periodically generates context suggestions when labs are active. IAERAU drives autonomous codegen and mission-aware execution. Together they form a runtime coordinator governed by explicit env flags and route guards.

NOURI Hemisphere
lib/brain/nouri.ts · lib/brain/hemispheres.ts
Consciousness evolution tracking, memory integration, mission-driven task proposal. The reflective hemisphere — accumulates context, proposes next actions from lab signals.
IAERAU Hemisphere
lib/brain/iaerau.ts · lib/brain/types.ts
Autonomous code generation and mission-aware execution. The active hemisphere — evaluates proposals, executes bounded missions, enforces governance gates.
Brain Singleton + Genesis Snapshot
lib/brain/initBrain.ts · lib/brain/snapshots/initBaselineSnapshot.ts
On startup: registers default missions, ensures a baseline "genesis" snapshot exists in Supabase. Anchors all rollback diffs and mission planning evolution tracking.
Dual Mission System
lib/brain/missions.ts · Supabase: brain_missions
Two layers: (A) runtime autonomy missions with lifecycle idle→active→cooldown, rate limits, and risk gates; (B) Supabase-backed planning missions with status new→in_progress→completed→rejected and hard UUID deduplication.
Codegen + Apply Pipeline
app/api/brain/codegen/ · app/api/brain/codegen/apply/
Generate staged patches → review → apply. Separate API calls, separate route guards. The Brain never auto-applies unless BRAIN_ALLOW_AUTO_APPLY=true and mission policy permits it.
Rollback Engine
lib/brain/rollback.ts · brain_rollback_snapshots
Snapshot-based recovery: resolves snapshot by ID, verifies existence, restores files, prunes forward codegen_history newer than the snapshot timestamp, logs rollback lifecycle to brain_logs.

Implemented Capabilities

What the Brain
Actually Does

Dual-Hemisphere Cognition
NOURI and IAERAU are separate roles with real coordination — not a single blob agent. Each has a defined function in the mission and execution lifecycle.
lib/brain/hemispheres.ts
Alive Mode Loop
The fully autonomous execution cycle — acquires distributed apply lock, selects eligible missions (max 3/loop), validates constraints, applies with rollback hooks, releases lock in finally.
app/api/brain/autonomy/loop/route.ts
Distributed Apply Lock
Prevents concurrent apply/rollback collisions during autonomous operation. Lock acquired before any mutation, released in finally block regardless of outcome.
Alive Mode · loop/route.ts
Mission Rate Limits + Risk Gates
Every mission defines allowed file roots, risk level, tasks/hour ceiling, dry-run enforcement, and doc auto-apply policy. Autonomy runs bounded missions — not unbounded tasks.
lib/brain/missions.ts · lifecycle: idle→active→cooldown
Constrained File Scope
Autonomy is bounded by explicit allowed roots — docs-only tier or code-tier. The Brain cannot write to arbitrary paths. Scope is part of mission policy, not an afterthought.
docs/ · .brain-sandbox/ · app/ · lib/ · components/
Snapshot + Rollback
Restore the system to a prior snapshot state and prune forward codegen_history. Genesis snapshot created at startup. Rollback is architecture — not a recovery afterthought.
lib/brain/rollback.ts · brain_rollback_snapshots
Kill Switch Layer
An ops emergency stop pattern (requireNotKilled) blocks filesystem apply routes at runtime. One call halts all mutation operations instantly.
lib/ops/routeGuards.ts · fs/apply/route.ts
Full Audit Trail
brain_logs records every event — brain_snapshots anchor rollback diffs — codegen_history persists every patch run — audit events log fs.apply operations for accountability.
brain_logs · codegen_history · audit events

Alive Mode

The Autonomy
Execution Cycle

When mode is set to auto, the Brain runs a complete Alive Mode loop on each cycle. This is not a simulation — it is a real execution chain with locks, constraint validation, rollback hooks, and structured logging at every phase.

The loop is bounded: maximum 3 missions per run. Mission selection is governed by eligibility — lifecycle state, rate limits, risk level, and allowed file roots must all align before a mission is selected. Nothing outside those constraints runs.

Optional capabilities — mission seeding, recurrence, feedback loops, and web tools — are flag-controlled. All disabled by default. The loop is designed to be extended, not assumed to do everything at once.

01
Acquire Distributed Apply Lock
Prevents concurrent apply/rollback collisions. Released in finally regardless of outcome.
loop/route.ts · distributed mutex
02
Run Autonomy Tick / Plan
Brain evaluates current state. Seeds missions if none exist (when flag enabled). Applies feedback from recent outcomes.
brain_missions · mission seeding flag
03
Select Eligible Missions (max 3)
Filters by lifecycle state, rate limits, risk gating, and allowed file roots. Bounded — not unbounded.
lib/brain/missions.ts · risk + root constraints
04
Validate Constraints + Apply with Rollback Hooks
File scope validated against mission's allowed roots. Rollback hooks registered before any write occurs.
routeGuards · lib/brain/rollback.ts
05
Persist Structured Logs for All Phases
Every phase — planning, selection, apply, rollback — logged to brain_logs with timestamps, outcomes, and subsystem attribution.
brain_logs · codegen_history · audit events
06
Release Lock
Distributed apply lock released in finally block. Next cycle can begin after cooldown.
loop/route.ts · cooldownMs · brain_state autonomy_control

Autonomy Control

Three Modes.
One Persisted Switch.

Autonomy mode is a persisted state stored in Supabase brain_state under key autonomy_control. Switching modes requires admin access. It persists across sessions.

Mode 01
mode: "manual"
Manual
No autonomous loop action. Human-driven entirely. Generate proposals, review staged changes, apply explicitly. Nothing runs without direct instruction. Full visibility, zero surprise.
State: enabled: false or mode: "manual"
File: app/api/brain/autonomy/control/route.ts
Stored in brain_state.autonomy_control
Mode 02
mode: "assist"
Assist
Semi-autonomous support. Bounded tasks can run. The Brain assists — proposes, queues, supports — but apply still requires confirmation unless BRAIN_ALLOW_AUTO_APPLY is explicitly set. Implemented and UI-supported.
State: mode: "assist"
Codegen: BRAIN_CODEGEN_SEMI_AUTONOMOUS=true
Apply still gated unless BRAIN_ALLOW_AUTO_APPLY=true
Mode 03
mode: "auto"
Auto (Alive Mode)
Full autonomy. Alive Mode loop executes missions — generates, validates, applies within constrained file scope, logs everything, rollback hooks active. Admin access required to enable.
State: mode: "auto" + enabled: true
Gates: BRAIN_ALLOW_AUTO_APPLY=true
          BRAIN_ALLOW_FILE_WRITES=true
          admin route guard required

Safety Architecture

Explore Freely.
Rollback Always.

Autonomy is not a black box. Every mutation endpoint is admin-guarded, environment-gated, logged, and can be disabled instantly via kill switch. The Brain operates inside explicit file-scope constraints at all times.

The rollback engine can restore the system to any prior snapshot state and prune forward codegen_history newer than that snapshot timestamp. The Brain is allowed to be aggressive in its proposals because undoing is as structured as applying.

Note: File writing is disabled in Vercel serverless environments. When running on Vercel, the Brain operates in dry-run / read-only mode. File writes require a write-capable runtime (local or self-hosted).

Admin Route Guards
All autonomy + apply + rollback endpoints require admin role authentication. Public codegen available only when BRAIN_ALLOW_PUBLIC_CODEGEN=true — apply still admin-only.
Kill Switch (requireNotKilled)
Ops-level emergency stop blocks all filesystem apply routes at runtime instantly. One switch — all mutations halt. Implemented in lib/ops/routeGuards.ts.
Generate / Apply Separation
Codegen and apply are always separate API calls behind separate route guards. The Brain never conflates proposal with execution.
File Write Gate
BRAIN_ALLOW_FILE_WRITES must be explicitly true. Attempts without this flag throw — no silent fallback. Disabled on Vercel serverless automatically.
Auto-Apply + Auto-Heal Gates
BRAIN_ALLOW_AUTO_APPLY and BRAIN_ALLOW_AUTO_HEAL are separate explicit switches. Disabled by default. Architecture supports both — neither activates without permission.
Governance Summary
Live endpoint exposes all enabled gates, recent allow/block decisions from mission history, and current autonomy state. The Brain's logic is always inspectable.

Constrained Autonomy

The Brain
Knows Its Limits.

Tier 1 — Docs Only
Safe Exploration Mode
docs/ .brain-sandbox/
The most conservative tier. The Brain can generate and apply documentation changes and sandbox experiments. No production code paths touched. Default starting point for new autonomy configurations.
Risk: low · Default: dry-run unless doc auto-apply enabled by mission policy
Tier 2 — Code Tier
Governed Code Operations
app/ components/ lib/ hooks/ types/ config/ public/ styles/ scripts/ docs/ .brain-sandbox/ src/brain/
Expanded roots for code-tier autonomy. Every path is explicit — the Brain cannot write to paths not on this list. Admin + env gates required to activate this tier.
Risk: elevated · Requires: BRAIN_ALLOW_FILE_WRITES=true + admin + rollback active

Memory & Persistence

The Brain
Remembers.

brain_state
OS Persistent Memory
Authoritative state in Supabase — consciousness fields, relationship fields, autonomy_control mode. Write-gated. Reads never fallback silently. The durable mind state of the OS.
brain_logs
Event Audit Trail
Structured event log for every action — what happened, when, why, which subsystem triggered it. Full audit accountability from every mission run.
brain_snapshots
Genesis + Rollback Anchors
Baseline genesis snapshot created on startup. Subsequent snapshots anchor rollback diffs and mission evolution tracking. Each is a restorable state of the system.
codegen_history
Patch Run History
Every codegen run payload persisted. Rollback prunes forward history newer than snapshot timestamp — so the Brain's applied history is always consistent with its snapshot state.
brain_missions
Planning Mission Records
Supabase-backed planning missions with full status lifecycle and hard UUID deduplication — prevents duplicate missions across loops and reboots. Mission history accumulates into system intelligence.
prefs.ts + localStorage
Preference Learning
Local preference learning for BF-EW and OS settings — promotes frequently changed settings into defaults after repeated changes. A concrete, implemented learning mechanism running client-side.

Who This Is For

Operators.
Not prompt users.

Builders & Founders
You want AI assistance that operates your system with a real execution model — missions, locks, scope constraints, audit trail. Not a chat window suggesting edits.
Technical Operators
You need auditable logs, explicit safety gates, constrained file scope, and a kill switch. A governed engine you can inspect — not a black box you have to trust blindly.
AI-Curious Architects
You want to understand what a real production AI governance layer looks like. The Brain's dual-hemisphere model, mission persistence, and rollback rails are a reference implementation.
OS Power Users
You are already in the OS using BF-EW or PBA. The Brain is the intelligence layer tying everything together — persistent memory, structured autonomy, safety-first evolution across all modules.
"The Brain is allowed to explore because it is built to undo. Constrained file scope. Admin-gated apply. Distributed lock. Genesis snapshot. Rollback rails. This is what a governed intelligence layer actually looks like."

— NOURI–IAERAU OS  ·  Brain Architecture

A Governed
Orchestration Engine.
Built to Undo.

The NOURI-IAERAU OS gives you the Brain as the execution foundation — plus BF-EW Workshop for music production, PBA for campaign modeling, and every module built going forward. One subscription, full platform access, $29/month while the user base builds.

Enter the OS — $29 / Month

Instant access  ·  Full Brain + all modules  ·  Cancel anytime

BF-EW Workshop  ·  PBA Module  ·  Eye-Tech  ·  Guest Life  ·  All future modules

Note on file writes: the Brain operates in dry-run / read-only mode on Vercel serverless. File write operations require a write-capable runtime. Web research tools (AUTONOMY_WEB_TOOLS_ENABLED) disabled by default.