Agent Long-Term Memory for Openclaw

A three-tier persistent memory architecture (short-term, SQLite-backed entity, and vector-based episodic memory) that persists knowledge across all your AI agent projects.

exp007
v1.0.0
Jun 16, 2026
0
566
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install agent-long-term-memory

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 agent-long-term-memory 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 Agent Long-Term Memory?

Agent Long-Term Memory is a comprehensive memory subsystem designed for AI agents, providing a robust solution for persisting state and user profiles. Written to work globally across multiple projects via ~/.codex/agent_memory/, it introduces a hierarchical cognitive architecture comprising three distinct tiers: a short-term sliding conversation window, structured SQLite-backed entity storage, and an episodic vector database powered by ChromaDB. This structured approach allows AI agents utilizing Openclaw Skills to maintain highly contextualized, persona-driven, and historically aware interactions over time.

By unifying transient short-term dialogue buffers with rich semantic historical lookups and rigid key-value facts, developers can stop writing custom boilerplate database code for every new bot. The skill features smart context construction, enabling agents to automatically inject relevant background facts directly into system prompts or query vector stores dynamically to extract historical conversations when needed.

Agent Long-Term Memory Use Cases

  • Cross-Project User Profiles: Share personal preferences, user names, and customized developer attributes across distinct AI tools and coding assistants.
  • Continuous Dialogue Context: Keep track of the active sliding window conversation buffer without inflating system context length limitations.
  • Episodic Interaction Auditing: Retrieve past chat episodes or specific semantic historical scenarios via semantic vector search to base answers on prior experiences.
  • Automated Knowledge Synthesis: Extract facts from raw chat scripts asynchronously using LLM auto-extraction rules or fallback regular expressions.

How Agent Long-Term Memory Works

  1. Initialize & Inject: During session startup, the memory subsystem loads the user's unified entity profile (get_profile) and appends it to the system instructions.
  2. Active Dialogue Tracking: Every prompt-response cycle, the agent logs conversation turns into the Tier 1 sliding window memory cache.
  3. Structured Fact Parsing: Whenever a key piece of information is declared, the agent writes it directly as an entity fact in Tier 2 SQLite storage or uses auto-extraction pipelines.
  4. Episodic Archiving: On session termination, the entire conversation transcript is vectorized and saved to the Tier 3 ChromaDB vector database.
  5. Maintenance & Pruning: Low-confidence or outdated memory elements are programmatically swept and cleared based on thresholds to prevent context pollution.

Agent Long-Term Memory Setup

Prerequisites

Ensure you have the required Python dependencies installed globally or within your agent environment:

pip install "chromadb>=0.4.0" "openai>=1.0.0"

(Note: OpenAI is optional. If no API key is set, the system falls back to regex-based entity extraction.)

Installation

Clone the repository into your Openclaw Skills directory structure:

git clone https://github.com/exp007/agent-long-term-memory.git ~/.codex/skills/agent-memory

Configuration

All state files are stored dynamically inside the global directory path ~/.codex/agent_memory/ ensuring cross-project persistency.

Agent Long-Term Memory Data Schema & Taxonomy

Directory Structure

All structured facts and database states are maintained globally:

  • ~/.codex/agent_memory/: The root directory for the agent's cognitive footprint.
  • SQLite DB: Manages Tier 2 entity cards containing structured facts with confidence weights.
  • ChromaDB vector store: Houses Tier 3 episodic conversation logs with corresponding embedding metadata.

Entity Table Schema

Property Type Description
key String Unique descriptor for the fact (e.g., favorite_color)
value Any Stored data associated with the key
evidence String Supporting conversational context or origin quote
confidence Float Fact reliability score (0.0 to 1.0)
tags Array of Strings Meta-tags for categorizing or partitioning the entity card

Agent Long-Term Memory Advanced Features

  • Multi-Tier Context Builder: Generate fully assembled MemoryContext models to seamlessly inject structured knowledge and vector memory directly into LLM prompts.
  • Automatic LLM Fact Extraction: Utilize OpenAI-driven extraction triggers to read transcripts and organically update SQLite facts on-the-fly.
  • Confidence Decay System: Programmatically sweep and drop low-confidence or expired beliefs with explicit age thresholds and clean routines.
  • Strict Regex Fallback Mode: Maintain fully functional structured knowledge indexing even offline without needing connection keys.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*