selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

GitHub
kiwi-mem logo

Self-host kiwi-mem

v1.7.0

Self-hosted AI memory gateway with human-like recall

ReleaseOpen SourceOther
Updated2 weeks ago
LanguagePython
Setup difficultyModerate
Stars
342
CPU
1 core
RAM
1 GB
Port
8080 (HTTP gateway and admin panel)
Requires
Docker, Docker Compose, PostgreSQL + pgvector
Install with Docker Compose

What is kiwi-mem?

kiwi-mem is a lightweight proxy gateway that gives AI companions long-term memory with human-like dynamics. It runs between your chat frontend (ChatBox, NextChat, SillyTavern, etc.) and any LLM provider (OpenAI-compatible or Anthropic native). Memories have a heat score that decays over time but warms up when recalled; a nightly Dream process consolidates fragments into coherent scenes and infers implicit knowledge; a calendar system compresses history into day/week/month/quarter/year summaries. Static prompt sections (persona, profile, locked memories, calendar) are placed first to hit API prompt caching, cutting input costs up to 90%. A tool drawer loads only the tools each turn needs via vector routing. Projects isolate private memories per context. Deployment is via Docker Compose (includes PostgreSQL + pgvector) or one-click on Zeabur. The admin panel configures providers and 80+ parameters; no built-in auth, so public exposure requires external protection. Licensed AGPL-3.0-or-later.

Should you self-host kiwi-mem?

kiwi-mem scores 50/100 on selfhost.directory (how scoring works) and ranks #40 of 120 in AI Assistant. It has 342 GitHub stars.

It shipped 9 stable releases in the past year. The latest, v1.7.0, came out on 10 September 2026. New versions land roughly every 6 days.

Setup is moderate: expect some configuration beyond a single command. It is Other-licensed and written mostly in Python.

Its closest alternative on selfhost.directory is hermes-agent (89/100, 257 989 stars). It scores higher overall, so compare the two before you pick. See kiwi-mem vs hermes-agent side by side.

Features

  • Auto-update with rollback
  • Backup and Restore
  • Calendar hierarchy summaries
  • Chinese segmentation (jieba)
  • Contradiction detection and memory locking
  • Dream sleep consolidation
  • Human-like memory heat system
  • MCP server and client
  • Multi-provider LLM routing
  • Project memory isolation
  • Prompt caching optimization
  • Reminder System
  • Tool drawer (vector-routed)
  • Web Admin Panel
  • Web search (7 engines)

kiwi-mem README

How to install kiwi-mem

Install kiwi-mem with Docker Compose

Docker, Docker Compose, VPS with public IP, domain + HTTPS for mobile
Environment variables
API_KEY, API_BASE_URL, DATABASE_URL (auto), MEMORY_ENABLED, DEFAULT_MODEL, PORT, MAX_MEMORIES_INJECT, MEMORY_EXTRACT_INTERVAL, CORS_ORIGINS, JIEBA_CUSTOM_WORDS, EXTRA_REFERER, EXTRA_TITLE, MCP_ALLOWED_HOSTS, MCP_ALLOWED_ORIGINS, plus 20+ memory/Dream/calendar tuning vars

安装 Docker(如果服务器没有的话)

curl -fsSL https://get.docker.com | sh

下载 kiwi-mem

git clone https://github.com/LucieEveille/kiwi-mem.git cd kiwi-mem

创建配置文件

cp .env.example .env

编辑配置文件(通常一行都不用改)

nano .env

启动

docker compose up -d

Includes PostgreSQL + pgvector automatically. Requires VPS with public IP and domain+HTTPS for mobile clients.

How to configure kiwi-mem

  • API_BASE_URLhttps://openrouter.ai/api/v1/chat/completionsLLM API base URL

    LLM API base URL

  • API_KEYLLM API Key (OpenRouter / OpenAI / AIHubMix / other OpenAI-compatible providers)

    LLM API Key (OpenRouter / OpenAI / AIHubMix / other OpenAI-compatible providers)

  • AUTO_SOFTEN_DAILY_LIMIT10Daily softening limit

    Daily softening limit

  • AUTO_SOFTEN_ENABLEDtrueAuto-softening of old memories toggle

    Auto-softening of old memories toggle

    values: true/false

  • AUTO_SOFTEN_MIN_AGE5Minimum age (days) for auto-softening

    Minimum age (days) for auto-softening

  • CLEANUP_HEAT_THRESHOLD0.15Low-heat cleanup threshold

    Low-heat cleanup threshold

  • CORS_ORIGINS*Frontend domain allowlist for CORS (comma-separated)

    Frontend domain allowlist for CORS (comma-separated)

  • DATABASE_URLPostgreSQL connection string (auto-configured by Docker Compose)

    PostgreSQL connection string (auto-configured by Docker Compose)

  • DEFAULT_MODELanthropic/claude-sonnet-4Default chat model

    Default chat model

  • EXT_DRAWER_MAX_OPEN3External MCP drawer max concurrent open

    External MCP drawer max concurrent open

  • EXT_DRAWER_THRESHOLD0.40External MCP drawer similarity threshold

    External MCP drawer similarity threshold

  • EXTRA_REFERERhttps://kiwi-mem.localExtra Referer header for OpenRouter

    Extra Referer header for OpenRouter

  • EXTRA_TITLEkiwi-memExtra Title header for OpenRouter

    Extra Title header for OpenRouter

  • JIEBA_CUSTOM_WORDSCustom jieba Chinese segmentation words (comma-separated)

    Custom jieba Chinese segmentation words (comma-separated)

  • LOCK_RETIRE_DAYS90Lock retirement days

    Lock retirement days

  • LOCK_RETIRE_ENABLEDtrueAuto/Dream lock retirement toggle

    Auto/Dream lock retirement toggle

    values: true/false

  • MAX_MEMORIES_INJECT15Maximum memories injected per request

    Maximum memories injected per request

  • MCP_ALLOWED_HOSTSMCP 2.0 allowed hosts (comma-separated domains)

    MCP 2.0 allowed hosts (comma-separated domains)

  • MCP_ALLOWED_ORIGINSMCP 2.0 allowed browser origins (comma-separated)

    MCP 2.0 allowed browser origins (comma-separated)

  • mcp_manual_idsManually pinned external drawer IDs/names

    Manually pinned external drawer IDs/names

  • mcp_modeautoExternal MCP config source mode

    External MCP config source mode

    values: off/auto/manual

  • mcp_serversExternal MCP servers JSON array (recommended via admin panel)

    External MCP servers JSON array (recommended via admin panel)

  • MEMORY_ENABLEDtrueMemory system toggle

    Memory system toggle

    values: true/false

  • MEMORY_EXTRACT_INTERVAL3Memory extraction interval (turns)

    Memory extraction interval (turns)

  • MERGE_MIN_KEEP20Dream merge minimum keep count

    Dream merge minimum keep count

  • MERGE_RETENTION_DAYS90Dream merge product retention days

    Dream merge product retention days

  • PORT8080Gateway port

    Gateway port

  • reminder_tools_enabledtrueReminder tools global toggle

    Reminder tools global toggle

    values: true/false

  • SCENE_INJECT_ENABLEDtrueMemScene injection toggle

    MemScene injection toggle

    values: true/false

  • SCENE_INJECT_LIMIT2Scene injection limit

    Scene injection limit

  • SCENE_INJECT_MIN_SIM0.5Scene injection minimum similarity

    Scene injection minimum similarity

  • SOFTEN_COOLDOWN_DAYS21Softening cooldown period (days)

    Softening cooldown period (days)

kiwi-mem releases & version history

FAQ

How do I import existing memories from past conversations?

Use the admin panel → Memories → Add Memory for manual entry. Bulk import is being rebuilt for a future version.

What is the difference between the API Base URL in my chat client and the provider URL in the admin panel?

The chat client's API Base URL points to your kiwi-mem gateway (https://your-domain/v1). The admin panel's provider URL points to the upstream AI service (e.g., https://openrouter.ai/api/v1). kiwi-mem sits in between.

Why can't my iOS/mobile client connect?

Mobile clients require HTTPS. You need a domain with a valid certificate (via Cloudflare Tunnel or similar).

Why do I get a 500 API_KEY not set error?

No provider is configured in the admin panel, or the provider's model isn't linked. Add a provider with API Key and at least one model.

Why do I get a 401 Missing Authentication header error?

The 401 comes from the upstream AI provider, not kiwi-mem. Check that the provider's API Key is correctly configured in the admin panel.

Is kiwi-mem suitable for a work knowledge base?

Not really. It excels at remembering a person's life, habits, and relationships, not document storage or retrieval. Use a dedicated RAG tool for enterprise knowledge.

How do I update and will I lose memories?

Run `bash scripts/update.sh` — it shows changes, backs up the database, rebuilds with --build, and auto-rolls back on failure. Memories, config, and provider settings are preserved; DB schema auto-migrates.

How much does Dream cost?

Approximately ¥0.01–0.03 per run using Claude Haiku.

Will memories grow without bound?

No. Heat-based decay, Dream consolidation, calendar compression, and per-request injection limits keep memory size controlled.

Which LLMs are supported?

Any OpenAI-compatible provider (OpenRouter, OpenAI, DeepSeek, Ollama, etc.) plus Anthropic native API directly — choose format in the admin panel.

Do I need to know how to code to use kiwi-mem?

No. Docker one-click deploy and a browser-based admin panel handle everything; the creator doesn't write code either.

More in Chat

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…