← 返回 Skills 市场
thebrierfox

Free Compaction Primer

作者 ~K¹yle Million · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
145
总下载
0
收藏
1
当前安装
2
版本数
在 OpenClaw 中安装
/install free-compaction-primer
功能描述
Learn to recognize and prevent context death spirals in OpenClaw agents. Covers symptoms, root causes, configuration categories, and why most default setups...
使用说明 (SKILL.md)

Context Death Spiral Prevention — OpenClaw Compaction Primer

What Is a Context Death Spiral?

A context death spiral is what happens when an OpenClaw agent accumulates so much conversation history that its reasoning quality degrades — and then the degradation makes it handle the accumulation worse, which accelerates the degradation.

You've seen the symptoms:

  • Agent starts forgetting instructions it acknowledged 20 turns ago
  • Response quality drops noticeably mid-session without any obvious trigger
  • Agent begins contradicting itself or repeating earlier failed attempts
  • Sudden unexplained context resets that wipe work in progress
  • Tool calls become erratic — the agent loses track of what it already tried

These aren't model failures. They're architecture failures. The agent isn't broken — its context management is.

Why Default OpenClaw Setups Don't Handle This

Out of the box, OpenClaw has no compaction architecture. There is no:

  • Threshold configuration that triggers compaction before quality degrades
  • Circuit breaker that catches failed compactions before they cascade
  • Post-compaction cleanup sequence that verifies the context was actually reduced
  • Sequencing logic that governs what gets compacted in what order
  • Guard against recursive compaction (compacting a compaction summary)

Without these, the agent operates until it hits the model's hard context limit. At that point, OpenClaw either crashes, truncates silently, or enters an error loop. None of these are recoverable without manual intervention.

The Four Categories That Control Compaction Behavior

Production compaction architecture covers four distinct areas. You need all four:

1. Threshold Management

The threshold determines when compaction fires. Set it too high and the agent degrades before compaction helps. Set it too low and you waste tokens on unnecessary compaction. The right thresholds are not intuitive — they depend on the model's actual quality degradation curve, not its advertised context window.

Most operators guess. Production deployments measure.

2. Autocompact Gate Logic

Compaction shouldn't fire on every threshold breach — some breaches are transient. A production gate evaluates multiple conditions before triggering: token count, session age, tool call density, the shape of recent content. A simple token threshold is not a gate. It's a single condition, and it fires at the wrong time roughly 30% of the time in active sessions.

3. Circuit Breaker

Compaction can fail. When it does, naive implementations retry immediately — which can send the agent into an infinite compaction loop that burns tokens and produces nothing. A production circuit breaker counts consecutive failures, backs off, and eventually halts with a recoverable state.

Without a circuit breaker, one bad compaction attempt can destroy a session.

4. Post-Compaction Cleanup

After compaction runs, the context window needs to be verified. Did it actually reduce? Was the summary written correctly? Are there orphaned references to content that no longer exists? Post-compaction cleanup is not optional — without it, you have no guarantee compaction worked.

Why This Is Harder Than It Looks

The threshold problem alone has three sub-problems:

  • Warning threshold — when to signal that compaction is approaching
  • Trigger threshold — when to actually compact
  • Block threshold — when the context is too full to compact safely and the session must halt

These three values interact. Setting any one of them wrong creates either unnecessary interruptions or silent degradation. Production deployments derive all three from the same empirical baseline. Guessing independently at each one is how operators end up with agents that compact too aggressively, lose important context, and then compound the problem on the next session.

The Bottom Line

If your OpenClaw agent runs sessions longer than 30 minutes, handles multi-step autonomous tasks, or operates without supervision — you have a context management problem, whether you've seen the symptoms yet or not.

Most operators discover this the hard way.


Full production architecture with all 7 SKILL.md files — including exact production-validated constants validated in production Claude Code deployments — available in the Production Agent Ops bundle on Claw Mart:

https://www.shopclawmart.com/listings/production-agent-ops-battle-tested-architecture-pack-0d1bb129

安全使用建议
This skill appears to be a safe, read-only primer. Before installing: be aware it contains a promotional link to a paid bundle (no automatic downloads are referenced). Because it's informational, it does not need credentials or installs; review the content for accuracy before relying on it for production changes. If you allow autonomous invocation, note that this skill won't itself access secrets or external APIs, but any advice it gives could lead you to reconfigure agents — validate changes in a safe environment.
能力评估
Purpose & Capability
The skill's name and description match the SKILL.md content (a technical primer on compaction/context management). It requires no binaries, env vars, or other resources, which is proportionate for an informational/educational skill.
Instruction Scope
The SKILL.md is purely descriptive and does not instruct the agent to read files, access credentials, or transmit user data. It does contain a promotional external URL to a paid bundle (shopclawmart.com), which is marketing content but not an instruction to exfiltrate data.
Install Mechanism
No install spec or code files are present (instruction-only), so nothing is written to disk or executed on install.
Credentials
The skill declares no required environment variables, credentials, or config paths — appropriate for an informational document.
Persistence & Privilege
The skill does not request always:true and is user-invocable (default). It does not modify other skills or system configuration.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install free-compaction-primer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /free-compaction-primer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Remove Anthropic attribution language
v1.0.0
- Initial release: a free primer for preventing context death spirals in OpenClaw agents. - Explains core symptoms, root causes, and why unmodified OpenClaw setups lack compaction protection. - Details the four production-critical categories for compaction behavior: threshold management, autocompact gate logic, circuit breakers, and post-compaction cleanup. - Offers practical guidance on correct threshold configuration to avoid degradation and session failures. - Available as a standalone SKILL.md and as part of a larger Production Agent Ops bundle.
元数据
Slug free-compaction-primer
版本 1.0.1
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 2
常见问题

Free Compaction Primer 是什么?

Learn to recognize and prevent context death spirals in OpenClaw agents. Covers symptoms, root causes, configuration categories, and why most default setups... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 145 次。

如何安装 Free Compaction Primer?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install free-compaction-primer」即可一键安装,无需额外配置。

Free Compaction Primer 是免费的吗?

是的,Free Compaction Primer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Free Compaction Primer 支持哪些平台?

Free Compaction Primer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Free Compaction Primer?

由 ~K¹yle Million(@thebrierfox)开发并维护,当前版本 v1.0.1。

💬 留言讨论