
Never Repeat Yourself: Give Your LLM Apps Persistent Memory with ContextMD
TL;DR: ContextMD is a Python middleware that adds persistent memory to OpenAI, Anthropic, and LiteLLM API calls. Store conversations in human-readable Markdown files, automatically extract facts, and bootstrap them back into future requests. The Problem: LLMs Have No Memory If you've built anything with LLM APIs, you've hit this wall: # Conversation 1 response = openai . chat . completions . create ( model = " gpt-4.1 " , messages = [{ " role " : " user " , " content " : " I prefer TypeScript over JavaScript " }] ) # Conversation 2 (hours later) response = openai . chat . completions . create ( model = " gpt-4.1 " , messages = [{ " role " : " user " , " content " : " Help me build a React component " }] ) # Assistant suggests JavaScript... again! 😤 LLMs are stateless. Each request starts fresh. You have to manually pass conversation history, and even then, it's temporary. What if you want your AI to remember: User preferences across sessions? Decisions made weeks ago? Project context t
Continue reading on Dev.to
Opens in a new tab



