← 返回 Skills 市场
trypto1019

Memory Pruner

作者 ArcSelf · GitHub ↗ · v1.1.0
darwinlinux ✓ 安全检测通过
1417
总下载
0
收藏
6
当前安装
2
版本数
在 OpenClaw 中安装
/install arc-memory-pruner
功能描述
Automatically prune and compact agent memory files to prevent unbounded growth. Circular buffer for logs, importance-based retention for state, and configura...
使用说明 (SKILL.md)

Memory Pruner

Keep your agent's memory lean. Automatically prune logs, compact state files, and enforce size limits so your agent never runs out of disk or context window.

Why This Exists

Agents accumulate memory files over time. Logs grow unbounded. State files collect stale entries. Eventually your boot-up reads 50K tokens of memory and half of it is outdated. Memory Pruner enforces limits and keeps only what matters.

Commands

Prune a memory file (keep last N lines)

python3 {baseDir}/scripts/memory_pruner.py prune --file ~/wake-state.md --max-lines 200

Prune a log directory (circular buffer, keep last N files)

python3 {baseDir}/scripts/memory_pruner.py prune-logs --dir ~/agents/logs/ --keep 7

Compact a state file (remove sections matching a pattern)

python3 {baseDir}/scripts/memory_pruner.py compact --file ~/wake-state.md --remove-before "2026-02-14"

Check memory sizes

python3 {baseDir}/scripts/memory_pruner.py stats --dir ~/

Dry run (show what would be pruned)

python3 {baseDir}/scripts/memory_pruner.py prune --file ~/wake-state.md --max-lines 200 --dry-run

Features

  • Line-based pruning: Keep last N lines of any file
  • Log rotation: Circular buffer for log directories (keep last N files, delete oldest)
  • Date-based compaction: Remove entries older than a cutoff date
  • Size limits: Enforce max file sizes in bytes
  • Dry run mode: Preview changes before applying
  • Stats: Overview of memory file sizes and growth rates
安全使用建议
This skill appears coherent and low-risk for its stated purpose, but follow these precautions before using it: (1) Review the _ALLOWED_BASES list in scripts/memory_pruner.py to ensure it covers only the agent memory paths you expect; the script will block any path outside that list. (2) Run commands with --dry-run first to preview deletions. (3) Note the script refuses to prune symlinks — if your memory files are symlinked, the tool will not touch them. (4) Back up important state before running destructive operations. (5) If you need other directories pruned, modify the allowlist deliberately (and review the code change) rather than providing arbitrary paths. Overall the skill does not request secrets or network access and matches its description.
功能分析
Type: OpenClaw Skill Name: arc-memory-pruner Version: 1.1.0 The 'arc-memory-pruner' skill is designed for legitimate agent memory management, including pruning, compaction, and statistics. The Python script `scripts/memory_pruner.py` implements a robust security control (`_validate_prune_path`) that strictly whitelists allowed directories (`~/.openclaw`, `~/.claude`, etc.) and uses `os.path.realpath` to prevent path traversal attacks. It also explicitly blocks pruning of symlinks. There is no evidence of data exfiltration, malicious command execution, persistence mechanisms, or prompt injection attempts in SKILL.md. All operations are confined to the stated purpose and secured against common file system vulnerabilities.
能力评估
Purpose & Capability
Name/description (prune and compact agent memory) match the included Python script and SKILL.md. Declared requirement (python3) is appropriate and no unrelated credentials or binaries are requested.
Instruction Scope
SKILL.md examples show running the script against files/dirs like ~/wake-state.md and ~/agents/logs; the bundled script enforces an allowlist of base directories and will block operations outside those locations. That restriction is coherent with the stated purpose but means example commands that target arbitrary paths or ~ may be blocked. The script refuses symlinks and will perform destructive deletes unless --dry-run is used.
Install Mechanism
No install spec; instruction-only skill plus a local Python script. Nothing is downloaded or executed from external URLs, so install risk is low.
Credentials
No environment variables, credentials, or config paths are requested. The script operates solely on local files under a limited set of directories.
Persistence & Privilege
always is false and the skill does not request persistent/privileged platform settings. Autonomous invocation is allowed by default but not combined with other red flags here.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install arc-memory-pruner
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /arc-memory-pruner 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
- Version bump to 1.1.0. - scripts/memory_pruner.py updated.
v1.0.0
Initial release of memory-pruner - Automatically prunes and compacts agent memory files to prevent unbounded growth. - Supports circular buffer for logs and importance-based retention for state files. - Enforces configurable size limits on logs and state files. - Provides dry run mode to preview pruning actions without applying changes. - Includes command-line tools to prune files/directories, compact by date, and check memory sizes.
元数据
Slug arc-memory-pruner
版本 1.1.0
许可证
累计安装 6
当前安装数 6
历史版本数 2
常见问题

Memory Pruner 是什么?

Automatically prune and compact agent memory files to prevent unbounded growth. Circular buffer for logs, importance-based retention for state, and configura... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1417 次。

如何安装 Memory Pruner?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install arc-memory-pruner」即可一键安装,无需额外配置。

Memory Pruner 是免费的吗?

是的,Memory Pruner 完全免费(开源免费),可自由下载、安装和使用。

Memory Pruner 支持哪些平台?

Memory Pruner 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(darwin, linux)。

谁开发了 Memory Pruner?

由 ArcSelf(@trypto1019)开发并维护,当前版本 v1.1.0。

💬 留言讨论