About memory-schema
memory-schema is a skill for managing structured note types with Basic Memory’s Picoschema system. It helps maintain consistent, searchable note fields by inferring schemas, validating notes, detecting drift, and evolving schema definitions.
Key features
- 01Define note fields in YAML
- 02Infer schemas from existing notes
- 03Validate notes against schemas
- 04Detect differences between notes and schemas
- 05Evolve schema definitions
Use cases
- 01Standardizing repeated meeting notes
- 02Checking records for missing required fields
- 03Finding fields that have drifted from a schema
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ basicmachines-co/ basic-memory --skill memory-schemaAfter installing, type/memory-schemain Claude Code to confirm it loaded.
Details
From the project READMEMemory Schema
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.
When to Use
- New note type emerging — you notice several notes share the same structure (meetings, people, decisions)
- Validation check — confirm existing notes conform to their schema
- Schema drift — detect fields that notes use but the schema doesn't define (or vice versa)
- Schema evolution — add/remove/change fields as requirements evolve
- On demand — user asks to create, check, or manage schemas
Picoschema Syntax Reference
Schemas are defined in YAML frontmatter using Picoschema — a compact notation for describing note structure.
Basic Types
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.
Optional Fields
Append ? to the field name:
schema:
title: string, required field
subtitle?: string, optional field
Enums
Use (enum) with a list of allowed values:
schema:
status(enum, current state): [active, blocked, done, abandoned]
Optional enum:
schema:
priority?(enum, task priority): [low, medium, high, critical]
Arrays
Use (array) for list fields:
schema:
tags(array): string, categorization labels
steps?(array): string, ordered steps to complete
Relations
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.
Validation Settings
settings:
validation: warn # warn (log issues) or strict (errors)
Use strict as the canonical enforcing mode. error is accepted only as a compatibility alias.
Complete Example
---
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, meeting state): [scheduled, completed, cancelled]
settings:
validation: warn
---
Discovering Unschemaed Notes
Look for clusters of notes that share structure but have no schema:
-
Search by type:
bm_search(note_types=["meeting"])— if many notes share atypebut noschema/Meeting.mdexists, it's a candidate. -
Infer a schema: Use
bm_schema(command="infer")to analyze existing notes and generate a suggested schema:bm_schema(command="infer", note_type="Meeting") bm_schema(command="infer", note_type="Meeting", threshold=0.5) # fields in 50%+ of notesThe 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.
-
Review the suggestion — the inferred schema shows field names, types, and frequency. Decide which fields to keep, make optional, or drop.
Creating a Schema
Write the schema note to schema/<EntityName>:
bm_write(
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"""
)
Key Principles
- Schema notes live in
schema/— one note per entity type note_type="schema"marks it as a schema definitionentity: Meetingin metadata names the type it applies toversion: 1in metadata — increment when making breaking changessettings.validation: warnis recommended to start — it logs issues without blocking writes
Validating Notes
Check how well existing notes conform to their schema:
# Validate all notes of a type
bm_schema(command="validate", note_type="Meeting")
# Validate a single note
bm_schema(command="validate", identifier="meetings/2026-02-10-standup")
Important: bm_schema(command="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 missing required fields (as observation categories, or relations for entity-reference fields) and invalid enum values. Undeclared observation categories and relations are listed as informational "unmatched" items. Scalar values are not type-checked.
Handling Validation Results
warnmode: Review warnings periodically. Fix notes that are clearly wrong; add optional fields to the schema for legitimate new patterns.strictmode: Use where conformance matters (e.g., automated pipelines consuming notes).
Detecting Drift
Over time, notes evolve and schemas lag behind. Use bm_schema(command="diff") to find divergence:
bm_schema(command="diff", note_type="Meeting")
Diff reports:
- Fields in notes but not in schema — candidates for adding to the schema (as optional)
- Schema fields rarely used — consider making optional or removing
- Cardinality changes — a field that moved between single-value and array
Schema Evolution
When note structure changes:
- Run diff to see current state:
bm_schema(command="diff", note_type="Meeting") - Update the schema note via
bm_editwith themetadataparameter. Top-level keys are replaced whole, so pass the complete updatedschemamap along with the newversion:bm_edit( identifier="schema/Meeting", command="set_metadata", metadata={ "version": 2, "schema": { "topic": "string, what was discussed", "date": "string, when it happened", "attendees?(array)": "Person, who attended", "decisions?(array)": "string, decisions made", "location?": "string, where it happened" } } ) - Re-validate to confirm existing notes still pass:
bm_schema(command="validate", note_type="Meeting") - Fix outliers — update notes that don't conform to the new schema
Evolution Guidelines
- Additive changes (new optional fields) are safe — no version bump needed
- Breaking changes (new required fields, removed fields, type changes) should bump
version - Prefer optional over required — most fields should be optional to start
- Don't over-constrain — schemas should describe common structure, not enforce rigid templates
- Schema as documentation — even if validation is set to
warn, the schema serves as living documentation for what notes of that type should contain
Workflow Summary
1. Notice repeated note structure → infer schema (bm_schema(command="infer"))
2. Review + create schema note → write to schema/ (bm_write)
3. Validate existing notes → check conformance (bm_schema(command="validate"))
4. Fix outliers → edit non-conforming notes (bm_edit)
5. Periodically check drift → detect divergence (bm_schema(command="diff"))
6. Evolve schema as needed → update schema note (bm_edit)