Skip to main content

Self-Evolving RAG for AI Agents — A cross-app persistent memory system where agents autonomously write, retrieve, and evolve their knowledge

Project description

Adaptive Agent MCP

Self-Evolving RAG for AI Agents

Agents don't just read memory — they write it.

License: MIT Python 3.10+ MCP PyPI

中文 | English


Core Concept

Traditional RAG

User Input → Retrieve KB → Generate
               ↑
            Read-only
        (Human-maintained)

Self-Evolving RAG

User Input → Retrieve Memory → Generate
               ↑↓
           Read + Write
    Agent autonomously evolves

Key Differences:

Traditional RAG Adaptive Agent MCP
Read Retrieves pre-indexed documents Dynamically accumulates at runtime
Write Human-maintained knowledge base Agent writes autonomously
Scope Generic knowledge User-specific memory
State Static data Continuously evolves

How It Works

In Claude Code: "Remember, I prefer TypeScript"
         ↓
    Agent automatically calls:
    • append_daily_log() → Record to daily log
    • update_preference() → Update preferences
    • extract_knowledge() → Extract knowledge graph
         ↓
In Antigravity: "What are my coding preferences?"
         ↓
    AI: "You prefer TypeScript"

Teach once, remember forever. Share across apps, never forget.


Quick Start

Installation

Configure mcp.json in any MCP-compatible AI application:

Basic Configuration:

{
  "mcpServers": {
    "adaptive-agent-mcp": {
      "command": "uvx",
      "args": ["adaptive-agent-mcp"]
    }
  }
}

Full Configuration (with Semantic Search API):

{
  "mcpServers": {
    "adaptive-agent-mcp": {
      "command": "uvx",
      "args": ["adaptive-agent-mcp"],
      "env": {
        "ADAPTIVE_EMBEDDING_BASE_URL": "https://api.openai.com/v1",
        "ADAPTIVE_EMBEDDING_API_KEY": "your-api-key",
        "ADAPTIVE_EMBEDDING_MODEL": "text-embedding-3-small",
        "ADAPTIVE_RERANK_BASE_URL": "https://api.cohere.ai/v1",
        "ADAPTIVE_RERANK_API_KEY": "your-api-key",
        "ADAPTIVE_RERANK_MODEL": "rerank-english-v3.0"
      }
    }
  }
}

Default storage path: ~/.adaptive-agent/memory. All apps share the same memory.

Enhance Agent Memory Behavior (Optional)

If your AI doesn't actively read/write memory, add this to your system prompt or user rules:

## Memory System Instructions

- At the start of each conversation, call `initialize_session` to load user preferences.
- When user says "remember", "save", or expresses preferences, call `update_preference` or `append_daily_log`.
- After completing tasks, briefly record progress using `append_daily_log`.
- When user asks about past conversations, use `query_memory_headers` or `search_memory_content`.

Features

Feature Description Version
Three-Layer Memory MEMORY.md + Daily Logs + Knowledge Graph v0.1.0
Scope Isolation project:xxx, app:xxx, global v0.2.0
Concurrent Safety Cross-process file locking v0.3.0
Incremental Indexing mtime-based smart updates v0.3.0
Semantic Search Embedding + Rerank API v0.4.0
FTS5 Full-text SQLite built-in search v0.4.0
Knowledge Graph NetworkX-based entity relations v0.5.0

Available Tools

Memory Management

Tool Description
initialize_session Initialize session with user profile and recent context
append_daily_log Append content to today's log
update_preference Intelligently update user preferences
query_memory_headers Query memory file metadata
read_memory_content Read complete memory file content
search_memory_content Full-text search using ripgrep

Semantic Search

Tool Description
semantic_search Vector similarity search
fulltext_search FTS5 keyword search with BM25 ranking
index_document Index document to vector store

Knowledge Graph

Tool Description
extract_knowledge Extract entity relations from text
add_knowledge_relation Manually add relations
query_knowledge_graph Query entities, relations, or stats
multi_hop_query Multi-hop reasoning queries

Storage Structure

~/.adaptive-agent/memory/
├── MEMORY.md              # User preferences (scope-based)
├── .knowledge/
│   └── items.json         # Atomic facts
├── .vector/
│   └── vector.db          # SQLite + sqlite-vec
├── .graph/
│   └── knowledge.json     # NetworkX graph
└── 2026/
    └── 02_february/
        └── week_06/
            └── 2026-02-07.md  # Daily logs

Data Safety

  • Isolated storage: Data stored in ~/.adaptive-agent/memory, independent of uvx installation
  • Concurrent safety: filelock prevents data corruption from multiple clients
  • Human-readable: All data in Markdown/JSON format, easy to backup and version control

Documentation


License

MIT License - See LICENSE for details.


Adaptive Agent MCPWhere agents learn, remember, and evolve.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adaptive_agent_mcp-0.5.4.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adaptive_agent_mcp-0.5.4-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file adaptive_agent_mcp-0.5.4.tar.gz.

File metadata

  • Download URL: adaptive_agent_mcp-0.5.4.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0rc2

File hashes

Hashes for adaptive_agent_mcp-0.5.4.tar.gz
Algorithm Hash digest
SHA256 92059a261748a7d4709817073a476352bbdaa757d0811aab83580d8ea0ce23ee
MD5 0c4f234d31e1c73478b63b46a23d7069
BLAKE2b-256 afca04374c036c88d9cbb11102e6532ec4aac38bef089c25c655033b8b8bb05e

See more details on using hashes here.

File details

Details for the file adaptive_agent_mcp-0.5.4-py3-none-any.whl.

File metadata

File hashes

Hashes for adaptive_agent_mcp-0.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ca30105016570a8afe8343baf7f544f8c6ef2b44ab70a08f16e11d205005e43e
MD5 f68c3ff848cb54b6e73a739d471539f0
BLAKE2b-256 f851b0cfabd2aabff867ce3cba0a05e291f0e0765f4ab497d007f2a0c56d5e9c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page