<?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: Sai Sailu</title>
    <description>The latest articles on DEV Community by Sai Sailu (@sai_sailu_8c57dd18660856a).</description>
    <link>https://dev.to/sai_sailu_8c57dd18660856a</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%2F4150419%2F12734903-e4b2-451c-b2f8-350338269a4c.png</url>
      <title>DEV Community: Sai Sailu</title>
      <link>https://dev.to/sai_sailu_8c57dd18660856a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sai_sailu_8c57dd18660856a"/>
    <language>en</language>
    <item>
      <title>How I Built a Referral System That Remembers Past Interactions</title>
      <dc:creator>Sai Sailu</dc:creator>
      <pubDate>Tue, 29 Sep 2026 16:44:26 +0000</pubDate>
      <link>https://dev.to/sai_sailu_8c57dd18660856a/how-i-built-a-referral-system-that-remembers-past-interactions-2fn3</link>
      <guid>https://dev.to/sai_sailu_8c57dd18660856a/how-i-built-a-referral-system-that-remembers-past-interactions-2fn3</guid>
      <description>&lt;p&gt;Getting a job referral may seem simple, but managing referrals can become difficult when multiple candidates and employees are involved.&lt;/p&gt;

&lt;p&gt;A candidate usually finds a suitable job, identifies someone working at the company, shares their profile, asks for a referral, and waits for a response. On the employee side, handling multiple referral requests can make it difficult to remember previous conversations, decisions, and interactions with the same candidate.&lt;/p&gt;

&lt;p&gt;To solve this problem, I built ReferralHub, an application designed to manage the referral process in one place. Candidates can explore job opportunities, check how closely their profile matches a position, and submit referral requests. Employees can review those requests, examine candidate-job matches, and make referral decisions.&lt;/p&gt;

&lt;p&gt;The most interesting part of the project was adding persistent memory so that the system could retain useful information from previous interactions.&lt;/p&gt;

&lt;p&gt;What ReferralHub Does&lt;/p&gt;

&lt;p&gt;ReferralHub has two main types of users: candidates and employees.&lt;/p&gt;

&lt;p&gt;Candidates maintain profiles containing details such as their technical skills, experience, projects, preferred roles, and locations.&lt;/p&gt;

&lt;p&gt;They can browse available jobs and view the requirements for each position.&lt;/p&gt;

&lt;p&gt;For example, a job may require Java, SQL, Spring Boot, and REST APIs.&lt;/p&gt;

&lt;p&gt;The system compares these requirements with the candidate's profile and calculates a match percentage. Candidates can also see which skills they already have and which required skills are missing.&lt;/p&gt;

&lt;p&gt;If they are interested in the position, they can submit a referral request through the application.&lt;/p&gt;

&lt;p&gt;Employees have a dashboard where they can view incoming referral requests, candidate-job matching information, and the current status of each request.&lt;/p&gt;

&lt;p&gt;The basic workflow is simple. The more interesting problem is what happens when an employee needs information about a previous interaction with the same candidate.&lt;/p&gt;

&lt;p&gt;Why a Database Alone Wasn't Enough&lt;/p&gt;

&lt;p&gt;MySQL acts as the transactional database and stores structured application data such as users, candidate profiles, jobs, companies, and referral requests.&lt;/p&gt;

&lt;p&gt;This works well when the application needs to answer questions about the current state.&lt;/p&gt;

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

&lt;p&gt;"What is the candidate's current match percentage?"&lt;/p&gt;

&lt;p&gt;or:&lt;/p&gt;

&lt;p&gt;"What is the current status of this referral?"&lt;/p&gt;

&lt;p&gt;However, some questions require historical context:&lt;/p&gt;

&lt;p&gt;"Have this employee and candidate interacted before?"&lt;/p&gt;

&lt;p&gt;"What happened during their previous interaction?"&lt;/p&gt;

&lt;p&gt;Although these events could also be stored in a relational database, I wanted to introduce a dedicated memory layer that could retain contextual information and retrieve relevant memories when required.&lt;/p&gt;

&lt;p&gt;That is where Hindsight comes into the architecture.&lt;/p&gt;

&lt;p&gt;Adding Hindsight as a Memory Layer&lt;/p&gt;

&lt;p&gt;I integrated Hindsight with the Spring Boot backend as a separate memory service.&lt;/p&gt;

&lt;p&gt;The architecture keeps transactional information in MySQL while using Hindsight to store and retrieve contextual information.&lt;/p&gt;

&lt;p&gt;The two systems have different responsibilities. MySQL handles the current and structured application state, while Hindsight handles relevant historical context.&lt;/p&gt;

&lt;p&gt;I created a dedicated HindsightService in the backend to manage memory operations.&lt;/p&gt;

&lt;p&gt;The retention process stores relevant information in the appropriate memory scope, while the recall process searches for previously stored context based on a query.&lt;/p&gt;

&lt;p&gt;I also separated memory into different scopes, such as candidate, employee, and job context. This helps keep memories organized and makes retrieval more relevant.&lt;/p&gt;

&lt;p&gt;The Before and After&lt;/p&gt;

&lt;p&gt;The main difference becomes clear when comparing the referral workflow before and after introducing the memory layer.&lt;/p&gt;

&lt;p&gt;Before Memory&lt;/p&gt;

&lt;p&gt;Suppose an employee receives a referral request.&lt;/p&gt;

&lt;p&gt;The application can provide information such as:&lt;/p&gt;

&lt;p&gt;80% profile match&lt;br&gt;
Matched skills&lt;br&gt;
Missing skills&lt;br&gt;
Current referral status&lt;/p&gt;

&lt;p&gt;However, the application may not know whether the employee has previously interacted with that candidate.&lt;/p&gt;

&lt;p&gt;The employee would have to rely on their own memory or search through previous conversations.&lt;/p&gt;

&lt;p&gt;After Adding Memory&lt;/p&gt;

&lt;p&gt;Now suppose the candidate has previously interacted with the same employee.&lt;/p&gt;

&lt;p&gt;When the employee opens the referral request, the application can retrieve relevant information from Hindsight.&lt;/p&gt;

&lt;p&gt;The employee can therefore access useful context from the previous interaction instead of starting from the current referral request alone.&lt;/p&gt;

&lt;p&gt;This changes the type of questions the application can answer.&lt;/p&gt;

&lt;p&gt;Instead of only answering:&lt;/p&gt;

&lt;p&gt;"What is happening now?"&lt;/p&gt;

&lt;p&gt;it can also help answer:&lt;/p&gt;

&lt;p&gt;"What relevant information do we already have about this interaction?"&lt;/p&gt;

&lt;p&gt;That is where the memory layer becomes valuable.&lt;/p&gt;

&lt;p&gt;A Complete Referral Workflow&lt;/p&gt;

&lt;p&gt;A typical ReferralHub workflow looks like this:&lt;/p&gt;

&lt;p&gt;Discover Job&lt;br&gt;
↓&lt;br&gt;
Calculate Profile Match&lt;br&gt;
↓&lt;br&gt;
Request Referral&lt;br&gt;
↓&lt;br&gt;
Store Referral in MySQL&lt;br&gt;
↓&lt;br&gt;
Retain Relevant Context&lt;br&gt;
↓&lt;br&gt;
Employee Reviews Request&lt;br&gt;
↓&lt;br&gt;
Recall Previous Context&lt;br&gt;
↓&lt;br&gt;
Employee Makes Referral Decision&lt;/p&gt;

&lt;p&gt;The candidate first logs in and views their profile.&lt;/p&gt;

&lt;p&gt;They then select a job, and the system compares their skills with the job requirements.&lt;/p&gt;

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

&lt;p&gt;AI Match: 70%&lt;/p&gt;

&lt;p&gt;Matched:&lt;br&gt;
Java&lt;/p&gt;

&lt;p&gt;Missing:&lt;br&gt;
Spring Boot&lt;br&gt;
SQL&lt;/p&gt;

&lt;p&gt;If the candidate wants to proceed, they submit a referral request.&lt;/p&gt;

&lt;p&gt;The backend stores the referral information in MySQL and can also retain relevant contextual information through the Hindsight integration.&lt;/p&gt;

&lt;p&gt;The employee can then review the request, examine the candidate's match information, and retrieve relevant historical context when needed.&lt;/p&gt;

&lt;p&gt;Finally, the employee can decide whether to refer or decline the candidate.&lt;/p&gt;

&lt;p&gt;Why I Kept MySQL and Hindsight Separate&lt;/p&gt;

&lt;p&gt;One important architectural decision was to keep MySQL and Hindsight responsible for different types of information.&lt;/p&gt;

&lt;p&gt;I did not want Hindsight to replace the application's transactional database.&lt;/p&gt;

&lt;p&gt;For example, a referral request can have a well-defined status:&lt;/p&gt;

&lt;p&gt;PENDING&lt;br&gt;
REFERRED&lt;br&gt;
DECLINED&lt;/p&gt;

&lt;p&gt;This structured state belongs in MySQL.&lt;/p&gt;

&lt;p&gt;Memory is different.&lt;/p&gt;

&lt;p&gt;Information such as previous interactions, contextual details surrounding a decision, or information that may become useful later is better suited to a dedicated memory layer.&lt;/p&gt;

&lt;p&gt;Therefore, the architecture follows this separation:&lt;/p&gt;

&lt;p&gt;MySQL → Current and structured application state&lt;br&gt;
Hindsight → Historical and contextual memory&lt;/p&gt;

&lt;p&gt;This separation makes the responsibilities of each component easier to understand and maintain.&lt;/p&gt;

&lt;p&gt;What I Learned&lt;/p&gt;

&lt;p&gt;One of the biggest lessons from this project was that simply adding a memory system does not automatically make an application better.&lt;/p&gt;

&lt;p&gt;Memory is useful when it solves a real problem within the workflow.&lt;/p&gt;

&lt;p&gt;Referral systems are a good example because candidates and employees may interact multiple times, making historical context valuable.&lt;/p&gt;

&lt;p&gt;Another important lesson was the importance of memory scope.&lt;/p&gt;

&lt;p&gt;Candidate-related information, employee-related information, and job-related information may serve different purposes. Keeping these contexts separate can make memory retrieval more targeted.&lt;/p&gt;

&lt;p&gt;I also found that demonstrating a clear before-and-after experience makes the value of memory easier to understand.&lt;/p&gt;

&lt;p&gt;Instead of simply showing that a memory service has been integrated, it is more useful to demonstrate how the application behaves without historical context and how the experience changes when relevant context can be recalled.&lt;/p&gt;

&lt;p&gt;The main takeaway is:&lt;/p&gt;

&lt;p&gt;The purpose of memory is not simply to store more information. It is to make useful information available when it is needed.&lt;/p&gt;

&lt;p&gt;What's Next&lt;/p&gt;

&lt;p&gt;ReferralHub currently focuses on the core referral workflow: candidate profiles, job discovery, profile-job matching, referral requests, employee decisions, and contextual memory.&lt;/p&gt;

&lt;p&gt;There are several ways the system could be extended.&lt;/p&gt;

&lt;p&gt;For example, future versions could use repeated referral interactions to provide richer candidate context or help employees identify patterns across previous interactions.&lt;/p&gt;

&lt;p&gt;The central idea remains the same:&lt;/p&gt;

&lt;p&gt;A referral interaction shouldn't always have to start from scratch.&lt;/p&gt;

&lt;p&gt;By combining a transactional database with a persistent memory layer, ReferralHub can maintain both the current state of a referral and the context surrounding previous interactions.&lt;/p&gt;

&lt;p&gt;For me, the most interesting part of building the system was seeing how persistent memory can become useful when it actually changes what happens during the next interaction.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>software</category>
      <category>softwaredevelopment</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
