首页
看点啥
插画图片
首页 科技看点 内存管理器:高级上下文与知识管理 - Openclaw Skills

内存管理器:高级上下文与知识管理 - Openclaw Skills

2026-08-24 0

什么是 内存管理器?

内存管理器是一款专为 AI 智能体设计的专业级架构,旨在以类人认知系统的复杂度处理上下文。通过实施情景、语义和程序三层内存模式,该工具确保智能体不仅是存储数据,而是为了实现最优检索而组织数据。使用此类 Openclaw Skills 可以让开发者超越扁平的文本文件,实现结构化的知识图谱方法。

该系统专为需要维持长期上下文且无需外部向量数据库的开销或隐私担忧的智能体而构建。它提供本地优先、人类可读的存储,使检索效率提高 18.5%。通过监控内存使用并提供自动快照,它能够有效防止通常与 LLM 令牌限制相关的上下文丢失。

下载入口:https://github.com/openclaw/skills/tree/main/skills/marmikcfc/memory-manager

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install memory-manager

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 memory-manager。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

内存管理器 应用场景

内存管理器 工作原理
  1. 系统初始化专门的目录结构,以存放不同类型的智能体内存。
  2. 情景日志捕获按时间顺序排列的事件,提供智能体行为的每日历史。
  3. 检测引擎监控内存容量,并在达到 70% 和 85% 阈值时发出警告。
  4. 整理脚本解析原始内存,识别并将事实迁移至语义存储,将工作流迁移至程序存储。
  5. 搜索工具允许智能体查询特定的内存层级(情景、语义或程序),以实现高度相关的上下文检索。

内存管理器 配置指南

要开始使用 Openclaw Skills 管理智能体上下文,请运行初始化脚本以设置目录结构:

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

然后,您可以检查现有的内存风险或整理当前的扁平文件内存日志:

# 检查压缩风险
~/.openclaw/skills/memory-manager/detect.sh

# 整理现有内存
~/.openclaw/skills/memory-manager/organize.sh

内存管理器 数据架构与分类体系

该技能将数据组织成层级结构,以最大化检索准确性和人类可读性:

目录 类型 描述
memory/episodic/ 情景 按时间顺序排列的事件日志(例如 YYYY-MM-DD.md)。
memory/semantic/ 语义 提炼的事实、概念和永久知识节点。
memory/procedural/ 程序 可重复使用的分步指南和工作流模式。
memory/snapshots/ 备份 在内存清除前生成的压缩快照。
memory/legacy/ 归档 迁移到层级结构后保留的原始文件。
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.

Memory Architecture

Three-tier memory system:

Episodic Memory (What Happened)

Semantic Memory (What I Know)

Procedural Memory (How To)

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

~/.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

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

Output:

3. Organize Memories

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

Migrates flat memory/*.md files into proper structure:

4. Search by Memory Type

# 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

## 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 - Search by memory type stats.sh - Usage statistics

Memory Organization

Manual categorization:

# 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
2. Build MVP
3. Launch on Moltbook..."

How It Works

Compression Detection

Monitors all memory types:

Estimates total context usage across all memory types.

Thresholds:

Memory Organization

Automatic:

Manual override available via categorize.sh

Retrieval Strategy

Episodic retrieval:

Semantic retrieval:

Procedural retrieval:

Why This Architecture?

vs. Flat files:

vs. Vector DBs:

vs. Cloud services:

Migration from Flat Structure

If you have existing memory/*.md files:

# 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

# 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

# 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

# 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

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

Shows:

Limitations & Roadmap

v1.0 (current):

v1.1 (50+ installs):

v1.2 (100+ installs):

v2.0 (payment validation):

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

喜欢(0)

上一篇

蚂蚁庄园7月21日今日答案2026

蚂蚁庄园7月21日今日答案2026

下一篇

无限暖暖小玉石任务的三处拍摄位置点位

无限暖暖小玉石任务的三处拍摄位置点位
猜你喜欢