● مجتمع
thedotmack
⚡ فوري
claude-mem
بواسطة thedotmack · thedotmack/claude-mem
claude-mem captures every Claude Code session, compresses it with AI into a searchable memory, and injects only the relevant bits into future sessions.
claude-mem is a plugin/skill hybrid for Claude Code (also Gemini CLI and OpenCode). Five lifecycle hooks observe everything your agent does; an AI compression pass distills sessions into structured observations; a SQLite + Chroma vector store powers semantic recall. You search memory with the mem-search skill, and a local web viewer at localhost:37777 shows the memory stream in real time. Privacy controls via <private> tags keep secrets out. The biggest win: no more 'remind me what we decided last Tuesday' at the start of every session.
لماذا تستخدمه
الميزات الأساسية
- Session-spanning memory via AI compression (not just grep of logs)
- SQLite + Chroma vector search for semantic recall
- Real-time web viewer at localhost:37777
<private> tags to exclude sensitive content from capture- Citation system — observations are referenced by ID in answers
- Works with Claude Code, Gemini CLI, OpenCode; available via plugin marketplace
عرض مباشر
كيف يبدو في الممارسة
claude-mem-skill.replay
▶ جاهز
حالات الاستخدام
استخدامات عملية: claude-mem
متى تستخدمه: You spend the first 10 minutes of every session re-explaining context that Claude had yesterday.
المتطلبات الأساسية
- Claude Code installed — npm install -g @anthropic-ai/claude-code
- claude-mem installed — npx claude-mem install (registers hooks in ~/.claude)
الخطوات
-
Work normally
Just use Claude Code. claude-mem is passive — hooks capture events automatically.✓ تم النسخ
→ localhost:37777 shows the memory stream updating as you work
-
Start tomorrow's session
Where did we leave off on the migration branch?✓ تم النسخ
→ Claude recalls concrete facts + cites observation IDs
-
Correct misremembering
That's wrong about the DB schema — we decided to keep the v1 field. Mark that observation as corrected.✓ تم النسخ
→ mem-search writes a correction; future recall prioritizes it
النتيجة: Sessions feel continuous. The re-briefing ritual disappears.
المزالق
- Memory recalls stale facts after you change course — Explicitly mark corrections; mem-search respects recency and overrides
- Sensitive code snippets get captured — Wrap them in
<private>...</private> tags; hooks skip private blocks
متى تستخدمه: You solve a gnarly bug, explain the fix to Claude, and want that explanation findable next month without writing a README.
الخطوات
-
Narrate your fix
Walk me through why the deadlock happened and the fix you just landed. Be complete — future me might read this.✓ تم النسخ
→ Claude writes a narrative; compression captures it
-
Tag the memory
Tag this observation with 'db-deadlock-2026-04' and 'billing-cluster'.✓ تم النسخ
→ Tags stored on the observation
-
Recall later
A month later: 'We've got another deadlock in billing — pull any prior notes.'✓ تم النسخ
→ The April note surfaces first
النتيجة: Lightweight knowledge base that grows by itself.
المزالق
- Memory gets noisy as months pass — Use mem-search --prune on low-signal old sessions; Endless Mode (beta) handles this automatically
متى تستخدمه: You work on code that touches PII or secrets and can't let them land in a local vector store.
الخطوات
-
Wrap sensitive blocks
Write me the sample data with real test records wrapped in <private> tags so claude-mem doesn't capture the values.✓ تم النسخ
→ Private blocks are in the transcript but not in the memory store
-
Verify
Open localhost:37777 and check today's stream. Confirm no records from the <private> block appear.✓ تم النسخ
→ Private content absent
-
Add repo-wide policy
Update CLAUDE.md: 'Always wrap real customer data in <private>'.✓ تم النسخ
→ CLAUDE.md updated; future sessions inherit
النتيجة: Memory is useful without being a data-leak surface.
المزالق
- Forgetting to tag sensitive content — Make it a pre-commit / hook convention; claude-mem can enforce prompts that remind on detection
التركيبات
اجمعها مع خوادم MCP أخرى لتحقيق نتائج x10
Memory recalls the file you edited, filesystem re-reads it
Pull from mem-search the last file we edited in the billing refactor; then read it and continue where we left off.✓ تم النسخ
Memory supplies the intent; Serena supplies the current code state
Memory says we're renaming ChargeService → BillingService; use Serena to finish the rename.✓ تم النسخ
Cross-reference memory with real PR state
Memory says we opened a PR yesterday; use GitHub MCP to get its current status and review comments.✓ تم النسخ
التكلفة والحدود
تكلفة التشغيل
- حصة API
- Local SQLite + Chroma vectors; embedding model bundled
- الرموز لكل استدعاء
- Small — observations are already compressed
- التكلفة المالية
- Free (MIT)
- نصيحة
- Compression calls use your Claude API key; set a monthly budget in the claude-mem config if you chat a lot
الأمان
الصلاحيات والأسرار ونطاق الأثر
تخزين بيانات الاعتماد: None for the tool itself; compression uses your existing Claude API key
نقل البيانات الخارجي: Compression calls go to Anthropic (your account); nothing else leaves your machine
لا تمنح أبدًا: Uploading the SQLite/Chroma store off-device without review — it contains transcripts
- The local memory database is plaintext by default. If your disk isn't encrypted, enable FileVault/LUKS/BitLocker before using on sensitive projects.
- Sharing your dotfiles or home dir via backup tools can leak memory. Add ~/.claude/mem/** to your backup exclusions if relevant.
استكشاف الأخطاء
الأخطاء الشائعة وحلولها
Web viewer at localhost:37777 won't load
Check the hook is running: ps aux | grep claude-mem. Reinstall with npx claude-mem install if it's absent.
تحقق: curl -I http://localhost:37777
Recall returns nothing useful
First few sessions are cold; memory gets better after ~10 sessions as patterns emerge. Also check that hooks are actually firing (see viewer).
تحقق: Open viewer during a session; events should stream in real time
Compression calls are expensive
Lower compression depth in config or use Endless Mode (beta) which is cheaper per session
تحقق: Check Anthropic usage dashboard for attribution
<private> content still shows up
Tag must be on its own lines; inline <private>…</private> in the middle of a sentence isn't parsed. Use block form.
تحقق: Reproduce and inspect the stored observation in the viewer
البدائل
claude-mem مقابل البدائل
| البديل | متى تستخدمها | المقايضة |
| Memory MCP | You want explicit, user-controlled memory writes — not passive capture | You do the memory-saving yourself; less ambient, less magic |
| Serena memory | Your use case is code-focused and you'd rather have per-project notes than transcript compression | No session-stream capture; more project-level |
| Just take notes | You prefer explicit, human-curated notes | No automation; discipline-dependent |