Memory
Search first: /mnemonic:search {relevant_keywords}
Capture after: /mnemonic:capture {namespace} "{title}"
Run /mnemonic:list --namespaces to see available namespaces from loaded ontologies.
Mnemonic Format Skill
MIF Level 3 specification, templates, and formatting guidelines.
Trigger Phrases
- •"memory format"
- •"MIF format"
- •"frontmatter template"
- •"memory template"
- •"mnemonic schema"
Overview
MIF Level 3 specification. Start minimal, add fields as needed.
Quick Start: Minimal Memory
Only 4 fields are required. Everything else is optional.
--- id: 550e8400-e29b-41d4-a716-446655440000 title: "Human-readable title" type: semantic created: 2026-01-23T10:30:00Z --- # Title Content here.
That's it. Add optional fields only when you need them.
File Naming
{uuid}-{slug}.memory.md
- •uuid: Lowercase UUID v4
- •slug: URL-safe title, max 50 chars
Optional Fields Reference
Add these when relevant:
---
# REQUIRED (always include these 4)
id: 550e8400-e29b-41d4-a716-446655440000
title: "Human-readable title"
type: semantic
created: 2026-01-23T10:30:00Z
# COMMON (add when useful)
modified: 2026-01-23T14:22:00Z
namespace: _semantic/decisions/project
tags:
- architecture
- database
# === PROGRESSIVE DISCLOSURE ===
summary: "PostgreSQL chosen for ACID compliance and JSON support"
detail_level: comprehensive # minimal | standard | comprehensive
related_memories: [] # UUIDs of related memories
supersedes: [] # UUIDs of memories this one replaces
# === BI-TEMPORAL TRACKING ===
temporal:
valid_from: 2026-01-23T00:00:00Z # When fact became true
valid_until: null # When fact expired (null = current)
recorded_at: 2026-01-23T10:30:00Z # When captured in system
ttl: P90D # ISO 8601 duration until expiry
decay:
model: exponential # Decay algorithm
half_life: P7D # Time to 50% relevance
strength: 0.85 # Current relevance score 0-1
access_count: 5 # Times recalled
last_accessed: 2026-01-23T14:22:00Z # Last recall timestamp
# === PROVENANCE ===
provenance:
source_type: conversation # user_explicit | inferred | conversation
source_ref: file:///path/to/source.ts:42
agent: claude-opus-4 # Capturing agent
confidence: 0.95 # Certainty score 0-1
session_id: abc123 # Claude session ID
# === CODE STRUCTURE AWARENESS ===
code_refs:
- file: src/auth/handler.ts
line: 42
symbol: authenticateUser
type: function # function | class | method | variable | type
# === CITATIONS ===
citations:
- type: documentation # paper | documentation | blog | github | stackoverflow | article
title: "Source Title"
url: https://example.com/source
author: "Author Name" # optional
date: 2026-01-23 # publication date, optional
accessed: 2026-01-23T10:30:00Z # when accessed, optional
relevance: 0.90 # how relevant to memory 0.0-1.0, optional
note: "Brief description" # optional context
# === CONFLICT TRACKING ===
conflicts:
- memory_id: xyz789
resolution: merged # merged | invalidated | skipped
resolved_at: 2026-01-23T12:00:00Z
# === COMPRESSION (Auto-generated) ===
summary: "Concise 2-3 sentence summary (max 500 chars)" # Auto-generated by gc --compress
compressed_at: 2026-01-24T10:00:00Z # When compression occurred
---
# Memory Title
Main content in markdown format.
## Section 1
Detailed information...
## Rationale
Why this decision/pattern/learning matters.
## Relationships
- relates-to [[other-memory-id]]
- supersedes [[old-memory-id]]
- derived-from [[source-memory-id]]
## Entities
- mentions @[[PostgreSQL]]
- uses @[[JWT Authentication]]
Field Reference
Required Fields
| Field | Type | Description |
|---|---|---|
id | UUID | Unique identifier (v4, lowercase) |
type | enum | Cognitive type: semantic, episodic, procedural |
namespace | string | Category/scope: _semantic/decisions, _semantic/knowledge, _procedural/patterns, etc. |
created | ISO 8601 | Creation timestamp with timezone |
title | string | Human-readable title in quotes |
Recommended Fields
| Field | Type | Description |
|---|---|---|
modified | ISO 8601 | Last modification timestamp |
tags | list | Categorization tags (lowercase, hyphenated) |
Progressive Disclosure Fields
| Field | Type | Description |
|---|---|---|
summary | string | 1-2 sentence summary for Level 1 recall (max 200 chars) |
detail_level | enum | minimal, standard, comprehensive |
related_memories | list | UUIDs of related memories for cross-reference |
supersedes | list | UUIDs of memories this one replaces |
Temporal Fields
| Field | Type | Description |
|---|---|---|
valid_from | ISO 8601 | When the fact actually became true |
valid_until | ISO 8601 | When the fact became outdated (null if current) |
recorded_at | ISO 8601 | When captured in the system |
ttl | ISO 8601 duration | Time-to-live (e.g., P90D = 90 days) |
decay.model | string | exponential, linear, step |
decay.half_life | ISO 8601 duration | Time to 50% relevance |
decay.strength | float | Current relevance 0.0-1.0 |
access_count | integer | Number of recalls |
last_accessed | ISO 8601 | Most recent recall |
Provenance Fields
| Field | Type | Description |
|---|---|---|
source_type | enum | user_explicit, inferred, conversation |
source_ref | URI | Source location (file, URL, etc.) |
agent | string | Agent that captured (e.g., claude-opus-4) |
confidence | float | Certainty score 0.0-1.0 |
session_id | string | Session identifier |
Code Reference Fields
| Field | Type | Description |
|---|---|---|
file | string | Relative file path |
line | integer | Line number |
symbol | string | Symbol name |
type | enum | function, class, method, variable, type, module |
Citation Fields
| Field | Type | Description |
|---|---|---|
type | enum | paper, documentation, blog, github, stackoverflow, article (required) |
title | string | Human-readable title of source (required) |
url | string | Full URL to source material (required) |
author | string | Author name (optional) |
date | date | Publication date YYYY-MM-DD (optional) |
accessed | ISO 8601 | When source was accessed (optional) |
relevance | float | How relevant to memory 0.0-1.0 (optional) |
note | string | Brief description of what this citation provides (optional) |
Compression Fields (Auto-generated)
These fields are added automatically by /mnemonic:gc --compress:
| Field | Type | Description |
|---|---|---|
summary | string | Concise 2-3 sentence summary (max 500 chars) |
compressed_at | ISO 8601 | When compression was performed |
Compression is applied to memories that:
- •Are older than 30 days AND have > 100 lines, OR
- •Have strength < 0.3 AND have > 100 lines
The summary field enables quick scanning without reading full content. Original content is preserved.
Cognitive Memory Types
Semantic (Facts & Concepts)
Use for: API documentation, technical specifications, definitions, configurations
Indicators:
- •"X is Y"
- •Definitions
- •Documentation
- •Specifications
- •Configuration values
Example:
--- id: abc123 type: semantic namespace: _semantic/knowledge/project title: "REST API Authentication Endpoint" tags: - api - authentication --- # REST API Authentication Endpoint POST /api/v1/auth/login ## Request - email: string (required) - password: string (required) ## Response - token: JWT access token - expires_in: seconds until expiry
Episodic (Events & Experiences)
Use for: Debug sessions, incidents, deployments, meetings, discoveries
Indicators:
- •"On [date], we..."
- •"When we tried..."
- •Timestamps
- •Narratives
- •Incident reports
Example:
--- id: def456 type: episodic namespace: _episodic/sessions/blockers/project title: "Database connection timeout incident" tags: - incident - database - resolved temporal: valid_from: 2026-01-20T14:30:00Z recorded_at: 2026-01-20T16:00:00Z --- # Database Connection Timeout Incident ## What Happened On 2026-01-20 at 14:30 UTC, production database connections started timing out. ## Root Cause Connection pool exhaustion due to unclosed connections in the batch processor. ## Resolution Added connection.close() in finally block. Deployed fix at 15:45 UTC. ## Prevention - Added connection pool monitoring - Set max connection lifetime to 5 minutes
Procedural (Processes & Workflows)
Use for: Deployment steps, configuration procedures, how-to guides, workflows
Indicators:
- •"To do X, first..."
- •Step-by-step instructions
- •Sequences
- •Procedures
- •Runbooks
Example:
--- id: ghi789 type: procedural namespace: _procedural/patterns/project title: "Database migration procedure" tags: - database - deployment - procedure --- # Database Migration Procedure ## Prerequisites - Database backup completed - Maintenance window scheduled - Rollback script prepared ## Steps 1. Enable maintenance mode ```bash ./scripts/maintenance.sh enable
- •
Run migrations
bashnpm run db:migrate
- •
Verify migrations
bashnpm run db:verify
- •
Disable maintenance mode
bash./scripts/maintenance.sh disable
Rollback
If step 3 fails:
npm run db:rollback
---
## Namespace Reference
| Namespace | Purpose | Memory Type |
|-----------|---------|-------------|
| `_semantic/decisions/` | Architectural choices, rationale | semantic |
| `_semantic/knowledge/` | APIs, context, learnings, security | semantic |
| `_semantic/entities/` | Entity definitions (technologies, components) | semantic |
| `_episodic/incidents/` | Production issues, postmortems | episodic |
| `_episodic/sessions/` | Debug sessions, work sessions | episodic |
| `_episodic/blockers/` | Impediments, issues | episodic |
| `_procedural/runbooks/` | Operational procedures | procedural |
| `_procedural/patterns/` | Code conventions, testing strategies | procedural |
| `_procedural/migrations/` | Migration steps, upgrade procedures | procedural |
### Memory Scope
- **Project**: `{org}/{project}/{namespace}/` - Specific to current codebase
- **Organization**: `{org}/{namespace}/` - Shared across projects in org
---
## Progressive Disclosure Structure
Every comprehensive memory should include three disclosure levels in the body:
### Level 1: Quick Answer (Default Recall)
The `## Quick Answer` section provides a 1-3 sentence summary. This is what Claude returns first when recalling a memory.
**Triggers for Level 1:** "What is X?", "Which X do we use?", basic recall
### Level 2: Context (Expanded Recall)
The `## Context` section provides:
- Decision date/timeframe
- Alternatives considered
- Key decision drivers
- Trade-offs made
**Triggers for Level 2:** "Why?", "Tell me more", "Explain the reasoning"
### Level 3: Comprehensive (Full Detail)
The `## Full Detail` section includes:
- Complete alternatives analysis
- Implementation notes
- Related decisions/patterns
- Code references
- Citations
**Triggers for Level 3:** "All details", "Full context", implementation work, debugging
### Progressive Disclosure Template
```markdown
# {Title}
## Quick Answer
{1-3 sentence summary answering "what" and "why briefly"}
## Context
- **Decision date:** {date}
- **Alternatives considered:** {list}
- **Key drivers:** {factors that led to decision}
- **Trade-offs:** {what was sacrificed}
## Full Detail
### Alternatives Analysis
1. **{Option 1}**: {pros/cons, why rejected or chosen}
2. **{Option 2}**: {pros/cons, why rejected or chosen}
### Implementation Notes
- {Specific implementation details}
- {Configuration requirements}
- {File locations}
### Related Decisions
- See: [[{related-memory-id}]] for {context}
### Code References
- {file:line} - {description}
### Citations
- {source title} - {url}
Relationship Syntax
Memory Links
## Relationships - relates-to [[550e8400-e29b-41d4-a716-446655440000]] - supersedes [[old-memory-id]] - derived-from [[source-memory-id]] - contradicts [[conflicting-memory-id]] - implements [[design-memory-id]]
Relationship Types
| Type | Meaning |
|---|---|
relates-to | General association |
supersedes | Replaces older memory |
derived-from | Built upon another memory |
contradicts | Conflicts with another memory |
implements | Realizes a design/decision |
blocks | Dependency relationship |
blocked-by | Inverse dependency |
Entity Syntax
Entity Mentions
## Entities - mentions @[[PostgreSQL]] - uses @[[JWT Authentication]] - authored-by @[[John Smith]] - located-in @[[src/auth/]]
Entity Types
| Type | Examples |
|---|---|
| Technology | PostgreSQL, Redis, Kubernetes |
| Pattern | Factory Pattern, Singleton |
| Person | Team members, authors |
| Location | File paths, directories |
| Concept | Microservices, REST, GraphQL |
Validation Rules
Required Checks
- •
idmust be valid UUID v4 format - •
typemust be one of:semantic,episodic,procedural - •
namespacemust follow pattern:{namespace}/{scope} - •
createdmust be valid ISO 8601 timestamp - •
titlemust be non-empty string
Recommended Checks
- •
confidenceshould be between 0.0 and 1.0 - •
valid_fromshould be before or equal torecorded_at - •
tagsshould be lowercase with hyphens - •
code_refs.filepaths should be relative
Citation Checks
Required if citations array exists:
- •
citations[].typemust be one of:paper,documentation,blog,github,stackoverflow,article - •
citations[].titlemust be non-empty string - •
citations[].urlmust be valid URL format (https:// or http://)
Optional field validations:
4. citations[].relevance if present, should be between 0.0 and 1.0
5. citations[].date if present, should be valid YYYY-MM-DD format
6. citations[].accessed if present, should be valid ISO 8601 timestamp
File Naming
# Generate compliant filename
UUID=$(uuidgen | tr '[:upper:]' '[:lower:]')
TITLE="My Memory Title"
SLUG=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-' | head -c 50)
FILENAME="${UUID}-${SLUG}.memory.md"
Quick Templates
Minimal Memory
---
id: {uuid}
type: semantic
namespace: _semantic/knowledge/project
created: {timestamp}
title: "{title}"
summary: "{Brief summary for quick recall}"
detail_level: minimal
---
# {Title}
## Quick Answer
{Content - serves as both summary and full content for minimal memories}
Detail Level Guidelines
| Level | When to Use | Typical Content |
|---|---|---|
minimal | Simple facts, quick TILs, single-point learnings | Quick Answer only |
standard | Most decisions, patterns with some rationale | Quick Answer + Context |
comprehensive | Architectural decisions, complex patterns, research | All three levels |
Decision Memory (with Progressive Disclosure)
---
id: {uuid}
type: semantic
namespace: _semantic/decisions/project
created: {timestamp}
title: "Decision: {what}"
tags:
- architecture
summary: "{Brief 1-sentence summary of decision and key reason}"
detail_level: comprehensive
related_memories: []
supersedes: []
provenance:
confidence: 0.95
---
# Decision: {What}
## Quick Answer
{What} was chosen for {primary reason}. This enables {key benefit}.
## Context
- **Decision date:** {date}
- **Alternatives considered:** {Option A}, {Option B}, {Option C}
- **Key drivers:**
- {Driver 1}
- {Driver 2}
- **Trade-offs:** {What was sacrificed for this choice}
## Full Detail
### Alternatives Analysis
1. **{Option A}**: {Description}
- Pros: {pros}
- Cons: {cons}
- Verdict: {Chosen/Rejected because...}
2. **{Option B}**: {Description}
- Pros: {pros}
- Cons: {cons}
- Verdict: {Rejected because...}
### Implementation Notes
- {Specific implementation details}
- {Configuration requirements}
### Related Decisions
- relates-to [[{related-decision-id}]]
## Relationships
- supersedes [[{old-decision-id}]] (if applicable)
Incident Memory
---
id: {uuid}
type: episodic
namespace: _episodic/sessions/blockers/project
created: {timestamp}
title: "Incident: {summary}"
tags:
- incident
temporal:
valid_from: {when_it_happened}
---
# Incident: {Summary}
## Timeline
- {time}: {event}
## Root Cause
{Why it happened}
## Resolution
{How it was fixed}
## Prevention
{How to prevent recurrence}
Research Memory with Citations
---
id: {uuid}
type: semantic
namespace: _semantic/knowledge/project
created: {timestamp}
title: "Learning: {topic}"
tags:
- research
citations:
- type: paper
title: "Research Paper Title"
url: https://arxiv.org/abs/...
author: "Smith et al."
date: 2025-11-15
accessed: {timestamp}
relevance: 0.95
note: "Key finding about X"
- type: documentation
title: "Official Documentation"
url: https://docs.example.com/...
accessed: {timestamp}
relevance: 0.85
---
# Learning: {Topic}
## Summary
{What you learned}
## Key Points
- {Point 1 from citation 1}
- {Point 2 from citation 2}
## Application
{How this applies to our project}