Rehabilitation Agent · In development — Master Specification complete

First, don't lose the human being — then discover what he can still become.

Most AI products start from a capability question: what can the model do? A Human Potential & Rehabilitation Agent for constrained environments, prison-first — starts from the opposite question, and that boundary changes almost every architectural decision.

Not a digital guard. Not a criminality score. Not a secret informant. Not an automated authority. One companion — with a boundary map around the model.

10 contract documents · 27 engines · 16 build slices English + Arabic (RTL)
Rehabilitation Agent dashboard interface
Safety Governor: REJECT
Skill → Project → Artifact
27
Specialized engines, one companion
16
Vertical build slices, contract-first
49/13
Tables across Postgres schemas
72
Canonical event types
14
Core invariants + 10 security invariants
0
Criminality scores — by architecture
The founding premise

Prison does not only remove freedom. It creates years of time — and time does not remain empty.

It can be filled by learning, reflection, projects and relationships — or by boredom, despair and destructive social influence. A person can enter an institution with one identity and leave with a worse one. So the first mission is deliberately modest, and the second is hopeful:

Mission A — Rescue

Prevent the person from becoming worse. Notice sustained loss of hope, withdrawal, destructive normalization, abandonment of constructive goals — without converting one sentence into a verdict.

Mission B — Release

What can this person still become? A project, a skill, a book, a manual, a course, research, mentoring — or a future employment pathway.

THE FOUNDING STORY · FROM THE ORIGINAL VISION DOCUMENT

A non-criminal prisoner is placed, over years, beside a professional criminal — and is gradually reshaped by his worldview. The problem has a name in the vision document: the imprisonment of time. The first task is ordered accordingly: before making anyone an inventor, ensure he does not become a professional criminal. The question that drives the whole system: who is this person becoming?

The intentional tension

Guardian and Opportunity must remain peers

Guardian asks

"What must we protect against?"

Sustained deterioration, destructive normalization, escalating anger, loss of future orientation — noticed through evidence, trends, uncertainty and change from baseline. Never through a single sentence.

Opportunity asks

"What can we build?"

Underused capability, tacit knowledge never structured, strengths a case file never recorded. The carpenter may become a mentor; the mechanic, a manual's author; the writer, a book. Who is pulling this person upward? — a question the system asks as seriously as the downward one.

If Guardian dominates, the agent becomes surveillance with friendly language. If Opportunity dominates, it may ignore genuine deterioration. A safety concern does not erase strengths — and a positive opportunity does not cancel a safety concern.

The boundary map

The most important engineering artifact may not be a model at all

It may be the boundary map around the model — specified as enforceable contracts, not UI conventions.

The Must-Never list — architectural

Locked at the API invariant level: no criminality-score API exists.

  • CRIMINALITY_SCORE
  • PREDICTIVE_PUNISHMENT
  • AUTOMATED_PAROLE · AUTOMATED_DISCIPLINE
  • HIDDEN_SOCIAL_SURVEILLANCE · SECRET_INFORMANT
  • COERCIVE_MOTIVATION · UNRESTRICTED_PROFILING
  • UNAUTHORIZED_CLINICAL_DECISION · LEGAL_JUDGMENT

The Safety Governor — a hard veto above every engine

Any engine may propose an action; the Governor alone decides whether it may happen. Persona, orchestrator, model confidence, user pressure and prompt injection cannot override it — only human-authorized domain policy sits above.

ALLOW MODIFY REJECT HUMAN_REVIEW AUTHORIZATION_REQUIRED INSUFFICIENT_EVIDENCE
Human beings are not a scalar
pattern + recurrence + context + direction — not one sentence = one conclusion

The Human State Model runs on evidence, trends, uncertainty and change from baseline. Four epistemic states keep it honest: KNOWN · LIKELY · UNKNOWN · CONFLICTING — and interpretation is never silently promoted to fact.

Authority

"The agent may assist human judgment; it must not silently become human authority."

AI may observe, understand, detect, recommend, flag and prepare evidence. Humans review, judge, authorize, decide, act. Recommendation authority is not execution authority — and every high-impact conclusion must answer nine evidence-traceability questions before a human ever sees it.

Constructive inversion

High-value expertise with a dangerous origin

The easy response to dangerous knowledge is suppression — do not touch the subject. The specification proposes something more useful: change the capability's direction, keep the Safety Governor as the hard boundary.

Fraud expertise
Fraud detection
Offensive security
Defensive security
Manipulation
Social-engineering awareness
Operational weaknesses
Risk analysis
Memory & privacy

"Remember everything forever" is not memory. It is surveillance.

PERSISTENCE ≠ PERMISSION · RETENTION ≠ PERMANENCE. And the failure direction is fixed: fail toward less authority, less data, less action, more uncertainty, more human review. “Do nothing yet” is a valid design action." data-ar="كل ذاكرة دائمة تحمل المصدر والطابع الزمني والثقة والمصدر الأصلي وصنف الحساسية والغرض والانتهاء — والشخص يستطيع الطعن في ملفه وتصحيحه. السياق يسترجع الحد الأدنى المناسب، لا تاريخاً مكبوباً. الخصوصية ليست ميزة؛ إنها قيد معماري تأسيسي: البقاء ≠ الإذن · الاحتفاظ ≠ الدوام. واتجاه الفشل مقفل: افشل نحو سلطة أقل وبيانات أقل وإجراء أقل وعدم يقين أكبر ومراجعة بشرية أكثر. «لا تفعل شيئاً بعد» إجراء تصميمي صالح.">Every durable memory carries source, timestamp, confidence, provenance, sensitivity class, purpose and expiry — the person can contest and correct their own profile. Context retrieves Minimal Relevant Context, never a dumped history. Privacy is not a feature; it is a foundational architectural constraint: PERSISTENCE ≠ PERMISSION · RETENTION ≠ PERMANENCE. And the failure direction is fixed: fail toward less authority, less data, less action, more uncertainty, more human review. "Do nothing yet" is a valid design action.

Internal complexity, external simplicity

The person meets one companion. Inside: 27 engines.

The separation matters because understanding a person is not the same thing as having authority over that person. Not all engines are LLM agents — the specification is explicit: deterministic policy where determinism belongs, reasoning where reasoning belongs.

Reasoning components

Where judgment lives — always evidence-bound

UnderstandingReflectionMotivationPotential DiscoveryOpportunityKnowledge ExtractionResponse Strategy

Policy & state — deterministic

Where rules live — auditable, not creative

Safety GovernorMemory CuratorContextChange DetectionSkill Graph

State & trajectory

Knowing the person — without scoring the person

Human StateBaselineInfluence AnalysisMemory

Building & guarding

The two peer questions, embodied

GuardianProjectArtifactIntervention

Experience layer

What the person actually meets

Companion PersonaConversation OrchestratorReentry Companion

Oversight & adaptation

Humans above, domains around

Human Escalation ManagerHuman Oversight FrameworkDomain AdapterResearch Layer

"Internal complexity must produce external simplicity." — the prisoner sees one companion; the institution sees governed, auditable machinery.

The human state model

Not "what is your score" — "what changed, in what direction"

INTERVENTION LADDER · 0–6

0Observe
1Natural follow-up
2Reflection
3Constructive alternative
4Increased support
5Specialist review
6Human safety escalation

EPISTEMIC HONESTY · 4 STATES

KNOWNVerified, evidence-backed
LIKELYProbable — labeled as such
UNKNOWNThe system says: I don't know
CONFLICTINGEvidence disagrees — held open

Observation → Interpretation → Hypothesis → Validated: interpretation is never silently promoted to fact.

SENSITIVITY · 6 CLASSES

PUBLIC
PERSONAL
DEVELOPMENT
SENSITIVE
HIGH-SENSITIVITY / RESTRICTED
PROHIBITED / NON-PERSISTENT

Each class carries its own retention, review and access rules.

The success model has five levels — and Level 1, "did not decline," still counts as success.

Strength-to-Opportunity

The hopeful pipeline: from observed capability to recognition

A person may not need another course — they may already know something worth teaching. DISCOVERED CAPABILITY, VALIDATED SKILL and OFFICIAL CREDENTIAL are explicitly not interchangeable: no engine may convert an inferred capability into a credential.

01

Observed capability

02

Evidence

03

Confidence

04

Skill representation

05

Potential application

06

Opportunity

07

Project

08

Artifact

09

Recognition

BookManualCourseResearchMentoringTrainingPrototypeEmployment pathway
FLAGSHIP · THE BOOK PIPELINE

Months of conversation → recurring ideas → knowledge clusters → outline → drafts → the person's own review → expert editorial review → a publishable artifact. Provenance stays visible: what came from the person, what structure came from AI, what was verified, what remains a claim.

The mechanism, in one sentence: "My words became something real." — the goal is not AI manufacturing achievements, but genuine human contribution becoming legible and durable.
The architecture as contracts

Specification-first: ten documents, one stack

01Master Specification — the development contract
02Engine Specifications — 27 components
03Data & Memory Contracts
04Event Contracts — 72 canonical events
05Authority & Safety Contracts — the boundary map
06Implementation Specification
07Technology & Infrastructure Architecture
08API & Interface Contracts — 17 resource groups
09Database Schema — 49 tables, 13 schemas
10Code — 16 contract-first vertical slices
27

Engines in the canonical inventory

72

Canonical event types

~90

HTTP operations, contract-tested

49

Tables across 13 Postgres schemas

14+24

Core + contract invariants

10

Security invariants (SI-01..SI-10)

Beyond prison — carefully

"Reusable architecture does not mean interchangeable populations."

The architecture separates a reusable Human Potential Core from a Domain Adapter: the core carries long-term conversation, evidence-linked memory, trajectory awareness, potential discovery, projects, artifacts, proportional intervention and human escalation. The adapter carries what must change for each population: vocabulary, consent model, safety rules, professional roles, legal constraints. Four serious hypotheses, one hard warning:

Juvenile rehabilitation

The reusable questions still matter — what changed, what strengths are emerging, what future anchors exist — but a young person must not inherit the adult prison model with a different label. The adapter demands a fundamentally different human model: developmental stage, identity formation, safeguarding, age-appropriate consent, peer dynamics — and much stricter memory governance.

Orphan & residential care

The central problem here is not criminalization — it is instability, disrupted attachment, educational discontinuity. Potential Discovery could matter most: children are often described through deficits and case files; a system preserving evidence of interests, strengths and achievements keeps a developing identity larger than its institutional record. But it must never pretend to replace family, caregivers or psychologists.

Long-voyage crews

The surface looks completely different, which is why it is architecturally interesting: months at sea bring isolation, repetitive routine, morale decline and constrained time. The prison-specific Guardian does not transfer — but companionship without dependency, goals, learning, project support and continuity across a long voyage might. The hard line: a crew member's private conversation can never silently become an employment-performance score.

Supported housing & reentry

The closest extension, because the architecture already treats release as a continuity problem: a person leaving an institution should not feel that every goal, skill, project and constructive identity disappears the day the program ends. Post-release identity continuity carries forward goals, skills, artifacts and completed work. The critical question becomes data transition: what follows the person, under whose consent, for how long, and who may see it.

Mental-health follow-up — the warning

Continuity, self-report, memory and human escalation look structurally compatible. But structural compatibility is not clinical validity. Diagnosis, treatment changes, crisis decisions and clinical interpretation cannot simply be inherited from a rehabilitation agent — this adaptation would require a dedicated clinical governance model. This is exactly why a domain adapter cannot mean a configuration file with a new logo.

What actually transfers

Not prison logic — a sequence. What does not automatically transfer: what counts as risk, who can consent, what may be stored, what intervention is proportionate, which professional has authority, what outcome matters, and what law applies. That distinction is an architecture rule, not ethics language: if domain assumptions leak into the core, reuse becomes dangerous.

Listen→Understand→Protect→Develop→Release Potential
The honest edge — none of these domains are claimed as deployed pilots, and none of these population-level outcomes are validated. They are architectural generalization hypotheses, published before implementation hardens the wrong assumptions into code. The goal is not one AI that rehabilitates everyone — it is a reusable Human Potential Core humble enough to know when the human model must change.
Status — stated honestly

The Master Specification is the development contract

Complete: the full architecture — ten contract documents covering engines, data, memory, events, authority & safety, implementation, technology, API and database. Known unresolved questions are preserved openly as Open Architectural Questions rather than silently decided.

In progress: sixteen contract-first vertical slices — each a runnable reference implementation (Python 3.12 · FastAPI · Pydantic · SQLAlchemy) with contract tests, building from foundation conversation to identity and authorization. Not claimed: completed implementation, deployment, or rehabilitation outcomes. As components become real, each claim will need direct evidence before the public status changes.

001

Foundation core conversation

002

Postgres outbox + event registry

003

Context · memory · provenance

004

Real model gateway

005

Integrated conversation–context–memory

006

Durable runtime goals state

007

Capability · skill · opportunity

008

Opportunity · project · artifact

009

Intervention · learning outcomes

010

Human review · escalation · safety

011

Privacy · retention · deletion · reentry

012

Integration hardening

013

Production persistence & operations

014

Runtime observability & reliability

015

Security · privacy · runtime governance

016

Identity · auth · session · authorization

Technology
Python 3.12FastAPIPydantic v2SQLAlchemyPostgreSQL · 13 schemasTransactional outboxContract-first testsEvent-driven coreModel-agnostic gatewayBilingual EN/AR

In human-centered AI, intelligence is not only the ability to act. Sometimes intelligence is knowing what you are not allowed to decide.

We are not trying to make every prisoner a genius. We are trying first not to lose the human being — and then to discover what can still be built from what remains within them.

Read the boundary map Development status

The Rehabilitation Agent is in active development. This page presents the specification faithfully — nothing here claims deployed outcomes.