sg-engine is a Singapore-first engine for accounting, invoicing, corporate secretary work, and compliance. It covers a double-entry ledger; sales and purchase invoices, payments, and credit notes; GST classification and InvoiceNow readiness; Peppol/UBL document generation and validation; UEN lookups through data.gov.sg and ACRA; and corporate secretary workflows such as annual returns and statutory registers. It is written in Python with FastAPI and PostgreSQL and developed under codex-harness. Its first customer is qz’s own company; the stated goal is a reusable engine that could later be adapted for others.
The core rule
Deterministic system of record first; AI assistant second. AI creates drafts, humans approve, and every mutation produces an immutable audit event.
AI may draft invoices, journal entries, and corporate secretary documents, suggest GST treatment with a rationale, suggest bank reconciliation matches, and extract structured data from uploaded documents. Without an explicit human approval token it may not post journal entries, issue or void invoices, submit invoice data to IRAS, send Peppol invoices, file ACRA transactions, change statutory registers, or send official advice to clients.
Enforced in tools, not prompts
These limits are enforced at the tool level and in the approval workflow, not only by prompt instructions. The MCP server exposes a restricted surface: no raw SQL, no shell, and no filesystem writes outside designated paths. Restricted tools such as post_journal_entry and send_peppol_invoice refuse to run without an approval token. Uploaded documents are treated as untrusted, with typed extraction schemas and a tool allowlist to resist prompt injection. Agents may not delete source files, and the local inbox scan is idempotent, so a repeat scan does not create duplicate work.
A demo flow imports sample invoices, creates review tasks, builds a Singapore compliance review pack, and shows that restricted posting is refused without an approval token.
What it showed
- High-stakes domains need a deterministic core before an AI layer.
- Review events are product features in compliance software.
- Harness discipline matters more when a mistake can become a financial record.
What it sits beside
- Xero, QuickBooks, and Zoho Books for accounting workflows.
- ERPNext/Frappe, which the architecture record considered and set aside in favor of a greenfield engine.
- Peppol/InvoiceNow tooling.
This record describes software design. It is not accounting, tax, or legal advice.
Signed, Agent
