<?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: Khushi Singh</title>
    <description>The latest articles on DEV Community by Khushi Singh (@khushiix08).</description>
    <link>https://dev.to/khushiix08</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%2F3970296%2Ff4a6c422-7b98-4136-86ae-c45e76de153a.png</url>
      <title>DEV Community: Khushi Singh</title>
      <link>https://dev.to/khushiix08</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/khushiix08"/>
    <language>en</language>
    <item>
      <title>Why I Built a Cross-Deal Memory Search and What Hindsight Made Possible</title>
      <dc:creator>Khushi Singh</dc:creator>
      <pubDate>Fri, 05 Jun 2026 18:32:26 +0000</pubDate>
      <link>https://dev.to/khushiix08/why-we-replaced-short-term-chat-history-with-hindsight-1lln</link>
      <guid>https://dev.to/khushiix08/why-we-replaced-short-term-chat-history-with-hindsight-1lln</guid>
      <description>&lt;p&gt;Six months into building sales tooling, I hit a wall that no one warns you about: your agent is only as useful as its worst conversation. Doesn't matter how good the LLM is. If it can't connect what happened in Deal A to what's happening right now in Deal B, it's giving advice that ignores half the available signal.&lt;/p&gt;

&lt;p&gt;That's the problem the Autopilot feature in the Deal Intelligence Agent was built to solve — and it only became possible because of how &lt;a href="https://github.com/vectorize-io/hindsight" rel="noopener noreferrer"&gt;Hindsight&lt;/a&gt; stores and retrieves memory across deal boundaries.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem with per-deal memory silos
&lt;/h2&gt;

&lt;p&gt;The first version of the agent had great per-deal memory. You could ask about any deal and get accurate, grounded answers about that specific account's history. Objections, stakeholders, pricing discussions — all there, all retrievable.&lt;/p&gt;

&lt;p&gt;What it couldn't do was answer questions like: "Has an objection like this ever come up before? What worked?"&lt;/p&gt;

&lt;p&gt;That's where the real value lives. An experienced sales rep doesn't just know their current deals — they pattern-match across everything they've ever worked on. They remember that the "we need to check with legal" objection from a manufacturing company last year was actually a stall tactic, and the way to break it was a specific framing around risk reduction, not around speed.&lt;/p&gt;

&lt;p&gt;An agent with siloed per-deal memory can't do that. It's smart within a deal and blind across deals.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Hindsight enabled cross-deal search
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;MemoryService&lt;/code&gt; wraps &lt;a href="https://hindsight.vectorize.io/" rel="noopener noreferrer"&gt;Hindsight's persistent memory layer&lt;/a&gt; with a &lt;code&gt;semantic_search&lt;/code&gt; method that can operate either scoped to one deal or across all deals in the system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;semantic_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;deal_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Dict&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Cross-deal semantic search.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;deal_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_relevant_memories&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;deal_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Search across all deals
&lt;/span&gt;    &lt;span class="n"&gt;all_results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;d_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;memories&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;_fallback_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;mem&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;memories&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;mem&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
                &lt;span class="n"&gt;all_results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;mem&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;deal_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;d_id&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;all_results&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the Hindsight-connected path, &lt;code&gt;client.memory.search&lt;/code&gt; handles the semantic similarity natively across the pipeline. In fallback mode, it iterates the local store. The interface is identical either way.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Autopilot loop in practice
&lt;/h2&gt;

&lt;p&gt;The Autopilot service uses this cross-deal search to run an autonomous objection resolution pass across every active deal. Here's the sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pull all active deals from the CRM&lt;/li&gt;
&lt;li&gt;For each deal, retrieve unresolved objections from Hindsight&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;semantic_search&lt;/code&gt; across all closed-won deals for similar objections&lt;/li&gt;
&lt;li&gt;If a match is found from a won deal, surface that resolution strategy&lt;/li&gt;
&lt;li&gt;Generate a full playbook: strategy, email draft, SMS, risk reduction estimate&lt;/li&gt;
&lt;li&gt;Store the playbook back in Hindsight as an &lt;code&gt;autopilot_action&lt;/code&gt; entry
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;search_query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;resolved &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;obj_category&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; objection &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;obj_text&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;raw_matches&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;semantic_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;search_query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;resolved_strategy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
&lt;span class="n"&gt;matched_deal_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;match&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;raw_matches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;m_deal_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;deal_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;m_deal_id&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;m_deal_id&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;deal_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;m_deal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_deals&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m_deal_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;m_deal&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;m_deal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;outcome&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;won&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;resolved_strategy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;matched_deal_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m_deal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;company_name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;break&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The key constraint: only pull strategies from deals with &lt;code&gt;outcome == "won"&lt;/code&gt;. Pulling from lost deals would be actively harmful — you'd be surfacing exactly what didn't work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the live execution looks like
&lt;/h2&gt;

&lt;p&gt;The Autopilot runs as a FastAPI &lt;code&gt;BackgroundTask&lt;/code&gt; and streams timestamped logs to a frontend console in real time. The log levels (&lt;code&gt;INFO&lt;/code&gt;, &lt;code&gt;PROCESS&lt;/code&gt;, &lt;code&gt;RECALL&lt;/code&gt;, &lt;code&gt;MATCH&lt;/code&gt;, &lt;code&gt;REASON&lt;/code&gt;, &lt;code&gt;SUCCESS&lt;/code&gt;) tell the story:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;[INFO]    Autopilot Agent triggered. Initializing CRM pipeline scan...
[PROCESS] Analyzing account context: 'Meridian Systems'...
[RECALL]  Retrieved 3 unresolved objections from Hindsight for 'Meridian Systems'.
[RECALL]  Primary objection: "Price is 40% above current vendor" [Category: pricing]
[PROCESS] Cross-Deal Search: Querying Hindsight for historical resolution patterns...
[MATCH]   Found historical match in CLOSED-WON deal: 'Apex Corp'.
[REASON]  Recall resolution strategy: "Offered 24-month commit with 20% discount bundled with onboarding..."
[SUCCESS] Objection Resolution Playbook generated for 'Meridian Systems' (Risk reduction: -22%).
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When there's no historical match, the agent falls back to synthesizing a strategy via Groq — but it logs that explicitly so reps know they're working with generated advice rather than proven patterns.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this actually changes for a sales team
&lt;/h2&gt;

&lt;p&gt;The difference between "AI assistant" and "AI that makes you better over time" is whether the system learns from closed deals. Every deal you win or lose adds signal. Without &lt;a href="https://vectorize.io/what-is-agent-memory" rel="noopener noreferrer"&gt;agent memory&lt;/a&gt; that persists across sessions and across deals, that signal evaporates the moment the call ends.&lt;/p&gt;

&lt;p&gt;With Hindsight storing typed, searchable outcomes, the Autopilot can tell a rep: "This exact objection type — pricing from a mid-market manufacturing company — came up in three deals this year. Two were won. Here's what worked." That's institutional knowledge that doesn't live in anyone's head or get lost when a rep leaves.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Three things I'd tell someone building cross-deal memory:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Don't assume per-deal scoping is sufficient. It feels complete until you need cross-deal reasoning. Design the &lt;code&gt;user_id&lt;/code&gt; scoping and the cross-search path from day one.&lt;/p&gt;

&lt;p&gt;Filter retrieved matches by outcome before surfacing them. "What worked" and "what happened" are different questions. Only the former is useful for an agent giving action recommendations.&lt;/p&gt;

&lt;p&gt;Store every outcome explicitly. Win/loss is obvious, but stage changes, objection resolutions, and competitive outcomes are all learning signal. If you don't write them to memory at event time, they're gone.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/chaitanya07-ai/deal-intelligence-agent" rel="noopener noreferrer"&gt;github.com/chaitanya07-ai/deal-intelligence-agent&lt;/a&gt; | Live: &lt;a href="https://deal-intelligence-agent-1.onrender.com/" rel="noopener noreferrer"&gt;deal-intelligence-agent-1.onrender.com&lt;/a&gt;&lt;/p&gt;

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