
The problem
Product catalogs accumulate gaps over time. New SKUs land without the full attribute set; old SKUs were imported before the current taxonomy existed; vendor-provided data is incomplete in predictable places. The gaps do not matter until they block a workflow — a missing HS code stops international shipping, a missing category breaks faceted search, a missing unit price blocks the PO autoroute.
The team that owns the catalog usually fills the gaps by hand. The same SKU appears in shipments, in similar-product clusters, in supplier feeds — the data to fill the gap exists somewhere, but the human is the one synthesizing it. The cost compounds: every new gap requires the human to be the conditional-probability engine again.
How it works
Multi-field gap fill is one query per missing field from the available context. Given the product's name, supplier and the attributes it already has, _predict fills the categorical fields — category, HS code, unit of measure, account code, tax class — each with its own confidence and $why, and _estimate fills the numbers, such as unit price and weight, from comparable products. A field that no product in the category carries is marked as not applying rather than invented. High-confidence fields can be applied in bulk; estimates, which have no probability, are left for a person to confirm.
The pattern matches Smart Form Fill but applied to data rather than to input UI. The form variant runs at user-input time; the gap-fill variant runs in batch over the existing catalog. Both use the same query shape — predict the unknown fields conditional on the known fields, with calibrated per-field confidence.
{
"from": "products",
"predict": "category",
"where": {
"name": "Multi-Surface Cleaner 750ml (Oulu)",
"supplier": "Berner Oy",
"hs_code": "3924.10",
"unit_of_measure": "kg"
},
"select": [
"$p",
"$value",
{
"$why": {
"highlight": {
"posPreTag": "«",
"posPostTag": "»"
}
}
}
],
"limit": 10
}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 catalog gap fill to this codebase using Aito, a predictive database. The feature: fill in the missing category, codes and tax class and estimate price and weight for incomplete products, from similar products in our catalog. 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/catalog-gap-fill/ 4. Use this reference implementation as the pattern (schema, data load and queries): https://github.com/AitoDotAI/aito-erp-demo/blob/main/src/catalog_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.
Frequently asked
How does this handle products with very little reference data?
Products with few similar siblings get low-confidence predictions. The system honestly says "I do not have enough comparable products to fill this gap" and leaves the field for human input. As similar products accumulate (or as the SKU itself accumulates history), the confidence rises and the field auto-fills.
Can we run this in batch across the entire catalog?
Yes. The query is the same; it just runs against many rows. A batch gap-fill surfaces a ranked list: high-confidence fills to apply, mid-tier suggestions for human review, low-confidence rows that need source-data correction. In the ERP demo, one click applies every prediction above 85% (or 70%) across the incomplete products.
What about supplier-provided data — should we trust it or predict?
Trust supplier data first; predict where it is missing. The two compose: supplier data fills what the supplier provided, and the gap-fill prediction handles the fields it left empty. For high-stakes fields (HS code, regulatory categories), the prediction is a suggestion not an auto-fill — humans confirm before commit.
How accurate is this on new product categories that do not exist yet?
Genuinely new categories return low confidence — the system has nothing to compare against. The fields for those products stay empty until either the human creates the category and applies a few examples, or similar enough products accumulate that the system can infer by similarity.
Does this work for service catalogs (not just physical products)?
Yes. The pattern is "predict missing fields from available context" — applicable to service catalogs, project templates, contract types, vendor profiles, anywhere a catalog of records has structured attributes. The threshold tuning differs by domain.



