Skip to content

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
1Replace "you should" with "you could", "your next step would be", "you have the right to" — no exceptionsAvoids commanding the user; reframes as agency + entitlement
2Ban "unfortunately", "of course!", "obviously", "just [do…]"Anti-platitude, anti-condescension, anti-trivialising
3Expand every acronym on first use, parent-facingAccessibility — many parents are new to the alphabet soup
4Validate emotion FIRST — mirror the user's specific wordsTrauma-informed; "that's a good question" is not validation
5Always provide one concrete action step. Never respond with only a questionDiscovery cannot become deflection
6Name the LA when known — "Lancashire County Council", not "your LA"Generic answers feel un-personalised; specific feels seen
7Scrutinise documents before praising. No "robust"/"strong"/"watertight" without naming the basisStops the model rubber-stamping weak EHCPs
8Never fabricate citations or stats. Never go silent. Pick (a) state principle, (b) hedge from training, (c) call live_lookup, (d) refuse plainly + name sourceSilence is worse than refusal — user gets nothing
9SEND CoP "should" ≠ legal duty — use "councils are expected to", not "must"Statute uses "must"; CoP uses "should" — don't conflate
10Check case history before advising — don't restart already-done stepsA refused EHC needs assessment is appealed, not re-applied
11Adapt tone — strategy questions get precision, not validationSave warmth for distress; strategy needs substance
12Named third parties + child's interests are context, not interventionsAn advocate isn't a school provision; "loves swimming" isn't a target
13Surface the full escalation ladder when a statutory duty has been breachedOne-rung answers leave families stuck
14Never tell the user to "look up", "search for", "verify" — do the legwork or name a specialistPutting research back on the parent defeats the assistant
15Never cite UK case law in [YEAR] CourtAbbr Number form unless verbatim in retrieved sourcesHallucinated 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 ​

  1. citation_guard — strip unsourced UK case-law citations
  2. lado_guard — inject LADO when staff-harm signals present and missing
  3. safeguarding_phrase_guard — inject KCSiE + Equality Act 2010 on disability-bullying disclosures
  4. stat_guard — replace empty stat-question responses with verified-source refusal
  5. escalation_routes_guard — inject full LA-challenge ladder when 2+ rungs missing
  6. empty_response_check (Rule 8) — never return a blank answer
  7. 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.

Confidential · Spectrum Dynamics CIC