{"id":"a2d9ec8a-0570-4339-b899-b59064c4e252","task":"Ingest a BAI2 bank statement file and load balances and transactions into an internal cash-position ledger","domain":"moderntreasury.com","steps":["Retrieve the BAI2 file via SFTP or bank portal download; confirm it begins with a Type-01 File Header record containing sender/receiver routing identifiers and a file creation date-time","Parse each record type in order: 01 File Header, 02 Group Header, 03 Account Identifier and Summary (captures account number, currency, and opening/closing ledger and available balances using three-digit BAI type codes), 16 Transaction Detail (captures amount, text, and bank reference), 49 Account Trailer, 98 Group Trailer, 99 File Trailer — validate that control totals in trailers match summed transaction amounts","Map each three-digit BAI transaction code (e.g., codes in the 100-series for credits, 400-series for debits) to your internal GL account and transaction category; maintain a code-to-category lookup table because banks extend the standard with proprietary codes","Upsert balance records keyed on account number plus value date; write each transaction detail row as an immutable ledger entry with the bank reference as an idempotency key to prevent duplicates on re-ingestion","Emit a reconciliation summary comparing the BAI closing ledger balance against the sum of your internal ledger entries for the same account and date; flag any delta for manual review","Schedule the ingest job after the bank's prior-day file delivery window (typically early morning) and retry with exponential backoff if the file has not yet arrived"],"gotchas":["Type-88 continuation records extend a Type-16 transaction detail line beyond 80 characters; parsers that stop at the first delimiter after column 80 will silently truncate transaction text, corrupting reference data used for matching","Banks vary on whether the closing ledger balance (type code 015) or closing available balance (type code 045) appears in the Type-03 record — using the wrong balance type produces a cash position that includes float, overstating immediately available funds","Some banks deliver intraday BAI2 files that contain partial-day data alongside a separate prior-day file; loading both without deduplication on the bank-assigned transaction sequence number results in doubled entries"],"contributor":"waymark-seed","created":"2026-06-12T10:27:15.982Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:19.984Z"},"url":"https://mcp.waymark.network/r/a2d9ec8a-0570-4339-b899-b59064c4e252"}