MemHop
嵌入式联想记忆引擎。O(1) 召回,单文件存储,零配置。
安装
pip install memhop
Python 3.10+,预编译 wheel,无需本地编译。
Quick Start
import memhop
# 打开数据库
with memhop.open("brain.db") as db:
# 写入记忆
db.remember("今天吃了豆浆油条", meta={"tags": ["早餐"]})
# 联想召回(O(1))
m = db.recall("早餐吃了什么")
print(m.text) # "今天吃了豆浆油条"
print(m.confidence) # 0.94
API
| 方法 | 说明 |
|---|---|
db.remember(text, meta?) |
写入记忆 |
db.recall(cue) |
联想召回最佳匹配 |
db.recall_topk(cue, k=5) |
Top-K 召回 |
db.search(filters) |
按 meta 过滤 |
db.recent(limit=5) |
最近记忆 |
db.forget(id) |
删除 |
db.update(id, text?, meta?) |
更新 |
db.remember_batch(items) |
批量写入 |
db.purge_before(datetime) |
清理旧记忆 |
核心特性
- O(1) 召回:Modern Hopfield Network,与记忆总量无关
- 单文件:LMDB 持久化,
brain.db即走即拷 - 零模型默认:字符 n-gram 哈希,无需下载模型
- 三层记忆:entity(纠缠图)/ knowledge(知识树)/ episode(原文)
License
All Rights Reserved. Copyright (c) 2026 MemHop Contributors.
Metadata
Release files for memhop 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| memhop-0.2.0-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details for memhop-0.2.0-cp310-cp310-win_amd64.whl |
| memhop-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.34+ x86-64 | Details for memhop-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl |
| memhop-0.2.0-cp310-cp310-macosx_11_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 11.0+ ARM64 | Details for memhop-0.2.0-cp310-cp310-macosx_11_0_arm64.whl |
Total release size: 1.7 MB
Release files / memhop-0.2.0-cp310-cp310-win_amd64.whl
| Download URL | memhop-0.2.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 553.8 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
fc0b28d69bb7c28a7ef005c3e152d8230a88ae4cecd0a668a6bf66ef46df87a1
|
|
BLAKE2b-256 checksum How to use checksums |
aed521fb40b3fad2308ec4fb5d084266f4ab4670b961cb090774a968f90b0c9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency logRelease files / memhop-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl
| Download URL | memhop-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 579.0 kB |
| Tags | CPython 3.10 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
4ec3a4329fe8b3c8b5725294fd50d44aae2935c8d027b24ff1805091af7f2388
|
|
BLAKE2b-256 checksum How to use checksums |
1f78be61b294a23ef99f0fac56cbe170cbac427fe870567f53538aaf3557edc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency logRelease files / memhop-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | memhop-0.2.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 526.3 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3f18c579be5bdfa19a58958449f39ec7e86b1471956f82b11e4d7b9b283c1c04
|
|
BLAKE2b-256 checksum How to use checksums |
c4b94cef9e2733d3cc331bf21e5d0ce6a84a4f53ee60dba6e2705495757c2a03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency logSecurity for memhop 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 3 files in this release have been uploaded with provenance metadata.
Attestation for memhop-0.2.0-cp310-cp310-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.