Time gap cache expiry microcompact

From ychampion/cskill-agents · View interactive version

Time gap cache expiry microcompact is an AI agent skill from the GitHub repository ychampion/cskill-agents. 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.

How to use this skill

Skill file

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

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)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.