Skip to content

v1.2.0 — Initial Public Release

Latest

Choose a tag to compare

@j-ohashi j-ohashi released this 27 Nov 04:16

Initial Public Release

Claude Code Compact Proxy is a lightweight, dependency-free Python proxy designed to speed up context compaction when using Claude Code with local LLMs.

Instead of modifying Claude Code or the LLM inference server, the proxy intercepts compaction requests and replaces verbose standard prompts with concise alternatives while preserving essential context and user-provided instructions.

Features

  • Automatic detection and replacement of Claude Code compaction prompts

  • Support for custom compaction instructions (/compact <instructions>)

  • Transparent forwarding of non-compaction requests

  • Support for Server-Sent Events (SSE) streaming

  • Conservative prompt matching with automatic passthrough when the prompt structure does not match

  • Performance metrics without logging conversation content

  • Configurable upstream endpoint and listening address

  • No external Python dependencies

  • English and Japanese documentation

  • Regression tests and a standard prompt capture utility

Performance Results

The following improvements were observed during testing with Claude Code and a local LLM running on llama.cpp.

Metric | Standard | Optimized | Reduction -- | -- | -- | -- Compaction time | 208.08 s | 101.77 s | 51.1% Output tokens | 7,821 | 2,520 | 67.8%

Earlier experiments with standard compaction also demonstrated approximately 68% reduction in processing time.

Post-compaction checks confirmed that essential project information, implementation decisions, test results, and major operational constraints were retained.

These results are based on practical experiments rather than strictly controlled benchmarks. Performance may vary depending on the model, hardware, conversation history, and prompt cache state.

Getting Started

See the documentation for installation, configuration, and standard prompt acquisition:

The original Claude Code compaction prompt is intentionally not included in this repository. Users must obtain it from their own environment.

Known Limitations

  • Compaction detection depends on the Claude Code prompt structure and may require updates when Claude Code changes its prompts.

  • An ordinary request containing the complete standard compaction prompt may be incorrectly detected as a compaction request.

  • The standard prompt capture utility has not yet been validated end-to-end with Claude Code.

  • The proxy is intended for local or trusted network environments and does not provide built-in authentication or TLS.

License

Released under the MIT License.

## Initial Public Release

Claude Code Compact Proxy is a lightweight, dependency-free Python proxy designed to speed up context compaction when using Claude Code with local LLMs.

Instead of modifying Claude Code or the LLM inference server, the proxy intercepts compaction requests and replaces verbose standard prompts with concise alternatives while preserving essential context and user-provided instructions.

Features

  • Automatic detection and replacement of Claude Code compaction prompts
  • Support for custom compaction instructions (/compact <instructions>)
  • Transparent forwarding of non-compaction requests
  • Support for Server-Sent Events (SSE) streaming
  • Conservative prompt matching with automatic passthrough when the prompt structure does not match
  • Performance metrics without logging conversation content
  • Configurable upstream endpoint and listening address
  • No external Python dependencies
  • English and Japanese documentation
  • Regression tests and a standard prompt capture utility

Performance Results

The following improvements were observed during testing with Claude Code and a local LLM running on llama.cpp.

Metric Standard Optimized Reduction
Compaction time 208.08 s 101.77 s 51.1%
Output tokens 7,821 2,520 67.8%

Earlier experiments with standard compaction also demonstrated approximately 68% reduction in processing time.

Post-compaction checks confirmed that essential project information, implementation decisions, test results, and major operational constraints were retained.

These results are based on practical experiments rather than strictly controlled benchmarks. Performance may vary depending on the model, hardware, conversation history, and prompt cache state.

Getting Started

See the documentation for installation, configuration, and standard prompt acquisition:

The original Claude Code compaction prompt is intentionally not included in this repository. Users must obtain it from their own environment.

Known Limitations

  • Compaction detection depends on the Claude Code prompt structure and may require updates when Claude Code changes its prompts.
  • An ordinary request containing the complete standard compaction prompt may be incorrectly detected as a compaction request.
  • The standard prompt capture utility has not yet been validated end-to-end with Claude Code.
  • The proxy is intended for local or trusted network environments and does not provide built-in authentication or TLS.

License

Released under the MIT License.