A transparent plugin for Claude Code and Codex that automatically preserves and restores working state around the /compact command through pre- and post-compaction hooks.

Stars

182

7-day growth

No data

Forks

4

Open issues

0

License

MIT

Last updated

2026-07-27

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It solves the common problem of losing session context during compaction in AI coding assistants, providing automatic state backup, recovery, and a configurable warning system without requiring manual user intervention.

Who it is for

  • Developers using Claude Code or Codex for long-running coding sessions
  • Teams that rely on AI pair programmers and need to maintain context across compaction
  • Advanced users who want fine-grained control over compaction behavior and recovery notes
  • Plugin developers interested in hook-based augmentation of AI runtime compaction

Use cases

  • Automatically preserving the full task plan, decisions, and file state before a /compact command
  • Recovering the agent's context exactly once after compaction, including skill invocations and editing history
  • Receiving a proactive warning when context usage approaches a threshold, along with a brief state recap
  • Manually capturing richer recovery notes via the /compact-plus skill before an upcoming compaction

Strengths

  • Fully transparent operation—no extra commands or manual steps required for basic use
  • Works on both Claude Code and Codex with the same hook-based architecture
  • Incremental transcript processing and configurable squashing reduce LLM token costs
  • Handles edge cases like thread-spawn subagents and runtime hook ordering differences

Considerations

  • Requires a compatible LLM backend (claude -p or codex exec) and a subscription for the fallback model
  • Configuration involves environment variables with multiple tunables, which may overwhelm casual users
  • Relies on runtime-specific hook APIs that could change with future versions of Claude Code or Codex

README quick start

Usage

Description

Claude Code plugin: preserve and restore working state around /compact

Related repositories

Similar projects matched by category, topics, and programming language.

jamesob
Featured
jamesob GitHub avatar

local-llm

A comprehensive guide for building and configuring a high-end local machine to run state-of-the-art LLMs, with detailed hardware choices, BIOS tuning, and Docker-based model serving.

AI & Machine LearningLarge Language Models
1,660
bjan
Featured
bjan GitHub avatar

claudemux

Claudemux is a lightweight, dependency-minimal message bus that lets multiple Claude Code sessions communicate in real-time over tmux, enabling one session to ask another a question and receive the answer without manual intervention.

AI & Machine LearningAI Agents
9
AARomanov1985
AARomanov1985 GitHub avatar

Audio-Cassette-Simulation

A set of bash scripts using ffmpeg to simulate vintage cassette tape audio profiles with noise, wow/flutter, bandwidth limits, and EQ.

Shell
373