openclaw-memory

Production-grade memory management for OpenClaw. Search, compress, encrypt, authenticate, rate limit, and audit OpenClaw memory (MEMORY.md, AGENTS.md, memory/) with enterprise-grade security.

16 stars

Best use case

openclaw-memory is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Production-grade memory management for OpenClaw. Search, compress, encrypt, authenticate, rate limit, and audit OpenClaw memory (MEMORY.md, AGENTS.md, memory/) with enterprise-grade security.

Teams using openclaw-memory should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/openclaw-memory/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/testing-security/openclaw-memory/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/openclaw-memory/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How openclaw-memory Compares

Feature / Agentopenclaw-memoryStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Production-grade memory management for OpenClaw. Search, compress, encrypt, authenticate, rate limit, and audit OpenClaw memory (MEMORY.md, AGENTS.md, memory/) with enterprise-grade security.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# OpenClaw Memory Management Skill

> 🧠 Search, compress, encrypt, authenticate, rate limit, and audit OpenClaw memory (MEMORY.md, AGENTS.md, memory/) with enterprise-grade security

**Version**: 1.2.0 - ENHANCED SECURITY
**Author**: Pi-Agent 🐺📿
**License**: MIT

> ⚠️ **Security**: This skill includes 11 defense layers against command injection, path traversal, prompt injection, DoS attacks, and unauthorized access.

---

## Quick Start

### Basic Usage

```bash
cd ~/pi-mono-workspace/skills/openclaw-memory

# Search memory
./openclaw-memory.sh search "trading strategies"

# View statistics
./openaw-memory.sh stats

# List recent entries
./openclaw-memory.sh recent
```

### Encryption (V1.2.0)

```bash
# Generate encryption key
./openclaw-memory.sh key generate

# Encrypt a file
./openclaw-memory.sh encrypt MEMORY.md

# Decrypt a file
./openclaw-memory.sh decrypt MEMORY.md.enc
```

### Authentication (V1.2.0)

```bash
# Initialize authentication
./openclaw-memory.sh auth init

# Add a user
./openclaw-memory.sh auth add-user alice secret123

# Enable authentication
export OPENCLAW_AUTH=true
export OPENCLAW_API_KEY="ocm_abc123..."
```

### Rate Limiting (V1.2.0)

```bash
# Initialize rate limiting
./openclaw-memory.sh rate-limit init

# Enable rate limiting
export OPENCLAW_RATE_LIMIT=true

# Check rate limit status
./openclaw-memory.sh rate-limit status
```

---

## Commands

### Memory Commands

| Command | Description |
|---------|-------------|
| `search <query>` | Search MEMORY.md and memory/*.md for content |
| `compress [level]` | Compress conversation history (default: level 1) |
| `stats` | Show memory statistics |
| `agents` | List all agents and their roles |
| `recent [n]` | Show recent memory entries (default: 5) |
| `clean` | Remove stale memory files (>90 days old) |

### Encryption Commands (V1.2.0)

| Command | Description |
|---------|-------------|
| `key generate` | Generate encryption key |
| `encrypt <file>` | Encrypt a memory file |
| `decrypt <file>` | Decrypt a memory file |
| `key list` | List encrypted files |

### Authentication Commands (V1.2.0)

| Command | Description |
|---------|-------------|
| `auth init` | Initialize authentication system |
| `auth add-user <user> <pass>` | Add a new user |
| `auth remove-user <user>` | Remove a user |
| `auth list` | List all users |
| `auth status` | Show authentication status |
| `auth clean-sessions` | Clean expired sessions |

### Rate Limiting Commands (V1.2.0)

| Command | Description |
|---------|-------------|
| `rate-limit init` | Initialize rate limiting |
| `rate-limit check` | Check rate limit (consume token) |
| `rate-limit status` | Get rate limit status |
| `rate-limit stats` | Show rate limit statistics |
| `rate-limit reset [client]` | Reset rate limit for client |
| `rate-limit cleanup` | Clean old client data |

---

## Features

### Memory Management
- 🔍 **Memory Search**: Search across MEMORY.md and memory/*.md files
- 🗜 **Memory Compression**: Compress old conversation history (3 levels)
- 📊 **Memory Statistics**: View memory usage and file counts
- 🤖 **Agent Listing**: Display AGENTS.md contents
- 📅 **Recent Entries**: Show recently added memory files
- 🧹 **Clean Old**: Remove stale memory files (>90 days)

### Security (V1.2.0)
- 🔒 **AES-256-GCM Encryption**: Military-grade encryption for sensitive files
- 🔐 **User Authentication**: API key and session-based access control
- 🚦 **Token Bucket Rate Limiting**: Production-grade rate limiting
- 🔍 **Permission Auditing**: Security audit with auto-fix capabilities
- 🛡️ **Security Hardened**: Protection against injection attacks, path traversal, DoS

---

## Examples

### Search for trading strategies

```bash
./openclaw-memory.sh search "trading strategies"
```

### Compress memory (Level 1)

```bash
./openclaw-memory.sh compress 1
```

### Encrypt sensitive files

```bash
./openclaw-memory.sh key generate
./openclaw-memory.sh encrypt MEMORY.md
```

### View memory statistics

```bash
./openclaw-memory.sh stats
```

### Run security audit

```bash
./openclaw-memory.sh audit
```

---

## Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `WORKSPACE` | Current directory | Path to OpenClaw workspace |
| `OPENCLAW_AUTH` | false | Enable authentication |
| `OPENCLAW_API_KEY` | - | API key for authentication |
| `OPENCLAW_SESSION` | - | Session token for authentication |
| `OPENCLAW_RATE_LIMIT` | false | Enable rate limiting |
| `OPENCLAW_CLIENT_ID` | hostname:pid | Client identifier for rate limiting |

---

## Best Practices

### Memory Organization

1. **Durable Facts** → Add to `MEMORY.md`
   - User preferences
   - Important decisions
   - System configurations
   - Long-term goals

2. **Daily Logs** → Create `memory/YYYY-MM-DD.md`
   - Daily activities
   - Session summaries
   - Short-term observations

3. **Agent Definitions** → Edit `AGENTS.md`
   - Agent roles
   - Sub-agent capabilities
   - Tool configurations

### Compression Schedule

```bash
# Weekly: Level 1 compression
0 0 * * 0 openclaw-memory.sh compress 1

# Monthly: Level 2 compression
0 0 1 * * openclaw-memory.sh compress 2

# Quarterly: Level 3 compression (archive)
0 0 1 1,4,7,10 * openclaw-memory.sh compress 3
```

---

## Security

The skill includes 11 defense layers:

| Threat | Mitigation |
|--------|------------|
| Command Injection | Input validation, dangerous character filtering |
| Path Traversal | Path resolution, symlink checks, whitelist |
| Option Injection | Fixed strings, `--` delimiter |
| Denial of Service | Operation limits (max results, max files) |
| Prompt Injection | Input sanitization, no AI processing |
| Unauthorized Access | AES-256-GCM encryption, authentication |

### Security Logging

All security events are logged to `/tmp/openclaw-memory.log`:
- Command executions
- Input validation failures
- Path traversal attempts
- Dangerous character detection
- Authentication attempts
- Rate limit violations

---

## Support

- **OpenClaw Discord**: https://discord.gg/clawd
- **OpenClaw Docs**: https://docs.openclaw.ai

---

**Built by**: Pi-Agent 🐺📿

Related Skills

openclaw-codex-oauth-proxy

16
from diegosouzapw/awesome-omni-skill

OpenClaw 用 openai-codex(ChatGPT OAuth)跑 GPT-5.x Codex/Spark 的配置与排障(网关进程、代理、模型、thinking、JSON 输出)。

memory-leak-audit

16
from diegosouzapw/awesome-omni-skill

Audit code for memory leaks and disposable issues. Use when reviewing event listeners, DOM handlers, lifecycle callbacks, or fixing leak reports. Covers addDisposableListener, Event.once, MutableDisposable, DisposableStore, and onWillDispose patterns.

openclaw-docs-sync

16
from diegosouzapw/awesome-omni-skill

Sync OpenClaw + ClawHub + Skills docs into a local mirror for the QMD memory backend.

u0538-engineering-memory-consolidation-pipeline

16
from diegosouzapw/awesome-omni-skill

Operate the "Engineering Memory Consolidation Pipeline" capability in production for workflows. Use when mission execution explicitly requires this capability and outcomes must be reproducible, policy-gated, and handoff-ready.

youtube-music-openclaw

16
from diegosouzapw/awesome-omni-skill

Control YouTube Music with natural language - search, play, pause, skip, volume, shuffle

vps-memory

16
from diegosouzapw/awesome-omni-skill

Access Flo's long-term memory on the VPS (OpenClaw). ALWAYS use when the user says "memory", "memories", "remember", "souviens-toi", "rappelle-toi", "save memory", "search memory", "VPS memory", "OpenClaw", or mentions saving/searching past sessions or knowledge.

session-memory

16
from diegosouzapw/awesome-omni-skill

Internal skill. Use cc10x-router for all development tasks.

openclaw-sentry-pro

16
from diegosouzapw/awesome-omni-skill

Full secret scanning suite: detect leaked API keys, tokens, and credentials, then automatically redact, quarantine exposed files, and enforce .gitignore policies. Everything in openclaw-sentry (free) plus automated countermeasures.

moai-foundation-memory

16
from diegosouzapw/awesome-omni-skill

Persistent memory across sessions using MCP Memory Server for user preferences, project context, and learned patterns

memorylane

16
from diegosouzapw/awesome-omni-skill

Zero-config persistent memory for Claude with automatic cost savings. Use when you need to remember project context, reduce API token costs, track learned patterns, manage memories across sessions, or curate/clean up memories. Automatically compresses context 6x and saves 84% on API costs. Keywords: memory, remember, recall, context, cost savings, reduce tokens, learn, patterns, insights, curate, clean up memories, review memories.

memory-sync

16
from diegosouzapw/awesome-omni-skill

Guided workflow for maintaining strategic redundancy between Serena memories and project documentation. Use after significant code changes, phase completions, or when new architectural patterns are discovered.

memory-management

16
from diegosouzapw/awesome-omni-skill

Guide for managing Claude Code memory effectively. Use when setting up project memory, optimizing CLAUDE.md files, configuring rules directories, or establishing cross-session knowledge patterns. Covers memory hierarchy, best practices, and context optimization.