Build Working Memory for Openclaw

A professional-grade, file-based memory architecture that provides AI agents with continuous identity and layered context retrieval across sessions.

jiyuan
v1.1.1
Mar 26, 2026
0
800
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install build-working-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 build-working-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 Build Working Memory?

The Build Working Memory skill implements a sophisticated file-based memory system designed to overcome the limitations of flat context dumps. By utilizing Openclaw Skills standards, it allows an AI agent to maintain a persistent identity and long-term memory without exhausting token budgets. The system prioritizes efficiency through a layered retrieval strategy, ensuring the agent only loads relevant information—ranging from machine-readable state data to curated long-term facts.

This system is particularly effective for complex, multi-session projects where maintaining a 'train of thought' is critical. It provides a structured environment where episodic logs, active threads, and long-term preferences are stored in distinct, interlinked files. This ensures that your agent doesn't just react to the current prompt but operates with the full context of past decisions, user preferences, and project history.

Build Working Memory Use Cases

  • Establishing persistent identity and persona across multiple AI chat sessions.
  • Migrating legacy agent workspaces from simple AGENT.md or MEMORY.md files to a structured architecture.
  • Managing complex project threads where the agent must remember specific technical decisions and open questions.
  • Implementing temporal recall for date-sensitive events like meetings, milestones, or purchases.
  • Reducing token costs by implementing tiered memory loading rather than full-history injection.

How Build Working Memory Works

  1. Orientation: At the start of a session, the system reads state.json to determine the time gap and pick the optimal loading strategy.
  2. Anchoring: The agent reads resumption.md, a first-person handoff note from the previous session, to establish immediate continuity.
  3. Context Retrieval: Depending on the user's message, the system pulls relevant sections from MEMORY.md, active threads, or the event ledger.
  4. Deep Recall: For specific queries, the agent can perform targeted lookups in daily logs or archives to retrieve granular episodic details.
  5. Persistence: At the end of the session, the writer.py script updates all logs, summarizes the interaction, and prepares the handoff for the next session.

Build Working Memory Setup

To set up the memory system in a new project, run the scaffolding script:

python <skill-path>/scripts/scaffold.py <project-root> --agent-name "YourAgent" --user-name "YourName"

To migrate an existing legacy workspace to the Openclaw Skills compliant structure:

# Preview the changes
python <skill-path>/scripts/migrate.py <project-root> --dry-run

# Execute migration and patch AGENT.md
python <skill-path>/scripts/migrate.py <project-root>

Build Working Memory Data Schema & Taxonomy

File Format Purpose
state.json JSON Machine-readable orientation (timestamps, session counters)
MEMORY.md Markdown Curated long-term facts, patterns, and user preferences
threads.md Markdown Ongoing topics with state, decisions, and open questions
events.json JSON Structured date-aware event ledger for temporal recall
YYYY-MM-DD.md Markdown Raw episodic session logs (Canonical Openclaw Skills format)
resumption.md Markdown First-person handoff note for the next session

Build Working Memory Advanced Features

  • Layered Retrieval Logic: Implements a four-phase loading process to optimize token usage (Orient → Anchor → Context → Deep Recall).
  • Idempotent Auto-Patching: Automatically injects memory-management instructions into AGENT.md without duplicating existing content.
  • Temporal Event Indexing: Allows agents to query a structured events.json for date-sensitive recall and historical milestones.
  • Bidirectional Referencing: Supports lightweight cross-file linking (e.g., [ref: thread-id]) for deep context navigation.
  • Maintenance Flags: Built-in logic to trigger memory curation and archival tasks every 5 sessions to prevent context rot.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*