Skip to content
Skillv1.0.0

token-compressor

Deterministically compresses long logs/text into high-signal excerpts to free context window.

by jonnathan-ls(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from jonnathan-ls/ai-context-kit (skills/token-compressor/SKILL.md). Install upstream with npx skills add jonnathan-ls/ai-context-kit --skill token-compressor. Copyright stays with the author.

Token Compressor

This skill reduces token overhead by compressing bulky inputs (logs, stack traces, long docs) while preserving evidence.

When to Use

  • The user pastes long logs.
  • Tool output is huge.
  • A file is too large to read fully.

Compression Rules (Deterministic)

Apply these tactics in order:

  1. Keep evidence lines

    • Always keep lines matching: error, exception, traceback, fail, warning, fatal.
  2. Keep structure

    • Keep the first N lines (header/context) and last M lines (final error).
  3. Deduplicate noise

    • Collapse repeated consecutive lines.
    • Collapse repeated blocks (same line repeated many times).
  4. Summarize the rest

    • Replace large omitted blocks with a short note: (… 3,421 lines omitted …).

Tooling

If available, use the bundled compressor script:

python3 ~/.ai-context/skills/token-compressor/scripts/compress_text.py --help

Output Format

## Compressed Context

- Source: …
- Original: X lines
- Kept: Y lines
- Notes: …

```text
…compressed excerpt…

## Anti-Patterns

- Removing the exact error line.
- Keeping only a summary with no evidence.
- Dumping the entire log into the reasoning window.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/jonnathan-ls-ai-context-kit-token-compressor/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

jonnathan-ls-ai-context-kit-token-compressor.ocm.jsonjson
{
  "ocm": "1",
  "id": "jonnathan-ls-ai-context-kit-token-compressor",
  "kind": "skill",
  "name": "token-compressor",
  "description": "Deterministically compresses long logs/text into high-signal excerpts to free context window.",
  "publisher": "jonnathan-ls",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "token",
      "compression",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Deterministically compresses long logs/text into high-signal excerpts to free context window."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/jonnathan-ls/ai-context-kit",
      "path": "skills/token-compressor/SKILL.md",
      "ref": "faeb6bdc81708c17c61365f976c221d9bb89928a",
      "url": "https://github.com/jonnathan-ls/ai-context-kit/blob/faeb6bdc81708c17c61365f976c221d9bb89928a/skills/token-compressor/SKILL.md",
      "key": "jonnathan-ls/ai-context-kit/skills/token-compressor/SKILL.md"
    },
    "allowed_tools": [
      "Read,",
      "Bash,",
      "Grep"
    ]
  },
  "instructions": "# Token Compressor\n\nThis skill reduces token overhead by compressing bulky inputs (logs, stack traces, long docs) while preserving evidence.\n\n## When to Use\n\n- The user pastes long logs.\n- Tool output is huge.\n- A file is too large to read fully.\n\n## Compression Rules (Deterministic)\n\nApply these tactics in order:\n\n1. **Keep evidence lines**\n   - Always keep lines matching: `error`, `exception`, `traceback`, `fail`, `warning`, `fatal`.\n\n2. **Keep structure**\n   - Keep the first N lines (header/context) and last M lines (final error).\n\n3. **Deduplicate noise**\n   - Collapse repeated consecutive",
  "cost": {
    "context_tokens": 307
  }
}

Fetch it by URL: GET /api/v1/registry/jonnathan-ls-ai-context-kit-token-compressor/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.