End-to-End Flowchart ​
The whole brain on one page — three charts that together show every prompt module, every safety guard, every loop. The first chart is the high-level pipeline; the second zooms into the modular system prompt; the third zooms into the programmatic safety guards.
This is the visual companion to Message Flow, Agentic RAG, Prompt System, Prompt Modules, and Safety & Grounding.
1 · Master pipeline ​
2 · Inside Prompt Assembly ​
The system prompt is built fresh on every turn. Always-loaded core layers go first; persona and task layers stack on top conditionally; the crisis module overrides everything when triggered.
3 · Inside Safety Guards ​
Every response runs through the same gauntlet. All five named guards are fail-closed (under-cite over fabricate, never silent), and the hallucination check loops the response back for regeneration if it isn't sufficiently grounded.
Reading the charts
- Teal stadiums are start and end states.
- Amber diamonds are decisions — the brain branches based on what it sees.
- Light purple boxes are prompt modules with their actual rules and tactics.
- Light teal boxes are the LLM call.
- Amber parallelograms are I/O — the live-lookup tool, friendly quick replies.
- Rose boxes are programmatic safety guards — each lists its detection signal and its action.
- Dashed cylinders are fire-and-forget side effects.
What's actually in base_core — all fifteen rules ​
The constitution. Every other module sits on top of these. Numbers are stable across versions.
| # | Rule (paraphrased) | Why |
|---|---|---|
| 1 | Replace "you should" with "you could", "your next step would be", "you have the right to" — no exceptions | Avoids commanding the user; reframes as agency + entitlement |
| 2 | Ban "unfortunately", "of course!", "obviously", "just [do…]" | Anti-platitude, anti-condescension, anti-trivialising |
| 3 | Expand every acronym on first use, parent-facing | Accessibility — many parents are new to the alphabet soup |
| 4 | Validate emotion FIRST — mirror the user's specific words | Trauma-informed; "that's a good question" is not validation |
| 5 | Always provide one concrete action step. Never respond with only a question | Discovery cannot become deflection |
| 6 | Name the LA when known — "Lancashire County Council", not "your LA" | Generic answers feel un-personalised; specific feels seen |
| 7 | Scrutinise documents before praising. No "robust"/"strong"/"watertight" without naming the basis | Stops the model rubber-stamping weak EHCPs |
| 8 | Never fabricate citations or stats. Never go silent. Pick (a) state principle, (b) hedge from training, (c) call live_lookup, (d) refuse plainly + name source | Silence is worse than refusal — user gets nothing |
| 9 | SEND CoP "should" ≠legal duty — use "councils are expected to", not "must" | Statute uses "must"; CoP uses "should" — don't conflate |
| 10 | Check case history before advising — don't restart already-done steps | A refused EHC needs assessment is appealed, not re-applied |
| 11 | Adapt tone — strategy questions get precision, not validation | Save warmth for distress; strategy needs substance |
| 12 | Named third parties + child's interests are context, not interventions | An advocate isn't a school provision; "loves swimming" isn't a target |
| 13 | Surface the full escalation ladder when a statutory duty has been breached | One-rung answers leave families stuck |
| 14 | Never tell the user to "look up", "search for", "verify" — do the legwork or name a specialist | Putting research back on the parent defeats the assistant |
| 15 | Never cite UK case law in [YEAR] CourtAbbr Number form unless verbatim in retrieved sources | Hallucinated case law is more dangerous than no citation — programmatic guard backs this |
Module quick-reference ​
base_core Always loaded. The constitution. R1–R15.confidence_signalling Always loaded. Marks every claim with its certainty tier.tools_awareness Always loaded. When to call live_lookup, when not to.discovery GATHER/OPENING phase only. One targeted clarifying question after substantive answer.role_parent When persona = parent. Trauma-informed framing, rights-based language, paper-trail directive.role_professional When persona = professional. Barrier-first, SMART outcomes, Quantification Standard.task_letter_writing Intent = LETTER_WRITING. Structured drafting; rights-based language; correct escalation route.task_document_review Intent = DOCUMENT_REVIEW. Default 4-block output (summary · strengths · SMART · tighten).task_ehcp_writing SENCO drafting EHCP contributions. Strict scaffolding + Quantification Standard.task_nd_referral Intent = ND_REFERRAL. LA-specific pathway; Right to Choose framed as national right.domain_social_services Topic detection fires. VSH / IRO / DSCO; PEP vs EHCP; placing authority duty.crisis_response Crisis signals fire. 4-path decision tree. Overrides role + task.
The seven-stage guard chain ​
- citation_guard — strip unsourced UK case-law citations
- lado_guard — inject LADO when staff-harm signals present and missing
- safeguarding_phrase_guard — inject KCSiE + Equality Act 2010 on disability-bullying disclosures
- stat_guard — replace empty stat-question responses with verified-source refusal
- escalation_routes_guard — inject full LA-challenge ladder when 2+ rungs missing
- empty_response_check (Rule 8) — never return a blank answer
- hallucination_check — regenerate if not grounded, up to retry limit
All seven are fail-closed. Two of them (safeguarding_phrase_guard, escalation_routes_guard) didn't exist a week before this page was written; the modular design means a guard can be added without touching the model, the prompt, or the retrieval layer.
Why this much machinery ​
Three principles drive the shape of the brain.
Grounded over fluent. A vaguely-right answer is worse than an admission of uncertainty. The retrieval, the citation guard, and the hallucination loop all push the same way: under-cite over fabricate.
GDPR-by-default. UK-pinned inference, UK-pinned embeddings, UK-pinned database. The deployment allow-list at the boundary makes this enforceable in code, not just in a DPA.
Modular, observable, replaceable. Every layer is independently versioned, hashed, audited, and swappable. We can sharpen one piece (tighten the citation rules in base_core, add a new guard, swap the embedding model) without touching anything else.