Clawhub Memory Tiers

v1.0.0

Tiered memory system for OpenClaw agents. Gives agents instant context on startup with a 4-line state snapshot (L0) and 7-day rolling context (L1). Eliminate...

0· 165·0 current·0 all-time
bySwarm Forge@dirtyrootsstudio

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for dirtyrootsstudio/clawhub-memory-tiers.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Clawhub Memory Tiers" (dirtyrootsstudio/clawhub-memory-tiers) from ClawHub.
Skill page: https://clawhub.ai/dirtyrootsstudio/clawhub-memory-tiers
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install clawhub-memory-tiers

ClawHub CLI

Package manager switcher

npx clawhub@latest install clawhub-memory-tiers
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
The name and description claim a local, tiered memory system; the SKILL.md only asks the user/agent to create and read/update L0.md, L1.md, and to add guidance to the agent's SOUL.md. There are no unrelated environment variables, binaries, or installs required.
Instruction Scope
The instructions explicitly tell agents to read L0.md and L1.md at startup and to update them at end-of-run — this is within the memory feature's scope. It does require agents to modify their SOUL.md and to read/write files in the agent workspace (including memory/). That is expected for a file-backed memory system but does grant the skill a persistent on-disk footprint in the agent workspace, so operators should be aware of what they choose to store in those files.
Install Mechanism
No install spec, no code files, and no external downloads — instruction-only. Lowest-risk installation surface.
Credentials
No environment variables, credentials, or config paths are requested. The SKILL.md references only files in the agent workspace and the agent's own SOUL.md, which is proportionate to a local memory helper.
Persistence & Privilege
The skill is not always-enabled and does not request elevated platform privileges. It asks agents to persist two small files in their workspace (expected for this feature) and to modify the agent's own SOUL.md; it does not modify other skills or system-wide settings.
Assessment
This skill is an instruction-only pattern for keeping two small text files (L0.md and L1.md) to warm-start agents. It appears coherent and low-risk, but remember: anything you write into these memory files will be read by the agent on every run. Avoid storing secrets, credentials, or sensitive PII in L0/L1. If you run multiple agents, keep each agent's memory files isolated. If you need stricter controls, consider auditing or encrypting what is written to workspace files before adopting the pattern.

Like a lobster shell, security has layers — review code before you run it.

latestvk971vt757tng1dgs5fs1gpkkn1833dfm
165downloads
0stars
1versions
Updated 1mo ago
v1.0.0
MIT-0

Agent Memory Tiers

Stop your agents from forgetting everything between runs.

OpenClaw agents start every activation with zero memory of what they did last time. They waste hundreds or thousands of tokens re-reading old files, parsing chat history, and reconstructing context. This skill fixes that.

Agent Memory Tiers is a structured, self-updating memory system that gives agents instant context on startup. Two files, updated automatically at the end of every run, so the next activation starts warm.

Tested in production across a 20-agent swarm running daily for 3+ weeks.

How It Works

Two memory layers sit in each agent's workspace:

LayerPurposeSizeLoaded
L0Instant state snapshot4 linesEvery activation
L17-day rolling context~20-40 linesEvery activation
L2+Historical memoryVariesOnly when needed

The agent reads L0 and L1 before doing anything else. Before finishing, it updates both files. Next activation picks up exactly where this one left off.

Token savings: 300-3700 tokens per activation depending on agent complexity. Over a week of daily runs, that adds up fast.

Setup

Step 1: Create L0.md in your agent's workspace

# L0 — [AGENT_NAME] Quick State

You are [AGENT_NAME]. [One sentence describing role and purpose.]
Current focus: [Top priority right now — what matters most this week.]
Last run: [Date and one-line summary of last activity, or "No runs yet."]
Flags: [Critical state warnings — cron status, credit limits, blockers. "None" if clear.]

Example — a content agent:

# L0 — WRITER Quick State

You are WRITER. Content engine for the company blog and social accounts.
Current focus: Draft 3 LinkedIn posts promoting the new pricing page.
Last run: 2026-03-15 — Generated 2 blog teasers and 1 thought leadership post.
Flags: Publishing queue has 8 posts loaded through Mar 22. No blockers.

Example — a monitoring agent:

# L0 — WATCHDOG Quick State

You are WATCHDOG. Security monitor for the production environment.
Current focus: Track error rates after the v2.4 deploy.
Last run: 2026-03-16 — Scanned logs, no anomalies. Alert threshold at 2% error rate.
Flags: Grafana dashboard unreachable intermittently. Investigate if persists.

Step 2: Create L1.md in your agent's workspace

# L1 — [AGENT_NAME] Rolling Context

## Last 7 Days
- YYYY-MM-DD: One-line summary of activity or state change.
- YYYY-MM-DD: Another entry.
(Keep exactly 7 most recent. Drop oldest when adding new.)

## Active Tasks (Top 3)
1. Task description — additional context, owner if relevant.
2. Second priority task.
3. Third priority task.

## Key State
- Important file paths, tracker values, config state.
- Anything that changed recently.
- Numbers the agent needs to know (queue sizes, deadlines, etc.).

## Blockers
- What is preventing progress. Root cause, not symptom.
- Remove resolved blockers. Add new ones.
- "None" if clear.

Example — a lead generation agent:

# L1 — SCOUT Rolling Context

## Last 7 Days
- 2026-03-16: Scanned LinkedIn for AI consulting leads. Found 4 warm prospects.
- 2026-03-15: Researched 3 companies posting AI job listings. Added to LEADS.md.
- 2026-03-14: First hunt run. Established search criteria and baseline.

## Active Tasks (Top 3)
1. Find 5 qualified leads per week — businesses publicly struggling with AI adoption.
2. Score leads by budget signals (hiring, funding rounds, public complaints).
3. Pass top leads to PITCH agent for proposal drafting.

## Key State
- LEADS.md: 7 prospects, 2 qualified, 0 contacted.
- Search channels: LinkedIn, Twitter, Hacker News, industry forums.
- Services offered: $2k-$6k setup + $500-$2k/month management.

## Blockers
- None.

Step 3: Add the Quick Context header to your SOUL.md

Paste this at the top of your agent's SOUL.md file, right after the role description:

## Quick Context (read these FIRST, before anything else)
1. Read `L0.md` — your current state in 4 lines.
2. Read `L1.md` — your last 7 days, active tasks, and blockers.
3. Only read files from `memory/` if your current task requires older history.
4. Before finishing: update L0.md and L1.md (see End-of-Run section at bottom).

Step 4: Add the End-of-Run footer to your SOUL.md

Paste this at the bottom of your agent's SOUL.md file:

## End-of-Run Memory Update (MANDATORY — do this before finishing every activation)

1. **Update L0.md** with exactly 4 lines:
   - Line 1: One-sentence identity reminder.
   - Line 2: Current top priority (what matters most RIGHT NOW after this run).
   - Line 3: What you just did this run (date + one line).
   - Line 4: State flags (cron status, credit warnings, blockers, or "None").

2. **Update L1.md:**
   - Add today's date + one-line summary to "Last 7 Days" (keep only 7 most recent entries — drop the oldest).
   - Update "Active Tasks" with current top 3 after this run.
   - Update "Key State" with any changed numbers, files, or dates.
   - Update "Blockers" — remove resolved ones, add new ones.

Why This Structure

L0 is for speed. Four lines. The agent reads it in under 50 tokens and immediately knows: who am I, what should I focus on, what did I do last, and is anything broken. No digging through files.

L1 is for context. Seven days of history, three active tasks, key numbers, and blockers. Enough to make informed decisions without loading the full memory archive. Stays under 200 tokens for most agents.

L2+ is on-demand. Historical memory files in a memory/ folder. Only loaded when the task explicitly requires older context. This keeps routine activations fast and cheap.

Self-updating is critical. The agent writes its own L0/L1 before finishing. No external process needed. No sync scripts. The agent that did the work is the one that records what happened.

Multi-Agent Coordination

When running multiple agents, any orchestrator agent can read another agent's L0.md to get instant status without interrupting it or parsing logs.

## Orchestrator Pattern

Before assigning a task to another agent:
1. Read their L0.md to check current focus and flags.
2. Read their L1.md "Blockers" section to confirm they are not stuck.
3. If blocked, route the task to a backup agent or flag for human review.

This eliminates the "is this agent available?" guessing game and prevents task collisions in multi-agent setups.

Common Mistakes

MistakeFix
L0 grows beyond 4 linesRuthlessly compress. If it does not fit in 4 lines, it belongs in L1.
L1 "Last 7 Days" keeps growingHard cap at 7 entries. Drop the oldest every time you add a new one.
Agent skips the end-of-run updatePut "MANDATORY" in the SOUL.md footer. Bold it. Agents follow strong directives.
L1 blockers pile upRemove blockers the moment they are resolved. Stale blockers cause confusion.
Storing detailed logs in L1L1 is summaries only. One line per day. Details go in dedicated log files.
Using relative dates ("yesterday")Always use absolute dates (YYYY-MM-DD). The agent does not know when it last ran.

Error Handling

Agent does not read L0/L1 on startup: The "Quick Context" header in SOUL.md must be near the top. If it is buried below other instructions, the agent may skip it. Move it directly after the role description.

Agent overwrites L0/L1 with garbage: This usually means the SOUL.md footer instructions are too vague. Use the exact template above with explicit line counts and section names. Agents follow precise structure better than general guidance.

L1 file grows too large (over 50 lines): Your "Key State" section is probably accumulating instead of updating. Each run should replace old state values, not append. Restructure: state is current values, not a changelog.

Multiple agents writing to the same L0/L1: Each agent must have its own L0.md and L1.md in its own workspace. Never share these files between agents. The orchestrator reads them, but only the owning agent writes them.

Permissions

This skill requires:

  • File read/write in the agent's workspace directory — to read and update L0.md and L1.md.
  • No network access required.
  • No external API access required.
  • No sensitive data access required.

Credits

Built and battle-tested by the Megaport swarm team. Inspired by the OpenViking tiered memory architecture.

License

MIT — use it, modify it, share it.

Comments

Loading comments...