Agent Memory Optimizer for Openclaw

An automated utility designed to archive aging daily notes into structured monthly folders to minimize token overhead and keep agent memory lean.

x3r081
v1.0.0
Apr 16, 2026
0
838
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install agent-memory-optimizer

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 agent-memory-optimizer 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 Agent Memory Optimizer?

Agent Memory Optimizer is a specialized tool within the ecosystem of Openclaw Skills designed to solve the problem of 'context bloat.' As AI agents accumulate daily memory files, the volume of data can lead to increased prompt token usage and slower processing times. This skill automates the organization of these files, ensuring your agent only focuses on the most relevant, recent information while safely preserving history.

By systematically moving older markdown notes into a hierarchical archive, the tool maintains a clean directory structure. This performance-centric approach is vital for developers and power users who rely on long-running AI agents and want to ensure cost-effective, high-speed interactions without losing their historical data trail.

Agent Memory Optimizer Use Cases

  • Reducing prompt token overhead by limiting the number of active memory files scanned by the LLM.
  • Maintaining a clean and navigable workspace directory for long-term AI projects.
  • Automated maintenance of persistent agent memory to prevent performance degradation over time.
  • Previewing file migrations safely using dry-run mode before committing to disk changes.

How Agent Memory Optimizer Works

  1. The skill scans the targeted memory directory for all files with the .md extension.
  2. It parses the timestamps of each daily note to determine its age relative to the current month.
  3. Files identified as older than the current month are flagged for archival.
  4. The utility creates a structured directory at memory/archive/YYYY-MM/ if it does not already exist.
  5. Files are moved from the active root to the specific month-based archive folder, effectively removing them from the immediate context of the AI agent.

Agent Memory Optimizer Setup

To install the Agent Memory Optimizer into your workspace, clone or move the skill folder into your project structure:

mkdir -p <workspace>/skills/agent-memory-optimizer
# Copy skill files into this directory

Ensure you have Python 3 installed, as it is a requirement for Openclaw Skills of this type. You can then execute the optimizer directly from your CLI:

# Run a dry run to see what would be archived
python3 scripts/agent_memory_optimizer.py --dry-run

# Perform the actual archive operation
python3 scripts/agent_memory_optimizer.py

Agent Memory Optimizer Data Schema & Taxonomy

The skill follows a strict file-based taxonomy to ensure compatibility with standard markdown-based memory systems:

Path Description
memory/*.md The source location for active daily memory notes.
memory/archive/ The root directory for all archived content.
memory/archive/YYYY-MM/ Time-siloed folders where files are moved (e.g., 2026-05/).

All metadata is handled via standard filesystem move operations, preserving the original file names and internal content of the markdown notes.

Agent Memory Optimizer Advanced Features

  • Dry-run support: Use the --dry-run flag to validate which files will be moved without performing actual filesystem writes.
  • Custom Cutoff Dates: Target specific historical points using the --before flag (e.g., --before 2026-01) for granular control over what stays in active memory.
  • Idempotent Operations: The script is safe to run repeatedly; it will not duplicate archives or move files that are already correctly placed.
  • Openclaw Skills Integration: Fully compatible with standard workspace configurations and can be triggered as part of a larger automation pipeline.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*