Skip to content

Example implementations of Claude's Memory Tool API - Next.js web app and Python CLI for building applications with persistent memory

License

Notifications You must be signed in to change notification settings

Evenss/claude-memory-tools

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Memory Tools

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

What's Inside

This repository contains two complete implementations of a fitness tracking application using Claude's Memory Tool:

🌐 Next.js Implementation (/nextjs)

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

View Next.js README β†’

🐍 Python Implementation (/python)

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

View Python README β†’

About the Memory Tool

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.

Quick Start

Next.js Web App

cd nextjs
npm install
npm run dev

Open http://localhost:3000 and add your Anthropic API key to start chatting.

Full Next.js setup guide β†’

Python CLI

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.py

Full Python setup guide β†’


Both implementations use the same system prompt and memory structure, demonstrating the flexibility of the Memory Tool API.

Project Structure

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

Learn More

License

MIT

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

Author

Built by Shlok Khemani | @shloked_

About

Example implementations of Claude's Memory Tool API - Next.js web app and Python CLI for building applications with persistent memory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 66.6%
  • Python 31.7%
  • CSS 1.5%
  • JavaScript 0.2%