Skip to content

Instantly share code, notes, and snippets.

View adamdilek's full-sized avatar
🎯
focusing

Adam Dilek adamdilek

🎯
focusing
View GitHub Profile
@adamdilek
adamdilek / 2026-04-02-sweep-account-tracking-design.md
Created April 2, 2026 21:31
Sweep Account Balance Tracking - Final PRD (Gemini brainstorm)

Design: Sweep Account Balance Tracking

Date: 2026-04-02 Status: Approved with Notes Approach: Hybrid (Balance-Anchored with Transaction Detail) Brainstorm: Gemini (technical + product perspectives, 4 phases, 7 Gemini calls)


Problem

@adamdilek
adamdilek / 2026-04-02-custom-formula-control-rules-design.md
Last active April 4, 2026 04:29
PRD: Custom Formula-Based Control Rules (Variable Pool + Formula Engine) for TreasuryPath

PRD: Custom Formula-Based Control Rules (Composable Variable Pool)

Date: 2026-04-02 Status: Design Complete — v3 (composable variables, math-free rules) Customer Catalyst: Dan @ MortgageAutomator — 60-day Liquidity Coverage Ratio Brainstorm Session: product + technical perspectives with Gemini


1. Problem Statement

@adamdilek
adamdilek / 2026-03-29-sweep-account-balance-handling-design.md
Last active March 29, 2026 17:27
Sweep Account Balance Handling — Design Doc

Design: Sweep Account Balance Handling

Date: 2026-03-29 Status: Approved (with notes incorporated) Branch: TBD

Problem

Sweep accounts (Craft, Mercury, Wealthfront, etc.) automatically move funds above FDIC limits ($250K) to partner banks. Plaid reports:

  • current_balance = amount physically at primary bank (e.g., $250K)
@adamdilek
adamdilek / adjustment-debugging-playbook.md
Created March 27, 2026 04:33
Cash Flow Adjustment Debugging Playbook — step-by-step diagnostic

Cash Flow Adjustment Debugging Playbook

Problem

Cash flow'da balance_adjustment ≠ 0 görünce, kaynağını bulmak.

Step 1: Hangi aylar sorunlu?

company = Company.find(COMPANY_ID)
svc = Forecast::CashForecastService.new(

Design: Exclude Investment Accounts from Cash Flow + Internal Activities

Problem

Two related issues in the cash flow forecast:

  1. Investment accounts corrupt cash flow: T-bill/bond accounts have incomplete Plaid transaction data (only deposits/withdrawals, no buy/sell). This causes false $74M inflow/outflow and massive adjustments.

  2. Internal transfers inflate inflow/outflow: All internal transfers (internal_transfer: true) are currently hidden from cash flow. But when investment accounts are excluded, transfers between operating and investment accounts cause unexplained balance changes. More broadly, customers don't want internal transfers inflating their inflow/outflow totals — these are fund movements, not real business cash flows.

@adamdilek
adamdilek / todo-reconstructed-balance.md
Created March 25, 2026 22:47
Reconstructed Balance — TODO & Next Steps

Reconstructed Balance — TODO List

PRs to Merge

  • PR #1410 — Reconstructed Balance for Cash Flow (CI fixing)
    • BalanceAnchor model, bi-directional reconstruction, CashForecastService integration
    • 10 commits, 434 specs pass
  • PR #1411 — Investment Transaction Sign Fix
    • buy/sell amount signs corrected in InvestmentsTransactionsSyncService
    • Rake task: bundle exec rake data:fix_investment_transaction_signs (153 txns to fix in prod)
@adamdilek
adamdilek / 2026-03-25-reconstructed-balance-cash-flow-design.md
Created March 25, 2026 17:29
Reconstructed Balance for Cash Flow — Design & Implementation Plan

Reconstructed Balance for Cash Flow — Design Document

Date: 2026-03-25 Status: Approved (with notes) Perspectives: Technical + Product


Problem

@adamdilek
adamdilek / 2026-03-22-internal-transfer-multi-signal-design.md
Created March 22, 2026 18:34
Internal Transfer Multi-Signal Confidence System — Design

Internal Transfer Multi-Signal Confidence System — Design

1. System Overview

This system enhances internal transfer detection by moving from a single, binary check to a multi-signal confidence model. It gathers evidence from various sources (accounting integrations like Campfire/QBO/Xero, mirror transaction matching, keywords, account masks, entity names, provider labels), assigns a confidence score to each, and calculates a final weighted score. This solves three key problems: (1) wasted high-confidence signals from integrations (Campfire journal_type=Transfer currently discarded), (2) race conditions where one side of a transfer enriches before the other arrives, and (3) ambiguity in round-number repeated transfers. Built ON TOP of existing infrastructure, not replacing it.

2. Components

New Files

@adamdilek
adamdilek / 2026-03-22-balance-aggregator-fix-design.md
Created March 22, 2026 18:33
BalanceAggregator + GroupedBankAccountsResolver fix designs (tPath)

FinancialControls::BalanceAggregator — Holdings Exclusion Fix

Status: Draft Depends on: investment_behavior flag (PR: holdings-reliability-flag) File: app/services/financial_controls/balance_aggregator.rb


1. Problem

@adamdilek
adamdilek / design.md
Last active March 22, 2026 19:25
Investment Behavior Flag — Final Design (tPath)

Investment Behavior Flag — Final Design

Status: Approved Scope: Backend + GraphQL only (no UI) Related: BalanceAggregator fix (separate PR), GroupedBankAccountsResolver fix (separate PR), Unreconciled UI #1350 (separate PR)


1. Summary