
The problem
Project plans get written from a template and the planner's memory. The template does not know that this kind of job usually needs a subcontractor in phase two, or which supplier the last three similar projects bought from.
The past projects know. Their tasks, assignees, and purchases are the evidence a planner would want in front of them while writing the plan.
How it works
Each step of the plan is a prediction from past projects: _predict the next phase, the tasks in it, the kind of assignee and the person, then the materials, supplier, and amount from past purchases. Each prediction shows its $why, and the planner accepts it or swaps it.
The plan is assembled from many small predictions instead of one generated document, so every line can be checked against the history it came from.
{
"from": "tasks",
"predict": "phase",
"where": {
"project_type": "construction",
"region": "Helsinki",
"season": "summer"
},
"select": [
"$p",
"$value",
{
"$why": {
"highlight": {
"posPreTag": "«",
"posPostTag": "»"
}
}
}
],
"limit": 5
}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 project plan drafting to this codebase using Aito, a predictive database. The feature: draft a new project's plan step by step (next phase, its tasks, who does them, materials and suppliers) from our completed projects, each suggestion with its reasons for the user to accept or swap. 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/project-plan-drafting/ 4. Use this reference implementation as the pattern (schema, data load and queries): https://github.com/AitoDotAI/aito-erp-demo/blob/main/src/task_service.py and https://github.com/AitoDotAI/aito-erp-demo/blob/main/src/aito_client.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 rows, run the predictions, and report accuracy against the current behaviour. 7. In the UI, show the confidence ($p) and the reasons ($why). Fill in automatically only above a threshold I choose; below it, suggest. Ask me before changing anything outside the new feature.



