← Back to Skills Marketplace
jpmoregain-eth

Tiered Memory

by jpmoregain-eth · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ Security Clean
116
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install agent-tiered-memory
Description
Two-tier memory system for OpenClaw agents. Tier 0 = QMD semantic search for recent memories (7-14 days). Tier 1 = SQLite archive for long-term storage. Auto...
README (SKILL.md)

Tiered Memory Skill

Two-tier memory system combining OpenClaw's QMD semantic search with SQLite archival. Keeps recent memories fast and searchable while compressing old sessions for long-term storage.

Architecture

┌─────────────────────────────────────────┐
│  TIER 0: QMD Semantic Search            │
│  ├── Hot memory (7-14 days)             │
│  ├── GPU-accelerated vector search      │
│  └── Searches: MEMORY.md, memory/*.md   │
├─────────────────────────────────────────┤
│  TIER 1: SQLite Archive                 │
│  ├── Cold storage (14+ days)            │
│  ├── Compressed summaries + key facts   │
│  └── Structured queries via SQL         │
└─────────────────────────────────────────┘

Quick Start

1. Ensure QMD is Enabled

QMD comes with OpenClaw. Check status:

openclaw doctor

Should show QMD as available. If not, check ~/.openclaw/openclaw.json:

{
  "memory": {
    "qmd": {
      "enabled": true,
      "device": "cuda"
    }
  }
}

2. Set Up Archive Directory

mkdir -p ~/.openclaw/workspace/memory/archive

3. Install Cron Job (Auto-archive)

# Add to crontab
crontab -e

# Add this line for daily 2 AM archive
0 2 * * * /usr/bin/python3 ~/.openclaw/skills/tiered-memory/scripts/memory_archiver.py --days 14 >> ~/.openclaw/workspace/memory/archive.log 2>&1

4. Use in Your Agent

import sys
sys.path.insert(0, '~/.openclaw/skills/tiered-memory/scripts')
from tiered_memory import TieredMemory

mem = TieredMemory()

# Query across both tiers
results = mem.search("AgentBear project")

Manual Archive

# See what would be archived
python3 ~/.openclaw/skills/tiered-memory/scripts/memory_archiver.py --dry-run

# Archive files older than 14 days
python3 ~/.openclaw/skills/tiered-memory/scripts/memory_archiver.py

# Archive with custom threshold
python3 ~/.openclaw/skills/tiered-memory/scripts/memory_archiver.py --days 7

# Skip LLM (faster, basic summaries)
python3 ~/.openclaw/skills/tiered-memory/scripts/memory_archiver.py --skip-llm

Query Archives

# List all archived sessions
python3 ~/.openclaw/skills/tiered-memory/scripts/memory_archiver.py --list

# Search archived summaries
python3 ~/.openclaw/skills/tiered-memory/scripts/memory_archiver.py --search "AgentBear"

How It Works

Daily Flow

  1. During Day: Agent writes to memory/YYYY-MM-DD.md
  2. QMD Indexes: Real-time semantic indexing
  3. At 2 AM: Cron runs archiver
  4. Old Files: Summarized → SQLite → moved to archive/

Search Priority

When an agent searches memory:

  1. QMD search (Tier 0) - semantic, fuzzy, fast
  2. If not found or need history: Query SQLite (Tier 1)

Archive Format

Field Type Description
session_date DATE Original file date
summary TEXT LLM-generated summary
key_facts JSON Important facts extracted
topics JSON Tags/categories
message_count INT Lines in original file

Database Schema

CREATE TABLE archived_sessions (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    source_file TEXT NOT NULL,
    session_date DATE NOT NULL,
    summary TEXT NOT NULL,
    key_facts TEXT,  -- JSON array
    topics TEXT,     -- JSON array
    message_count INTEGER,
    archived_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX idx_date ON archived_sessions(session_date);
CREATE INDEX idx_topics ON archived_sessions(topics);

Scripts

  • scripts/memory_archiver.py - Archive old files to SQLite
  • scripts/tiered_memory.py - Unified search across both tiers

Files

  • references/qmd-setup.md - QMD configuration details
  • references/archiver-api.md - Archiver script API reference

Notes

  • QMD requires CUDA GPU for best performance (falls back to CPU)
  • Archive uses Ollama for summarization (qwen2.5-coder:14b default)
  • Original files are preserved in archive/ folder
  • SQLite DB at ~/.openclaw/memory_archive.db

Troubleshooting

QMD not working? See references/qmd-setup.md

Archive failing? Check Ollama is running: ollama list

Want to restore archived file? Just move it back from memory/archive/ to memory/

Usage Guidance
This skill appears to do what it claims: auto-archive old OpenClaw memory files into a local SQLite DB and optionally summarize them with Ollama. Before installing, check: 1) you are comfortable that the archiver will read and move files under ~/.openclaw/workspace/memory and will create ~/.openclaw/memory_archive.db; 2) if you care about privacy, use the --skip-llm flag or ensure your Ollama installation runs entirely locally (so summaries are not proxied off-machine); 3) inspect and, if desired, run the scripts manually before adding the cron entry; and 4) avoid running third-party curl|sh installers without review (the README suggests one for Ollama). If those points are acceptable, the skill is coherent and appropriate for its stated purpose.
Capability Analysis
Type: OpenClaw Skill Name: agent-tiered-memory Version: 1.0.1 The tiered-memory skill implements a legitimate two-tier memory management system for OpenClaw agents, using SQLite for long-term archival and local Ollama instances for summarization. The code in memory_archiver.py and tiered_memory.py performs standard file operations and database queries within the expected ~/.openclaw directory, and the use of subprocess to call Ollama is consistent with the stated functionality without evidence of malicious intent or data exfiltration.
Capability Assessment
Purpose & Capability
Name/description, required binaries (python3, ollama), and the included scripts all align: scripts scan ~/.openclaw/workspace/memory, summarize with Ollama, insert into a local SQLite DB, and move files to an archive directory. The requested binaries and filesystem paths are appropriate for a memory-archiver skill.
Instruction Scope
SKILL.md and the CLI/python examples limit actions to reading/writing files under ~/.openclaw, indexing/searching those files, and optionally invoking Ollama for summarization. The cron instructions explicitly run the provided archiver script. There are no instructions to read unrelated system config, other users' data, or to post content to unknown external endpoints.
Install Mechanism
This is instruction-only (no automated installer). The README suggests installing Ollama using the project's official install script (curl | sh) and pulling a model; that's a documented, optional step and uses the vendor's URL. No arbitrary archive downloads or obscure URLs are used by the skill itself. As always, running third-party install scripts has inherent risk and should be reviewed before execution.
Credentials
The skill requests no credentials or environment variables and confines work to ~/.openclaw paths and a local SQLite DB — proportionate to its purpose. One consideration: the archiver passes file content to the 'ollama' CLI. If Ollama is configured to run local models, content remains local; if an Ollama installation is configured to proxy or send data externally, sensitive memory content could be transmitted. The skill offers --skip-llm to avoid LLM summarization.
Persistence & Privilege
always is false and the skill does not request persistent platform-wide privileges. It creates and uses files under the user's home (~/.openclaw) only, and the cron job in SKILL.md is an explicit user action (not automatic). It does not attempt to modify other skills or system-wide agent settings.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install agent-tiered-memory
  3. After installation, invoke the skill by name or use /agent-tiered-memory
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.1
Fix: added ollama/python3 to requires.bins metadata, fixed inconsistent DB path (~/.agentbear → ~/.openclaw), declared external dependencies properly
v1.0.0
Two-tier memory system for OpenClaw agents. Tier 0 = QMD semantic search for recent memories. Tier 1 = SQLite archive for long-term storage. Auto-archives with LLM summarization.
Metadata
Slug agent-tiered-memory
Version 1.0.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Tiered Memory?

Two-tier memory system for OpenClaw agents. Tier 0 = QMD semantic search for recent memories (7-14 days). Tier 1 = SQLite archive for long-term storage. Auto... It is an AI Agent Skill for Claude Code / OpenClaw, with 116 downloads so far.

How do I install Tiered Memory?

Run "/install agent-tiered-memory" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Tiered Memory free?

Yes, Tiered Memory is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Tiered Memory support?

Tiered Memory is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Tiered Memory?

It is built and maintained by jpmoregain-eth (@jpmoregain-eth); the current version is v1.0.1.

💬 Comments