storage-basicmemory
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCore principle: All project artifacts must be stored in basicmemory under a [ProjectId], with explicit linking and status tracking to maintain single source of truth across concurrent projects.
[!NOTE] Before starting anything, ensure you have identified the correct [ProjectId] for the project you are working on.
核心原则: 所有项目工件必须存储在对应[ProjectId]下的basicmemory中,通过明确的关联和状态追踪,在多个并发项目间保持唯一可信数据源。
[!注意] 开始任何操作前,请确保你已经为当前正在处理的项目确定了正确的[ProjectId]。
Requirements:
要求:
- use basicmemory mcp tools to read and write [Project Artifacts].
- Recognise types of [Project Artifacts]: [Spec], [Research], [Descision], [Epic], [Story], [Task], [Retrospective].
- Store [Project Artifacts] in basicmemory under the correct project context using [ProjectId].
- 使用basicmemory mcp工具读写[项目工件]。
- 识别[项目工件]的类型:[Spec、Research、Decision、Epic、Story、Task、Retrospective]。
- 使用[ProjectId]将[项目工件]存储在basicmemory中对应的项目上下文下。
How to interact with [Project Artifacts] storage?
如何与[项目工件]存储交互?
CRITICAL All [Project Artifacts] are interacted with via basicmemory mcp tools.
FAILURE MODE Interacting with [Project Artifacts] via the file system directly is not allowed and will lead to disorganization and loss of data.
- basicmemory_read_note - Read markdown notes
- basicmemory_read_content - Read file raw content by path
- basicmemory_view_note - View formatted notes
- basicmemory_write_note - Create/update markdown notes
- basicmemory_edit_note - Edit existing notes with operations
- basicmemory_move_note - Move notes to new locations
- basicmemory_delete_note - Delete notes by title
- basicmemory_canvas - Create Obsidian canvas files
- basicmemory_search_notes - Search across knowledge base
- basicmemory_search - Search for content across knowledge base
- basicmemory_fetch - Fetch full contents of search results
- basicmemory_recent_activity - Get recent activity
- basicmemory_build_context - Build context from memory URIs
- basicmemory_list_memory_projects - List all available projects
- basicmemory_create_memory_project - Create new projects
- basicmemory_delete_project - Delete projects
- basicmemory_list_directory - List directory contents
- basicmemory_sync_status - Check file sync status
重要提醒 所有[项目工件]都必须通过basicmemory mcp工具进行交互。
错误场景 不允许直接通过文件系统操作[项目工件],否则会导致数据混乱和丢失。
- basicmemory_read_note - 读取markdown笔记
- basicmemory_read_content - 按路径读取文件原始内容
- basicmemory_view_note - 查看格式化后的笔记
- basicmemory_write_note - 创建/更新markdown笔记
- basicmemory_edit_note - 按操作编辑现有笔记
- basicmemory_move_note - 将笔记移动到新位置
- basicmemory_delete_note - 按标题删除笔记
- basicmemory_canvas - 创建Obsidian canvas文件
- basicmemory_search_notes - 跨知识库搜索笔记
- basicmemory_search - 跨知识库搜索内容
- basicmemory_fetch - 获取搜索结果的完整内容
- basicmemory_recent_activity - 获取最近活动记录
- basicmemory_build_context - 从内存URI构建上下文
- basicmemory_list_memory_projects - 列出所有可用项目
- basicmemory_create_memory_project - 创建新项目
- basicmemory_delete_project - 删除项目
- basicmemory_list_directory - 列出目录内容
- basicmemory_sync_status - 检查文件同步状态
Planning Artifact Frontmatter
规划工件Frontmatter
Frontmatter for planning artifacts is important. It must remain at the top of the markdown file as YAML, NOT as markdown code blocks.
规划工件的Frontmatter非常重要,必须以YAML格式放在markdown文件的顶部,不能放在markdown代码块中。
Understanding Frontmatter
了解Frontmatter
Templates contain YAML frontmatter blocks at the top, between delimiters:
---yaml
---
epic_id: 1
title: Epic Title
status: planned
priority: high
estimated_effort: 2 weeks
linked_spec:
- type: spec
target: 2.1.1-spec-title
---模板顶部包含YAML frontmatter块,位于分隔符之间:
---yaml
---
epic_id: 1
title: Epic Title
status: planned
priority: high
estimated_effort: 2 weeks
linked_spec:
- type: spec
target: 2.1.1-spec-title
---Rest of markdown content here
Rest of markdown content here
This is **actual YAML frontmatter**, not a markdown code block. When you create artifacts, this structure must be preserved exactly.这是**实际的YAML frontmatter**,不是markdown代码块。创建工件时必须严格保留该结构。Frontmatter Preservation Workflow
Frontmatter保留工作流
When creating or updating planning artifacts via :
Step 1: Parse Template File
basicmemory_write_note- Extract the frontmatter block (everything between first and second
---)--- - Extract the markdown body (everything after the closing )
--- - Keep them separate
Step 2: Assemble Content for basicmemory
The content passed to must be:
basicmemory_write_note
md
---
field1: value1
field2: value2
links:
- type: epic
target: 2.1.1-epic-title
---通过创建或更新规划工件时:
步骤1:解析模板文件
basicmemory_write_note- 提取frontmatter块(第一个和第二个
---之间的所有内容)--- - 提取markdown主体(结束之后的所有内容)
--- - 两者分开保存
步骤2:组装basicmemory所需内容
传递给的内容必须是:
basicmemory_write_note
md
---
field1: value1
field2: value2
links:
- type: epic
target: 2.1.1-epic-title
---Markdown Heading
Markdown Heading
Markdown body content here...
**Critical requirements:**
- Content MUST start with `---`
- Frontmatter block MUST end with `---`
- Blank line MUST separate frontmatter from markdown body
- All frontmatter fields from template MUST be preserved
- No `## Frontmatter` markdown sections
**Step 3: Call basicmemory_write_note**
```md
basicmemory_write_note(
title="artifact-title",
folder="2-epics", # or 1-prds, 3-research, etc.
content=assembled_content, # With frontmatter at top
entity_type="epic", # or spec, research, story, task, decision
tags=extracted_tags, # Optional, if tags are in frontmatter
project=project_id
)Step 4: basicmemory Handles the Rest
basicmemory automatically:
- Detects the YAML frontmatter (via )
has_frontmatter() - Parses all frontmatter fields
- Removes frontmatter from markdown body (via )
remove_frontmatter() - Preserves all fields in the final artifact as YAML frontmatter
- Converts back to proper markdown with YAML frontmatter
Markdown body content here...
**核心要求:**
- 内容必须以`---`开头
- Frontmatter块必须以`---`结束
- Frontmatter和markdown主体之间必须有空行分隔
- 必须保留模板中的所有frontmatter字段
- 不得出现`## Frontmatter`这类markdown章节
**步骤3:调用basicmemory_write_note**
```md
basicmemory_write_note(
title="artifact-title",
folder="2-epics", # or 1-prds, 3-research, etc.
content=assembled_content, # With frontmatter at top
entity_type="epic", # or spec, research, story, task, decision
tags=extracted_tags, # Optional, if tags are in frontmatter
project=project_id
)步骤4:剩余操作由basicmemory自动处理
basicmemory会自动:
- 检测YAML frontmatter(通过)
has_frontmatter() - 解析所有frontmatter字段
- 从markdown主体中移除frontmatter(通过)
remove_frontmatter() - 将所有字段作为YAML frontmatter保留在最终工件中
- 转换回带有YAML frontmatter的标准markdown格式
Field Mapping
字段映射
Template frontmatter fields become YAML frontmatter in the artifact:
- → stored in frontmatter as
epic_id: 1epic_id - → stored as
status: plannedstatus - → stored as
priority: highpriority - → stored as
estimated_effort: 2 weeksestimated_effort - → stored as YAML list in frontmatter
linked_spec: [...] - → stored as YAML list in frontmatter These are structured metadata fields, not markdown content.
derived_from: [...]
模板frontmatter字段会成为工件中的YAML frontmatter:
- → 作为
epic_id: 1存储在frontmatter中epic_id - → 作为
status: planned存储status - → 作为
priority: high存储priority - → 作为
estimated_effort: 2 weeks存储estimated_effort - → 作为YAML列表存储在frontmatter中
linked_spec: [...] - → 作为YAML列表存储在frontmatter中 这些是结构化元数据字段,不属于markdown内容。
derived_from: [...]
Common Mistake: Markdown Code Blocks
常见错误:Markdown代码块
❌ WRONG - Creates markdown code block, loses frontmatter:
md
---
title: Artifact Title
type: epic
permalink: some-path
---❌ 错误 - 生成markdown代码块,丢失frontmatter:
md
---
title: Artifact Title
type: epic
permalink: some-path
---Artifact Title
Artifact Title
Frontmatter
Frontmatter
```yaml
epic_idid: 1
status: planned
```
Rest of content...
✅ **CORRECT** - Preserves frontmatter as YAML:
```md
---
title: Artifact Title
type: epic
permalink: some-path
epic_id: 1
status: planned
---```yaml
epic_idid: 1
status: planned
```
Rest of content...
✅ **正确** - 将frontmatter保留为YAML格式:
```md
---
title: Artifact Title
type: epic
permalink: some-path
epic_id: 1
status: planned
---Artifact Title
Artifact Title
Rest of content...
undefinedRest of content...
undefinedImplementation Best Practices
实现最佳实践
- Always parse frontmatter carefully - Extract the YAML block as-is from the template
- Preserve field order - YAML field order matters for readability
- Validate YAML syntax - Ensure frontmatter is valid YAML before passing to basicmemory
- Include all template fields - Don't drop fields; merge with generated fields instead
- Use proper YAML lists - Use for list items in frontmatter, not JSON arrays
- - Test round-trip - After creation, verify the artifact has frontmatter, not markdown code blocks
- 始终谨慎解析frontmatter - 按原样从模板中提取YAML块
- 保留字段顺序 - YAML字段顺序对可读性很重要
- 验证YAML语法 - 传入basicmemory前确保frontmatter是有效的YAML
- 包含所有模板字段 - 不要丢弃字段,可与生成的字段合并
- 使用标准YAML列表 - frontmatter中列表项用,不要用JSON数组
- - 测试往返流程 - 创建完成后验证工件携带的是frontmatter,而非markdown代码块
[ProjectId] Naming and Format
[ProjectId]命名与格式
ProjectId Convention:
- Format: (kebab-case, lowercase alphanumeric + hyphens)
slugified-project-name - Source: Derived from git repository name or project name
- Generated by: (automatically slugifies)
./scripts/get_project_id.sh - Examples:
- Repository: → ProjectId:
github.com/username/dotfilesdotfiles - Project name: "User Authentication System" → ProjectId:
user-authentication-system - Example name "My App v2" → ProjectId:
my-app-v2
- Repository:
ProjectId规范:
- 格式:(短横线命名法,小写字母数字+连字符)
slugified-project-name - 来源:派生自git仓库名或项目名称
- 生成方式:(自动转换为短横线格式)
./scripts/get_project_id.sh - 示例:
- 仓库:→ ProjectId:
github.com/username/dotfilesdotfiles - 项目名称:"User Authentication System" → ProjectId:
user-authentication-system - 示例名称"My App v2" → ProjectId:
my-app-v2
- 仓库:
Creating new Projects
创建新项目
If you need to create a new project in basicmemory, always ensure that
- Follow the [ProjectId] naming convention.
- Confirm the project does not already exist by listing existing projects first.
- Store the project at ~/Notes/Projects/[ProjectId]
- Never store the project in the same folder as the repo you are working on.
如果需要在basicmemory中创建新项目,请始终确保:
- 遵循[ProjectId]命名规范
- 先列出已有项目,确认要创建的项目不存在
- 将项目存储在路径下
~/Notes/Projects/[ProjectId] - 不要将项目存储在你正在处理的代码仓库的同目录下