Xpersona
O

Openclaw Context Capsule

CLAWHUB · Unverified

Compresses older OpenClaw agent session history into a bounded, lane-change-aware context capsule — keeps recent messages verbatim, flags abandoned directions, quarantines injected instructions, and redacts secrets. Local, deterministic, any model.

62
Rank
84
Safety
1.2k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17f1wyc9w1zq21b4wj4a63xw187x632:context-capsule
  1. Install using `clawhub skill install s17f1wyc9w1zq21b4wj4a63xw187x632:context-capsule` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/parad0x-labs/context-capsule before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-parad0x-labs-context-capsule/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

81,118 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: context-capsule
description: Compresses older OpenClaw agent session history into a bounded, lane-change-aware context capsule — keeps recent messages verbatim, flags abandoned directions, quarantines injected instructions, and redacts secrets. Local, deterministic, any model.
license: MIT
metadata:
  author: Parad0x-Labs
---

# Context Capsule

Compress older agent session history before it hits the LLM, so long chats stop
re-sending the full transcript every turn. It keeps the recent tail verbatim and
turns older history into a bounded extractive capsule with decisions, tasks,
errors, paths, links, questions, and durable facts. Works with any model —
Claude, GPT, Ollama, Mistral, LM Studio.

**What sets it apart:**

- **Lane-change aware.** When the session pivots ("replace X with Y", "forget X,
  use Y instead"), the capsule marks the abandoned direction as superseded and
  keeps the live one — so the model never wanders back into a dropped plan. On a
  held-out pivot set it cleans 83% of abandoned subjects with **zero** wrongly
  flagged live choices.
- **High fidelity per token.** Distinctive signals — file paths, IDs, ports,
  URLs, commands, errors, decisions — are emitted as dense atoms. As of **v1.7.0**,
  a lone value (a bare port `5433`, an issue ref `#4821`, a version `v2.13.0`, an
  ISO date, a hyphenated code like `NEEDLE-ZX-7742`) is emitted as its **own** atom,
  so it survives compression even when its surrounding sentence loses the budget
  race — CI-tested in `test/value-survival.test.mjs`. On the maintainer's own real
  sessions the capsule kept ~79% of key signals at ~5× reduction and ~93% at ~3.4×;
  `test/fidelity-bench.mjs` measures this against **your own** `~/.openclaw` sessions
  (run it on your data to reproduce — the figures are from private sessions, not a
  repo fixture).

> **Self-contained (v1.7.0):** The compression core is bundled directly in this
> skill (`src/compression.ts`). There is **no external runtime dependency**, and
> the plugin makes **no network, file-system, or on-chain calls**. Everything
> runs locally using only Node's built-in `zlib` and `crypto`, and is fully
> deterministic. Capsules carry a `schema` tag (`context-capsule.v2`).

> **Protections (defense-in-depth, all CI-gated by `npm test`):**
> - **Secret redaction (every surface).** API keys (OpenAI, Anthropic, AWS,
>   Google, GitHub classic + fine-grained, GitLab, npm, Slack, Stripe, SendGrid,
>   Twilio), JWTs, PEM blocks, URL basic-auth, `DATABASE_URL=` DSNs, and
>   `key=value` credentials are detected by prefix/shape/context — never by raw
>   entropy, so public IDs (git SHAs, UUIDs, chain addresses) are untouched.
>   Redaction runs **before compression**, so no secret survives even in the zlib
>   audit blob, and again on output — the core never emits a secret even if called
>   directly. Each redaction carries a one-way **SHA-256 fingerprint**
>   (`[REDACTED_AWS_KEY#a1b2c3d4]`) so the same key is correlatable across turn

README.md

# context-capsule — OpenClaw ContextEngine plugin

Self-contained OpenClaw context engine that reduces prompt tokens in long agent
sessions. It keeps the recent tail verbatim and converts older history into a
bounded, model-readable extractive capsule.

The capsule preserves high-value older context:

- decisions and constraints
- open tasks and requested work
- errors and failed attempts
- files, commands, and links
- open questions and durable facts

It also keeps a zlib-compressed payload and Merkle root for auditability, but the
LLM is given the extractive capsule, not opaque compressed bytes.

## Safety and limits

- **Lossy by design.** Older messages are not preserved verbatim in the model
  prompt. Exact wording, nuance, and low-priority details can be lost.
- **Recent context remains verbatim.** `keepRecentMessages` controls how many
  latest messages stay untouched.
- **Best-effort vault scan.** Text content is scanned for common secrets and PII
  before compression or model injection. This is useful defense-in-depth, not a
  formal guarantee.
- **No external runtime dependency.** The plugin uses only Node built-ins
  (`zlib` and `crypto`) and makes no network, file-system, or on-chain calls.

## Activation

```jsonc
// openclaw.json
{
  "plugins": {
    "slots": {
      "contextEngine": "context-capsule"
    }
  }
}
```

## Config options

| Key | Default | Description |
| --- | ---: | --- |
| `minMessages` | `20` | Sessions shorter than this pass through unchanged. |
| `keepRecentMessages` | `10` | Recent messages kept verbatim after compression. |
| `maxCapsuleTokens` | `1400` | Hard cap for the injected extractive capsule. |
| `capsuleTokenRatio` | `0.14` | If OpenClaw provides a model token budget, cap the capsule to this fraction of the budget. |
| `minCompressTokens` | `900` | Estimated transcript-token floor before compression activates. |

```jsonc
{
  "plugins": {
    "entries": {
      "context-capsule": {
        "minMessages": 20,
        "keepRecentMessages": 10,
        "maxCapsuleTokens": 1400,
        "capsuleTokenRatio": 0.14,
        "minCompressTokens": 900
      }
    }
  }
}
```

## Packaging

The npm/ClawHub package ships compiled `dist/` JavaScript. It does not require
TypeScript support from the host runtime.

```sh
npm run typecheck
npm test
npm pack --dry-run
```

## When to use

Use this for long-running local or hosted model sessions where resending the full
conversation is too expensive or pushes the model toward context overflow.

Do not use it for workflows where old transcript wording must remain exact. For
that, keep normal OpenClaw history or use a retrieval system that can quote the
original source.

_meta.json

{
  "ownerId": "kn7bp6ev0v1qec2qahhgdvzt3x81q4fv",
  "slug": "context-capsule",
  "version": "1.6.1",
  "publishedAt": 1783630058561
}

CHANGELOG.md

# Changelog

## 1.7.0

- **Value-atom preservation.** A lone distinctive value — a bare port (`5433`), an
  issue ref (`#4821`), a version (`v2.13.0`), an ISO date, or a hyphenated code
  (`NEEDLE-ZX-7742`) — is now emitted as its own dense atom, so it survives
  compression even when its surrounding sentence loses the budget race. Previously
  such a value only survived when its whole line was selected. New regression:
  `test/value-survival.test.mjs` (wired into `npm test`).
- **Docs accuracy.** Corrected the documented config defaults (`maxCapsuleTokens`
  `700` → `1400`, `capsuleTokenRatio` `0.08` → `0.14`) to match the shipped values.
  Reframed the fidelity figures to state plainly that they are measured on the
  maintainer's own private sessions via `test/fidelity-bench.mjs` (reproduce on your
  own `~/.openclaw` sessions), not a repo fixture. The supersession clean rate (83%
  floor) and value-survival remain CI-gated by `npm test`.

## 1.6.0

- Self-contained compression core bundled in `src/compression.ts` (no external
  runtime dependency; no network / file-system / on-chain calls).

skill-card.md

## Description:

Openclaw Context Capsule compresses older OpenClaw agent session history into a bounded, lane-change-aware context capsule while keeping recent messages verbatim, redacting credential-shaped secrets, and quarantining injected instructions.

This skill is ready for commercial/non-commercial use.

## Publisher:

[parad0x-labs](https://clawhub.ai/user/parad0x-labs)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and agent operators use this skill to reduce prompt tokens in long OpenClaw sessions while keeping recent turns and important older decisions, tasks, errors, paths, links, and durable facts available to the model.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: Older session history is summarized rather than preserved verbatim, so exact wording, nuance, or low-priority details can be lost.

Mitigation: Use the skill for long-running sessions where bounded context is acceptable; keep original logs or retrieval sources available when exact transcript fidelity is required.

Risk: Credential-shaped secrets are redacted on a best-effort basis, but semantic personal or confidential details may still appear in retained context.

Mitigation: Do not treat the skill as the only privacy control for highly sensitive chats; limit sensitive inputs and apply host-level data handling controls.

## Reference(s):

- [Openclaw Context Capsule ClawHub listing](https://clawhub.ai/parad0x-labs/skills/context-capsule)
- [README](README.md)
- [Changelog](CHANGELOG.md)

## Skill Output:

**Output Type(s):** [text, JSON, configuration]

**Output Format:** [Model-readable text capsule with JSON-compatible capsule metadata and OpenClaw configuration examples]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Older history is lossy and bounded by maxCapsuleTokens and capsuleTokenRatio; recent messages are retained verbatim.]

## Skill Version(s):

1.6.1 (source: ClawHub release metadata)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to Openclaw Context Capsule and adjacent AI workflows.