Memory Notes
Write well-structured notes that Basic Memory can parse into a searchable knowledge graph. Every note is a markdown file with three key sections: frontmatter, observations, and relations.
Note Anatomy
CODEBLOCK0
Frontmatter
Every note starts with YAML frontmatter:
CODEBLOCK1
- - The
title must match the # Heading in the body - Tags are searchable and help with discovery
- Custom
type values (Task, Meeting, Person, etc.) work with the schema system. See the memory-schema skill for defining schemas, validating notes against them, and detecting drift. - The
permalink is auto-generated from the title and directory. For example, title "API Design Decisions" in directory "specs" produces permalink specs/api-design-decisions and memory URL memory://specs/api-design-decisions. If no directory is specified, the permalink is just the kebab-cased title. Permalinks stay stable across file moves. You rarely need to set one manually.
Note: When using write_note, you don't write frontmatter yourself. The title, tags, note_type, and metadata are separate parameters — Basic Memory generates the frontmatter automatically. Your content parameter is just the markdown body starting with # Heading.
Body / Context
Free-form markdown between the heading and the Observations section. This is the heart of the note — write generously here:
- - Background, motivation, and history
- Detailed explanation of what happened and why it matters
- Analysis, reasoning, and trade-offs considered
- Context that someone (or an AI) needs to understand this note later
Write complete, substantive prose. Basic Memory's search retrieves relevant chunks from note bodies, so longer, richer context makes notes more discoverable and more useful when found. Don't reduce everything to bullet points — tell the story.
Observations
Observations are categorized facts — the atomic units of knowledge. Each one becomes a searchable entity in the knowledge graph.
Syntax
CODEBLOCK2
- - Square brackets define the semantic category
- Content is the fact, decision, insight, or note
- Hash tags (optional) add extra metadata for filtering
Categories Are Arbitrary
The category in brackets is free-form — use whatever label makes sense for the observation. There is no fixed list. The only rule is the [category] content syntax. Consistency within a project helps searchability, but invent categories freely.
A few examples to illustrate the range:
CODEBLOCK3
Observation Tips
- - One fact per observation. Don't pack multiple ideas into one line.
- Be specific.
[decision] Use JWT is less useful than [decision] Use JWT with 15-minute expiry for API auth. - Use tags for cross-cutting concerns.
[risk] Rate limiting needed #api #security makes this findable under both topics. - Categories are queryable.
search_notes("[decision]") finds all decisions across your knowledge base.
Relations
Relations create edges in the knowledge graph, linking notes to each other. They're how you build structure beyond individual notes.
Syntax
CODEBLOCK4
- - relationtype is a descriptive verb or phrase (snakecase by convention)
- Double brackets
[[...]] identify the target note by title or permalink - Relations are directional: this note → target note
Relation Types
| Type | Purpose | Example |
|---|
| INLINECODE21 | One thing implements another | INLINECODE22 |
| INLINECODE23 |
Dependencies |
- requires [[Database Setup]] |
|
relates_to | General connection |
- relates_to [[Performance Notes]] |
|
part_of | Hierarchy/composition |
- part_of [[Backend Architecture]] |
|
extends | Enhancement or elaboration |
- extends [[Base Config]] |
|
pairs_with | Things that work together |
- pairs_with [[Frontend Client]] |
|
inspired_by | Source material |
- inspired_by [[CRDT Research Paper]] |
|
replaces | Supersedes another note |
- replaces [[Old Auth Design]] |
|
depends_on | Runtime/build dependency |
- depends_on [[MCP SDK]] |
|
contrasts_with | Alternative approaches |
- contrasts_with [[GraphQL Approach]] |
Inline Relations
Wiki-links anywhere in the note body — not just the Relations section — also create graph edges:
CODEBLOCK5
These create references relations automatically. Use the Relations section for explicit, typed relationships; use inline links for natural prose references.
Relation Tips
- - Link liberally. Relations are what turn isolated notes into a knowledge graph. When in doubt, add the link.
- Create target notes if they don't exist yet.
[[Future Topic]] is valid — BM will resolve it when that note is created. - Use
build_context to traverse. build_context(url="memory://note-title") follows relations to gather connected knowledge. - Custom relation types are fine.
taught_by, blocks, tested_in — use whatever is descriptive.
Memory URLs
Every note is addressable via a memory:// URL, built from its permalink. These URLs are how you navigate the knowledge graph programmatically.
URL Patterns
CODEBLOCK6
Project-Scoped URLs
In multi-project setups, prefix with the project name:
CODEBLOCK7
The first path segment is matched against known project names. If it matches, it's used as the project scope. Otherwise the URL resolves in the default project.
Using Memory URLs
Memory URLs work with build_context to assemble related knowledge by traversing relations:
CODEBLOCK8
Before Creating a Note
Always search Basic Memory before creating a new note. Duplicates fragment your knowledge graph — updating an existing note is almost always better than creating a second one.
Search with Multiple Variations
A single search often misses. Try the full name, abbreviations, acronyms, and keywords:
CODEBLOCK9
For people, try full name and last name. For organizations, try the full name and common abbreviations.
Decision Tree
- - Entity exists → Update it with
edit_note (append observations, add relations, find-and-replace outdated info) - Entity doesn't exist → Create it with INLINECODE51
- Unsure if it's the same entity → Read the existing note first, then decide
Granular Updates with edit_note
When a note already exists, make targeted edits instead of rewriting the whole file:
CODEBLOCK10
This preserves existing content and keeps the edit history clean.
Writing Notes with Tools
Creating a Note
CODEBLOCK11
Basic Memory auto-generates frontmatter (including the permalink and memory URL) from the parameters. This note would get permalink architecture/api-design-decisions and be addressable at memory://architecture/api-design-decisions.
Editing an Existing Note
Use edit_note to append, prepend, or find-and-replace within a note:
CODEBLOCK12
Moving a Note
Use move_note to reorganize notes into different directories:
CODEBLOCK13
The permalink stays the same after a move, so all [[wiki-links]] and memory:// URLs continue to resolve.
Best Practices
- 1. Start with context. Before listing observations, explain why this note exists. Future-you (or your AI collaborator) will thank you.
- 2. Favor completeness. Write rich, substantive notes. Basic Memory's search pulls relevant chunks from note bodies, so longer notes with more context are more discoverable, not less. Use prose in the body to tell the full story — the background, the reasoning, the nuance. Then distill key facts into
[category] content observations for structured queries. Both matter: prose gives meaning, observations give precision.
- 3. Build incrementally. Add to existing notes rather than creating duplicates. Use
edit_note to append new observations or relations as you learn more.
- 4. Review AI-generated content. When an AI writes notes for you, review them for accuracy. The AI captures structure well but may miss nuance.
- 5. Use consistent titles. Note titles are identifiers in the knowledge graph.
API Design Decisions and Api Design decisions are different entities. Pick a convention and stick with it.
- 6. Link related concepts. The value of a knowledge graph compounds with connections. A note with zero relations is an island — useful, but not as powerful as a connected one.
- 7. Let the graph grow naturally. Don't try to design a perfect taxonomy upfront. Write notes as you work, add relations as connections emerge, and periodically use
/reflect or /defrag to consolidate.
记忆笔记
编写结构良好的笔记,Basic Memory 可将其解析为可搜索的知识图谱。每条笔记都是一个 Markdown 文件,包含三个关键部分:前置元数据、观察记录和关联关系。
笔记结构
markdown
title: API 设计决策
tags: [api, 架构, 决策]
API 设计决策
API 团队在第一季度评估了公开 API 的多种方案。在原型开发了 REST 和 GraphQL 两种方案后,团队选择了 REST,原因是其拥有更广泛的生态系统支持和更简单的缓存语义。本条笔记记录了关键决策及其理由,以及尚待解决的开放问题。
观察记录
- - [决策] 使用 REST 而非 GraphQL,以保持简洁性 #api
- [需求] 必须从第一天起支持版本管理
- [风险] 公开端点需要限流
关联关系
- - 实现 [[API 规范]]
- 依赖 [[认证系统]]
- 关联 [[性能需求]]
前置元数据
每条笔记以 YAML 前置元数据开头:
yaml
title: 笔记标题 # 必填 — 成为知识图谱中的实体名称
tags: [标签1, 标签2] # 可选 — 用于组织和筛选
type: note # 可选 — 默认为 note,可使用自定义类型配合模式
permalink: 自定义路径 # 可选 — 省略时从标题自动生成
- - title 必须与正文中的 # 标题 一致
- 标签可搜索,有助于发现
- 自定义 type 值(任务、会议、人员等)可与模式系统配合使用。有关定义模式、验证笔记是否符合模式以及检测偏差,请参阅 memory-schema 技能。
- permalink 从 title 和 directory 自动生成。例如,目录 specs 中的标题 API Design Decisions 会生成 permalink specs/api-design-decisions 和记忆 URL memory://specs/api-design-decisions。如果未指定目录,则 permalink 仅为短横线命名格式的标题。Permalink 在文件移动时保持稳定。你很少需要手动设置。
注意: 使用 writenote 时,你不需要自己编写前置元数据。title、tags、notetype 和 metadata 是单独的参数 — Basic Memory 会自动生成前置元数据。你的 content 参数只是以 # 标题 开头的 Markdown 正文。
正文/上下文
标题和观察记录部分之间的自由格式 Markdown。这是笔记的核心 — 在此处尽情书写:
- - 背景、动机和历史
- 对发生事件及其重要性的详细解释
- 分析、推理和权衡的考量
- 他人(或 AI)后续理解本条笔记所需的上下文
编写完整、充实的散文。Basic Memory 的搜索会检索笔记正文中的相关片段,因此更长、更丰富的上下文使笔记更易于发现,且在被找到时更有价值。不要将所有内容都简化为要点 — 讲述故事。
观察记录
观察记录是分类的事实 — 知识的原子单位。每条观察记录都会成为知识图谱中可搜索的实体。
语法
- - 方括号 定义语义类别
- 内容 是事实、决策、见解或备注
- 井号标签(可选)添加额外的元数据用于筛选
类别是任意的
方括号中的类别是自由格式的 — 使用任何对观察记录有意义的标签。没有固定列表。唯一的规则是 [类别] 内容 的语法。项目内的一致性有助于搜索,但可以自由创造类别。
以下示例展示了其范围:
- - [决策] 使用 PostgreSQL 作为主数据存储
- [风险] 第三方 API 没有 SLA 保证
- [技术] 重试逻辑使用指数退避 #弹性
- [问题] 我们是否应该在数据库层面支持多租户?
- [偏好] 新项目使用 Bun 而非 Node
- [经验] 始终在服务端验证 Webhook 签名
- [状态] 活跃
- [风味] 埃塞俄比亚咖啡豆最适合浅烘焙
观察记录技巧
- - 每条观察记录只包含一个事实。 不要将多个想法塞进一行。
- 要具体。 [决策] 使用 JWT 不如 [决策] 使用 15 分钟过期的 JWT 进行 API 认证 有用。
- 使用标签处理跨领域关注点。 [风险] 需要限流 #api #安全 使该记录在两种主题下都可被找到。
- 类别是可查询的。 search_notes([决策]) 可以找到知识库中的所有决策。
关联关系
关联关系在知识图谱中创建边,将笔记相互链接。这是你在单个笔记之外构建结构的方式。
语法
- - 关系类型 是描述性动词或短语(按惯例使用蛇形命名法)
- 双括号 [[...]] 通过标题或 permalink 标识目标笔记
- 关联关系是有方向的:本条笔记 → 目标笔记
关系类型
| 类型 | 用途 | 示例 |
|---|
| 实现 | 一个事物实现另一个事物 | - 实现 [[认证规范]] |
| 需要 |
依赖关系 | - 需要 [[数据库设置]] |
| 关联 | 一般连接 | - 关联 [[性能笔记]] |
| 组成部分 | 层级/组成关系 | - 组成部分 [[后端架构]] |
| 扩展 | 增强或细化 | - 扩展 [[基础配置]] |
| 搭配 | 协同工作的事物 | - 搭配 [[前端客户端]] |
| 灵感来源 | 源材料 | - 灵感来源 [[CRDT 研究论文]] |
| 替代 | 取代另一条笔记 | - 替代 [[旧认证设计]] |
| 依赖 | 运行时/构建依赖 | - 依赖 [[MCP SDK]] |
| 对比 | 替代方案 | - 对比 [[GraphQL 方案]] |
内联关联关系
笔记正文中任何位置的 Wiki 链接 — 不仅仅是关联关系部分 — 也会创建图谱边:
markdown
我们评估了 [[GraphQL 方案]] 但决定不采用,因为团队对 REST 更有经验。请参阅 [[API 规范]] 了解完整约定。
这些会自动创建 引用 关系。对于明确、类型化的关系,请使用关联关系部分;对于自然的散文引用,请使用内联链接。
关联关系技巧
- - 自由链接。 关联关系是将孤立笔记转变为知识图谱的关键。如有疑问,就添加链接。
- 如果目标笔记尚不存在,请创建它们。 [[未来主题]] 是有效的 — BM 会在创建该笔记时解析它。
- 使用 buildcontext 进行遍历。 buildcontext(url=memory://note-title) 会跟随关联关系收集连接的知识。
- 自定义关系类型也没问题。 由...教授、阻塞、在...中测试 — 使用任何描述性的类型。
记忆 URL
每条笔记都可以通过 memory:// URL 寻址,该 URL 由其 permalink 构建。这些 URL 是你以编程方式导航知识图谱的方式。
URL 模式
memory://api-design-decisions # 按 permalink(标题 → 短横线命名)
memory://docs/authentication # 按文件路径
memory://docs/authentication.md # 带扩展名(同样有效)
memory://auth* # 通配符前缀
memory://docs/* # 通配符后缀
memory://project/*/requirements # 路径通配符
项目作用域 URL
在多项目设置中,使用项目名称作为前缀:
memory://main/specs/api-design # main 项目,specs/api-design 路径
memory://research/papers/crdt # research 项目
第一个路径段会与已知项目名称进行匹配。如果匹配,则将其用作项目作用域。否则,URL 会在默认项目中解析。
使用记忆 URL
记忆 URL 可与 build_context 配合使用,通过遍历关联关系来组装相关知识:
python
获取一条笔记及其连接上下文
build_context(url=memory://api-design-decisions)
通配符 — 收集所有文档
build_context(url=memory://docs/*)
按 permalink 直接读取
read_note(identifier=memory://api-design-decisions)
创建笔记之前
在创建新笔记之前,始终先搜索 Basic Memory。重复内容会碎片化你的知识图谱 — 更新现有笔记几乎总是比创建第二条笔记更好。
使用多种变体进行搜索
单次搜索往往会遗漏。尝试全名、缩写、首字母缩略