Skip to content

feat(core+cli): advanced financial goal projections#261

Merged
kafkade merged 1 commit into
mainfrom
kafkade-advanced-goal-projections
Jul 5, 2026
Merged

feat(core+cli): advanced financial goal projections#261
kafkade merged 1 commit into
mainfrom
kafkade-advanced-goal-projections

Conversation

@kafkade

@kafkade kafkade commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Description

Builds the "advanced" layer of financial goal projections on top of the existing basic goal tracking, and exposes it through a new ldgr goals CLI command. All projection math lives in pure ldgr-core (no I/O, no floating point) and is deterministic.

What's included:

Core (crates/ldgr-core/src/goals/tracker.rs):

  • Multi-scenario projection bandsScenarioRates + project_band model an optimistic/expected/pessimistic annual-return range and return three projected completion dates instead of one.
  • Inflation-adjusted targetsinflate_target, inflation_adjusted_target, and project_with_inflation grow the target as savings compound, so a goal preserves real purchasing power (real vs nominal target).
  • Variable contribution schedulesContributionSchedule (base monthly + step-ups + one-off lump sums) with project_schedule.
  • Shared-budget allocationallocate_budget divides a single monthly budget across competing goals by priority, deadline, proportional, or equal-split strategy, reporting per-goal shortfalls.
  • Linked-account actualsestimate_monthly_rate_from_history derives an empirical contribution estimate from real balance history.
  • 19 new unit tests covering edge cases: zero/negative rates, past/absent target dates, unreachable and already-met goals, lump sums completing a goal, step-ups crossing the target month, allocation shortfall/surplus, and empty history.

CLI (crates/ldgr-cli):

  • New ldgr goals command with list, project <id>, plan <id>, and allocate --budget subcommands, each supporting --output table|json.
  • Goal definitions are read from ~/.ldgr/goals.json (interim source until vault persistence lands); current amounts are pulled from a goal's linked account balance in the vault when unlocked, falling back to a configured value.

Compounding uses a nominal monthly rate (annual / 12), matching the existing loans module, via month-by-month simulations bounded by a 100-year horizon so unreachable goals terminate cleanly rather than looping.

Related Issues

Closes #224

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Refactoring (no functional changes)
  • CI / infrastructure
  • Other (describe below)

Component

  • crates/ldgr-core/ — Core library (crypto, accounting, storage)
  • crates/ldgr-cli/ — CLI tool
  • crates/ldgr-server/ — Sync server
  • bindings/swift/ — UniFFI Swift bindings
  • apps/ios/ — iOS / iPadOS / watchOS app
  • apps/web/ — Web app (Next.js + WASM)
  • docs/ — Documentation

Privacy Checklist

  • No plaintext financial data is sent to or stored on the server
  • No new metadata exposure introduced (or documented if unavoidable)
  • Any new external service interaction is documented in the trust boundary model — N/A, no new external service interaction
  • Crypto changes use audited RustCrypto crates — no custom primitives — N/A, no crypto changes
  • Key material is never exposed in error messages, logs, or Debug output

Checklist

  • I have read CONTRIBUTING.md
  • Tests pass (cargo test --workspace)
  • Clippy passes (cargo clippy --workspace -- -D warnings)
  • Formatting passes (cargo fmt --check)
  • I have updated documentation (if applicable) — CHANGELOG.md updated; goal definitions documented via the command's built-in sample/help

@kafkade kafkade enabled auto-merge (squash) July 5, 2026 05:31
@kafkade kafkade merged commit 37db41a into main Jul 5, 2026
14 checks passed
@kafkade kafkade deleted the kafkade-advanced-goal-projections branch July 5, 2026 05:35
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(core+cli): advanced financial goal projections (scenarios, inflation, variable contributions)

1 participant