Skip to content

feat(mist): add a daily data digest skill for Mist app databases - #135

Open
AaronIngersoll wants to merge 1 commit into
mainfrom
aaron/daily-data-digest-skill
Open

feat(mist): add a daily data digest skill for Mist app databases#135
AaronIngersoll wants to merge 1 commit into
mainfrom
aaron/daily-data-digest-skill

Conversation

@AaronIngersoll

Copy link
Copy Markdown
Collaborator

What

Adds mist/daily-data-digest — a skill that reads a Mist app's own database and reports what changed in the last 24 hours: per-table volume trends, spikes, drops, and stalls. It delivers the result twice, as a written digest in chat and as a show_dashboard dashboard that overwrites itself each day, so there's always exactly one current view per app.

Two files: the skill body and a manifest.json entry alongside the other mist/ skills.

Why

Mist can already query a Mist app's database (db_schema / db_query resolve to the active project's Neon or PGlite side), but nothing turns that capability into a recurring read on whether an app is actually healthy. Answering "is this thing still getting traffic, and did anything break overnight?" means someone remembering to ask. Paired with a recurring schedule from skill-schedules, this makes that answer arrive on its own — the run's final message becomes the schedule summary and the notification the user reads.

How it works

Every Mist app has its own arbitrary schema, so the skill is schema-agnostic: db_schema overview to rank tables, then tables mode on a shortlist to read real column names and types. It never assumes a table or column exists.

Design decisions worth reviewing:

  • Rolling 24-hour windows, not calendar days. A cron firing at 08:00 compares an eight-hour partial "today" against full-day averages and manufactures a drop every single morning. Rolling windows are always complete and always comparable.
  • Anomaly rules carry absolute floors — a spike needs >=2x baseline and >=5 rows. Without the floor, 1 → 3 rows reads as a "200% spike" and the digest becomes noise nobody opens after a week.
  • Stable dashboard title. The dashboard id derives from the title and the same title overwrites in place (dashboards.service.ts:221), so the skill mandates an app-specific, date-free title. A date in the title would mint a new dashboard file daily and bury the panel.
  • timestamptz vs timestamp is called out explicitly, because comparing the wrong one against now() silently slides the window boundaries by the server's timezone offset.
  • Aggregates only, never row-level PII. These are real production tables, and the output lands in both a chat log and a saved dashboard file on disk.
  • Non-blocking by construction — no human_in_the_loop, never ends a turn waiting for input, since the whole point is the unattended scheduled path.
  • A mandatory Coverage section lists tables that were skipped and why. A silent skip reads as "all clear" when the table was never checked.

Known limitation

db_query and db_schema resolve against the active project only (tools/index.ts:11968) — there is no cross-app query tool — so one run covers one Mist app, and covering five apps means five daily schedules. The skill says this plainly rather than pretending to sweep. A genuine roll-up would need a target-slug parameter on db_query; the plumbing already exists, since the discovery service caches every app's connection as mist-db:<slug>:<side> and exposes resolveSide().

How to test

  1. python3 -m unittest discover -s scripts -p 'test_*.py' → 16 tests pass.
  2. python3 scripts/validate_catalog.pycatalog validation passed: 42 skills, 6 workflows (was 41 skills). Both were run locally on this branch and pass; they're the same two steps validate-catalog.yml runs in CI.
  3. End-to-end, against a real Mist app: copy mist/daily-data-digest/ into ~/Fluid/skills/, relaunch Mist, open a Mist app project with a provisioned production database, and run the skill. Expect a digest naming real tables with real counts, plus a saved dashboard. Then add a daily recurring schedule captured against that project and confirm the headless run produces the same digest as its run summary.

Step 3 has not been run — the skill is unexercised against a live database so far, and that's the review risk worth weighing: the SQL templates and the show_dashboard card shapes are derived from the tool contracts and the descriptor schema rather than from a real execution.

Review guide

Focus on: mist/daily-data-digest/SKILL.md — specifically the roll-up SQL template and the anomaly thresholds.
Skim: manifest.json — a mechanical nine-line catalog entry.

🤖 Generated with Claude Code

Mist can already query a Mist app's own database, but nothing turns that
into a recurring read on whether the app is healthy. This adds a
schema-agnostic skill that discovers the app's tables, trends row volume
over rolling 24-hour windows, flags spikes/drops/stalls against a 7-day
baseline, and delivers the result as both a chat digest and a saved
dashboard that overwrites itself each day.

Rolling windows rather than calendar days: a cron firing mid-morning
compares a partial "today" against full-day averages and invents a drop
every morning. Anomaly rules carry absolute floors (>=2x baseline AND
>=5 rows) so 1 -> 3 rows doesn't read as a 200% spike.

Co-Authored-By: Claude Opus 5 (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