TN

TrueNorth AI

Design Spec: 17 Sept 2026

POC10 to Pilot-Ready Product Architecture · React 19 + Supabase + Cloudflare Pages

Target: Staging Pilot Delivery
Client Verification Checklist ↓
OFFICIAL SYSTEM DESIGN & ROADMAP

TrueNorth: POC10 to Pilot-Ready Product

Comprehensive implementation plan executing all six priorities from the Technical Brief. Decomposed into four focused sub-projects (SP1 – SP4), anchoring on our existing React 19 platform with 51 passing unit tests, backed by Supabase (ap-southeast-1) and static hosting on Cloudflare Pages.

Backend Topology
Supabase Edge
Postgres + Deno Functions (ap-southeast-1)
Identity & Privacy
Zero Child Login
Adult magic link; child is pseudonymous row
Context Observation
Free-Text Only
No rating scales; AI extracts direction at checkpoint
Content Policy
100% Hand-Written
Zero generative AI tasks (client rule)
SP1

Sub-Project 1: Parity Port (P0 — Client-Only React 19)

No External Dependencies

Port POC10 features into the modular React app on localStorage. Closes the gap from POC8 to POC10.

Ready to Execute First

Engineering Implementation Scope

  • Six-Capability Engine: Implement selectNextTask(tier, evidence, lastTaskId, capability). Six modular task libraries in src/core/tasks/ (one per capability, matching lighthouse-data.ts).
  • Five New Interactive Exercise Views: Following LighthouseExerciseView.tsx pattern and sharing EngineReadout:
    • Cognitive Flexibility: Second Way (option groups; same-group retry = not a switch) & The Rule Changed (sort rule flips unannounced at item 2).
    • Creative Thinking: Free-text prompts with pluggable judge() seam (12-word placeholder).
    • Emotional Intelligence: Stuck On Purpose riddles. Retry = correct:true; solving is not the measure.
    • Self-Expression: Free-text prompts with pluggable judge() seam (20-word placeholder).
    • Systems Thinking: Second-order consequence multiple choice.
  • Teacher Portal CRUD: Add student (name, age), soft-remove, restore, hard-delete with typed-name confirmation and delete log. Sonia marked demo-only.
  • Pure Evidence-Seeking Context Form: 16 parent & teacher questions tagged to capabilities. Pure free-text answers only—no diagnostic labels or rating pickers presented to adults (Program Flow P1, P2).
  • Code Hygiene & Policies: Strictly strip em dashes from all ported content. Fix known POC10 defects (remove broken Node require, avoid global window leakage).

What the Client Can Test & Verify on Staging

Full 6-Exercise Progression

Walk through each exercise. Verify the unannounced sort-rule flip in Cognitive Flexibility and retry mechanics in Emotional Intelligence record cleanly in EngineReadout.

Teacher Portal Lifecycle

Create a student, soft-remove them, view them in removed state, restore them, and execute a hard delete with typed confirmation. Verify Sonia remains pinned as demo data.

Evidence-Seeking Free Text Inputs

Fill out the parent and teacher context forms with authentic observational notes; verify answers save cleanly per role and child without any rating sliders.

SP2

Sub-Project 2: Infrastructure, Security & Child Safety (P1, P3, P5)

Supabase + Edge Functions

Password-gated hosted app, live AI intake report, Postgres database, adult accounts, and child safety safeguards.

Prerequisite: SP1

Engineering Implementation Scope

  • Supabase Database (ap-southeast-1): Create relational tables for profiles, students, evidence_instances, context_answers, checkpoints, and reports with RLS policies.
  • Adult Magic Link Identity (P3): Adults log in via passwordless magic link. Children have no logins or accounts—each child is a pseudonymous row owned by an adult profile with zero child PII.
  • Edge Password Gate (P1): Supabase Deno Edge Function (gate) checks shared password against GATE_PASSWORD secret, returning signed HMAC-SHA256 token (7-day expiry). Rotatable instantly without redeploy.
  • Secure Intake Claude Proxy: Edge function (intake-report) runs server-side Claude call using secret ANTHROPIC_API_KEY. Zero keys in browser bundle. Falls back to offline profile gracefully if API is down.
  • Child Safety Measures (P5):
    • Age verification: Adult attests age and ticks versioned consent checkbox when creating child profile.
    • AI disclosure: Clear, plain disclosure sentence on gate screen, onboarding intro, report, and Student View.
    • Content moderation: Automated moderation pass (moderate.ts) on all child-facing text. If flagged, safe fallback sentence is substituted and logged for adult review.
  • Offline Queue: SupabaseEvidenceStore queues events locally in localStorage when offline, auto-flushing on reconnect while computing tiers locally.

What the Client Can Test & Verify on Staging

Edge Password Gate

Visit staging in a clean Incognito session. Verify that no onboarding or student page is accessible without entering the shared password.

Zero API Keys in Browser Network

Complete the intake questionnaire and trigger report generation. Inspect DevTools: verify all AI calls go to Supabase Edge Functions with zero API keys exposed in payloads or source.

Cross-Device Persistence & Data Wall

Log in as teacher and create a student; log in as parent on another device. Confirm parent can answer context questions for their child, but cannot read teacher answers via RLS.

SP3

Sub-Project 3: Evidence to Report & Hypothesis Extraction (P2, P4)

Brief Highest-Value Item

Extract hypotheses from free-text answers via Claude, compute deterministic verdicts, and synthesize dynamic reports.

Prerequisite: SP2

Engineering Implementation Scope

  • AI Hypothesis Extraction at Checkpoint: One Claude extraction call per role converts free-text context answers into a structured Reported Hypothesis Set: [{ question_idx, capability, claim, direction }], where direction is strength | concern | neutral and claim is the falsifiable restatement. Extraction never invents a capability not tagged in the question set.
  • Pure Hypothesis Comparison Engine (src/core/engine/comparison.ts): Deterministic rule matching Program Flow Step 6:
    neutral → Not Yet Testable
    tier == No Signal → Not Yet Testable
    concern && tier ≥ Provisional → Contradicted
    strength && tier ≥ Provisional → Consistent
    concern && tier == Emerging (scaffolded/incorrect) → Consistent
    strength && tier == Emerging (independent ≥ 1) → Consistent
    otherwise → Not Yet Testable
  • Dual-Role Synthesis Rendering: Single synthesis rendered through two views:
    • Parent view: Growth narrative, observed tiers, and their own extracted hypotheses.
    • Teacher view: Same narrative + MOE/CAIT framing and teacher extracted hypotheses.
  • Audit Logging in checkpoints.comparisons: The extracted hypotheses are stored alongside verdicts in checkpoints.comparisons so educators can inspect exactly what the AI derived from free text.

What the Client Can Test & Verify on Staging

AI Extraction + Milestone Regeneration

Submit free-text answers describing student challenges at stuck points. Reach Provisional in exercises, click "Run check-in", and verify that the report quotes empirical instances and accurately reflects the extracted hypothesis.

Hypothesis Falsification Test

Write a context note indicating difficulty with logical sequences. Complete 3 Logical tasks independently to reach Provisional. Verify the report indicates "Contradicted" with diplomatic phrasing.

Dual Rendering Inspection

View the generated milestone report as a parent, then switch to teacher login. Verify teacher sees MOE/CAIT framing while parent sees plain-language growth narrative.

SP4

Sub-Project 4: AI Judgement & Content Scaling (P6)

Post-Rubric Delivery

Replace word-count placeholder with Claude qualitative judgement for CT and SE. Hand-author additional task variants.

Pending: Dr. Chew Lee's Rubric

Engineering Implementation Scope

  • Server-Side Judgement (judge-response Edge Function): POST {capability, task_id, prompt, answer}. Claude evaluates response against Doc 2 facets:
    • Creative Thinking: Originality and Elaboration.
    • Self-Expression: Vocabulary range, Syntactic complexity, Coherence, Elaboration confidence.
  • Swap Word-Count Seam: Client replaces 12/20 word count checks with judge-response call. Word count preserved as graceful offline fallback.
  • Audit Reason Logging: evidence_instances.judge_reason recorded for teacher and educator review queue.
  • Hand-Authored Task Scaling: Add 2–3 variants per difficulty level across src/core/tasks/*. Strictly hand-authored per client policy; no AI-generated tasks.

What the Client Can Test & Verify on Staging

Qualitative Rubric Scoring

Submit high-effort creative responses vs generic gibberish exceeding 20 words; verify the rubric judge evaluates genuine conceptual novelty and logs the rationale.

Multi-Session Task Variety

Run consecutive exercise sessions with a student and verify that the 3-independent-instances rule draws on fresh task variants without exhausting the library.

System Architecture, Data Wall & Supabase Schemas

Unified backend topology on Supabase (ap-southeast-1) with Cloudflare Pages serving the static frontend.

Supabase Relational Database Schema

profiles (id uuid pk, role text 'teacher'|'parent')

students (
  id uuid pk default gen_random_uuid(),
  owner_id uuid references profiles,
  display_name text, age int,
  consent_given_by uuid, consent_wording_version text,
  removed_at timestamptz, deleted_at timestamptz
)

evidence_instances (
  id bigint pk, student_id uuid references students,
  capability text, task_id text, difficulty int,
  behaviour text, attribution text,
  time_taken_ms int, attempt_number int,
  flagged_for_review bool, flag_reason text
)

context_answers (
  id bigint pk, student_id uuid references students,
  role text 'parent'|'teacher', author_id uuid,
  question_idx int, capability text,
  answer text not null -- free text only, no direction/rating
)

checkpoints (
  id bigint pk, student_id uuid,
  evidence_summary jsonb, comparisons jsonb -- holds extracted hypotheses + verdicts
)

reports (
  id bigint pk, student_id uuid,
  checkpoint_id bigint, kind text 'intake'|'milestone',
  body jsonb, model text, moderated bool
)

Edge Functions & Security Layer

gate Public

Verifies shared password against Supabase secret GATE_PASSWORD; returns HMAC-SHA256 token signed with GATE_TOKEN_KEY (7-day expiry).

record-attempt Gate Token

Receives child exercise events, runs pure tagEvidence, inserts row into evidence_instances via service-role, and returns updated tier.

intake-report & run-checkpoint Gate + Auth

Server-side Claude calls using secret ANTHROPIC_API_KEY. run-checkpoint extracts hypotheses from free-text answers, tests verdicts, and moderates output before saving.

judge-response Gate Token

SP4: Runs Dr. Chew Lee's qualitative rubric evaluation against child responses for Creative Thinking & Self-Expression.

Client Review Matrix

Sub-Project Verification & Acceptance Guide

Track acceptance criteria as each sub-project is deployed to staging (truenorth-ai-a5j.pages.dev).

Staging Target: truenorth-ai-a5j.pages.dev
Sub-Project Deliverable Area What the Client Will Test on Staging Status
SP1 6 Interactive Exercises All 6 exercises fully playable with real engine scoring and tier transitions (CF rule flip, EI retries). Ready to Build
SP1 Teacher Portal CRUD Add, soft-remove, restore, and permanently delete students with typed confirmation. Ready to Build
SP2 Edge Password Gate Unauthenticated visitors blocked by shared password screen; token persists session. Queued
SP2 Zero-Key Claude Proxy Intake report generates via Edge Function; zero API keys or secrets in browser bundle. Queued
SP2 Adult Magic Link & Child Privacy Adults log in via magic link; child records remain pseudonymous without passwords or logins. Queued
SP3 AI Hypothesis Extraction & Regeneration Claude extracts hypotheses from free-text answers; real exercise instances update report with empirical evidence. Queued
SP3 Hypothesis Verdicts & Phrasing Outputs Consistent / Contradicted / Not Yet Testable with agreed diplomatic phrasing. Queued
SP4 Qualitative Rubric Judgement Claude judges CT & SE responses against Dr. Chew Lee's rubric facets, replacing word counts. Post-Rubric

Graceful Error Handling & Fallbacks

Claude Unavailable (Intake): Returns fallback Sonia profile, clearly labelled offline.
Claude Unavailable (Checkpoint): No new report created; prior report stands and user is notified.
Moderation Rejects: Safe encouraging sentence substituted, flagged for educator review.
Network Offline: Exercise events queue in localStorage; local engine computes tiers and flushes on reconnect.

Fixed Principles from Source Documents

  • Evidence-seeking free text only: No diagnostic labels or rating pickers are ever shown to parents or teachers (Program Flow P1, P2).
  • Threshold is the only gate (Doc 3): Falsification and Other Explanations only downgrade tiers, never elevate.
  • Strict Hand-Authored Tasks: No tasks are generated by AI now or later (client policy).
  • Zero-Em-Dash Copy Policy: Clean, crisp punctuation across all application interfaces and prompts.