mempal  by ZhangHanDong

AI agent memory and knowledge management system

Created 3 months ago
273 stars

Top 94.3% on SourcePulse

GitHubView on GitHub
Project Summary

Mempal provides a persistent memory system for AI coding agents, enabling them to recall past decisions, context, and rationale across sessions and projects. It addresses the challenge of AI agent amnesia by offering a hybrid search mechanism that combines keyword and semantic vector search, augmented by a temporal knowledge graph. This allows agents to efficiently find relevant past information, cite sources, and maintain continuity, thereby reducing redundant work and improving decision-making consistency.

How It Works

Mempal employs a hybrid search architecture that merges BM25 keyword matching with vector semantic search, using Reciprocal Rank Fusion (RRF) for a unified ranking. It also maintains a knowledge graph of subject-predicate-object triples with temporal validity, allowing for nuanced querying and historical tracking. A key innovation is its self-describing protocol (MCP), where the mempal server embeds MEMORY_PROTOCOL rules, automatically teaching any connected agent how to interact with the memory system without explicit system prompt configuration. This approach ensures agents can leverage past experiences contextually and efficiently.

Quick Start & Requirements

  • Primary Install: cargo install mempal --version 0.8.0 --locked (single binary).
  • Prerequisites: Rust and Cargo toolchain.
  • Dependencies: Default embedder (model2vec-rs) has zero native dependencies. ONNX (--features onnx) or external API backends require specific configurations.
  • Resource Footprint: All data is stored in a local SQLite database (~/.mempal/palace.db).
  • Links: Usage guide: docs/usage.md.

Highlighted Details

  • Hybrid Search: Combines BM25, vector embeddings (via sqlite-vec), and RRF for robust retrieval.
  • Knowledge Graph: Supports temporal validity for triples, enabling historical analysis and fact-checking.
  • Agent Collaboration (Cowork): Facilitates inter-agent communication (Claude↔Codex) via per-project inboxes, session peeking, and message pushing.
  • AAAK Compression: An output-only format readable by LLMs without decoding, suitable for memory consolidation.
  • Agent Diary: Enables cross-session behavioral learning and pattern recording.
  • Multilingual Embedder: Uses model2vec-rs (BGE-M3 distilled) by default for broad language support.
  • Cross-project Tunnels: Automatically discovers and links related information across different project contexts.
  • Offline Fact Checking: Detects similar name conflicts, relation contradictions, and stale facts against the KG.

Maintenance & Community

The project shows active development with a recent release (v0.8.0, 2026-07-08). No specific community links (Discord, Slack) or explicit contributor information are provided in the README.

Licensing & Compatibility

The license is not explicitly stated in the provided text. Compatibility for commercial use or linking with closed-source projects is not detailed.

Limitations & Caveats

Concurrent ingest safety is Unix-only in earlier versions (v0.4.0), with Windows support for locking being a tracked issue. Codex agent collaboration relies on a feature flag (codex_hooks) that is currently "under development" and may require manual activation. Claude Code integration requires specific hook script and settings configurations, and TUI restarts are necessary after certain configuration changes. MCP server tools may require restarting the client application after mempal binary upgrades. mempal_cowork_push is scoped specifically for the Claude↔Codex pair and requires authenticated client identities.

Health Check
Last Commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
5
Issues (30d)
2
Star History
114 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.