Memory Pruner

v1.1.0

Automatically prune and compact agent memory files to prevent unbounded growth. Circular buffer for logs, importance-based retention for state, and configura...

0· 1.3k·5 current·5 all-time
byArcSelf@trypto1019
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
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.
Assessment
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.

Like a lobster shell, security has layers — review code before you run it.

Runtime requirements

🧹 Clawdis
OSmacOS · Linux
Binspython3
latestvk974c45c2dh6gfs7c0swc8qg2181a3fe
1.3kdownloads
0stars
2versions
Updated 1mo ago
v1.1.0
MIT-0
macOS, Linux

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

Comments

Loading comments...