MemWeaver — Memory Profiler
Your Agent reads your memory every day, but does it truly understand you?
MemWeaver digs into your memory files — long-term memory (MEMORY.md) and daily logs — to uncover preferences, behavioral patterns, and hidden traits you might not even be aware of, then confirms findings through an interactive questionnaire and outputs a structured user profile (YAML).
What Makes This Different
| Existing tools | What they do | What MemWeaver does differently |
|---|
| Mem0 / Zep | Memory retrieval | Not retrieval — understanding |
| SimpleMem / LightMem |
Memory
compression | Not compression —
insight mining |
| ai-persona-os | Give AI a persona | Opposite direction: discover
your persona from memory |
Core value: MemWeaver finds the gap between what you say you prefer and what you actually do — then asks you about it.
Overview
- - Input:
MEMORY.md (long-term memory) + recent daily logs (memory/*.md) - Process: LLM deep analysis → batch interactive questionnaire
- Output: Structured user profile at INLINECODE3
Workflow
Step 1: Collect Memory
CODEBLOCK0
The script reads long-term memory and recent logs, outputs JSON to stdout. The Agent parses content.long_term and content.daily_logs fields from the JSON.
Note: If estimated_tokens exceeds 8000, consider reducing the --days parameter.
Step 2: LLM Deep Analysis
The Agent analyzes collected memory in 3 sub-tasks:
2.1 Basic Profile Extraction
Extract factual information from memory across these dimensions:
| Dimension | What to extract | Confidence source |
|---|
| Identity | Role, tech stack, MBTI | Explicit statements → 1.0 |
| Work patterns |
Active projects, decision style, creation preference | Behavioral inference → 0.7-0.9 |
| Interests | Professional interests, hobbies, depth of engagement | Topic frequency → 0.6-0.9 |
| Communication | Response depth preference, format preference, dislikes | Interaction pattern → 0.7-0.85 |
| Long-term goals | Career direction, product plans, values | Explicit statements → 0.9-1.0 |
Tag each field with a confidence score.
2.2 Hidden Pattern Mining
This is MemWeaver's most valuable part. The Agent specifically analyzes these 6 types of hidden patterns:
- 1. Decision patterns: What does the user lean toward when facing multiple options? (Analysis-driven vs intuition? Fast vs slow decisions?)
- Time & energy allocation: Does actual energy distribution (from log frequency) match user's self-description?
- Overlooked interests: Topics that appear repeatedly but the user hasn't formally tracked
- Statement vs behavior contradictions: Are stated preferences inconsistent with actual actions?
- Emotion/energy triggers: What scenarios make the user especially productive or resistant?
- Unlabeled skills: Abilities the user demonstrates but hasn't self-recognized
Each finding needs evidence (citing specific memory content) and reasoning logic.
2.3 Project Importance Re-evaluation
List every project and idea recorded in MEMORY.md, provide reassessment:
- - Current status (active / paused / archived / concept)
- Suggested importance (high / medium / low / shelved)
- Assessment reasoning (frequency in logs, recent activity, user investment)
- Questions to confirm with user (if uncertain)
Step 3: Interactive Confirmation (Batch Questionnaire)
Interact with the user in batch mode, similar to a personality test. Each question is based on the user's actual memory content, not just showing analysis conclusions.
Core design principles:
- - Push 5 questions per batch, user answers at once (e.g., "1A 2C 3B 4D 5A"), Agent provides feedback then pushes next batch
- Questions reference user's real memories as context
- Provide options (A/B/C/D or open-ended), user can choose or free-form
- Type B (hidden insight) questions should be ≥50% of total — this is MemWeaver's core value
- Three question types interleaved, not strictly separated by rounds
Question Design Rules:
The Agent designs 10-15 questions based on Step 2 analysis. Three types:
Type A: Scenario Recall (validate profile facts, ≤25%)
Reconstruct a real scene from memory, let user choose the best description.
CODEBLOCK1
Type B: Hidden Insight (core value, ≥50%)
This is MemWeaver's most important question type. The Agent uses specific evidence from memory to point out contradictions or blind spots between user's "self-perception" and "actual behavior".
Methodology:
- 1. Find user's explicit statement (e.g., "I prefer X")
- Find contradictory behavioral records (e.g., logs show consistently doing Y)
- Present the contradiction to user, guide explanation via options
- Options should include: acknowledge contradiction, deny, offer new explanation, other
CODEBLOCK2
Hidden insight mining directions (look for these 6 types of clues in memory):
- 1. Statement vs behavior contradictions: Stated preferences inconsistent with actual actions
- Time allocation truth: Log frequency/length reveals real energy distribution vs stated priorities
- Silence signals: Topics in MEMORY that disappear from logs → possible priority drift
- Energy fingerprint: Length differences across log types → reveals energy sources
- Choice patterns: Consistent tendencies when user faces decisions
- Unlabeled skills: Abilities demonstrated but not self-recognized
Type C: Priority Trade-off (re-evaluate project importance, ≤25%)
Create resource-constraint scenarios, force user to choose between projects, revealing true priorities.
CODEBLOCK3
Question count and batching:
- - Total 10-15 questions, pushed in 2-3 batches (~5 per batch)
- Batch 1 (5 questions): 1-2 warm-up Type A + 3 Type B (hidden insights)
- Batch 2 (5 questions): 3-4 Type B + 1-2 Type C (priority trade-offs)
- Optional Batch 3 (2-3 questions): follow-up questions based on unexpected findings from previous batches
- After each batch, Agent waits for user to answer all at once
Answer processing:
- - After user submits a batch (e.g., "1C 2B 3A 4B 5C"), Agent processes collectively
- Give 1 brief feedback per question, noting profile inference
- If an answer reveals new insight leads, add follow-up questions in next batch
- All answers recorded internally as profile evidence, aggregated into Step 4
Completion:
- - After the last batch, Agent outputs a brief profile summary (like a personality test result page)
- Then proceeds to Step 4
Step 4: Generate and Save Profile
Generate the confirmed profile as YAML and save via script:
- 1. Agent generates complete YAML profile (see "Profile Template" below)
- Save via script:
CODEBLOCK4
Or via stdin:
CODEBLOCK5
The script automatically backs up old profiles and saves to output/profile_YYYYMMDD.yaml.
Profile Template
CODEBLOCK6
Output
- - User profile: INLINECODE10
- Analysis cache:
{baseDir}/cache/analysis_cache.json (future version)
Requirements
No external dependencies. Python 3.8+ standard library only.
MemWeaver — 内存分析器
你的智能体每天都在读取你的记忆,但它真的理解你吗?
MemWeaver深入你的记忆文件——长期记忆(MEMORY.md)和日常日志——以发现偏好、行为模式以及你可能自己都未意识到的隐藏特质,然后通过交互式问卷确认发现,并输出结构化的用户画像(YAML格式)。
独特之处
| 现有工具 | 功能 | MemWeaver的不同之处 |
|---|
| Mem0 / Zep | 记忆检索 | 不是检索——而是理解 |
| SimpleMem / LightMem |
记忆
压缩 | 不是压缩——而是
洞察挖掘 |
| ai-persona-os | 赋予AI人格 | 相反方向:从记忆中发掘
你的人格 |
核心价值:MemWeaver发现你声称的偏好与你实际行为之间的差距——然后向你求证。
概述
- - 输入:MEMORY.md(长期记忆)+ 近期日常日志(memory/*.md)
- 流程:LLM深度分析 → 批量交互式问卷
- 输出:结构化用户画像,保存至 output/profile_YYYYMMDD.yaml
工作流程
步骤1:收集记忆
bash
cd {baseDir} && python3 scripts/collect_memory.py --days 14
该脚本读取长期记忆和近期日志,将JSON输出到标准输出。智能体解析JSON中的content.longterm和content.dailylogs字段。
注意:如果estimated_tokens超过8000,考虑减少--days参数。
步骤2:LLM深度分析
智能体通过3个子任务分析收集到的记忆:
2.1 基础画像提取
从记忆中提取以下维度的事实信息:
| 维度 | 提取内容 | 置信度来源 |
|---|
| 身份 | 角色、技术栈、MBTI | 明确陈述 → 1.0 |
| 工作模式 |
活跃项目、决策风格、创作偏好 | 行为推断 → 0.7-0.9 |
| 兴趣 | 职业兴趣、爱好、投入深度 | 话题频率 → 0.6-0.9 |
| 沟通 | 回复深度偏好、格式偏好、反感点 | 交互模式 → 0.7-0.85 |
| 长期目标 | 职业方向、产品规划、价值观 | 明确陈述 → 0.9-1.0 |
为每个字段标注confidence(置信度)分数。
2.2 隐藏模式挖掘
这是MemWeaver最有价值的部分。智能体专门分析以下6类隐藏模式:
- 1. 决策模式:面对多个选项时用户倾向于什么?(分析驱动 vs 直觉?快速决策 vs 慢速决策?)
- 时间与精力分配:实际精力分布(来自日志频率)是否与用户的自我描述一致?
- 被忽视的兴趣:反复出现但用户未正式追踪的话题
- 陈述与行为矛盾:声称的偏好与实际行为是否不一致?
- 情绪/精力触发因素:什么场景让用户特别高效或抗拒?
- 未标注的技能:用户展示但未自我认知的能力
每个发现需要证据(引用具体记忆内容)和推理逻辑。
2.3 项目重要性重新评估
列出MEMORY.md中记录的每个项目和想法,提供重新评估:
- - 当前状态(活跃 / 暂停 / 归档 / 概念)
- 建议重要性(高 / 中 / 低 / 搁置)
- 评估理由(日志中的频率、近期活动、用户投入)
- 需要向用户确认的问题(如果不确定)
步骤3:交互式确认(批量问卷)
以批量模式与用户交互,类似于人格测试。每个问题基于用户的实际记忆内容,而不仅仅是展示分析结论。
核心设计原则:
- - 每批推送5个问题,用户一次性回答(例如1A 2C 3B 4D 5A),智能体提供反馈后推送下一批
- 问题引用用户的真实记忆作为上下文
- 提供选项(A/B/C/D或开放式),用户可选择或自由回答
- B类(隐藏洞察)问题应占总数的≥50%——这是MemWeaver的核心价值
- 三种问题类型交错出现,不严格按轮次分隔
问题设计规则:
智能体基于步骤2的分析设计10-15个问题。三种类型:
A类:场景回忆(验证画像事实,≤25%)
从记忆中重建真实场景,让用户选择最佳描述。
📋 问题1.
你的记忆显示你在[具体日期]做了[具体行为]。
对你来说,这更像是:
A. [选项:工程直觉 / 习惯驱动]
B. [选项:经验教训]
C. [选项:性格驱动]
D. 其他:_
B类:隐藏洞察(核心价值,≥50%)
这是MemWeaver最重要的问题类型。 智能体使用记忆中的具体证据,指出用户自我认知与实际行为之间的矛盾或盲点。
方法论:
- 1. 找到用户的明确陈述(例如我更喜欢X)
- 找到矛盾的行为记录(例如日志显示一直在做Y)
- 向用户呈现矛盾,通过选项引导解释
- 选项应包括:承认矛盾、否认、提供新解释、其他
📋 问题5.
你的记忆显示[用户的明确陈述]。
但日志显示从[日期A]到[日期B]你一直在做[矛盾行为]。
这两者:
A. 并不矛盾——[合理解释]
B. 确实矛盾——我的真实偏好与自我认知不同
C. 视情况而定——[条件性解释]
D. 其他:_
🔍 你的言语说X,但你的行动说Y
隐藏洞察挖掘方向(在记忆中寻找这6类线索):
- 1. 陈述与行为矛盾:声称的偏好与实际行为不一致
- 时间分配真相:日志频率/长度揭示真实精力分布与声称优先级的差异
- 沉默信号:MEMORY中出现但日志中消失的话题→可能的优先级漂移
- 精力指纹:不同日志类型的长度差异→揭示精力来源
- 选择模式:用户面对决策时的一致倾向
- 未标注的技能:展示但未自我认知的能力
C类:优先级权衡(重新评估项目重要性,≤25%)
创建资源约束场景,迫使用户在项目之间做出选择,揭示真实优先级。
📋 问题10.
如果你下个月只能推进2个个人项目(工作不算),
你的记忆中提到了这些:[来自MEMORY.md的项目列表]
哪两个?
A. [项目1] + [项目2]
B. [项目1] + [项目3]
C. [项目2] + [项目3]
D. 其他组合:_
问题数量与分批:
- - 总计10-15个问题,分2-3批推送(每批约5个)
- 第一批(5个问题):1-2个热身A类 + 3个B类(隐藏洞察)
- 第二批(5个问题):3-4个B类 + 1-2个C类(优先级权衡)
- 可选第三批(2-3个问题):基于前几批意外发现的跟进问题
- 每批后,智能体等待用户一次性回答所有问题
答案处理:
- - 用户提交一批答案后(例如1C 2B 3A 4B 5C),智能体集体处理
- 每个问题给出简短反馈,注明画像推断
- 如果某个答案揭示新的洞察线索,在下一批中添加跟进问题
- 所有答案内部记录为画像证据,汇总到步骤4
完成:
- - 最后一批后,智能体输出简短的画像摘要(如人格测试结果页)
- 然后进入步骤4
步骤4:生成并保存画像
生成确认后的YAML格式画像并通过脚本保存:
- 1. 智能体生成完整的YAML画像(见下方画像模板)
- 通过脚本保存:
bash
cd {baseDir} && python3 scripts/saveprofile.py --file /tmp/memweaverprofile.yaml
或通过标准输入:
bash
echo | cd {baseDir} && python3 scripts/save_profile.py
该脚本自动备份旧画像并保存到output/profile_YYYYMMDD.yaml。
画像模板
yaml
MemWeaver 用户画像
生成日期:YYYY-MM-DD
版本:1
identity:
role:
tech_stack: []
mbti:
confidence: 1.0
work_patterns:
decisionstyle: # datadriven / intuitive / consultative
detail_preference: # high / medium / low
creation_preference: # 0to1 / polish / both
energy_source: