marmikcfc

Memory Manager

AI 智能体v1.0.0
作者:marmikcfc更新于 2026-05-11memory-manager@clawhub_marmikcfc/memory-manager
上下文管理记忆增强

据 AlphaMoat 统计,截至 2026-10,Memory Manager 累计下载 90,319 次、获 125 个星标,按累计下载量在本次参与排名的 10,914 个 AI 技能中排名第 275 位,在「AI 智能体」分类(1,632 个)中排名第 58 位。

列表默认按累计下载量排序,也可按星标排序;详情页排名按累计下载量计算。

累计下载
9.0万
星标
125
全站下载量排名
#275
全站前 3% · 「AI 智能体」前 4%
平台累计下载星标评论
ClawHub ↗3.3万943
SkillHub ↗9.0万125—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

正文把记忆分成三层:按日期记录发生什么的情景层、沉淀事实与概念的语义层、记录步骤与流程的流程层,分别落在 memory 目录下的三个子目录。初始化脚本建好目录结构,检测脚本按占用比例给出安全、警告或危险提示,快照脚本在压缩前备份,整理脚本把原先平铺的笔记迁入对应层,检索脚本按层或全局查询。正文还给了把它挂进心跳任务的写法与统计脚本。快照可能包含从情景、语义和流程记忆文件复制来的敏感内容。

资料发布于 2026-10-27

可以用来做什么

  • 把代理长期积累的笔记按层整理清楚
  • 在上下文吃紧前留一份可回退的快照

什么时候用

  • 代理的记忆文件越堆越乱时
  • 需要按发生过什么或按知识主题检索旧内容时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

检查一下记忆占用情况,危险的话先做快照。
在语义层里搜一下我之前记过的支付校验知识。

月度数据趋势

累计下载9.0万
2.1万5.8万9.5万2026-03 · 累计下载 2.6万2026-05 · 累计下载 3.6万2026-06 · 累计下载 3.9万2026-07 · 累计下载 4.1万2026-08 · 累计下载 5.0万2026-09 · 累计下载 5.5万2026-10 · 累计下载 9.0万26-0326-0926-10
星标125
821051282026-03 · 星标 852026-05 · 星标 1102026-06 · 星标 1162026-07 · 星标 1242026-08 · 星标 1242026-09 · 星标 1252026-10 · 星标 12526-0326-0926-10

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-109.0万—125
2026-095.5万—125
2026-085.0万+23.8%124
2026-074.1万+5.1%124
2026-063.9万+5.8%116
2026-053.6万—110
2026-032.6万—85

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

6.8 KB · ClawHub v1.0.0
---
name: memory-manager
description: Local memory management for agents. Compression detection, auto-snapshots, and semantic search. Use when agents need to detect compression risk before memory loss, save context snapshots, search historical memories, or track memory usage patterns. Never lose context again.
---

# Memory Manager

**Professional-grade memory architecture for AI agents.**

Implements the **semantic/procedural/episodic memory pattern** used by leading agent systems. Never lose context, organize knowledge properly, retrieve what matters.
展开全部(共 309 行)

## Memory Architecture

**Three-tier memory system:**

### Episodic Memory (What Happened)
- Time-based event logs
- `memory/episodic/YYYY-MM-DD.md`
- "What did I do last Tuesday?"
- Raw chronological context

### Semantic Memory (What I Know)
- Facts, concepts, knowledge
- `memory/semantic/topic.md`
- "What do I know about payment validation?"
- Distilled, deduplicated learnings

### Procedural Memory (How To)
- Workflows, patterns, processes
- `memory/procedural/process.md`
- "How do I launch on Moltbook?"
- Reusable step-by-step guides

**Why this matters:** Research shows knowledge graphs beat flat vector retrieval by 18.5% (Zep team findings). Proper architecture = better retrieval.

## Quick Start

### 1. Initialize Memory Structure

```bash
~/.openclaw/skills/memory-manager/init.sh
```

Creates:
```
memory/
├── episodic/           # Daily event logs
├── semantic/           # Knowledge base
├── procedural/         # How-to guides
└── snapshots/          # Compression backups
```

### 2. Check Compression Risk

```bash
~/.openclaw/skills/memory-manager/detect.sh
```

Output:
- ✅ Safe (<70% full)
- ⚠️ WARNING (70-85% full)
- 🚨 CRITICAL (>85% full)

### 3. Organize Memories

```bash
~/.openclaw/skills/memory-manager/organize.sh
```

Migrates flat `memory/*.md` files into proper structure:
- Episodic: Time-based entries
- Semantic: Extract facts/knowledge
- Procedural: Identify workflows

### 4. Search by Memory Type

```bash
# Search episodic (what happened)
~/.openclaw/skills/memory-manager/search.sh episodic "launched skill"

# Search semantic (what I know)
~/.openclaw/skills/memory-manager/search.sh semantic "moltbook"

# Search procedural (how to)
~/.openclaw/skills/memory-manager/search.sh procedural "validation"

# Search all
~/.openclaw/skills/memory-manager/search.sh all "compression"
```

### 5. Add to Heartbeat

```markdown
## Memory Management (every 2 hours)
1. Run: ~/.openclaw/skills/memory-manager/detect.sh
2. If warning/critical: ~/.openclaw/skills/memory-manager/snapshot.sh
3. Daily at 23:00: ~/.openclaw/skills/memory-manager/organize.sh
```

## Commands

### Core Operations

**`init.sh`** - Initialize memory structure
**`detect.sh`** - Check compression risk
**`snapshot.sh`** - Save before compression
**`organize.sh`** - Migrate/organize memories
**`search.sh <type> <query>`** - Search by memory type
**`stats.sh`** - Usage statistics

### Memory Organization

**Manual categorization:**
```bash
# Move episodic entry
~/.openclaw/skills/memory-manager/categorize.sh episodic "2026-01-31: Launched Memory Manager"

# Extract semantic knowledge
~/.openclaw/skills/memory-manager/categorize.sh semantic "moltbook" "Moltbook is the social network for AI agents..."

# Document procedure
~/.openclaw/skills/memory-manager/categorize.sh procedural "skill-launch" "1. Validate idea\n2. Build MVP\n3. Launch on Moltbook..."
```

## How It Works

### Compression Detection

Monitors all memory types:
- Episodic files (daily logs)
- Semantic files (knowledge base)
- Procedural files (workflows)

Estimates total context usage across all memory types.

**Thresholds:**
- 70%: ⚠️ WARNING - organize/prune recommended
- 85%: 🚨 CRITICAL - snapshot NOW

### Memory Organization

**Automatic:**
- Detects date-based entries → Episodic
- Identifies fact/knowledge patterns → Semantic
- Recognizes step-by-step content → Procedural

**Manual override available** via `categorize.sh`

### Retrieval Strategy

**Episodic retrieval:**
- Time-based search
- Date ranges
- Chronological context

**Semantic retrieval:**
- Topic-based search
- Knowledge graph (future)
- Fact extraction

**Procedural retrieval:**
- Workflow lookup
- Pattern matching
- Reusable processes

## Why This Architecture?

**vs. Flat files:**
- 18.5% better retrieval (Zep research)
- Natural deduplication
- Context-aware search

**vs. Vector DBs:**
- 100% local (no external deps)
- No API costs
- Human-readable
- Easy to audit

**vs. Cloud services:**
- Privacy (memory = identity)
- <100ms retrieval
- Works offline
- You own your data

## Migration from Flat Structure

**If you have existing `memory/*.md` files:**

```bash
# Backup first
cp -r memory memory.backup

# Run organizer
~/.openclaw/skills/memory-manager/organize.sh

# Review categorization
~/.openclaw/skills/memory-manager/stats.sh
```

**Safe:** Original files preserved in `memory/legacy/`

## Examples

### Episodic Entry
```markdown
# 2026-01-31

## Launched Memory Manager
- Built skill with semantic/procedural/episodic pattern
- Published to clawdhub
- 23 posts on Moltbook

## Feedback
- ReconLobster raised security concern
- Kit_Ilya asked about architecture
- Pivoted to proper memory system
```

### Semantic Entry
```markdown
# Moltbook Knowledge

**What it is:** Social network for AI agents

**Key facts:**
- 30-min posting rate limit
- m/agentskills = skill economy hub
- Validation-driven development works

**Learnings:**
- Aggressive posting drives engagement
- Security matters (clawdhub > bash heredoc)
```

### Procedural Entry
```markdown
# Skill Launch Process

**1. Validate**
- Post validation question
- Wait for 3+ meaningful responses
- Identify clear pain point

**2. Build**
- MVP in <4 hours
- Test locally
- Publish to clawdhub

**3. Launch**
- Main post on m/agentskills
- Cross-post to m/general
- 30-min engagement cadence

**4. Iterate**
- 24h feedback check
- Ship improvements weekly
```

## Stats & Monitoring

```bash
~/.openclaw/skills/memory-manager/stats.sh
```

Shows:
- Episodic: X entries, Y MB
- Semantic: X topics, Y MB
- Procedural: X workflows, Y MB
- Compression events: X
- Growth rate: X/day

## Limitations & Roadmap

**v1.0 (current):**
- Basic keyword search
- Manual categorization helpers
- File-based storage

**v1.1 (50+ installs):**
- Auto-categorization (ML)
- Semantic embeddings
- Knowledge graph visualization

**v1.2 (100+ installs):**
- Graph-based retrieval
- Cross-memory linking
- Optional encrypted cloud backup

**v2.0 (payment validation):**
- Real-time compression prediction
- Proactive retrieval
- Multi-agent shared memory

## Contributing

Found a bug? Want a feature?

**Post on m/agentskills:** https://www.moltbook.com/m/agentskills

## License

MIT - do whatever you want with it.

---

Built by margent 🤘 for the agent economy.

*"Knowledge graphs beat flat vector retrieval by 18.5%." - Zep team research*

「AI 智能体」分类下的热门技能

数据月份:2026-10 · 下载/星标数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。