<?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>Forem: shalini mk</title>
    <description>The latest articles on Forem by shalini mk (@shalini_mk_151cbd50f6dec0).</description>
    <link>https://forem.com/shalini_mk_151cbd50f6dec0</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3837236%2F71f3322d-de6d-44fb-b8b6-edaf1192c1b0.jpg</url>
      <title>Forem: shalini mk</title>
      <link>https://forem.com/shalini_mk_151cbd50f6dec0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shalini_mk_151cbd50f6dec0"/>
    <language>en</language>
    <item>
      <title>My Coding Bot Stopped Repeating Itself After I Added Hindsight Memory</title>
      <dc:creator>shalini mk</dc:creator>
      <pubDate>Sat, 21 Mar 2026 15:45:27 +0000</pubDate>
      <link>https://forem.com/shalini_mk_151cbd50f6dec0/my-coding-bot-stopped-repeating-itself-after-i-added-hindsight-memory-4mo9</link>
      <guid>https://forem.com/shalini_mk_151cbd50f6dec0/my-coding-bot-stopped-repeating-itself-after-i-added-hindsight-memory-4mo9</guid>
      <description>&lt;p&gt;"Did it seriously just do that?" I leaned forward as our coding mentor &lt;br&gt;
recommended the exact problem I kept failing — not because I told it to, &lt;br&gt;
but because it remembered my last four sessions and noticed the pattern &lt;br&gt;
before I did.&lt;/p&gt;
&lt;h2&gt;
  
  
  What We Built
&lt;/h2&gt;

&lt;p&gt;CodeMentor AI is a coding practice web app with one key difference from &lt;br&gt;
every other platform: it remembers you. Not just your score — your actual &lt;br&gt;
mistake patterns, your weak topics, your solving speed by language, across &lt;br&gt;
every single session.&lt;/p&gt;

&lt;p&gt;The memory layer is powered by &lt;a href="https://github.com/vectorize-io/hindsight" rel="noopener noreferrer"&gt;Hindsight&lt;/a&gt;, &lt;br&gt;
a persistent agent memory system by Vectorize. The LLM is Groq running &lt;br&gt;
qwen/qwen3-32b. The frontend is React with Monaco Editor — the same &lt;br&gt;
editor used in VS Code.&lt;/p&gt;

&lt;p&gt;The app has 5 modules: a code editor for practice, a mistake memory &lt;br&gt;
tracker, an AI mentor chat, a personalized learning path generator, &lt;br&gt;
and a progress analytics dashboard. Everything is wired through &lt;br&gt;
Hindsight's retain() and recall() functions.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Problem With Every Other Coding Platform
&lt;/h2&gt;

&lt;p&gt;LeetCode doesn't know you failed binary search three times this week. &lt;br&gt;
HackerRank doesn't know you always mess up recursion base cases. &lt;br&gt;
Every single session starts from zero.&lt;/p&gt;

&lt;p&gt;So the "personalized" recommendations are just topic filters. There's &lt;br&gt;
no agent that actually learned from watching you code. You repeat the &lt;br&gt;
same mistakes because nothing is tracking the pattern.&lt;/p&gt;

&lt;p&gt;We wanted to fix that.&lt;/p&gt;
&lt;h2&gt;
  
  
  How Hindsight Memory Changes Everything
&lt;/h2&gt;

&lt;p&gt;Every action in CodeMentor retains a memory to &lt;br&gt;
&lt;a href="https://hindsight.vectorize.io/" rel="noopener noreferrer"&gt;Hindsight's agent memory system&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// When a student fails a problem&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;hindsight&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;retain&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mistake_pattern&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Arun&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;off-by-one error&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;language&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Python&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;frequency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;problems_affected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;two-sum&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;binary-search&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sliding-window&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before every AI response, the mentor recalls from memory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Recall before answering&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;memories&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;hindsight&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;recall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;what mistakes does Arun keep making in Python&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// Groq receives recalled memories as context&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;groq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;
    &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;system&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`You are CodeMentor AI. Here is what you remember 
    about this student: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;memories&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;
    Use this to give specific, personalized advice.`&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userMessage&lt;/span&gt;
  &lt;span class="p"&gt;}]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The mentor doesn't guess. It knows.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Before vs After Moment
&lt;/h2&gt;

&lt;p&gt;This is the demo moment that makes judges stop scrolling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With Memory OFF&lt;/strong&gt;, the bot says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Hello! What would you like to practice today?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;With Memory ON&lt;/strong&gt; — after recalling from Hindsight:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Hey Arun — you've hit recursion issues twice this week. &lt;br&gt;
Want to try an easier problem first to build confidence?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Same LLM. Same prompt. The ONLY difference is the recall() call &lt;br&gt;
pulling real history from Hindsight before the response is generated.&lt;/p&gt;

&lt;p&gt;We added a toggle switch in the navbar so you can flip between &lt;br&gt;
the two modes live during a demo. It's the clearest possible way &lt;br&gt;
to show what persistent memory actually does.&lt;/p&gt;

&lt;h2&gt;
  
  
  What We Stored in Hindsight
&lt;/h2&gt;

&lt;p&gt;We retained four types of memories:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Problem attempts&lt;/strong&gt; — every try, pass or fail, with error type&lt;br&gt;&lt;br&gt;
&lt;strong&gt;2. Mistake patterns&lt;/strong&gt; — recurring issues like off-by-one, null pointer, &lt;br&gt;
missing base case&lt;br&gt;&lt;br&gt;
&lt;strong&gt;3. Solved problems&lt;/strong&gt; — language used, attempts taken, concepts covered&lt;br&gt;&lt;br&gt;
&lt;strong&gt;4. Session summaries&lt;/strong&gt; — daily snapshots of weak and strong areas&lt;/p&gt;

&lt;p&gt;We started by only storing solved problems. That gave us almost nothing &lt;br&gt;
useful for personalization. The breakthrough came when we added mistake &lt;br&gt;
patterns — suddenly the agent could say things like "you've had this &lt;br&gt;
exact error 3 times" instead of giving generic advice.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Surprised Us
&lt;/h2&gt;

&lt;p&gt;We expected Hindsight to be useful for recommendations. We didn't &lt;br&gt;
expect it to make the AI sound genuinely caring.&lt;/p&gt;

&lt;p&gt;When the agent says "I noticed you haven't practiced dynamic programming &lt;br&gt;
in 5 days" — it's not hallucinating. It literally recalled that from a &lt;br&gt;
session summary we retained 5 days ago. That grounding makes the &lt;br&gt;
responses feel trustworthy in a way RAG alone never did.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://vectorize.io/features/agent-memory" rel="noopener noreferrer"&gt;agent memory features in Vectorize&lt;/a&gt; &lt;br&gt;
make this pattern surprisingly easy to implement. retain() and recall() &lt;br&gt;
are the whole API surface. The hard part is deciding what to store.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Retain more than you think you need.&lt;/strong&gt; We started minimal. Adding &lt;br&gt;
mistake patterns and session summaries unlocked 80% of the useful &lt;br&gt;
behaviors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The recall query is everything.&lt;/strong&gt; Vague queries return vague memories. &lt;br&gt;
"off-by-one errors in Python arrays this week" returns exactly what &lt;br&gt;
you need. "user mistakes" returns noise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Show the memory working visibly.&lt;/strong&gt; We added a Memory Log page that &lt;br&gt;
shows every retain() call ever made. Users trusted the app more when &lt;br&gt;
they could see what it knew about them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The before/after toggle is your best demo.&lt;/strong&gt; Nothing explains &lt;br&gt;
persistent memory faster than showing the agent with it OFF vs ON &lt;br&gt;
side by side. Build this into your demo flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't over-engineer the LLM prompt.&lt;/strong&gt; The recalled memories do the &lt;br&gt;
heavy lifting. A simple system prompt + recalled context outperformed &lt;br&gt;
our elaborate prompt engineering attempts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;🌐 Live App: &lt;a href="https://codementor-ai-inky-eight.vercel.app/" rel="noopener noreferrer"&gt;https://codementor-ai-inky-eight.vercel.app/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;💻 GitHub: &lt;a href="https://github.com/shalz-collab/code-mentor-ai-f130af97" rel="noopener noreferrer"&gt;https://github.com/shalz-collab/code-mentor-ai-f130af97&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;🧠 Hindsight: &lt;a href="https://github.com/vectorize-io/hindsight" rel="noopener noreferrer"&gt;github.com/vectorize-io/hindsight&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're building any kind of practice or coaching agent, the &lt;br&gt;
retain/recall pattern here is reusable for any domain. The code &lt;br&gt;
is all on GitHub.&lt;/p&gt;

</description>
      <category>workplace</category>
      <category>webdev</category>
      <category>ai</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
