OpenParable
Skip to content
← Back to skills

Claw Memory Management

Agent Building
claw-memory-management

Claw Memory Management is an Agent Skill for agent building published in the x-cmd/x-cmd repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Workspace memory management guide: memory layers, writing rules, entry format, and maintenance. Use when writing, updating, or maintaining memory files (memory/YYYY-MM-DD.md and MEMORY.md).

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/x-cmd/x-cmd/blob/HEAD/mod/claw/lib/data/workspace/manager/skills/memory-management/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/claw-memory-management, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Memory Management

Memory Layers

LayerFileContentPurpose
Layer 2MEMORY.mdPersistent facts, preferences, conventionsCross-session knowledge
Layer 1memory/YYYY-MM-DD.mdConcise daily index: tasks, decisions, changes, next stepsQuick context recovery

Key difference: memory/ is what you need to know to continue working. Keep it concise — do not stuff it with exhaustive operational details.

Writing Rules

  1. Write memory after action — Each round produces one concise memory index entry.
  2. Keep memory concise — memory/ is for quick context recovery. If it becomes too long to scan at a glance, you are writing too much detail.
  3. Use timestamps inside entries — Use HH:MM:SS inside entries. The ## heading already provides the date.
  4. Link to long-term memory — If a pattern or preference should persist, update MEMORY.md directly.
  5. Silent writing — Write memory as part of tool calls. Do not mention logging in your text replies to the user.
  6. Log every reply — Every memory entry must include a Sent field summarizing what you output to the user. If you said nothing, write "No reply".
  7. Check before replying — Before replying, scan today's memory/ entries for the Sent field. If you already answered this question, do not repeat it.
  8. Check context on short/ambiguous replies — If the user's message is brief or seems to reference something not in their message (e.g., "ok", "好的", "why", "next time"), ALWAYS check the most recent Sent entry in memory/YYYY-MM-DD.md. The user may be responding to a heartbeat notification. If so, acknowledge the notification context in your reply.

Memory Index Entry Format

Append entries to memory/YYYY-MM-DD.md. Keep them short — this is for quick context recovery, not full documentation.

## HH:MM:SS — [One-sentence task summary]

- **Request**: [What the user asked for]
- **Method**: [Brief description of the approach or pattern used]
- **Key decision**: [Important choices and rationale]
- **Changes**: [List of files touched]
- **Status**: [Complete / Partial / Blocked / Needs review]
- **Sent**: [Brief summary of what you sent to the user, e.g., "Explained heartbeat mechanism" or "No reply"]
- **Next step**: [Suggested next step, or empty if complete. If you sent a message to the user and expect a reply, write: "If user replies, they are likely responding to: <summary of what you sent>". This helps the next agent session understand the context when the user replies.]

Do not output these logs in your text replies. Write them directly to files.

Memory Maintenance

Periodically (every few days or when you notice accumulation), review and maintain your memory:

  1. Read recent memory/YYYY-MM-DD.md files
  2. Identify significant events, lessons, insights worth saving long-term
  3. Update MEMORY.md with distilled learnings (not raw logs)
  4. Delete outdated information in MEMORY.md that is no longer relevant

This is like a human reviewing a diary and updating their mental model. Daily files are raw notes; MEMORY.md is curated wisdom.

Key rule: If you want to remember something, write it to a file.