SQLite for associative memory — embedded, single-file, zero-config associative memory engine powered by Modern Hopfield Networks
Project description
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.
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 Distributions
Built Distributions
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 memhop-0.2.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: memhop-0.2.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 553.8 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc0b28d69bb7c28a7ef005c3e152d8230a88ae4cecd0a668a6bf66ef46df87a1
|
|
| MD5 |
df24f7285e739183556dd33a8cbb1f60
|
|
| BLAKE2b-256 |
aed521fb40b3fad2308ec4fb5d084266f4ab4670b961cb090774a968f90b0c9f
|
Provenance
The following attestation bundles were made for memhop-0.2.0-cp310-cp310-win_amd64.whl:
Publisher:
workflow.yml on qyiun666/MemHop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memhop-0.2.0-cp310-cp310-win_amd64.whl -
Subject digest:
fc0b28d69bb7c28a7ef005c3e152d8230a88ae4cecd0a668a6bf66ef46df87a1 - Sigstore transparency entry: 1580372876
- Sigstore integration time:
-
Permalink:
qyiun666/MemHop@e726287b2bcb0b1e41bd8b5460fc8bc768a2e751 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/qyiun666
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@e726287b2bcb0b1e41bd8b5460fc8bc768a2e751 -
Trigger Event:
push
-
Statement type:
File details
Details for the file memhop-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: memhop-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 579.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ec3a4329fe8b3c8b5725294fd50d44aae2935c8d027b24ff1805091af7f2388
|
|
| MD5 |
ce1d468fd319193d3ce4760f0af2338c
|
|
| BLAKE2b-256 |
1f78be61b294a23ef99f0fac56cbe170cbac427fe870567f53538aaf3557edc7
|
Provenance
The following attestation bundles were made for memhop-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl:
Publisher:
workflow.yml on qyiun666/MemHop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memhop-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl -
Subject digest:
4ec3a4329fe8b3c8b5725294fd50d44aae2935c8d027b24ff1805091af7f2388 - Sigstore transparency entry: 1580373063
- Sigstore integration time:
-
Permalink:
qyiun666/MemHop@e726287b2bcb0b1e41bd8b5460fc8bc768a2e751 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/qyiun666
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@e726287b2bcb0b1e41bd8b5460fc8bc768a2e751 -
Trigger Event:
push
-
Statement type:
File details
Details for the file memhop-0.2.0-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: memhop-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 526.3 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f18c579be5bdfa19a58958449f39ec7e86b1471956f82b11e4d7b9b283c1c04
|
|
| MD5 |
6c61638f7966de5efc9086212dbe8c68
|
|
| BLAKE2b-256 |
c4b94cef9e2733d3cc331bf21e5d0ce6a84a4f53ee60dba6e2705495757c2a03
|
Provenance
The following attestation bundles were made for memhop-0.2.0-cp310-cp310-macosx_11_0_arm64.whl:
Publisher:
workflow.yml on qyiun666/MemHop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memhop-0.2.0-cp310-cp310-macosx_11_0_arm64.whl -
Subject digest:
3f18c579be5bdfa19a58958449f39ec7e86b1471956f82b11e4d7b9b283c1c04 - Sigstore transparency entry: 1580372726
- Sigstore integration time:
-
Permalink:
qyiun666/MemHop@e726287b2bcb0b1e41bd8b5460fc8bc768a2e751 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/qyiun666
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@e726287b2bcb0b1e41bd8b5460fc8bc768a2e751 -
Trigger Event:
push
-
Statement type: