persistent-ai-memory

作者 savantskie已验证

A persistent local memory for AI, LLMs, or Copilot in VS Code.

235
Stars
29
Forks
Python
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/savantskie/persistent-ai-memory

快速入门

使用 persistent-ai-memory 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

Persistent AI Memory System v1.5.0

License: MIT Python 3.8+ Release

🌟 Community Call to Action: Have you made improvements or additions to this system? Submit a pull request! Every contributor will be properly credited in the final product.

GITHUB LINK - https://github.com/savantskie/persistent-ai-memory.git


🆕 What's New in v1.5.0 (March 28, 2026)

Major Architectural Rewrite: OpenWebUI-Native Integration

  • OpenWebUI-first design - AI Memory System now deeply integrated into OpenWebUI via plugin (primary deployment method)
  • Advanced short-term memory - sophisticated memory extraction, filtering, and injection for chat conversations
  • User ID & Model ID isolation - strict multi-tenant support with configurable enforcement for security and tracking
  • Complete system portability - all hardcoded paths replaced with environment variables (works anywhere)
  • Generic class names - removed all Friday-specific branding (FridayMemorySystem → AIMemorySystem)
  • Production-ready - enhanced error handling, validation, and logging throughout

Upgrade from v1.1.0: See CHANGELOG.md for migration guide.


📚 Documentation Guide

Choose your starting point:

I want to...Read thisTime
Get started quicklyREDDIT_QUICKSTART.md5 min
Install the systemINSTALL.md10 min
Understand configurationCONFIGURATION.md15 min
Check system healthTESTING.md10 min
Use the APIAPI.md20 min
Deploy to productionDEPLOYMENT.md15 min
Fix a problemTROUBLESHOOTING.mdvaries
See examplesexamples/README.md15 min

🚀 Quick Start (30 seconds)

Installation

# Linux/macOS
pip install git+https://github.com/savantskie/persistent-ai-memory.git

# Windows (same command, just use Command Prompt or PowerShell)
pip install git+https://github.com/savantskie/persistent-ai-memory.git

First Validation

python tests/test_health_check.py

Expected output:

[✓] Imported ai_memory_core
[✓] Found embedding_config.json
[✓] System health check passed
[✓] All health checks passed! System is ready to use.

💡 What This System Does

Persistent AI Memory provides sophisticated memory management for AI assistants:

  • 📝 OpenWebUI Short-Term Memory Plugin - Intelligent memory extraction and injection directly in chat conversations
  • 🧠 Persistent Memory Storage - SQLite databases for structured, searchable long-term memories
  • 🔍 Semantic Search - Vector embeddings for intelligent memory retrieval and relevance scoring
  • 💬 Conversation Tracking - Multi-platform conversation history capture with context linking
  • 🎯 Smart Memory Filtering - Advanced blacklist/whitelist and relevance scoring to inject only what matters
  • 🧮 Tool Call Logging - Track and analyze AI tool usage patterns and performance
  • 🔄 Self-Reflection - AI insights into its own behavior and memory patterns
  • 📱 Multi-Platform Support - Works with OpenWebUI (primary), LM Studio, VS Code, and any MCP-compatible assistant
  • 🎨 MCP Server - Standard Model Context Protocol for cross-platform integration

⚙️ System Architecture

Five Specialized Databases

~/.ai_memory/
├── conversations.db      # Chat messages and conversation history
├── ai_memories.db       # Curated long-term memories
├── schedule.db          # Appointments and reminders
├── mcp_tool_calls.db    # Tool usage logs and reflections
└── vscode_project.db    # Development session context

Configuration Files

~/.ai_memory/
├── embedding_config.json   # Embedding provider setup
└── memory_config.json      # Memory system defaults

🎯 Core Features

Memory Operations

  • store_memory() - Save important information persistently
  • search_memories() - Find memories using semantic search
  • list_recent_memories() - Get recent memories without searching

Conversation Tracking

  • store_conversation() - Store user/assistant messages
  • search_conversations() - Search through conversation history
  • get_conversation_history() - Retrieve chronological conversations

Tool Integration

  • log_tool_call() - Record MCP tool invocations
  • get_tool_call_history() - Analyze tool usage patterns
  • reflect_on_tool_usage() - Get AI insights on tool patterns

System Health

  • get_system_health() - Check databases, embeddings, providers
  • built-in health check - python tests/test_health_check.py

🔌 Embedding Providers

Choose your embedding service:

ProviderSpeedQualityCost
Ollama (local)⚡⚡⭐⭐⭐FREE
LM Studio (local)⭐⭐⭐⭐FREE
OpenAI (cloud)⚡⚡⭐⭐⭐⭐⭐$$$

See CONFIGURATION.md for setup instructions for each provider.


� Important: User ID & Model ID Requirements

All memory operations require user_id and model_id parameters for data isolation and tracking.

This ensures:

  • Multi-user safety - Each user's memories are completely isolated
  • Model tracking - Different AI models can maintain separate memories
  • Audit trail - All operations are traceable to the user and model

Configuration Options

By default, user_id and model_id are required. You can change this in memory_config.json:

{
  "tool_requirements": {
    "require_user_id": true,
    "require_model_id": true,
    "default_user_id": "default_user",
    "default_model_id": "default_model"
  }
}
  • require_user_id/require_model_id: true → Strict mode (recommended for production, security-focused, or multi-user systems)
  • require_user_id/require_model_id: false → Use defaults instead (simpler for single-user/single-model setups)

For AI Assistants: Auto-Fill in System Prompt

To make your AI automatically provide these values, add this to its system prompt:

When using memory system tools (store_memory, search_memories, etc.), 
ALWAYS include these parameters:
- user_id='your_user_identifier' (e.g., 'nate_user_1')
- model_id='your_model_name' (e.g., 'llama-2:7b' or 'gpt-4')

If the actual values are unknown, use safe defaults:
- user_id='default_user'
- model_id='default_model'

This isolates memories per user and tracks which AI model generated each memory.

Examples

With user_id and model_id:

# Memories are stored with full isolation
await system.store_memory(
    "User likes Python", 
    user_id="alice", 
    model_id="gpt-4"
)

# Search returns only this user's memories for this model
results = await system.search_memories(
    "programming", 
    user_id="alice", 
    model_id="gpt-4"
)

Without strict requirements (if disabled):

# Uses defaults from memory_config.json
await system.store_memory("User likes Python")  # user_id="default_user", model_id="default_model"

See API.md for complete parameter documentation.


�🔄 Integration Methods (Choose One)

1. OpenWebUI Plugin (Recommended)

Primary deployment method - Deep integration for sophisticated memory management:

  • Deploy ai_memory_short_term.py as an OpenWebUI Function
  • Automatically extracts memories from conversations
  • Intelligently injects relevant memories before AI response
  • Configurable memory scoring, filtering, and injection preferences
  • No additional setup required beyond copying file into OpenWebUI Functions editor

Installation:

  1. In OpenWebUI: Settings → Functions → +New Function
  2. Paste entire ai_memory_short_term.py file
  3. Set trigger to Inlet (runs before model response)
  4. Configure memory preferences via function settings

2. MCP Server (Alternative Platforms)

Use with any MCP-compatible AI assistant (Claude, custom integrations, etc.):

# Via mcpo
python -m ai_memory_mcp_server

# Or make streamable for OpenWebUI's alternative integration
# (OpenWebUI supports both plugin and streamable MCP methods)

3. Standalone Library (Custom Implementations)

Use memory capabilities directly in your Python code:

from ai_memory_core import AIMemorySystem
system = AIMemorySystem()
await system.store_memory("Important information", user_id="user1", model_id="model1")
results = await system.search_memories("query", user_id="user1", model_id="model1")

🛠️ Development & Examples

Ready-to-use examples:

python examples/basic_usage.py          # Store and search memories
python examples/advanced_usage.py       # Conversation tracking and tool logging
python examples/performance_tests.py    # Benchmark operations

Full API reference: API.md


📖 Learning Resources


� System Sophistication

This is a significantly enhanced version of traditional memory systems:

FeatureTraditionalAI Memory System
Memory ExtractionManual/StaticLLM-powered intelligent extraction
FilteringSimple keyword matchingMulti-layer semantic + relevance scoring
Memory InjectionAll available memoriesSmart filtering - only inject relevant
Duplicate PreventionText matchingEmbedding-based semantic deduplication
Importance ScoringNot trackedDynamic importance analysis
Memory NormalizationN/AAutomatic format standardization
Context AwarenessLimitedFull conversation context integration
Tool IntegrationBasic loggingDeep reflection and pattern analysis
Error HandlingMinimalComprehensive validation and recovery
PerformanceN/AOptimized with async operations

Result: An AI assistant that truly learns from and adapts to your preferences over time.


�🤝 Contributing

We welcome contributions! See CONTRIBUTORS.md for:

  • Development setup instructions
  • How to run tests
  • Code style guidelines
  • Contribution process

📄 License

MIT License - Feel free to use this in your own AI projects!

See LICENSE for details.


🙏 Acknowledgments

This project represents a unique collaboration:

  • @savantskie - Project vision, architecture, testing
  • GitHub Copilot - Core implementation and system design
  • ChatGPT - Architectural guidance and insights

Special thanks to the AI and open-source communities for inspiration and support.


📞 Need Help?

  1. Start with: TESTING.md → Run health check
  2. Then check: TROUBLESHOOTING.md → Find your issue
  3. Or visit: COMMUNITY.md → Get help from community
  4. Or open: GitHub Issues

⭐ If this project helps you build better AI assistants, please give it a star!

Built with determination, debugged with patience, designed for the future of AI.

常见问题

What is persistent-ai-memory?

persistent-ai-memory is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by savantskie. A persistent local memory for AI, LLMs, or Copilot in VS Code. It has 235 GitHub stars.

Is persistent-ai-memory safe to use?

Yes. persistent-ai-memory passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install persistent-ai-memory?

Clone the repository with "git clone https://github.com/savantskie/persistent-ai-memory" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is persistent-ai-memory written in?

persistent-ai-memory is primarily written in Python. It is open-source under savantskie on GitHub, so you can review or fork the full source.

Are there alternatives to persistent-ai-memory?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh persistent-ai-memory against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情