Skip to content
youdede

Compact Readiness Guard

OperationsHookv1.0.0

On PreCompact, count dirty worktree changes and read pending claims from the latest ledger checkpoint, then emit a bounded system warning when either exists. Observing only; compaction proceeds.

Runs on

Scope
$npx @youdede/toolkit add compact-readiness-guard --target claude-code

What it does

Warn before compaction when uncommitted changes or pending ledger claims would silently lose context.

When it fires

  • operations
  • handoff

How it behaves

Warn when compaction would hide dirty state or pending claims.

It does not block, delay, or alter the observed event; it records or reports only.

It does not execute submitted content, call an LLM, or transmit any data off the machine.

It does not treat unreadable, symlinked, or oversized state as valid evidence.

Configuration

targets/claude-code/compact-readiness-guard.mjsnode · none

Version
1.0.0
Requires
node
Licence
RiskThis observer warns before compaction when uncommitted changes or pending ledger claims would silently lose context; it cannot block the event or mutate the inspected state.
Low
ModeHow it works: fixed rules, model instructions, or both.
Deterministic only
Behaviour
Observes, does not intervene
On failure
Allows and continues
LatencyTo warn before compaction when uncommitted changes or pending ledger claims would silently lose context, the entrypoint may run a bounded local subprocess before returning.
Bounded
Data retentionWhether data remains after use and who manages its storage.
Kept locally, bounded
In packs
  • Session continuity

Often used with

All in Operations