Skip to content

[WIP] Build deterministic double-entry ledger engine#52

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/feat-deterministic-ledger-engine
Closed

[WIP] Build deterministic double-entry ledger engine#52
Copilot wants to merge 1 commit intomainfrom
copilot/feat-deterministic-ledger-engine

Conversation

Copy link
Contributor

Copilot AI commented Mar 22, 2026

  • Create packages/ledger/package.json
  • Create packages/ledger/tsconfig.json
  • Create packages/ledger/src/types.ts — accounts, postings, snapshots, balances, transfers, reconciliation types
  • Create packages/ledger/src/accounts.ts — CRUD, types (asset/liability/income/expense/equity), hierarchy
  • Create packages/ledger/src/postings.ts — double-entry journal entries with balance validation
  • Create packages/ledger/src/balances.ts — point-in-time balance computation from postings
  • Create packages/ledger/src/snapshots.ts — monthly/periodic balance snapshots
  • Create packages/ledger/src/transfers.ts — internal transfer detection and creation
  • Create packages/ledger/src/reconciliation.ts — compare imported transactions vs ledger state
  • Create packages/ledger/src/ledger.ts — main LedgerEngine orchestrator
  • Create packages/ledger/src/index.ts — public exports
  • Create test/unit/ledger.test.ts — unit tests covering all acceptance criteria
  • Update root package.json to include ledger in build:packages
  • Update tsconfig.test.json to add path for @financialadvisor/ledger
Original prompt

This section details on the original issue you should resolve

<issue_title>feat(ledger): deterministic double-entry ledger engine</issue_title>
<issue_description>## Summary
Build packages/ledger — the boring, deterministic core of the financial system. Double-entry bookkeeping that is always correct.

Owns

  • Accounts: CRUD, types (asset/liability/income/expense), hierarchy
  • Balances: Point-in-time account balances, computed from postings
  • Postings: Double-entry journal entries (every transaction = debit + credit)
  • Transfers: Internal transfers between accounts (detected or manual)
  • Snapshots: Monthly/periodic balance snapshots for fast queries
  • Reconciliation: Compare imported transactions against ledger state

Storage

Use PluresDB (or SQLite initially) with strict schema:

accounts(id, name, type, institution, currency, created_at)
postings(id, date, debit_account, credit_account, amount_cents, memo, import_session_id)
snapshots(account_id, period, balance_cents, computed_at)

Principles

  • Deterministic: same inputs always produce same ledger state
  • Auditable: every balance can be recomputed from postings
  • No AI involvement — pure accounting logic

Acceptance

  • Double-entry postings always balance
  • Balance computation from postings is correct
  • Snapshot generation and verification works
  • Reconciliation detects mismatches</issue_description>

Comments on the Issue (you are @copilot in this section)


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

@kayodebristol
Copy link
Contributor

Closing this PR to enforce the 1-PR-per-repo rule. Only one Copilot PR is allowed per repository at a time. The oldest PR (#48) will be kept active.

Copilot stopped work on behalf of kayodebristol due to an error March 22, 2026 23:31
Copilot AI requested a review from kayodebristol March 22, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ledger): deterministic double-entry ledger engine

2 participants