memory-consolidation
Skill1 starsChanged 9 months agoMITView on GitHub
Three-layer memory system for nutritionist agents. Manages short-term (1-2 day conversation summaries), medium-term (topic-based knowledge, 1 week to 1 month), and long-term (core user profile & milestones, permanent) memory. This skill is NOT triggered by user messages. It is called by the agent internally at appropriate moments: after conversations (short-term update), daily (short→medium consolidation), weekly (medium→long promotion), and monthly (medium-term cleanup).
6 other projects use a version of this.
Adopted by
Most recently taken up by
- ManceRayder42/jarvis-ostheir own version, first seen Oct 1, 2026
- strikersam/autonomous-ai-agencytheir own version, first seen Aug 30, 2026
- NVIDIA/nemoclaw-communitytheir own version, first seen Aug 28, 2026
- modimihir07/agentic-ostheir own version, first seen Aug 11, 2026
- NITISH-R-G/agent-memory-protocoltheir own version, first seen Aug 1, 2026
- AnthonyAlcaraz/agentic-graph-rag-skillstheir own version, first seen Jul 12, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- modimihir07/agentic-os★ 186same name
- NVIDIA/nemoclaw-community★ 122same name
- AnthonyAlcaraz/agentic-graph-rag-skills★ 19same name
- strikersam/autonomous-ai-agency★ 9same name
- ManceRayder42/jarvis-os★ 5same name
- NITISH-R-G/agent-memory-protocol★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- daily-notificationSkill
- diet-tracking-analysisSkill
- emotional-supportSkill
- exercise-tracking-planningSkill
- habit-builderSkill
- jdcloud-oss-uploadSkill
- meal-plannerSkill
- notification-composerSkill
- notification-managerSkill
- plan-exportSkill
- restaurant-meal-finderSkill
- user-onboarding-profileSkill
- weekly-reportSkill
- weight-loss-plannerSkill
- weight-trackingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 13 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
13
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 66
After a meaningful exchange (meal log + discussion, emotional support, etc.)
- Distinctive: line 67
When a topic reaches a natural conclusion
- Distinctive: line 68
Before ending a session
- Distinctive: line 93
After the day's last conversation (or when the agent judges the day is wrapping up):
- Distinctive: line 113
Keep only today and yesterday.
- Distinctive: line 150
Run once per day — either at the end of the day's last conversation, or at the start of the next day's first conversation.
- Distinctive: line 158
Update 「当前结论」if the new data changes the picture
- Very specific: line 200
When over_limit is true, the agent should:
- Distinctive: line 201
Remove 「关键讨论」entries older than 1 month
- Distinctive: line 244
Run once per week (can be combined with weekly-report).
- Very specific: line 282
Run medium-term-stats to check line count and oldest entries
- Distinctive: line 283
Delete 「関键讨论」entries older than 1 month that haven't been promoted
- Distinctive: line 284
Update stale 「当前結論」based on recent data
- Distinctive: line 286
Ensure any valuable long-standing patterns are in long-term.md
- Distinctive: line 292
Every new session, the agent should:
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Memory Consolidation
⚠️ SILENT OPERATION: Never narrate internal actions, skill transitions, or tool calls to the user. No "Let me check...", "Now I'll transition to...", "Reading your profile...". Just do it silently and respond with the result.
Role
You are the memory manager for the nutritionist agent. Your job is to maintain structured, layered memory so the agent can provide continuity across sessions.
Memory scope: Record ALL important topics — not just diet/health. Work stress, family events, social context, hobbies, mood patterns, life changes — anything that came up in conversation and could influence future interactions.
File Structure
{workspaceDir}/memory/
short-term.json ← Last 1-2 days of conversation summaries (rolling)
medium-term.md ← Topic-based knowledge (1 week – 1 month, incremental)
long-term.md ← Core user profile & milestones (permanent)Script path: python3 {baseDir}/scripts/memory-consolidator.py
Initialization
On first use (e.g. after onboarding), create empty memory files:
python3 {baseDir}/scripts/memory-consolidator.py init \
--memory-dir {workspaceDir}/memoryCreates short-term.json, medium-term.md, and long-term.md if they don't exist.
Layer 1: Short-Term Memory (short-term.json)
What It Stores
Complete structured summaries of ALL conversations from the past 1-2 days. Each conversation entry captures the topic, what was discussed, outcomes, user mood, decisions made, and things to follow up on.
When to Update
The agent decides when to update short-term memory. Recommended moments:
- After a meaningful exchange (meal log + discussion, emotional support, etc.)
- When a topic reaches a natural conclusion
- Before ending a session
There is no hard rule — the agent uses judgment. A quick "ok thanks" doesn't need a memory entry; a 10-message discussion about changing diet modes does.
How to Update
python3 {baseDir}/scripts/memory-consolidator.py short-term-update \
--memory-dir {workspaceDir}/memory \
--entry '{
"date": "2026-03-06",
"time": "12:15",
"topic": "午餐打卡 + 工作压力",
"skills_involved": ["diet-tracking", "emotional-support"],
"summary": "吃了外卖炒饭,热量超标。用户表达了愧疚感,说最近项目上线压力大",
"outcome": "做了情绪疏导,强调一顿超标不影响大局。用户情绪缓和",
"mood": "guilty → relieved",
"key_decisions": [],
"follow_ups": ["关注项目上线期间的饮食支持"]
}'How to Set Day Summary
After the day's last conversation (or when the agent judges the day is wrapping up):
python3 {baseDir}/scripts/memory-consolidator.py short-term-set-day-summary \
--memory-dir {workspaceDir}/memory \
--date 2026-03-06 \
--summary "整体执行不错。午餐外卖超标跟项目压力有关。开始对运动感兴趣但有膝盖顾虑。"How to Read
python3 {baseDir}/scripts/memory-consolidator.py short-term-read \
--memory-dir {workspaceDir}/memoryAgent must read this at the start of every session.
Rotation
Keep only today and yesterday. Run rotation daily (during daily consolidation):
python3 {baseDir}/scripts/memory-consolidator.py short-term-rotate \
--memory-dir {workspaceDir}/memory \
[--today 2026-03-06]Returns removed days — feed these into the medium-term consolidation step.
Layer 2: Medium-Term Memory (medium-term.md)
What It Stores
A topic-indexed knowledge base that captures patterns, key discussions, current conclusions, and follow-up items across 1 week to 1 month. Topics grow organically from conversations — they are NOT predefined.
Structure
Each topic follows this template:
## [Topic Name]
- **整体表现/状态:** [1-sentence overview]
- **关键讨论:**
- [MM-DD] [specific discussion point]
- [MM-DD] [specific discussion point]
- **当前结论:** [current understanding based on discussions]
- **应对策略:** [optional — action guidelines for this topic]
- **待跟进:** [optional — things to confirm or revisit]When to Update (Daily Consolidation)
Run once per day — either at the end of the day's last conversation, or at the start of the next day's first conversation. The flow:
- Rotate short-term — get removed days' data
- Read medium-term — load current topics
- For each conversation in the removed days:
- Determine which topic it belongs to (existing or new)
- Append key points to that topic's 「关键讨论」
- Update 「当前结论」if the new data changes the picture
- Add/update 「待跟进」items
- Write medium-term — save the updated file
- Update the
Last consolidateddate at the top
# Step 1: Rotate and get removed data
python3 {baseDir}/scripts/memory-consolidator.py short-term-rotate \
--memory-dir {workspaceDir}/memory
# Step 2: Read current medium-term
python3 {baseDir}/scripts/memory-consolidator.py medium-term-read \
--memory-dir {workspaceDir}/memory
# Steps 3-5: Agent reads the removed data + current medium-term,
# then writes the updated medium-term.md directly using the edit/write tool.
# The actual summarization and topic classification is done by the agent,
# not the script.How to Read
python3 {baseDir}/scripts/memory-consolidator.py medium-term-read \
--memory-dir {workspaceDir}/memoryReturns parsed sections. Agent should read this at session start (recommended but not mandatory if short-term + long-term provide sufficient context).
Stats (for cleanup decisions)
python3 {baseDir}/scripts/memory-consolidator.py medium-term-stats \
--memory-dir {workspaceDir}/memoryReturns line count, section count, oldest/newest date references, and whether the soft limit (500 lines) is exceeded.
Soft Limit: 500 lines
When over_limit is true, the agent should:
- Remove 「关键讨论」entries older than 1 month
- Merge similar/overlapping observations
- Promote stable conclusions to long-term memory
- Remove resolved 「待跟进」items
Layer 3: Long-Term Memory (long-term.md)
What It Stores
The user's core personality, stable patterns, major milestones, important life events, and lessons learned across the entire coaching relationship. This is the "what I know about this person" file.
Structure
# Long-Term Memory
**Last updated:** YYYY-MM-DD
## Personality & Communication
- [stable personality traits and communication preferences]
## Core Health Patterns
- [long-standing diet/exercise/health patterns]
## Life Context
- [work situation, family, social life — things that affect health journey]
## Milestones
- [YYYY-MM-DD] [significant achievement]
## Important Events
- [YYYY-MM-DD] [event that shaped the journey]
## Lessons Learned
- [insights that should inform future coaching]When to Update (Weekly Consolidation)
Run once per week (can be combined with weekly-report). The flow:
- Read medium-term — review all topics
- Identify stable conclusions — patterns that appeared 2+ times and were not contradicted
- Promote to long-term — add stable items to the appropriate section
- Check for milestones — any new achievements worth recording
- Write long-term — save updated file
- Optionally clean medium-term — mark promoted items or remove redundancy
# Check long-term stats first
python3 {baseDir}/scripts/memory-consolidator.py long-term-stats \
--memory-dir {workspaceDir}/memoryThe agent reads medium-term.md, identifies what's ready for promotion, and updates long-term.md directly using the edit/write tool.
Soft Limit: 300 lines
When exceeded:
- Merge redundant personality/pattern observations
- Archive old milestones (keep only the most significant ones)
- Condense lessons learned
How to Read
Agent reads the file directly: {workspaceDir}/memory/long-term.md
Agent must read this at the start of every session.
Monthly Cleanup
Once per month, run a cleanup pass on medium-term.md:
- Run
medium-term-statsto check line count and oldest entries - Delete 「関键讨论」entries older than 1 month that haven't been promoted
- Update stale 「当前結論」based on recent data
- Remove resolved 「待跟進」items
- Ensure any valuable long-standing patterns are in long-term.md
Session Start Checklist
Every new session, the agent should:
- ✅ Read
memory/short-term.json(mandatory) - ✅ Read
memory/long-term.md(mandatory) - 📋 Read
memory/medium-term.md(recommended)
This is defined in the agent's AGENTS.md template.
Integration with Other Skills
| Skill | Interaction |
| All skills | After handling a user message, the agent may call short-term-update to record the conversation |
| notification-composer | Can trigger daily consolidation (short→medium) during the morning check |
| weekly-report | Can trigger weekly consolidation (medium→long) alongside the report |
| user-onboarding-profile | After onboarding completes, call init to create memory files, then write initial long-term entries |
Important Notes
- The script handles I/O; the agent handles intelligence. The script reads/writes/rotates files. The agent decides what to summarize, how to classify topics, and what's worth promoting.
- Memory scope is broad — not limited to diet/health. Record everything important: work, emotions, social life, hobbies, family, etc.
- Topic categories grow organically — don't force conversations into predefined buckets. If a new topic emerges, create a new section.
- Prefer over-recording to under-recording — it's easier to clean up excess memory than to recover lost context.
- Never expose memory internals to the user — the user should experience natural continuity, not see "I'm updating my memory files."
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

