DEV Community

Deshaipeta Sujana
Deshaipeta Sujana

Posted on

ResearchLens: Building an AI Research Assistant That Learns Using Hindsight Memory

ResearchLens: Building an AI Research Assistant That Learns with Hindsight Memory

What if your AI research assistant could remember what you researched last week โ€” and use that knowledge to help you today?

Research is rarely a one-question activity.

A researcher may start by exploring a broad topic, discover a specific subfield, investigate several papers, compare methodologies, and eventually identify a new research direction.

Traditional AI assistants often treat these interactions as isolated conversations.

ResearchLens takes a different approach.

For the Hindsight hackathon, I extended ResearchLens with persistent memory using Hindsight, enabling the application to remember research interests and previous research activity and use that context during future interactions.

๐ŸŽฏ The Problem

Finding and understanding research literature can involve several repetitive steps:

Searching for relevant topics
Understanding research papers
Extracting methodologies and findings
Comparing different studies
Identifying research gaps
Deciding what to explore next

The bigger problem is that the researcher's context is often lost between interactions.

Imagine this workflow:

Day 1:
"I'm researching AI applications in healthcare."

Day 3:
"I'm particularly interested in medical imaging."

Day 7:
"What research direction should I explore next?"

A useful research assistant should understand that these questions are connected.

That's the problem ResearchLens aims to address.

๐Ÿ”ฌ Introducing ResearchLens

ResearchLens is an AI-powered research assistant designed to help users explore scientific literature more efficiently.

It provides capabilities such as:

AI-generated research briefs
Research paper analysis
Paper extraction and structured analysis
Paper-specific AI chat
Literature review generation
Research methodology analysis
Research findings and gap identification

For the hackathon, I added another capability:

Persistent research memory powered by Hindsight.

๐Ÿง  The Core Idea

Instead of treating every research query as completely independent, ResearchLens follows a continuous learning loop:

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  Research Query  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ†“
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Hindsight Recall โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ†“
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Existing Context โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ†“
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚    Gemini AI     โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ†“
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Research Brief   โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ†“
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Hindsight Retain โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ†“
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Future Memory    โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Enter fullscreen mode Exit fullscreen mode

This creates a simple but powerful loop:

Recall โ†’ Understand โ†’ Generate โ†’ Retain โ†’ Learn

๐Ÿ—๏ธ System Architecture
๐Ÿ“Œ


Caption:

Figure 1 โ€” ResearchLens architecture with Hindsight-powered memory

You can use this architecture diagram:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ USER โ”‚
โ”‚ Research Query / Question โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ResearchLens UI โ”‚
โ”‚ React + TypeScript โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”‚ HTTP API
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Node.js + Express โ”‚
โ”‚ Backend Server โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โ”‚
โ–ผ โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Hindsight โ”‚ โ”‚ Gemini AI โ”‚
โ”‚ Memory โ”‚ โ”‚ Research Engine โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚ โ”‚
โ”‚ RECALL โ”‚
โ”‚ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Personalized โ”‚
โ”‚ Research Brief โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Hindsight RETAIN โ”‚
โ”‚ Store new memory โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
๐Ÿ”„ How Hindsight Is Used

The Hindsight integration has two main stages.

  1. RECALL โ€” Remember Before Answering

Before ResearchLens generates a research brief, the backend sends a contextual query to Hindsight.

For example:

"ResearchLens user's previous research interests, topics, preferences, and research history related to AI healthcare."

Hindsight returns relevant memories.

These memories are then included in the Gemini prompt.

Conceptually:

User Query
โ†“
Hindsight RECALL
โ†“
Relevant Memories
โ†“
Gemini Prompt
โ†“
Personalized Research Brief

This means the AI can take previous research activity into account rather than starting from zero.

  1. RETAIN โ€” Remember After Answering

After ResearchLens generates a research brief, the current research topic is retained in Hindsight.

For example:

ResearchLens user research history:

The user researched the topic
"AI applications in healthcare".

This indicates an interest in
"AI applications in healthcare"
and should be remembered for future
research assistance.

The memory is stored in the:

researchlens

Hindsight memory bank.

This creates the continuous learning cycle:

     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚ User Query  โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
            โ†“
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚  RECALL   โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
            โ†“
   Previous Research
       Context
            โ†“
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚ Gemini AI โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
            โ†“
      AI Response
            โ†“
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚  RETAIN   โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
            โ†“
    New Research Memory
Enter fullscreen mode Exit fullscreen mode

๐Ÿ’ป Implementation

ResearchLens uses the Hindsight TypeScript client on the backend.

The client is initialized using environment variables:

HINDSIGHT_BASE_URL
HINDSIGHT_API_KEY
HINDSIGHT_BANK_ID

The Hindsight SDK is kept on the server side, so the API key is never exposed to the browser.

The application contains two helper functions:

recallResearchMemory()
retainResearchMemory()

The recall function retrieves relevant previous memories.

The retain function stores new research activity.

This keeps the memory functionality separated from the rest of the ResearchLens application.

๐Ÿ“ธ ResearchLens Interface
๐Ÿ“Œ

Your ResearchLens main/home/research dashboard.

Caption:

Figure 2 โ€” ResearchLens research workspace

The ResearchLens interface provides a central workspace for exploring research topics, generating research briefs, analyzing papers, and working with scientific literature.

๐Ÿ”Ž Generating a Research Brief
๐Ÿ“Œ

ResearchLens after entering:

AI applications in healthcare

and displaying the generated research brief.

Caption:

Figure 3 โ€” AI-generated research brief

The research brief provides a structured overview of the selected topic, including key findings, methodologies, research questions, and other relevant research information.

๐Ÿง  Demonstrating Hindsight Memory

This is the most important screenshot in the article because it demonstrates the hackathon requirement.

๐Ÿ“Œ

Open:

https://researchlens-0aj1.onrender.com/api/hindsight/test

after you have performed a research search.

Capture the response showing:

{
"success": true,
"bankId": "researchlens",
"memoriesFound": 1,
"memories": [...]
}

Caption:

โ€” Hindsight successfully recalling ResearchLens research memory

Then explain:

After the user performs research, ResearchLens stores the research activity using Hindsight. The memory can subsequently be recalled through the Hindsight API and used as contextual information for future research interactions.

๐Ÿ” The Learning Experience

The most important part of the project is not simply storing a piece of text.

It is demonstrating that memory becomes useful in later interactions.

Consider the following workflow:

Interaction 1
User:
AI applications in healthcare

ResearchLens generates a research brief.

Hindsight remembers:

User is interested in AI applications in healthcare.
Interaction 2

Later, the user explores:

Medical imaging research directions

ResearchLens can recall the previous healthcare-AI interest and use it as contextual information.

Interaction 3

The user asks:

What research area should I explore next?

Now the system has accumulated research context from previous interactions.

The goal is to move from:

AI that answers questions

to:

AI that understands an ongoing research journey.

โš™๏ธ Technology Stack
Layer Technology
Frontend React
Language TypeScript
Build Tool Vite
Backend Node.js
API Framework Express.js
AI Google Gemini
Memory Hindsight
Memory SDK @vectorize-io/hindsight-client
Deployment Render
๐Ÿ” Security Considerations

API credentials are kept on the backend using environment variables.

The following secrets are not committed to GitHub:

GEMINI_API_KEY
HINDSIGHT_API_KEY

Only .env.example containing empty placeholders is included in the repository.

This allows the project to be deployed without exposing private credentials.

๐Ÿš€ Why Hindsight Matters in ResearchLens

The interesting part of the project is not simply adding a database or storing previous questions.

The memory layer enables a different interaction model.

Without persistent memory
Query โ†’ Answer
With persistent memory
Query
โ†“
Recall previous context
โ†“
Generate personalized answer
โ†“
Learn from current interaction
โ†“
Store memory
โ†“
Future query becomes more contextual

This makes memory an active part of the AI workflow rather than a passive storage layer.

๐Ÿ“Š From One-Time Assistant to Long-Term Research Companion

ResearchLens can be viewed as a progression:

Traditional Search
โ†“
AI Research Assistant
โ†“
Context-Aware Assistant
โ†“
Memory-Enabled Assistant
โ†“
Long-Term Research Companion

The Hindsight integration is what enables ResearchLens to move toward the final stage.

๐Ÿงช What I Learned

The biggest lesson from building this project was that memory design is as important as prompt design.

When building a memory-enabled AI system, three questions become important:

What should the agent remember?

ResearchLens currently remembers research topics and research interests.

When should it recall?

Relevant memories are recalled before generating a new research brief.

When should it learn?

After completing a research interaction, new research activity is retained.

This creates a continuous memory lifecycle:

Remember โ†’ Recall โ†’ Reason โ†’ Respond โ†’ Retain

๐Ÿ”ฎ Future Improvements

The current implementation focuses on the core hackathon requirement while keeping the existing ResearchLens application intact.

Future versions could include:

๐Ÿ‘ค User-specific memory

Instead of a shared demo memory bank, each user could have an isolated memory space.

๐Ÿ‘ Explicit feedback

Users could tell ResearchLens whether a paper or recommendation was useful.

That feedback could become another memory signal.

๐Ÿ“š Research profiles

The system could gradually build a structured profile containing:

Research interests
Frequently explored topics
Preferred methodologies
Favorite research domains
Previously analyzed papers
๐Ÿงญ Research journey tracking

ResearchLens could visualize how a user's interests evolve over time.

๐Ÿค– Personalized recommendations

The accumulated research memory could be used to recommend:

Related papers
New research areas
Research gaps
Potential project ideas
๐ŸŒ Project
Live Demo

ResearchLens:
https://researchlens-0aj1.onrender.com

Source Code

GitHub:
YOUR_GITHUB_REPOSITORY_LINK

Hackathon

AI Agents That Learn Using Hindsight

๐ŸŽฅ Demo
๐Ÿ“Œ PLACE VIDEO / DEMO LINK HERE

For the final article, you can embed your YouTube demo here.

Your demo should show:

  1. Open ResearchLens โ†“
  2. Search "AI applications in healthcare" โ†“
  3. Generate research brief โ†“
  4. Show Hindsight memory โ†“
  5. Perform another related interaction โ†“
  6. Show that previous context is recalled

The important thing is to show the memory changing the interaction, rather than spending most of the video explaining the UI.

๐Ÿ Conclusion

ResearchLens began as an AI-powered research assistant designed to make scientific literature exploration faster and more structured.

With Hindsight, it gains another important capability:

It can remember the research journey.

Instead of treating every interaction as an isolated request, ResearchLens can recall previous research interests and retain new information for future interactions.

The project demonstrates how persistent memory can turn an AI application from a simple question-answering system into a more continuous and personalized research companion.

ResearchLens doesn't just help you research.

It remembers what you research.

๐Ÿ“Œ Exact screenshots you should capture

You don't need 10โ€“15 screenshots. Five good screenshots are enough.

Screenshot Where to place it

1 Architecture diagram After System Architecture
2 ResearchLens main interface After ResearchLens Interface
3 Generated research brief After Generating a Research Brief
4 /api/hindsight/test showing memory After Demonstrating Hindsight Memory
5 Second interaction showing personalized/contextual response After The Learning Experience
Most important screenshot

It should show something like:

{
"success": true,
"bankId": "researchlens",
"memoriesFound": 1,
"memories": [
{
"type": "...",
"text": "The user researched the topic..."
}
]
}

Top comments (0)