agentsclimarketplace

Time gap cache expiry microcompact

Skill ychampion/cskill-agents/agents/claude-code/skills/time-gap-cache-expiry-microcompact

When a long idle gap means the server cache is cold, clear old tool-result content before the next request instead of attempting warm-cache cache edits.From its SKILL.md

Install
npx -y skills add ychampion/cskill-agents --skill time-gap-cache-expiry-microcompact

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

2.2 KB, 393 tokens by cl100k_base, as published. Nobody here has run it

SKILL: Time-Gap Cache-Expiry Microcompact

Domain: compaction Trigger: Apply when a long gap since the last assistant response implies the prompt cache has expired and cache-editing no longer makes sense. Source Pattern: Distilled from reviewed session memory, compaction, and context-budgeting implementations.

Core Method

Detect when the cache is effectively cold by comparing the idle gap against a time-based microcompact threshold. If the gap is too large, skip cache-editing entirely and proactively clear old tool-result content before the next request, because the full prefix will be rewritten anyway. Reset any cached microcompact state and suppress false-positive cache-break warnings so the cold-cache rewrite is treated as an intentional maintenance step.

Key Rules

  • Evaluate the idle gap only for explicit main-thread requests; analysis-only calls without a real query source should not trigger time-based compaction.
  • Short-circuit before cache-editing when the gap exceeds the configured threshold, because cache edits assume a warm server cache.
  • Reset shared cached-microcompact state after the content clear so stale registered tool IDs do not leak into later turns.
  • Notify cache-break detection that the upcoming drop in cache reads is expected, not a genuine regression.
  • Suppress compact warnings on successful time-gap cleanup so users do not get duplicate noise for the intentional clear.

Example Application

If a user leaves a conversation idle for long enough that the server prompt cache is gone, clear old read/shell tool results before the next turn rather than trying to attach cache-edit instructions. The next request pays one clean rewrite cost and starts from a consistent compacted state.

Anti-Patterns (What NOT to do)

  • Do not attempt cache edits after a long idle gap; those edits assume cached server state that no longer exists.
  • Do not leave cached microcompact state intact after a time-gap clear; stale tool registrations will poison the next edit cycle.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.