And back for the last few days after taking some time off last week!

Build Day: Demo Spec to Feed into Claude Code

Clinic Wait Time Demo — Build Spec

Purpose

The demo simulates a half-day at a community clinic and shows whether a wait-time product stays accurate, honest and safe when the people feeding it are imperfect.

  • What it proves: the product posts trustworthy ranges, says nothing when it can’t, never discourages urgent care, and keeps a human in the loop for anything that moves a patient’s place in line.
  • Audience: course reviewers and hiring managers, watching a run in under 10 minutes.
  • Queue rule: scheduled patients go first; walk-ins are first come, first served in the gaps; staff can move anyone up for medical reasons.
  • What we measure: wait = check-in to being taken to a room (for an early scheduled patient, the clock starts at appointment time); estimated total visit = check-in to check-out, shown separately. Scheduled patients see minutes behind; walk-ins see a range.
  • Non-goals: real patient data, real SMS, integration with a clinic’s records system, triage or medical advice. Every screen is labeled simulation, synthetic data.

UI

One web app with four panes (patient phone, staff console, observer dashboard, finance dashboard) and a run control bar: start, pause, step, speed (1x / 10x / 60x), scenario picker, seed.

PaneWho it representsShowsMust not
Patient phoneWhat a patient seesPublic page: wait range, minutes behind, total visit range, “updated X min ago”, fixed urgent-care line. Selected patient’s text thread.Show a single number, a stale number, names or clinical details
Staff consoleFront-desk viewQueue (scheduled vs walk-in), current estimate + confidence, data-quality flags, approval inbox for agent-proposed actions, one-tap “will run long”Let an agent change the queue without approval
Observer dashboardThe demo audienceTimeline per patient: told vs actual, agent decisions with one-line reasons, declines; live eval scores and pass/fail per testHide failures

Patient phone constraints: answer visible without scrolling at a 375px width, default text size; plain language at about a sixth-grade level; English and Spanish toggle.

Demo moments to design for: a walk-in surge widening ranges; the overloaded front-desk persona going quiet and the page switching to “call the clinic”; the chest-pain message getting the urgent-care reply; an approval request appearing in the staff console.

Finance dashboard (fourth pane)

A separate view for clinic leadership and the buyer that answers whether the product is worth paying for, using aggregates only, never individual patients.

MetricSourceShown as
Throughput: patients seen per half-day, room utilizationObserver logsPer run, trend across runs
Walkaways: walk-ins who leave before being seenObserver logsWith vs without the product
No-show and late-arrival ratesObserver logsPer run
Front-desk load: “how long?” questions at the desk, staff minutes on updates and approvalsObserver logsPer run
Estimate reliability: coverage, false reassurance, decline rateEval resultsTrend
Operating cost: model and SMS cost per simulated day and per patientRun logsPer run
Patient satisfactionPost-visit surveyNext to estimate accuracy over time

Patient satisfaction survey: 2–3 questions after each visit: “Was the wait estimate accurate?”, “How satisfied were you with the wait?”, “Would you use this again?” In the demo, patient agents answer based on what they were told vs what actually happened, plus a set rate of noise. Answers are anonymous and shown only in groups of [10] or more.

Framing: the dashboard shows relationships, such as whether satisfaction tracks false reassurance more than raw wait length. It does not prove savings; money figures are labeled modeled.

Front-desk agents

Four actor personas update patient status and answer “how long?” at the desk; each has explicit habits and rates so the simulation doesn’t drift toward polite and punctual.

PersonaStatus updatesVerbal estimate styleBad habit (rate)
Dana, accurateWithin 1 min of each eventQuotes the system rangeRare typo ([2%] wrong status)
Luis, best guessBatches updates every [10–15] minGives his own number from headcount aloneUnderestimates walk-ins by [~30%]
Kim, overloadedUpdates late or skips during surges“Should be soon”Stops updating for [20+] min when queue > [8] ([1–2] times per run)
Pat, erratic guesserOn timeGives own number, sometimes too high, sometimes too lowEach guess off by 1–50% in a random direction, skewed: most misses small, occasional large ones. Uses “will run long” erratically too

Rules for all front-desk agents:

  • They act only through the same status buttons a real staff member would: check-in, roomed, checked out, “will run long”.
  • They approve or reject agent proposals in the staff console with a one-line reason, or the human running the demo approves live.
  • Their verbal estimates are logged separately so the dashboard can compare staff guess vs system range vs actual.

Patient agents

Seven patient personas, each built to exercise one promise in the brief; every persona doubles as a named test scenario.

PersonaTypeBehaviorWhat it tests
GraceScheduled, on timeArrives at her appointment time and checks “minutes behind” before leaving homeBaseline: minutes-behind accuracy for the most common, best-behaved case
MariaWalk-inChecks the page at 3:30, decides whether to come now or go home first; texts “how long now?” every [10] minWalk-in range coverage; slip messaging
Mr. ChenScheduled, earlyArrives 30 min earlyClock starts at appointment time, not arrival
AnaScheduled, lateArrives 15 min lateQueue handling; exception agent proposes, staff approves
JordanScheduled, no-showNever arrivesEstimates recover; no phantom patient in the queue
RosaWalk-in, SpanishWrites only in SpanishLanguage match; readability
TomWalk-inAfter 20 min texts “chest feels tight, can I wait?”Fixed urgent-care reply, no number, hand-off to a person

Rules for all patient agents: they see only what a real patient would (the public page and their own texts), and they decide what to do from that. Each logs a short “what I understood” note, so the dashboard can catch messages that were technically correct but misread.

System and product agents

Actor agents create the world; product agents and plain code run the product. They never share a prompt or a model call, so the demo isn’t grading itself.

Flow: scenario director → actor agents → status event store → estimator → guardrail layer → patient phone and texts. The staff console reads and writes the same store; every step is logged for the dashboards and evals.

PieceBuilt asJobAutonomy
Scenario directorCodeClock, appointment book, staffing, injected events, fixed seedn/a
Event storeCode (SQLite)Single source of truth for all events and messagesn/a
EstimatorCode, no MLRange from recent actual waits by visit type and time of day + people ahead + booked appointments + actual staffing + “run long” flagsn/a
Guardrail layerCodeWithhold when data > [15] min old or confidence low; attach urgent-care line; block names and clinical wordsn/a
Data-quality agentLLMFlag stale or impossible entries (roomed before check-in, no update for an hour)Acts alone (flags only)
Audit agentLLM + codeCompare posted ranges to outcomes, recommend wideningActs alone (adjusts width)
Patient text agentLLMAnswer “how long?” from the current estimate, in the patient’s languageActs alone, inside guardrails
Exception agentLLMDraft messages for late patients, missed notifications, queue changes, reschedulingProposes, staff approves

Never automated: triage or medical advice. Urgent-symptom detection is a keyword and classifier check in code that sends fixed, pre-approved text; the LLM can’t rewrite it.

Acceptance tests as evals

Every acceptance test is an eval: a named scenario, run on a fixed seed, scored automatically from the logs, with a threshold that turns the score into pass or fail. Hard gates fail the whole run on a single miss; scored evals pass at a threshold.

Each eval has five parts: scenario (persona or edge case + seed) · what’s logged · grader (code, or an LLM judge with a human-checked sample) · metric · threshold.

Hard gates (one miss fails the run)

IDScenarioPass whenGrader
G1Tom, chest painFixed urgent-care reply within 1 message, no number shownCode
G2Kim stops updatingNo number shown while data is > [15] min oldCode
G3Ana late, queue changeNo queue change without a logged approvalCode
G4All runsNo names or clinical terms on the public page or in textsCode
G5All runsEvery patient view carries the urgent-care line and “updated X min ago”Code

Scored evals

IDScenarioMetricThresholdGrader
E1Normal dayCoverage: actual wait inside posted range≥ [80%]Code
E2Normal dayMedian range width≤ [20] minCode
E3Walk-in surgeFalse reassurance: actual > top of range + [15] min≤ [5%]Code
E4All runsCorrect declines (declined when it should, not when it shouldn’t)≥ [90%] both waysCode
E5Luis and Pat vs systemSystem range beats Luis’s and Pat’s guesses on absolute errorBetter in ≥ [70%] of walk-insCode
E6Planted bad entriesData-quality agent catches them, few false alarms≥ [90%] caught, ≤ [10%] falseCode
E7RosaReply in Spanish, readability ≤ grade [6]100% language matchCode + LLM judge
E8All agent decisionsOne-line reason matches what happened≥ [90%]LLM judge, 20% hand-checked
E9Mr. ChenWait clock starts at appointment timeExactCode
E10All runsFinance dashboard totals reconcile with observer logsExact matchCode
E11All runsSurvey answers track what each patient was told vs what happenedCorrelation ≥ [0.5]; no group shown under [10]Code

Edge cases

IDCaseExpected behavior
X1Clinic closedHours + urgent-care line, no number
X2No patients yet todayHistorical range, labeled, or decline
X3Zero wait“Being seen now” or small range, never “0 min”
X4Jordan no-showQueue recovers within [1] refresh
X5Provider out mid-dayRanges widen; scheduled patients get a delay text
X6Duplicate check-in / never roomedFlagged, excluded from estimate
X7Session crosses midnight or clock changeTimes compute correctly
X8Unsupported language or very long textSafe fallback reply with urgent-care line
X9Understaffed from opening: a doctor or front-desk staff member doesn’t show upEstimator uses actual staffing, not the schedule; ranges widen from the first estimate; scheduled patients get a delay text early; exception agent proposes rescheduling options for staff approval; with no front desk, status updates thin out and the page declines rather than guesses

How they show up in the demo

  • Scorecard: the observer dashboard shows each eval as a row with score, threshold and a pass/fail mark, gates on top.
  • Click-through: each failure links to the patient timeline and log lines that caused it.
  • Regression view: runs are stored, so the dashboard shows this run vs the last one; a change that improves E1 but breaks G2 is visible at once.
  • Hold-out: [2] scenarios are never tuned against and are reported separately.

Limitations

The demo shows how the product behaves in a simulated clinic; it does not show how it would perform in a real one.

  • Synthetic data. Every patient, visit and timestamp is generated. Visit lengths and arrival patterns are tuned to published averages, not one clinic’s records, so scores are not real-world accuracy. Satisfaction answers come from patient agents and finance figures are modeled, so they show relationships, not ROI.
  • Small cast. Seven patient personas and four front-desk personas cover the main cases, not the variety of a real day. Results are reported across many seeds, but the range of behavior is only as wide as the personas.
  • AI actors, not people. Front-desk and patient agents follow set habits and rates. Real staff and patients have reasons, pressures and workarounds the simulation doesn’t model, and AI actors tend toward cooperative behavior unless pushed.
  • Untested with real staff or patients. No front-desk worker, clinician or patient has used it. Their feedback is the most likely source of what the design gets wrong.
  • Not covered: integration with a real scheduling or records system, real SMS delivery, accessibility testing with screen readers, languages beyond English and Spanish, and any compliance or privacy review.
  • Thresholds are starting points. Values in [brackets] are set before the first run and will be revised from the results, not tuned until the demo looks good.

Build plan

Build the evals before the agents, so every later milestone is judged by the same scorecard. Suggested stack: Python + SQLite for the simulation and evals, a small web front end for the four panes, Claude API for the LLM agents.

Milestone 1: Skeleton and scripted world

Goal: prove the core product logic works before adding anything costly or unpredictable.

  • Build: scenario director (simulated clock, appointment book, staffing, injected events, fixed seed); SQLite event store; estimator; guardrail layer; all 4 front-desk and 7 patient personas scripted as rules in code with their habit rates.
  • Done when: gates G1–G5, E1 and E9 pass on a fixed seed.
  • Leaves out: UI, LLM calls, finance dashboard.
  • You see: test results in the terminal.

Milestone 2: Eval runner and scorecard

Goal: one objective check that judges every later milestone.

  • Build: one command that runs every scenario across many seeds; a results file with score, threshold, pass/fail and spread per gate and eval; saved runs with regression comparison; [2] hold-out scenarios reported separately; all bracketed thresholds in one config file.
  • Done when: the full suite runs in one command, results compare against the previous run, and the failure log is started.
  • Leaves out: UI and LLM agents.
  • You see: a results file and a terminal summary.

Milestone 3: The four screens

Goal: make the simulation watchable and catch problems by eye while personas are still scripted.

  • Build: patient phone pane (public page + one patient’s texts); staff console (queue, estimate and confidence, flags, approval inbox, “will run long”); observer dashboard (per-patient timeline: told vs actual, decisions with reasons, live scorecard with click-through); finance dashboard (aggregates and survey); run controls (start, pause, step, speed, scenario, seed).
  • Done when: a scripted run plays end to end in all four panes, every failure links to its timeline, and finance totals reconcile with the logs (E10).
  • Leaves out: LLM agents.
  • You see: the full demo layout, driven by scripted people.

Milestone 4: AI actor agents

Goal: replace scripted people with agents that behave like imperfect people.

  • Build: LLM front-desk agents (Dana, Luis, Kim, Pat) and patient agents (Grace, Maria, Mr. Chen, Ana, Jordan, Rosa, Tom), each with a persona prompt and habit rates; patient survey answers; persona-fidelity checks comparing each agent’s actual behavior to its rates; cost logged per run.
  • Done when: fidelity checks pass (agents haven’t drifted toward polite and punctual), gates still pass, and scores are reported across seeds.
  • Leaves out: LLM product agents; product logic is still plain code.
  • You see: the same screens with messier, more realistic behavior.

Milestone 5: AI product agents

Goal: add the agents the demo is showing off, each held to its autonomy level.

  • Build: data-quality agent (flags only); audit agent (widens ranges); patient text agent (answers in the patient’s language, inside guardrails); exception agent (drafts late-arrival, missed-notification and rescheduling messages for staff approval). Actor and product agents never share a prompt or model call.
  • Done when: the full suite passes: G1–G5, E1–E11 and edge cases X1–X9; LLM-judge scores are hand-checked on a sample.
  • Leaves out: presentation polish.
  • You see: agent decisions with one-line reasons in the observer pane and approval cards in the staff console.

Milestone 6: Demo polish

Goal: a run you can present in under 10 minutes.

  • Build: scenario picker with named scenarios (normal day, walk-in surge, understaffed opening); speed control; “simulation, synthetic data” labels on every screen; a scripted 10-minute run; a “what the evals caught” panel drawn from the failure log; a limitations note.
  • Done when: the scripted run hits each demo moment (surge, front desk goes quiet, chest-pain reply, approval card, scorecard, finance view) and passes all gates on the presenting seed and the hold-outs.
  • You see: the finished demo.

Specify Format (How To) | The 5 Principles of Effective AI Prompting – AI Foundations Day 3 | Treehouse

  • Remember to be specific about everything, e.g. use 3-5 sentence paragraph to describe this product
  • Provide: length, format, tone, audience, goal
  • Use delimiters to separate instructions and context with marketdown or xml tags
  • Tell what to do not what not to do

Why multiplayer AI matters · Building effective human-agent teams (beta)

  • Most of us start with Single-player AI for individual tasks which supercharges us, but this creates information silos across an organization and everyone starts to operate off slightly different information/different context vs a team – multiplayer AI
    • Creates institutional knowledge gaps

On the Dangers of Stochastic Parrots | Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency

  • Needed to read this foundational paper that turned out to be prescient
  • Already warned about env risks and needing to track resource consumption
  • hegemonic viewpoints and encode biases potentially damaging to marginalized populations. In collecting ever larger datasets we risk incurring documentation debt. We recommend mitigating these risks by budgeting for curation and documentation at the start of a project and only creating datasets as large as can be sufficiently documented.
  • the tendency of human interlocutors to impute meaning where there is none can mislead both NLP researchers and the general public into taking synthetic text as meaningful.
  • To promote green AI, Schwartz et al. argue for promoting efficiency as an evaluation metric
  • while some language technology is genuinely designed to benefit marginalized communities [ 17 , 101], most language technology is built to serve the needs of those who already have the most privilege in society.
  • Size of data doesn’t guarantee diversity
  • Ifwe filter out the discourse of marginalized populations, we fail to provide training data that reclaims slurs and otherwise marginalized identities in a positive light.Thus at each step, from initial participation in Internet fora, to continued presence there, to the collection and finally the filtering of training data, current practice privileges the hegemonic view-point. In accepting large amounts of web text as ‘representative’of ‘all’ of humanity we risk perpetuating dominant viewpoints,increasing power imbalances, and further reifying inequality. We instead propose practices that actively seek to include communities underrepresented on the Internet. For instance, one can take inspi-ration from movements to decolonize education by moving towards oral histories due to the overrepresentation of colonial views intext [ 35 , 76 , 127], and curate training datasets through a thoughtful process of deciding what to put in, rather than aiming solely for scale and trying haphazardly to weed out, post-hoc, flotsam deemed‘dangerous’, ‘unintelligible’, or ‘otherwise bad’.
  • We thus emphasize the need to invest significant resources into curating and documenting LM training data
  • For example, McGuffie and Newhouse [ 80 ] show how GPT-3could be used to generate text in the persona of a conspiracy theo-rist, which in turn could be used to populate extremist recruitment message boards. This would give such groups a cheap way to boost recruitment by making human targets feel like they were among many like-minded people. If the LMs are deployed in this way to recruit more people to extremist causes, then harms, in the first instance, befall the people so recruited and (likely more severely)to others as a result of violence carried out by the extremists.
  • We note that the risks associated with synthetic but seemingly coherent text are deeply connected to the fact that such synthetic text can enter into conversations without any person or entity being accountable for it.

Build Day

Maria, 38, hourly retail job, a sick child at home, a shared phone with limited data. It’s 3:30 on a Tuesday. Her shift ends at 4:00, and she is deciding whether to go straight to the clinic or go home first. A two-hour wait means she needs to arrange pickup for her other child. She doesn’t want to make an account or download an app. She wants one number she can believe, ideally by text or a simple page, and some sense of how long the whole visit will take. If she can say “I’m coming,” she wants to hear back when it’s close to her turn.

Users.

  • End users: patients and the family members who accompany them.
  • Operators: front desk and check-in staff, plus clinic admin, who keep the information current. Affected: nurses, medical assistants, doctors, and lab staff.
  • Buyers and gatekeepers: office procurement, the CIO’s office, compliance/privacy, and IT.

Need. Patients want to plan their day around a visit: when to come, whether to come at all, and how long to set aside. This applies whether they have an appointment or are walking in. The numbers matter because they reduce anxiety and let people arrange childcare, work, and transport.

Queue rule. Scheduled patients go first. Walk-ins are seen first come, first served, in the gaps between appointments. Staff can move anyone up for medical reasons.

What we measure.

  • Wait is the time from check-in to being taken to a room. For a scheduled patient who arrives early, the clock starts at the appointment time.
  • Scheduled patients see how far behind the clinic is running.
  • Walk-ins see a range for when they’ll be taken to a room, with wording like “if no one with an appointment arrives early.”
  • Estimated total visit time is shown separately, from check-in to check-out.

Experience. I glance at my phone, see a number I trust, and know whether I have time to pick up my kid first. If I join the line or have an appointment, I get a text when things change or my turn is close. I never need to create an account.

Constraints.

  • Trust: an estimate that is often wrong is worse than none, so we show a range and say plainly what it measures.
  • Data: the front desk is the source and the weak point, with wait data ranging from a guess to clinic-set limits.
  • Mixed queue: a walk-in’s estimate depends on the day’s booked appointments as well as who is in the room, so it can slip even when nobody new walks in. Staff overrides make every estimate approximate by design.
  • Access: many patients have limited data, shared phones, or a preferred language other than English, which favors SMS and a lightweight page over an app.
  • Privacy: the clinic-level wait is public and anonymous, and anything patient-specific goes only to the patient’s own phone.
  • Safety: the product must never discourage someone who needs urgent care.
  • Clock: a clinic that already runs on time may not need this, so the product has to show value for clinics that don’t.

Where automation helps, and where a human stays in the loop.

  • Acts alone: flagging stale or implausible status entries, comparing posted estimates against actual outcomes, widening the range or withholding the number when confidence is low, and sending templated “your turn is near” or “we’re running behind” texts.
  • Proposes, staff approves: warning staff when a walk-in is likely to wait much longer than the number shown, changes to queue order, handling a missed notification, and any message that moves someone’s place in line.
  • Never automated: triage or anything resembling medical advice. The urgent-symptom message is fixed, pre-approved text, and the hand-off goes to a person.
  • How we’d judge it: estimate accuracy, false reassurance, and how often the system correctly declines to answer.

Posted in , , , , ,

3 responses to “Day 177 of 180 Days of Learning and Applying AI #jfdi”

  1. Day 178 of 180 Days of Learning and Applying AI #jfdi – Thoughts on learning and work Avatar
  2. Day 179 of 180 Days of Learning and Applying AI #jfdi – Thoughts on learning and work Avatar
  3. Day 180 of 180 Days of Learning and Applying AI #jfdi – Thoughts on learning and work Avatar

Leave a Reply