Kind
Engineering Note
Products
FinanceOS, theStandards
Evidence
2 reported · 1 verified

Illustration, not a screenshot: split picture: before, an arrow from minor units to the model is crossed out; after, the arrow passes a gate marked code formats on its way to the model Illustration The first live answer read an amount in the wrong unit. Code now formats every amount before the model sees it.

FinanceOS is my personal finance planner, and I am its only user. It has an assistant that explains the plan.

What happened

FinanceOS stores amounts as integer minor units. The first live answer of the assistant read one of those figures as major units and reported a wrong difference.

I know this from the project itself. A code comment in FinanceOS records it, as the reason amounts are now formatted in code.

What I decided

Code now formats every amount before the context leaves the process. The engine computes, and the model explains numbers it was given. No model call has tools.

Grosz, which the comment in the function below mentions, is the minor unit of the Polish złoty.

src/agent/explain.ts
/**
* Formats every amount before the context leaves the process.
*
* The first live answer read a grosz figure as złoty and reported a difference that was simply
* wrong. Asking the model not to do arithmetic is not enough when the raw material invites it:
* shipping złoty strings means there is nothing left to convert and nothing to subtract.
*/
export function presentAmounts(value: unknown, key?: string): unknown {
if (Array.isArray(value)) return value.map((item) => presentAmounts(item));
if (value && typeof value === "object")
return Object.fromEntries(
Object.entries(value).map(([name, item]) => [name, presentAmounts(item, name)]),
);
if (typeof value === "number" && key && !COUNTS.has(key)) return formatPLN(value, 2);
return value;
}

The lesson the project drew is this: if the input lets the model make a mistake, a prompt will not fix it. Narrow the input, not the instruction.

The trade-off

The model no longer sees raw stored amounts, and it is not asked to do arithmetic. It can explain a figure only when the engine has computed that figure and code has formatted it. It has no tools, so it cannot fetch or work out another one.

The check and the rule

The project keeps an evaluation case in its repository that checks the model does not calculate. I did not run it for this entry, so I report that it exists and not what it returns.

theStandards is my catalog of engineering rules. It holds an accepted rule, AI-DETERMINISTIC-001, at level MUST:

AI-DETERMINISTIC-001.json (excerpt)
{
"id": "AI-DETERMINISTIC-001",
"revision": 5,
"status": "accepted",
"level": "MUST",
"evidenceLevel": "E1",
"rule": {
"statement": "Compute authoritative arithmetic and computable classifications in deterministic code, then pass those values and their uncertainty to model-assisted interpretation without replacing them with model-generated arithmetic."
}
}

That rule was accepted earlier, from evidence in two other apps, EvoFlow and Sous.

What is still open

  • This is one incident, reported by the project and not independently observed.
  • How often this class of error occurs has not been measured.
  • The FinanceOS evidence is not yet part of the accepted record of the rule.

Evidence

The sources are private, so each item is described in words, with the state it is in.

  • Reported

    Code comment and formatting step in FinanceOS

    The comment that records the wrong answer, and the step that formats amounts, are in the project. This is the project's own report. The answer was not independently observed.

    Stated by the project itself. Not checked independently.

  • Reported

    Evaluation case in FinanceOS

    The case exists in the repository. It was not run for this entry, so its results are not reported here.

    Stated by the project itself. Not checked independently.

  • Verified

    Accepted rule AI-DETERMINISTIC-001 in theStandards

    The rule record and my decision to accept it exist in the catalog. The rule was accepted from evidence in EvoFlow and Sous, not from FinanceOS.

    Checked against the source.