Example implementations of Claude's Memory Tool API for building applications with persistent memory.
This repository demonstrates how to build memory-enabled applications with Claude using file-based storage. It includes two complete implementations: a browser-based Next.js app and a Python CLI.
Read the accompanying blog post: Anthropic's Opinionated Memory Bet
This repository contains two complete implementations of a fitness tracking application using Claude's Memory Tool:
A full-featured, IDE-style web application built with Next.js 15 and TypeScript. Features a chat interface, memory file viewer, and settings panel. Runs entirely in the browser with BYOK (Bring Your Own Key).
Key Features:
- Browser-based with IndexedDB storage
- No server required
- IDE-style interface with file navigation
- Real-time memory file viewing
- Dark/light mode support
A command-line application demonstrating Memory Tool usage in Python. Stores memories as XML files locally and includes context management for long conversations.
Key Features:
- Local filesystem storage
- CLI commands for memory inspection
- Automatic context management
- Customizable system prompts
Anthropic's Memory Tool provides a native way for Claude to maintain persistent memory across conversations. Instead of using vector databases or RAG systems, Claude manages memories as files using six fundamental operations: view, create, str_replace, insert, delete, and rename.
The model is specifically trained on these operations, giving it sophisticated understanding of when and how to store information, what's worth remembering, and how to organize memories over time.
cd nextjs
npm install
npm run devOpen http://localhost:3000 and add your Anthropic API key to start chatting.
cd python
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
export ANTHROPIC_API_KEY='your-key-here'
python main.pyBoth implementations use the same system prompt and memory structure, demonstrating the flexibility of the Memory Tool API.
claude-memory-tools/
βββ nextjs/ # Next.js web application
β βββ src/
β β βββ components/ # React components
β β βββ hooks/ # Custom hooks (memory store)
β β βββ types/ # TypeScript types
β βββ system_prompt.txt
βββ python/ # Python CLI application
βββ main.py # Main script
βββ memory/ # XML memory storage
βββ system_prompt.txt
MIT
Contributions are welcome! Feel free to open issues or submit pull requests.
Built by Shlok Khemani | @shloked_