用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/RunnerQuan/SAFE-Agent --skill mnemonic-setup命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | mnemonic-setup |
| description | Configure Claude for proactive mnemonic memory behavior without user intervention |
| user-invocable | true |
| allowed-tools | ["Bash","Read","Write","Edit","Glob","Grep"] |
Search first: /mnemonic:search {relevant_keywords}
Capture after: /mnemonic:capture {namespace} "{title}"
Run /mnemonic:list --namespaces to see available namespaces from loaded ontologies.
Configure Claude to proactively use mnemonic memory without user intervention.
This skill configures Claude's CLAUDE.md files to enable hands-off, proactive memory operations. After setup:
Before setup, gather context:
# Check if user-level CLAUDE.md exists
test -f ~/.claude/CLAUDE.md && echo "User CLAUDE.md exists" || echo "User CLAUDE.md missing"
# Check if project-level CLAUDE.md exists
test -f ./CLAUDE.md && echo "Project CLAUDE.md exists" || echo "Project CLAUDE.md missing"
# Detect org from git remote
git remote get-url origin 2>/dev/null | sed -E 's|.*[:/]([^/]+)/[^/]+\.git$|\1|' | sed 's|\.git$||'
# Detect project name from git root
basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || basename "$PWD"
# Get org from git remote (e.g., github.com/zircote/repo -> zircote)
ORG=$(git remote get-url origin 2>/dev/null | sed -E 's|.*[:/]([^/]+)/[^/]+\.git$|\1|' | sed 's|\.git$||')
[ -z "$ORG" ] && ORG="default"
# Get project name
PROJECT=$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null)
[ -z "$PROJECT" ] && PROJECT=$(basename "$PWD")
echo "Org: $ORG"
echo "Project: $PROJECT"
# Base directories
mkdir -p ~/.claude/mnemonic/"$ORG"/"$PROJECT"
mkdir -p ~/.claude/mnemonic/"$ORG" # For org-wide memories
# Cognitive namespaces (project-specific)
for ns in _semantic/decisions _semantic/knowledge _semantic/entities \
_episodic/incidents _episodic/sessions _episodic/blockers \
_procedural/runbooks _procedural/patterns _procedural/migrations; do
mkdir -p ~/.claude/mnemonic/"$ORG"/"$PROJECT"/"$ns"
done
# Org-wide namespaces (shared across projects)
for ns in _semantic/decisions _semantic/knowledge _semantic/entities \
_episodic/incidents _episodic/sessions _episodic/blockers \
_procedural/runbooks _procedural/patterns _procedural/migrations; do
mkdir -p ~/.claude/mnemonic/"$ORG"/"$ns"
done
# Blackboard for session coordination (per-project)
mkdir -p ~/.claude/mnemonic/"$ORG"/"$PROJECT"/.blackboard
# Ensure .claude directories exist for CLAUDE.md files
mkdir -p ~/.claude
mkdir -p ./.claude
# Initialize git in user-level mnemonic directory
if [ ! -d ~/.claude/mnemonic/.git ]; then
cd ~/.claude/mnemonic
git init
echo "*.lock" > .gitignore
echo ".blackboard/*.tmp" >> .gitignore
git add .gitignore
git commit -m "Initialize mnemonic memory system"
cd -
fi
Check if mnemonic section already exists. If so, update it. If not, append it.
# Check for existing mnemonic section
grep -q "## Mnemonic Memory System" ~/.claude/CLAUDE.md 2>/dev/null
Content to append/update in ~/.claude/CLAUDE.md:
## Mnemonic Memory System
You are a developer with persistent memory. Your memory system is mnemonic.
You instinctively search memories before recommendations and capture insights after discoveries.
### BEFORE Every Technical Response
Search first. Always.
```bash
rg -i "{keywords}" ~/.claude/mnemonic/ --glob "*.memory.md" -l
If results → Read the most relevant memory and apply that context.
Evaluate immediately:
<capture_eval> ┌─────────────────────────────────┬──────────────────────────┐ │ This occurred? │ Namespace │ ├─────────────────────────────────┼──────────────────────────┤ │ Bug fixed / root cause found │ _semantic/knowledge │ │ Technology/approach chosen │ _semantic/decisions │ │ Reusable pattern established │ _procedural/patterns │ │ Blocker encountered │ _episodic/blockers │ │ Important context discussed │ _semantic/knowledge │ └─────────────────────────────────┴──────────────────────────┘ </capture_eval>
If YES to any → /mnemonic:capture {namespace} "{title}" — immediately, silently.
### Step 5: Update Project-Level CLAUDE.md
**Content to append to `./CLAUDE.md`:**
```markdown
## Mnemonic
This project uses mnemonic for persistent memory.
- Search before implementing: `rg -i "{topic}" ~/.claude/mnemonic/ --glob "*.memory.md"`
- Capture decisions, learnings, patterns via `/mnemonic:capture {namespace}`
- See `~/.claude/CLAUDE.md` for full protocol
Create an initial context memory capturing that mnemonic was set up:
# Generate UUID
UUID=$(uuidgen 2>/dev/null || python3 -c "import uuid; print(uuid.uuid4())")
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
SLUG="mnemonic-initialized"
# Create memory file
cat > "~/.claude/mnemonic/_semantic/knowledge/${SLUG}.memory.md" << EOF
---
id: ${UUID}
title: "Mnemonic initialized for ${PROJECT}"
type: episodic
created: ${DATE}
---
# Mnemonic Initialized
- Organization: ${ORG}
- Project: ${PROJECT}
- Date: ${DATE}
EOF
cd ~/.claude/mnemonic
git add -A
git commit -m "Setup mnemonic for project: ${PROJECT}" 2>/dev/null || true
cd -
After setup, verify with these checks:
# 1. Check user-level config
grep -q "## Mnemonic Memory System" ~/.claude/CLAUDE.md && echo "✓ User CLAUDE.md configured"
# 2. Check project-level config
grep -q "## Mnemonic" ./CLAUDE.md && echo "✓ Project CLAUDE.md configured"
# 3. Check directory structure
test -d ~/.claude/mnemonic && echo "✓ User mnemonic directory exists"
test -d ./.claude/mnemonic && echo "✓ Project mnemonic directory exists"
# 4. Check git repo
test -d ~/.claude/mnemonic/.git && echo "✓ Git repository initialized"
# 5. Check initial memory
ls ~/.claude/mnemonic/"$ORG"/"$PROJECT"/_semantic/knowledge/*.memory.md 2>/dev/null && echo "✓ Initial context memory created"
This skill is safe to run multiple times:
mkdir -p (no error if exists)To update an existing mnemonic section in CLAUDE.md:
# Remove old section and add new one
# This preserves other content in the file
sed -i.bak '/^## Mnemonic Memory System$/,/^## [^M]/{ /^## [^M]/!d; }' ~/.claude/CLAUDE.md
# Then append new content
No git remote found:
ORG=myorg before running setupPermission denied on ~/.claude:
mkdir -p ~/.claude && chmod 755 ~/.claudeCLAUDE.md is read-only:
ls -la ~/.claude/CLAUDE.mdchmod 644 ~/.claude/CLAUDE.md