Jeremy Divorce

Full Workflow Diagram · Backend & Frontend
12
Intake Fields
9
UD Forms
10
Hand-Hold Fields
3
Signatures
$19.99
Unlock Price

System Architecture — Bird's Eye View

USER (mobile / desktop) FRONTEND — divorce-intake.html Chat UI + Avatar + KITT Speech Queue (TTS) 9 Doc Generators (JS) Verification Matrix Overlay localStorage (user_id) BACKEND — src/server.py /api/chat → divorce_chat.py /api/tts (Edge-TTS) /api/user/* (login/save/load) /api/sign/* (tokens, upload) /api/stripe/* (checkout/verify) SQLITE DB user_memory.db users sessions signatures sig_tokens payments EXTERNAL SERVICES Anthropic API claude-sonnet-4-6 Edge-TTS Steffan voice Stripe Checkout sk_live_... $19.99 mail.prosenetwork.org jeremy@prosenetwork.org Pillow (PIL) sig image processing SIGNATURE COLLECTION SUB-FLOW Plaintiff / Server / Defendant opens magic link /sign?t=TOKEN Canvas draw pad OR photo upload /api/sign/upload Pillow processes: threshold + transparent PNG signatures (user_id, role, base64 PNG) sigLine() injects <img> onto UD forms
User / Signer
Frontend (browser JS)
Backend (Python / VM)
SQLite database
External service
0

Login & Bootstrap

Email-only auth · localStorage · session restore

0.1

Splash screen appears

User sees Jeremy's portrait and taps "Start Consultation"

0.2

Login modal / auto-restore

If localStorage.prosenet_user exists → auto-login. Otherwise prompt for email. POST /api/user/login returns user_id.

0.3

State hydration

POST /api/user/load restores collectedData + doc progress. POST /api/sign/all hydrates SIGNATURES_CACHE. POST /api/stripe/is-paid checks paywall status.

0.4

URL param detection

If ?stripe_session_id= present → auto-verify payment. If returning user with saved state → "Welcome back" message.

1

Main Intake (12 fields)

phase: intake · Claude Sonnet 4.6 extraction · auto-save to DB

1.1

Conversational field collection

Jeremy asks each of the 12 intake questions. Every user message → POST /api/chatchat_intake() calls Claude with system prompt + history. Claude returns JSON with extracted value + field_complete flag.

1.2

Stop triggers

4 fields have stop conditions: irretrievable_breakdown, no_children, no_property, both_cooperate. If triggered, session enters "stopped" phase with recovery option.

1.3

Persistent save

After every field update, userSaveSession() debounces 800ms then POST /api/user/save writes to sessions table.

1.4

Left panel sync

Each response's collected object paints the intake checklist with green checks + filled values.

2

Verification Matrix

Animated clearance · matrix rain · green eligibility banner

2.1

Trigger

When all 12 fields collected OR Jeremy's message matches completion phrases ("everything we need", "all set", "you qualify") → showEligible() fires (guarded by eligibleFired).

2.2

Matrix rain overlay

12 rows fade in one at a time, status flips from VERIFYING... (gold) to CLEARED ✓ (green). Progress bar fills to 100%.

2.3

Transition to roadmap

Matrix fades, left panel swaps to Document Roadmap, UD-1 build auto-triggers.

3

Document Builds (9 forms + hand-holding)

phase: roadmap + doc_intake · client-side generators · terminal animations

3.1

UD-1 — Divorce Summons

Builds immediately from collectedData. Terminal animates on left panel. Preview button opens full 4-page UD-1 in new tab with watermark + scrape protection.

3.2

UD-3 — Proof of Service (hand-holding)

User says "next" → startDocIntake('ud3') → server enters doc_intake phase → Jeremy asks 9 UD-3 fields naturally (server name, age, address, service date/time/location, ID method, defendant description, military status). Each field extracted by Claude and saved to collectedData.

3.3

UD-5, UD-6, UD-7, UD-9, UD-10, UD-11, UD-12

User says "next" after each. UD-6 triggers another hand-holding (1 field: residency basis A/B/C for DRL §230). All other forms build immediately from existing data.

3.4

Generator logic

Each generator is a JS function generateUDxHtml(d) that returns a full HTML document with embedded CSS, print styles, and signature line placeholders.

4

Signature Collection

phase: doc_intake (signatures) · 3 magic links · Pillow image pipeline

4.1

Email collection

After UD-12 builds, Jeremy enters sig_intake and asks for 3 emails: plaintiff, server, defendant.

4.2

Token generation

POST /api/sign/request-tokens creates 3 secure tokens in sig_tokens table, returns 3 URLs like /sign?t=xxx. Links shown in chat.

4.3

Invite emails (Python script)

/tmp/send_sig_invites.py looks up unused tokens and sends personalized emails from jeremy@prosenetwork.org.

4.4

Signer uploads

Each party opens their link on any device. /sign.html offers canvas draw pad OR photo upload. On submit → POST /api/sign/upload (multipart).

4.5

Image processing (Pillow)

process_signature_image() runs: EXIF orientation fix → grayscale → dark-pixel threshold → alpha mask (ink opaque, bg transparent) → bounding box trim → 10px pad → PNG export. Stored as base64 keyed by (user_id, role).

4.6

Signature injection

Next time the user previews a doc, sigLine(label, role) checks SIGNATURES_CACHE[role] and injects <img src="data:image/png;base64,..."> above the signature line.

5

Paywall — $19.99 Unlock

phase: roadmap (paid) · Stripe Checkout · clean preview mode

5.1

Paywall UI

4s after signature collection completes → Jeremy shows the gold "UNLOCK FILING PACKAGE — $19.99" button in chat.

5.2

Checkout session

Button click → POST /api/stripe/create-checkout → server calls Stripe API with price_data inline ($19.99 USD) → returns hosted URL → browser redirects.

5.3

Payment & return

User pays via Stripe's hosted page → Stripe redirects back to /divorce-intake.html?stripe_session_id=cs_xxx.

5.4

Verification

Frontend detects query param → POST /api/stripe/verify → server calls Stripe GET session → if payment_status === 'paid' updates payments table → returns ok.

5.5

Unlock

userIsPaid = trueopenDocPreview() skips the watermark injection → clean previews → "Payment received" message.

6

Filing Package Delivery

phase: post-paid · 9 PDFs emailed to plaintiff

6.1

Payment trigger

/tmp/send_filing_package.py confirms payments.status = 'paid', pulls collectedData + signatures from DB.

6.2

PDF generation

Renders all 9 UD forms via the same JS generators (headless in production) or Python weasyprint fallback. Each PDF has the user's collected data + injected signatures.

6.3

Email delivery

Builds one email from jeremy@prosenetwork.org to plaintiff_email with all 9 PDFs as attachments. Instructions for filing with the NY Supreme Court included in the body.

6.4

Done

User has everything they need to file. Session marked complete. Upsell (optional: pay $20 more for Jeremy to file on their behalf) tabled for phase 7.