ERP, POS, inventory and margin already modeled
Semantic tables, per-store views and context document
Answer with executed SQL and the official rule
MCP in chat and leadership and store WhatsApp
What it solves
- The AI answers net sales, available inventory and margin with the same rule as the dashboard.
- Each manager sees only their own store; sensitive data stays with leadership.
- The AI runs the query before answering and says when the data does not exist or is late.
Business questions it answers
Ask your agent these questions once the case is live.
What you need
- ERP, POS or hub connected to Nekt, with the sales, inventory and margin tables already modeled
- The list of stores and who can see each one
- The official definitions of net sales, margin and available inventory
What you get
- Semantic tables per purpose, with grain and measures described for the AI
- One view per store with its own permission, and full views for leadership only
- Context document with the rules the AI must follow
- Freshness monitor that warns when a load did not run
Where to activate
Leadership and analysts ask in chat with access to the whole chain and the sensitive tables.
Each manager asks on WhatsApp and gets only their own store's numbers.
Early every day: yesterday's sales, target variances, A-curve stockouts and late loads.
The work is in the descriptions, the per-store views and the permissions. It requires sales and inventory to be modeled already. The detailed view has the business rules, the pitfalls and the acceptance test. Or send everything straight to your agent with the Nekt MCP.
Leadership and managers want to ask in natural language and get the official number. Without semantic descriptions, the AI picks the wrong column (gross instead of net), applies a time zone to a field that is already a business date, and adds up branches that share the same inventory. Without per-table permissions, one store's manager queries another store, and the assistant exposes cancellations that identify the cashier.
How it is usually done, and the rule
Each row is a mistake that already happened in practice.
Create consumption tables per question: daily sales by store, fiscal line item, inventory by product and branch, margin by item. Each one has its grain declared in the description in one sentence ("One row per store, per day"). Do not expose a generic table that mixes grains, and do not use a financial field from an operational table as revenue.
Start the column description with the tag: @pk for the grain key, @fk for a foreign key, @measure additive for something summable across any dimension, @measure non_additive for average ticket and percentages, @grain=daily or monthly. Then, in text: origin, calculation rule and pitfall. Document the table, not just the transformation.
"How much did we sell" is answered with net sales (gross minus discounts minus cancellations). The answer always names the metric, the period and the store. Gross only when asked.
ERP date fields stored as midnight UTC are already the business day. The AI computes today and yesterday in America/Sao_Paulo and compares directly, without converting the field. The rule is written in the column description and in the context document.
In Nekt, permissions apply to an entire layer or to a table or view, with read and edit roles. Folders in the catalog are only visual organization and protect nothing. Create one view per store (daily sales filtered to that store) and grant each manager only theirs. Use a token scoped by table for each audience's assistant.
Cancellations and cancellation attempts identify the cashier and are used for evaluation and investigation. They do not go into the store views, not even filtered to the store itself. They stay in leadership, audit and HR views.
The assistant never answers a number without running the query. It also does not decline for lack of data before reading the structure of the domain's semantic table. Metrics flagged as "to be validated" are not inferred. When the field does not exist, the answer is "data not found in this source".
Available = total quantity minus reserved, never negative. Branches that mirror the same physical inventory are aggregated by stock group, never summed. Products with unlimited stock stay out. A nonexistent product and an out-of-stock product get different answers. Product codes are standardized (for example, left-padded with zeros to 18 positions in SAP) before joining with sales.
The assistant's views run on an event right after the source table, never with a manual trigger. A monitor with its own schedule detects missing runs (for example, more than 120 minutes without a load). The answer states the date and time of the last update.
Companies in the same group can show up as separate accounts or stores. Transfers between them are neither revenue nor operating expense and are eliminated in the consolidated view. Margin comes from the official margin table, never recomputed by the AI with a different rule.
Which table answers each question
Routing for the assistant's context document.
Definitions
Pitfalls that already happened
The AI answered gross sales as net and was off by six figures on a single store's result for a single day.
Net sales as the default, with @measure and the rule written in the description.
The AI converted a date field that was already the business day to BRT and answered zero sales on a high-sales day.
Column description stating there is no time zone conversion.
The per-store views were created with a manual trigger and went more than a week without updating, while the source was up to date.
Event trigger after the source table and a missing-run monitor.
The store views were in separate folders and the team assumed each manager only saw their own. A folder is visual organization.
Permission granted view by view, tested with each store's user.
Two mirror branches added together doubled the balance. In another database, extracting the product code from the URL field instead of the reference code lost about 80% of inventory.
Aggregate by stock group and extract the code from the reference field.
Acceptance test
The case is done when every item passes.
- For a set of 10 reference questions (one store's net sales yesterday, a product's inventory at a DC, a channel's margin for the month), the assistant returns exactly the dashboard number for all of them.
- With a store's user, querying another store or the cancellations table returns permission denied.
- The inventory of a group of mirror branches equals the balance of one branch in the group, not the sum.
- Every numeric answer includes the date of the last update, and the monitor alerts when a load passes the limit without running.
Agent package
Paste into Claude, ChatGPT or any client with the Nekt MCP connected.
Sales, inventory and margin assistant - Do not answer a number without running SQL. Do not decline for lack of data before reading the DDL of the domain's semantic table. - Routing: sales and ticket by store in daily sales by store; product and tax in the fiscal line item; inventory in inventory by product and branch; stockouts in the inventory snapshot; margin in the contribution margin table; targets in the targets table. - "How much did we sell" = net sales (gross minus discounts minus cancellations). Always state the metric, the period and the store. - ERP sale dates are the business day stored as midnight UTC. Do not convert time zones. Today and yesterday in America/Sao_Paulo. - Average ticket and percentages are not additive: recompute from the sums. - Available inventory = total minus reserved, minimum zero. Aggregate mirror branches by stock group. Say whether the product does not exist or is just out of stock. - Metrics flagged as "to be validated" are not inferred. Nonexistent field: "data not found in this source". - Transfers between group companies are not revenue. - State the date of the last update in every numeric answer. Client exceptions: - <client>: branches <A> and <B> mirror the same inventory (group <group>). - <client>: stores without direct sales <list>. - <client>: group companies <list>; sales between them are intercompany.
Build the "AI assistant for leadership and stores" case in my Nekt workspace following the rules at https://academy.nekt.com/en/industrias/varejo/assistente-ia-diretoria-lojas.md. 1) Find the source tables and confirm the columns the rules use. 2) Create a transformation at the stated grain applying every rule. 3) Run the acceptance test and show me the result of each item. 4) Create the case's context document in the workspace, leaving my clients' exceptions open for me to fill in.
Variations
Dictionary of catalog abbreviations (qj for queijo, cheese) and an inverted index to find the product the way the salesperson writes it.
Store WhatsApp questions and answers in a table to review hits and misses.
Same layer for work orders, parts and labor, separating revenue from profit and service visit volume.