Neuroscience-inspired memory framework for AI agents / 海马体 — Agent 大脑记忆框架
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
Hippocampus 海马体
Neuroscience-inspired memory framework for AI agents
Hippocampus gives your AI agents a brain-like memory system. Just like the human hippocampus consolidates short-term experiences into long-term knowledge, this framework automatically organizes, prioritizes, and forgets memories so your agents stay sharp.
Why Hippocampus?
| Feature | Mem0 | Letta | Zep | Hippocampus |
|---|---|---|---|---|
| Memory consolidation | - | - | - | Automatic |
| Forgetting / decay | - | - | Implicit | Dynamic TTL formula |
| Tag-based knowledge graph | - | - | Partial | Built-in |
| Zero-config deployment | - | - | - | SQLite, one command |
| Vector search optional | - | - | - | Progressive disclosure |
| Multi-model (OpenAI/Claude/Qwen/GLM/Kimi) | Partial | Partial | Partial | Via LiteLLM |
Architecture
| API / MCP / CLI | ||||
| ▼ | ||||
|
HIPPOCAMPUS Working Memory Inbox |
||||
| ▼ Consolidation Agent (Agentic RAG · Classify · Conflict Resolve · Tag Extract) | ||||
|
SEMANTIC Facts & Knowledge |
EPISODIC Events & History |
PREFERENCE Likes & Dislikes |
PROCEDURAL Skills & How-to |
CUSTOM Your Partitions |
| ▼ Hybrid Retrieval ⟷ Knowledge Graph ⟷ Forgetting (Dynamic TTL) | ||||
Quick Start
pip install afx-hippocampus # Install
hippocampus init # Initialize (creates hippocampus.json + SQLite DB)
hippocampus config set llm_api_key sk-your-key-here # Set LLM key
hippocampus start # Start server → http://localhost:8321/
Open http://localhost:8321/ for the Web Console, or http://localhost:8321/docs for the API docs.
Alternative install methods
Docker:
git clone https://github.com/afx-team/hippocampus.git && cd hippocampus
docker compose -f docker/docker-compose.yml up
One-line install:
curl -fsSL https://raw.githubusercontent.com/afx-team/hippocampus/main/scripts/install.sh | sh
Try it in 30 seconds
# Store a memory
curl -X POST http://localhost:8321/api/v1/memories \
-H "Content-Type: application/json" \
-d '{"content": "User prefers dark mode", "tags": ["preference", "ui"], "importance_score": 7.5}'
# Search memories
curl -X POST http://localhost:8321/api/v1/search \
-H "Content-Type: application/json" \
-d '{"query": "UI preferences", "top_k": 5}'
# Trigger consolidation manually
curl -X POST http://localhost:8321/api/v1/admin/consolidate
# Explore the knowledge graph
curl http://localhost:8321/api/v1/graph/tags
curl http://localhost:8321/api/v1/graph/neighbors/python?depth=2
How It Works
Memories flow through four stages — inspired by how the human hippocampus consolidates short-term experiences into long-term knowledge:
| Stage | What Happens | Trigger |
|---|---|---|
| Ingest | New memories land in the working memory inbox (mem_hippocampus) |
API write |
| Consolidate | Agent classifies into partition, resolves conflicts, extracts tags → Knowledge Graph | Periodic / manual |
| Retrieve | Three-path hybrid search (vector + keyword + graph) with recency/importance/relevance scoring | API search |
| Forget | Dynamic TTL: base × (1 + log(access)) × importance × exp(-decay × days) — frequently used memories survive, neglected ones fade |
Periodic |
Full details: Memory Lifecycle · Consolidation · Hybrid Search · Forgetting
Configuration
All config lives in hippocampus.json — no environment variables needed.
hippocampus config list # View all settings
hippocampus config set llm_model openai/gpt-4o # Change model
hippocampus config set llm_base_url https://dashscope.aliyuncs.com/compatible-mode/v1 # Qwen/GLM/Kimi
| Field | Default | Description |
|---|---|---|
llm_model |
openai/gpt-4o-mini |
LLM model identifier (via LiteLLM) |
llm_api_key |
null |
LLM provider API key (required for consolidation) |
llm_base_url |
null |
Custom LLM API endpoint (for Qwen/GLM/Kimi) |
storage_type |
sqlite |
sqlite or postgresql |
embedding_enabled |
true |
Set false to disable vector search |
port |
8321 |
Server port |
consolidation_interval_seconds |
3600 |
How often consolidation runs |
base_ttl_hours |
168 |
Base memory TTL before decay |
Storage backends
SQLite (default) — zero-config, single file, great for personal use and development.
PostgreSQL + pgvector — production-grade, connection pooling, native vector types.
pip install afx-hippocampus[pg]
hippocampus config set storage_type postgresql
hippocampus config set pg_url postgresql://user:pass@localhost/hippocampus
Full config reference: Configuration Guide
Supported Models
Via LiteLLM, Hippocampus works with any major LLM provider:
| Provider | Model Example | Env Var |
|---|---|---|
| OpenAI | openai/gpt-4o-mini |
OPENAI_API_KEY |
| Anthropic | anthropic/claude-3-haiku-20240307 |
ANTHROPIC_API_KEY |
| Qwen (Alibaba) | openai/qwen-plus |
HIPPOCAMPUS_LLM_API_KEY + HIPPOCAMPUS_LLM_BASE_URL |
| GLM (Zhipu) | openai/glm-4 |
HIPPOCAMPUS_LLM_API_KEY + HIPPOCAMPUS_LLM_BASE_URL |
| Kimi (Moonshot) | openai/moonshot-v1-8k |
HIPPOCAMPUS_LLM_API_KEY + HIPPOCAMPUS_LLM_BASE_URL |
Development
git clone https://github.com/afx-team/hippocampus.git
cd hippocampus
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Lint
ruff check src/
# Type check
mypy src/hippocampus/
See CONTRIBUTING.md for contribution guidelines.
Roadmap
- Core memory model with 5 brain-inspired partitions
- SQLite + sqlite-vec storage backend
- PostgreSQL + pgvector storage backend
- Memory consolidation agent (Agentic RAG)
- Dynamic forgetting with exponential decay
- Tag-based knowledge graph
- FastAPI REST API
- CLI tooling + Docker deployment
- Built-in Web Console (memory CRUD, search, graph visualization)
- Evaluation benchmarks (LoCoMo, LongMemEval, ConvoMem, PersonaMem)
- MCP server for Claude Code / OpenClaw integration
- Multi-agent shared memory
- Emotional tagging and memory importance learning
Research
This project draws on research from:
- Generative Agents — recency-importance-relevance retrieval
- MemGPT / Letta — agent-driven memory management
- CoALA — episodic/semantic/procedural taxonomy
- Zep / Graphiti — temporal knowledge graphs
See repo_pages/papers/ for detailed survey notes.
License
Built by afx-team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file afx_hippocampus-0.1.0.tar.gz.
File metadata
- Download URL: afx_hippocampus-0.1.0.tar.gz
- Upload date:
- Size: 57.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fc7c2b7d0222c6e79cd36139ab4e1bfea3c6ab14916dbf61f02ae370cadbdb3
|
|
| MD5 |
cc3a4d4207c69d946af086c9c562c0f2
|
|
| BLAKE2b-256 |
b52c40510792f3998f2a16220beb3c246d867521a0bcf98556bb93fc0b664b94
|
Provenance
The following attestation bundles were made for afx_hippocampus-0.1.0.tar.gz:
Publisher:
publish.yml on afx-team/hippocampus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
afx_hippocampus-0.1.0.tar.gz -
Subject digest:
6fc7c2b7d0222c6e79cd36139ab4e1bfea3c6ab14916dbf61f02ae370cadbdb3 - Sigstore transparency entry: 1341832995
- Sigstore integration time:
-
Permalink:
afx-team/hippocampus@141fca5a0a0dcbf8ea61090bcf5cd047b99200e1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/afx-team
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@141fca5a0a0dcbf8ea61090bcf5cd047b99200e1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file afx_hippocampus-0.1.0-py3-none-any.whl.
File metadata
- Download URL: afx_hippocampus-0.1.0-py3-none-any.whl
- Upload date:
- Size: 68.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62f4f600baac0b82b9fdd92628b43caed22ee63e96423ffe3221afe30114a7ec
|
|
| MD5 |
9620599661cd56625f717c0b8c7c8dd6
|
|
| BLAKE2b-256 |
3646b40fd84eb1806bcc7110a13eb94e36528b84e42428a2f02f1c9f0dfab013
|
Provenance
The following attestation bundles were made for afx_hippocampus-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on afx-team/hippocampus
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
afx_hippocampus-0.1.0-py3-none-any.whl -
Subject digest:
62f4f600baac0b82b9fdd92628b43caed22ee63e96423ffe3221afe30114a7ec - Sigstore transparency entry: 1341833003
- Sigstore integration time:
-
Permalink:
afx-team/hippocampus@141fca5a0a0dcbf8ea61090bcf5cd047b99200e1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/afx-team
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@141fca5a0a0dcbf8ea61090bcf5cd047b99200e1 -
Trigger Event:
push
-
Statement type: