MCPInstall

memory-schema

Manage Basic Memory schemas: find unschemaed notes, infer and edit schemas, validate notes, detect drift. Use when structured note types (Task, Person, Meeting) need consistency across the graph.

Installs
1.2K
Last 24h
+12
Trending rank
#7881
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/basicmachines-co/basic-memory --skill memory-schema
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads memory-schema automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Memory 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:

  1. Search by type: bm_search(note_types=["meeting"]) — if many notes share a type but no schema/Meeting.md exists, it's a candidate.

  2. 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 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.

  3. 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 definition
  • entity: Meeting in metadata names the type it applies to
  • version: 1 in metadata — increment when making breaking changes
  • settings.validation: warn is 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

  • warn mode: Review warnings periodically. Fix notes that are clearly wrong; add optional fields to the schema for legitimate new patterns.
  • strict mode: 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:

  1. Run diff to see current state: bm_schema(command="diff", note_type="Meeting")
  2. Update the schema note via bm_edit with the metadata parameter. Top-level keys are replaced whole, so pass the complete updated schema map along with the new version:
    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"
        }
      }
    )
    
  3. Re-validate to confirm existing notes still pass: bm_schema(command="validate", note_type="Meeting")
  4. 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)

FAQ

What does the memory-schema skill do?

Manage Basic Memory schemas: find unschemaed notes, infer and edit schemas, validate notes, detect drift. Use when structured note types (Task, Person, Meeting) need consistency across the graph.

How do I install memory-schema?

Run npx skills add https://github.com/basicmachines-co/basic-memory --skill memory-schema in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/memory-schema/ (personal) or .claude/skills/memory-schema/ (project).

Which AI agents can use memory-schema?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is memory-schema safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains memory-schema?

It is published by basicmachines-co in basicmachines-co/basic-memory. It has 1,231 recorded installs.

More from basicmachines-co/basic-memory

View all →

memory-notes

basicmachines-co/basic-memory

How to write well-structured Basic Memory notes: frontmatter, categorized observations, wiki-link relations, and knowledge-graph best practices. Use when creating or improving notes.

Docs & Writing1.3K installs

memory-continue

basicmachines-co/basic-memory

Resume prior work by rebuilding context from the Basic Memory graph via memory:// URLs, recent activity, and search. Use at session start or on 'continue with...', 'back to...', 'where were we?'

1.3K installs

memory-capture

basicmachines-co/basic-memory

Capture a working thread's current state into one coherent Basic Memory note; on re-capture, rewrite it in place. Use mid- or end-of-thread when decisions, insights, or context are worth keeping.

1.3K installs

memory-curate

basicmachines-co/basic-memory

Curate the Basic Memory graph: link orphan notes, propose typed relations, merge duplicates, audit tags and folders, build hub notes. Use to organize and connect a knowledge base as notes accumulate.

Docs & Writing1.3K installs

memory-reflect

basicmachines-co/basic-memory

Sleep-time reflection: review recent Basic Memory activity and fold lasting decisions, lessons, and facts into the notes they belong in. Run 1-2x daily, on a heartbeat, or when asked.

memory-metadata-search

basicmachines-co/basic-memory

Search Basic Memory notes by custom frontmatter fields with equality, range, array, and nested filters. Use when finding notes by status, priority, confidence, or any YAML field, not free text.

Docs & Writing1.2K installs

Popular docs & writing skills

View category →

grill-with-docs

mattpocock/skills

A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.

Docs & Writing1.2M installs

lark-markdown

open.feishu.cn

飞书 Markdown:查看、创建、上传、编辑和比较飞书中的原生 Markdown 文件。当用户要操作飞书 Markdown 文件,或比较其远端版本及本地草稿时使用。纯本地 Markdown 文件操作不触发本 skill。不负责将 Markdown 导入为飞书在线文档,也不负责文件搜索、权限、评论、移动、删除等云空间管理操作。

Docs & Writing778.7K installs

writing-beats

mattpocock/skills

Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.

Docs & Writing490.7K installs

writing-shape

mattpocock/skills

Writing, exploit: shape raw material into an article, paragraph by paragraph.

Docs & Writing490.2K installs

writing-fragments

mattpocock/skills

Writing, explore: mine raw fragments, no structure yet.

Docs & Writing489.6K installs

writing-for-agents

mattpocock/skills

Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.

Docs & Writing479.3K installs