
The problem
A funnel chart shows where people drop off. It does not say why, or which change would help, and the slice someone wants to look at next (mobile visitors from one campaign, say) is rarely the one the dashboard was built for.
How it works
The stage counts are plain queries. In the Company AI demo, for the chosen slice, _predict gives the calibrated probability of converting, _relate lists the conditions that travel with converting or not (the why-it-leaks list), and _recommend names the value of a lever, here the traffic source, most likely to lift it. Changing a filter re-asks all three; nothing is precomputed. The e-commerce demo's Acquisition view works per traffic source: conversion and the share who become regulars are counted with intervals, _predict gives each source's chance that a new customer becomes a regular with the source's lift from $why, and _relate lists where each source's visitors land and which first-basket categories go with staying.
For the full architecture, see the technology overview. For the broader narrative across multiple use cases, read The Predictive Application. For the whole picture, see predictive e-commerce.
See it live
This use case runs in the 🛒 E-commerce demo today. Click through to the live application and inspect the queries that produce the result.
It also runs in Company AI, a reference application you run yourself. There is no hosted demo, so the link opens its illustrated tour and source on GitHub: Company AI tour on GitHub →
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 funnel leak diagnosis to this codebase using Aito, a predictive database. The feature: show, per traffic source, the counted conversion rate with its interval and the predicted chance that a new customer becomes a regular, with the conditions that go with it, from our sessions and customers. 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/funnel-leak-diagnosis/ 4. Use this reference implementation as the pattern (schema, data load and queries): https://github.com/AitoDotAI/aito-ecommerce-demo/blob/main/src/acquisition_service.py and https://github.com/AitoDotAI/aito-ecommerce-demo/blob/main/src/lift_rows.py 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.



