Build Order & Checklist
If two sections conflict, the authority page (12-meta-authority.html) and sections tagged [V1-PRODUCTION] override all other text.
Remove or rewrite conflicting older text β do not leave both versions in place.
Claude Code must only implement [V1-PRODUCTION] sections. All other tags mean: skip.
Part of: Pickatale Master Build Wiki | Version: v1.7 | Last Updated: 2026-04-18
12. Build Order
Source: (D) | Status: Confirmed
Phase 1 β Infrastructure β COMPLETE
22 services live. Reader App live with finger-follow, vertical mode, accessibility panel, TTS, karaoke. Nightly bot verified 2026-04-17.
Phase 2 β Intelligence Loop β CURRENT (INCOMPLETE)
Must build in this order:
- CM REST API β
GET /api/v1/objectives(territory, year_level, subject). X-Internal-Key auth. Unblocks everything else. - AI Learning Orchestrator β gap detection β story selection β adaptive levelling β assessment trigger β mastery eval β reports. Port 3121.
- Reinforcement Engine β built inside Orchestrator. Ranks gaps by: word tap frequency, MAZE errors, low WCPM, comprehension <65%, slow pages.
- Assessment Bot β 3β5 MCQ questions per book (GPT-4o from page texts). Score β level_recommendation. POST result to Learner Bot.
- Comprehension Quiz UI in Reader App β post-book screen, fetches questions from Assessment Bot.
- Placement Test in Reader App β first-login flow, sets initial FK level in Learner Profile.
- Account Center learner_profiles schema β full SSO profile unification.
Phase 3 β Fix + Wire Siloed Services
- Wire SendGrid (key from Sig β legal requirement).
- Swap to Azure TTS (key from Sig β code ready).
- Start Decodables, Voice Assessment, Talk AI services.
- Wire Fluency Assessment β Learner Profile (push FK + CEFR after each scoring).
- Wire Voice Assessment β Learner Profile.
- Wire Decodables, Talk β Telemetry.
- Build landscape reading mode in Reader App.
- Build Miles/Tokens reward UI.
- Teacher Portal SSO via Account Center.
Phase 4 β Real Data + ML
- Pickatale Create API (Borja) β personalised illustrated stories.
- First real children on platform β Learner Bot live cycles.
- Recommendation Engine v2 β collaborative filtering.
- ML training pipeline.
13. Claude Code Build Brief
Source: (D) + code audit | Status: Confirmed
Stack (currently deployed β confirmed)
| Layer | Technology |
|---|---|
| Reader client | React 19 + Vite + TypeScript |
| Reader server | Express + tRPC + Drizzle ORM |
| Other services | Node.js / Express (mix) |
| Database | MySQL 8 β shared Docker instance (internal access only β see ops docs) |
| Infrastructure | Docker + Caddy reverse proxy |
| Auth | JWT (httpOnly cookies) + uc_session cookie (Account Center) |
| Internal calls | X-Internal-Key header, 5s timeout |
| Platform target | PWA + Capacitor (iOS/Android) |
Database Connection
Host from containers: : (see ops docs)
Root password: stored in secure env β contact server admin
Rule: docker compose down && up after .env changes (never restart β does not reload env)
Service Disk Locations (Confirmed)
| Service | Path |
|---|---|
| Reader | /home/ubuntu/reader/ |
| Telemetry | /home/ubuntu/telemetry/ |
| LRS | /home/ubuntu/lrs/ |
| Adaptive Engine | /home/ubuntu/adaptive-content/ |
| Learner Bot | /home/ubuntu/learner-bot/ |
| Teacher Portal | /home/ubuntu/teacher-portal/ |
| Parent Portal | /home/ubuntu/parent-portal/ |
| CM | /home/ubuntu/cm/ |
| Content Service | /home/ubuntu/content-meta/ |
| Fluency | /home/ubuntu/fluency/ |
| Voice Assessment | /home/ubuntu/Voice/ |
Non-Negotiable Rules
- Never hardcode secrets β all in .env files only.
- No cross-service DB access β API contracts only (X-Internal-Key).
- learner_id (UUID) is the universal child identifier β never integer IDs cross-service.
- All services connect to the shared DB via internal host (see ops docs β never hardcode the address).
docker compose down && up(not restart) after .env changes.- Show live test output before marking any task done.
- Use Context7 MCP before writing code for any 3rd-party library.
- Voice audio MUST NOT be stored. Audio may exist only in-memory during request processing and must be deleted immediately after transcription. No logging, caching, queues, or retries may contain raw audio.
- Raw touch data must be anonymised after session analysis.
- Every web project must use the Pip logo as favicon β never default framework icons.
Immediate Phase 2 Tasks (in order)
**Task 1: CM REST API
File: /home/ubuntu/cm/src/routes/objectives.ts Endpoint: GET /api/v1/objectives?territory=&year_level=&subject= Auth: X-Internal-Key Returns: [{id, title, description, difficulty, vocabulary[], story_potential_score}]
Task 2: Orchestrator service New service: /home/ubuntu/orchestrator/ | Port: 3121 Flow: query Learner Bot status β query CM objectives β select story β POST to Adaptive Engine β store for Reader β trigger Assessment Bot β receive result β POST to Learner Bot quiz-result β update Learner Profile
Task 3: Assessment Bot Module or service. POST /api/v1/assess/generate (GPT-4o, 3-5 MCQ). POST /api/v1/assess/result (score, level_recommendation drop/hold/raise). Pass threshold: 65%.
Task 4: Comprehension Quiz UI File: /home/ubuntu/reader/client/src/pages/QuizPage.tsx Trigger: after book completed. Fetch from Assessment Bot. Submit via reader server proxy to Learner Bot /bot/:learner_id/quiz-result.
Task 5: Placement Test File: /home/ubuntu/reader/client/src/pages/PlacementTest.tsx Trigger: first login (reading_level is null). Short passage at median FK. Adjust up/down based on responses. PATCH Learner Profile with result.
27. Build Order (Complete β Including Identity and Billing)
Source: (D) | Status: Confirmed
Phase 1 β Identity Foundation (MUST BUILD FIRST)
These do not exist yet. Nothing else is buildable without them.
invitestable + invite flow (flow 15.9)email_log+audit_logtables (NFR-012 compliance)subscriptions+entitlement_grantstablescheckEntitlement()middleware β called by every protected endpoint- Teacher Portal
teacher_notificationstable + PARENT_CLAIM_REQUEST flow parent_claimstable + claim approval flow (flow 20.1)
Phase 2 β Intelligence Loop (Section 12 β unchanged)
CM REST API β Orchestrator β Assessment Bot β Quiz UI β Placement Test β Account Center learner_profiles
Phase 3 β Billing (After Phase 1 Identity)
- Stripe integration (checkout, webhooks, subscription lifecycle)
- Subscription expiry handling (grace period, feature lock, bot pause)
- Admin entitlement grant/revoke tool
- Payment receipt emails, renewal failure emails
Phase 4 β Admin Tools (Section 24)
- admin.readingtester.com panel
- Impersonation (Section 24.2)
- Merge duplicates (Section 24.6)
- Audit log viewer (Section 24.7)
Phase 5 β Fix Siloed Services (Section 12 Phase 3)
Wire Fluency β Learner Profile. Start Decodables, Voice, Talk. Azure TTS swap. Landscape mode. Reward UI.
35. End-to-End Build Checklist
Source: (D) | Status: Confirmed as build gates
Claude Code must verify ALL items pass before each phase is considered complete.
Gate 1: Identity (Sections 28β29 prerequisite)
- POST /api/auth/register (teacher + parent)
- POST /api/auth/verify-email
- POST /api/auth/login (teacher, parent, child separate endpoints)
- POST /api/auth/logout
- POST /api/auth/forgot-password
- POST /api/auth/reset-password
- POST /api/auth/accept-invite
- GET /api/auth/session (middleware)
-
audit_logtable populated on every auth event - bcrypt cost 12 (users), cost 10 (pins)
- Rate limiting on all auth endpoints
Gate 2: Billing (before any feature access)
-
subscriptionstable exists -
entitlement_grantstable exists -
checkEntitlement()middleware called on every protected endpoint - Stripe webhook handler live (checkout, payment_succeeded, payment_failed, subscription.deleted)
- Subscription expiry cron running every hour
- Free-tier enforcement: 50-book limit enforced server-side
- Bot stops on expiry
Gate 3: Roster (before children can read)
- POST /api/v1/classes
- POST /api/v1/classes/:id/students (single add, PIN returned via token)
- POST /api/v1/classes/:id/students/import (CSV)
- GET /api/v1/pin/:token (one-time PIN reveal, 10-min TTL)
- POST /api/v1/students/:id/reset-pin
- POST /api/v1/classes/:id/login-cards (PDF, no file:// paths)
- PATCH /api/v1/students/:id/move
- DELETE /api/v1/classes/:id (archive, cascade to students)
- Learner Profile Service called on student creation
Gate 4: Child Reading
- Child login: username + PIN β uc_session (child role)
- Placement test on first login β writes reading_level to Learner Profile
- Library: 50 books (free) / all (full tier) β server-side filter
- Telemetry fires on page_turned, word_tapped, session_ended
- Offline queue (IndexedDB + Service Worker replay)
- FK-levelled text served via Adaptive Engine
- Comprehension quiz shown after book (full tier only)
- Miles + token accumulation
Gate 5: Intelligence Loop
- Learner Bot nightly cycle at 04:00 UTC
- Teacher report generated + stored
- Parent digest generated + stored
- Intervention flags populated in Teacher Portal
- CM REST API: GET /api/v1/objectives
Gate 6: Notifications
- SendGrid API key configured (from Sig β OQ-002)
- VERIFY_EMAIL working end-to-end
- WELCOME_TEACHER / WELCOME_PARENT
- PASSWORD_RESET
- CHILD_LOCKED_PIN in-app notification
- WEEKLY_PARENT_DIGEST (Sunday 08:00 UTC cron)
- RENEWAL_FAILED
Gate 7: Admin Tools
- Admin panel access (platform_admin 2FA)
- Impersonation with orange bar + audit log
- Grant/revoke entitlement
- PIN reset for any student
- Merge duplicate students
- View audit log (filterable)