Skip to main content
Glama
README.md
# anchor-memory · 个人排错经验记忆

> 它把 AI 每次帮你解决的问题,变成你自己的经验。

- **存**:你在 Trae 里解决 bug,AI 自动把整段对话蒸馏成一张 100 字的「排错卡」
- **联**:卡片挂到知识锚点上(连接池、事务、Vue……),长成你的 3D 经验网络
- **忆**:每天 90 秒「点亮复习」,快忘的卡自动回到你面前

零依赖、零 API Key、数据全在本地一个 JSON 文件里。

## 五分钟上手

### 第 1 步:启动服务

双击 `start.bat`(或手动运行 `node server/index.js`)。

看到这行字就说明成功了:

```
[anchor-memory] MCP(stdio) 就绪,可视化: http://localhost:7331
```

浏览器打开 **http://localhost:7331** ——这就是你的经验网络。

### 第 2 步:接入 Trae

Trae 设置 → MCP → 添加:

```json
{
  "mcpServers": {
    "anchor-memory": {
      "command": "node",
      "args": ["E:\\AI-zhishi\\anchor-memory\\server\\index.js"]
    }
  }
}
```

> `command` 用 `node` 即可(Trae 会用系统 PATH 里的 node)。如果你的机器有多版本 node 且默认版本低于 v14,请写 node.exe 的完整路径。

> 路径换成你自己的实际位置。配置后重启 Trae 会话。

### 第 3 步:验证

对 AI 说:

> 我遇到一个问题:接口 500 但是没有日志,帮我排查

AI 会先检索你的历史卡片(种子数据里正好有这张!)。问题解决后说「存卡」,然后刷新可视化页面——网络长出了新节点。

### 第 4 步:每天的习惯(90 秒)

打开 http://localhost:7331 ,右侧「今日点亮」:

看症状 → 心里默走一遍排查路径 → 自评「记得 / 模糊 / 忘了」→ 揭示答案。

就这些。剩下的交给间隔重复调度。

## 我的数据在哪?

全部在 **`data/cards.json`** 一个文件里(纯文本 JSON)。

- **备份**:复制这个文件即可
- **换电脑**:拷贝整个 `anchor-memory` 文件夹
- **想跑路**:数据是标准 JSON,随时可以导出成任何格式
- 不联网、不上传、没有账号

## 常见问题

**Q:页面打不开 / fetch 报错?**
服务没启动。先双击 `start.bat`,看到「就绪」字样再刷新页面。

**Q:Trae 里 AI 不查卡 / 不存卡?**
确认 `.trae/rules/anchor-memory.md` 存在且会话已重启。项目规则会把「先查卡、后存卡」变成纪律。

**Q:控制台中文乱码?**
不影响功能。`start.bat` 已自动切换 UTF-8 代码页;手动启动时可先执行 `chcp 65001`。

**Q:端口 7331 被占用?**
说明已经有一个实例在跑,可视化由先启动的实例提供,MCP 功能不受影响。不需要开两个。

**Q:AI 依赖什么 API?要不要付费?**
不依赖任何外部 AI API。蒸馏和检索的智能由 Trae 里的模型提供,MCP 只是本地管道。

## 项目结构

```
anchor-memory/
├── server/index.js       # MCP(stdio) + 可视化(HTTP 7331),零依赖
├── data/cards.json       # 你的全部经验数据(可 git、可备份)
├── public/index.html     # 3D 经验网络 + 点亮复习页
├── test/mcp-smoke.js     # MCP 协议冒烟测试
├── start.bat             # Windows 一键启动
└── .trae/rules/          # Trae 项目规则(查卡/存卡纪律)
```

## 复习调度的原理

简化版间隔重复:答「记得」等级 +1,间隔拉长(1→2→4→8→…→128 天);「模糊」等级 -1;「忘了」回到 1 天后重来。等级 ≥3(间隔 ≥8 天)视为「已内化」。每天最多 15 张,逾期的优先,超出的顺延——复习债永远不滚雪球。

TDQS

A4.1/5.0

Scored across 9 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: creating, searching, reviewing, deleting cards, logging topics, importing/claiming packs, and generating reports. No two tools overlap in function or trigger condition.

Naming Consistency4/5

Tools follow a consistent snake_case, mostly verb_noun pattern (save_card, search_cards, review_card). 'due_cards' uses an adjective-led name instead of a verb, a minor deviation from the otherwise uniform convention.

Tool Count5/5

9 tools cover the full memory workflow without redundancy: create, retrieve, review, delete, log, import, claim, and analyze. The count feels intentional and well-scoped for the domain.

Completeness4/5

The core card lifecycle is complete (create, search, review, delete) plus useful extras like packs, logs, and reporting. Minor gaps exist, such as no direct edit-card tool or explicit pack management beyond claiming, but these don't break the main workflows.

Maintenance

ActivityMaintained
ResponsivenessNo issues