<?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: Shivani Saraf</title>
    <description>The latest articles on DEV Community by Shivani Saraf (@shivani_saraf_315).</description>
    <link>https://dev.to/shivani_saraf_315</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%2F4006342%2F7534c0f2-7cc4-41f0-8d85-c17030260846.png</url>
      <title>DEV Community: Shivani Saraf</title>
      <link>https://dev.to/shivani_saraf_315</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shivani_saraf_315"/>
    <language>en</language>
    <item>
      <title>Building a Multi-Persona Finance Agent with Persistent Memory: Inside Vorniq</title>
      <dc:creator>Shivani Saraf</dc:creator>
      <pubDate>Sun, 28 Jun 2026 10:34:04 +0000</pubDate>
      <link>https://dev.to/shivani_saraf_315/building-a-multi-persona-finance-agent-with-persistent-memory-inside-vorniq-2ppo</link>
      <guid>https://dev.to/shivani_saraf_315/building-a-multi-persona-finance-agent-with-persistent-memory-inside-vorniq-2ppo</guid>
      <description>&lt;p&gt;Building a Multi-Persona Finance Agent with Persistent Memory: Inside Vorniq&lt;br&gt;
A technical deep-dive into five expert AI agents, one shared memory layer, and what it takes to make them feel like a single coherent financial advisor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem: Expert Amnesia&lt;/strong&gt;&lt;br&gt;
Most AI finance tools have a blindspot that nobody talks about: they are brilliant in isolation and amnesiac across sessions. You tell your investment assistant you have a moderate risk appetite and a five-year horizon, and three days later, when you switch to a tax question, it has no idea who you are. The expertise is there. The continuity is not.&lt;br&gt;
That is the gap I built Vorniq to close. It is a personal finance intelligence system built around five specialized expert personas — a Bookkeeper, a Financial Analyst, an FP&amp;amp;A Analyst, an Investment Researcher, and a Tax Strategist — all sharing a single persistent memory layer powered by Hindsight by Vectorize. When Quinn, the Investment Researcher, learns you have a five-lakh corpus with moderate risk tolerance, Cassandra, the Tax Strategist, knows it on your very next session — without you repeating a word.&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%2Fbz36p29yrw7wzkal10yb.png" 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%2Fbz36p29yrw7wzkal10yb.png" alt=" " width="800" height="516"&gt;&lt;/a&gt;&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%2Fegoy5jjnaffzjg17xgt3.png" 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%2Fegoy5jjnaffzjg17xgt3.png" alt=" " width="800" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Vorniq Does and How It Hangs Together&lt;/strong&gt;&lt;br&gt;
At its core, Vorniq is a Next.js 14 frontend talking to an Express/TypeScript backend. The backend handles three things: recalling financial context from Hindsight before each LLM call, routing the message to the correct persona's system prompt, and retaining new facts back to memory after the response is generated. The LLM itself is Groq running qwen/qwen3-32b — fast enough that the recall-generate-retain loop does not introduce perceptible latency.&lt;br&gt;
The five personas are not cosmetic aliases for the same prompt. Each one has a distinct system instruction tuned to its domain:&lt;br&gt;
• Controller: Month-end close, GAAP reconciliation, internal controls, audit readiness&lt;br&gt;
• Financial Analyst: DCF modeling, scenario analysis, valuation, capital structure&lt;br&gt;
• FP&amp;amp;A Analyst: Rolling forecasts, variance analysis, driver-based budgeting&lt;br&gt;
• Investment Researcher: Portfolio due diligence, equity research, risk assessment&lt;br&gt;
• Tax Strategist: Section 80C deductions, LTCG optimization, multi-jurisdiction compliance&lt;br&gt;
The user selects a persona per session through a command palette in the sidebar. Switching personas mid-conversation is a first-class action — not a workaround. And because Hindsight memory persists across all five, switching from the Analyst to the Tax Strategist is less like opening a new app and more like walking from one specialist's office to the next in the same building.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Core Technical Story: Memory as First-Class Infrastructure&lt;/strong&gt;&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%2Fxjxrwm31kj2puvnr5ffs.png" 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%2Fxjxrwm31kj2puvnr5ffs.png" alt=" " width="800" height="565"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The single architectural decision that made everything else possible was treating memory not as a feature bolted onto the chat layer, but as the primary infrastructure concern — resolved before a single token of generation begins.&lt;br&gt;
Here is the sequence inside backend/src/agent/core.ts on every request:&lt;br&gt;
try {&lt;br&gt;
    // Memory is optional — if Hindsight is down, chat still works&lt;br&gt;
    try {&lt;br&gt;
      await ensureBank(bankId);&lt;br&gt;
    } catch (bankErr: unknown) {&lt;br&gt;
      console.warn(&lt;code&gt;[core] ensureBank failed (Hindsight may be offline): ${(bankErr as Error).message}&lt;/code&gt;);&lt;br&gt;
    }&lt;br&gt;
    const memories = await recall(bankId, message);&lt;br&gt;
    const systemPrompt = getPersonaPrompt(persona, formatMemories(memories));&lt;br&gt;
    const completion = await groq.chat.completions.create({&lt;br&gt;
      model: settings.GROQ_MODEL,&lt;br&gt;
      messages: [&lt;br&gt;
        { role: "system", content: systemPrompt },&lt;br&gt;
        ...history.slice(-10),&lt;br&gt;
        { role: "user", content: message },&lt;br&gt;
      ],&lt;br&gt;
      temperature: 0.7,&lt;br&gt;
      max_tokens: 1024,&lt;br&gt;
    });&lt;br&gt;
The Recall step is where Hindsight earns its keep. It runs a TEMPR search — a combination of semantic vector similarity, BM25 keyword retrieval, graph traversal across related facts, and temporal weighting that ranks recent information higher. A single query for "what should I invest in?" returns not just investment preferences, but linked debt obligations, income constraints, and tax-bracket context that were stored in completely separate sessions.&lt;br&gt;
The Retain step is equally deliberate. Rather than dumping the entire conversation back into the memory store, the system extracts discrete financial facts — income figures, debt balances, risk tolerances, stated goals — and stores them as structured entries keyed to the user's bankId. This keeps retrieval clean and prevents the memory store from becoming a noisy transcript archive.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Cross-Persona Memory in Practice&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
The most revealing test of the system is what happens when you switch personas mid-workflow. Here is a real session sequence:&lt;br&gt;
// Session 1 — Investment Researcher&lt;br&gt;
User: "I have ₹5L to invest, moderate risk, 5-year horizon."&lt;br&gt;
Investment Researcher: [provides allocation across equity, debt, hybrid funds]&lt;br&gt;
// Retained: investable_capital=₹5L, risk=moderate, horizon=5yr&lt;/p&gt;

&lt;p&gt;// Session 2 — Tax Strategist&lt;br&gt;
User: "What's the most tax-efficient way to invest?"&lt;br&gt;
Tax Strategist: "Given your ₹5L corpus and 5-year horizon Quinn noted,&lt;br&gt;
         ELSS funds give you Sec 80C deduction on ₹1.5L&lt;br&gt;
         and LTCG exemption after 1 year."&lt;br&gt;
Tax Strategist did not ask Investment Reasearcher what the user's situation was. The memory system bridged the two sessions invisibly. That is the behavior the architecture was designed to produce — and in practice, it works on session counts well into the double digits, accumulating up to 105 retained memories in a single user's bank.&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%2Fibmcnhqxzkwyl8y6y44a.png" 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%2Fibmcnhqxzkwyl8y6y44a.png" alt=" " width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Why Hindsight, and What It Actually Does&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
I evaluated a few memory backends before landing on Hindsight. The deciding factor was TEMPR — its hybrid retrieval strategy. Pure semantic search misses exact figures ("5L" and "five lakh" are semantically close but keyword retrieval is more reliable for number-heavy financial data). Pure BM25 misses conceptually related facts. Hindsight runs both, then applies graph traversal to pull in linked entities and temporal weighting to surface recent updates over stale entries.&lt;br&gt;
The Reflect endpoint is a useful addition for session hygiene. Calling POST /reflect at session end triggers Hindsight to consolidate the session's retained facts into a coherent profile update — deduplicating, resolving conflicts, and pruning superseded data. Without it, a user who updates their income figure across three sessions would accumulate three separate income entries rather than a single current value.&lt;br&gt;
Memory is stored per user in a named bankId. The backend/.env sets this as HINDSIGHT_BANK_ID=finsight-bank for local development, but in production this would be a per-user identifier so financial data is properly scoped and isolated.&lt;br&gt;
&lt;strong&gt;Persona Prompts: Where Domain Expertise Lives&lt;/strong&gt;&lt;br&gt;
Each persona's system prompt in backend/src/agent/personas.ts does two things:&lt;br&gt;
it establishes the expert identity Controller who cares about GAAP compliance and segregation of duties; Financial analyst who defaults to DCF and scenario analysis, and it specifies how recalled memories should be integrated into responses.&lt;br&gt;
The memory injection is not naive concatenation. The system prompt instructs each persona to surface recalled context only when it is relevant to the current query, and to cite the source — "as you mentioned in a previous session" or "based on the income figure Investment Researcher noted." This keeps responses grounded without turning every reply into a recitation of everything the system remembers.&lt;br&gt;
One design decision I am glad I made early: keeping persona switching stateless on the backend. The frontend sends { persona, bankId, message, history } on every request. The backend does not maintain session state between calls. This means the frontend can switch personas mid-conversation without any server-side coordination — the correct persona prompt is just selected from the map and injected fresh on each call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Results: What the System Actually Produces&lt;/strong&gt;&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%2Fvfiz0orgwepc8vqj5hwc.png" 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%2Fvfiz0orgwepc8vqj5hwc.png" alt=" " width="799" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The concrete outputs are what matter most, so here is what the system produces in practice. When a user with a financial profile of ₹1,20,000/month income, ₹5L in mutual funds, ₹5L car loan, ₹50,000 monthly budget queries Financial Analyst, they receive a structured quick-look summary breaking down gross income, stated surplus of ₹70,000, current investments, and debt obligations — with comments flagging unknowns like the car loan interest rate.&lt;br&gt;
That same user, switching to Tax Strategist in a later session, receives a four-column table covering ELSS vs. balanced fund allocation: what deduction each provides, the LTCG tax treatment, and post-tax CAGR projections of 10–12% and 7–9% respectively. The response references the ₹5L corpus and 5-year horizon from the Investment Researcher session without prompting.&lt;br&gt;
Controller handles requests in a different register entirely — responding to "What can I do today?" with a structured to-do list covering journal entry review, high-risk account reconciliation, AP/AR aging, close-calendar status, and team process improvement — each item with specific sub-tasks rather than generic advice.&lt;br&gt;
&lt;strong&gt;Lessons Learned&lt;/strong&gt;&lt;br&gt;
Five takeaways worth carrying into your next agent build:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Memory before generation, always. The recall step must happen before the LLM call, not after. Any architecture that tries to "stitch in" context during or after generation produces inconsistent results. Treat memory retrieval as a hard dependency, not an optimization.&lt;/li&gt;
&lt;li&gt;Stateless persona routing scales better. Sending the full context on every request means you get horizontal scalability for free. The backend can be replicated without any session affinity requirements.&lt;/li&gt;
&lt;li&gt;Reflect is not optional. Without periodic consolidation, memory stores accumulate contradictory facts. A user who updates their income three times ends up with three entries that confuse retrieval. The Reflect step keeps the profile coherent.&lt;/li&gt;
&lt;li&gt;Domain expertise lives in the prompt, not the model. Qwen3-32b is competent across all five domains. The differentiation between Dana's GAAP focus and Cassandra's tax optimization comes entirely from the persona system prompt. Investing in prompt quality compounds over time.&lt;/li&gt;
&lt;li&gt;Hybrid retrieval is non-negotiable for financial data. Financial facts are a mix of semantically meaningful context and precise numerical values. Semantic-only retrieval loses exact figures. Keyword-only retrieval misses conceptual connections. You need both, plus temporal weighting to surface the most recent version of any given fact.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What This Opens Up&lt;/strong&gt;&lt;br&gt;
The most interesting thing about Vorniq is not the five personas — it is the memory architecture that makes them feel coherent. The same pattern applies to any domain where a user interacts with multiple specialized agents over time: healthcare, legal research, engineering design review. The challenge in each case is identical: how do you ensure that what one agent learns is available to all others without rebuilding it from scratch each session?&lt;br&gt;
Persistent, structured, cross-session memory is the answer. And tools like Hindsight make it operationally straightforward enough that you can focus on what your personas actually know — not on plumbing the infrastructure to make them remember it.&lt;br&gt;
The full backend is three files: core.ts for the recall-generate-retain loop, memory.ts for the Hindsight client wrapper, and personas.ts for the five system prompts. If you are building something similar, that is the surface area you need to own. Everything else is standard web infrastructure.&lt;/p&gt;

&lt;p&gt;Resources: Hindsight GitHub  |  Hindsight Docs  |  Vectorize Agent Memory Overview  |  Groq Console&lt;br&gt;
References: - &lt;br&gt;
The Hindsight GitHub repository: &lt;a href="https://github.com/vectorize-io/hindsight" rel="noopener noreferrer"&gt;https://github.com/vectorize-io/hindsight&lt;/a&gt;&lt;br&gt;
The documentation for Hindsight: &lt;a href="https://hindsight.vectorize.io/" rel="noopener noreferrer"&gt;https://hindsight.vectorize.io/&lt;/a&gt;&lt;br&gt;
GitHub Link of project: &lt;a href="https://github.com/Durgaprasad044/VORNIQ" rel="noopener noreferrer"&gt;https://github.com/Durgaprasad044/VORNIQ&lt;/a&gt;&lt;br&gt;
Built with Hindsight for persistent agent memory, Groq for inference, and Next.js + Express for the stack&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>hindsight</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Building a Multi-Persona Finance Agent with Persistent Memory: Inside Vorniq</title>
      <dc:creator>Shivani Saraf</dc:creator>
      <pubDate>Sun, 28 Jun 2026 10:34:04 +0000</pubDate>
      <link>https://dev.to/shivani_saraf_315/building-a-multi-persona-finance-agent-with-persistent-memory-inside-vorniq-4g8c</link>
      <guid>https://dev.to/shivani_saraf_315/building-a-multi-persona-finance-agent-with-persistent-memory-inside-vorniq-4g8c</guid>
      <description>&lt;p&gt;Building a Multi-Persona Finance Agent with Persistent Memory: Inside Vorniq&lt;br&gt;
A technical deep-dive into five expert AI agents, one shared memory layer, and what it takes to make them feel like a single coherent financial advisor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem: Expert Amnesia&lt;/strong&gt;&lt;br&gt;
Most AI finance tools have a blindspot that nobody talks about: they are brilliant in isolation and amnesiac across sessions. You tell your investment assistant you have a moderate risk appetite and a five-year horizon, and three days later, when you switch to a tax question, it has no idea who you are. The expertise is there. The continuity is not.&lt;br&gt;
That is the gap I built Vorniq to close. It is a personal finance intelligence system built around five specialized expert personas — a Bookkeeper, a Financial Analyst, an FP&amp;amp;A Analyst, an Investment Researcher, and a Tax Strategist — all sharing a single persistent memory layer powered by Hindsight by Vectorize. When Quinn, the Investment Researcher, learns you have a five-lakh corpus with moderate risk tolerance, Cassandra, the Tax Strategist, knows it on your very next session — without you repeating a word.&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%2Fbz36p29yrw7wzkal10yb.png" 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%2Fbz36p29yrw7wzkal10yb.png" alt=" " width="800" height="516"&gt;&lt;/a&gt;&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%2Fegoy5jjnaffzjg17xgt3.png" 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%2Fegoy5jjnaffzjg17xgt3.png" alt=" " width="800" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Vorniq Does and How It Hangs Together&lt;/strong&gt;&lt;br&gt;
At its core, Vorniq is a Next.js 14 frontend talking to an Express/TypeScript backend. The backend handles three things: recalling financial context from Hindsight before each LLM call, routing the message to the correct persona's system prompt, and retaining new facts back to memory after the response is generated. The LLM itself is Groq running qwen/qwen3-32b — fast enough that the recall-generate-retain loop does not introduce perceptible latency.&lt;br&gt;
The five personas are not cosmetic aliases for the same prompt. Each one has a distinct system instruction tuned to its domain:&lt;br&gt;
• Controller: Month-end close, GAAP reconciliation, internal controls, audit readiness&lt;br&gt;
• Financial Analyst: DCF modeling, scenario analysis, valuation, capital structure&lt;br&gt;
• FP&amp;amp;A Analyst: Rolling forecasts, variance analysis, driver-based budgeting&lt;br&gt;
• Investment Researcher: Portfolio due diligence, equity research, risk assessment&lt;br&gt;
• Tax Strategist: Section 80C deductions, LTCG optimization, multi-jurisdiction compliance&lt;br&gt;
The user selects a persona per session through a command palette in the sidebar. Switching personas mid-conversation is a first-class action — not a workaround. And because Hindsight memory persists across all five, switching from the Analyst to the Tax Strategist is less like opening a new app and more like walking from one specialist's office to the next in the same building.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Core Technical Story: Memory as First-Class Infrastructure&lt;/strong&gt;&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%2Fxjxrwm31kj2puvnr5ffs.png" 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%2Fxjxrwm31kj2puvnr5ffs.png" alt=" " width="800" height="565"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The single architectural decision that made everything else possible was treating memory not as a feature bolted onto the chat layer, but as the primary infrastructure concern — resolved before a single token of generation begins.&lt;br&gt;
Here is the sequence inside backend/src/agent/core.ts on every request:&lt;br&gt;
try {&lt;br&gt;
    // Memory is optional — if Hindsight is down, chat still works&lt;br&gt;
    try {&lt;br&gt;
      await ensureBank(bankId);&lt;br&gt;
    } catch (bankErr: unknown) {&lt;br&gt;
      console.warn(&lt;code&gt;[core] ensureBank failed (Hindsight may be offline): ${(bankErr as Error).message}&lt;/code&gt;);&lt;br&gt;
    }&lt;br&gt;
    const memories = await recall(bankId, message);&lt;br&gt;
    const systemPrompt = getPersonaPrompt(persona, formatMemories(memories));&lt;br&gt;
    const completion = await groq.chat.completions.create({&lt;br&gt;
      model: settings.GROQ_MODEL,&lt;br&gt;
      messages: [&lt;br&gt;
        { role: "system", content: systemPrompt },&lt;br&gt;
        ...history.slice(-10),&lt;br&gt;
        { role: "user", content: message },&lt;br&gt;
      ],&lt;br&gt;
      temperature: 0.7,&lt;br&gt;
      max_tokens: 1024,&lt;br&gt;
    });&lt;br&gt;
The Recall step is where Hindsight earns its keep. It runs a TEMPR search — a combination of semantic vector similarity, BM25 keyword retrieval, graph traversal across related facts, and temporal weighting that ranks recent information higher. A single query for "what should I invest in?" returns not just investment preferences, but linked debt obligations, income constraints, and tax-bracket context that were stored in completely separate sessions.&lt;br&gt;
The Retain step is equally deliberate. Rather than dumping the entire conversation back into the memory store, the system extracts discrete financial facts — income figures, debt balances, risk tolerances, stated goals — and stores them as structured entries keyed to the user's bankId. This keeps retrieval clean and prevents the memory store from becoming a noisy transcript archive.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Cross-Persona Memory in Practice&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
The most revealing test of the system is what happens when you switch personas mid-workflow. Here is a real session sequence:&lt;br&gt;
// Session 1 — Investment Researcher&lt;br&gt;
User: "I have ₹5L to invest, moderate risk, 5-year horizon."&lt;br&gt;
Investment Researcher: [provides allocation across equity, debt, hybrid funds]&lt;br&gt;
// Retained: investable_capital=₹5L, risk=moderate, horizon=5yr&lt;/p&gt;

&lt;p&gt;// Session 2 — Tax Strategist&lt;br&gt;
User: "What's the most tax-efficient way to invest?"&lt;br&gt;
Tax Strategist: "Given your ₹5L corpus and 5-year horizon Quinn noted,&lt;br&gt;
         ELSS funds give you Sec 80C deduction on ₹1.5L&lt;br&gt;
         and LTCG exemption after 1 year."&lt;br&gt;
Tax Strategist did not ask Investment Reasearcher what the user's situation was. The memory system bridged the two sessions invisibly. That is the behavior the architecture was designed to produce — and in practice, it works on session counts well into the double digits, accumulating up to 105 retained memories in a single user's bank.&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%2Fibmcnhqxzkwyl8y6y44a.png" 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%2Fibmcnhqxzkwyl8y6y44a.png" alt=" " width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Why Hindsight, and What It Actually Does&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
I evaluated a few memory backends before landing on Hindsight. The deciding factor was TEMPR — its hybrid retrieval strategy. Pure semantic search misses exact figures ("5L" and "five lakh" are semantically close but keyword retrieval is more reliable for number-heavy financial data). Pure BM25 misses conceptually related facts. Hindsight runs both, then applies graph traversal to pull in linked entities and temporal weighting to surface recent updates over stale entries.&lt;br&gt;
The Reflect endpoint is a useful addition for session hygiene. Calling POST /reflect at session end triggers Hindsight to consolidate the session's retained facts into a coherent profile update — deduplicating, resolving conflicts, and pruning superseded data. Without it, a user who updates their income figure across three sessions would accumulate three separate income entries rather than a single current value.&lt;br&gt;
Memory is stored per user in a named bankId. The backend/.env sets this as HINDSIGHT_BANK_ID=finsight-bank for local development, but in production this would be a per-user identifier so financial data is properly scoped and isolated.&lt;br&gt;
&lt;strong&gt;Persona Prompts: Where Domain Expertise Lives&lt;/strong&gt;&lt;br&gt;
Each persona's system prompt in backend/src/agent/personas.ts does two things:&lt;br&gt;
it establishes the expert identity Controller who cares about GAAP compliance and segregation of duties; Financial analyst who defaults to DCF and scenario analysis, and it specifies how recalled memories should be integrated into responses.&lt;br&gt;
The memory injection is not naive concatenation. The system prompt instructs each persona to surface recalled context only when it is relevant to the current query, and to cite the source — "as you mentioned in a previous session" or "based on the income figure Investment Researcher noted." This keeps responses grounded without turning every reply into a recitation of everything the system remembers.&lt;br&gt;
One design decision I am glad I made early: keeping persona switching stateless on the backend. The frontend sends { persona, bankId, message, history } on every request. The backend does not maintain session state between calls. This means the frontend can switch personas mid-conversation without any server-side coordination — the correct persona prompt is just selected from the map and injected fresh on each call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Results: What the System Actually Produces&lt;/strong&gt;&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%2Fvfiz0orgwepc8vqj5hwc.png" 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%2Fvfiz0orgwepc8vqj5hwc.png" alt=" " width="799" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The concrete outputs are what matter most, so here is what the system produces in practice. When a user with a financial profile of ₹1,20,000/month income, ₹5L in mutual funds, ₹5L car loan, ₹50,000 monthly budget queries Financial Analyst, they receive a structured quick-look summary breaking down gross income, stated surplus of ₹70,000, current investments, and debt obligations — with comments flagging unknowns like the car loan interest rate.&lt;br&gt;
That same user, switching to Tax Strategist in a later session, receives a four-column table covering ELSS vs. balanced fund allocation: what deduction each provides, the LTCG tax treatment, and post-tax CAGR projections of 10–12% and 7–9% respectively. The response references the ₹5L corpus and 5-year horizon from the Investment Researcher session without prompting.&lt;br&gt;
Controller handles requests in a different register entirely — responding to "What can I do today?" with a structured to-do list covering journal entry review, high-risk account reconciliation, AP/AR aging, close-calendar status, and team process improvement — each item with specific sub-tasks rather than generic advice.&lt;br&gt;
&lt;strong&gt;Lessons Learned&lt;/strong&gt;&lt;br&gt;
Five takeaways worth carrying into your next agent build:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Memory before generation, always. The recall step must happen before the LLM call, not after. Any architecture that tries to "stitch in" context during or after generation produces inconsistent results. Treat memory retrieval as a hard dependency, not an optimization.&lt;/li&gt;
&lt;li&gt;Stateless persona routing scales better. Sending the full context on every request means you get horizontal scalability for free. The backend can be replicated without any session affinity requirements.&lt;/li&gt;
&lt;li&gt;Reflect is not optional. Without periodic consolidation, memory stores accumulate contradictory facts. A user who updates their income three times ends up with three entries that confuse retrieval. The Reflect step keeps the profile coherent.&lt;/li&gt;
&lt;li&gt;Domain expertise lives in the prompt, not the model. Qwen3-32b is competent across all five domains. The differentiation between Dana's GAAP focus and Cassandra's tax optimization comes entirely from the persona system prompt. Investing in prompt quality compounds over time.&lt;/li&gt;
&lt;li&gt;Hybrid retrieval is non-negotiable for financial data. Financial facts are a mix of semantically meaningful context and precise numerical values. Semantic-only retrieval loses exact figures. Keyword-only retrieval misses conceptual connections. You need both, plus temporal weighting to surface the most recent version of any given fact.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What This Opens Up&lt;/strong&gt;&lt;br&gt;
The most interesting thing about Vorniq is not the five personas — it is the memory architecture that makes them feel coherent. The same pattern applies to any domain where a user interacts with multiple specialized agents over time: healthcare, legal research, engineering design review. The challenge in each case is identical: how do you ensure that what one agent learns is available to all others without rebuilding it from scratch each session?&lt;br&gt;
Persistent, structured, cross-session memory is the answer. And tools like Hindsight make it operationally straightforward enough that you can focus on what your personas actually know — not on plumbing the infrastructure to make them remember it.&lt;br&gt;
The full backend is three files: core.ts for the recall-generate-retain loop, memory.ts for the Hindsight client wrapper, and personas.ts for the five system prompts. If you are building something similar, that is the surface area you need to own. Everything else is standard web infrastructure.&lt;/p&gt;

&lt;p&gt;Resources: Hindsight GitHub  |  Hindsight Docs  |  Vectorize Agent Memory Overview  |  Groq Console&lt;br&gt;
References: - &lt;br&gt;
The Hindsight GitHub repository: &lt;a href="https://github.com/vectorize-io/hindsight" rel="noopener noreferrer"&gt;https://github.com/vectorize-io/hindsight&lt;/a&gt;&lt;br&gt;
The documentation for Hindsight: &lt;a href="https://hindsight.vectorize.io/" rel="noopener noreferrer"&gt;https://hindsight.vectorize.io/&lt;/a&gt;&lt;br&gt;
GitHub Link of project: &lt;a href="https://github.com/Durgaprasad044/VORNIQ" rel="noopener noreferrer"&gt;https://github.com/Durgaprasad044/VORNIQ&lt;/a&gt;&lt;br&gt;
Built with Hindsight for persistent agent memory, Groq for inference, and Next.js + Express for the stack&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>hindsight</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
