write-compressor

Implement deterministic compressor encoders compatible with existing decoders.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/bianhaifeng789-hue/openclaw-config --skill write-compressor-bianhaifeng789-hue
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-compressor
Source: https://github.com/bianhaifeng789-hue/openclaw-config/tree/main/skills/tb2/write-compressor
Command: npx skills add https://github.com/bianhaifeng789-hue/openclaw-config --skill write-compressor-bianhaifeng789-hue

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill explains how to implement compression encoders that produce output byte-for-byte compatible with an existing decoder and prevents subtle state divergence that breaks decompression, with a strong focus on arithmetic coding and other bit-level schemes.

Core Features & Use Cases

  • Decoder-first analysis: Reimplement the decoder as a simulator to trace state transitions (fraction, range, low) and derive the exact byte-output formulas.
  • Incremental implementation: Start with single-bit and single-integer encoders, extend to sequences, and only then attempt full-file compression.
  • Dual simulation verification & testing: Maintain encoder and decoder simulators, compare step-by-step debug traces, and add unit tests that assert state synchronization after every operation.
  • Practical use case: Implement a compressor for legacy archives that must interoperate with an existing arithmetic decoder where any mismatch causes data corruption.

Quick Start

Create a minimal Python encoder that encodes a single bit, run it against a Python decoder simulator, and verify state and decoded output match exactly.

Frequently Asked Questions about write-compressor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement an arithmetic coding encoder that is byte-for-byte compatible with an existing decoder?

To implement a compatible arithmetic coding encoder, you must match renormalization timing, byte-output formulas, and probability model updates exactly. Reimplement the decoder as a simulator to trace state transitions and derive the exact byte-output formulas.

Why does my arithmetic encoder cause state divergence and break decompression?

State divergence occurs when encoder and decoder probability model updates or renormalization timing mismatch. Prevent this by maintaining dual simulators, comparing step-by-step debug traces, and adding unit tests asserting state synchronization after every operation.

What is the best way to start developing a bit-level compressor for a legacy archive?

Start incremental implementation with single-bit and single-integer encoders, verify them against a decoder simulator, extend to sequences, and only then attempt full-file compression to ensure interoperability with the existing arithmetic decoder.

How do I unit test an incremental encoder to verify decoder state synchronization?

Write decoder-simulator unit tests that assert state synchronization after every operation. Maintain both encoder and decoder simulators, compare step-by-step debug traces for fraction, range, and low values, and verify decoded output matches exactly.

Can I use this approach to build a compressor for legacy archives with an existing arithmetic decoder?

Yes, this approach specifically targets legacy archives that must interoperate with an existing arithmetic decoder. By deriving exact byte-output formulas through decoder-first analysis, you prevent the subtle state divergence that causes data corruption.

Does this compression encoder implementation work with bit-level encoders and single-bit operations?

Yes, the implementation applies to bit-level encoders and incremental encoder development for single bits up to full-file compression. You start with a minimal encoder that encodes a single bit and verify state and decoded output match exactly.