| diataxis_type | reference |
|---|
This directory contains ontology definitions for the Memory Interchange Format.
The base ontology defines the namespace hierarchy for the three base memory types.
Important: Namespace paths use an underscore prefix (_semantic, _episodic, _procedural) to distinguish base type namespaces from domain-specific namespaces. This convention ensures consistent namespace identification across implementations.
_semantic/ # Facts, concepts, relationships
├── decisions/ # Architectural choices, rationale
├── knowledge/ # APIs, context, learnings, security
└── entities/ # Entity definitions
_episodic/ # Events, experiences, timelines
├── incidents/ # Production issues, postmortems
├── sessions/ # Debug sessions, work sessions
└── blockers/ # Impediments, issues
_procedural/ # Step-by-step processes
├── runbooks/ # Operational procedures
├── patterns/ # Code conventions, testing
└── migrations/ # Migration steps, upgrades
Ontologies can inherit traits from other ontologies using the extends field:
ontology:
id: my-domain
version: "1.0.0"
extends:
- mif-base # Core traits (timestamped, confidence, provenance)
- shared-traits # Cross-domain traits (lifecycle, auditable, located, etc.)The base ontology defines foundational traits:
| Trait | Description | Fields |
|---|---|---|
timestamped |
Creation/update timestamps | created_at, updated_at |
confidence |
Memory decay score | confidence (0.0-1.0) |
provenance |
Source tracking | source, author |
Cross-domain reusable traits for industry ontologies:
| Category | Traits |
|---|---|
| Lifecycle | lifecycle, renewable |
| Compliance | auditable, certified, regulated |
| Geographic | located, bounded |
| Stakeholder | owned, contactable |
| Financial | budgeted, transactional |
| Temporal | scheduled, seasonal |
| Measurement | measured, scored |
| Classification | categorized, tagged |
| Asset | inventoried, maintainable |
| Quality | reviewed, quality_controlled |
Domain ontologies compose these traits into entity types:
entity_types:
- name: soil-profile
base: semantic
traits:
- measured # From shared-traits
- located # From shared-traits
- provenance # From mif-base
schema:
properties:
organic_matter_percent: { type: number }When an ontology declares extends, the following inheritance rules apply:
-
Traits: All traits from parent ontologies become available to entity types in the child ontology. Traits are inherited by reference and merged additively.
-
Relationships: Relationship type definitions are inherited. Child ontologies can extend the
from/toconstraints to include additional entity types. -
Namespaces: Parent namespace hierarchies are inherited. Child ontologies can:
- Add sibling namespaces at any level
- Add child namespaces to inherited parents
- Override
descriptionortype_hintfor inherited namespaces - Cannot remove or rename inherited namespaces
-
Discovery Patterns: Parent discovery patterns are inherited and merged with child patterns. When patterns conflict (same pattern string), the child pattern takes precedence.
-
Entity Types: Entity types are NOT inherited automatically. Child ontologies must explicitly define their own entity types, but can reference inherited traits.
When multiple ontologies are listed in extends, they are processed in order:
extends:
- mif-base # Processed first
- shared-traits # Processed second (overrides mif-base on conflict)Later entries override earlier entries for conflicting definitions.
Memories are stored using hierarchical namespace paths:
# User-level (includes org and project)
${MNEMONIC_ROOT}/{org}/{project}/{namespace}/
# Project-level (namespace only)
./.claude/mnemonic/{namespace}/
Examples:
${MNEMONIC_ROOT}/zircote/mif/_semantic/decisions/./.claude/mnemonic/_procedural/patterns/
Path contexts:
${MNEMONIC_ROOT}/{org}/{project}/is the user-level storage path (external to the repository). Project-level.claude/mnemonic/is for embedded project memories.
Choose namespaces based on memory type:
| Memory Type | Namespace | Description |
|---|---|---|
| Architectural choices | _semantic/decisions |
Why we chose X over Y |
| API/technical facts | _semantic/knowledge |
How X works |
| Component definitions | _semantic/entities |
What X is |
| Production issues | _episodic/incidents |
When X broke |
| Debug sessions | _episodic/sessions |
Work session notes |
| Blockers/impediments | _episodic/blockers |
What's blocking progress |
| Operational procedures | _procedural/runbooks |
How to deploy X |
| Code conventions | _procedural/patterns |
How we write X |
| Upgrade steps | _procedural/migrations |
How to migrate to X |
MIF memories can explicitly declare which ontology they conform to using the ontology field:
---
id: 550e8400-e29b-41d4-a716-446655440000
type: semantic
created: 2026-01-26T10:00:00Z
ontology:
id: regenerative-agriculture
version: "0.1.0"
uri: https://github.com/zircote/MIF/ontologies/examples/regenerative-agriculture.ontology.yaml
namespace: _semantic/livestock
---{
"@context": "https://mif-spec.dev/schema/context.jsonld",
"@type": "Memory",
"@id": "urn:mif:550e8400",
"ontology": {
"@type": "OntologyReference",
"id": "regenerative-agriculture",
"version": "0.1.0",
"uri": "https://github.com/zircote/MIF/ontologies/examples/regenerative-agriculture.ontology.yaml"
},
"namespace": "_semantic/livestock",
"content": "..."
}| Field | Required | Description |
|---|---|---|
id |
Yes | Ontology identifier (must match ontology.id in definition) |
version |
No | Semantic version (e.g., "1.0.0") |
uri |
No | URL to the ontology definition file |
The examples/ directory contains domain-specific ontologies:
software-engineering.ontology.yaml- Software development entitiesregenerative-agriculture.ontology.yaml- Farm operations and carbon marketsk12-educational-publishing.ontology.yaml- Educational content publishingbiology-research-lab.ontology.yaml- Academic research lab operationsbackstage.ontology.yaml- Backstage.io developer portal entitiescsi-5w1h.ontology.yaml- CSI 5W1H investigative frameworkshared-traits.ontology.yaml- Reusable trait mixins
-
Create an
ontology.yamlfile in your project:./.claude/mnemonic/ontology.yaml -
Define custom namespaces, entity types, and discovery patterns:
ontology: id: my-project version: "1.0.0" namespaces: features: description: "Product features" type_hint: semantic entity_types: - name: feature base: semantic schema: required: [name, status] properties: name: { type: string } status: { type: string, enum: [planned, active, deprecated] }
Convert YAML ontologies to JSON-LD for semantic web compatibility:
python scripts/yaml2jsonld.py ontologies/mif-base.ontology.yaml
python scripts/yaml2jsonld.py --all # Convert allPrerequisites:
pip install pyyaml(PyYAML is required for YAML processing)