Rechercher

PythonReactSEOPDF
OpenClaw

context-compactor

Token-based context compaction for local models (MLX, llama.cpp, Ollama) that don't report context limits.

emberdesire0 installations selon la source☆ 0 Étoiles du dépôtv0.3.8

Installation

Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.

SkillHub CLI

skillhub install emberdesire/context-compactor

Examinez la source et la compatibilité, puis suivez les étapes d’installation.

Donnez le lien à votre agent et demandez-lui d’examiner instructions et dépendances avant d’expliquer les étapes.

Voir la source ↗Guides

Instructions

Context Compactor

Automatic context compaction for OpenClaw when using local models that don't properly report token limits or context overflow errors.

The Problem

Cloud APIs (Anthropic, OpenAI) report context overflow errors, allowing OpenClaw's built-in compaction to trigger. Local models (MLX, llama.cpp, Ollama) often:

  • Silently truncate context
  • Return garbage when context is exceeded
  • Don't report accurate token counts

This leaves you with broken conversations when context gets too long.

The Solution

Context Compactor estimates tokens client-side and proactively summarizes older messages before hitting the model's limit.

How It Works

┌─────────────────────────────────────────────────────────────┐
│  1. Message arrives                                         │
│  2. before_agent_start hook fires                           │
│  3. Plugin estimates total context tokens                   │
│  4. If over maxTokens:                                      │
│     a. Split into "old" and "recent" messages              │
│     b. Summarize old messages (LLM or fallback)            │
│     c. Inject summary as compacted context                 │
│  5. Agent sees: summary + recent + new message             │
└─────────────────────────────────────────────────────────────┘

Installation

# One command setup (recommended)
npx jasper-context-compactor setup

# Restart gateway
openclaw gateway restart

The setup command automatically:

  • Copies plugin files to ~/.openclaw/extensions/context-compactor/
  • Adds plugin config to openclaw.json with sensible defaults

Configuration

Add to openclaw.json:

{
  "plugins": {
    "entries": {
      "context-compactor": {
        "enabled": true,
        "config": {
          "maxTokens": 8000,
          "keepRecentTokens": 2000,
          "summaryMaxTokens": 1000,
          "charsPerToken": 4
        }
      }
    }
  }
}
Options

| Option | Default | Description | |---...

Informations sur la source

Source
github
Repository
openclaw/skills
Path
skills/emberdesire/context-compactor
Version
0.3.8
Commit
0ad07cf0c30359336cdd8879f9f6674292b87eb6
Source de classification
rules
Statut
active
Visibilité
public

Ces informations proviennent de l’analyse indexée et peuvent être anciennes. Vérifiez les fichiers actuels.

README

Jasper Context Compactor

Token-based context compaction for OpenClaw with local models (MLX, llama.cpp, Ollama)

The Problem

Local LLMs don't report context overflow errors like cloud APIs do. When context gets too long, they either:

  • Silently truncate your conversation
  • Return garbage output
  • Crash without explanation

OpenClaw's built-in compaction relies on error signals that local models don't provide.

The Solution

Jasper Context Compactor estimates tokens client-side and proactively summarizes older messages before hitting your model's limit. No more broken conversations.

Quick Start

npx jasper-context-compactor setup

The setup will:

  1. ✅ Back up your config — Saves openclaw.json to ~/.openclaw/backups/ with restore instructions
  2. ✅ Ask permission — Won't read your config without consent
  3. ✅ Detect local models — Automatically identifies Ollama, llama.cpp, MLX, LM Studio providers
  4. ✅ Suggest token limits — Based on your model's contextWindow from config
  5. ✅ Let you customize — Enter your own values if auto-detection doesn't match
  6. ✅ Update config safely — Adds the plugin with your chosen settings
Supported Local Providers

The setup automatically detects these providers (primary or fallback):

  • Ollama — Any provider with ollama in name or :11434 in baseUrl
  • llama.cpp — llamacpp provider
  • MLX — mlx provider
  • LM Studio — lmstudio provider
  • friend-gpu — Custom GPU servers
  • OpenRouter — When routing to local models
  • Local network — Any provider with localhost, 127.0.0.1, or Tailscale IP in baseUrl

Then restart OpenClaw:

openclaw gateway restart

Privacy

🔒 Everything runs 100% locally. Nothing is sent to external servers.

The setup only reads your local openclaw.json file (with your permission) to detect your model and suggest appropriate limits.

How It Works

  1. Before each message, estimates total context tokens...

Contenu extrait

SKILL.md
# Context Compactor

Automatic context compaction for OpenClaw when using local models that don't properly report token limits or context overflow errors.

## The Problem

Cloud APIs (Anthropic, OpenAI) report context overflow errors, allowing OpenClaw's built-in compaction to trigger. Local models (MLX, llama.cpp, Ollama) often:

- Silently truncate context
- Return garbage when context is exceeded
- Don't report accurate token counts

This leaves you with broken conversations when context gets too long.

## The Solution

Context Compactor estimates tokens client-side and proactively summarizes older messages before hitting the model's limit.

## How It Works

```
┌─────────────────────────────────────────────────────────────┐
│  1. Message arrives                                         │
│  2. before_agent_start hook fires                           │
│  3. Plugin estimates total context tokens                   │
│  4. If over maxTokens:                                      │
│     a. Split into "old" and "recent" messages              │
│     b. Summarize old messages (LLM or fallback)            │
│     c. Inject summary as compacted context                 │
│  5. Agent sees: summary + recent + new message             │
└─────────────────────────────────────────────────────────────┘
```

## Installation

```bash
# One command setup (recommended)
npx jasper-context-compactor setup

# Restart gateway
openclaw gateway restart
```

The setup command automatically:
- Copies plugin files to `~/.openclaw/extensions/context-compactor/`
- Adds plugin config to `openclaw.json` with sensible defaults

## Configuration

Add to `openclaw.json`:

```json
{
  "plugins": {
    "entries": {
      "context-compactor": {
        "enabled": true,
        "config": {
          "maxTokens": 8000,
          "keepRecentTokens": 2000,
          "summaryMaxTokens": 1000,
          "charsPerToken": 4
        }
      }
    }
  }
}
```

### Options

| Option | Default | Description |
|---...
README
# Jasper Context Compactor

> Token-based context compaction for OpenClaw with local models (MLX, llama.cpp, Ollama)

## The Problem

Local LLMs don't report context overflow errors like cloud APIs do. When context gets too long, they either:
- Silently truncate your conversation
- Return garbage output
- Crash without explanation

OpenClaw's built-in compaction relies on error signals that local models don't provide.

## The Solution

Jasper Context Compactor estimates tokens client-side and proactively summarizes older messages before hitting your model's limit. No more broken conversations.

## Quick Start

```bash
npx jasper-context-compactor setup
```

**The setup will:**

1. ✅ **Back up your config** — Saves `openclaw.json` to `~/.openclaw/backups/` with restore instructions
2. ✅ **Ask permission** — Won't read your config without consent
3. ✅ **Detect local models** — Automatically identifies Ollama, llama.cpp, MLX, LM Studio providers
4. ✅ **Suggest token limits** — Based on your model's contextWindow from config
5. ✅ **Let you customize** — Enter your own values if auto-detection doesn't match
6. ✅ **Update config safely** — Adds the plugin with your chosen settings

### Supported Local Providers

The setup automatically detects these providers (primary or fallback):
- **Ollama** — Any provider with `ollama` in name or `:11434` in baseUrl
- **llama.cpp** — llamacpp provider
- **MLX** — mlx provider  
- **LM Studio** — lmstudio provider
- **friend-gpu** — Custom GPU servers
- **OpenRouter** — When routing to local models
- **Local network** — Any provider with localhost, 127.0.0.1, or Tailscale IP in baseUrl

Then restart OpenClaw:
```bash
openclaw gateway restart
```

## Privacy

🔒 **Everything runs 100% locally.** Nothing is sent to external servers.

The setup only reads your local `openclaw.json` file (with your permission) to detect your model and suggest appropriate limits.

## How It Works

1. Before each message, estimates total context tokens...

Skills associés

OpenClaw

bambu-studio-ai

heyixuan2

Bambu Lab 3D printer control and automation. Activate when user mentions: printer status, 3D printing, slice, analyze model, generate 3D, AMS filament, print monitor, Bambu Lab, or any 3D printing task. Full pi...

OpenClaw

humanpages

human-pages-ai

Search and hire real humans for tasks — photography, delivery, research, and more

OpenClaw

geo-optimization

capt-marbles

Generative Engine Optimization (GEO) for AI search visibility. Optimize content to appear in ChatGPT, Perplexity, Claude, and Google AI Overviews. Use when optimizing websites, pages, or content for LLM discove...

OpenClaw

openclaw-skills

zseven-w

Reusable skill templates for OpenClaw AI agents. Templates for API integration, data processing, web scraping, CLI tools, and file processing.