inou/PROMPT-FUNCTION-BRIEF.md

2.7 KiB

Prompt Function — Flagship Feature Brief

Vision

This is one of inou's flagship features. It must be awesome beyond belief — pretty, intuitive, fast, useful.

User types natural language → system understands, stores, and intelligently follows up.

Examples:

  • "I had a headache, took a Tylenol" → logs both, asks tomorrow "Did you take Tylenol?"
  • "Blood pressure 120/80" → stores with proper fields (systolic/diastolic)
  • "Leg trainer: 3 sets, 12 reps, 45kg" → handles complex multi-parameter input
  • "My period stopped" → does NOT ask about period the next day
  • "I'm pregnant" then later "I had my period" → handles contradiction intelligently

Core Concept

Everything displays as a prompt card. The card's state changes:

  • Due — waiting for input
  • Completed — what you just told us (confirmation)
  • Pending — coming tomorrow

When you type freeform input, you immediately see it as a completed card. Tomorrow's follow-up appears as a due card.

Smart & Sensitive

The system must be intelligent about follow-ups:

  • One-time events don't generate recurring prompts
  • Contradictions are handled (pregnancy → period means pregnancy ended)
  • "Stopped taking X" dismisses the X prompt
  • Context matters — understand what makes sense to ask again

Design

Follow the styleguide: inou.com/styleguide

Cards are not in the styleguide yet — design freedom here, but match the inou aesthetic.

Existing Code

LLM Pipeline:

  • api/prompts/triage.md — categorizes input
  • api/prompts/*.md — category-specific extraction prompts
  • api/api_llm.gocallLLMForPrompt() orchestrates triage → extraction
  • api/api_prompts.go — API endpoints, tryGeneratePromptFromFreeform()

Data:

  • lib/types.goPrompt, Entry structs
  • lib/prompt.go — CRUD, respond, skip, dismiss

UI:

  • portal/prompts.go — current prompts page
  • portal/templates/prompts.tmpl — current template

Test harness:

  • test-prompts/main.go — CLI tool: ./test-prompts "I took aspirin"

Flexibility

Input configs must handle:

  • Single checkbox ("Did you take X?")
  • Multiple checkboxes ("Morning pills: ☐ Lisinopril ☐ Metformin")
  • Numeric with units ("Weight: ___ kg")
  • Multi-field ("BP: / mmHg")
  • Complex forms ("Leg trainer: sets ___ reps ___ weight ___")
  • Scales ("Pain level 1-10")

The LLM extraction prompts define input_config — the UI renders whatever structure it returns.

Must Have

  • Edit recognized prompts (change question, schedule, fields)
  • Delete/dismiss prompts
  • Works beautifully on web and mobile (WebView)
  • Fast — no jarring waits after input
  • Immediate visual confirmation of what was captured