The mnemonic-validate tool validates memory files against the MIF Level 3 schema.
# Validate all memories (default paths)
./tools/mnemonic-validate
# Validate specific directory
./tools/mnemonic-validate ${MNEMONIC_ROOT}
# JSON output for CI/CD
./tools/mnemonic-validate --format json
# Using make targets
make validate-memories
make validate-memories-ciThe validation tool is included with the mnemonic plugin. No additional installation required.
Dependencies: Python 3.9+ with PyYAML (included in most Python installations).
mnemonic-validate [options] [path...]
Options:
--format json|markdown Output format (default: markdown)
--check TYPE Only validate: code_refs|citations|links|schema
--skip-http Skip HTTP checks (offline mode)
--fast-fail Stop on first error
--changed Only validate git-modified files
--capture Capture validation run as episodic memory
-v, --verbose Verbose output
-h, --help Show this helpIf no path is specified, the tool searches:
${MNEMONIC_ROOT}/(global memories)${MNEMONIC_ROOT}/(project memories)
Validates MIF Level 3 required fields and formats:
| Field | Validation |
|---|---|
id |
Must be valid UUID v4 format (lowercase) |
type |
Must be semantic, episodic, or procedural |
namespace |
Should follow pattern {namespace}/{scope} |
created |
Must be valid ISO 8601 timestamp |
title |
Must be non-empty string |
Additional checks:
provenance.confidenceshould be between 0.0 and 1.0tagsshould be lowercase with hyphensvalid_fromshould be before or equal torecorded_at
For memories with code_refs:
typeshould be one of:function,class,method,variable,type,modulefilepath should exist (relative to git root)linenumber should be within file length
For memories with citations:
type(required) must be:paper,documentation,blog,github,stackoverflow,articletitle(required) must be non-emptyurl(required) must be valid URL formatrelevance(optional) should be between 0.0 and 1.0
Validates [[uuid]] patterns in memory body:
- UUID format must be valid
- (Future: referenced memory should exist)
# Mnemonic Validation Report
**Date:** 2026-01-24T10:30:00Z
## Summary
- **Memories validated:** 145
- **Valid:** 142
- **Errors:** 3
- **Warnings:** 5
## Errors
### abc123-example.memory.md
- **type**: Missing required field: type
- **id** (line 2): Invalid UUID format: not-a-uuid
## Warnings
### def456-other.memory.md
- **tags**: Tag should be lowercase with hyphens: CamelCase{
"timestamp": "2026-01-24T10:30:00Z",
"summary": {
"total": 145,
"valid": 142,
"errors": 3,
"warnings": 5
},
"results": [
{
"file": "abc123-example.memory.md",
"valid": false,
"errors": [
{
"file": "abc123-example.memory.md",
"field": "type",
"message": "Missing required field: type",
"line": null,
"severity": "error"
}
],
"warnings": []
}
]
}0: All validations passed1: One or more errors found
name: Validate Memories
on:
push:
paths:
- '**/*.memory.md'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Validate memories
run: ./tools/mnemonic-validate --format json
- name: Validate changed only
if: github.event_name == 'pull_request'
run: ./tools/mnemonic-validate --changed --format jsonAdd to .pre-commit-config.yaml:
repos:
- repo: local
hooks:
- id: validate-memories
name: Validate memory files
entry: ./tools/mnemonic-validate --changed --fast-fail
language: python
types: [markdown]
files: \.memory\.md$Use --capture to save validation results as an episodic memory:
./tools/mnemonic-validate --captureThis creates a memory in:
blockers/projectif errors were foundepisodic/projectif validation passed
The captured memory includes:
- Summary statistics
- List of errors and warnings
- Timestamp and provenance
This enables tracking validation history over time via mnemonic search.
# Validate with markdown output
make validate-memories
# Validate with JSON output (for CI)
make validate-memories-ci
# Validate only changed files
make validate-memories-changedEnsure you're running from the mnemonic plugin directory or have set up paths correctly.
Check that:
- Memory files end with
.memory.md - The search paths contain memory files
- For
--changed, files are tracked by git
If frontmatter fails to parse:
- Check for invalid YAML syntax
- Ensure the file starts with
--- - Verify closing
---exists
The validation rules are parsed from skills/format/SKILL.md, ensuring a single source of truth between documentation and validation (see ADR-004).