Memory Evolution: Enabling Agents with Persistent Memory and Self-Learning Evolution

Preface

When using agents like Cursor and Claude Code to write code over long periods, a common problem is that once a session ends, the corrected preferences and the pitfalls encountered in the project are lost; next time you have to start explaining from scratch. Some people write key points into AGENTS.md or notes, but static documents don’t adjust priority based on usage frequency, nor do they infer strategies from task successes and failures. Below is an introduction to the community Skill on SkillHub called Memory Evolution (coordinate @user_0327da8d/memory-evolution, current version 3.0.2), which combines a persistent knowledge base, decay-based forgetting, and multi-trigger reflection into a locally running memory system.

What Is This

Memory Evolution is a self-learning memory evolution system for AI agents: it uses an evolution engine, a decay-based forgetting model, and multi-path reflection triggers to mimic human memory consolidation and fading; it builds knowledge that can be reused long-term from user corrections, self-reflection, and automatic pattern detection.

  • Release channel: SkillHub community (community), category ai-agent
  • Publisher: user_0327da8d
  • Dependencies: requires_api_key=false; the evolution engine is described as fully local with no network required
  • Official pages: SkillHub Skill Page, API Entry

It merges the author’s earlier ideas across self-improving, cognitive-memory, and ontology into a unified, out-of-the-box memory layer, rather than temporary context within a single conversation.

Three-Layer Storage with Automatic Tiering

The system divides memory into HOT, WARM, and COLD layers, each with different purposes and loading behavior:

Layer Purpose Behavior
HOT Core rules, user preferences, correction records Always loaded into context (single file ≤100 lines)
WARM Project-level experience, domain knowledge Loaded on demand (single file ≤200 lines)
COLD Archived historical experience Retrieved only upon explicit query

Automatic tiering rules (official description):

  1. Patterns used 3 times within 7 days can be promoted to HOT.
  2. Entries unused for 30 days can be demoted to WARM.
  3. When the decay score falls below a threshold, entries are archived to COLD rather than deleted.

Thus, core constraints remain in context, project experience is pulled according to tasks, and historical content remains searchable—avoiding loading all memory into the prompt at once.

Evolution Engine

Four modules work together locally without external network calls:

  1. Sensor: Records the outcome and context of each task.
  2. World Model: Analyzes history to predict practices more likely to succeed.
  3. Evo Devo: Uses genetic-algorithm ideas to generate new strategy proposals.
  4. Covenant: A safety guard that intercepts dangerous strategies.

The engine grows through stages: embryonic (passive recording) → juvenile (begins proposing) → mature (proactively evolves) → expert (high-confidence prediction). It suits scenarios where you want to gradually solidify ways of working for repeated task types while maintaining guardrails.

Decay-Based Forgetting

Forgetting isn’t a simple time-based clearing; it’s driven by a relevance score that governs archiving. The official formula is:

relevance = base × e^(-0.03 × days) × log2(access_count + 1) × type_weight

Example type weights: HOT core rules 1.5 (slow decay), user corrections 1.2, project experience 0.8 (faster decay). Entries are not automatically deleted; they are only archived to COLD, avoiding “forgetting without traceability.”

Reflection and Safety

Three Reflection Triggers

  1. Automatic reflection: Triggered after important tasks (official conditions: 5+ tool calls, or modifications to 2+ files), asking “what did I learn,” and recording only non-obvious lessons.
  2. Manual reflection: When the user says “reflect,” “review,” or “dream,” the system reads recent memories, extracts 2–4 patterns, and requires confirmation before writing.
  3. Scheduled dreaming: Paired with a heartbeat or scheduled task, it recomputes decay, demotes expired entries, and organizes proposals pending review.

Safety Design

  • Must confirm with the user before writing to HOT.
  • Forgetting is executed only after user confirmation.
  • Archiving only moves, never deletes, and records the reason.
  • User corrections take precedence over engine proposals; preferences are not inferred from silence.

In long-term collaboration, these rules reduce the risk of agents unilaterally solidifying wrong preferences or mistakenly deleting memories.

Installation and Activation

In the SkillHub installation flow, send the official prompt to the agent to install @user_0327da8d/memory-evolution per skillhub.cn/install/skillhub.md. Client-specific differences are governed by that installation document; this article does not fabricate IDE-specific commands.

After installation, initialize the local data directory under the Skill directory:

python scripts/init.py

To place data in a custom path:

python scripts/init.py --path /your/data/directory

Official documentation states support for Windows, macOS, and Linux. After initialization, memory files and the evolution engine are maintained in the local directory, without relying on an API key.

Typical Usage

Combined with official descriptions, you can collaborate with the Skill as follows (wording should align with the SKILL.md your agent actually follows; refer to the instructions in the installed package):

  1. Corrections and preferences: When you correct the agent’s mistakes or state preferences, the relevant content can enter the memory system; the agent should ask for confirmation before writing to HOT.
  2. Post-task consolidation: After complex tasks (multiple tool calls or multi-file modifications), rely on automatic reflection to write lessons into WARM/HOT instead of leaving them only in the current conversation.
  3. Proactive tidying: Say “review” or “reflect” to let the agent summarize recent patterns; confirm before persisting.
  4. Scheduled maintenance: Trigger the “dreaming” flow in a heartbeat or cron-like task to refresh decay scores and tiers, preventing HOT from being filled with niche entries.
  5. History queries: When old experience is needed, perform explicit queries; the COLD layer responds rather than loading all archives by default.

It’s not suitable to treat it as a general Q&A plugin: for simple greetings, one-off instructions, or short Q&A that doesn’t need consolidation, there’s no need to run the full memory pipeline (consistent with the Skill’s design goals—reduce meaningless writes).

Applicable Scenarios and Caveats

More suitable for:

  • Codebases or product projects spanning weeks or months that need to accumulate domain conventions and pitfall records.
  • Multi-person collaboration where you want the agent to remember different members’ corrections and preferences (still subject to HOT confirmation constraints).
  • Complex automation workflows where you want to induct strategies from success/failure records and filter dangerous proposals via Covenant.

Points to note:

  • This is a community Skill; behavior is governed by the package’s SKILL.md and scripts. After upgrading (e.g., to 3.0.2), it’s recommended to read the change notes again.
  • HOT has a line limit; put truly “must-follow every time” content into the core layer, and the rest into WARM/COLD.
  • Archiving without deletion doesn’t mean governance can be ignored: regularly tidy via manual reflection or scheduled tasks; otherwise WARM/COLD will still grow and increase retrieval cost.

Conclusion

Memory Evolution binds together hierarchical storage, a local evolution engine, decay-based archiving, and multiple reflection triggers, targeting agent scenarios that “get more aligned with projects and users the more you use them.” To try it in your environment, install @user_0327da8d/memory-evolution from SkillHub, run python scripts/init.py to initialize, and then use it in long-term tasks with corrections and reflection.

Official URL: https://www.skillhub.cn/skills/user_0327da8d/memory-evolution

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye