<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ramachandran MG</title>
    <description>The latest articles on DEV Community by Ramachandran MG (@ramachandran_mg_008).</description>
    <link>https://dev.to/ramachandran_mg_008</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4232468%2F2045efad-a6e6-48da-a9ad-37f00ff0ec0e.jpg</url>
      <title>DEV Community: Ramachandran MG</title>
      <link>https://dev.to/ramachandran_mg_008</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ramachandran_mg_008"/>
    <language>en</language>
    <item>
      <title>My cash-flow agent stopped trusting due dates after HindsightMy cash-flow agent stopped trusting due dates after Hindsight</title>
      <dc:creator>Ramachandran MG</dc:creator>
      <pubDate>Sat, 07 Nov 2026 17:07:37 +0000</pubDate>
      <link>https://dev.to/ramachandran_mg_008/my-cash-flow-agent-stopped-trusting-due-dates-after-hindsightmy-cash-flow-agent-stopped-trusting-47gn</link>
      <guid>https://dev.to/ramachandran_mg_008/my-cash-flow-agent-stopped-trusting-due-dates-after-hindsightmy-cash-flow-agent-stopped-trusting-47gn</guid>
      <description>&lt;p&gt;Most AI finance tools predict cash flow using invoice due dates. But due dates are promises, not payments.&lt;/p&gt;

&lt;p&gt;I wanted to build something smarter.&lt;/p&gt;

&lt;p&gt;Imagine your dashboard says you'll have ₹9.91 lakh remaining after paying your biggest supplier. Everything looks safe. But what if your customers don't actually pay on time?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That's the problem I wanted to solve with Cashwise&lt;/strong&gt; — an AI-powered cash-flow agent that learns how customers really pay, remembers past business events, and helps business owners make better financial decisions.&lt;/p&gt;

&lt;p&gt;In one scenario, a traditional due-date forecast showed ₹9.91 lakh remaining. Cashwise predicted a ₹1.94 lakh cash shortage.&lt;/p&gt;

&lt;p&gt;Same business. Same invoices. Different understanding of reality.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;The Problem: Expected Cash Isn't Actual Cash&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Small businesses often sell products and services on credit. While waiting for customer payments, they still need to manage supplier bills, salaries, rent, and other expenses.&lt;/p&gt;

&lt;p&gt;Most traditional cash-flow tools calculate future balances based on invoice due dates.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;But here's the problem:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One customer consistently pays on time.&lt;/li&gt;
&lt;li&gt;Another customer is usually 15 days late.&lt;/li&gt;
&lt;li&gt;Someone else pays in multiple instalments.&lt;/li&gt;
&lt;li&gt;A previously reliable customer suddenly starts delaying payments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A system that treats every customer equally can give business owners a false sense of financial security.&lt;/p&gt;

&lt;p&gt;Cashwise follows a different approach: predict cash flow using actual payment behaviour, not just expected payment dates.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Introducing Cashwise&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cashwise is an AI-powered financial assistant designed to help small businesses understand their future cash position.&lt;/p&gt;

&lt;p&gt;Instead of simply displaying financial records, it combines deterministic financial calculations, customer payment behaviour, and long-term business memory.&lt;/p&gt;

&lt;p&gt;The goal is simple: help business owners understand not only how much money they might have, but also why they might face a shortage and what they can do about it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxbelkksvw9ie6umuhzdp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxbelkksvw9ie6umuhzdp.jpg" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Cashwise landing page introduces the platform and its core capabilities.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;How We Built Cashwise&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We designed Cashwise using four major components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;Financial Database&lt;/em&gt;: Stores invoices, customer payments, expenses, supplier bills, and business records.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Python Financial Engine&lt;/em&gt;: Handles cash-flow forecasting, financial calculations, alerts, and what-if scenarios.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Hindsight Memory&lt;/em&gt;: Stores and retrieves important business history, customer behaviour, and previous decisions.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Groq AI Agent&lt;/em&gt;: Understands user questions, selects the appropriate tools, and communicates financial insights.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The frontend is built with React, while FastAPI powers the backend.&lt;/p&gt;

&lt;p&gt;The AI agent uses Groq for tool calling and Hindsight for persistent business memory.&lt;/p&gt;

&lt;p&gt;One important architectural decision we made was to keep financial calculations outside the language model.&lt;/p&gt;

&lt;p&gt;Python calculates the numbers. The AI agent retrieves the required information and explains the results.&lt;/p&gt;

&lt;p&gt;This makes the financial logic more transparent, predictable, and testable.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Making Cash-Flow Forecasting More Realistic&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the core features of Cashwise is customer-specific payment prediction.&lt;/p&gt;

&lt;p&gt;Instead of assuming every customer pays on their invoice due date, we analyse their recent payment history.&lt;/p&gt;

&lt;p&gt;For each customer, the system considers up to their eight most recent paid invoices.&lt;/p&gt;

&lt;p&gt;We generate three forecasting scenarios:&lt;/p&gt;

&lt;p&gt;HISTORY_WINDOW = 8&lt;/p&gt;

&lt;p&gt;SCENARIOS = {&lt;br&gt;
    "best": 0.2,&lt;br&gt;
    "likely": 0.5,&lt;br&gt;
    "worst": 0.9,&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;These represent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Best Case: 20th percentile of historical payment delays.&lt;/li&gt;
&lt;li&gt;Likely Case: Median historical payment delay.&lt;/li&gt;
&lt;li&gt;Worst Case: 90th percentile of historical payment delays.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The financial engine also handles overdue invoices, partial payments, supplier bills, recurring expenses, and what-if scenarios.&lt;/p&gt;

&lt;p&gt;For example, a business owner can ask:&lt;/p&gt;

&lt;p&gt;"What happens if Mehta Traders pays 15 days late?"&lt;/p&gt;

&lt;p&gt;Cashwise recalculates the projected cash position based on that change.&lt;/p&gt;

&lt;p&gt;Importantly, this is a statistical projection based on historical payment behaviour, not a guarantee or a trained machine-learning model. Customers with limited payment history naturally have less reliable estimates.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Giving AI a Memory with Hindsight&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A financial database can tell us what happened.&lt;/p&gt;

&lt;p&gt;But it doesn't always explain why it happened.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A customer started paying faster after collection calls.&lt;/li&gt;
&lt;li&gt;Another customer repeatedly disputed invoices.&lt;/li&gt;
&lt;li&gt;A supplier changed payment terms.&lt;/li&gt;
&lt;li&gt;A business owner decided to delay a particular expense.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These events can influence future financial decisions.&lt;/p&gt;

&lt;p&gt;That's where Hindsight, an open-source agent memory system, becomes important.&lt;/p&gt;

&lt;p&gt;Cashwise uses Hindsight to store and retrieve business-specific experiences, including customer behaviour, supplier terms, collection outcomes, and owner decisions.&lt;/p&gt;

&lt;p&gt;Here's an example of how business events are stored:&lt;/p&gt;

&lt;p&gt;client.retain(&lt;br&gt;
    bank_id="malabar-electronics",&lt;br&gt;
    content=f"{e['description']} Outcome: {e['outcome']}",&lt;br&gt;
    context=f"{e['entity_type']}:{e['entity_id']} {e['event_type']}",&lt;br&gt;
    timestamp=f"{e['date']}T10:00:00Z",&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;When a business owner asks a question, Cashwise retrieves relevant memories before generating its response.&lt;/p&gt;

&lt;p&gt;Each business has its own memory bank, keeping its historical context separate from other businesses.&lt;/p&gt;

&lt;p&gt;This means the agent doesn't depend only on the current conversation. It can also use relevant experiences from the business's past.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl8i5wnx8c9c44xe4bnbl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl8i5wnx8c9c44xe4bnbl.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
Hindsight helps Cashwise recall previous business events and customer behaviour.&lt;/p&gt;




&lt;p&gt;Tools, Not Guesswork&lt;/p&gt;

&lt;p&gt;Memory provides context, but the agent also needs accurate financial data.&lt;/p&gt;

&lt;p&gt;We integrated Groq tool calling with a set of dedicated backend functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"cash_forecast" – Returns best, likely, and worst cash-flow scenarios.&lt;/li&gt;
&lt;li&gt;"what_if" – Compares forecasts after a proposed financial change.&lt;/li&gt;
&lt;li&gt;"customer_profile" – Retrieves customer payment behaviour.&lt;/li&gt;
&lt;li&gt;"upcoming_bills" – Checks supplier bills and payment terms.&lt;/li&gt;
&lt;li&gt;"recall_memory" – Retrieves relevant business history from Hindsight.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, when an owner asks:&lt;/p&gt;

&lt;p&gt;"Can I pay Vertex on Friday?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cashwise can:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check upcoming supplier bills.&lt;/li&gt;
&lt;li&gt;Recall relevant information about Vertex.&lt;/li&gt;
&lt;li&gt;Generate the current cash-flow forecast.&lt;/li&gt;
&lt;li&gt;Run a what-if scenario.&lt;/li&gt;
&lt;li&gt;Explain whether the proposed payment could create a cash shortage.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Python handles the financial calculations, while Groq coordinates the tools and communicates the results.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;The Dashboard: Financial Insights at a Glance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We wanted Cashwise to make complex financial information easy to understand.&lt;/p&gt;

&lt;p&gt;The dashboard brings important business information together, helping owners monitor their financial position without going through multiple spreadsheets.&lt;/p&gt;

&lt;p&gt;It provides an overview of financial performance, cash-flow projections, upcoming payments, and important business insights.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuqpljzfq0y5jsjemjpvi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuqpljzfq0y5jsjemjpvi.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
The dashboard gives business owners a clear view of their financial position.&lt;/p&gt;

&lt;p&gt;We also focused on making the platform practical rather than overwhelming. The aim is to turn financial data into information that business owners can actually use.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Before and After: A Realistic Business Scenario&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To demonstrate Cashwise, we created a sample business called Malabar Electronics Distributors.&lt;/p&gt;

&lt;p&gt;Its customers have different payment patterns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mehta Traders: Frequently pays late, with collection-call effectiveness changing over time.&lt;/li&gt;
&lt;li&gt;Sreeram Retail Chain: Has gradually started delaying payments.&lt;/li&gt;
&lt;li&gt;Fortune Appliances: Usually pays in two instalments.&lt;/li&gt;
&lt;li&gt;Kerala Digital Store: Has a reliable payment history.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now consider a major supplier payment.&lt;/p&gt;

&lt;p&gt;The business needs to pay ₹15 lakh to Vertex on 13 November.&lt;/p&gt;

&lt;p&gt;A traditional due-date-based forecast assumes that expected customer payments will arrive on schedule.&lt;/p&gt;

&lt;p&gt;It reports:&lt;/p&gt;

&lt;p&gt;₹9.91 lakh remaining.&lt;/p&gt;

&lt;p&gt;But Cashwise considers the customers' actual payment behaviour and historical delays.&lt;/p&gt;

&lt;p&gt;Its likely forecast reports:&lt;/p&gt;

&lt;p&gt;₹1.94 lakh cash shortfall.&lt;/p&gt;

&lt;p&gt;That's a significant difference.&lt;/p&gt;

&lt;p&gt;Now the owner asks:&lt;/p&gt;

&lt;p&gt;"What if Mehta pays 15 days late?"&lt;/p&gt;

&lt;p&gt;Cashwise runs the what-if scenario and recalls that Mehta has consistently paid 13–15 days late.&lt;/p&gt;

&lt;p&gt;Instead of simply displaying a warning, it can recommend practical actions such as contacting Mehta immediately and following up in writing.&lt;/p&gt;

&lt;p&gt;The important difference is that the recommendation is supported by financial calculations and relevant business history.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;What We Learned While Building Cashwise&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Building Cashwise also helped us understand some limitations of AI-powered financial systems.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;New customers have limited history&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A new customer has no established payment pattern. Predictions become more useful as payment records accumulate.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Unexpected expenses can change everything&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An unplanned expense can affect the entire cash-flow projection. Forecasts must be updated as new financial information becomes available.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Memory quality matters&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If incorrect events are stored or irrelevant memories are retrieved, recommendations can become less reliable.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Background scheduling is challenging&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Our scheduled reports run inside the web server environment. Since servers can sleep, we implemented a five-minute scheduler check that generates a missed report once the server wakes up instead of replaying every missed execution.&lt;/p&gt;

&lt;p&gt;These challenges reminded us that building an AI agent is not just about connecting an LLM to an API. Reliability, data quality, and system design matter just as much.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2bkew2cnrarylw3nmjzn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2bkew2cnrarylw3nmjzn.jpg" alt=" " width="439" height="1078"&gt;&lt;/a&gt;&lt;br&gt;
What We Would Carry Into Our Next AI Project&lt;/p&gt;

&lt;p&gt;There are a few important lessons we learned:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep calculations outside the LLM. Financial numbers should come from deterministic code, not generated responses.&lt;/li&gt;
&lt;li&gt;Databases and memory serve different purposes. Databases store structured records, while memory stores meaningful context and experiences.&lt;/li&gt;
&lt;li&gt;Retrieve relevant memories. More context isn't always better. The agent should recall information related to the user's question.&lt;/li&gt;
&lt;li&gt;Make uncertainty visible. Historical payment behaviour can improve forecasts, but it cannot guarantee future payments.&lt;/li&gt;
&lt;li&gt;Remember outcomes, not just decisions. Understanding what the business owner did and what happened afterward makes future recommendations more useful.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cashwise started with a simple observation: knowing when an invoice is due is not the same as knowing when the money will arrive.&lt;/p&gt;

&lt;p&gt;By combining deterministic Python calculations, Groq-powered tool calling, and Hindsight memory, we built an agent that goes beyond traditional due-date forecasting.&lt;/p&gt;

&lt;p&gt;It doesn't claim to predict the future perfectly.&lt;/p&gt;

&lt;p&gt;Instead, it helps business owners make better decisions using their financial data and business history.&lt;/p&gt;

&lt;p&gt;Because better financial decisions start with understanding what actually happens, not just what is expected to happen.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Explore Cashwise&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: "View the Cashwise source code" (YOUR_GITHUB_REPOSITORY_URL)&lt;/li&gt;
&lt;li&gt;Live Demo: &lt;a href="https://cashwise-5c6z.onrender.com" rel="noopener noreferrer"&gt;https://cashwise-5c6z.onrender.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Built with React, FastAPI, Python, Groq, and Hindsight.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0594eei78vxb42gn2w59.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0594eei78vxb42gn2w59.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>agents</category>
      <category>security</category>
    </item>
  </channel>
</rss>
