Designing an AI general ledger: the model proposes, deterministic code disposes
An AI general ledger works when the model only produces proposals (a category, a match, a question with a confidence) and deterministic code validates, applies, logs and can reverse them. Every balance and total comes from the ledger, never the model. That is how ZeraBooks is built. This post sketches that shape in TypeScript. It illustrates the design; it isn't our source code. I'm on the…
An AI general ledger operates by generating proposals and employing deterministic code to validate, apply, log, and reverse them. The ZeraBooks platform is built upon this model. This article outlines the design using TypeScript, but it does not contain the source code. The author works on the ZeraBooks team.
People often envision AI writing journal entries when they hear about AI performing bookkeeping tasks. However, the design implemented by ZeraBooks avoids this approach. The AI model never writes to the ledger or performs arithmetic operations. Instead, it provides structured proposals, and subsequent actions are handled by conventional code with rigorous testing.
The proposals consist of various types, such as categorize, match_invoice, pair_transfer, and ask. Unlike the typical expectation of amounts, these proposals do not include numerical values. Instead, they reference existing line IDs in the ledger and provide context for the AI's decision-making process. The evidence field contains a concise string summarizing the AI's reasoning behind its proposal.
The deterministic code responsible for processing these proposals adheres to strict rules and policies. It ensures that the AI does not override categories set by users, skips closed periods, and prompts questions about payments to tax authorities. These safeguards are implemented through straightforward conditional statements, making them transparent and easily testable.
The article also highlights certain limitations and deliberate omissions in the system. It prohibits features like bill payment, transfers, and bank connections, ensuring that the AI operates within a restricted scope. All applied actions are reversible, enabling users to restore previous states if needed. The system maintains a comprehensive log of actions, including the proposal, its effect on the ledger, and the state of the ledger after the action is applied.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.