Lumentum's Historical sheet as built by Claude Code and by Codex, each of the 19 requested lines coloured by the check against the 10-K's XBRL: Claude's cost of sales includes intangible amortization and Codex's capital expenditures are negative

Can AI build an Excel financial model? Claude Code vs Codex on a 10-K

Yes. Claude Code and Codex each wrote a Python script that built a four-sheet AI Excel financial model of Lumentum from the same 10-K and the same prompt, in under six minutes, with live formulas and every check cell TRUE after recalculation. Python then checked all 187 numbers on the two Historical sheets against the XBRL tags in the 10-K: 177 match to the decimal, and the other 10 differ only by a sign or definition convention the model chose. None was wrong. The trouble is quieter than a typo. The two workbooks book the same costs under the same labels in different ways, each right by its own definition, and their forecasts land $54 million apart on fiscal 2031 revenue and $525 million apart on free cash flow.

Lumentum's Historical sheet as built by Claude Code and by Codex, each of the 19 requested lines coloured by the check against the 10-K's XBRL: Claude's cost of sales includes intangible amortization and Codex's capital expenditures are negative

The setup

The company is Lumentum (LITE), the optical components maker, and the document is its 10-K for the year to 27 June 2026. I converted the SEC’s HTML to plain text with the BeautifulSoup script below, about 81,000 words. It’s a good test file because fiscal 2026 is a mess: revenue up 83.2% to $3,014.0 million, and a net loss of $6,935.1 million, driven by a $7,756.6 million non-cash loss on debt extinguishment after Lumentum swapped convertible notes for about 10.6 million shares. Any model that treats fiscal 2026 net income as a normal base year falls over on the first row.

# BeautifulSoup 4.15: python to_text.py lite-20260627.htm lumentum-10k-fy2026.txt
import sys, re
from bs4 import BeautifulSoup
soup = BeautifulSoup(open(sys.argv[1], encoding="utf-8").read(), "html.parser")
for t in soup.find_all(["ix:header", "script", "style"]):
    t.decompose()
for d in soup.find_all(style=re.compile(r"display:\s*none")):
    d.decompose()
for tbl in soup.find_all("table"):
    rows = []
    for tr in tbl.find_all("tr"):
        cells = [re.sub(r"\s+", " ", td.get_text(" ", strip=True)) for td in tr.find_all(["td", "th"])]
        cells = [c for c in cells if c and c not in ("$", ")", "%")]
        if cells:
            rows.append(" | ".join(cells))
    tbl.replace_with(soup.new_string("\n" + "\n".join(rows) + "\n"))
for br in soup.find_all(["p", "div", "br", "tr"]):
    br.insert_after("\n")
text = soup.get_text()
text = re.sub(r"[ \t\xa0]+", " ", text)
text = re.sub(r"\n\s*\n+", "\n\n", text)
open(sys.argv[2], "w").write(text.strip() + "\n")
print(len(text), "chars")

Each tool ran once, headless, on 28 November 2026, in a folder holding nothing but that text file, and wrote its workbook with openpyxl 3.1.5. Claude Code 2.1.330 ran Claude Opus 5.5 in non-interactive mode with permission to write and run files in its folder, and took 209 seconds. Codex CLI 0.171.0 ran gpt-6.2-sol at high reasoning effort through codex exec, in a sandbox that could write to the folder, and took 335 seconds.

Both tools read standing instruction files by default (why that matters is below), so Claude Code ran with CLAUDE_CODE_DISABLE_CLAUDE_MDS=1, and Codex with CODEX_HOME pointed at a fresh folder holding only its login and config, which keeps its global AGENTS.md out. Asked in the same setup to quote any instructions from CLAUDE.md or AGENTS.md files or from memory, both answered “NONE”. The commands, with the prompt piped in:

CLAUDE_CODE_DISABLE_CLAUDE_MDS=1 CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 \
  claude -p --output-format text --model claude-opus-5-5 --dangerously-skip-permissions < prompt.md
CODEX_HOME=/path/to/fresh-codex-home \
  codex exec --skip-git-repo-check --ephemeral -s workspace-write -m gpt-6.2-sol \
  -c model_reasoning_effort="high" - < prompt.md

The prompt fixed the Historical layout so the files could be checked line by line:

The file lumentum-10k-fy2026.txt in this folder is the text of the annual report on Form 10-K of Lumentum Holdings Inc. (Nasdaq: LITE) for the fiscal year ended June 27, 2026, as filed with the SEC.

Build an Excel financial model of Lumentum from this 10-K. Write a Python script, build_model.py, that uses openpyxl to create lumentum_model.xlsx in this folder, and run it. Use only the 10-K in this folder: no web access and no other data.

The workbook has four sheets.

1. "Historical": fiscal 2024, 2025 and 2026 as reported in the 10-K, in USD millions (EPS in dollars, shares in millions). Row 1 is the header. Column A holds the line names below, exactly as written, one per row starting in row 2, in this order; columns B, C and D hold fiscal 2024, 2025 and 2026. Type the reported figures in as numbers. Lines that are calculated from other lines (gross profit, free cash flow, total debt, the margins) are Excel formulas. Leave a cell empty when the 10-K does not give the figure for that year.
   Net revenue
   Cost of sales
   Gross profit
   Research and development
   Selling, general and administrative
   Operating income (loss)
   Net income (loss)
   Diluted EPS
   Diluted weighted average shares
   Depreciation and amortization
   Stock-based compensation
   Net cash from operating activities
   Capital expenditures
   Free cash flow
   Cash and cash equivalents
   Total debt
   Total stockholders' equity
   Gross margin
   Operating margin

2. "Assumptions": the forecast drivers for fiscal 2027 to 2031 as input cells (revenue growth, gross margin, R&D and SG&A as a share of revenue, tax rate, depreciation and amortization, capital expenditures and stock-based compensation as a share of revenue, and any other driver you need), each with a one-line note on its basis in the 10-K.

3. "Forecast": fiscal 2027 to 2031 income statement down to net income, and free cash flow. Every cell is an Excel formula that refers to "Assumptions" and "Historical".

4. "Checks": formulas that test the model, each returning TRUE or FALSE (for example that gross profit equals revenue minus cost of sales).

Every calculated cell must be a live Excel formula, never a value computed in Python and written in as a number. Do not value the company or its shares. When you have finished, reply with a short summary: what each sheet holds, and any figure you were unsure about.

openpyxl writes formulas but never calculates them, so the raw files hold no results for formula cells (its data_only flag returns “the value stored the last time Excel read the sheet”, per the openpyxl tutorial). I recalculated both workbooks in LibreOffice 26.2 (headless) and read those copies.

What they built

Both built the four sheets with the names and row order the prompt gave, with one departure. Claude made cost of sales a formula (the reported cost of sales line plus the amortization line below it) where the prompt asked for reported figures typed in, and its reply says why. Claude’s Forecast sheet holds 120 formulas and no typed numbers; Codex’s holds 115 formulas and no typed numbers. Codex wrote 57 TRUE/FALSE checks. Claude’s reply says it wrote 59; the sheet holds 60, plus an “All checks pass” cell, so the first miscount of the test came from a model summarizing its own work. Every check returned TRUE after recalculation.

“Live formulas” is easy to claim, so I set the fiscal 2027 growth input to zero and recalculated. Claude’s fiscal 2031 revenue fell from $7,206.0 million to $5,147.2 million, Codex’s from $7,259.6 million to $5,377.5 million, and all the checks stayed TRUE.

The assumption notes were better than I expected. Every driver came with a line on its basis in the 10-K, and Claude dug out details like the $56.4 million of intangible amortization sitting inside fiscal 2026 SG&A. Both spotted that fiscal 2027 runs 53 weeks, which the 10-K states in its accounting policies note. Neither forecast touches fiscal 2026 profit: both build down from revenue, and Claude’s reply names the debt loss as the reason fiscal 2026 EPS and tax rates are no guide.

Checking an AI Excel financial model against XBRL

The check pulls the 10-K’s own XBRL facts from the SEC, filtered to this filing’s accession number, and builds every line either workbook holds. The functions follow the SEC EDGAR API tutorial in Python; if XBRL is new to you, the XBRL parser post explains the structure.

import os
import re
from html.parser import HTMLParser
import requests
import pandas as pd
import matplotlib.pyplot as plt

# The SEC asks every script to identify itself. Set your own contact first:
#   export SEC_USER_AGENT="Your Name you@example.com"
HEADERS = {"User-Agent": os.environ["SEC_USER_AGENT"]}
ACCN = "0001628280-26-057358"  # Lumentum's 10-K for the year to 27 June 2026, filed 17 August 2026
TEN_K = "https://www.sec.gov/Archives/edgar/data/1633978/000162828026057358/lite-20260627.htm"
FACTS = requests.get("https://data.sec.gov/api/xbrl/companyfacts/CIK0001633978.json",
                     headers=HEADERS, timeout=60).json()["facts"]["us-gaap"]
YEARS = ["FY2024", "FY2025", "FY2026"]
YEAR_END = dict(zip(YEARS, ["2024-06-29", "2025-06-28", "2026-06-27"]))


class InlineXBRL(HTMLParser):
    """Every numeric fact tagged in an inline XBRL filing, with its period end, including dimensional facts."""

    def __init__(self):
        super().__init__()
        self.facts, self.ends, self.open, self.context, self.tag = [], {}, [], None, None

    def handle_starttag(self, tag, attrs):
        self.tag, a = tag, dict(attrs)
        if tag == "xbrli:context":
            self.context = a["id"]
        elif tag == "ix:nonfraction":
            self.open.append([a, ""])

    def handle_data(self, data):
        if self.tag in ("xbrli:instant", "xbrli:enddate") and data.strip():
            self.ends[self.context] = data.strip()
        if self.open:
            self.open[-1][1] += data

    def handle_endtag(self, tag):
        self.tag = None
        if tag == "ix:nonfraction" and self.open:
            a, text = self.open.pop()
            number = 0.0 if "zero" in a.get("format", "") else float(re.sub(r"[^\d.]", "", text) or "nan")
            sign = -1 if a.get("sign") == "-" else 1
            self.facts.append((a["name"].split(":")[-1], a["contextref"], sign * number * 10 ** int(a.get("scale", 0))))


html = requests.get(TEN_K, headers=HEADERS, timeout=60).text
parser = InlineXBRL()
parser.feed(html)
IX = pd.DataFrame(parser.facts, columns=["concept", "context", "value"])
IX["end"] = IX["context"].map(parser.ends)
TEXT = re.sub(r"\s+", " ", re.sub(r"<[^>]+>", " ", html).replace("&#160;", " "))


def filed(concept, fy, unit="USD"):
    """What this 10-K tagged for a concept and fiscal year: full-year flows or year-end balances, in millions."""
    rows = pd.DataFrame(FACTS[concept]["units"][unit])
    rows = rows[(rows["accn"] == ACCN) & (rows["end"] == YEAR_END[fy])]
    if "start" in rows:
        days = (pd.to_datetime(rows["end"]) - pd.to_datetime(rows["start"])).dt.days
        rows = rows[days.isna() | (days > 360)]
    if rows.empty:  # companyfacts drops dimensional facts; fall back to the filing's own inline tags
        rows = IX[(IX["concept"] == concept) & (IX["end"] == YEAR_END[fy])].rename(columns={"value": "val"})
        if rows["val"].nunique() != 1:
            return None
    value = float(rows["val"].iloc[-1])
    return value if unit == "USD/shares" else value / 1e6


def ten_k(fy):
    """Every line either workbook holds, from the 10-K's XBRL tags (USD millions, shares in millions)."""
    def f(concept, unit="USD"):
        return filed(concept, fy, unit)
    rev, gp, op = f("RevenueFromContractWithCustomerExcludingAssessedTax"), f("GrossProfit"), f("OperatingIncomeLoss")
    ocf, capex = f("NetCashProvidedByUsedInOperatingActivities"), f("PaymentsToAcquirePropertyPlantAndEquipment")
    dep, amort = f("Depreciation"), f("AmortizationOfIntangibleAssets")
    debt = [f("LongTermDebtCurrent"), f("LongTermDebtNoncurrent")]
    return {
        "Net revenue": rev,
        "Cost of sales": f("CostOfGoodsAndServiceExcludingDepreciationDepletionAndAmortization"),
        "Amortization in cost of sales": f("CostOfGoodsAndServicesSoldAmortization"),
        "Gross profit": gp,
        "Research and development": f("ResearchAndDevelopmentExpense"),
        "Selling, general and administrative": f("SellingGeneralAndAdministrativeExpense"),
        "Restructuring": f("RestructuringCharges"),
        "Gain on sale of facility": f("GainLossOnSaleOfPropertyPlantEquipment"),
        "Operating income (loss)": op,
        "Interest expense": f("InterestExpenseNonoperating"),
        "Interest and investment income": f("InvestmentIncomeInterest"),
        "Total other income (expense)": f("NonoperatingIncomeExpense"),
        "Income (loss) before taxes": f("IncomeLossAttributableToParent"),  # the tag Lumentum used on this line
        "Income tax": f("IncomeTaxExpenseBenefit"),
        "Net income (loss)": f("NetIncomeLoss"),
        "Diluted EPS": f("EarningsPerShareDiluted", "USD/shares"),
        "Diluted weighted average shares": f("WeightedAverageNumberOfDilutedSharesOutstanding", "shares"),
        "Basic weighted average shares": f("WeightedAverageNumberOfSharesOutstandingBasic", "shares"),
        "Depreciation": dep,
        "Amortization of intangibles": amort,
        # no single D&A line in this 10-K: depreciation (cash flow statement) + intangible amortization (Note 9)
        "Depreciation and amortization": dep + amort,
        "Stock-based compensation": f("ShareBasedCompensation"),
        "Net cash from operating activities": ocf,
        "Capital expenditures": capex,
        "Free cash flow": ocf - capex,
        "Cash and cash equivalents": f("CashAndCashEquivalentsAtCarryingValue"),
        # the cash flow statement's total (cash, cash equivalents and restricted cash): the only FY2024 cash tag
        "Cash incl. restricted": f("CashCashEquivalentsRestrictedCashAndRestrictedCashEquivalents"),
        "Short-term investments": f("ShortTermInvestments"),
        "Current portion of long-term debt": debt[0],
        "Long-term debt": debt[1],
        "Total debt": None if None in debt else sum(debt),
        "Total stockholders' equity": f("StockholdersEquity"),
        "Common shares outstanding": f("CommonStockSharesOutstanding", "shares"),
        "Preferred shares outstanding": f("TemporaryEquitySharesOutstanding", "shares"),
        "Gross margin": gp / rev,
        "Operating margin": op / rev,
    }


truth = pd.DataFrame({fy: ten_k(fy) for fy in YEARS})
print(f"{len(IX)} numeric facts tagged inline in the 10-K; {truth.notna().sum().sum()} line values for FY2024-FY2026")
same = all(abs(truth.loc["Cash incl. restricted", fy] - truth.loc["Cash and cash equivalents", fy]) < 0.05 for fy in YEARS[1:])
print(f"Restricted cash in FY2025 and FY2026 (cash flow total minus balance sheet cash): {'nil' if same else 'not nil'}")
for line in ["Net revenue", "Cost of sales", "Amortization in cost of sales", "Gross profit", "Capital expenditures"]:
    print(f"{line}: " + ", ".join(f"{fy} {truth.loc[line, fy]:,.1f}" for fy in YEARS))
1932 numeric facts tagged inline in the 10-K; 103 line values for FY2024-FY2026
Restricted cash in FY2025 and FY2026 (cash flow total minus balance sheet cash): nil
Net revenue: FY2024 1,359.2, FY2025 1,645.0, FY2026 3,014.0
Cost of sales: FY2024 1,023.8, FY2025 1,102.9, FY2026 1,680.5
Amortization in cost of sales: FY2024 83.9, FY2025 82.2, FY2026 77.6
Gross profit: FY2024 251.5, FY2025 459.9, FY2026 1,255.9
Capital expenditures: FY2024 133.0, FY2025 231.0, FY2026 451.3

The code finds 1,932 tagged numeric facts and builds 103 line values. The XBRL side has its own trap. Lumentum tags its cost of sales line as CostOfGoodsAndServiceExcludingDepreciationDepletionAndAmortization, so a script that looks for the usual CostOfGoodsAndServicesSold tag comes back empty for this filing (Lumentum last used it in 2019).

Next, every number on both Historical sheets, memo figures included, goes in as a dictionary copied from the recalculated files, and the code grades each cell against the filing. A difference counts as a convention only on the cells listed in CONVENTIONS; anything else prints as wrong:

# Every number on each Historical sheet after recalculation (FY2024, FY2025, FY2026; margins to four decimals).
# Rows 2-20 are the 19 lines the prompt asked for; the two sheets agree on 17 of them.
CLAUDE = {
    "Net revenue": [1359.2, 1645.0, 3014.0],
    "Cost of sales": [1107.7, 1185.1, 1758.1],
    "Gross profit": [251.5, 459.9, 1255.9],
    "Research and development": [302.2, 303.9, 356.5],
    "Selling, general and administrative": [310.7, 348.2, 363.2],
    "Operating income (loss)": [-434.0, -180.1, 524.8],
    "Net income (loss)": [-546.5, 25.9, -6935.1],
    "Diluted EPS": [-8.12, 0.37, -92.96],
    "Diluted weighted average shares": [67.3, 69.6, 74.6],
    "Depreciation and amortization": [261.2, 254.0, 264.5],
    "Stock-based compensation": [128.8, 177.2, 170.2],
    "Net cash from operating activities": [24.7, 126.3, 751.4],
    "Capital expenditures": [133.0, 231.0, 451.3],
    "Free cash flow": [-108.3, -104.7, 300.1],
    "Cash and cash equivalents": [436.7, 520.7, 2043.5],
    "Total debt": [None, 2573.2, 1637.4],
    "Total stockholders' equity": [957.3, 1134.7, 4643.9],
    "Gross margin": [0.1850, 0.2796, 0.4167],
    "Operating margin": [-0.3193, -0.1095, 0.1741],
}
CODEX = {**CLAUDE, "Cost of sales": [1023.8, 1102.9, 1680.5], "Capital expenditures": [-133.0, -231.0, -451.3]}
# The extra figures each model typed in to feed its formulas and checks (Claude: rows 23-40; Codex: columns G-I),
# with the sheet labels shortened to the names used in ten_k()
CLAUDE_MEMO = {
    "Cost of sales": [1023.8, 1102.9, 1680.5],
    "Amortization in cost of sales": [83.9, 82.2, 77.6],
    "Gross profit": [251.5, 459.9, 1255.9],
    "Restructuring": [72.6, 22.8, 11.4],
    "Gain on sale of facility": [0.0, -34.9, 0.0],
    "Total other income (expense)": [28.3, 8.0, -7697.6],
    "Income (loss) before taxes": [-405.7, -172.1, -7172.8],
    "Income tax": [140.8, -198.0, -237.7],
    "Interest expense": [33.8, 22.2, 21.8],
    "Interest and investment income": [61.3, 34.4, 60.2],
    "Depreciation": [110.6, 104.3, 128.8],
    "Amortization of intangibles": [150.6, 149.7, 135.7],
    "Current portion of long-term debt": [None, 10.6, 1596.9],
    "Long-term debt": [None, 2562.6, 40.5],
    "Short-term investments": [None, 356.4, 694.9],
    "Basic weighted average shares": [67.3, 69.0, 74.6],
    "Common shares outstanding": [67.9, 69.8, 88.6],
    "Preferred shares outstanding": [0.0, 0.0, 2.9],
}
CODEX_MEMO = {
    "Amortization in cost of sales": [83.9, 82.2, 77.6],
    "Depreciation": [110.6, 104.3, 128.8],
    "Amortization of intangibles": [150.6, 149.7, 135.7],
    "Current portion of long-term debt": [None, 10.6, 1596.9],
    "Long-term debt": [None, 2562.6, 40.5],
    "Gross profit": [251.5, 459.9, 1255.9],
    "Total debt": [None, 2573.2, 1637.4],
    "Restructuring": [72.6, 22.8, 11.4],
    "Gain on sale of facility": [0.0, -34.9, 0.0],
}


# The conventions found in each workbook, and the only cells they may explain
CONVENTIONS = {("Claude Code", "main", "Cost of sales"): "cost of sales with amortization",
               ("Codex", "main", "Capital expenditures"): "capex as a negative",
               ("Claude Code", "memo", "Gain on sale of facility"): "gain as a negative expense",
               ("Codex", "memo", "Gain on sale of facility"): "gain as a negative expense",
               ("Claude Code", "main", "Cash and cash equivalents"): "FY2024 cash from the cash flow statement",
               ("Codex", "main", "Cash and cash equivalents"): "FY2024 cash from the cash flow statement"}


def grade(model, block, line, fy, said, filing):
    """Compare one workbook cell with the 10-K's XBRL value; anything unexplained is wrong."""
    rule = CONVENTIONS.get((model, block, line))
    if rule == "FY2024 cash from the cash flow statement" and fy == "FY2024" and pd.isna(filing):
        return rule if abs(said - truth.loc["Cash incl. restricted", fy]) <= 0.05 else "wrong"
    if said is None or pd.isna(filing):
        if said is None and pd.isna(filing):
            return "both empty"
        return "zero for a dash" if said == 0 and line == "Gain on sale of facility" else "wrong"
    tol = 0.0005 if "margin" in line else 0.005 if line == "Diluted EPS" else 0.05
    if abs(said - filing) <= tol:
        return "match"
    if rule == "cost of sales with amortization" and abs(said - filing - truth.loc["Amortization in cost of sales", fy]) <= tol:
        return rule
    if rule in ("capex as a negative", "gain as a negative expense") and abs(said + filing) <= tol:
        return rule
    return "wrong"


grades, results = {}, []
for model, blocks in {"Claude Code": [CLAUDE, CLAUDE_MEMO], "Codex": [CODEX, CODEX_MEMO]}.items():
    for block, sheet in zip(["main", "memo"], blocks):
        g = pd.DataFrame({fy: {line: grade(model, block, line, fy, sheet[line][i], truth.loc[line, fy]) for line in sheet}
                          for i, fy in enumerate(YEARS)})
        if block == "main":
            grades[model] = g
        for (line, fy), result in g.stack().items():
            results.append({"model": model, "block": block, "line": line, "fy": fy, "result": result,
                            "sheet": sheet[line][YEARS.index(fy)], "filing": truth.loc[line, fy]})
results = pd.DataFrame(results)
checked = results[results["result"] != "both empty"]
for (model, block), part in checked.groupby(["model", "block"], sort=False):
    counts = part["result"].value_counts()
    print(f"{model}, {block}: {len(part)} numbers, " + ", ".join(f"{n} {k}" for k, n in counts.items()))
for r in checked[checked["result"] != "match"].itertuples():
    filing = truth.loc["Cash incl. restricted", r.fy] if pd.isna(r.filing) else r.filing
    print(f"  {r.model}: {r.line} {r.fy} is {r.sheet:,.1f} on the sheet, {filing:,.1f} in the 10-K ({r.result})")
Claude Code, main: 56 numbers, 52 match, 3 cost of sales with amortization, 1 FY2024 cash from the cash flow statement
Claude Code, memo: 51 numbers, 50 match, 1 gain as a negative expense
Codex, main: 56 numbers, 52 match, 3 capex as a negative, 1 FY2024 cash from the cash flow statement
Codex, memo: 24 numbers, 23 match, 1 gain as a negative expense
  Claude Code: Cost of sales FY2024 is 1,107.7 on the sheet, 1,023.8 in the 10-K (cost of sales with amortization)
  Claude Code: Cost of sales FY2025 is 1,185.1 on the sheet, 1,102.9 in the 10-K (cost of sales with amortization)
  Claude Code: Cost of sales FY2026 is 1,758.1 on the sheet, 1,680.5 in the 10-K (cost of sales with amortization)
  Claude Code: Cash and cash equivalents FY2024 is 436.7 on the sheet, 436.7 in the 10-K (FY2024 cash from the cash flow statement)
  Claude Code: Gain on sale of facility FY2025 is -34.9 on the sheet, 34.9 in the 10-K (gain as a negative expense)
  Codex: Capital expenditures FY2024 is -133.0 on the sheet, 133.0 in the 10-K (capex as a negative)
  Codex: Capital expenditures FY2025 is -231.0 on the sheet, 231.0 in the 10-K (capex as a negative)
  Codex: Capital expenditures FY2026 is -451.3 on the sheet, 451.3 in the 10-K (capex as a negative)
  Codex: Cash and cash equivalents FY2024 is 436.7 on the sheet, 436.7 in the 10-K (FY2024 cash from the cash flow statement)
  Codex: Gain on sale of facility FY2025 is -34.9 on the sheet, 34.9 in the 10-K (gain as a negative expense)

Claude’s sheet holds 107 numbers and 102 match the filing to the decimal; Codex’s holds 80 and 75 match. The rest are the interesting part, because none is a typo. (Claude’s 67.9 million common shares at the end of fiscal 2024 are graded through the inline tag: companyfacts has no value for that date under this filing.)

Claude’s cost of sales is $1,758.1 million for fiscal 2026, against $1,680.5 million on the cost of sales line. The difference is exactly the $77.6 million of amortization of acquired developed intangibles that Lumentum shows as a separate line above gross profit. Claude folded it in so that revenue minus cost of sales equals reported gross profit. Codex kept the reported line and subtracted the amortization inside its gross profit formula. Both get gross profit right. Drop either cost line into a peer comparison, though, and you’re comparing two different things under one label.

Codex typed capital expenditures as negative numbers, the way the cash flow statement shows them, and its free cash flow formula adds them. Copy Claude’s formula (operating cash flow minus capex) onto Codex’s sheet and fiscal 2026 free cash flow becomes $1,202.7 million instead of $300.1 million. That’s the classic spreadsheet error: two correct pieces, joined.

The gain on sale of a facility in fiscal 2025 shows up as a sign flip in both memo blocks for the same reason. The 10-K prints it as (34.9) inside operating expenses, a negative expense, and the XBRL tag stores the gain as a positive number. Both models also took fiscal 2024 cash, $436.7 million, from the cash flow statement total, which includes restricted cash. With no separate fiscal 2024 cash tag, the code grades that cell as a convention.

Depreciation and amortization “matched” only because I graded it the way both models built it. The 10-K has no single D&A line. For fiscal 2026, both added depreciation of $128.8 million to the $135.7 million of intangible amortization from the notes, $264.5 million in total. The cash flow statement’s add-back for amortization includes write-offs, and Claude’s reply points out that using it would give $267.0 million (10-K, cash flow statement). A third workbook could use that figure and be just as right.

The grid at the top, drawn from the grades of the 19 requested lines:

COLORS = {"match": "#d8f3dc", "both empty": "#f1f1f1", "cost of sales with amortization": "#ffd6a5",
          "capex as a negative": "#ffadad", "FY2024 cash from the cash flow statement": "#bde0fe", "wrong": "#e63946"}
fig, ax = plt.subplots(figsize=(11, 8.5))
lines = list(CLAUDE)
for j, (model, sheet) in enumerate({"Claude Code": CLAUDE, "Codex": CODEX}.items()):
    for k, fy in enumerate(YEARS):
        x = j * 3.3 + k
        ax.text(x + 0.5, -0.6, f"{model}\n{fy}", ha="center", va="bottom", fontsize=9, weight="bold")
        for i, line in enumerate(lines):
            g, v = grades[model].loc[line, fy], sheet[line][k]
            ax.add_patch(plt.Rectangle((x, i), 0.96, 0.92, color=COLORS[g]))
            label = "" if v is None else f"{v:.1%}" if "margin" in line else f"{v:,.2f}" if line == "Diluted EPS" else f"{v:,.1f}"
            ax.text(x + 0.48, i + 0.5, label, ha="center", va="center", fontsize=8)
for i, line in enumerate(lines):
    ax.text(-0.15, i + 0.5, line, ha="right", va="center", fontsize=9)
ax.set_xlim(-0.2, 6.4)
ax.set_ylim(len(lines), -1.6)
ax.axis("off")
handles = [plt.Rectangle((0, 0), 1, 1, color=c) for k, c in COLORS.items() if k != "wrong"]
ax.legend(handles, ["matches the 10-K's XBRL", "empty in the sheet and the 10-K", "cost of sales includes intangible amortization",
                    "capex entered as a negative number", "FY2024 cash: the cash flow statement total"], loc="upper center",
          bbox_to_anchor=(0.45, -0.01), ncol=2, fontsize=9, frameon=False)
ax.set_title("Lumentum: the 19 requested lines on each model's Historical sheet, checked against the 10-K's XBRL\n(USD millions; EPS in dollars, shares in millions)",
             fontsize=11, x=0.42, pad=28)
plt.savefig("lite-ai-excel-model-check.png", dpi=150, bbox_inches="tight")

The notes get the same treatment. The code lists every figure the two models quoted in their assumption notes and where it should come from: an inline XBRL fact in the 10-K, a calculation from the XBRL values above, a line the 10-K prints without a numeric tag, or the model’s own estimate.

# Every figure in the two models' assumption notes, typed as written (cell in brackets), and where it comes from:
#   ("tag", concept, period end): an inline XBRL fact in the 10-K for that period
#   ("calc", value): a calculation from the XBRL values above
#   ("text", passage): no XBRL tag exists, so the passage the figure comes from must be in the 10-K
#   ("estimate", why): the model's own input, nothing to check
t, END = truth, YEAR_END["FY2026"]


def share(line, fy, of="Net revenue"):
    return t.loc[line, fy] / t.loc[of, fy]


def growth(fy):
    return t.loc["Net revenue", fy] / t.loc["Net revenue", YEARS[YEARS.index(fy) - 1]] - 1


def flow(concept, sign=1):
    return sign * filed(concept, "FY2026")


# FY2026 cash used by operating assets and liabilities, from the cash flow statement's tags
OPERATING_CHANGES = sum(flow(c, s) for c, s in [
    ("IncreaseDecreaseInAccountsReceivable", 1), ("IncreaseDecreaseInInventories", 1),
    ("IncreaseDecreaseInOtherOperatingAssets", 1), ("IncreaseDecreaseInDeferredIncomeTaxes", 1),
    ("IncreaseDecreaseInAccountsPayable", -1), ("IncreaseDecreaseInEmployeeRelatedLiabilities", -1),
    ("IncreaseDecreaseInOtherAccruedLiabilities", -1), ("IncreaseDecreaseInOperatingLeaseLiability", -1)]) + \
    IX[(IX["concept"] == "OperatingLeaseRightOfUseAssetIncreaseDecrease") & (IX["end"] == END)]["value"].iloc[0] / 1e6
CODEX_WC = sum(flow(c, s) for c, s in [
    ("IncreaseDecreaseInAccountsReceivable", 1), ("IncreaseDecreaseInInventories", 1),
    ("IncreaseDecreaseInOtherOperatingAssets", 1), ("IncreaseDecreaseInAccountsPayable", -1),
    ("IncreaseDecreaseInEmployeeRelatedLiabilities", -1), ("IncreaseDecreaseInOtherAccruedLiabilities", -1)])
REV_UP = t.loc["Net revenue", "FY2026"] - t.loc["Net revenue", "FY2025"]
NOTES = [
    ("Claude [H2]", "83.2% revenue growth FY2026", 0.832, ("calc", growth("FY2026"))),
    ("Codex [G2]", "83.2% revenue growth FY2026", 0.832, ("calc", growth("FY2026"))),
    ("Claude [H2]", "21.0% revenue growth FY2025", 0.210, ("calc", growth("FY2025"))),
    ("Claude [H2]", "$2.35bn purchase obligations", 2350, ("text", "Purchase obligations (3) 2,354.4")),
    ("Claude [H2]", "FY27 is a 53-week year", 53, ("text", "fiscal year 2027 ending on July 3, 2027 has a 53-week period")),
    ("Codex [G2]", "FY2027's 53rd week", 53, ("text", "fiscal year 2027 ending on July 3, 2027 has a 53-week period")),
    ("Claude [H3]", "18.5% gross margin FY2024", 0.185, ("calc", share("Gross profit", "FY2024"))),
    ("Claude [H3]", "28.0% gross margin FY2025", 0.280, ("calc", share("Gross profit", "FY2025"))),
    ("Claude [H3]", "41.7% gross margin FY2026", 0.417, ("calc", share("Gross profit", "FY2026"))),
    ("Codex [G3]", "41.7% gross margin FY2026", 0.417, ("calc", share("Gross profit", "FY2026"))),
    ("Claude [H4]", "22.2% R&D share FY2024", 0.222, ("calc", share("Research and development", "FY2024"))),
    ("Claude [H4]", "18.5% R&D share FY2025", 0.185, ("calc", share("Research and development", "FY2025"))),
    ("Claude [H4]", "11.8% R&D share FY2026", 0.118, ("calc", share("Research and development", "FY2026"))),
    ("Codex [G4]", "11.8% R&D share FY2026", 0.118, ("calc", share("Research and development", "FY2026"))),
    ("Claude [H5]", "12.1% SG&A share FY2026", 0.121, ("calc", share("Selling, general and administrative", "FY2026"))),
    ("Codex [G5]", "12.1% SG&A share FY2026", 0.121, ("calc", share("Selling, general and administrative", "FY2026"))),
    ("Claude [H5]", "$56.4m intangible amortization in SG&A FY2026", 56.4, ("tag", "AmortizationOfIntangibleAssets", END)),
    ("Claude [H6]", "$72.6m restructuring FY2024", 72.6, ("tag", "RestructuringCharges", YEAR_END["FY2024"])),
    ("Claude [H6]", "$22.8m restructuring FY2025", 22.8, ("tag", "RestructuringCharges", YEAR_END["FY2025"])),
    ("Claude [H6]", "$11.4m restructuring FY2026", 11.4, ("tag", "RestructuringCharges", END)),
    ("Claude [H6]", "0.4% restructuring share FY2026", 0.004, ("calc", share("Restructuring", "FY2026"))),
    ("Codex [G6]", "0.4% restructuring share FY2026", 0.004, ("calc", share("Restructuring", "FY2026"))),
    ("Claude [H7]", "$21.8m interest expense FY2026", 21.8, ("tag", "InterestExpenseNonoperating", END)),
    ("Claude [H7]", "$1.55bn note principal left", 1550, ("calc", filed("DebtInstrumentFaceAmount", "FY2026"))),
    ("Claude [H7]", "0.375% lowest coupon", 0.00375, ("tag", "DebtInstrumentInterestRateStatedPercentage", None)),
    ("Claude [H7]", "1.50% highest coupon", 0.015, ("tag", "DebtInstrumentInterestRateStatedPercentage", None)),
    ("Claude [H7]", "$5.4m note interest due within a year", 5.4, ("text", "Convertible notes - interest (5) 30.6 5.4")),
    ("Claude [H7]", "term loans at about 1%", None, ("estimate", "rounds the tagged 0.88%, 1.44% and 0.90% rates")),
    ("Claude [H8]", "$60.2m interest and investment income FY2026", 60.2, ("tag", "InvestmentIncomeInterest", END)),
    ("Codex [G14]", "$60.2m interest and investment income FY2026", 60.2, ("tag", "InvestmentIncomeInterest", END)),
    ("Codex [G14]", "$34.4m interest and investment income FY2025", 34.4,
     ("tag", "InvestmentIncomeInterest", YEAR_END["FY2025"])),
    ("Claude [H8]", "$2.74bn cash and investments", 2740,
     ("calc", t.loc["Cash and cash equivalents", "FY2026"] + t.loc["Short-term investments", "FY2026"])),
    ("Claude [H8]", "$757.8m early conversion requests", 757.8,
     ("tag", "DebtConversionConvertedInstrumentAmount1", "2026-08-14")),
    ("Claude [H9]", "21% US statutory rate", 0.21, ("tag", "EffectiveIncomeTaxRateReconciliationAtFederalStatutoryIncomeTaxRate", END)),
    ("Codex [G7]", "21% federal statutory rate", 0.21, ("tag", "EffectiveIncomeTaxRateReconciliationAtFederalStatutoryIncomeTaxRate", END)),
    ("Claude [H10]", "8.8% D&A share FY2026", 0.088, ("calc", share("Depreciation and amortization", "FY2026"))),
    ("Claude [H10]", "$128.8m depreciation FY2026", 128.8, ("tag", "Depreciation", END)),
    ("Codex [G8]", "$128.8m depreciation FY2026", 128.8, ("tag", "Depreciation", END)),
    ("Claude [H10]", "$135.7m amortization FY2026", 135.7, ("tag", "AmortizationOfIntangibleAssets", END)),
    ("Codex [G8]", "4.3% depreciation share FY2026", 0.043, ("calc", share("Depreciation", "FY2026"))),
    ("Claude [H10]", "depreciation about 5% of revenue ahead", None, ("estimate", "forecast input")),
    *[(who, f"${v}m amortization due in fiscal {2027 + i}", v,
       ("tag", f"FiniteLivedIntangibleAssetsAmortizationExpense{c}", END))
      for who in ("Claude [H10]", "Codex [Assumptions!B9:F9]")
      for i, (v, c) in enumerate(zip([123.5, 83.0, 52.6, 46.5, 20.0],
                                     ["NextTwelveMonths", "YearTwo", "YearThree", "YearFour", "YearFive"]))],
    ("Claude [H11]", "9.8% capex share FY2024", 0.098, ("calc", share("Capital expenditures", "FY2024"))),
    ("Claude [H11]", "14.0% capex share FY2025", 0.140, ("calc", share("Capital expenditures", "FY2025"))),
    ("Claude [H11]", "15.0% capex share FY2026", 0.150, ("calc", share("Capital expenditures", "FY2026"))),
    ("Codex [G10]", "15.0% capex share FY2026", 0.150, ("calc", share("Capital expenditures", "FY2026"))),
    ("Codex [G10]", "9.8% capex share FY2024", 0.098, ("calc", share("Capital expenditures", "FY2024"))),
    ("Claude [H11]", "$181.4m unpaid PP&E FY2026", 181.4, ("tag", "CapitalExpendituresIncurredButNotYetPaid", END)),
    ("Claude [H12]", "9.5% SBC share FY2024", 0.095, ("calc", share("Stock-based compensation", "FY2024"))),
    ("Claude [H12]", "10.8% SBC share FY2025", 0.108, ("calc", share("Stock-based compensation", "FY2025"))),
    ("Claude [H12]", "5.6% SBC share FY2026", 0.056, ("calc", share("Stock-based compensation", "FY2026"))),
    ("Codex [G11]", "5.6% SBC share FY2026", 0.056, ("calc", share("Stock-based compensation", "FY2026"))),
    ("Claude [H13]", "$292.0m used by operating assets and liabilities", 292.0, ("calc", OPERATING_CHANGES)),
    ("Claude [H13]", "$1,369.0m revenue increase", 1369.0, ("calc", REV_UP)),
    ("Claude [H13]", "about 21% of the increase", 0.21, ("calc", OPERATING_CHANGES / REV_UP)),
    ("Codex [G12]", "18% working capital per added revenue", 0.18, ("calc", CODEX_WC / REV_UP)),
    ("Codex [G14]", "$40m interest income a year ahead", None, ("estimate", "forecast input")),
]


def note_check(value, source):
    """True when the figure as written agrees with its source at the precision it was written."""
    kind = source[0]
    if kind == "estimate":
        return None
    if kind == "text":
        return source[1] in TEXT
    step = {0.21: 0.01, 0.18: 0.01, 2350: 10, 1550: 10, 2740: 10}.get(value, 0.1 if value >= 1 else 0.001)
    if kind == "calc":
        return abs(source[1] - value) <= step / 2 + 1e-9
    concept, end = source[1], source[2]
    facts = IX[(IX["concept"] == concept) & ((IX["end"] == end) if end else True)]["value"]
    return bool((abs(facts / (1e6 if value >= 1 else 1) - value) <= step / 2 + 1e-9).any())


notes = pd.DataFrame([{"who": w, "figure": f, "kind": s[0], "ok": note_check(v, s)} for w, f, v, s in NOTES])
KINDS = {"tag": "an inline XBRL fact for the same period", "calc": "a calculation from XBRL values",
         "text": "the 10-K text, because no XBRL tag exists"}
for kind, part in notes[notes["kind"] != "estimate"].groupby("kind", sort=False):
    print(f"{len(part)} figures checked against {KINDS[kind]}: {int((part['ok'] == True).sum())} agree")  # noqa: E712
print("model estimates, nothing to check: " + "; ".join(notes[notes["kind"] == "estimate"]["figure"]))
bad = notes[notes["ok"] == False]  # noqa: E712
print("figures that disagree with the filing: " + ("none" if bad.empty else "; ".join(bad["who"] + " " + bad["figure"])))
32 figures checked against a calculation from XBRL values: 32 agree
4 figures checked against the 10-K text, because no XBRL tag exists: 4 agree
27 figures checked against an inline XBRL fact for the same period: 27 agree
model estimates, nothing to check: term loans at about 1%; depreciation about 5% of revenue ahead; $40m interest income a year ahead
figures that disagree with the filing: none

Of the 66 figures, typed in as the notes state them, 27 match a tagged fact for the same period and 32 a calculation from XBRL values. The other 4 have no XBRL tag (purchase obligations, note interest due within a year, and the 53-week fiscal 2027 that both models quote), so the code finds them in the 10-K text. “About 1%” for the term loans, one of three estimates, rounds the tagged 0.88%, 1.44% and 0.90% rates. The same kind of check, run on figures models gave from memory, is in the AI for financial data analysis post.

Same 10-K, two forecasts

The history is a transcription job and both models passed it. The forecast is a judgment job: the 10-K gives no revenue growth guidance, as Claude says in its reply. The code below copies the inputs from each Assumptions sheet, rebuilds every Forecast cell from them and the 10-K’s fiscal 2026 revenue (Codex’s five year-label formulas included), and compares it with the workbook, along with the 26 historical ratios Claude’s Assumptions sheet recalculates from its Historical sheet:

def five(x):
    """One input held for all five forecast years."""
    return [x] * 5


# Each Assumptions sheet, FY2027-FY2031 (D&A: a share of revenue plus a fixed USD million amount)
INPUTS = {
    "Claude Code": {"growth": [0.40, 0.25, 0.15, 0.10, 0.08], "gross_margin": [0.43, 0.44, 0.45, 0.45, 0.45],
                    "rd": five(0.115), "sga": [0.105, 0.095, 0.09, 0.085, 0.085], "restructuring": five(0.003),
                    "interest": [12, 10, 8, 6, 5], "other_income": [45, 45, 50, 55, 60], "tax": five(0.17),
                    "da_share": [0.08, 0.066, 0.06, 0.058, 0.054], "da_fixed": five(0),
                    "capex": [0.14, 0.12, 0.10, 0.09, 0.08], "sbc": [0.05, 0.045, 0.045, 0.04, 0.04], "wc": five(0.20)},
    "Codex": {"growth": [0.35, 0.25, 0.18, 0.12, 0.08], "gross_margin": [0.42, 0.43, 0.44, 0.44, 0.44],
              "rd": [0.118, 0.115, 0.113, 0.112, 0.11], "sga": [0.12, 0.115, 0.11, 0.107, 0.105],
              "restructuring": five(0.004), "interest": [9, 8.5, 7.5, 7, 6.5], "other_income": five(40),
              "tax": five(0.21), "da_share": five(0.043), "da_fixed": [123.5, 83, 52.6, 46.5, 20],
              "capex": [0.15, 0.15, 0.14, 0.13, 0.12], "sbc": [0.056, 0.053, 0.05, 0.048, 0.046], "wc": five(0.18)},
}


def forecast(base, a):
    """Rebuild a Forecast sheet from its inputs and the 10-K's FY2026 revenue, as the workbook formulas do."""
    rows, prev = [], base
    for t_ in range(5):
        r = {"revenue": prev * (1 + a["growth"][t_])}
        r["growth"] = r["revenue"] / prev - 1
        r["gross_profit"] = r["revenue"] * a["gross_margin"][t_]
        r["cost_of_sales"] = r["revenue"] - r["gross_profit"]
        for k in ("rd", "sga", "restructuring"):
            r[k] = r["revenue"] * a[k][t_]
        r["operating_income"] = r["gross_profit"] - r["rd"] - r["sga"] - r["restructuring"]
        r["interest"], r["other_income"] = a["interest"][t_], a["other_income"][t_]
        r["pretax"] = r["operating_income"] - r["interest"] + r["other_income"]
        r["tax"] = max(r["pretax"], 0) * a["tax"][t_]  # Claude's formula has no floor; pre-tax is positive here
        r["net_income"] = r["pretax"] - r["tax"]
        r["depreciation"], r["amortization"] = r["revenue"] * a["da_share"][t_], a["da_fixed"][t_]
        r["da"] = r["depreciation"] + r["amortization"]
        r["sbc"], r["capex"] = r["revenue"] * a["sbc"][t_], r["revenue"] * a["capex"][t_]
        r["wc"] = (r["revenue"] - prev) * a["wc"][t_]
        r["ocf"] = r["net_income"] + r["da"] + r["sbc"] - r["wc"]
        r["fcf"] = r["ocf"] - r["capex"]
        for k in ("gross_profit", "operating_income", "net_income", "fcf"):
            r[k + "_margin"] = r[k] / r["revenue"]
        rows.append(r)
        prev = r["revenue"]
    return pd.DataFrame(rows, index=range(2027, 2032))


# Every row of each Forecast sheet after recalculation (FY2027-FY2031) and the rebuilt line it should equal
SHEETS = {"Claude Code": """Net revenue,4219.60,5274.50,6065.68,6672.24,7206.02
Revenue growth,0.4000,0.2500,0.1500,0.1000,0.0800
Cost of sales,2405.17,2953.72,3336.12,3669.73,3963.31
Gross profit,1814.43,2320.78,2729.55,3002.51,3242.71
Research and development,485.25,606.57,697.55,767.31,828.69
Selling, general and administrative,443.06,501.08,545.91,567.14,612.51
Restructuring and other operating charges,12.66,15.82,18.20,20.02,21.62
Operating income (loss),873.46,1197.31,1467.89,1648.04,1779.89
Interest expense,12.00,10.00,8.00,6.00,5.00
Interest and other income, net,45.00,45.00,50.00,55.00,60.00
Income (loss) before income taxes,906.46,1232.31,1509.89,1697.04,1834.89
Income tax provision (benefit),154.10,209.49,256.68,288.50,311.93
Net income (loss),752.36,1022.82,1253.21,1408.55,1522.96
Net income (loss),752.36,1022.82,1253.21,1408.55,1522.96
Depreciation and amortization,337.57,348.12,363.94,386.99,389.13
Stock-based compensation,210.98,237.35,272.96,266.89,288.24
(Increase) in net working capital,-241.12,-210.98,-158.24,-121.31,-106.76
Net cash from operating activities,1059.79,1397.31,1731.87,1941.11,2093.57
Capital expenditures,590.74,632.94,606.57,600.50,576.48
Free cash flow,469.04,764.37,1125.30,1340.61,1517.08
Gross margin,0.4300,0.4400,0.4500,0.4500,0.4500
Operating margin,0.2070,0.2270,0.2420,0.2470,0.2470
Net margin,0.1783,0.1939,0.2066,0.2111,0.2113
Free cash flow margin,0.1112,0.1449,0.1855,0.2009,0.2105""", "Codex": """Net revenue,4068.90,5086.12,6001.63,6721.82,7259.57
Cost of sales, including acquired intangible amortization,2359.96,2899.09,3360.91,3764.22,4065.36
Gross profit,1708.94,2187.03,2640.72,2957.60,3194.21
Gross margin,0.4200,0.4300,0.4400,0.4400,0.4400
Research and development,480.13,584.90,678.18,752.84,798.55
Selling, general and administrative,488.27,584.90,660.18,719.24,762.25
Restructuring and related charges,16.28,20.34,24.01,26.89,29.04
Operating income (loss),724.26,996.88,1278.35,1458.64,1604.36
Operating margin,0.1780,0.1960,0.2130,0.2170,0.2210
Interest expense,9.00,8.50,7.50,7.00,6.50
Interest and investment income,40.00,40.00,40.00,40.00,40.00
Income (loss) before income taxes,755.26,1028.38,1310.85,1491.64,1637.86
Income tax provision,158.61,215.96,275.28,313.24,343.95
Net income (loss),596.66,812.42,1035.57,1178.39,1293.91
Depreciation,174.96,218.70,258.07,289.04,312.16
Acquired intangible amortization,123.50,83.00,52.60,46.50,20.00
Depreciation and amortization,298.46,301.70,310.67,335.54,332.16
Stock-based compensation,227.86,269.56,300.08,322.65,333.94
Increase in operating working capital,189.88,183.10,164.79,129.64,96.79
Net cash from operating activities (modeled),933.10,1200.59,1481.53,1706.94,1863.22
Capital expenditures,-610.34,-762.92,-840.23,-873.84,-871.15
Free cash flow,322.76,437.67,641.30,833.11,992.07"""}
ROW_KEYS = {  # sheet label -> rebuilt line (a leading minus: the sheet shows it with the opposite sign)
    "Net revenue": "revenue", "Revenue growth": "growth", "Cost of sales": "cost_of_sales",
    "Cost of sales, including acquired intangible amortization": "cost_of_sales", "Gross profit": "gross_profit",
    "Research and development": "rd", "Selling, general and administrative": "sga",
    "Restructuring and other operating charges": "restructuring", "Restructuring and related charges": "restructuring",
    "Operating income (loss)": "operating_income", "Interest expense": "interest",
    "Interest and other income, net": "other_income", "Interest and investment income": "other_income",
    "Income (loss) before income taxes": "pretax", "Income tax provision (benefit)": "tax", "Income tax provision": "tax",
    "Net income (loss)": "net_income", "Depreciation": "depreciation", "Acquired intangible amortization": "amortization",
    "Depreciation and amortization": "da", "Stock-based compensation": "sbc",
    "(Increase) in net working capital": "-wc", "Increase in operating working capital": "wc",
    "Net cash from operating activities": "ocf", "Net cash from operating activities (modeled)": "ocf",
    "Capital expenditures": "capex", "Free cash flow": "fcf", "Gross margin": "gross_profit_margin",
    "Operating margin": "operating_income_margin", "Net margin": "net_income_margin", "Free cash flow margin": "fcf_margin",
}
# Claude's Assumptions sheet also recalculates nine FY2024-FY2026 ratios from its Historical sheet (rows 16-24)
CLAUDE_RATIOS = {"Revenue growth": [None, 0.2103, 0.8322], "Gross margin": [0.1850, 0.2796, 0.4167],
                 "R&D": [0.2223, 0.1847, 0.1183], "SG&A": [0.2286, 0.2117, 0.1205],
                 "Restructuring": [0.0534, 0.0139, 0.0038], "Effective tax rate": [-0.3471, 1.1505, 0.0331],
                 "D&A": [0.1922, 0.1544, 0.0878], "Capex": [0.0979, 0.1404, 0.1497], "SBC": [0.0948, 0.1077, 0.0565]}
# FY2031 revenue, net income and free cash flow after setting the FY2027 growth input to 0% and recalculating
ZERO_GROWTH_FY2031 = {"Claude Code": [5147.16, 1100.87, 1096.67], "Codex": [5377.46, 965.32, 746.91]}
# Codex's Forecast!B1:F1 are formulas too (=Assumptions!B1 ...); after recalculation they read FY2027 to FY2031
CODEX_HEADERS = ["FY2027", "FY2028", "FY2029", "FY2030", "FY2031"]

base = truth.loc["Net revenue", "FY2026"]
rebuilt, zero_gaps = {}, []
for model, a in INPUTS.items():
    rebuilt[model] = fc = forecast(base, a)
    off = []
    for row in SHEETS[model].splitlines():
        label, *vals = row.rsplit(",", 5)
        key = ROW_KEYS[label]
        ours = -fc[key.lstrip("-")] if key.startswith("-") or (model == "Codex" and key == "capex") else fc[key.lstrip("-")]
        tol = 0.0001 if abs(float(vals[0])) < 2 else 0.01
        off += [f"{label} {y}" for y, v, o in zip(fc.index, vals, ours) if abs(float(v) - o) > tol]
    zero = forecast(base, {**a, "growth": [0.0] + a["growth"][1:]}).loc[2031, ["revenue", "net_income", "fcf"]]
    zero_gaps.append(max(abs(zero.values - ZERO_GROWTH_FY2031[model])))
    if model == "Codex":
        off += [h for h, y in zip(CODEX_HEADERS, fc.index) if h != f"FY{y}"]
    cells = 5 * len(SHEETS[model].splitlines()) + (5 if model == "Codex" else 0)
    print(f"{model}: {cells} forecast cells rebuilt from the inputs and the 10-K, "
          f"{len(off)} off by more than the copied precision; zero-growth test off by at most "
          f"{zero_gaps[-1]:.3f} (USD millions)")
hist_ratio = {"Revenue growth": lambda fy: truth.loc["Net revenue", fy] / truth.loc["Net revenue", YEARS[YEARS.index(fy) - 1]] - 1,
              "Effective tax rate": lambda fy: truth.loc["Income tax", fy] / truth.loc["Income (loss) before taxes", fy]}
for k, line in [("Gross margin", "Gross profit"), ("R&D", "Research and development"),
                ("SG&A", "Selling, general and administrative"), ("Restructuring", "Restructuring"),
                ("D&A", "Depreciation and amortization"), ("Capex", "Capital expenditures"), ("SBC", "Stock-based compensation")]:
    hist_ratio[k] = lambda fy, line=line: truth.loc[line, fy] / truth.loc["Net revenue", fy]
ratio_off = [f"{k} {fy}" for k, vals in CLAUDE_RATIOS.items() for fy, v in zip(YEARS, vals)
             if v is not None and abs(hist_ratio[k](fy) - v) > 0.0001]
print(f"Claude Code: {sum(v is not None for vals in CLAUDE_RATIOS.values() for v in vals)} historical ratios "
      f"rebuilt from the XBRL values, {len(ratio_off)} off")
c, x = rebuilt["Claude Code"].loc[2031], rebuilt["Codex"].loc[2031]
print("FY2031 free cash flow, Claude minus Codex: " + ", ".join(
    f"{name} {s * (c[k] - x[k]):+,.1f}" for name, k, s in [("net income", "net_income", 1), ("D&A", "da", 1),
                                                          ("SBC", "sbc", 1), ("working capital", "wc", -1),
                                                          ("capex", "capex", -1)]) + f", total {c['fcf'] - x['fcf']:,.1f}")
print("FY2031 net income, Claude minus Codex: " + ", ".join(
    f"{name} {s * (c[k] - x[k]):+,.1f}" for name, k, s in [("operating income", "operating_income", 1),
                                                          ("interest and other income", "other_income", 1),
                                                          ("interest expense", "interest", -1), ("tax", "tax", -1)])
    + f", total {c['net_income'] - x['net_income']:,.1f}")

fig, axes = plt.subplots(1, 2, figsize=(11, 4.2))
hist_years, fc_years = [2024, 2025, 2026], list(range(2027, 2032))
for ax, key, line, label in [(axes[0], "revenue", "Net revenue", "10-K, reported"),
                             (axes[1], "fcf", "Free cash flow", "10-K: operating cash flow minus capex")]:
    ax.plot(hist_years, truth.loc[line, YEARS].values, color="black", marker="o", label=label)
    for (model, fc), color in zip(rebuilt.items(), ["#d97706", "#2563eb"]):
        ax.plot([2026] + fc_years, [truth.loc[line, "FY2026"]] + list(fc[key]), color=color, marker="o", ls="--",
                label=f"{model}'s assumptions")
    ax.set_title(f"{line}, USD millions", fontsize=10, loc="left")
    ax.set_xticks(hist_years + fc_years)
    ax.grid(alpha=0.3)
    ax.legend(fontsize=8, frameon=False)
fig.suptitle("Lumentum: same 10-K, same prompt, two forecasts (fiscal years ending near 30 June)",
             fontsize=11, x=0.01, ha="left")
plt.savefig("lite-ai-excel-forecasts.png", dpi=150, bbox_inches="tight")

ac, ax_ = INPUTS["Claude Code"], INPUTS["Codex"]
n = checked.groupby("model").size()
figures = {  # USD amounts in dollars, percentages as fractions
    "rev_fy26": base * 1e6, "rev_growth_fy26": float(base / truth.loc["Net revenue", "FY2025"] - 1),
    "net_loss_fy26": -truth.loc["Net income (loss)", "FY2026"] * 1e6,
    "cost_fy26": truth.loc["Cost of sales", "FY2026"] * 1e6,
    "amort_cost_fy26": truth.loc["Amortization in cost of sales", "FY2026"] * 1e6,
    "claude_cost_fy26": CLAUDE["Cost of sales"][2] * 1e6,
    "fcf_fy26": truth.loc["Free cash flow", "FY2026"] * 1e6,
    "fcf_sign_mixup": (truth.loc["Net cash from operating activities", "FY2026"] - CODEX["Capital expenditures"][2]) * 1e6,
    "da_fy26": truth.loc["Depreciation and amortization", "FY2026"] * 1e6,
    "dep_fy26": truth.loc["Depreciation", "FY2026"] * 1e6, "amort_fy26": truth.loc["Amortization of intangibles", "FY2026"] * 1e6,
    "cells_checked": int(len(checked)), "claude_cells": int(n["Claude Code"]), "codex_cells": int(n["Codex"]),
    "claude_match": int((checked[checked["model"] == "Claude Code"]["result"] == "match").sum()),
    "codex_match": int((checked[checked["model"] == "Codex"]["result"] == "match").sum()),
    "wrong": int((checked["result"] == "wrong").sum()),
    "all_match": int((checked["result"] == "match").sum()),
    "conventions": int((~checked["result"].isin(["match", "wrong"])).sum()),
    "note_tag": int((notes["kind"] == "tag").sum()), "note_calc": int((notes["kind"] == "calc").sum()),
    "note_text": int((notes["kind"] == "text").sum()), "cash_fy24": truth.loc["Cash incl. restricted", "FY2024"] * 1e6,
    "note_figures": int(len(notes)), "note_estimates": int((notes["kind"] == "estimate").sum()),
    "note_bad": int(len(bad)),
    "claude_g27": ac["growth"][0], "codex_g27": ax_["growth"][0],
    "claude_gm27": ac["gross_margin"][0], "claude_gm31": ac["gross_margin"][-1],
    "codex_gm27": ax_["gross_margin"][0], "codex_gm31": ax_["gross_margin"][-1],
    "claude_capex31": ac["capex"][-1], "codex_capex31": ax_["capex"][-1],
    "claude_tax": ac["tax"][0], "codex_tax": ax_["tax"][0],
    "claude_rev31": c["revenue"] * 1e6, "codex_rev31": x["revenue"] * 1e6,
    "rev31_gap": (x["revenue"] - c["revenue"]) * 1e6,
    "claude_fcf31": c["fcf"] * 1e6, "codex_fcf31": x["fcf"] * 1e6, "fcf31_gap": (c["fcf"] - x["fcf"]) * 1e6,
    "capex31_gap": (x["capex"] - c["capex"]) * 1e6, "ni31_gap": (c["net_income"] - x["net_income"]) * 1e6,
    "op31_gap": (c["operating_income"] - x["operating_income"]) * 1e6,
    "other31_gap": ((c["other_income"] - c["interest"]) - (x["other_income"] - x["interest"])) * 1e6,
    "tax31_gap": (x["tax"] - c["tax"]) * 1e6,
    "zero_gap": round(max(zero_gaps) * 1e6, -3), "shares_fy24": truth.loc["Common shares outstanding", "FY2024"] * 1e6,
    "claude_zero31": ZERO_GROWTH_FY2031["Claude Code"][0] * 1e6, "codex_zero31": ZERO_GROWTH_FY2031["Codex"][0] * 1e6,
}
Claude Code: 120 forecast cells rebuilt from the inputs and the 10-K, 0 off by more than the copied precision; zero-growth test off by at most 0.005 (USD millions)
Codex: 115 forecast cells rebuilt from the inputs and the 10-K, 0 off by more than the copied precision; zero-growth test off by at most 0.005 (USD millions)
Claude Code: 26 historical ratios rebuilt from the XBRL values, 0 off
FY2031 free cash flow, Claude minus Codex: net income +229.0, D&A +57.0, SBC -45.7, working capital -10.0, capex +294.7, total 525.0
FY2031 net income, Claude minus Codex: operating income +175.5, interest and other income +20.0, interest expense +1.5, tax +32.0, total 229.0
Lumentum net revenue and free cash flow for fiscal 2024 to 2026 from the 10-K (free cash flow calculated as operating cash flow minus capex) and fiscal 2027 to 2031 under Claude Code's and Codex's assumptions

Every cell rebuilds at the precision it was copied (two decimals of a USD million, four for ratios), and the zero-growth results agree to within about $5,000. Claude starts fiscal 2027 at 40% growth and Codex at 35%, yet Codex ends fiscal 2031 with revenue $54 million higher, because it holds growth up for longer. Gross margin runs from 43% to 45% for Claude and from 42% to 44% for Codex. Close on revenue, then, and $525.0 million apart on fiscal 2031 free cash flow: $1,517.1 million against $992.1 million. Capex explains $294.7 million of that (8% of revenue by 2031 for Claude, 12% for Codex), and net income $229.0 million: $175.5 million from Claude’s higher operating income, $21.5 million from its higher net interest and other income, and $32.0 million from lower modeled tax, which reflects both Claude’s 17% rate against Codex’s 21% and the different pre-tax incomes. These are each model’s assumptions from one run each, and I’m not taking a side on Lumentum’s next five years.

What can go wrong

Formulas without values. Read a freshly written openpyxl file with pandas.read_excel and the formula cells come back empty. Recalculate it first, or open it in Excel and save it.

Definitions that drift. Cost of sales with or without amortization, capex positive or negative, D&A from the cash flow statement or from the notes. Claude’s source column and Codex’s labels and formulas show each choice. Ask for a basis note on the historical lines too; it costs one sentence of prompt.

Two free cash flows in one workbook. History is reported operating cash flow less capex; the forecast builds cash flow from net income plus D&A and stock-based compensation, less working capital and capex. Reported operating cash flow carries items the forecast never sees (a $236.3 million change in the tax valuation allowance in fiscal 2026, per the cash flow statement), so part of the jump between 2026 and 2027 in the chart is a change of method.

Your own instructions leak in. My first attempt ran without the two switches, from a folder inside my research folder, and Claude’s reply ended by offering to “add a summary of this session to daily/“. That’s rule 4 of the CLAUDE.md at the top of the research folder, and Claude Code loads CLAUDE.md files in the directory hierarchy above the working directory. A house style for D&A would travel the same way. And each tool ran once; a rerun can pick different inputs.

What to watch

Lumentum’s 10-K for fiscal 2027 is the first full-year test of the inputs (the last three 10-Ks were filed in August, per its EDGAR filing list): Claude assumed 40% revenue growth and Codex 35%, both for a 53-week year. The free cash flow in Python post builds that line from Lumentum’s filings by hand, and the Claude Code DCF walkthrough covers the valuation step these models skipped.

My longer company research is published on the newsletter Sector Playbook, which is available by email subscription.

Sources

Lumentum’s 10-K for fiscal 2026 on SEC EDGAR and the SEC’s companyfacts API; the Claude Code documentation on non-interactive mode, environment variables and CLAUDE.md files; the Codex documentation on non-interactive mode and AGENTS.md; the openpyxl tutorial. This post contains no affiliate links.

Tested 28 November 2026 with Claude Code 2.1.330 (Claude Opus 5.5) and Codex CLI 0.171.0 (gpt-6.2-sol, reasoning effort high); workbooks written with openpyxl 3.1.5 and recalculated in LibreOffice 26.2.6; checking code run with Python 3.12.14, matplotlib 3.11.2, pandas 3.1.0, requests 2.34.2.

Disclaimer

Disclosure: I have no position in LITE. I also hold diversified funds (IWDA, QQQ, SPY, VWRL) that may include LITE. Positions checked on 28 November 2026.

This article is general information about a listed company, written for educational purposes. It is not investment advice and not a personal recommendation to buy, sell or hold any security, and it does not take into account anyone’s financial situation or objectives. I am not a registered investment adviser or a licensed financial services provider. Figures come from company filings and the other sources linked in the text, as of the dates given, and may have changed since. I may hold positions in the securities discussed; see the disclosure above. Investment decisions call for independent research or the advice of a licensed professional.

This is my own research, done with the help of AI tools.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.