
The problem
A services revenue forecast is usually the delivery schedule summed by month. The schedule assumes every project lands on time and on budget, and the finance team adds a haircut from experience. When projects slip, the forecast learns about it at month end.
Whether a project will slip is predictable from the projects before it: its type, manager, team size, duration, priority and budget. That prediction belongs in the forecast.
How it works
For each active project, _predict returns the probability of on-time and of on-budget delivery, each with its $why. The application spreads the project's remaining value over the months it is scheduled for, then moves the share at risk of slipping, one minus P(on-time), to the month after the scheduled end. The scheduled line and the predicted line sit side by side and sum to the same total; nothing is invented or lost, only moved in time. Projects already past their scheduled end are reported separately as overdue.
A project whose prediction moves shows up in the gap between the two lines, with the drivers that moved it.
{
"from": "projects",
"predict": "on_time",
"where": {
"project_type": "implementation",
"manager": "L. Lounela",
"team_size": 4,
"duration_days": 106,
"priority": "high",
"budget_eur": 31800.0
},
"select": [
"$p",
"$value",
{
"$why": {
"highlight": {
"posPreTag": "ยซ",
"posPostTag": "ยป"
}
}
}
],
"limit": 2
}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 ERP.
See it live
This use case runs in the ๐ ERP 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 revenue outlook to this codebase using Aito, a predictive database. The feature: show scheduled revenue per month next to revenue adjusted by each active project's predicted on-time delivery, with its on-budget odds and the reasons beside it, from our project history. 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/revenue-outlook/ 4. Use this reference implementation as the pattern (schema, data load and queries): https://github.com/AitoDotAI/aito-erp-demo/blob/main/src/forecast_service.py and https://github.com/AitoDotAI/aito-erp-demo/blob/main/src/project_service.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. Measure before wiring the UI: hold out recent closed rows and report the calibration per probability band against the base rate. 7. In the UI, show the probability ($p) and the reasons ($why) on each row, and flag the rows beyond a threshold I choose for review. Never write the score back as a decision. Ask me before changing anything outside the new feature.


