@galvinsan/pi-mentis
Integrated Pi Mentis knowledge-first memory extension for Pi >= 0.84.0
Package details
Install @galvinsan/pi-mentis from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@galvinsan/pi-mentis- Package
@galvinsan/pi-mentis- Version
0.1.44- Published
- Aug 10, 2026
- Downloads
- 6,675/mo · 4,531/wk
- Author
- galvinsan
- License
- MIT
- Types
- extension
- Size
- 2.9 MB
- Dependencies
- 8 dependencies · 3 peers
Pi manifest JSON
{
"extensions": [
"./dist/index.js"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@galvinsan/pi-mentis
Pi Mentis 是为 Pi 设计的个人长期记忆与知识库 Extension,包含知识库 + 长期记忆的完整集成版本。
- 个人长期记忆:偏好、事实、决策、流程、事件,跨会话召回。
- 知识库:文件、目录、Git 工作区、在线文档、Wiki 型站点。
- 混合检索:Dense + 全文 + RRF + 可选 Rerank + MMR。
- 本地持久化:Zvec 存储在本机,API Key 只读环境变量。
- Pi 原生:复用 Session / Branch 语义,不维护第二套会话树。
English: Pi-native personal long-term memory + knowledge base, backed by Zvec and SiliconFlow.
要求
| 项目 | 要求 |
|---|---|
| Pi | >= 0.84.0 |
| Node.js | >=22.19.0 |
| 凭证 | SILICONFLOW_API_KEY 环境变量 |
| 存储 | 本机 Zvec,单写者 |
三个可选产品,只安装一个:
| 包 | 适用场景 | 工具 |
|---|---|---|
@galvinsan/pi-mentis |
推荐:知识 + 记忆 | commit_memory, search_memory |
@galvinsan/pi-mentis-memory |
只要个人记忆 | commit_memory, search_memory |
@galvinsan/pi-mentis-knowledge |
只要知识库 | commit_knowledge, search_knowledge |
安装
pi install npm:@galvinsan/pi-mentis
升级:pi update npm:@galvinsan/pi-mentis · 卸载:pi remove npm:@galvinsan/pi-mentis
配置
export SILICONFLOW_API_KEY="your-api-key"
默认模型:Embedding Qwen/Qwen3-Embedding-8B(1024 维),Rerank Qwen/Qwen3-Reranker-8B。
可选 BAAI 模型(SILICONFLOW_EMBEDDING_MODEL、SILICONFLOW_EMBEDDING_DIMENSIONS、SILICONFLOW_RERANKER_MODEL、SILICONFLOW_RERANK_MAX_INPUT_TOKENS)。
详细配置默认位于 ~/.pi/.pi-mentis/config.json,不随启动目录或 Workspace
变化;所有字段可省略并继承安全默认值。显式 Pi profile 使用
<PI_CODING_AGENT_DIR>/.pi-mentis,PI_MENTIS_HOME 可指定隔离的绝对路径。
API Key 只放环境变量,不要写入 JSON。
使用
请使用 commit_memory 记住:我在 Node.js 项目中优先使用 pnpm。
请调用 search_memory,搜索我关于 Node.js 包管理器的长期偏好。
Memory 以不分类的自然语言断言保存,不写入 Predicate、Memory Type、Domain、Cardinality、Fact Key 或 Semantic Key。需要纠正、强化或撤回时,Agent 会优先在同一轮用 search_memory 找到具体旧记录,再用不变的 commit_memory({content}) 写入新陈述。主写路径先完成保存;后台优先对本轮召回的具体记录做 pairwise reasoning;没有显式召回时可复核 Core 找到的最强向量候选。相似度只选候选,不能改变状态;只有高置信成对证据才能建立 reinforce / supersede / retract / conflict 关系,不确定时安全 coexist。
这不是关键词或 correction/retraction 分类器。相似度只负责找候选,不能改变状态;后台整合保留原始来源、关系边和 decision trace。Branch hypothesis 在验证前不会污染主事实。
/kb add ./docs
/kb add https://zhanghandong.github.io/pi-book/
/kb status
数据与安全
- 备份前停止 Pi,整体复制
storage.rootDir(默认~/.pi/.pi-mentis/zvec)。 - 仅存在
~/.pi/agent/.pi-mentis时会兼容使用;两套目录并存时固定选择稳定的~/.pi/.pi-mentis,另一套只报告为 inactive,不会自动合并、覆盖或删除。 - 同一存储目录只允许一个写入进程。
- 自动召回有软/硬超时(默认 300ms / 800ms),不会无限阻塞回复。
- 召回内容标记为不受信任证据,不会覆盖当前用户指令。
链接
MIT License.