VaultEq Core — MVP v1.1
LLMs orchestrate. VaultEq computes.
A deterministic, auditable double-entry accounting engine built for AI agent orchestration. This is the foundational 10% of FinanceX — the part you ship before writing another line of design doc.
What's inside
| File | Purpose |
|---|---|
vaulteq/ |
Python package — engine.py, mcp_server.py, schema.sql |
pyproject.toml |
Package metadata, dependencies, entry points |
demo.py |
Functional demo (imports from installed package) |
race_test.py |
Concurrent stress test (imports from installed package) |
Design decisions
- Amounts are integer minor units (
BIGINT, cents) — never floats, never unconstrained decimals in storage. - Audit events are hash-chained (
prev_event_hash→ SHA-256 of previous event). This proves deletion resistance, not just modification resistance. - Idempotency is real, not cosmetic:
- Same key + same payload → returns cached
PostResponse(safe retry) - Same key + different payload →
DUPLICATE_IDEMPOTENCY_KEYconflict - Check is atomic under
BEGIN IMMEDIATEwith explicit transaction control (isolation_level=None) - Belt-and-suspenders:
IntegrityErrorfrom the UNIQUE constraint is caught and resolved into proper retry or conflict
- Same key + same payload → returns cached
- Error taxonomy is explicit and complete:
| Code | Meaning |
|---|---|
ORGANIZATION_NOT_FOUND |
Referenced org doesn't exist |
INVALID_JOURNAL |
Fewer than 2 lines, or other structural violation |
UNBALANCED_JOURNAL |
Debits ≠ credits |
ACCOUNT_NOT_FOUND |
Referenced account_code doesn't exist for this org |
ACCOUNT_INACTIVE |
Account exists but is closed/inactive |
DUPLICATE_IDEMPOTENCY_KEY |
Key already used with a different payload |
CURRENCY_MISMATCH |
Line currency has no registered fx_rate to base_currency |
PERIOD_CLOSED |
Attempted post to a closed accounting period (deferred) |
Run it
python demo.py # functional demo
python race_test.py # concurrent idempotency verification
No dependencies. Uses Python stdlib + SQLite.
Why the race test proves what it proves
race_test.py uses separate sqlite3 connections per thread (not a shared connection, which would serialize through Python's GIL and mask real cross-connection races) and a threading.Barrier to force both threads into post() at the same instant rather than hoping for a scheduling accident. It asserts the invariant that matters: exactly one journal entry in the database, both threads returning the same journal ID, and zero raw IntegrityError exceptions leaking to the caller. This is a legitimate concurrency test, not a token one.
What works now
- Organization & Chart of Accounts management
- Double-entry journal posting with strict balance validation
- Real idempotency — safe retries return cached responses, conflicts are explicit
- Atomic idempotency under SQLite reserved lock with explicit transaction control
- Race-safety verified — concurrent threads with same key produce exactly one journal entry
- Immutable, hash-chained audit trail
- Trial balance query
- Audit chain integrity verification
- Complete error taxonomy with structured JSON responses
What's intentionally deferred
- Multi-currency FX rates (MVP enforces base-currency only)
- Period close / lock
- Journal reversals
- HTTP API layer (FastAPI wrapper)
- Concurrent post safety at scale (SQLite serializes; prod needs row-level locking in Postgres)
- Postgres migration (swap connection string, schema is compatible)
The one thing to remember
This is infrastructure, not a fintech. Your first customer is a developer building an AI agent that needs to post a journal without hallucinating the math.
Ship this. Get feedback. Then build PaymentsX.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vaulteq-1.1.0.tar.gz.
File metadata
- Download URL: vaulteq-1.1.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85018720ca4ace01d387245ba5bb054164e3d483ff21cdc54ca4c3d31710a7b2
|
|
| MD5 |
88d0abdb8119bb5bd5bf9d4353eedff9
|
|
| BLAKE2b-256 |
fac418a40629738de1e626051b7326292690e3c91cc753593d363616e6216c44
|
File details
Details for the file vaulteq-1.1.0-py3-none-any.whl.
File metadata
- Download URL: vaulteq-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e30c2e6602b81f5bf451302428c35139a090a6d59a1b88eb77fd8785fab7efc5
|
|
| MD5 |
6a8c0420af72ccd4486f1842836323cc
|
|
| BLAKE2b-256 |
45ca8d8c32e21ce1f238878734c786e6198adc1108626989a88d69914c6a05c5
|