The hardest part about building an AI coach wasn't the prompt engineering, it was the memory architecture. Here is how I solved it.
Hey everyone,
I’ve been building a side project recently (a digital journal with an AI coach), and I quickly realized that standard LLM memory approaches kind of suck for long-term contexts.
If you just pass the last 20 conversations into the prompt, the context window gets bloated, and the AI eventually forgets the user's core personality traits anyway.
My solution:
Instead of passing raw text, I built a background process. While the user types in their journal, the AI secretly updates a structured JSON "psychological state" matrix. When the user actually chats with the AI, it only reads that clean, up-to-date JSON matrix.
It completely solved my "AI amnesia" problem and saved me a ton of tokens.
Has anyone else struggled with long-term AI memory? I’d love to know if there are better standard practices for this yet.
Posted Jul 30, 2026, 2:06 PM UTC