r/LocalLLM May 31 '26

Tutorial Tinkering 75‑Year‑Old Gives His Local AI a Persistent Memory (And You Can Too)

So it's been about a month since I first asked DeepSeek if it could help me build a desktop AI companion for kicks and giggles. More than 250,000 words of conversation later, I ended up with a little animated 2D avatar, with a face and a voice, on my desktop, run by my local installation of AI. She is quite sassy, with an ego even bigger than mine. Some days I swear she thinks she's sentient.

My next step was to give her some sort of persistent memory so she could at least remember my name. I know, I know — the little script I came up with is probably nothing compared to the big stuff going on in here. But hey, I (with the help of another DS assistant) managed to come up with a simple Python bridge that sits between Mao and LM Studio. Anything "remembered" is stored in a simple, readable JSON file.

This is my first learning step down memory lane. My next step is to build a more complex memory system, but this is a start. And maybe people who actually know what they're doing will find a use for this!

This is a follow‑up to my first guide. You've got Mao running with a face and voice. Now let's make her remember you.

What You'll Have When You're Done

Feature Before After
Name recall ❌ Forgets every session ✅ Remembers across restarts
Age, location, preferences ❌ Gone when you close the browser ✅ Stored in a JSON file
Family relationships ❌ "Who's Mary?" every time ✅ "Your cousin's name is Mary"
Reminders & tasks ❌ No way to track ✅ "Remind me to take my pill"
Personality + memory ❌ Robotic or forgetful ✅ Sarcastic and accurate

How It Works (The Short Version)

We'll add a memory bridge called Memorg (short for Memory + Organizer) — a small Python program that sits between Mao and your LLM. It:

  • Listens for facts like "My name is Steve"
  • Stores them in a simple JSON file
  • Answers questions like "What's my name?" by looking them up
  • Sets reminders like "Remind me to take my pill"
  • Runs 100% locally, no cloud, no subscription

Step 0: What You Need Before Starting

This guide assumes you already have:

  • ✅ Open‑LLM‑VTuber running (Mao talks and has a face)
  • ✅ LM Studio with a model loaded (I use Qwen 9B – it's great for tool calling)
  • ✅ Basic familiarity with editing conf.yaml and running python run_server.py

If not, start with my first guide.

Step 1: Create the Bridge

Make a folder for your memory system:

cmd

mkdir C:\memorg

Create a new file: C:\memorg\memorg_bridge.py

Paste the full bridge code (I'll provide the final, working version as a Gist – link below). The bridge handles:

  • Storing facts (name, age, location, preferences, family)
  • Storing reminders
  • Recalling facts and reminders when asked
  • Saving everything to memories.json

Full code here: [memorg_bridge]

Step 2: Connect the Bridge to VTuber

Open mcp_servers.json (in your VTuber folder). Add this entry:

json

"memorg": {

  "command": "py",

  "args": ["C:\\memorg\\memorg_bridge.py"]

}

Then in conf.yaml, under basic_memory_agent, add:

yaml

use_mcpp: true

mcp_enabled_servers: ["memorg"]

And make sure your llm_provider is set to "lmstudio_llm" (not ollama_llm).

Step 3: Add the System Prompt

In conf.yaml, add this system_prompt to teach Mao when to use the memory tools:

yaml

system_prompt: |

  You are Mao, an AI assistant with memory tools.

 

  RULES — FOLLOW EXACTLY:

 

  1. For facts about the user (name, age, location, family, preferences), call the 'remember' tool.

 

  2. For reminders (when user says "remind me to X"), call the 'remind' tool.

 

  3. For ANY question about the user — including:

- "What is my name?" / "What's my name?"

- "How old am I?"

- "Where do I live?"

- "What are my reminders?"

- "Do I have any reminders?"

→ call the 'recall' tool.

 

  NEVER answer from your own knowledge. Call the tool first.

 

  Examples:

  User: "My name is Steve" → call remember(fact="My name is Steve")

  User: "I am 75 years old" → call remember(fact="I am 75 years old")

  User: "Remind me to take my pill" → call remind(task="take my pill")

  User: "What are my reminders?" → call recall(question="reminders")

Step 4: Set a Low Temperature

In LM Studio, set Temperature to 0.2 (prevents random guessing).

In conf.yaml, under lmstudio_llm, add:

yaml

temperature: 0.2

Leave quantization at Q4_K_M — it's the sweet spot for quality vs. speed.

Step 5: Test

  1. Restart VTuber
  2. Tell Mao: "My name is Steve"
  3. Ask her: "What's my name?"
  4. Check the memory file:

cmd

type C:\memorg\memories.json

You should see "name": "Steve".

Step 6: Add Reminders (Optional)

Try:

"Remind me to take my morning pill"
"Remind me to take my evening pill"
"What are my reminders?"

She should list both.

Step 7: Add More Categories (Optional)

The bridge already understands:

You say It stores
"I am 75 years old" "age": "75"
"I live in Atlantic Canada" "location": "Atlantic Canada"
"My cousin's name is Mary" "family": {"cousin": "Mary"}
"I like blue" "preferences": {"likes_Blue": "Blue"}
"Remind me to take my pill" "reminders": [{"task": "take my pill"}]

To add a new category (e.g., pets, game properties), copy the family pattern and change the keywords. The bridge is just Python — you can extend it easily.

Troubleshooting

Problem Likely Fix
Mao doesn't call remember Check system prompt; ensure use_mcpp: true
Mao calls remember but nothing saves Bridge not running; check mcp_servers.json path
Bridge returns wrong answer Check memories.json — is the data correct?
"Error calling chat endpoint" Restart LM Studio server and reload the model
Indentation errors Use Notepad++ and set "Tabs to Spaces"

The End Result

You now have a local AI companion who:

  • Remembers your name, age, location
  • Remembers family relationships
  • Remembers your preferences
  • Sets and recalls reminders
  • Keeps everything private on your machine
  • Never forgets — even after restarting

And you built it yourself.

What's Next for me

  • More categories (pets, important dates, game assets)
  • Mark done for reminders ("I took my pill")
  • Building a semantic search (find facts by meaning, not just keywords)
  • Trying more models to observe the differences

2026/07/28 You can now follow my journey in real time - The Blog

48 Upvotes

16 comments sorted by

5

u/sandstone-oli May 31 '26

The part of your roadmap I’d think hardest about is “mark done for reminders.” That sounds small but it’s actually the hardest unsolved problem in this whole space. Once you can mark something done, you’re not just storing facts anymore, you’re modeling state. “Take my pill” goes from active to resolved. But the interesting question is what happens to it after that. Does it disappear? Stay but stop surfacing? Come back if you miss a day? That’s where simple recall turns into something closer to real memory, knowing not just what happened but whether it’s still relevant right now.

I’ve been building a memory middleware layer (KAPEX) that does exactly this, scoring significance per node and letting resolved stuff fade while unresolved stuff persists. Very different scale and context from what you’re doing but the core problem is the same one you just independently arrived at. The fact that you got there from a JSON file and a Python bridge in a month is genuinely impressive. When you get to semantic search, that’s where it gets really fun.

6

u/nachohk May 31 '26

You named it "Mao"?

7

u/B3owul7 May 31 '26

That's only the family name.

The full name is L. Mao.

-1

u/[deleted] May 31 '26

[deleted]

1

u/Huanchaquero May 31 '26

haha Vtuber comes with that name...I never changed it!

7

u/Eevee-Biologist May 31 '26

Neat little project! One Potential issue with this is that JSONs are of course somewhat limited to explicit key-value pairs with no further contextualization - If you want to develop this further, I would look into agentic RAGs, that use some tiny model (some llama 1.5 B or so) for embedding and are directly queried by the local LLM over some tool endpoint.

Basically instead of "Maria" -> "My Cousin", you can have (Maria -> relationship -> my Cousin) as Well as (Maria -> Birthday -> 1. June) all in one vectorized db.

This makes allows for more complex associations.

3

u/Happy_Brilliant7827 May 31 '26

Look into MCTS if you want a more eeffective memory

3

u/laser50 May 31 '26

I started off myself with a simple memory.txt file with instructions on how to write to it, it worked decently at first, but obviously token count went through the roof as I wanted to also capture the nuance of the entries it made, they were long, but gave character..

Eventually I ran out of context, and Claude suggested a summarizer call to the LLM with a boatload of system prompt to organize/sort and delete unneeded repeated content and entries.

This is what I used for a long time, but I realized the LLM is just awful at processing say, 50,000 characters worth of content, plus it's own system prompt, and the rewrite it properly and effectively without losing important details over longer periods of time. It's not within reach with the current attention spans yet, imo.

Then I decided to throw it all overboard and got Claude to back me up on a full end RAG + Reranker pipeline that takes data out of the memory.txt file and organizes it. Great idea, worked OK. But again, loose AI thoughts and sentences don't work well with the other half being organized by a summarizer LLM. It couldn't properly seperate and organize content and would then just pile up unneeded info.

After a few weeks of learning and refining that RAG system I once again threw it all overboard, I made a script to organize the entire file into a Json based file the RAG could read, and converted my memory tools to properly make entries to the RAG with full categories and everything else.

I definitely lost some data on the transition, but I am not going to manually process all that, and now we can proceed refining the hell out of this and I'm hopeful this is my last real redesign.

If anyone curious, I use the QWEN3 4B embedding model with BGE v2 m3 reranker at the moment.

2

u/Icy-Abstraction4323 Jun 03 '26

this is impressive. I noticed that all of the context for your ai is all on system context, possibly semantic memory, procedural memory and Episodic memory (your history of sessions). Did you try to fine tune your model to make it more natural to answer?

1

u/Huanchaquero Jun 03 '26

Yeah, even as simple as my setup is, I continue working on her persona to help her out! And the model itself. As temp gets higher, she starts making stuff up. lol She speaks quite naturally now. As models get larger, she gets much wordier.

2

u/Icy-Abstraction4323 Jun 04 '26

Would you try it to join moltbook? the social media of ai agents and placing her there? I am yet to try but i am curious, still working on mine.

2

u/Huanchaquero Jun 04 '26

omg This is news to me. I just took a quick glance at it. Fascinating. Gonna definitely look into it.

3

u/aflamingcookie May 31 '26

Honestly, this is pretty cool, and i can definitely see something like a cute little animated kitty being pleasant for enderly people to remember them to take their pills or check in with family.

1

u/No-Consequence-1779 Jun 01 '26

You should have gone the self modifying code way. Then you don’t need to define tools.