Skip to content

Ballmer: always-on BAC agent with interactive dashboard controls#13

Open
jberm236-98 wants to merge 8 commits into
victorsteeb:mainfrom
jberm236-98:ballmer-bac-agent
Open

Ballmer: always-on BAC agent with interactive dashboard controls#13
jberm236-98 wants to merge 8 commits into
victorsteeb:mainfrom
jberm236-98:ballmer-bac-agent

Conversation

@jberm236-98

Copy link
Copy Markdown

Summary

  • Adds the Ballmer always-on BAC agent: a simulated bar-night loop that ticks every 20 min, computes BAC via Widmark + Watson TBW, and steers the drinker toward the XKCD #323 Ballmer Peak (0.129–0.138%)
  • Adds a live web dashboard (serve_dashboard.py + web/dashboard.html) that plays back the session tick-by-tick with a real-time BAC chart, gauge, and burndown projection
  • Adds a sidebar Controls panel with interactive toggles:
    • Start time — shift when the simulated session begins (clock labels update live)
    • Food state — empty / light / full (re-runs simulation; affects absorption speed)
    • Auto-consume — toggle whether the agent auto-orders drinks (re-runs simulation)
    • Speed — playback speed slider 0.5–5s per tick (no re-simulation)
    • Loop — toggle continuous looping (no re-simulation)
  • POST /api/config endpoint re-runs the simulation for physiology-affecting changes; speed/loop update the playback in-place

Test plan

  • python serve_dashboard.py — dashboard opens at http://127.0.0.1:8765, BAC curve animates tick-by-tick
  • Toggle food state → "recalculating…" flashes, playback restarts with different absorption curve
  • Change start time → clock labels in tick log shift to new start hour
  • Toggle auto-consume OFF → BAC curve stays flat (no drinks ordered)
  • Drag speed slider → playback visibly speeds up / slows down
  • Toggle loop OFF → playback stops at last tick instead of restarting

⚠️ The Ballmer Peak is a joke from XKCD #323 and is not health or safety advice.

🤖 Generated with Claude Code

Bermensolo and others added 8 commits June 22, 2026 15:49
The coordinator was instructed to spawn exactly one specialist per ticket,
causing it to silently abandon any issue beyond the primary one. Removed
the one-specialist constraint and added explicit rules to spawn per category
and withhold resolved status until all issues are actioned.

Validated: 0/5 → 1/1 on T-4471, 3/3 on holdout (T-4490, T-4503).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
A scheduled-agent demo built on the Always-On Ops construct (tick -> read
state -> reason vs policy -> write action), with a real Widmark/Watson
pharmacokinetic engine underneath.

- Pure BAC engine (bac_model.py): Widmark + Watson TBW with blood-water
  correction (r=TBW/(0.806*kg) ~ 0.649 for the demo profile), zero-order
  elimination, first-order absorption with food modifier. 14 hand-calc unit
  tests against the brief's anchors.
- Recipe-level ethanol library (~20 drinks, JSON, recipe-defined).
- Recommendation: dwell-in-window minus overshoot penalty, plus a climb
  gradient so the agent builds the multi-drink staircase to the band; soft
  nudge past a configurable safety ceiling.
- Always-on tick loop over fast-forwarded simulated time; writes transcripts
  to state/log/. Burndown = (BAC - target_low)/beta projects time to leave
  the range.
- Local live web dashboard (stdlib http.server + vanilla-JS canvas, no pip
  installs, offline): in-range indicator, gauge, BAC curve, burndown line.
- Prominent safety framing throughout: the band is a comic-strip joke, above
  every legal driving limit, not health/safety advice.

Note: deliberately corrects the brief's r=TBW/weight to the blood-water form
to hit the brief's own stated anchors (documented in config.py/bac_model.py).
TODO: validate against published BAC time-course data.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds start time, food state, auto-consume, speed, and loop toggles to
the left panel. POST /api/config re-runs the simulation for physiology
changes; speed/loop update instantly without re-simulation.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Fix time_to_leave_window to use ODE integration instead of the naive
  linear formula (current - low) / beta, which ignores residual
  absorption from drinks still being absorbed and can underestimate
  burndown by 2-3x immediately after a drink
- Fix burndown projection line in web_data.py to use the same ODE
  forward curve rather than a straight linear decline
- Add weight (lb), height (in), and age inputs to controls panel;
  changes trigger re-simulation with updated Widmark r-factor
- Add 0.08% US legal driving limit as a dashed reference line on chart

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Adds the actual agent intelligence that transforms Ballmer from a scoring
script into an LLM-powered agent:
- drink-library.json: each drink now has a vibe score (1-10) reflecting
  its character for a Ballmer Peak coding session (dry martini=10,
  long island=2, etc.)
- ballmer/drinks.py: Drink dataclass gains vibe_score field
- ballmer/llm_agent.py: new module — llm_reason() calls Claude Haiku
  with current BAC state, the drink menu with vibe scores, and the math
  model's recommendation, and uses tool use to return a structured
  pick + 2-3 sentence reasoning
- serve_dashboard.py: POST /api/llm_reason calls the LLM for the current
  tick state and returns the recommendation as JSON
- web/dashboard.html: "Ask Claude" button + response panel shows Claude's
  recommended drink (with color-coded pill), vibe score, and reasoning

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Updates the LLM system prompt to speak in authentic Boston dialect:
dropped R's, local slang (wicked pissa, no suh, kid, chief), strong
opinions, and gruff Southie attitude — while still delivering correct
BAC reasoning and drink recommendations.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…hiskey

- Remove the disclaimer warning banner from the dashboard header
- Y-axis now uses fixed 0.02 increments with light gridlines instead
  of dividing yTop into 5 uneven parts
- Add Double whiskey, rocks (4 oz) to drink library (vibe 8)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ab KPI

- Rename "dashboard" to "model" throughout (title, sub-header, browser tab)
- Add explainer callout box below title explaining the XKCD #323 joke
- Add price field to every drink in the library (realistic bar prices)
- Thread price through Drink dataclass and web_data frame pipeline
- Add bac_delta (Widmark contribution per drink) and price columns to tick log
- Add live running tab KPI ($X.XX) in the header, updating each tick

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant