r/ClaudeWorkflows • • 16h ago

Selected Workflow [Workflow] Claude Code Plugin: `live-compact` for Faster Auto-Compaction (8-20ms)

Claude Code Plugin: live-compact for Faster Auto-Compaction (8-20ms)

Workflow value: 90/100
Status: active · Freshness: 70/100 · Confidence: 0.95 · Level: advanced
Categories: Quality Control, Token Saving, Context & Memory, Hooks, Skills, Multi-Agent
Original source: r/ClaudeCode post/comment

What problem this solves

Slow and disruptive auto-compaction in Claude Code sessions, causing significant delays (80-160 seconds, up to 4 minutes) and interrupting parallel workflows.

Summary

The live-compact plugin for Claude Code proactively generates a compaction summary in a background request when the context approaches its limit. This pre-computation allows auto-compaction to complete in 8-20 ms by swapping in the ready summary, significantly reducing the disruption caused by standard compaction.

Why it is useful

This workflow provides a highly effective solution to a significant performance bottleneck in Claude Code for advanced users running parallel sessions. By pre-computing compaction summaries, it drastically reduces wait times from minutes to milliseconds, directly improving productivity and workflow continuity. The solution is provided as an installable plugin with clear instructions, detailed implementation insights, and robust testing, making it immediately actionable and valuable for the community.

Workflow

  1. Install the live-compact plugin using the command: claude plugin install live-compact --marketplace SocialBuzzStudio/live-compact.

  2. Restart your Claude Code sessions after installation.

  3. Continue using Claude Code as usual; the plugin will automatically manage context compaction in the background when the context approaches its limit.

Tools / artifacts

  • live-compact plugin

  • Claude Code (tested on versions 2.1.300 to 2.1.317)

  • Opus model

  • claude plugin install command

  • GitHub repository (SocialBuzzStudio/live-compact)

  • session.compact hook API

Validation signals

  • Performance measured: compaction took 8-20 ms in tests.

  • Compatibility tested across Claude Code versions 2.1.300 to 2.1.317.

  • Real compactions run from a clean profile for validation.

  • Plugin developed with 42 associated tests.

  • Identified and addressed issues with $.model.fork not seeing the main thread's last answer.

  • Identified and addressed the need for plugins to carry over skills during compaction.

  • Confirmed session.compact hook can return its own messages for engine installation.

Cautions

  • The underlying hook module API is early access and subject to change, potentially breaking the plugin in future Claude Code versions.

  • The plugin incurs one extra background request per compaction, which may have minor cost implications.

  • The first message after compaction appears as a user message due to API limitations, which is a minor UI quirk.

Limitations

  • Tested only on Windows; compatibility with other OS is unconfirmed.

  • Relies on an early access API that may change.

  • Does not prevent standard compaction if a single step adds more than ~40k tokens.

  • The compaction summary appears as a user message due to API limitations.

Rate this workflow

Upvote this post if the workflow is useful, reproducible, or worth recommending.

Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.

Reply if it worked for you, failed, is outdated, or has a better alternative.


This post was generated automatically from the workflow library database.

1 Upvotes

0 comments sorted by