mcpField
M
memory

memory

github.com/johnlindquist生产力26362 次安装45 周前更新
代码仓库

关于 memory

基于 basic-memory 的持久化知识存储技能,可跨会话保存并通过语义搜索检索 Markdown 笔记。适合记录个人资料、学习内容和项目上下文。

主要功能

  1. 01写入与读取笔记
  2. 02语义搜索笔记
  3. 03按主题构建上下文
  4. 04按标签和文件夹组织
  5. 05同步与状态检查

适用场景

  1. 01保存代码片段和项目决策
  2. 02记录学习内容并按主题检索
  3. 03在新会话开始时恢复项目上下文

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/johnlindquist/claude --skill memory

安装后在 Claude Code 中输入/memory确认已加载。

详细介绍

Memory - 持久化知识存储

通过语义搜索跨会话存储和检索知识。

前提条件

安装 basic-memory:

pip install basic-memory

CLI 参考

写入笔记
# Basic note
basic-memory tool write-note --title "Note Title" --content "Note content in markdown"

# With tags
basic-memory tool write-note --title "React Patterns" --content "# Content here" --tags "react,patterns,frontend"

# To specific folder
basic-memory tool write-note --title "Meeting Notes" --content "# Notes" --folder "meetings"

# With specific project
basic-memory tool write-note --title "Project Notes" --content "# Notes" --project myproject
读取笔记
# By identifier/permalink
basic-memory tool read-note "note-title"

# From specific project
basic-memory tool read-note "note-title" --project myproject
搜索记忆
# Semantic search (query is positional)
basic-memory tool search-notes "your search query"

# Limit results
basic-memory tool search-notes "react hooks" --page-size 10

# Search by permalink
basic-memory tool search-notes "pattern" --permalink

# Search by title
basic-memory tool search-notes "meeting" --title

# Filter by date
basic-memory tool search-notes "feature" --after_date "7d"

# With specific project
basic-memory tool search-notes "authentication" --project myproject
构建主题上下文
# Get related notes for a URL/topic (URL is positional)
basic-memory tool build-context "memory://topic/authentication"

# With depth and timeframe
basic-memory tool build-context "memory://note/my-note" --depth 2 --timeframe 30d

# With specific project
basic-memory tool build-context "memory://topic/api" --project myproject
列出近期活动
# Default (depth 1, 7 days)
basic-memory tool recent-activity

# With depth
basic-memory tool recent-activity --depth 3

# With timeframe
basic-memory tool recent-activity --timeframe 30d

# Combined
basic-memory tool recent-activity --depth 3 --timeframe 14d
继续对话
# Get prompt to continue previous work
basic-memory tool continue-conversation "previous topic or context"
同步数据库
basic-memory sync
检查状态
basic-memory status

笔记格式

笔记以带有 YAML frontmatter 的 Markdown 格式存储:

---
title: My Note
tags: [tag1, tag2]
created: 2024-01-15
---

# My Note

Content here in markdown format.

## Sections

More content...

工作流模式

保存所学内容

发现有用的信息时:

basic-memory tool write-note \
  --title "TypeScript Utility Types" \
  --content "# Utility Types\n\n- Partial<T> - Makes all properties optional\n- Required<T> - Makes all properties required\n- Pick<T, K> - Picks specific properties" \
  --tags "typescript,types,reference"
保存决策

做出架构决策时:

basic-memory tool write-note \
  --title "Auth Strategy Decision" \
  --content "# Decision: Use JWT for API auth\n\n## Context\n...\n\n## Decision\n...\n\n## Consequences\n..." \
  --tags "architecture,auth,decision" \
  --folder "decisions"
检索上下文

开始相关工作之前:

# Search for relevant notes
basic-memory tool search-notes "authentication jwt tokens"

# Or build comprehensive context
basic-memory tool build-context "memory://topic/api-authentication"
回顾近期工作
basic-memory tool recent-activity --depth 5 --timeframe 7d

使用场景

个人 Wiki
  • 存储代码片段和模式
  • 记录项目决策
  • 保存参考资料
学习日志
  • 记录学到的内容
  • 按主题添加标签,便于日后检索
  • 随时间积累知识
项目上下文
  • 保存项目专属知识
  • 在会话开始时检索相关上下文
  • 跨会话共享知识

最佳实践

  1. 使用有意义的标题 - 标题会成为永久链接
  2. 添加标签 - 改善搜索和组织效果
  3. 使用 Markdown - 内容支持完整的 Markdown 格式
  4. 使用文件夹整理 - 将相关笔记归为一组
  5. 写入前先搜索 - 检查是否已有相关知识
  6. 让笔记聚焦 - 每篇笔记只写一个主题
  7. 更新而非重复创建 - 修改现有笔记

集成模式

会话开始
# Get context for today's work
basic-memory tool build-context "memory://topic/feature-youre-building"
工作期间
# Save discoveries
basic-memory tool write-note --title "Discovery Title" --content "What I learned"
会话结束
# Sync to ensure persistence
basic-memory sync

评论

支持 Markdown