
The problem
Ad-hoc segment analysis usually waits for someone to build the cube. The slices the cube was built for answer fast; the slice the analyst actually wants next does not exist yet.
Thin slices bring a second problem. A raw rate over a few dozen rows looks as solid as one over thousands, and a dashboard that shows only the rate invites a decision the data cannot support.
How it works
The breadcrumb is the WHERE clause. Each click narrows it, and three kinds of statement re-run on the new slice: predict() for the calibrated outcome rate, recommend() with the slice as its condition for the levers the business can change, and a GROUP BY count for the raw rates of every value.
The engine and the counts can disagree on a thin slice, and the page shows both. The prediction shrinks toward the base rate when the evidence is thin, which is the calibration working, not a bug.
For the full architecture, see the technology overview. For the broader narrative across multiple use cases, read The Predictive Application.
See it live
This use case runs in the 🐘 SQL demo today. Click through to the live application and inspect the queries that produce the result.
Build it with Claude Code
Paste this prompt into Claude Code, or another coding agent, in your own codebase. It runs Aito locally from the Docker image, reads the API docs written for agents, and follows a working reference implementation.
Add slice explorer to this codebase using Aito, a predictive database. The feature: let users narrow our customer data one click at a time, and for each slice show the predicted outcome rate, the levers that move it, and the raw counted rates beside them. 1. Run Aito locally: `docker pull ghcr.io/aitohq/aito`, then follow https://aito.ai/docker/ to start it with your own API keys (keep them in the environment, never in code). 2. Read https://aito.ai/docs/api/llms.txt for the v2 query shapes before writing any query. 3. Read the use-case guide: https://aito.ai/use-cases/slice-explorer/ 4. Use this reference implementation as the pattern (schema, data load and queries): https://github.com/AitoDotAI/aito-sql-demo/blob/main/src/explore.py and https://github.com/AitoDotAI/aito-sql-demo/blob/main/sql/01_schema.sql 5. Find the matching tables in this codebase, design the Aito schema for them (links between tables where we have foreign keys), and load a sample. 6. Check the numbers before building the view: compare a few of them against a direct count over the same rows (SQL or a short script), and report any that differ. 7. In the UI, show the evidence behind each number (the counts, the interval or $why), and leave out patterns with too little data behind them. Ask me before changing anything outside the new feature.



