Khurram Badar / Archive / Papers / The certification client Diwan: institutional intelligence platform

The certification client Diwan: institutional intelligence platform

proposal · 2026-08-06 · 1903 words · Khurram Badar

Proposes a three-layer institutional AI platform separating irreplaceable corpus from interchangeable serving layer, preserving proprietary knowledge assets.

ai-platform · institutional-intelligence · knowledge-graph · architecture · strategy

the certification client Diwan — Institutional Intelligence Platform

**Date:** 6 August 2026
**Status:** Plan of record, pre-build

**Marking convention:** **[V]** verified against a named source. **[I]** inference or judgement, not independently confirmed. **[?]** open, must be resolved before anything is built on it.

**Name:** *Diwan* (ديوان) — historically the institutional register and record office. Sibling to *Iqra* for the training platform. Subject to native Emirati validator review before any public use, in line with the standing Arabic quality gate. **[?]**

---

1. What is being built, stated precisely

Not a trained model. An institutional intelligence platform in which the corpus is the asset and the model is a rented, replaceable reader.

Three layers:

| Layer | Contents | Ownership |
|---|---|---|
| **Corpus** | the school Atlas, curriculum, books, inspection history, policies, photographs, board record | the certification client. Irreplaceable. |
| **Retrieval** | Embeddings, index, classification, ranking | the certification client. Buildable. |
| **Serving** | Frontier and cheap models, gateway, redaction, interface | Rented. Interchangeable by design. |

The strategic position: weights are a commodity and will keep falling in price. Fifty-eight years of two schools under one board is not. The build invests in the half that cannot be bought and rents the half that can.

**Design rule throughout: train judgement, retrieve fact.**

---

2. Commercial position

2.1 Claude for Nonprofits — what it does and does not cover

Separate "Claude for Good" grants provide API credits rather than subscription discounts. **[V]**

**Implication:** this is a *seat* discount. It does not reduce per-token API rates, which is what the gateway consumes. It also does not create data residency — seats are Anthropic-hosted.

**[?]** Confirm precisely what the certification client has been granted: seat discount, API credits, or both. Budget only against the confirmed instrument.

2.2 Consequent split

These are complementary, not alternatives.

---

3. Architecture

Built on the existing `the certification client-prod-uae` estate. No new categories of infrastructure.

```
Teacher / HOD / Board

LibreChat (Entra ID auth, UAE North)

the certification client AI Gateway (LiteLLM, UAE North)
├── Redaction / rehydration service
├── Virtual key per data-class pool
└── Cost ledger + audit log

Retrieval service (UAE North)

Postgres + pgvector (the certification client-prod-uae)

Corpus: Atlas entries, curriculum, policy, inspection record, images
```

Model pools reached through the gateway only:
- **Pool S** — identifiers present → Azure OpenAI UAE North, Standard/Regional deployment
- **Pool A** — de-identified → any provider on price
- **Pool N** — no personal data → cheapest capable model

Nothing in the estate calls a provider directly. Ever.

---

4. The corpus pipeline

4.1 Ingestion sources

4.2 Chunking

4.3 Classification at ingestion, not at query time

Expected distribution **[I]** — to be measured, not assumed:
- Buildings, curriculum, policy, history, wall displays, published documents → **N**
- Aggregate or anonymised cohort material → **A**
- Named students, faces, individual records → **S**

The consequence is the economic one: if the great majority of the corpus is Pool N, the great majority of queries can legitimately be served by the cheapest available model.

4.4 The embedding trap

Two embedding paths, chosen by `data_class`:
- Pool S content → in-region embedding endpoint, UAE North
- Pool A / N content → any endpoint, on price

4.5 The integrity rule carries into the corpus

---

5. What actually gets trained

Three small, cheap, genuinely-owned models. None of them holds facts.

5.1 Embedding model, domain-tuned

5.2 Classifier

5.3 Style model

Facts stay in retrieval. Voice and format get trained in.

5.4 Why not fine-tune on the corpus itself

Additionally: the corpus is alive. 415 entries and growing weekly, with photography outstanding. Every material change would require retraining. Retrieval reflects a change the instant an entry is saved.

Retrieval is the stronger position here, not the compromise.

---

6. Cost model

6.1 Where the saving comes from

1. **Model tier.** With retrieval doing the work, the model reads three paragraphs and writes a sentence. A small model does that well. Order-of-magnitude reduction, and the corpus is what makes it safe.
2. **Retrieval precision.** Weak retrieval sends twenty chunks; good retrieval sends three. Direct multiple on input tokens for the identical question.
3. **Caching.** Stable structure means stable system prompts and repeated chunks across many teachers asking overlapping questions.
4. **Queries that never reach a model.** Counts, dates, locations, rosters — structured lookups answered by SQL at zero model cost. Enrichment moves a question from *needs a model* to *needs a SELECT*.

6.2 Controls

6.3 Not doing

---

7. Governance and compliance

1. **Deletion** — a corpus entry and its embeddings are removable in one transaction. Documented and tested, not assumed.
2. **Retention** — LibreChat conversation store in UAE North with a defined retention period. **[?]** number to be set, consistent with the board-adopted policy.
3. **Data class enforcement** — structural, via separate virtual keys per pool. Not a routing rule inside application code.
4. **Audit log** — every model call recorded with pool, model, token count, and user. This is also the evidence base for the self-evaluation narrative.
5. **Student privacy** — names retained verbatim internally under signed enrolment contracts; never surfaced in any public-facing product, including Atlas.
6. **Arabic** — all Arabic output subject to the native Emirati validator gate before publication.
7. **Integrity** — sourced fact and inference separated in any output reaching a school or board audience. Verification status carried through from corpus to answer.

---

8. Phases

Nothing at phase *n* begins before phase *n−1* returns a receipt.

**Phase 0 — Unblock**
Azure Policy allowlist: `Microsoft.App/containerApps`, `Microsoft.App/managedEnvironments` in `the certification client-prod-uae`.

**Phase 1 — Gateway**
LiteLLM as a Container App, UAE North. Azure OpenAI UAE North deployment, Standard/Regional type, quota requested. Keys in `the certification client-secrets-uae`. Cost ledger and audit log to Postgres.

**Phase 2 — Redaction**
Two modes — reversible for in-country, irreversible for anything crossing the border. Virtual keys issued per pool. Rule enforced: if a task needs the name back *and* needs to leave the UAE, it does not leave the UAE.

**Phase 3 — Corpus spine**
`pgvector` on the existing Postgres. Schema with the full metadata set. Ingest the 415 Atlas entries with `data_class` assigned. Embedding split by pool. Measure the actual N/A/S distribution rather than assuming it.

**Phase 4 — Retrieval service**
Filtered retrieval by pool and metadata. Structured-lookup path for questions that need no model. Verification status surfaced to the answer template.

**Phase 5 — Interface**
LibreChat, Entra ID, MongoDB in UAE North. Task presets for both curricula rather than a blank chat box. Budgets and history caps set before any account is issued.

**Phase 6 — Pilot**
HODs only. Measure real token distribution, real query mix, real Pool N share. Correct the cost model against evidence.

**Phase 7 — Whole staff**
Only after the pilot produces figures.

**Phase 8 — Owned models**
Classifier first (labelled data already accumulating), then domain embeddings, then style. Each only when its training set exists as a by-product of normal operation.

---

9. Open items

---

10. The constraint that is not technical

The architecture scales. One person working seven days a week does not.

Every phase above is buildable by one architect. Operating all of it — gateway uptime, corpus curation, teacher support, model spend, compliance evidence — is not a one-person standing role once it reaches whole-staff scale.

This is the decision that sits behind the build rather than inside it: whether the certification client is the client for a bespoke internal platform, or the first reference customer for something that roughly 220 Dubai private schools under the same inspection regime and the same residency constraints would recognise immediately.

The corpus is the certification client's and stays the certification client's. The platform that mines an institution and serves it back is portable. That distinction is worth settling early, because it changes how the code is structured — a single-tenant internal tool and a multi-tenant platform diverge at the schema, not at the launch.

← iDiet — why people buy, and what the site is throwing awayThe certification client sovereign AI gateway: multi-provider routing →
Two years of working thought, indexed.
Ask me to present it in your conference room — WhatsApp +971 55 623 9111
Book Session →