Files
mao1/README.md.bak
fyah fbfa10d8d2 feat: 项目更名为张三,笔记规范升级
- 项目名:nerd-Brain/呆脑子 -> 张三
- 笔记规范:每次记录强制带时间戳 [YYYY-MM-DD HH:MM]
- 标签更新:#memory/zhang-san
- 同步 anchor_writer.py 时间戳功能
2026-04-27 10:10:11 +08:00

67 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 张三 (Zhang San)
> 一个轻量级、全本地化的 AI 长效记忆系统。
## 简介
nerd-Brain 是一套基于 Obsidian Markdown 笔记库的 AI 记忆引擎。它不依赖 Docker、向量数据库或外部服务仅用纯 Python 脚本 + 本地 LLM API 实现:
- **记忆写入**:自动生成摘要、情感坐标、关键词打标
- **多维检索**:关键词 + 情感 + 时间 + 重要性加权搜索
- **自然遗忘**:改进版艾宾浩斯遗忘曲线,自动衰减与归档
- **随机返场**10% 概率让旧记忆/旧 Idea 从归档中复活
## 架构
```
┌─────────────┐ ┌──────────────┐ ┌───────────────┐
│ anchor_ │────▶│ Obsidian │────▶│ Qwen 3.5 Plus│
│ writer.py │ │ Vault (MD) │ │ (百炼 API) │
└─────────────┘ └──────────────┘ └───────────────┘
│ │
▼ ▼
┌─────────────┐ ┌──────────────┐
│ anchor_ │ │ anchor_ │
│ search.py │ │ decay.py │
│ (多维检索) │ │ (遗忘+返场) │
└─────────────┘ └──────────────┘
```
## 核心脚本
| 脚本 | 功能 | 用法 |
|------|------|------|
| `anchor_writer.py` | 记忆写入与情感打标 | `python3 anchor_writer.py "内容"` |
| `anchor_search.py` | 多维语义检索 | `python3 anchor_search.py "关键词"` |
| `anchor_decay.py` | 遗忘曲线扫描与归档 | `python3 anchor_decay.py` |
| `anchor_vault_sync.py` | Vault 索引生成 | `python3 anchor_vault_sync.py sync` |
## 配置
所有路径和 API 配置在脚本顶部常量区:
- `VAULT_DIR`: Obsidian 笔记库路径
- `API_URL`: LLM 接口地址
- `API_KEY`: 百炼 API 密钥
- `RESURRECTION_CHANCE`: 返场概率(默认 0.1
- `DECAY_LAMBDA`: 遗忘速率(默认 0.05
- `THRESHOLD`: 归档阈值(默认 0.3
## 依赖
```bash
pip install requests pyyaml
```
## 状态
- ✅ 记忆写入(含情感标签)
- ✅ 多维检索引擎
- ✅ 遗忘曲线 + 自动归档
- ✅ 归档后随机返场10% 概率)
- 🔄 A100 本地 Qwen 3.6 部署中(待切换)
## 备份
原始脚本备份在 `~/.hermes/anchor_memory_backup/`,随时可回滚。