memory-schema by basicmachines-co/basic-memory-skills
npx skills add https://github.com/basicmachines-co/basic-memory-skills --skill memory-schema使用 Basic Memory 的 Picoschema 系统管理结构化笔记类型。模式定义了笔记类型应包含的字段,使笔记保持统一、可查询且可验证。
模式使用 Picoschema(一种描述笔记结构的紧凑表示法)在 YAML frontmatter 中定义。
schema:
name: string, 人员的全名
age: integer, 年龄(岁)
score: number, 浮点评分
active: boolean, 当前是否活跃
支持的类型:string、integer、number、boolean。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在字段名后附加 ?:
schema:
title: string, 必填字段
subtitle?: string, 可选字段
使用 (enum) 并列出允许的值:
schema:
status(enum): [active, blocked, done, abandoned], 当前状态
可选枚举:
schema:
priority?(enum): [low, medium, high, critical], 任务优先级
使用 (array) 表示列表字段:
schema:
tags(array): string, 分类标签
steps?(array): string, 完成任务的顺序步骤
直接引用其他实体类型:
schema:
parent_task?: Task, 父任务(如果这是子任务)
attendees?(array): Person, 参会人员
关系在知识图谱中创建边,将笔记链接在一起。
settings:
validation: warn # warn(记录问题)或 error(严格模式)
---
title: Meeting
type: schema
entity: Meeting
version: 1
schema:
topic: string, 讨论的主题
date: string, 发生时间 (YYYY-MM-DD)
attendees?(array): Person, 参会人员
decisions?(array): string, 做出的决策
action_items?(array): string, 后续任务
status?(enum): [scheduled, completed, cancelled], 会议状态
settings:
validation: warn
---
寻找共享结构但没有模式的笔记群组:
search_notes(query="type:Meeting") — 如果许多笔记共享 type 但不存在 schema/Meeting.md,则它是一个候选。schema_infer 分析现有笔记并生成建议的模式:
schema_infer(noteType="Meeting")
schema_infer(noteType="Meeting", threshold=0.5) # 出现在 50%+ 笔记中的字段
阈值(0.0–1.0)控制字段必须有多常见才能被包含。默认值通常没问题;降低它以捕获较罕见的字段。将模式笔记写入 schema/<实体名称>:
write_note(
title="Meeting",
directory="schema",
note_type="schema",
metadata={
"entity": "Meeting",
"version": 1,
"schema": {
"topic": "string, 讨论的主题",
"date": "string, 发生时间",
"attendees?(array)": "Person, 参会人员",
"decisions?(array)": "string, 做出的决策"
},
"settings": {"validation": "warn"}
},
content="""# Meeting
会议笔记的模式。
## 观察
- [convention] 会议笔记存放在 memory/meetings/ 或作为每日条目
- [convention] 始终包含日期和主题
- [convention] 复杂的行动项应转为任务"""
)
schema/ — 每个实体类型一个笔记note_type="schema" 将其标记为模式定义entity: Meeting 在元数据中命名其适用的类型version: 1 在元数据中 — 进行破坏性更改时递增settings.validation: warn 建议开始时使用 — 它会记录问题而不阻止写入检查现有笔记符合其模式的程度:
# 验证某个类型的所有笔记
schema_validate(noteType="Meeting")
# 验证单个笔记
schema_validate(identifier="meetings/2026-02-10-standup")
重要提示: schema_validate 将模式字段作为笔记正文中的观察类别进行检查 — 例如,status 字段期望 - [status] active 作为一个观察项。仅存储在 frontmatter 元数据中的字段无法通过验证。要顺利通过验证,应将模式字段同时作为 frontmatter 值(用于元数据搜索)和观察项(用于模式验证)包含。
验证报告:
warn 模式:定期审查警告。修复明显错误的笔记;对于合法的新模式,将可选字段添加到模式中。error 模式:用于严格模式,其中一致性很重要(例如,消费笔记的自动化流水线)。随着时间的推移,笔记会演变,模式会滞后。使用 schema_diff 来发现差异:
schema_diff(noteType="Meeting")
差异报告:
当笔记结构发生变化时:
schema_diff(noteType="Meeting")edit_note 更新模式笔记:
edit_note(
identifier="schema/Meeting",
operation="find_replace",
find_text="version: 1",
content="version: 2",
expected_replacements=1
)
schema: 块中添加/移除/修改字段schema_validate(noteType="Meeting")versionwarn,模式也可作为该类型笔记应包含内容的实时文档1. 注意到重复的笔记结构 → 推断模式 (schema_infer)
2. 审查 + 创建模式笔记 → 写入 schema/ (write_note)
3. 验证现有笔记 → 检查一致性 (schema_validate)
4. 修复异常值 → 编辑不符合的笔记 (edit_note)
5. 定期检查漂移 → 检测差异 (schema_diff)
6. 根据需要演进模式 → 更新模式笔记 (edit_note)
每周安装次数
31
仓库
GitHub 星标数
6
首次出现
2026年2月20日
安全审计
安装于
codex26
claude-code25
cursor24
gemini-cli24
github-copilot24
amp24
Manage structured note types using Basic Memory's Picoschema system. Schemas define what fields a note type should have, making notes uniform, queryable, and validatable.
Schemas are defined in YAML frontmatter using Picoschema — a compact notation for describing note structure.
schema:
name: string, person's full name
age: integer, age in years
score: number, floating-point rating
active: boolean, whether currently active
Supported types: string, integer, number, boolean.
Append ? to the field name:
schema:
title: string, required field
subtitle?: string, optional field
Use (enum) with a list of allowed values:
schema:
status(enum): [active, blocked, done, abandoned], current state
Optional enum:
schema:
priority?(enum): [low, medium, high, critical], task priority
Use (array) for list fields:
schema:
tags(array): string, categorization labels
steps?(array): string, ordered steps to complete
Reference other entity types directly:
schema:
parent_task?: Task, parent task if this is a subtask
attendees?(array): Person, people who attended
Relations create edges in the knowledge graph, linking notes together.
settings:
validation: warn # warn (log issues) or error (strict)
---
title: Meeting
type: schema
entity: Meeting
version: 1
schema:
topic: string, what was discussed
date: string, when it happened (YYYY-MM-DD)
attendees?(array): Person, who attended
decisions?(array): string, decisions made
action_items?(array): string, follow-up tasks
status?(enum): [scheduled, completed, cancelled], meeting state
settings:
validation: warn
---
Look for clusters of notes that share structure but have no schema:
Search by type : search_notes(query="type:Meeting") — if many notes share a type but no schema/Meeting.md exists, it's a candidate.
Infer a schema : Use schema_infer to analyze existing notes and generate a suggested schema:
schema_infer(noteType="Meeting")
schema_infer(noteType="Meeting", threshold=0.5) # fields in 50%+ of notes
The threshold (0.0–1.0) controls how common a field must be to be included. Default is usually fine; lower it to catch rarer fields.
Write the schema note to schema/<EntityName>:
write_note(
title="Meeting",
directory="schema",
note_type="schema",
metadata={
"entity": "Meeting",
"version": 1,
"schema": {
"topic": "string, what was discussed",
"date": "string, when it happened",
"attendees?(array)": "Person, who attended",
"decisions?(array)": "string, decisions made"
},
"settings": {"validation": "warn"}
},
content="""# Meeting
Schema for meeting notes.
## Observations
- [convention] Meeting notes live in memory/meetings/ or as daily entries
- [convention] Always include date and topic
- [convention] Action items should become tasks when complex"""
)
schema/ — one note per entity typenote_type="schema" marks it as a schema definitionentity: Meeting in metadata names the type it applies toversion: 1 in metadata — increment when making breaking changessettings.validation: warn is recommended to start — it logs issues without blocking writesCheck how well existing notes conform to their schema:
# Validate all notes of a type
schema_validate(noteType="Meeting")
# Validate a single note
schema_validate(identifier="meetings/2026-02-10-standup")
Important: schema_validate checks for schema fields as observation categories in the note body — e.g., a status field expects - [status] active as an observation. Fields stored only in frontmatter metadata won't satisfy validation. To pass cleanly, include schema fields as both frontmatter values (for metadata search) and observations (for schema validation).
Validation reports:
warn mode: Review warnings periodically. Fix notes that are clearly wrong; add optional fields to the schema for legitimate new patterns.error mode: Use for strict schemas where conformance matters (e.g., automated pipelines consuming notes).Over time, notes evolve and schemas lag behind. Use schema_diff to find divergence:
schema_diff(noteType="Meeting")
Diff reports:
When note structure changes:
Run diff to see current state: schema_diff(noteType="Meeting")
Update the schema note via edit_note:
edit_note(
identifier="schema/Meeting",
operation="find_replace",
find_text="version: 1",
content="version: 2",
expected_replacements=1
)
Add/remove/modify fields in the schema: block
Re-validate to confirm existing notes still pass: schema_validate(noteType="Meeting")
Fix outliers — update notes that don't conform to the new schema
versionwarn, the schema serves as living documentation for what notes of that type should contain1. Notice repeated note structure → infer schema (schema_infer)
2. Review + create schema note → write to schema/ (write_note)
3. Validate existing notes → check conformance (schema_validate)
4. Fix outliers → edit non-conforming notes (edit_note)
5. Periodically check drift → detect divergence (schema_diff)
6. Evolve schema as needed → update schema note (edit_note)
Weekly Installs
31
Repository
GitHub Stars
6
First Seen
Feb 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex26
claude-code25
cursor24
gemini-cli24
github-copilot24
amp24
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
44,900 周安装