managing-memory by designnotdrum/brain-jar
npx skills add https://github.com/designnotdrum/brain-jar --skill managing-memory重要提示:在使用记忆工具之前,请确保 MCP 服务器已构建并配置好:
# 检查是否已构建
ls ~/.claude/plugins/cache/brain-jar/shared-memory/*/dist/index.js 2>/dev/null || echo "NOT_BUILT"
如果显示 NOT_BUILT,请运行设置:
node ~/.claude/plugins/cache/brain-jar/shared-memory/*/run.js &
sleep 15
然后检查 Mem0 配置:
cat ~/.config/brain-jar/config.json 2>/dev/null || echo "NOT_CONFIGURED"
如果显示 NOT_CONFIGURED,请向用户询问他们的 Mem0 API 密钥(可在 https://app.mem0.ai 获取),然后创建配置:
mkdir -p ~/.config/brain-jar
cat > ~/.config/brain-jar/config.json << 'EOF'
{
"mem0_api_key": "USER_API_KEY_HERE",
"default_scope": "global",
"auto_summarize": true
}
EOF
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
注意:本地存储无需 Mem0 配置即可工作 - 云同步是可选的。
设置完成后,用户必须重启 Claude Code 以使 MCP 注册。
当你观察到以下情况时,请存储记忆:
不好的例子(过于枯燥):
User chose Neon for database.
好的例子(捕捉上下文和情感):
User chose Neon over Supabase for Postgres hosting - appreciated the more generous
free tier limits. Showed strong preference for managed solutions: "I'm not running
my own infra" - values simplicity and time savings over control.
包含:
global - 个人偏好、一般性学习、跨项目模式project:<name> - 特定于当前项目(从工作目录检测)对于适用于所有地方的偏好,请使用 global。对于特定于一个代码库的架构决策、技术选择和模式,请使用 project:。
在以下情况之前:
使用自然的回忆语言:
当搜索或列出可能返回大量结果(10 个以上)的记忆时,派遣一个 Haiku 子代理来处理和总结:
何时使用子代理:
如何派遣:
使用 Task 工具:
subagent_type: "general-purpose"model: "haiku"prompt: "搜索用户记忆并提供摘要。任务:[用户正在寻找的内容]
步骤:
输出:简洁的摘要,而非原始记忆转储。"
告诉用户: 子代理的摘要。不要将所有原始记忆转储到上下文中。
何时使用直接工具:
示例流程:
User: What do I usually prefer for state management?
You: Let me search your memories for state management preferences...
[Dispatch Haiku subagent]
Subagent returns:
"Found 7 memories about state management. Key patterns:
- Strong preference for Zustand over Redux (called Redux 'too much boilerplate')
- Uses React Query for server state ('keeps server/client state separate')
- Avoids global state when possible - prefers component-level state
Notable quote: 'I want the simplest thing that works'"
You: Based on your past preferences, you tend to favor Zustand for client state
and React Query for server state. You've mentioned wanting "the simplest thing
that works" - should I keep that philosophy for this feature?
preference - 喜好/厌恶decision - 做出的具体选择architecture - 系统设计模式personality - 工作风格、沟通偏好project - 项目特定上下文session-summary - 会话结束时的整合profile-context - 个人资料偏好的背景上下文profile-learning - 为个人资料提供信息的观察结果对于结构化的用户个人资料管理(姓名、角色、技术偏好、工作风格),请使用 learning-about-you 技能,而不是存储为自由格式的记忆。
使用记忆来记录:
使用个人资料来记录:
个人资料是可查询的,并在所有 brain-jar 插件中共享。记忆为个人资料条目提供了上下文和"原因"。
每周安装数
1
代码仓库
GitHub 星标数
2
首次出现
今天
安全审计
安装于
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
IMPORTANT : Before using memory tools, ensure the MCP server is built and configured:
# Check if built
ls ~/.claude/plugins/cache/brain-jar/shared-memory/*/dist/index.js 2>/dev/null || echo "NOT_BUILT"
If NOT_BUILT, run the setup:
node ~/.claude/plugins/cache/brain-jar/shared-memory/*/run.js &
sleep 15
Then check for Mem0 config:
cat ~/.config/brain-jar/config.json 2>/dev/null || echo "NOT_CONFIGURED"
If NOT_CONFIGURED, ask user for their Mem0 API key (get one at https://app.mem0.ai), then create config:
mkdir -p ~/.config/brain-jar
cat > ~/.config/brain-jar/config.json << 'EOF'
{
"mem0_api_key": "USER_API_KEY_HERE",
"default_scope": "global",
"auto_summarize": true
}
EOF
Note: Local storage works without Mem0 config - cloud sync is optional.
After setup, user must restart Claude Code for MCP to register.
Store memories when you observe:
Bad (too dry):
User chose Neon for database.
Good (captures context and sentiment):
User chose Neon over Supabase for Postgres hosting - appreciated the more generous
free tier limits. Showed strong preference for managed solutions: "I'm not running
my own infra" - values simplicity and time savings over control.
Include:
global - Personal preferences, general learnings, cross-project patternsproject:<name> - Specific to current project (detect from working directory)Use global for preferences that apply everywhere. Use project: for architectural decisions, tech choices, and patterns specific to one codebase.
Before:
Use natural recall language:
When searching or listing memories that could return many results (10+), dispatch a Haiku subagent to process and summarize:
When to use subagent:
How to dispatch:
Use Task tool:
subagent_type: "general-purpose"model: "haiku"prompt: "Search user memories and provide a summary.TASK: [what user is looking for]
STEPS:
OUTPUT: Concise summary, not raw memory dumps."
Tell the user: The subagent's summary. Don't dump all raw memories into context.
When to use direct tools:
Example flow:
User: What do I usually prefer for state management?
You: Let me search your memories for state management preferences...
[Dispatch Haiku subagent]
Subagent returns:
"Found 7 memories about state management. Key patterns:
- Strong preference for Zustand over Redux (called Redux 'too much boilerplate')
- Uses React Query for server state ('keeps server/client state separate')
- Avoids global state when possible - prefers component-level state
Notable quote: 'I want the simplest thing that works'"
You: Based on your past preferences, you tend to favor Zustand for client state
and React Query for server state. You've mentioned wanting "the simplest thing
that works" - should I keep that philosophy for this feature?
preference - Likes/dislikesdecision - Specific choices madearchitecture - System design patternspersonality - Working style, communication preferencesproject - Project-specific contextsession-summary - End-of-session consolidationprofile-context - Background context for profile preferencesprofile-learning - Observations that inform the user profileFor structured user profile management (name, role, tech preferences, working style), use the learning-about-you skill instead of storing as freeform memories.
Use memories for:
Use profile for:
The profile is queryable and shared across all brain-jar plugins. Memories provide the context and "why" behind profile entries.
Weekly Installs
1
Repository
GitHub Stars
2
First Seen
Today
Security Audits
Gen Agent Trust HubPassSocketWarnSnykFail
Installed on
zencoder1
amp1
cline1
openclaw1
opencode1
cursor1
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
111,800 周安装