Why Is Your Token Consumption So High? Money-Saving Tricks with OpenClaw

Author: Fu Rongfeng, senior technical expert at OceanBase and head of the seekdb M0 R&D team.

✨ If you’re interested in PowerMem, you’re welcome to try it out at https://github.com/oceanbase/powermem—we believe it can help your AI applications manage long-term memory better!

Any developer who truly understands AI knows it in their bones: the context window isn’t free. Every extra 1K tokens thickens the bill a little and slows the response by a frame.

If you’re using OpenClaw, this anxiety gets more concrete. Last week you and your Agent spent two hours troubleshooting a production issue—checking logs, reading configs, trying solutions—generating 30,000 tokens of conversation. This week you ask it to continue, and it replies: “Hi! Which refactor are you referring to?” So you have to spend another few thousand tokens recapping the background, the Agent spends another few thousand tokens understanding it, and in the end it may still not fully get it.

Those 30,000 tokens? Wasted.

This isn’t a fluke. OpenClaw’s memory mechanism traps you in two token black holes.

Two Black Holes That Send Your Token Bill Out of Control

The more it remembers, the more expensive it gets. The Agent writes important information into MEMORY.md, and this file is loaded in full into the system prompt of every request. The longer you use it, the bigger MEMORY.md grows, and the more input tokens each API call costs. The Bootstrap file has a default cap of 20K characters per file (150K total), but long before the cap is reached, the bloated context has already started crowding out the Agent’s working space.

The more it forgets, the more it errs. When a session gets too long, OpenClaw triggers compaction and a memory flush. But a compaction summary is essentially lossy compression, and key context can get cut off. When the Agent can’t find the information it needs, it makes a mistake; a mistake leads to rework; rework generates more conversation, which triggers the next compaction faster.

Tool calls are an accelerant. The intermediate results from the Agent’s tool calls—web_fetch returning a web page, exec outputting a command’s results—are up to 400K characters each and quickly fill up a session.

The cost of remembering is expensive; the cost of forgetting is making mistakes. We need a third path.

seekdb M0: A Cloud Memory Plugin

The core idea of seekdb M0: don’t stuff all memory into the system prompt; instead, before each conversation begins, retrieve only the memory fragments relevant to the current topic and inject them into the context.

Unlike MEMORY.md’s full-load approach, seekdb M0 breaks memory into independent “facts” stored in a cloud database. Each fact has a vector representation and a full-text index. Before a conversation starts, hybrid retrieval (BM25 + vector similarity) finds the most relevant memories; after the conversation ends, new facts are extracted automatically.

This means: MEMORY.md no longer bloats, a session reset is no longer a disaster, and cross-device sync.

Two-Stage Design: Extraction + Decision

Stage one: fact extraction. After a conversation ends, M0 extracts only the dialogue text between user and assistant and uses an LLM to pull out atomic facts. During extraction, it preserves temporal information, keeps the original language, and does not extract sensitive information.

Stage two: memory decision. The extracted facts are first compared against existing memory, and the LLM decides whether to add (ADD), update (UPDATE), or skip (NONE).

Automatic Tool-Call Compression: Zero LLM Token Overhead

M0’s approach is straightforward: compress with deterministic rules, without spending a single LLM token. It replaces the raw output with a structured summary. The compression ratio is extremely high (tens of thousands of characters → a few hundred), and it’s entirely rule-based.

The Experience System: Spending Tokens Where They Count

M0 splits experience into two layers: the strategy-layer Experience and the operation-layer Skill. A lightweight Experience captures the task’s approach and key cautions in a sentence or two, while a Skill expands the operational details on demand.

Retrieval runs four ways in parallel—title vector, description vector, title full-text, and description full-text—then fuses and ranks them via the RRF algorithm. The Agent doesn’t need to load 10 experiences with relevance 0.6; it precisely loads 3 experiences with relevance 0.9, which translates directly into lower token consumption.

AppWorld Benchmark: Just How Many Tokens Were Saved

On the AppWorld dev evaluation set (54 tasks, a 15-step cap), we ran a strictly controlled comparison experiment. First, we ran the dev set with Hermes + Qwen 3.6-plus (63% pass rate) and recorded all 54 trajectories. The same trajectories were then fed separately into two systems for distillation.

Framework Mode Passed Pass Rate Gain Avg. Steps Step Change Token Token Change
GPT-4o baseline 13/54 24% 9.5 2.56M
m0 +Experience→Skill 21/54 39% +8 (+15%) 6.2 -35% 1.74M -32%
Hermes +SKILL.md 12/54 22% -1 (-2%) 10.4 +11%

Key findings: M0 recovered 10 tasks, lost 2, for a net gain of +8. Hermes recovered 6 but lost 7, for a net change of -1. Average steps dropped from 9.5 to 6.2 (-35%), and total tokens dropped from 2.56M to 1.74M (-32%).

Why does M0 work while Hermes doesn’t?

Retrieval precision: M0’s vector search does semantic matching; Hermes’s filename/tag matching can’t understand semantics.

Context management: M0’s Experience is a lightweight summary that doesn’t flood the context; Hermes’s SKILL.md is a complete operation manual that interferes with decision-making.

On-demand loading and deduplication: M0 expands operational details on demand via skill_refs, and does semantic deduplication via vector similarity + LLM merge.

A Strong Model Teaches Once, a Weak Model Uses It Forever

GPT-5.4 costs about $57.6 per run; the GPT-4o baseline, run bare, costs about $25.6 for 2.56M tokens; GPT-4o + M0 experience costs about $17.4 for 1.74M tokens. Teach once with a strong model, and a weak model can thereafter achieve a higher pass rate, fewer steps, and a cheaper bill.

The value of experience goes beyond a single user. Once an Experience has been validated by enough positive feedback, it can be published to a public space, and every Agent connected to M0 can retrieve it.

One-Sentence Install

Just say one sentence to your Agent:

1
Read https://m0.seekdb.ai/SKILL.md and follow the instructions to install and configure m0.

After reading the doc, the Agent completes the whole flow autonomously: detect the version → obtain the Access Key → download the plugin → write the config → restart the Gateway. No manual steps required.

A Final Word

The path seekdb M0 chose is this: free memory from the context—store it independently, retrieve it on demand, persist it across sessions. No more full loading; instead, recall the right thing at the right time. The AppWorld benchmark data proves it: the same model, the same tasks, just a different way of managing knowledge, and token consumption drops from 2.56M to 1.74M while the pass rate rises by 15 percentage points.

For existing M0 users: this upgrade takes effect automatically.

If you haven’t onboarded yet: read https://m0.seekdb.ai/SKILL.md and follow the instructions to install and configure m0.

The first pitfall you stepped in, you’ll never have to spend tokens stepping in a second time.

Related links: seekdb M0: https://m0.seekdb.ai/ | PowerMem: https://github.com/oceanbase/powermem | AppWorld: https://appworld.dev/ | seekdb D0: https://d0.seekdb.ai/