compact-lifecycle-reuse

Coordinate reusable pre- and post-compact hooks to extend and audit conversation compaction.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/liuyu520/cc_source --skill compact-lifecycle-reuse
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compact-lifecycle-reuse
Source: https://github.com/liuyu520/cc_source/tree/main/.claude/skills/compact-lifecycle-reuse
Command: npx skills add https://github.com/liuyu520/cc_source --skill compact-lifecycle-reuse

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reuse compact lifecycle hooks (pre-compact snapshot, post-compact cleanup, orchestrator decide/execute) to extend or debug the compact workflow as conversations evolve.

Core Features & Use Cases

  • Pre-compact snapshot hooks to capture full session state before any destructive operation.
  • Post-compact cleanup hooks to restore or adjust messages after compaction and preserve user intent.
  • Orchestrator-level hooks to influence decide/execute paths without bypassing safety checks.
  • Debugging scaffolds to observe, log, and simulate compact flows across different scenarios.

Quick Start

Hook into the compactConversation flow to apply a pre-compact hook, then perform post-compact cleanup as needed.

Frequently Asked Questions about compact-lifecycle-reuse

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

FAQPage Schema
How do I run custom logic before conversation compaction deletes session data?

Pre-compact snapshot hooks capture full session state before any destructive compaction operation. You inject behavior into the compact lifecycle to safely preserve context and audit data before cleanup occurs.

Can I adjust messages after compaction to preserve user intent?

Post-compact cleanup hooks restore or adjust messages after compaction to preserve user intent. They connect to the compact lifecycle allowing you to modify the session state immediately after the orchestrator finishes.

How do lifecycle hooks influence orchestrator decide and execute paths?

Orchestrator-level hooks influence decide and execute paths during conversation compaction without bypassing safety checks. They integrate with the compact orchestrator to inject custom routing logic while maintaining system constraints.

What is the best way to debug conversation compaction flows across different scenarios?

Debugging scaffolds observe, log, and simulate compact flows across different scenarios. By attaching reusable hooks to pre-compact, post-compact, and orchestrator phases, you can trace the entire compaction lifecycle.

Do I need dependencies to use compact lifecycle hooks in my chat workflow?

No external dependencies are required to use compact lifecycle hooks. The system requires only a robust hook interface, safe error handling, and compatibility with existing compact orchestrator, snapshot, and memory components.

When should I not use lifecycle hooks for conversation compaction?

Avoid using lifecycle hooks if your chat workflow lacks a compact orchestrator or snapshot components. Hooks require safe error handling and existing memory components to function properly without breaking compaction safety checks.