๐ง Claude AI Updates and FeaturesMarch 11, 2026โ
Tests passing
Claude Memory Manager
A tool to interact with Claude AI's memory feature by storing, retrieving, and managing contextual information for better AI responses. Developers can use this to maintain long-term context across conversations or tasks, making it easier to handle complex workflows.
What It Does
- Save memory data to Claude AI using JSON or YAML files.
- Retrieve memory data from Claude AI.
- Delete specific memory entries from Claude AI.
Installation
- Python 3.7+
requestslibrarypyyamllibrary
Install the required libraries using:
pip install requests pyyamlUsage
Run the script with the following options:
Save Memory
python claude_memory_manager.py --api-url <API_URL> --api-key <API_KEY> --save <FILE_PATH><API_URL>: The base URL of the Claude AI API.<API_KEY>: Your Claude AI API key.<FILE_PATH>: Path to the JSON or YAML file containing memory data to save.
Retrieve Memory
python claude_memory_manager.py --api-url <API_URL> --api-key <API_KEY> --retrieve [--output <OUTPUT_FILE>]<OUTPUT_FILE>(optional): Path to save the retrieved memory data as a JSON file.
Delete Memory
python claude_memory_manager.py --api-url <API_URL> --api-key <API_KEY> --delete <MEMORY_ID><MEMORY_ID>: The ID of the memory entry to delete.
Source Code
import argparse
import json
import yaml
import os
import requests
def save_memory(api_url, api_key, memory_data):
"""Saves memory data to Claude AI."""
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
try:
response = requests.post(f"{api_url}/memory", headers=headers, json=memory_data)
response.raise_for_status()
return response.json()
except requests.RequestException as e:
raise RuntimeError(f"Failed to save memory: {e}")
def retrieve_memory(api_url, api_key):
"""Retrieves memory data from Claude AI."""
headers = {"Authorization": f"Bearer {api_key}"}
try:
response = requests.get(f"{api_url}/memory", headers=headers)
response.raise_for_status()
return response.json()
except requests.RequestException as e:
raise RuntimeError(f"Failed to retrieve memory: {e}")
def delete_memory(api_url, api_key, memory_id):
"""Deletes a specific memory entry from Claude AI."""
headers = {"Authorization": f"Bearer {api_key}"}
try:
response = requests.delete(f"{api_url}/memory/{memory_id}", headers=headers)
response.raise_for_status()
return response.json()
except requests.RequestException as e:
raise RuntimeError(f"Failed to delete memory: {e}")
def load_data(file_path):
"""Loads data from a JSON or YAML file."""
if not os.path.exists(file_path):
raise FileNotFoundError(f"File not found: {file_path}")
with open(file_path, 'r') as file:
if file_path.endswith('.json'):
return json.load(file)
elif file_path.endswith('.yaml') or file_path.endswith('.yml'):
return yaml.safe_load(file)
else:
raise ValueError("Unsupported file format. Use JSON or YAML.")
def main():
parser = argparse.ArgumentParser(description="Claude Memory Manager")
parser.add_argument("--api-url", required=True, help="Claude AI API URL")
parser.add_argument("--api-key", required=True, help="Claude AI API Key")
parser.add_argument("--save", help="Path to JSON or YAML file to save memory data")
parser.add_argument("--retrieve", action="store_true", help="Retrieve memory data")
parser.add_argument("--delete", help="ID of the memory entry to delete")
parser.add_argument("--output", help="Path to save retrieved memory data (optional)")
args = parser.parse_args()
try:
if args.save:
memory_data = load_data(args.save)
result = save_memory(args.api_url, args.api_key, memory_data)
print("Memory saved successfully:", result)
elif args.retrieve:
result = retrieve_memory(args.api_url, args.api_key)
if args.output:
with open(args.output, 'w') as file:
json.dump(result, file, indent=4)
print(f"Memory retrieved and saved to {args.output}")
else:
print("Retrieved memory:", json.dumps(result, indent=4))
elif args.delete:
result = delete_memory(args.api_url, args.api_key, args.delete)
print("Memory deleted successfully:", result)
else:
parser.print_help()
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
main()Community
Downloads
ยทยทยท
Rate this tool
No ratings yet โ be the first!
Details
- Tool Name
- claude_memory_manager
- Category
- Claude AI Updates and Features
- Generated
- March 11, 2026
- Tests
- Passing โ
- Fix Loops
- 4
Quick Install
Clone just this tool:
git clone --depth 1 --filter=blob:none --sparse \ https://github.com/ptulin/autoaiforge.git cd autoaiforge git sparse-checkout set generated_tools/2026-03-11/claude_memory_manager cd generated_tools/2026-03-11/claude_memory_manager pip install -r requirements.txt 2>/dev/null || true python claude_memory_manager.py