Mema Brain for Openclaw

A standardized memory system that combines a SQLite metadata index for document organization with a Redis-powered short-term context buffer.

1999azzar
v1.1.1
Feb 17, 2026
0
1.7k
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install mema

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 mema 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 Mema Brain?

Mema Brain serves as a sophisticated memory layer for AI agents, bridging the gap between long-term file organization and immediate session awareness. By leveraging a SQLite database for indexing local file metadata and Redis for ephemeral state management, it allows developers to build more context-aware Openclaw Skills.

This dual-layer approach ensures that file paths and tags are easily searchable while temporary mental states are maintained across sessions. By decoupling metadata from file contents, Mema provides a lightweight way to organize workspace knowledge without the overhead of heavy vector databases, making it an essential component for any modular agent architecture.

Mema Brain Use Cases

  • Organizing workspace knowledge by indexing file paths and metadata tags for quick retrieval.
  • Managing ephemeral session states and passing context between different agent tasks.
  • Reducing LLM context bloat by storing large metadata sets in a local SQLite index instead of the prompt.
  • Cross-session state persistence using the Redis-based mental state namespace for multi-stage workflows.

How Mema Brain Works

  1. Initialize the SQLite schema to create a local storage directory for document metadata at ~/.openclaw/memory/.
  2. Index specific document paths and associate them with descriptive tags using the provided Python utility.
  3. Store temporary key-value pairs in Redis to maintain the agent's mental state during active coding sessions.
  4. Query the SQLite index to filter paths by tag or recency to provide relevant context to the AI agent during task execution.
  5. Automatically expire short-term context via Redis TTL to ensure the workspace remains clean and relevant.

Mema Brain Setup

Follow these steps to integrate Mema Brain with your Openclaw Skills:

# Install the necessary Python dependencies
pip install -r requirements.txt

# Configure your environment variables
cp env.example.txt .env
# Define REDIS_HOST and REDIS_PORT in your .env file

# Initialize the SQLite database schema
python3 $WORKSPACE/skills/mema/scripts/mema.py init

Mema Brain Data Schema & Taxonomy

Mema Brain organizes data across two distinct layers to balance persistence and performance:

Component Storage Type Location / Namespace Purpose
Document Index SQLite ~/.openclaw/memory/main.sqlite Persistent metadata: paths, titles, and tags.
Short-Term Memory Redis mema:mental:* Ephemeral session state and context.
Expiration Policy TTL 21,600 seconds Default 6-hour cleanup for Redis keys.

Mema Brain Advanced Features

  • Customizable TTL (Time-To-Live) settings for individual Redis keys to control state duration precisely.
  • Tag-based filtering for rapid retrieval of specific project knowledge paths across large workspaces.
  • Local-first architecture ensuring complete data privacy and low-latency access for all Openclaw Skills.
  • Path isolation logic that strictly confines database operations to the designated memory directory for enhanced security.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Requires
Bins python3
Github Stars: 0
forks: 0