Automatically captures session activity, errors, decisions, and patterns into a browsable, visualizable knowledge base.

version
1.0.6
GitHub stars
13

Install

/plugin install cc-obsidian-mem@cc-obsidian-mem

Run it inside Claude Code after adding the marketplace with /plugin marketplace add Z-M-Huang/cc-obsidian-mem.

Contents

Discovered from source

Skills 8

Memory Audit Skill

Audit your Claude Code knowledge base to identify structural issues and content staleness.

When to Use

  • Checking health of your knowledge base
  • Finding broken links between notes
  • Identifying orphan notes not connected to the hierarchy
  • Detecting missing category indexes
  • Finding notes with invalid frontmatter
  • Optionally: AI-powered detection of stale content

Usage

The skill can run with or without a project specified:

/mem-audit
/mem-audit project:my-project
/mem-audit includeContentValidation:true

Workflow

  1. Detect Project

    • If no project specified and only one exists, use it automatically
    • If multiple projects exist, list them and ask the user to specify
  2. Run Audit

    • Call mem_audit with appropriate options
    • Structural checks run by default (fast, no AI)
    • Content validation is optional and uses AI (slower)
  3. Present Results

    • Show summary of issues by severity (errors, warnings, info)
    • Group issues by category
    • Show suggested fixes and whether they're auto-fixable
    • Recommend using /mem-fix for auto-fixable issues

Issue Categories

Structural (Fast, No AI)

  • broken_link: Wikilinks pointing to non-existent notes
  • orphan_note: Notes without parent links (not connected to hierarchy)
  • missing_index: Category folders missing their index file
  • supersession_inconsistent: Supersession links not properly set up
  • index_stale: JSON index out of sync with note files
  • invalid_frontmatter: Missing required frontmatter fields

Content (AI-Powered, Slower)

  • Stale content detection by comparing notes to current code
  • Only runs when includeContentValidation: true

Output Format

# Audit Results: project-name

**Scanned**: 42 notes in 156ms

## Summary

- **Errors**: 2
- **Warnings**: 5
- **Info**: 3

## Broken Link (3)

- [!] `research/2024-01-15_api-design.md`: Broken link: [[old-decision]]
  - Fix: Remove broken link [[old-decision]] (auto-fixable)
  - ID: `broken_link-abc123`

...

---
Use `mem_fix` to apply fixes. Use `dryRun: true` to preview changes first.

Follow-up Actions

After presenting results, suggest:

  • /mem-fix to automatically fix auto-fixable issues
  • /mem-fix dryRun:true to preview changes first
  • Manual review for non-auto-fixable issues

Memory Consolidate Skill

Two-phase knowledge base cleanup: normalize verbose filenames, then consolidate semantic duplicates.

When to Use

  • Long filenames: When files have verbose 40+ character names that should be shortened
  • Duplicate topics: When multiple files discuss the same topic with different wording
  • Post-migration cleanup: After migrating to topic-based filenames (no date prefixes)
  • Knowledge base maintenance: Periodic cleanup to keep notes organized

Usage

/mem-consolidate
/mem-consolidate project:my-project
/mem-consolidate project:my-project dryRun:true
/mem-consolidate project:my-project normalizeOnly:true   # Skip duplicate merging

Workflow Overview

Phase 1: Normalize Long Filenames
├── Find files with names > 40 chars
├── AI suggests short generic titles (2-4 words)
├── Rename files, add original as alias
└── Handle collisions (merge or suffix)

Phase 2: Consolidate Semantic Duplicates
├── AI groups notes by topic similarity
├── Merge groups into single files
├── Archive source files
└── Update aliases for future matching

Workflow

0. Get Config (Required First Step)

Before any file operations, you MUST read the config:

  1. Read user config: ~/.cc-obsidian-mem/config.json

    • On Windows: C:\Users\{username}\.cc-obsidian-mem\config.json
    • On macOS/Linux: ~/.cc-obsidian-mem/config.json
  2. Extract settings from config:

    {
      "vault": {
        "path": "/path/to/obsidian/vault",
        "memFolder": "_claude-mem"
      },
      "ai": {
        "enabled": true,
        "model": "sonnet",
        "timeout": 30000
      }
    }
    
  3. Construct project paths:

    • Memory folder: {vault.path}/{vault.memFolder}
    • Projects folder: {vault.path}/{vault.memFolder}/projects
    • Project folder: {vault.path}/{vault.memFolder}/projects/{project-name}
  4. Note AI settings for semantic matching:

    • ai.enabled: Whether to use AI (default: true)
    • ai.model: "sonnet", "haiku", or "opus" (default: sonnet)

Important: Never hardcode or assume vault paths. Always read from config first.

1. Detect Project

Consolidation is always scoped to a single project. Notes from different projects are never merged together.

  • If no project specified, detect from current working directory (find .git root)
  • If only one project exists in the vault, use it automatically
  • If multiple projects exist and none detected, list them and ask the user to specify

2. Collect All Notes

For each category (decisions, patterns, errors, research, knowledge):

  1. List all files in {project}/{category}/ folder

    • Exclude category index files (e.g., decisions/decisions.md)
    • Exclude .archive/ subfolder
    • Exclude sessions folder
  2. Build notes list with title, category, and filename length:

    [
      { "title": "Stop hook non-blocking", "category": "decisions", "path": "...", "filenameLength": 24 },
      { "title": "QA: How to prevent stop hook from blocking", "category": "research", "path": "...", "filenameLength": 53 },
      ...
    ]
    

3. Normalize Long Filenames (Phase 1)

Before finding duplicates, normalize verbose filenames to short generic titles.

Step 3a: Identify Long Filenames

Find all files with filename length > 40 characters (excluding .md extension):

Long filenames found:
  1. [decisions] use-writeifchanged-pattern-to-avoid-unnecessary-fi.md (50 chars)
  2. [research] qa-how-to-prevent-stop-hook-from-blocking-claude-s.md (53 chars)
  3. [patterns] atomic-file-operations-with-collision-handling.md (47 chars)
Step 3b: AI Prompt for Title Normalization

Send long filenames to AI for generic title suggestions:

Suggest short generic titles (2-4 words) for these verbose filenames.

FILES:
0. [decisions] "use-writeifchanged-pattern-to-avoid-unnecessary-fi"
1. [research] "qa-how-to-prevent-stop-hook-from-blocking-claude-s"
2. [patterns] "atomic-file-operations-with-collision-handling"

Respond with JSON:
{"titles": ["WriteIfChanged pattern", "Stop hook blocking", "Atomic file operations"]}

Rules:
- Keep titles short: 2-4 words maximum
- Capture the core concept, not implementation details
- Remove prefixes like "qa-", "how-to-", "pattern-for-"
- Use title case
Step 3c: Rename Files

For each long filename:

  1. Rename file to slugified generic title (e.g., write-if-changed-pattern.md)
  2. Update frontmatter title to the generic title
  3. Add original verbose title as alias for future Jaccard matching
  4. Update parent links if needed

Example transformation:

Before: use-writeifchanged-pattern-to-avoid-unnecessary-fi.md
After:  write-if-changed-pattern.md
        aliases: ["use writeifchanged pattern to avoid unnecessary fi"]
Step 3d: Handle Collisions

If the generic filename already exists:

  • Check if semantically same topic → merge into existing file
  • Different topic → add suffix: write-if-changed-pattern-2.md

4. Find Duplicate Groups Using AI (Phase 2)

Use AI semantic matching to identify groups of notes within the current project that discuss the same topic.

AI Prompt for Grouping

Send this prompt to Claude CLI using the model from config:

Group these notes by semantic similarity (same topic, different wording).

NOTES (0-indexed):
0. [decisions] "Stop hook non-blocking"
1. [research] "QA: How to prevent stop hook from blocking"
2. [research] "QA: Stop hook blocking Claude session"
3. [patterns] "Two-phase locking"
...

Respond with JSON using 0-based indices:
{"groups": [[0,1,2], [3]], "genericTitles": ["Stop hook blocking", "Two-phase locking"]}

Rules:
- Only group notes that are semantically about the SAME topic
- Notes in different categories CAN be grouped if same topic
- Each note appears in at most one group
- Single-note groups can be omitted
- Suggest a short generic title (2-4 words) for each group
Execute AI Call
echo '<prompt>' | claude -p - --model {config.ai.model} --no-session-persistence --output-format text
Parse Response

AI returns groups like:

{
  "groups": [[0,1,2], [5,8,12]],
  "genericTitles": ["Stop hook blocking", "Windows path normalization"]
}

5. Process Each Duplicate Group

For each group with 2+ notes:

Step 5a: Present Group to User

Show the group for confirmation (unless auto-mode):

Found duplicate group: "Stop hook blocking"
  1. [decisions] stop-hook-non-blocking.md
  2. [research] qa-how-to-prevent-stop-hook-from-blocking-claude-s.md
  3. [research] qa-stop-hook-blocking-claude-session.md

Merge into: decisions/stop-hook-blocking.md ?
[Yes / Skip / Custom target]
Step 5b: Execute Merge
  1. Choose target file:

    • Prefer existing GENERIC filename (short, 1-4 words)
    • Or use AI-suggested generic title
    • Keep in the most appropriate category (decisions > patterns > errors > research)
  2. Merge content:

    • Sort by created date (oldest first)
    • Combine as timestamped entries: ## Entry: YYYY-MM-DD HH:MM
    • Merge tags (unique union)
    • Add all source titles as aliases (for future Jaccard matching)
    • Update entry_count
  3. Write merged file to target path

  4. Archive source files (except target) to .archive/

6. Merge Workflow

When merging multiple files into one:

  1. Sort files by created date (oldest first)

    • Read frontmatter created field (ISO8601 format)
    • Fallback: use file mtime if created missing
  2. Prepare merged content:

    • Use oldest file's created date
    • Merge all tags (unique union)
    • Combine all aliases (unique, cap at 10)
    • Combine content with timestamped entry headers:
      ## Entry: YYYY-MM-DD HH:MM
      {content from this file}
      
    • Calculate entry_count from all ## Entry headers
  3. Write merged file:

    • Use generic filename (shortest/most canonical)
    • Include aliases from all source files
    • If target file exists, append and merge frontmatter
  4. Archive source files (except the target file):

    • Move to .archive/ subfolder
    • Handle conflicts with timestamp suffix

7. Auto-Merge Mode

When user requests automatic merging (no prompts):

  1. Trust AI groupings: Auto-merge all groups identified by AI

    • AI has already determined semantic similarity
    • Use AI-suggested generic titles
  2. Category priority for target: When group spans categories:

    • decisions > patterns > errors > research > knowledge
    • Or keep in category with most files
  3. Still prompt for:

    • Groups with notes in very different categories (e.g., errors + decisions)
    • When AI confidence indicators suggest uncertainty

8. Report Summary

After processing all files:

# Consolidation Summary

**Scanned**: {N} files across {M} categories
**AI Model**: {config.ai.model}

## Phase 1: Filename Normalization
| Before | After | Category |
|--------|-------|----------|
| use-writeifchanged-pattern-to-avoid-unnecessary-fi.md | write-if-changed-pattern.md | decisions |
| qa-how-to-prevent-stop-hook-from-blocking-claude-s.md | stop-hook-blocking.md | research |

**Normalized**: {X} files renamed to shorter titles

## Phase 2: Duplicate Consolidation
| Group | Files | Target | Aliases Added |
|-------|-------|--------|---------------|
| Stop hook blocking | 3 | decisions/stop-hook-blocking.md | 2 |
| Windows path normalization | 4 | research/windows-path-normalization.md | 3 |

**Merged**: {Y} duplicate groups

## Skipped
- `{filename}`: {reason}

## Final Stats
- Files before: {N}
- Normalized: {X} long filenames → short titles
- Merged: {Y} duplicate groups
- Files after: {M}
- Total reduction: {N-M} files ({percentage}%)

---
Archived files are in `.archive/` folders.
Aliases added will improve future Jaccard matching.

AI Semantic Matching Details

Why AI Instead of Filename Patterns?

Filename-based matching (Jaccard word similarity) misses semantic duplicates:

  • "stop-hook-non-blocking" vs "prevent-stop-hook-blocking" → different words, same topic
  • "windows-config-location" vs "cc-obsidian-mem-config-path" → same topic
  • "jaccard-similarity-limitations" vs "word-based-matching-insufficient" → same topic

AI understands that these are the same topic even with different wording.

Self-Improving System

When AI identifies duplicates and they're merged:

  1. All source titles added as aliases to merged note
  2. Next time, Jaccard matching will catch similar titles (aliases are checked)
  3. Reduces future AI calls - the system learns from consolidation

Handling Large Note Collections

If project has many notes (50+), batch the AI call:

  1. Send first 50 notes to AI
  2. Process identified groups
  3. Repeat with remaining notes
  4. This avoids prompt size limits

Edge Cases

Category Index Exclusion

Problem: Category index files like decisions/decisions.md have the same slug as their folder name.

Solution: Explicitly exclude files matching ${category}.md pattern.

Sessions Folder

Problem: sessions/ folder contains auto-generated session notes.

Solution: Exclude sessions category from consolidation.

Files Without Created Date

Problem: Some files may not have created field in frontmatter.

Solution: Fall back to filesystem mtime and warn user.

Already-Consolidated Files

Problem: Some generic files may already have multiple entries from previous consolidations.

Solution: Append new entries, merge aliases, update entry_count.

Archive Conflicts

Problem: File already exists in .archive/ from previous consolidation.

Solution: Append timestamp to filename: auth-bug_20260115-103000.md

Safety Features

  • Dry run available: Preview changes before applying
  • Archive before delete: Old files moved to .archive/ for easy recovery
  • Conflict handling: Timestamp suffixes prevent overwrites
  • Alias preservation: Original titles saved for future matching
  • Incremental: Can run multiple times safely

Follow-up Actions

After consolidation, suggest:

  • Review archived files in .archive/ folders
  • Run /mem-audit to verify vault structure is clean
  • Clean up old archives when confident changes are correct

Memory Fix Skill

Apply fixes for issues detected in your Claude Code knowledge base.

When to Use

  • After running /mem-audit and finding issues
  • To clean up broken links
  • To add missing parent links to orphan notes
  • To create missing category indexes
  • To rebuild stale indexes

Usage

/mem-fix project:my-project
/mem-fix project:my-project dryRun:true
/mem-fix project:my-project fixCategories:broken_link,orphan_note

Workflow

  1. Run Audit First

    • Call mem_audit to get current issues
    • Present summary: X errors, Y warnings, Z info
  2. Collect Confirmation

    • Group issues by category
    • For each category with issues, ask: "Fix all N [category] issues?"
    • Show examples (first 3-5) before asking for confirmation
  3. Apply Fixes

    • Use dryRun: true first to preview changes
    • Then apply confirmed fixes with dryRun: false
  4. Report Results

    • Show what was fixed successfully
    • Show what failed and why
    • Suggest re-running audit to verify

Fix Types

CategoryFix TypeAuto-Fixable
broken_linkRemove the broken wikilinkYes
orphan_noteAdd parent link to frontmatterYes
missing_indexCreate category index fileYes
supersession_inconsistentUpdate frontmatter (may need manual input)Partial
index_staleRebuild project indexYes
invalid_frontmatterAdd missing fields (except title)Partial

Output Format

Dry Run

# Dry Run Results

**Would fix**: 8/10

## Successful

- `broken_link-abc123`: Would remove link [[old-note]]
  - link_removed: Removed broken link [[old-note]]

## Failed

- `supersession_inconsistent-def456`: No suggested fix available

---
Run again with `dryRun: false` to apply these changes.

After Applying

# Fix Results

**Fixed**: 8/10

## Successful

- `broken_link-abc123`: Removed link [[old-note]]
  - link_removed: Removed broken link [[old-note]]

## Failed

- `supersession_inconsistent-def456`: No suggested fix available

Safety Features

  • Dry run by default: Always preview changes first
  • Atomic writes: Files are written atomically to prevent corruption
  • TOCTOU protection: Checks if files changed since audit before applying fixes
  • Individual results: Each fix reports success/failure independently

Follow-up Actions

After fixing, suggest:

  • /mem-audit to verify all issues are resolved
  • Review any failed fixes manually

Memory Repair Skill

Clean up and repair common issues with the cc-obsidian-mem memory system.

When to Use

  • Getting errors about temp files or stale sessions
  • Sessions not starting properly
  • --continue picking up wrong sessions
  • Sessions stuck in "processing" status
  • Want to clean up all temp files and start fresh

Usage

/mem-repair
/mem-repair full

Workflow

  1. Show Current Status First, show what will be cleaned:

    # Windows (cmd)
    dir "%TEMP%\cc-obsidian-mem-*.txt" 2>nul || echo No temp files
    dir "%TEMP%\cc-mem-agent-*.txt" 2>nul || echo No legacy temp files
    dir "%USERPROFILE%\.cc-obsidian-mem\locks\*" 2>nul || echo No lock files
    
    # macOS/Linux
    ls -la /tmp/cc-obsidian-mem-*.txt 2>/dev/null || echo "No temp files"
    ls -la /tmp/cc-mem-agent-*.txt 2>/dev/null || echo "No legacy temp files"
    ls -la ~/.cc-obsidian-mem/locks/* 2>/dev/null || echo "No lock files"
    
  2. Clean Up Temp Files Remove orphan temp files from crashed sessions:

    # Windows (cmd)
    del /q "%TEMP%\cc-obsidian-mem-*.txt" 2>nul
    del /q "%TEMP%\cc-mem-agent-*.txt" 2>nul
    
    # macOS/Linux
    rm -f /tmp/cc-obsidian-mem-*.txt
    rm -f /tmp/cc-mem-agent-*.txt
    
  3. Clean Up Stale Lock Files

    # Windows (cmd)
    del /q "%USERPROFILE%\.cc-obsidian-mem\locks\*" 2>nul
    
    # macOS/Linux
    rm -f ~/.cc-obsidian-mem/locks/*
    
  4. Clean Up Old Log Files (optional, if user requests full cleanup)

    # Windows (cmd)
    del /q "%TEMP%\cc-obsidian-mem-*.log" 2>nul
    
    # macOS/Linux
    rm -f /tmp/cc-obsidian-mem-*.log
    
  5. Clean Up Database Sessions (if sqlite3 is available)

    # Mark stale processing sessions as failed (stuck > 30 min)
    sqlite3 ~/.cc-obsidian-mem/sessions.db "UPDATE sessions SET status = 'failed' WHERE status = 'processing' AND updated_at < datetime('now', '-30 minutes');"
    
    # Mark orphan active sessions as failed (active > 24 hours)
    sqlite3 ~/.cc-obsidian-mem/sessions.db "UPDATE sessions SET status = 'failed' WHERE status = 'active' AND created_at < datetime('now', '-24 hours');"
    
    # Show recent sessions
    sqlite3 ~/.cc-obsidian-mem/sessions.db "SELECT substr(session_id, 1, 12) || '...' as session_id, status, project, created_at FROM sessions ORDER BY created_at DESC LIMIT 10;"
    

    Windows alternative (if sqlite3 not in PATH):

    # Just show the database file exists
    dir "%USERPROFILE%\.cc-obsidian-mem\sessions.db" 2>nul || echo No database found
    
  6. Clean Polluted Claude Session History (if --continue picks wrong sessions)

    # Windows (PowerShell) - find and delete polluted session files
    Get-ChildItem -Path "$env:USERPROFILE\.claude\projects" -Recurse -Filter "*.jsonl" |
      Where-Object { (Get-Content $_.FullName -Raw) -match "cc-mem-agent|cc-obsidian-mem-" } |
      Remove-Item -Force
    
    # macOS/Linux
    grep -rl "cc-mem-agent\|cc-obsidian-mem-" ~/.claude/projects --include="*.jsonl" | xargs rm -f
    

Output Format

## Memory System Repair

### Temp Files Cleaned
- Removed 3 orphan temp files
- Removed 1 legacy temp file

### Lock Files Cleaned
- Removed 2 stale lock files

### Database Sessions
- Marked 1 stale processing session as failed
- Marked 0 orphan sessions as failed

### Log Files
- Kept (use `/mem-repair full` to remove)

### Recent Sessions
| Session ID | Status | Project | Created |
|------------|--------|---------|---------|
| abc123... | completed | my-project | 2024-01-15 10:30 |
| def456... | failed | other-proj | 2024-01-14 15:20 |

Repair complete. Start a new session to continue working.

Common Issues Fixed

IssueSymptomFix
Orphan temp filesErrors reading temp filesRemove cc-obsidian-mem-*.txt
Legacy temp files--continue picks wrong sessionRemove cc-mem-agent-*.txt
Stale locksSessions stuck in "processing"Remove files from ~/.cc-obsidian-mem/locks/
Stale processingSessions never completeMark as failed in database
Orphan sessionsOld active sessionsMark as failed in database
Polluted history--continue reads file pathsDelete polluted JSONL files
Old logsDisk space usageRemove cc-obsidian-mem-*.log

After Repair

  • Start a fresh session (not --continue)
  • If issues persist, check config: cat ~/.cc-obsidian-mem/config.json
  • Run /mem-status to verify memory system is working

Memory Save Skill

Explicitly save knowledge to the Claude Code memory system for future reference.

When to Use

  • Recording an important decision
  • Documenting a useful pattern
  • Saving a solution to a tricky error
  • Noting learnings for future reference
  • Creating reusable knowledge

Usage

The skill accepts content to save. Examples:

/mem-save decision: We chose PostgreSQL over MongoDB for this project
/mem-save pattern: This regex pattern works for parsing dates: /\d{4}-\d{2}-\d{2}/
/mem-save learning: The API rate limits at 100 requests per minute
/mem-save error-fix: The CORS issue was fixed by adding the origin header

Note Types

TypeUse For
decisionArchitectural or design decisions with rationale
patternReusable code patterns, regex, algorithms
errorError solutions and workarounds
learningGeneral insights and knowledge
fileFile-specific notes and documentation

Workflow

  1. Identify Content Type

    • Parse the user's input to determine the note type
    • If unclear, ask for clarification
  2. Structure the Content

    • Extract the main information
    • Add appropriate context (project, tags)
    • Format with Obsidian-friendly markdown
  3. Save and Confirm

    • Use mem_write to persist
    • Show the saved note path
    • Offer to add more details

Content Templates

Decision

## Context
[Why this decision was needed]

## Decision
[What was decided]

## Rationale
[Why this approach was chosen]

## Consequences
- Positive: ...
- Negative: ...

Pattern

## Description
[What this pattern does]

## When to Use
[Scenarios where this applies]

## Implementation
\`\`\`language
[Code example]
\`\`\`

Error Fix

## Problem
[The error encountered]

## Cause
[Root cause]

## Solution
[How it was fixed]

## Prevention
[How to avoid in future]

Guidelines

  • Always include context about why something was decided
  • Add relevant tags for discoverability
  • Link to related notes when possible
  • Be specific enough to be useful later

Memory Search Skill

Search your Claude Code knowledge base to find relevant information.

When to Use

  • Finding how a previous error was solved
  • Recalling decisions made about the codebase
  • Looking up patterns used before
  • Getting context about a file's history
  • Finding knowledge and learnings

Usage

The skill accepts a natural language query. Examples:

/mem-search authentication error fix
/mem-search database schema decisions
/mem-search how did we handle caching
/mem-search API rate limiting patterns

Workflow

  1. Analyze the Query

    • Determine if they're looking for an error, decision, pattern, or general info
    • Identify any project context
  2. Search Strategy

    • Use mem_search with appropriate filters
    • For errors: filter by type: error
    • For decisions: filter by type: decision
    • For patterns: filter by type: pattern
    • For knowledge: filter by type: learning
  3. Present Results

    • Show a summary of top matches
    • Show title, type, and path for each result
    • Offer to show full details with mem_read

Output Format

Present results clearly:

## Found X results for "query"

### [Title]
**Type**: type | **Path**: `path/to/note.md`
**Project**: project-name

---

Would you like me to show the full details of any of these?

Note: Search returns lightweight results. Use mem_read for full note content.

Advanced Usage

If the user wants project-wide context:

mem_project_context({ project: "project-name" })

This returns unresolved errors, active decisions, and patterns for the project.

Memory Status Skill

Display memory system information and tracked projects.

When to Use

  • See if the memory system is working
  • List all tracked projects
  • Get context for a specific project

Usage

/mem-status
/mem-status projects

Workflow

  1. List Projects Use mem_list_projects tool

  2. Get Project Context If a project is specified, use mem_project_context

  3. Check Config

    cat ~/.cc-obsidian-mem/config.json
    

Output Format

## Memory System Status

### Projects in Memory
1. project-a (last active: 1 day ago)
2. project-b (last active: 3 days ago)
3. my-project (current)

### Quick Stats
- Total Notes: 156
- Errors Documented: 23
- Decisions Recorded: 15
- Knowledge Items: 45

Troubleshooting

If no data is being captured:

  1. Verify hooks are installed: check /plugin list
  2. Check config: cat ~/.cc-obsidian-mem/config.json
  3. Ensure vault path is correct and writable
  4. Check background log: cat /tmp/cc-obsidian-mem-background.log

Memory Validate Skill

Validate your knowledge notes against the current state of the codebase to detect stale content.

When to Use

  • Periodic knowledge base maintenance
  • After major refactoring
  • Before relying on old documentation
  • To identify notes that need updating

Usage

/mem-validate project:my-project
/mem-validate project:my-project noteType:decision
/mem-validate project:my-project limit:10

How It Works

  1. Extract File References

    • Scans note content for file path mentions
    • Patterns like src/utils/helper.ts, code block paths, etc.
  2. Check File Existence

    • If referenced files are deleted: note is definitely stale
    • If some files missing: note is likely stale
  3. AI Comparison (for existing files)

    • Reads current file content (first 2000 chars)
    • Uses AI to compare documented knowledge vs actual code
    • Returns staleness verdict with confidence score

Workflow

  1. Run Validation

    • Call mem_validate for the project
    • Default limit: 20 notes (AI validation is slow)
  2. Present Results

    • Group by status: stale, current, unable to validate
    • Show confidence scores for stale notes
    • List files that have changed
  3. Offer Actions

    • For stale notes: offer to update via mem_supersede
    • For notes without file references: note that manual review may be needed

Output Format

# Content Validation Results

**Checked**: 15 notes
**Stale**: 3
**Current**: 10
**Unable to validate**: 2

## Stale Notes

These notes may need to be updated or superseded:

### `research/2024-01-15_api-design.md`
- **Confidence**: 85%
- **Reason**: The API endpoint handlers have been refactored to use a different pattern
- **Referenced files**: src/api/handlers.ts, src/middleware/auth.ts

### `decisions/authentication-strategy.md`
- **Confidence**: 92%
- **Reason**: All referenced files have been deleted

## Unable to Validate

- `research/general-tips.md`: No file references found in note content

---
Use `mem_supersede` to update stale notes with current information.

Follow-up Actions

For each stale note, offer:

  1. Update: Read current files and create superseding note with mem_supersede
  2. Skip: Leave as-is (user decides later)
  3. Delete: If content is no longer relevant

Notes

  • Validation is AI-powered and may take 30-60 seconds per note
  • Uses claude -p with haiku model for fast validation
  • Notes without file references cannot be automatically validated
  • High confidence (>80%) suggests the note should definitely be reviewed

MCP servers 1

Sponsors

Details

Marketplace
Z-M-Huang/cc-obsidian-mem
Source
plugin
Category
Community