container/skills/mk-doctor/SKILL.md
Diagnose and fix memory-kernel setup issues. Use when memory isn't working, CLAUDE.md is empty, atoms aren't being retained, or you want to verify your memory setup is healthy. Triggers on "check memory", "memory broken", "mk doctor", "memory not working", "diagnose memory", "fix memory".
npx skillsauth add mainion-ai/memory-kernel mk-doctorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Self-diagnostic for memory-kernel. Run this to verify your setup is healthy or to find and fix problems.
Works in both container and native mode. The skill auto-detects your environment.
# Am I in a container or on the host?
if [ -d /workspace/group ]; then
echo "CONTAINER MODE"
MEMORY_DIR="/workspace/extra/memory"
CLAUDE_MD="/workspace/group/CLAUDE.md"
MK_CMD="npx mk"
else
echo "NATIVE MODE"
# Try common locations
for p in ~/mk-memory ~/repos/memory/kernel; do
[ -d "$p/ENTITIES" ] && MEMORY_DIR="$p" && break
done
echo "Memory dir: ${MEMORY_DIR:-NOT FOUND}"
MK_CMD="mk"
fi
If MEMORY_DIR is not found, ask the user: "Where is your memory-kernel data directory?"
# Does the directory exist?
ls -la $MEMORY_DIR/
# Expected structure:
# ENTITIES/ — atom files (source of truth)
# ARCHIVE/ — archived atoms
# EVIDENCE/ — content-addressed blobs
# CONFLICTS/ — conflict atoms
# EPISODES/ — session summaries
# events.ndjson — event log
If missing directories: Run $MK_CMD init $MEMORY_DIR to create them.
If ENTITIES/ is empty: Memory was initialized but no atoms were created yet. This is normal for a fresh setup — see Step 7 (Bootstrap).
$MK_CMD doctor -d $MEMORY_DIR
This checks:
If mk doctor fails with "command not found":
Container:
cd /tmp && npm install memory-kernel 2>/dev/null
node /tmp/node_modules/.bin/mk doctor -d $MEMORY_DIR
Native:
npm install -g memory-kernel
mk doctor -d $MEMORY_DIR
$MK_CMD status -d $MEMORY_DIR
Look for the index status line. If it says "no index" or recall is slow:
$MK_CMD reindex -d $MEMORY_DIR
# Does it exist and have content?
head -5 $CLAUDE_MD
If missing or empty:
$MK_CMD render $MEMORY_DIR $CLAUDE_MD
head -5 $CLAUDE_MD
If render says "No atoms found" but ENTITIES/ has files:
# Check if atoms have valid frontmatter
ls $MEMORY_DIR/ENTITIES/
$MK_CMD status -d $MEMORY_DIR
wc -l $MEMORY_DIR/events.ndjson
If empty (0 lines) but atoms exist in ENTITIES/:
# Bootstrap events from existing atoms
$MK_CMD bootstrap-events -d $MEMORY_DIR
If this is a fresh installation with no atoms:
# Create a seed identity atom so CLAUDE.md isn't blank
$MK_CMD remember "Memory-kernel initialized. This agent uses persistent typed memory across sessions." \
-d $MEMORY_DIR -t fact --tags setup,identity
# Render initial CLAUDE.md
$MK_CMD render $MEMORY_DIR $CLAUDE_MD
The agent should add more atoms during its first real session:
Only if in container mode:
# Is the memory mount working?
ls /workspace/extra/memory/ENTITIES/ 2>/dev/null || echo "MOUNT MISSING"
# Can I write to it?
touch /workspace/extra/memory/.write-test && rm /workspace/extra/memory/.write-test && echo "WRITABLE" || echo "READ-ONLY"
If mount is missing: Tell the user:
"The memory directory isn't mounted in this container. Check that
~/.config/nanoclaw/mount-allowlist.jsonexists on the host and includes the memory directory path. Then check thecontainer_configin the NanoClaw database has the mount configured. Restart NanoClaw after fixing."
If read-only: Tell the user:
"The memory mount is read-only. Update the mount config to set
readonly: falseand restart NanoClaw."
crontab -l 2>/dev/null | grep -i memory
If no cron entry:
echo "⚠ No nightly memory sync cron found."
echo " Without it, atoms won't be consolidated and CLAUDE.md won't auto-update."
echo " Set up with: crontab -e"
echo " Add: 0 23 * * * mk reflect -d $MEMORY_DIR --agent-id MY_AGENT --session-id nightly-\$(date +\\%Y\\%m\\%d) && mk render $MEMORY_DIR $CLAUDE_MD"
Print a summary at the end:
Memory-Kernel Health Check
──────────────────────────
Environment: container | native
Memory dir: {path}
CLAUDE.md: {path}
Atoms: {count} ({by_type})
Events: {count}
Index: ✓ built | ✗ missing
Doctor: ✓ healthy | ✗ {N} issues
CLAUDE.md: ✓ {lines} lines | ✗ empty
Cron: ✓ configured | ✗ not set (native only)
Mount: ✓ writable | ✗ missing (container only)
tools
Set up memory-kernel — persistent, file-based agent memory — for any host that needs it. Universal core (install CLI, init store, seed identity + lifecycle atoms, schedule reflect) plus host-specific plumbing for NanoClaw container agents (mounts, allowlist, restart), OpenClaw plugin-based agents (plugin install, isolation config, AGENTS.md / MEMORY.md doctrine), or any MCP-capable client (Claude Desktop, Cursor, Continue) that needs an `mk-mcp` server entry. Use when the user asks to "set up memory-kernel", "install mk", "configure agent memory", "add persistent memory to my agent", "wire up memory-kernel for NanoClaw / OpenClaw / Claude Desktop / Cursor", or anything similar where memory-kernel is being introduced to an agent host. Triggers on "mk-memory-setup", "memory-kernel setup", "set up agent memory", "install memory-kernel", "configure mk", "persistent memory across sessions", "add memory to my agent", "memory-kernel for NanoClaw", "memory-kernel for OpenClaw", "memory-kernel MCP server".
tools
Diagnose and fix memory-kernel setup issues for any agent host — NanoClaw, OpenClaw, MCP clients (Claude Desktop / Cursor), or a plain native install. Verifies the universal store (atoms, events, index, lifecycle atoms, semantic health, drift) and then runs host-specific checks (mounts, plugin doctrine, MCP wiring, cron). Use when atoms are missing, CLAUDE.md is empty, recall feels off, the agent doesn't seem to remember anything across sessions, or you want a health check before debugging further. Triggers on "mk doctor", "memory-kernel diagnose", "atoms missing", "CLAUDE.md empty", "memory-kernel broken", "agent memory not working", "mk-memory health", "diagnose mk", "memory-kernel check", "verify memory setup".
testing
Structured typed memory with event-log replay, confidence scoring, temporal decay, type-aware ranking, typed relation edges, and conflict detection. Use for facts, decisions, constraints, beliefs, and open questions — when structure matters more than fuzzy recall.
data-ai
Set up memory-kernel for a NanoClaw agent — persistent memory across sessions. Use when user asks to set up memory, install memory-kernel, add persistent memory, or configure agent memory. Triggers on "setup memory", "memory-kernel", "mk-memory-setup", "add memory", "persistent memory".