mema

Mema's personal brain - SQLite metadata index for documents and Redis short-term context buffer. Use for organizing workspace knowledge paths and managing ephemeral session state.

3,891 stars
Complexity: medium

About this skill

Mema provides a standardized memory system for AI agents, comprising two core components: a SQLite-based Document Index and a Redis-based Short-Term Memory. The SQLite index stores metadata like file paths, titles, and tags, enabling agents to quickly locate relevant documents without ingesting full content. The Redis component serves as an ephemeral buffer for cross-session context and dynamic state, with a default Time-To-Live (TTL) of 6 hours, ideal for maintaining conversational flow or task-specific variables. This skill is designed to enhance an AI agent's capability to operate intelligently across tasks by giving it a persistent yet localized "brain." It allows agents to record and retrieve key information about their workspace, ensuring consistency and reducing the need for repeated information extraction. For instance, an agent can index important project files and later search them by tags, or store intermediate results and user preferences in Redis for quick access within a session. Users would leverage Mema to give their agents a more robust sense of context and personal knowledge. It solves the challenge of an agent forgetting prior interactions or relevant files, making complex, multi-step workflows more seamless and efficient. By providing a structured way to manage both long-term metadata and short-term operational state, Mema transforms a stateless agent into a more informed and persistent assistant.

Best use case

The primary use case is providing AI agents with a local, standardized memory system to manage both long-term document references and short-term operational context. AI developers and advanced users benefit most by enabling their agents to retain knowledge across sessions, efficiently locate relevant workspace files, and manage ephemeral task states, thereby improving agent autonomy and performance in complex workflows.

Mema's personal brain - SQLite metadata index for documents and Redis short-term context buffer. Use for organizing workspace knowledge paths and managing ephemeral session state.

The AI agent will gain a structured way to store and retrieve metadata about documents and manage ephemeral key-value states, leading to more informed and context-aware operations.

Practical example

Example input

Agent, I'm working on the `frontend-auth` module. Please index `src/auth/login.js` and `src/auth/register.js` with the tag 'authentication'. Then, set my current task in short-term memory as 'Refactoring Auth UI'.

Example output

Files `src/auth/login.js` and `src/auth/register.js` indexed with tag 'authentication'. Short-term memory key 'current_task' set to 'Refactoring Auth UI' with default TTL.

When to use this skill

  • When an AI agent needs to remember and quickly access previously encountered document paths, titles, or tags.
  • When managing temporary session state, conversational context, or intermediate results across different agent interactions.
  • To provide an AI agent with a persistent, localized "brain" for its working environment.
  • For agents needing to organize and reference specific knowledge paths within a project.

When not to use this skill

  • When full-text search capabilities for document content are required, as Mema only indexes metadata.
  • As a primary, high-durability database for critical application data.
  • For extremely large-scale data storage or complex relational queries beyond simple metadata lookup.
  • If you cannot or do not want to run a local Redis instance.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/mema/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/1999azzar/mema/SKILL.md"

Manual Installation

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

How mema Compares

Feature / AgentmemaStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexitymediumN/A

Frequently Asked Questions

What does this skill do?

Mema's personal brain - SQLite metadata index for documents and Redis short-term context buffer. Use for organizing workspace knowledge paths and managing ephemeral session state.

How difficult is it to install?

The installation complexity is rated as medium. You can find the installation instructions above.

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.

Related Guides

SKILL.md Source

# Mema Brain (Centralized Memory)

Standardized memory system providing a Metadata Index (SQLite) and Short-Term Context (Redis).

## Core Components

### 1. Document Index (SQLite)
- **Primary Path:** `~/.openclaw/memory/main.sqlite`
- **Capability:** Stores file paths, titles, and tags. 
- **Note:** This is a **Metadata Index only**. It does not ingest or provide full-text search of file contents.

### 2. Short-Term Memory (Redis)
- **Key Prefix:** `mema:mental:*`
- **Purpose:** Ephemeral state management and cross-session context passing.
- **TTL:** Default 6 hours (21600 seconds).

## Core Workflows

### Indexing Knowledge
Record a file's location and tags in the local database.
- **Usage**: `python3 $WORKSPACE/skills/mema/scripts/mema.py index <path> [--tag <tag>]`

### Searching Index
List indexed paths filtered by tag or recency.
- **Usage**: `python3 $WORKSPACE/skills/mema/scripts/mema.py list [--tag <tag>]`

### Mental State (Redis)
Manage key-value pairs in the `mema:mental` namespace.
- **Set**: `python3 $WORKSPACE/skills/mema/scripts/mema.py mental set <key> <value> [--ttl N]`
- **Get**: `python3 $WORKSPACE/skills/mema/scripts/mema.py mental get <key>`

## Setup
1. Copy `env.example.txt` to `.env`.
2. Configure `REDIS_HOST` and `REDIS_PORT` (defaults: localhost:6379).
3. Initialize the SQLite schema:
   `python3 $WORKSPACE/skills/mema/scripts/mema.py init`

## Reliability & Security
- **Data Privacy**: All data is stored locally.
- **Network Safety**: Only point `REDIS_HOST` to trusted instances.
- **Path Isolation**: Database operations are confined to the `~/.openclaw/memory` directory.

Related Skills

find-skills

3891
from openclaw/skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

General Utilities

filesystem

3891
from openclaw/skills

Advanced filesystem operations for listing files, searching content, batch processing, and directory analysis. Supports recursive search, file type filtering, size analysis, and batch operations like copy/move/delete. Use when you need to: list directory contents, search for files by name or content, analyze directory structures, perform batch file operations, or analyze file sizes and distribution.

General Utilities

Budget & Expense Tracker — AI Agent Financial Command Center

3891
from openclaw/skills

Track every dollar, enforce budgets, spot spending patterns, and build wealth — all through natural conversation with your AI agent.

General Utilities

yt-dlp

3891
from openclaw/skills

A robust CLI wrapper for yt-dlp to download videos, playlists, and audio from YouTube and thousands of other sites. Supports format selection, quality control, metadata embedding, and cookie authentication.

General Utilities

time-checker

3891
from openclaw/skills

Check accurate current time, date, and timezone information for any location worldwide using time.is. Use when the user asks "what time is it in X", "current time in Y", or needs to verify timezone offsets.

General Utilities

pihole-ctl

3891
from openclaw/skills

Manage and monitor local Pi-hole instance. Query FTL database for statistics (blocked ads, top clients) and control service via CLI. Use when user asks "how many ads blocked", "pihole status", or "update gravity".

General Utilities

mermaid-architect

3891
from openclaw/skills

Generate beautiful, hand-drawn Mermaid diagrams with robust syntax (quoted labels, ELK layout). Use this skill when the user asks for "diagram", "flowchart", "sequence diagram", or "visualize this process".

General Utilities

memory-cache

3891
from openclaw/skills

High-performance temporary storage system using Redis. Supports namespaced keys (mema:*), TTL management, and session context caching. Use for: (1) Saving agent state, (2) Caching API results, (3) Sharing data between sub-agents.

General Utilities

file-organizer-skill

3891
from openclaw/skills

Organize files in directories by grouping them into folders based on their extensions or date. Includes Dry-Run, Recursive, and Undo capabilities.

General Utilities

media-compress

3891
from openclaw/skills

Compress and convert images and videos using ffmpeg. Use when the user wants to reduce file size, change format, resize, or optimize media files. Handles common formats like JPG, PNG, WebP, MP4, MOV, WebM. Triggers on phrases like "compress image", "compress video", "reduce file size", "convert to webp/mp4", "resize image", "make image smaller", "batch compress", "optimize media".

General Utilities

edge-tts

3891
from openclaw/skills

Text-to-speech conversion using node-edge-tts npm package for generating audio from text. Supports multiple voices, languages, speed adjustment, pitch control, and subtitle generation. Use when: (1) User requests audio/voice output with the "tts" trigger or keyword. (2) Content needs to be spoken rather than read (multitasking, accessibility, driving, cooking). (3) User wants a specific voice, speed, pitch, or format for TTS output.

General Utilities

ocr-local

3891
from openclaw/skills

Extract text from images using Tesseract.js OCR (100% local, no API key required). Supports Chinese (simplified/traditional) and English.

General Utilities