记忆生命周期
memory-lifecycle
by andrewagrahamhodges
Systematic memory management for long-running AI agents. Implements a five-tier lifecycle — heartbeat micro-attention, nightly consolidation, weekly reflection, monthly archiving, and yearly wisdom distillation. Use when setting up a new agent's memory system, improving an existing agent's memory quality, or when the agent's MEMORY.md is growing too large and context quality is degrading. Triggers on "set up memory", "memory management", "improve memory", "memory lifecycle", "nightly consolidation", "sleep cycle", "memory housekeeping".
安装
claude skill add --url https://github.com/openclaw/skills文档
Memory Lifecycle
Structured memory management that makes agents smarter over time — not through code, but through disciplined capture, consolidation, and distillation of context.
Philosophy
Memory management is not about saving tokens. It's about crafting high-signal context that makes a powerful LLM more effective.
Core principles:
- Distill, don't summarise. Output should be better than raw input — structured, actionable, reasoning preserved
- Preserve decisions and reasoning. "We chose X because Y" > "We did X"
- Never compress away specifics. Phone numbers, dates, prices are facts, not fluff
- Daily files are immutable. They're the audit trail — add headers, never edit content
- Each tier builds upward. Raw → structured → refined → wisdom
- Archives are a library, not a bin. Full narratives, not one-liners
Setup
Run the setup script to scaffold memory files and create cron jobs:
python3 scripts/setup.py
The script will:
- Create structured memory files (people.md, decisions.md, lessons.md, commitments.md)
- Add a
## Recentworking memory buffer to MEMORY.md - Create four cron jobs (nightly, weekly, monthly, yearly)
- Add memory micro-attention tasks to HEARTBEAT.md
Run with --dry-run to preview changes without applying them.
Run with --agent <id> to target a specific agent (default: main).
The Five Tiers
Tier 1: Heartbeat Micro-Attention (every ~30 min)
Added to the agent's HEARTBEAT.md. Quick focused pass — capture, promote, tag:
- Capture: Ensure notable events are in today's
memory/YYYY-MM-DD.md - Promote: Session-critical items (new appointment, key decision) →
MEMORY.md → ## Recent - Tag: Mark daily file entries with
[decision],[lesson],[person]for the nightly cycle - Monitor: Check nightly cycle health — if it errored, fix and re-run. Don't just report.
Tier 2: Nightly "Sleep Cycle" (cron, ~2:00 AM local)
Read references/nightly-prompt.md for the full cron prompt.
- Read today's daily file end-to-end
- Write a 2-3 line "day essence" header
- Promote items to structured files (people → people.md, decisions → decisions.md, etc.)
- Update MEMORY.md if active project state changed
- Clear processed items from
## Recent
Rules: Never edit daily file content. Never remove from MEMORY.md unless completed AND archived.
Tier 3: Weekly Reflection (cron, Sunday ~3:00 AM local)
Read references/weekly-prompt.md for the full cron prompt.
- Read all 7 daily files from the past week
- Spot patterns: repeated topics, unresolved threads
- Refine MEMORY.md — improve structure and language (not strip content)
- Review commitments, contacts, decisions for staleness
- Write a "week in review" in Sunday's daily file
Tier 4: Monthly Deep Clean (cron, 1st of month ~4:00 AM local)
Read references/monthly-prompt.md for the full cron prompt.
- Create
memory/archive/YYYY-MM.mdwith full narratives of completed work - Move completed items from MEMORY.md to archive
- Keep MEMORY.md under ~4000 words
- Consolidate related lessons into principles
- Personality check on SOUL.md
Rules: Archive entries must be self-contained. Active items never move to archive.
Tier 5: Yearly Wisdom Distillation (cron, January 1)
Read references/yearly-prompt.md for the full cron prompt.
- Create
memory/wisdom/YYYY.md - Extract wisdom that transcends specific events
- Evolve SOUL.md based on a year's experience
- Flag SOUL.md changes to the human
The "Recent" Buffer
A ## Recent section at the top of MEMORY.md acts as working memory:
## Recent
> Working memory — heartbeat promotes critical items here, nightly cycle processes them.
- **2026-03-23:** Viewing booked Thu 26 Mar 9am with estate agent
- **2026-03-23:** Server upgraded v2.3.13 → v2.3.22
- Heartbeats promote critical items here immediately
- Every new session sees it (MEMORY.md is loaded automatically)
- Nightly cycle processes items and clears them
This bridges the gap between raw daily capture and curated long-term memory.
File Structure
After setup, the memory directory contains:
MEMORY.md ← Active long-term memory (loaded every session)
memory/
YYYY-MM-DD.md ← Daily raw notes (immutable)
people.md ← Contacts, relationships, dynamics
decisions.md ← Key choices with rationale
lessons.md ← Mistakes and learnings (grows, never shrinks)
commitments.md ← Deadlines and obligations
archive/
YYYY-MM.md ← Monthly archives (full narratives)
wisdom/
YYYY.md ← Yearly distilled wisdom
Health Check
Run the health check to verify the memory system is working:
python3 scripts/health_check.py
Checks: nightly cron status, MEMORY.md size, Recent buffer staleness, structured file freshness.
What Gets Archived vs What Stays
- Archive: Completed projects, resolved leads, past deadlines, finished work
- Keep active: Ongoing relationships, active projects, preferences, lessons learned
- Never compress: Phone numbers, addresses, credentials, family details, business structure
相关 Skills
Claude接口
by anthropics
面向接入 Claude API、Anthropic SDK 或 Agent SDK 的开发场景,自动识别项目语言并给出对应示例与默认配置,快速搭建 LLM 应用。
✎ 想把Claude能力接进应用或智能体,用claude-api上手快、兼容Anthropic与Agent SDK,集成路径清晰又省心
RAG架构师
by alirezarezvani
聚焦生产级RAG系统设计与优化,覆盖文档切块、检索链路、索引构建、召回评估等关键环节,适合搭建可扩展、高准确率的知识库问答与检索增强应用。
✎ 面向RAG落地,把知识库、向量检索和生成链路系统串联起来,做架构设计时更清晰,也更少踩坑。
智能体流程设计
by alirezarezvani
面向生产级多 Agent 编排,梳理顺序、并行、分层、事件驱动、共识五种工作流设计,覆盖 handoff、状态管理、容错重试、上下文预算与成本优化,适合搭建复杂 AI 协作系统。
✎ 帮你把多智能体流程设计、编排和自动化统一起来,复杂工作流也能更稳地落地,适合追求强控制力的团队。
相关 MCP 服务
知识图谱记忆
编辑精选by Anthropic
Memory 是一个基于本地知识图谱的持久化记忆系统,让 AI 记住长期上下文。
✎ 帮 AI 和智能体补上“记不住”的短板,用本地知识图谱沉淀长期上下文,连续对话更聪明,数据也更可控。
顺序思维
编辑精选by Anthropic
Sequential Thinking 是让 AI 通过动态思维链解决复杂问题的参考服务器。
✎ 这个服务器展示了如何让 Claude 像人类一样逐步推理,适合开发者学习 MCP 的思维链实现。但注意它只是个参考示例,别指望直接用在生产环境里。
PraisonAI
编辑精选by mervinpraison
PraisonAI 是一个支持自反思和多 LLM 的低代码 AI 智能体框架。
✎ 如果你需要快速搭建一个能 24/7 运行的 AI 智能体团队来处理复杂任务(比如自动研究或代码生成),PraisonAI 的低代码设计和多平台集成(如 Telegram)让它上手极快。但作为非官方项目,它的生态成熟度可能不如 LangChain 等主流框架,适合愿意尝鲜的开发者。