Phase Two · Technical Summary

InnerVoice Practice & Adherence Engine

The governing principle: we are not merely delivering content — we are supporting measurable, consistent practice. Below is the current architecture, what is functional, Cloud requirements, the CRM integration audit, the Calliope handoff, and the recommended implementation order.

1

Current technical architecture

A TanStack Start (React 19) single-page application on an edge runtime, styled with Tailwind v4. Routes: / (home), /welcome (first-time welcome),/practice (participant player + dashboard), /braintalk (replayable library), /mentor (accountability), /privacy, and /docs. Listening events flow from the browser ListeningTracker → recordListeningEvent server function (zod-validated, deduplicated) → browser localStorage for the demo. On completion, the practice page recomputes stats and forwards an IV summary to the connected CRM form-tracking endpoint. Audio, programs and categories (SelfTalk vs BrainTalk) are data-driven in src/lib/audio-data.ts so the engine is reusable across DMP, Neuro²Harmonics, KidsTalk and future programs.

2

What is genuinely functional today

Participant-facing audio player

Fully functional

Custom HTML5 player with play/pause, restart, seek, elapsed/remaining time, cover artwork, title and description. Events are tracked and deduplicated with distinct-content completion logic (90% threshold).

Listening-event tracking architecture

Fully functional

All eight event types (opened, started, paused, resumed, seeked, progress, completed, ended) are emitted through a secure server-side endpoint stub with zod validation and deduplication. Progress updates fire every ~15 seconds.

Enrollment-aware dashboard math

Fully functional

Missed days, consecutive missed days and 30-day adherence are measured from each participant's enrollment date forward — pre-enrollment and future days never count as missed. Three sessions on one day count as three sessions and one unique practice day.

First-time welcome experience (EDU-001)

Fully functional

The supplied final welcome WAV (Welcome to InnerVoice · BrainTalk · FINAL-V01) streams on /welcome with play/pause/resume and no autoplay. Welcome completion is stored separately from daily SelfTalk adherence and is replayable in the BrainTalk library (/braintalk). URL verified: audio/wav, accept-ranges, CORS enabled.

Participant practice dashboard

Demonstration data

Completed sessions, total minutes, current/longest streak, unique listening days, today's sessions, 7-day calendar and 30-day progress ring. Seeded with the current participant's browser-stored sessions plus demo data.

Mentor accountability dashboard

Demonstration data

Enrollment, started, completed-today, average adherence, total sessions, consecutive-missed-days KPIs, per-participant listening histories, streaks, total minutes and 30-day adherence. CSV export is functional. Seeded with labeled demonstration participants.

CRM contact-level summary fields

Requires CRM config

The integration forwards the IV summary to the connected form-tracking endpoint on completion. Custom-field IDs are placeholders that Calliope must map to the live CRM custom fields (see handoff table below).

Workflow automation events

Requires CRM config

Milestone triggers (first completion, 3/7/14-day streaks, 30 sessions, two missed days, return to practice, program completion) are specified below but not activated. No communications are sent in development.

Persistent authentication & storage

Requires external infra

Participant authentication, listening-session persistence and server-side completion validation require the managed backend (Cloud) to be enabled. Without it, data is stored locally in the browser for the demonstration only.

Final DMP audio & cover artwork

Requires Calliope

Production asset ID DMP-ST-CENTER-001-SGM-V02 is configured with placeholder URLs. Sean must upload the final mastered MP3 and artwork and replace the placeholder URLs (see §7). The welcome WAV (EDU-001) is already integrated.

Mobile & security validation

Requires security/mobile testing

Background playback and lock-screen controls require testing on physical iOS/Android devices. Secure personalized access links and mentor role authorization require end-to-end security review before any public publish.

3

Cloud requirements & costs

  • • What it provides: a managed Postgres database, email auth, row-level security, and file storage — the authoritative home for participants, programs, audio assets, assignments, listening sessions, events and mentor roles.
  • • Underlying infrastructure: provided by the platform's managed backend (Cloud). It is a separate paid feature from the CRM subscription and is not included in the existing CRM plan.
  • • Costs: Cloud is a paid add-on with its own monthly/usage-based pricing set by the platform. No paid services are activated without approval. Enabling Cloud is the only paid step required for the pilot; the welcome WAV is already hosted on the existing media CDN at no additional app cost.
  • • Permissions: enabling Cloud requires the project owner to connect it from the builder (More → Cloud). No CRM permissions change — the existing form-tracking connection keeps working, and no CRM custom fields are overwritten.
  • • Capacity: generous database and storage quotas suitable for the pilot and well beyond; scale via the platform plan.
  • • Auth: passwordless email login, persistent sessions, and server-side role authorization for mentors.
  • • Server functions: full server-side function capability for completion validation, CRM writes with secret credentials, and milestone emission.
  • • Audio hosting: Cloud storage can host the MP3, or any CDN/secure file host can be used (see §7).
  • • Data ownership & export: you own all data; Postgres is exportable/backupable via the platform tooling.
  • • Portability: the app is a standard React/edge app; moving to other infrastructure later is possible, though the managed auth/storage APIs would need re-platforming.

To enable: open the builder's More → Cloud tab and connect. No paid services are activated by connecting alone; the project continues to run in preview. Do not publish until the security dependencies in §6 are resolved.

4

Existing CRM integration audit

  • • Endpoint: the connected form-tracking event endpoint (external-tracking/events), wired with the project's publishable tracking/location/project IDs.
  • • Participant identity: currently the demo participant reference. In production the participant's CRM contact ID is attached server-side from the authenticated session — never trusted from the browser.
  • • Create vs. update: the form-tracking endpoint records an event per submission; it does not itself upsert a contact. Contact-level field updates require Calliope to map the custom-field IDs (§5) so the CRM workflow can write them to the matching contact.
  • • Duplicate prevention: contact matching relies on the CRM's existing contact key (email). On the app side, recordListeningEvent deduplicates by eventId and terminal events are emitted once per sessionId.
  • • Submission origin: the IV summary is currently sent from the browser (fire-and-forget). In production this must move behind the server function so credentials stay server-side and totals are server-validated before any CRM write.
  • • Validation: events are zod-validated server-side; completion is computed from distinct-content playback, not from a browser-claimed flag.
  • • Retry: today submissions are fire-and-forget with no retry. Production needs a durable outbox + retry on the server (a Cloud dependency).
  • • Overwrite risk: because the CRM write is event-driven, a late-arriving retry could overwrite a newer summary. Production must include a lastUpdated guard so an older event never overwrites a newer contact field.

Sanitized sample event payload

{
  "type": "external_form_submission",
  "formId": "innervoice-listening-session",
  "formData": {
    "iv_program": "Definite Major Purpose",
    "iv_current_audio": "I Am the Author of My Life",
    "iv_total_sessions": 12,
    "iv_completed_sessions": 9,
    "iv_total_minutes": 126,
    "iv_unique_days": 8,
    "iv_current_streak": 4,
    "iv_longest_streak": 6,
    "iv_last_listening_date": "2026-12-03",
    "iv_last_completion_date": "2026-12-03",
    "iv_today_completed": 1,
    "iv_30day_adherence": 73,
    "iv_commitment_target": "1/day"
  },
  "properties": { "source": "ai_studio", "formName": "InnerVoice Listening Session" }
}
5

Calliope implementation handoff — custom field mapping

The current integration uses placeholder custom-field IDs. Manual field-ID mapping is required — the form-tracking endpoint does not auto-discover custom fields. Calliope should create each IV field in the CRM, then replace the placeholder ID in src/lib/crm-tracking.ts with the live field ID. Do not create duplicate fields or overwrite existing CRM configuration.

Display nameProposed keyTypeExampleSource calculationUpdate freqPlaceholder ID
IV Programiv_programText / DropdownDefinite Major Purposeprogram.name on the participant's active assignmentOn assignment change30CdXdJPzABzdLxyxTHd
IV Current Audioiv_current_audioTextI Am the Author of My LifeaudioAsset.title of last-played assetOn session completiontEVxijBhgTP8PeatlaO0
IV Total Listening Sessionsiv_total_sessionsNumber12count of all listening sessions for the participantOn session completionG7BangH0ZoE9vvTwKWgV
IV Completed Listening Sessionsiv_completed_sessionsNumber9count of sessions with completionStatus = completedOn session completionZEjyR8rz2Ru8Fyhgjmwh
IV Total Listening Minutesiv_total_minutesNumber126sum(activePlaybackSeconds)/60 over completed sessionsOn session completionzxPli9JDvSn6PnBQqdUr
IV Unique Listening Daysiv_unique_daysNumber8distinct count of localDate with a completed sessionOn session completion2eAJQn4T2pcLpx1KdVsB
IV Current Streakiv_current_streakNumber4consecutive completed days ending today (or yesterday)On session completionlDBakzNFpiGgzZSla2cn
IV Longest Streakiv_longest_streakNumber6longest run of consecutive completed days everOn session completionOKU2TGnBXRxt7paLzCrP
IV Last Listening Dateiv_last_listening_dateDate2026-12-03max(localDate) over all sessionsOn session completionAFsLNMnZcOMFisTHEC5E
IV Last Completion Dateiv_last_completion_dateDate2026-12-03max(localDate) over completed sessionsOn session completionnjUYeeOfjJTQhmxxcHVn
IV Today's Completed Sessionsiv_today_completedNumber1count of completed sessions where localDate = todayOn session completion3NynSiddu1e8Wc5OigUc
IV 30-Day Adherence Percentageiv_30day_adherenceNumber (0–100)73round(days met target / eligible days since enrollment × 100)On session completionFBc1eMldyiUa2MQRpmjF
IV Commitment Targetiv_commitment_targetText1/dayprogram.dailyTarget formatted as `${target}/day`On assignment changeKKuGJ5uDUVEfH8nrXCLL

Location in code: all fields are passed in the customFields map inside sendListeningSummaryToCrm() in src/lib/crm-tracking.ts.

6

Outstanding security dependencies

  • • Server-side completion validation: move the 90% distinct-content check behind the server function; never trust browser-submitted totals.
  • • Mentor role authorization: gate /mentor and its data with a server-side role check; remove Mentor & Docs from the ordinary participant nav in production.
  • • Participant access: passwordless email login (recommended for the pilot) with persistent sessions, linked to the CRM contact by email. Expiring access links are a fallback for no-account participants.
  • • CRM credentials: all CRM write credentials must live in server env only — never in the browser bundle.
  • • Mobile testing: lock-screen and background playback on physical iOS/Android devices before publish.
7

Exact actions required from Sean

  1. 1. Welcome audio (EDU-001): done. The final WAV is integrated and verified streaming (audio/wav, range requests, CORS). No action needed.
  2. 2. Upload the final DMP MP3 to a permanent host (Cloud storage, or a CDN/static file host you control). Do not use an expiring preview URL.
  3. 3. Copy the permanent MP3 URL and replace the audioUrl placeholder for asset DMP-ST-CENTER-001-SGM-V02 in src/lib/audio-data.ts.
  4. 4. Upload the final cover artwork and replace the coverUrl placeholder in the same file.
  5. 5. Set the real duration in durationSeconds once known (improves progress accuracy before metadata loads).
  6. 6. Approve Cloud enablement (More → Cloud) so auth, persistence and server-side validation can be built.
  7. 7. Hand the field map (§5) to Calliope to create the IV custom fields and return the live field IDs.
8

Recommended implementation order

  1. 1. Approve & enable Cloud (auth + persistence).
  2. 2. Stand up the persistent schema (participants, programs, audio assets, assignments, listening sessions, events, mentor roles).
  3. 3. Move completion validation + CRM writes behind the server function with secret credentials and a retry outbox.
  4. 4. Wire passwordless email auth and link participants to CRM contacts by email.
  5. 5. Gate /mentor with server-side role authorization; remove Mentor/Docs from participant nav.
  6. 6. Calliope maps the IV custom fields; replace placeholder IDs.
  7. 7. Sean uploads the final DMP MP3 + artwork.
  8. 8. Run the pilot acceptance tests (§10) on real devices.
  9. 9. Only then: activate milestone automations (§9) and publish.
9

Automation readiness — milestone event specs

These milestones are specified for future CRM workflow triggers. They are not activated and no communications are sent until persistent records and completion accuracy are validated.

EventTriggerRecipient
first_completionFirst session with completionStatus = completedParticipant
streak_3currentStreak reaches 3 consecutive completed daysParticipant
streak_7currentStreak reaches 7 consecutive completed daysParticipant
streak_14currentStreak reaches 14 consecutive completed daysParticipant
sessions_30totalCompletedSessions reaches 30Participant
missed_2_consecutiveconsecutiveMissedDays reaches 2 (enrollment-aware)Mentor / Participant
return_to_practiceA completed session after a gap of ≥3 eligible missed daysParticipant
program_completionAll commitmentDays met (or 100% adherence at window end)Participant + Mentor
10

Pilot acceptance criteria (1 audio · 5 participants · 7 days)

  • Individual participant identification (unique authenticated reference per participant)
  • Full playback → session marked completed (≥90% distinct content)
  • Partial playback → session ended_incomplete, not counted
  • Skipping to the end → no completion (distinct-content < 90%)
  • Repeated listening → each session counted independently
  • Browser refresh → no duplicate completion (dedup on sessionId/eventId)
  • Interrupted connectivity → events queued / retried, no lost completion
  • iPhone locked-screen playback → controls persist, playback continues
  • Android background playback → playback continues when app backgrounded
  • Cross-device access → same participant history retained
  • Duplicate completion prevention → server-side dedup validates totals
  • Unauthorized mentor access → role check rejects non-mentor
  • CRM contact updates → summary fields written, no duplicate contacts
  • Welcome recording → completes separately, never counts toward daily adherence

Reusable architecture

The system is not hardcoded for the DMP program. Programs, audio assets, categories (SelfTalk vs BrainTalk), daily targets, commitment windows and mentors are all configurable — supporting InnerVoice, Neuro²Harmonics, KidsTalk and future personalized SelfTalk, subscription, corporate and educational programs.

Do not publish, activate paid services, send communications, or overwrite existing CRM assets until the security dependencies in §6 are resolved and the pilot tests in §10 pass.