Memory Pruner for Openclaw

A specialized utility to automatically prune, compact, and manage the size of AI agent memory and log files.

trypto1019
v1.1.0
Feb 17, 2026
0
1.4k
6

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install arc-memory-pruner

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install arc-memory-pruner using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Memory Pruner?

Memory Pruner is an essential tool for developers building long-running agents. It prevents the common problem of unbounded memory growth, where logs and state files eventually consume too much disk space or overwhelm an agent's context window. By implementing a circular buffer for logs and importance-based retention for state, it ensures that your agent remains efficient and cost-effective. Use this skill to keep your Openclaw Skills organized and prevent boot-up delays caused by reading tens of thousands of tokens of stale memory data.

Memory Pruner Use Cases

  • Prevent agent state files from exceeding token limits during boot-up.
  • Implement log rotation for long-running autonomous processes.
  • Clean up stale historical data older than a specific date.
  • Monitor memory file sizes and growth rates across different agent instances.
  • Safely preview memory cleanup operations using dry-run mode.

How Memory Pruner Works

  1. The user or system triggers a pruning command via Python to target specific memory files or log directories.
  2. The utility analyzes the file content based on specified constraints, such as max lines, file count, or date cutoffs.
  3. For logs, it manages a circular buffer, deleting the oldest files while keeping the most recent history.
  4. For state files, it compacts the markdown or text content by removing sections that match the pruning criteria.
  5. It outputs a summary of the operations performed, ensuring your Openclaw Skills maintain a lean data footprint.

Memory Pruner Setup

Ensure you have python3 installed on your system (macOS or Linux).

# Check for python availability
python3 --version

# Run the stats command to see current memory usage across your agents
python3 scripts/memory_pruner.py stats --dir ~/

Memory Pruner Data Schema & Taxonomy

Memory Pruner operates on standard text, markdown, and log files. It does not require a complex database but tracks metadata through file system attributes and line parsing.

Target Type Retention Strategy Metadata Tracked
State Files (.md) Max line count or date-based compaction Line indices, Date patterns
Log Directories Circular buffer (last N files) Timestamp-based sorting, File count
Global Stats Cumulative size monitoring Growth rates, Disk usage in bytes

Memory Pruner Advanced Features

  • Circular buffer management for log directories to prevent disk overflow.
  • Regex-based compaction to remove specific patterns or outdated sessions from state files.
  • Dry run mode for testing pruning logic without modifying production data.
  • Size-based enforcement to strictly limit memory files to a specific byte size.
  • Integration with other Openclaw Skills to trigger cleanup after specific tasks or daily maintenance.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Requires
Bins python3
Github Stars: 0
forks: 0

Featured*