OpenClaw Maintenance (Memory + Sessions)

v1.0.0

Nightly maintenance for OpenClaw — memory organization (sort loose memory files into topic folders with frontmatter and INDEX.md) and session cleanup (purge...

0· 136·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for duolahypercho/hypercho-openclaw-maintenance.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "OpenClaw Maintenance (Memory + Sessions)" (duolahypercho/hypercho-openclaw-maintenance) from ClawHub.
Skill page: https://clawhub.ai/duolahypercho/hypercho-openclaw-maintenance
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install hypercho-openclaw-maintenance

ClawHub CLI

Package manager switcher

npx clawhub@latest install hypercho-openclaw-maintenance
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description match the included scripts. All file operations are confined to ~/.openclaw (workspace and agents). No unrelated binaries, network endpoints, or credentials are required.
Instruction Scope
SKILL.md and the two Python scripts stay within the maintenance scope (move .md files, add frontmatter, update INDEX.md, and remove tombstones/orphan/old session files). One notable addition: references/setup-prompt.md contains a 'Full Self-Contained Prompt' that tells an agent to write the scripts to disk, run them, and create a cron job — if pasted into an agent, that gives the agent the ability to create/modify files and set up cron without installing the packaged scripts. Recommend reviewing scripts and using --dry-run before executing.
Install Mechanism
No install spec (instruction-only). The skill includes the scripts in the package; nothing is downloaded from external URLs or installed automatically.
Credentials
No environment variables, credentials, or config paths are requested. The scripts operate on standard per-user OpenClaw directories under the home directory.
Persistence & Privilege
always:false and normal autonomous invocation. The skill does not request persistent elevated privileges or modify other skills' configs. Cron setup is explicit and requires user action (or the 'self-contained prompt' if run by an agent).
Assessment
This package appears to do exactly what it claims: tidy .md memories and prune session files under ~/.openclaw. Before enabling a nightly cron or running for real: 1) run session_cleanup.py --dry-run to preview changes; 2) inspect the scripts (they're included) to confirm behavior and retention windows; 3) back up ~/.openclaw/agents/*/sessions/sessions.json (the script already writes a .json.bak but double-check); 4) be cautious about pasting the 'Full Self-Contained Prompt' into any agent — that prompt instructs an agent to write and run scripts and create cron jobs and should only be used if you trust the agent and have reviewed the code. If you want extra safety, run the scripts under a user account with limited data or test on a copy of your workspace first.

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

latestvk975rxawcg5msy65zsvgay655h83bx9j
136downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

OpenClaw Maintenance

Two scripts that keep your OpenClaw instance lean: memory organization and session cleanup.

1. Memory Organizer

Sorts loose .md files from ~/.openclaw/workspace/memory/ root into topic subfolders.

What it does

  • Scans memory/*.md for files sitting in the root (not already in a subfolder)
  • Routes each file to a topic folder based on keyword matching:
    • cabinet/ — agent, cron, delegation, cabinet agent names
    • content/ — post, blog, marketing, seo, clips
    • products/ — copanion, hypercho, feature, ui, roadmap
    • technical/ — bug, error, config, docs, gateway
    • x/ — twitter, viral, engagement, followers
    • user/ — ziwen, founder, personal
    • daily/ — fallback for everything else
  • Adds YAML frontmatter (topic, date, tags) if missing
  • Updates INDEX.md in each topic folder with the new file
  • Idempotent — safe to run repeatedly
  • No LLM dependency — pure keyword matching

Run

python3 <skill_dir>/scripts/memory_organize.py

2. Session Cleanup

Cleans session storage across ALL registered agents.

What it cleans

TargetRetentionAction
Tombstones (.reset.*, .deleted.*, .bak-*)0 daysAlways delete
Cron session .jsonl files7 daysDelete after 7 days
Orphan .jsonl (on disk, not in sessions.json)0 daysDelete
Stale sessions.json entries (cron, file missing)0 daysRemove entry
Non-cron sessions30 daysKeep
Main sessionsForeverNever touched
Active sessions (.lock)ForeverNever touched

Safety

  • Auto-discovers agents by scanning ~/.openclaw/agents/*/sessions/
  • Backs up sessions.json before modifying
  • Never touches locked/active sessions

Run

# All agents
python3 <skill_dir>/scripts/session_cleanup.py

# Preview only
python3 <skill_dir>/scripts/session_cleanup.py --dry-run

# Single agent
python3 <skill_dir>/scripts/session_cleanup.py --agent main

Cron Setup

Set up a single midnight cron that runs both scripts:

Schedule: 0 0 * * * (midnight local time)
Model: any cheap/fast model
Thinking: low
Timeout: 600s
Delivery: none

Cron task message:

Single task only: run memory organizer and session cleanup.

Command 1 (memory):
bash -lc 'python3 <skill_dir>/scripts/memory_organize.py'

Command 2 (sessions):
bash -lc 'python3 <skill_dir>/scripts/session_cleanup.py'

Return ONLY the combined stdout (no extra commentary).

Comments

Loading comments...