当前位置: 首页 > Skill >

记忆进化 Memory Evolution

记忆进化 Memory Evolution

3.0.2 2026.11.13 浏览:298
获取Skill文件查看使用说明
作者:陈辰许可证:
本文目录展开

Memory Evolution

Self-learning memory with evolution engine, decay-based forgetting, and multi-trigger reflection.

Quick Start

No setup required. The AI automatically creates the data directory on first use.

Data is stored in ~/memory-evolution/. See Architecture below for the directory structure.

Architecture

~/memory-evolution/
├── hot/                    # Always loaded (<=100 lines each)
│   ├── memory.md           # Confirmed rules & preferences
│   └── corrections.md      # User corrections
├── warm/                   # Load on demand
│   ├── projects/           # Per-project learnings
│   └── domains/            # Domain-specific patterns
├── cold/                   # Explicit query only
│   └── archive/            # Decayed patterns
├── engine/                 # Evolution engine data (auto-managed)
│   ├── sensor.json         # Task outcome records
│   ├── world_model.json    # Success pattern predictions
│   ├── evo_devo.json       # Generated strategies
│   └── decay-scores.json   # Decay tracking
├── proposals/              # Engine-generated strategies
│   └── pending.md
├── reflections/            # Reflection outputs
│   └── log.md              # Summaries (newest first)
└── meta.json               # Version info

Three Reflection Triggers

1. Auto (task completion)

"Significant work" = any task that took 5+ tool calls or modified 2+ files.

Steps:

  1. Ask: "Did something go wrong? Did I learn something non-obvious?"
  2. If yes → write to reflections/log.md
  3. If same pattern appears 3x in 7 days → promote to hot/memory.md

Reflection format:

CONTEXT: [task type, e.g. "Electron packaging"]
REFLECTION: [what I noticed, e.g. "adm-zip needs separate include"]
LESSON: [what to do differently, e.g. "Always check asarUnpack for renderer files"]

Correction format (when user corrects you):

## YYYY-MM-DD — [topic]
**What I did wrong**: [specific mistake]
**What I should do**: [correct approach]
**Context**: [when this applies]

Write to hot/corrections.md.

2. Manual (user says "reflect/回顾/反思/做梦")

Steps:

  1. Read hot/memory.md + hot/corrections.md (current state)
  2. Read reflections/log.md (recent reflections)
  3. Read recent conversation context or daily logs (last 7 days)
  4. Identify 2-4 patterns or lessons worth recording
  5. For each: check if it already exists in HOT → skip if duplicate
  6. Write new entries to reflections/log.md
  7. If any lesson is critical (would prevent real damage) → also write to hot/memory.md

Output format:

## YYYY-MM-DD — [topic]

**Context**: [what triggered this]
**Findings**: [2-4 observations]
**Actions**: [what to change/remember]

Stop and confirm before writing to hot/memory.md. Tell user what you plan to add.

3. Dream (scheduled/heartbeat)

Runs during scheduled tasks (e.g. heartbeat automation, cron):

  1. Read engine/decay-scores.json
  2. Recalculate all decay scores using formula
  3. If any score dropped below 0.2 → demote to WARM, log to reflections/log.md
  4. If any score dropped below 0.05 → auto-move to cold/archive/
  5. Read proposals/pending.md → if any pending, include in report
  6. Extract 1-2 patterns from recent activity → append to reflections/log.md

Safety: Before archiving to COLD, log the action with reason. Never delete — only archive.

Decay Model

relevance(t) = base * e^(-0.03 * days_since_access) * log2(access_count + 1) * type_weight
Score Status Behavior
1.0-0.5 Active Fully searchable, in context
0.5-0.2 Fading Load on demand
0.2-0.05 Dormant Explicit search only
< 0.05 Archived Move to COLD

Type weights: hot=1.5, warm=0.8, correction=1.2, engine_strategy=1.0

See references/decay.md for detailed implementation.

Learning Signals

Record (automatic)

  • Task success/failure → engine/sensor.json
  • User correction → hot/corrections.md
  • Pattern confirmed → hot/memory.md

Ignore (do not record)

  • One-time instructions
  • Context-specific commands
  • Hypotheticals

Tiered Storage

Tier Location Limit Behavior
HOT hot/*.md 100 lines each Always in context
WARM warm/projects/, warm/domains/ 200 lines each Load on demand
COLD cold/archive/ Unlimited Explicit query

Promotion / Demotion

  • Used 3x in 7 days → promote to HOT
  • Unused 30 days → demote to WARM
  • Decay < 0.05 → auto-archive to COLD
  • Engine strategy approved → promote to HOT
  • Engine strategy rejected → auto-cull

Evolution Engine

The engine operates on ~/memory-evolution/engine/*.json:

  • sensor — Records task outcomes (success/failure with context)
  • world_model — Predicts which approaches succeed
  • evo_devo — Generates new strategies via pattern evolution
  • covenant — Safety guard (rejects dangerous strategies)

See references/engine.md for module details, data formats, and interaction flow.

Engine Lifecycle

  1. Engine accumulates records passively (sensor)
  2. When enough data collected → evolve() generates strategy proposals
  3. Proposals land in proposals/pending.md
  4. AI or user reviews → approve / reject / modify
  5. Approved → hot/memory.md + engine records success
  6. Rejected → engine records failure, auto-adjusts weights

Proposal Workflow

  1. Engine generates strategy → proposals/pending.md
  2. AI or user reviews → approve / reject / modify
  3. Approved → hot/memory.md + engine records success
  4. Rejected → mark rejected + engine records failure

Quick Queries

User says Action
"What do you know about X?" Search hot/memory.md → warm/ → engine/ concepts
"What have you learned?" Show last 10 corrections + pending proposals
"Show my patterns" List HOT memory + active engine strategies
"Memory stats" Count lines in hot/*.md + files in warm/ + engine entries
"Evolution status" Read engine stage + sensor record count
"Forget X" Search all tiers → list matches → confirm → remove
"Remember X" Write to hot/memory.md. Compact if >100 lines.
"Reflect / 做梦" Run manual reflection cycle (Trigger 2)

Edge Cases

Scenario What to do
hot/memory.md exceeds 100 lines Compact: merge related entries, move oldest to warm/
Data directory missing AI recreates the directory structure automatically
engine/*.json corrupted Rename to .bak, re-init empty, log warning
forget X finds nothing Tell user "X not found in any tier"
remember X is duplicate Tell user "Already known: [existing entry]"
Decay score NaN/invalid Reset to base=0.8, log warning
User contradicts existing rule New rule replaces old. Log in reflections/log.md.

Conflict Resolution

  • Most specific wins (project > domain > global)
  • Most recent wins (same tier)
  • Engine proposal vs manual rule → manual wins
  • User correction vs everything → user wins
  • Ambiguous → ask user

Scope

ONLY:

  • Learns from corrections, reflection, engine proposals
  • Stores in ~/memory-evolution/
  • Runs decay calculations
  • Integrates with scheduled tasks / heartbeat

NEVER:

  • Accesses calendar, email, contacts
  • Makes network requests
  • Infers preferences from silence
  • Deletes memory without confirmation
  • Modifies its own SKILL.md

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,018
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,013
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,013
Skill 文件
  • SKILL.md
    • Memory Evolution
    • Quick Start
    • Architecture
    • Three Reflection Triggers
      • 1. Auto (task completion)
      • 2. Manual (user says "reflect/回顾/反思/做梦")
      • 3. Dream (scheduled/heartbeat)
    • Decay Model
    • Learning Signals
      • Record (automatic)
      • Ignore (do not record)
    • Tiered Storage
      • Promotion / Demotion
    • Evolution Engine
      • Engine Lifecycle
      • Proposal Workflow
    • Quick Queries
    • Edge Cases
    • Conflict Resolution
    • Scope
  • 项目或源文件

相关 Skill

更多
Self-Improving + Proactive Agent Self-Improving + Proactive Agent Self-reflection + Self-criticism + Self-learning + Self-organizing memory. Agent evaluates its own work, catches mistakes, and improves permanently. Use when (1) a command, tool, API, or operation fails; (2) the user corrects you or rejects your work; (3) you realize your knowledge is outdated or incorrect; (4) you discover a better approach; (5) the user explicitly installs or references the skill for the current task.
test-etst-test-tes-1-111 test-etst-test-tes-1-111 Self-reflection + Self-criticism + Self-learning + Self-organizing memory. Agent evaluates its own work, catches mistakes, and improves permanently. Use when (1) a command, tool, API, or operation fails; (2) the user corrects you or rejects your work; (3) you realize your knowledge is outdated or incorrect; (4) you discover a better approach; (5) the user explicitly installs or references the skill for the current task.
Conversation Focus Conversation Focus 对话焦点管理 + 需求澄清引导。每次对话开始时自动分析用户意图,确保需求清晰、限制明确,避免模型分散注意力。自动对接到 self-improving 进行持续优化。
Self-Improving Agent (Proactive Self-Reflection) Self-Improving Agent (Proactive Self-Reflection) 自我反思、自我批评、自主学习与自组织记忆。智能体能评估自身工作、发现错误并实现永久性改进。
Self-reflection Self-reflection Self-reflection + Self-criticism + Self-learning + Self-organizing memory. Agent evaluates its own work, catches mistakes, and improves permanently. Use when (1) a command, tool, API, or operation fails; (2) the user corrects you or rejects your work; (3) you realize your knowledge is outdated or incorrect; (4) you discover a better approach; (5) the user explicitly installs or references the skill for the current task.