Files
InnerOS/TODOS.md
jackyu66gitandClaude Opus 4.6 cef29d40bd Initial commit: Inner OS v1
Full-stack inner development operating system built on Next.js 16 + Prisma 7 + PostgreSQL + OpenAI + Clerk.
Generates personalized daily mental training tasks, collects reflection, updates user state, and provides internal reward feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 12:11:27 +08:00

2.9 KiB

Inner OS — Deferred Work

From /plan-eng-review (2026-05-20)

T1: Define state capture mechanism

What: Specify the UX and formulas for capturing attention_level, emotion_stability, and stress_level. Why: These are inputs to task generation, but no data entry path exists. Session reflection has focus_score and emotion_score (1-5 user self-report), but no mapping to the state model. Context: The session reflection form needs clear self-report questions ("How focused were you? 1-5", "How emotionally balanced? 1-5"). Map formulas: attention_delta = (focus_score - 3) * 5, emotion_delta = (emotion_score - 3) * 5. For the empty-reflection case (user writes nothing), default deltas to 0 (no change). Effort: S (human: ~3h / CC: ~15min) Priority: P1 Depends on: Session reflection form design

T2: Add LLM output content safety

What: Add a lightweight safety layer on LLM-generated tasks before showing them to users. Why: GPT-4o-mini could generate harmful suggestions (extreme practices, dangerous advice). A single bad output is a reputational event. Context: Implement a keyword blocklist (self-harm, extreme behaviors, medical advice) and an optional LLM self-review prompt ("Does this task contain harmful or dangerous suggestions? Reply yes/no."). If flagged, fall back to a template task. Effort: S (human: ~2h / CC: ~10min) Priority: P1 Depends on: Task generation pipeline

T3: Define stage advancement rules per level

What: Define concrete thresholds for each stage transition (0→1, 1→2, 2→3, 3→4, 4→5). Why: The LLM prompt needs current stage to set task difficulty. Without per-level rules, advancement is arbitrary. Context: Proposed rules:

  • Stage 0→1: 7 completed sessions (any consistency)
  • Stage 1→2: 14 completed sessions + consistency >= 60
  • Stage 2→3: 30 completed sessions + consistency >= 80 + stability >= 60
  • Stage 3→4: 60 completed sessions + consistency >= 90 + stability >= 70
  • Stage 4→5: 120 completed sessions + consistency >= 95 + stability >= 80 Effort: S (human: ~1h / CC: ~10min) Priority: P2 Depends on:

T4: Add Clerk user deletion webhook handling

What: Handle Clerk user.deleted webhook to cascade-delete user data, plus a periodic cleanup job for orphaned rows. Why: Clerk webhooks are at-least-once (not exactly-once). If delivery fails, UserState/Sessions/Tasks/RewardEvents become orphaned with no owner. Context: Add onDelete: Cascade on User→UserState Prisma relation. Implement Clerk webhook handler at /api/webhooks/clerk. Add a weekly cleanup job that deletes rows where user_id doesn't exist in Clerk (query Clerk API). Effort: M (human: ~4h / CC: ~15min) Priority: P1 Depends on: Clerk integration

From /plan-ceo-review (2026-05-20)

  • (all scope items accepted as "Build now" — nothing deferred from CEO review)