Time based microcompact trigger

From ychampion/cskill-agents · View interactive version

Time based microcompact trigger is an AI agent skill from the GitHub repository ychampion/cskill-agents. Fall back to time-based microcompaction when the idle gap exceeds the configured threshold and directly clear the oldest compactable tool results.

How to use this skill

Skill file

SKILL: Time-Based Microcompact Trigger

Domain: context-management

Trigger: Apply when the interval since the last assistant response exceeds the threshold and cached microcompact cannot run.

Source Pattern: Distilled from reviewed context, compaction, and memory-governance patterns.

Core Method

Measure the minutes since the last main-thread assistant message, compare it to gapThresholdMinutes, and only fire when the configured trigger is enabled and the caller is the main thread. When triggered, keep the last keepRecent tool results and content-clear the rest by replacing their content with the [Old tool result content cleared] marker. Log the elapsed gap, tokens saved, and retained count so operators can tune the gap threshold.

Key Rules

Example Application

When a session sits idle longer than gapThresholdMinutes, apply this trigger to replace outdated tool results with [Old tool result content cleared], log the 12-minute gap, and still leave the last tool result so future summaries have some fresh context.

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.