Memory Schema logo

Memory Schema

OrganizationPopular
basicmachines-co
memory-schema

Schema lifecycle management for Basic Memory: discover unschemaed notes, infer schemas, create and edit schema definitions, validate notes, and detect drift. Use when working with structured note types (Task, Person, Meeting, etc.) to maintain consistency across the knowledge graph.

Overview

Publisherbasicmachines-co
Repositorybasic-memory
Skill namememory-schema
Stars
4K
Forks
283
Bundled files
Instructions only
LicenseAGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by basicmachines-co on GitHub. Read the source before you install it.

Installation

Install the Memory Schema AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/basicmachines-co/basic-memory.git /tmp/basic-memory
mkdir -p .claude/skills
cp -r /tmp/basic-memory/skills/memory-schema .claude/skills/memory-schema
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Memory Schema in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Memory Schema on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Memory Schema is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

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

yaml
schema:
  title: string, required field
  subtitle?: string, optional field

Enums

Use (enum) with a list of allowed values:

yaml
schema:
  status(enum, current state): [active, blocked, done, abandoned]

Optional enum:

yaml
schema:
  priority?(enum, task priority): [low, medium, high, critical]

Arrays

Use (array) for list fields:

yaml
schema:
  tags(array): string, categorization labels
  steps?(array): string, ordered steps to complete

Relations

Reference other entity types directly:

yaml
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

yaml
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

yaml
---
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: search_notes(query="type:Meeting") — if many notes share a type but no schema/Meeting.md exists, it's a candidate.

  2. Infer a schema: Use schema_infer to analyze existing notes and generate a suggested schema:

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

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

python
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"""
)

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:

python
# 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:

  • Missing required fields — the note lacks a field the schema requires (as an observation category)
  • Unknown fields — the note has fields the schema doesn't define
  • Type mismatches — a field value doesn't match the expected type
  • Invalid enum values — a value isn't in the allowed set

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 schema_diff to find divergence:

python
schema_diff(noteType="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
  • Type inconsistencies — fields used as different types across notes

Schema Evolution

When note structure changes:

  1. Run diff to see current state: schema_diff(noteType="Meeting")
  2. Update the schema note via edit_note:
    python
    edit_note(
      identifier="schema/Meeting",
      operation="find_replace",
      find_text="version: 1",
      content="version: 2",
      expected_replacements=1
    )
  3. Add/remove/modify fields in the schema: block
  4. Re-validate to confirm existing notes still pass: schema_validate(noteType="Meeting")
  5. 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 (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)

Frequently asked questions

What does the Memory Schema AI skill do?

Schema lifecycle management for Basic Memory: discover unschemaed notes, infer schemas, create and edit schema definitions, validate notes, and detect drift. Use when working with structured note types (Task, Person, Meeting, etc.) to maintain consistency across the knowledge graph.

Why use Memory Schema on TypingMind?

Because you install it once and use it with any model. Memory Schema is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Memory Schema in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/basicmachines-co/basic-memory/tree/main/skills/memory-schema. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Memory Schema?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Memory Schema?

As many as you like. As long as a model supports skills, you can use Memory Schema with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Memory Schema AI skill free?

Yes. It is published on GitHub by basicmachines-co under the AGPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇