Excel Intelligence & ControlsExcel Intelligence & Controls · LaurenceYang · Detailed Run Evidence

Preserved six-step workflow: the original synthetic product proof

This historical method demo uses one four-sheet workbook: payroll (long format), inventory (long format), department master data (zero formulas), and budget (wide format). Each sheet contains one seeded issue modeled on a common business failure, and all five detection paths hit. Select a station below to inspect the generated output from each step.

Every figure and report excerpt on this page comes from generated run artifacts produced by the one-command run_demo.sh workflow; they are not visual mockups. At the Step 0 station, you can also rerun the engine locally in your browser.
Current authority: the live Browser Analyzer has since added formula-family grouping, dependency evidence, Excel errors, and a review map. The separately installed local Agent is now stable 1.34.0 with five Skills. This page remains evidence of the earlier generated workflow; it is not the current Skill or CLI inventory.

Step 0 · Profile: identify the workbook before interpreting it

Historical tool excel_ai.py profile · Outputs a profile-report Markdown file + profile.json

The machine hypotheses matched all four sheets:

SheetPattern hypothesisStructureheader_rowsOriginal formulasSpecial note
Payroll DetailsPayroll / labor cost (5 keyword matches)long3 (title + grouped header + field row)12Performance coefficient ⚠️ contains non-numeric / meaning not participating
Inventory LedgerInventory / stock movement (5 keyword matches)long136Suggest rollforward + continuity
Department Master DataNo pattern match · generic tablelong10⚠️ Zero-formula table → validate data quality
Budget ExecutionBudget execution / expense control (4 keyword matches)wide110Suggest horizontal reconciliation
The profile is a machine hypothesis, not a conclusion. Recount header_rows when reading the Markdown in the next step. One incorrect row invalidates everything downstream.

Rerun it in your browser now ↓

The same demo workbook and a ported version of the same algorithm. The file loads from this site and analysis runs locally in your browser.

Step 1 · Excel → structured MD: make the workbook legible to AI

Tool excel_ai.py tomd · One Markdown file per sheet plus an index

A direct read_excel turns a three-row header into Unnamed: 0. The tomd step parses the header region row by row (excerpt from generated output):

**Row 0** (1 non-empty column): Column 0: `June 2026 Payroll Calculation Details (Demo)` ← Title (merged A1:I1)
**Row 1** (2 non-empty columns): Column 3: `Income Items`  Column 6: `Deductions`             ← Group headers
**Row 2** (9 non-empty columns): Employee ID | Name | Department | Base A | Allowance B | Commission C | Deduction D
                                  | Gross Pay E=A+B+C-D | Performance Coefficient            ← Actual field row

Using data_only=False, the tool extracts original formulas and converts supported formulas into draft expressions:

Original formulaDraft translationSupported
=D4+E4+F4-G4C3+C4+C5-C6
=SUM(C2:H2)(0+(C2+C3+C4+C5+C6+C7))
=IF(A2>100, 0.1, 0.05)— Must be authored by AI
=VLOOKUP(A2, Performance!A:C, 3, 0)— Must be authored by AI
The translator is intentionally conservative: it stops at IF. Rewriting a ternary expression involves business judgment, so no translation is safer than a wrong guess.

Step 1b · Spec scaffold: generate a draft without letting incomplete logic proceed

Tool excel_ai.py scaffold · Output spec.draft.json

The scaffold sets the header depth and maps keys, dimensions, and fields by column position to machine aliases C0C8. Translatable Excel formulas become checks directly; unsupported formulas are marked TODO. Below is an unaltered excerpt from generated output (excel_ai.py scaffold web/demo/multi_type.xlsx --sheet <payroll-sheet>):

{
  "sheet": "Payroll Details",  "header_rows": 3,
  "keys":       {"C0": 0, "C1": 1},
  "dimensions": {"C2": 2},
  "fields":     {"C3": 3, "C4": 4, "C5": 5, "C6": 6, "C7": 7, "C8": 8},
  "derived": {},
  "checks": [{"name": "Gross Pay E=A+B+C-D", "target": "C7",
              "expr": "C3+C4+C5-C6", "tolerance": 0.01,
              "_translated": true, "_source_formula": "=D4+E4+F4-G4"}],
  "table_checks": [
    {"type": "unique",   "name": "Primary key is unique", "fields": ["C0"]},
    {"type": "non_null", "name": "Required fields are present", "fields": ["C0", "C1"]}]
}
The draft looks this way by design. C0 / C3 are positional machine aliases, not business names. The scaffold does not guess which column means “Employee ID.” Its TODO list names the required human work:
  1. Confirm that header_rows is correct (the easiest item to get wrong)
  2. Replace machine aliases such as C0/C1 with meaningful business names (A / B1 / DEPT …)
  3. An expr containing TODO is a formula the script cannot translate; AI must understand the business context and author it
  4. Expand checks to input-level fields where possible instead of referencing a prior result column
  5. Add table_checks from suggested_checks, then add lineage / ontology / analysis

Only after completion is the spec ready for verify: aliases become business names, and table checks are limited to the rules this period's workbook actually needs:

{
  "keys":   {"ID": "Employee ID", "NAME": "Name"},
  "fields": {"A": "Base A", "B": "Allowance B", "C": "Commission C", "D": "Deduction D",
             "E_x": "Gross Pay E", "COEF": "Performance Coefficient"},
  "checks": [{"name": "Gross Pay E", "target": "E_x",
              "expr": "round(A+B+C-D, 2)", "tolerance": 0.01}],
  "table_checks": [
    {"type": "unique",      "name": "Employee ID is unique", "fields": ["ID"]},
    {"type": "total_row",   "name": "Total-row reconciliation", "field": "E_x"},
    {"type": "range",       "name": "Performance coefficient range", "field": "COEF", "min": 0, "max": 2},
    {"type": "foreign_key", "name": "Department must exist in master data",
     "field": "DEPT", "sheet": "Department Master Data", "key": "Department Name"}]
}
Hard guard: if verify finds any expr still set to TODO, it refuses to run and returns exit code 2. Validation cannot proceed with incomplete understanding.

Step 2·3 · Field ontology + formula chain and lineage: the two steps that cannot be automated

Owner: AI-authored while reading the Step 1 Markdown · This is cognitive work

A script can extract =D4+E4-G4, but not “Column G is the employee social-insurance contribution, capped by local minimum and maximum bases, and not deducted in the month of departure.” Business meaning is not stored in the file; it lives in what the column label implies. Layered formula chain (demo payroll sheet):

Layer 1 · Inputs       A=Base Salary  B=Allowance  C=Commission  D=Deduction  ← Entered by a person / supplied upstream
Layer 2 · Intermediate INCOME = A + B + C
Layer 3 · Result       Gross Pay E = round(A + B + C − D, 2)                 ← Existing Excel column used for reconciliation
Value caveat           Performance Coefficient `/` = not participating (≠ a score of zero)

Cross-sheet lineage (each record states source → target / join key / explanation):

SourceTargetJoin keyExplanation
Department Master.Department NamePayroll Details.DepartmentDepartment NameDimension reference that must exist in master data (foreign_key anchor)
Inventory Ledger.Previous Month EndInventory Ledger.Current Month BeginningSKU + MonthCross-period linkage (continuity anchor)
Put uncertainty into the “questions awaiting confirmation” list and ask a person; do not fill gaps by guessing. These definitions require AI interpretation and human review because the workbook does not contain all of the business context.

Step 4 ★ · Full validation: recalculate every row and run table controls

Tool excel_ai.py verify · Row recalculation + 19 table-level rule types + cell-level provenance + cross-sheet checks
Payroll Details
91.67% · 1 table-level exception type
Inventory Ledger
100% · 1 table-level exception type
Budget Execution
80.00% · 1 table-level exception type

Passing requires 100% row-level agreement and zero table-level exceptions. All three sheets fail because the demo intentionally seeds issues; this is the expected result.

4 seeded issues, 5 detection paths, all hit

#Seeded issueDetection ruleGenerated output
Gross pay in row 7 was manually increased by 120checks row-level recalculationcsid1003 gross pay AI=9745.14 / Excel=9865.14 / variance −120.00
An employee references “Strategy Department,” which is absent from master dataforeign_key“Strategy Department” does not exist in Department Master Data (4 row references)
SKU-B has a beginning-to-ending inventory continuity gap across monthscontinuity[SKU-B] Month 3 ending 610.00 ≠ Month 4 beginning 647.00
The wide-table “Actual Total” omits one monthidentity horizontal reconciliationRent expense AI=53067.78 / Excel=43757.54 / variance 9310.24
H7 is a constant while the other 11 cells in the column are formulas
↑ A second independent path to the same issue as ①
Formula breakpoint (cell-level provenance, not a table_checks rule)H7 · coverage 11/12 · ✓ Failed row hit → root-cause cell
Count carefully: 4 issues, 5 detections. ① and ⑤ inspect the same issue: H7 was hard-coded as a constant, causing a row-level variance of 120 and leaving a formula breakpoint in the column. Two independent paths hitting one error is defense in depth, not two separate errors.
How to read a mismatch: a mismatch does not always mean the model is wrong. A few isolated rows with a clean variance of 120 are typical evidence of a manual override; the same proportional variance across every row would instead suggest a definition error.

Step 4b · Ontology graph: turn encoded columns into business objects

Tool excel_ai.py graph · Outputs ontology.json + Mermaid + ontology report

Objects, links, and functions are already encoded in the spec (keys / foreign_key / derived / checks). This step reads those definitions rather than guessing again. Generated counts: 4 objects · 1 link · 8 functions (2 validated) · property DAG with 32 nodes / 35 edges · 1 non-simulatable path

Payroll Record One person-month · 12 rows · failed Department Master unverified DEPT ❌ failed Inventory Record One SKU-month · 18 rows · failed Budget Execution Record One expense-year · 5 rows · failed — Solid = supported by a passed check - - Dashed = unverified Red = a validation failed by design: 100% row pass + table exception still means failed
Discipline: every link needs support from a passed foreign_key, and every function needs support from a passed check. Anything without a green light is marked unverified and drawn with a dashed line. An automatically inferred but unvalidated ontology is more dangerous than no ontology because it looks authoritative.

Impact ranking (how many downstream nodes change when this node changes): IN/OUT → 3 downstream nodes; M1..M6 → 3; A/B/C → 2. This answers “if this number is wrong, what else is affected?”

Step 5 · Delivery and What-If: recalculate affected dependencies

Tool excel_ai.py output / analyze · Three-color result workbook + analysis report + whatif.json

The output Excel uses three colors: Blue = original input Green = AI calculation Orange = variance, with four additional sheets for validation summary, table checks, data lineage, and field ontology.

What-If no longer relies on a hand-written recalculation list. It starts from the changed input and propagates automatically through the dependency DAG, while explicitly reporting paths that cannot be calculated (generated output):

## What-If: 10% increase in base salary
**Changed input**: `A`
**Automatically recalculated intermediate values** (topological order): `INCOME`
> ⚠️ The following path cannot be simulated and was excluded rather than forced:
>   `R_net`: Net pay requires cumulative withholding tax; a single-month sheet lacks cross-month cumulative values
Gross Pay E total: 152,517.24 → 165,824.50 (+13,307.26)
This changes What-If from “it may calculate incorrectly” to “it tells you when it cannot calculate.”

Step 6 · Web dashboard: one file colleagues can open directly

Tool excel_ai.py dashboard · Embedded data · Offline-ready

KPIs and workflow, ontology graph (dashed = unverified), per-sheet validation tabs, formula breakpoints, What-If propagation, and findings are packaged into one HTML file. The file below is the dashboard generated by the demo workflow:

Open the generated dashboard (new tab)

Final report: name the owner and next action

Translate “four issues found” into “who owns each issue and how to fix it”

This review covered 3 business sheets (plus 1 referenced master-data sheet), 35 records, and 58 validation points, identifying 4 issues:

1. Gross pay for csid1003 in the payroll sheet was manually overridden by +120—the row formula was replaced by a fixed value (root-cause cell H7). Confirm whether this was a specially approved supplemental payment; if so, record it through the supplemental-payment process. Owner: payroll specialist.
2. “Strategy Department” is absent from department master data, but 4 employees reference it, so cost allocation cannot find a cost center. Owner: HR master-data manager.
3. SKU-B has a 37-unit inventory gap between the end of month 3 and the beginning of month 4, suggesting an unrecorded inventory gain or transfer. Owner: warehouse operations.
4. The Actual Total formula for Rent Expense in the budget sheet omits June, understating the total by 9,310.24. Owner: budget preparer.

Issues 1 and 4 are calculation errors in the workbook and directly affect reported figures; issues 2 and 3 are data-management process gaps that require an added control step.

Try it with your workbook → Read the complete methodology (PRD)