l3dg3rr

l3dg3rr is a local-first bookkeeping application for turning financial documents into an accountant-usable, CPA-auditable source of truth. Its core shape is a strongly typed, ontologically linked graph of scriptable, visual-first workflows: Rust owns financial invariants, Rhai owns editable classification and workflow rules, and AI/LLM agents drive supervised ETL through MCP tools without taking custody of credentials or approval authority.
Read the live book: https://promptexecution.github.io/l3dg3rr/
Primary bookkeeping outcome: ingest raw historical statements, classify and reconcile transactions, preserve evidence and mutation history, then export a CPA-reviewable Excel workbook without requiring private data to leave the local machine.
System Thesis
The project is intentionally not just a PDF parser, a rules folder, or a visualization experiment. Those are subsystems of one bookkeeping control plane:
fn source_documents() -> typed_document_graph
fn typed_document_graph() -> extraction_and_normalization
fn extraction_and_normalization() -> transaction_classification
fn transaction_classification() -> validation_and_legal_checks
fn validation_and_legal_checks() -> reconciliation
fn reconciliation() -> workbook_export
fn workbook_export() -> cpa_review
fn cpa_review() -> audit_history
The workbook remains the human and accounting interface. The graph, sidecar state, Rhai rules, MCP tools, and visualization layers exist to make that workbook reproducible, explainable, and agent-accessible.
Design Lens: TRIZ + MECE
l3dg3rr resolves recurring product contradictions by separating concerns instead of adding one-off glue:
| Contradiction | Resolution |
|---|
| Accountant-readable vs machine-replayable | Excel is the CPA-facing artifact; journal and sidecar state preserve deterministic replay. |
| Runtime-editable rules vs financial correctness | Rhai handles heuristics at controlled boundaries; Rust types enforce money, identity, validation, and workbook contracts. |
| Agent autonomy vs operator control | MCP exposes capability families; host policy, audit, approvals, notifications, and credentials remain owned by l3dg3rr. |
| Rich visual workflows vs stable execution | A narrow Rhai diagram DSL renders Mermaid and isometric views while typed Rust workflow structs own execution contracts. |
| Xero integration vs local-first privacy | Xero is a supervised capability reached through worker tools and reconciled evidence, not raw credential leakage to a model. |
MECE module grouping keeps the logic approachable:
| Layer | Responsibility | Primary files |
|---|
| Bookkeeping truth | ingest, journal, workbook projection, audit output | crates/ledger-core/src/ingest.rs, journal.rs, workbook.rs |
| Typed domain model | documents, transactions, accounts, tax categories, validation state | document.rs, classify.rs, validation.rs, legal.rs |
| Ontology graph | typed links between documents, accounts, transactions, evidence, Xero entities | crates/ledgerr-mcp/src/ontology.rs, crates/ledger-core/src/graph.rs, book/src/ontology-type-mesh.md |
| Scriptable policy | editable Rhai classification and document-shape rules | rules/, classify.rs, rule_registry.rs |
| Workflow control | pipeline state, scheduled operations, approval/reversibility metadata | pipeline.rs, workflow.rs, ledger_ops.rs, calendar.rs |
| Visualization | Mermaid, isometric docs renderer, live Rhai editor | crates/mdbook-rhai-mermaid/, book/theme/rhai-live-core.js, visualize.rs |
| Agent boundary | published MCP capability families and deterministic argument contracts | crates/ledgerr-mcp/src/contract.rs, mcp_adapter.rs, docs/mcp-capability-contract.md |
| Operator host | desktop settings, notifications, local chat endpoint, tray/window control | crates/ledgerr-host/src/ |
Bookkeeping Flow