中文 English 日本語

# mempal

Project memory for coding agents. Single binary, hybrid search, find past decisions with citations in seconds.

`cargo install mempal`
GitHub crates.io Design Book

## Core Features

🔍

### Hybrid Search

BM25 keyword matching + vector semantic search, merged via Reciprocal Rank Fusion. Exact-match error codes and understand semantic similarity.

🧠

### Knowledge Graph

Subject-predicate-object triples with temporal validity. Timeline view, stats, and relationship invalidation when facts expire.

🌐

### Cross-Project Tunnels

Automatic discovery when the same room appears in multiple wings (projects). Search results include inline tunnel hints.

🤖

### Self-Describing Protocol

MEMORY_PROTOCOL (10 rules) embedded in MCP ServerInfo. Any agent learns the workflow on connect — zero configuration.

🌍

### Multilingual Embedding

model2vec-rs (BGE-M3 distilled) as default embedder. Zero native dependencies, supports Chinese, Japanese, Korean, English.

📦

### Single-File Storage

Everything in ~/.mempal/palace.db (SQLite + sqlite-vec). Backup is cp. Migration is scp. No server process.

🔗

### 9 MCP Tools

status, search, ingest, delete, taxonomy, kg, tunnels, peek_partner, cowork_push. Each tool carries field-level documentation in its JSON schema.

📝

### Agent Diary

Cross-session behavioral learning. Agents record OBSERVATION / LESSON / PATTERN entries. Future sessions search and learn.

🔒

### Safe Operations

Soft-delete + purge two-step deletion. Audit logging. Semantic dedup detection. Dry-run preview mode.

## Data Flow

    query → BM25 (FTS5)         → keyword ranking
          → Vector (sqlite-vec) → semantic similarity ranking
          → RRF Fusion (k=60)   → merged ranking
          → Wing/Room filter     → scoped results
          → Tunnel hints         → cross-project references
          → Citations (drawer_id + source_file)

8.5MB
Release Binary
95.2%
R@5 Retrieval
0
Native Dependencies
5
Ingest Formats