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.
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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/mema/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How mema Compares
| Feature / Agent | mema | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | medium | N/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
Best AI Skills for ChatGPT
Find the best AI skills to adapt into ChatGPT workflows for research, writing, summarization, planning, and repeatable assistant tasks.
Top AI Agents for Productivity
See the top AI agent skills for productivity, workflow automation, operational systems, documentation, and everyday task execution.
AI Agents for Freelancers
Browse AI agent skills for freelancers handling client research, proposals, outreach, delivery systems, documentation, and repeatable admin work.
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
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.
filesystem
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.
Budget & Expense Tracker — AI Agent Financial Command Center
Track every dollar, enforce budgets, spot spending patterns, and build wealth — all through natural conversation with your AI agent.
yt-dlp
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.
time-checker
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.
pihole-ctl
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".
mermaid-architect
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".
memory-cache
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.
file-organizer-skill
Organize files in directories by grouping them into folders based on their extensions or date. Includes Dry-Run, Recursive, and Undo capabilities.
media-compress
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".
edge-tts
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.
ocr-local
Extract text from images using Tesseract.js OCR (100% local, no API key required). Supports Chinese (simplified/traditional) and English.