원클릭으로
main-thread-only-cache-editing
Gate cached microcompact cache edits to the main thread so background forks cannot alter the shared cache state.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Gate cached microcompact cache edits to the main thread so background forks cannot alter the shared cache state.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Collapse multiple change sources into one caller-facing boolean so headless bootstraps know whether a downstream refresh is necessary.
After awaiting persistence work, update the shared budget state for each `tool_use_id` exactly once so no concurrent reader ever sees a half-committed decision.
Issue continuation nudges while the turn stays under budget, then halt once diminishing returns or the budget cap justify stopping.
Lazily extract referenced files for bundled skills so large prompts stay offline until needed.
Persist a cache-safe stop-hook context snapshot only for main session queries so later helpers can resume from stable state without fork pollution.
Sweep stale extension caches before activation, then fall back to a sticky manual-refresh flag if the live refresh fails.
| name | main-thread-only-cache-editing |
| description | Gate cached microcompact cache edits to the main thread so background forks cannot alter the shared cache state. |
| metadata | {"author":"ychampion"} |
Domain: context-management
Trigger: Use when cached microcompact runs and you must prevent subagents or forks from writing cache edits that the main thread shares.
Source Pattern: Distilled from reviewed context, compaction, and memory-governance patterns.
Only perform cache-editing microcompactions when the executing query source is the main thread (repl_main_thread or unspecified). This avoids contaminating shared cachedMCState with tool results that belong to background runs like session-memory compact, prompt suggestion, or other forks. The guard also ensures the cached MC path is never triggered in non-ANT builds that disable the feature altogether.
isMainThreadSource(querySource) so only canonical queries can edit the global cache.feature('CACHED_MICROCOMPACT') to keep the functionality out of builds that do not support it.querySource.startsWith('repl_main_thread') rather than strict equality so styled prompt contexts still match.cachedMCState unexpectedly.When a main-thread REPL session hits the cached microcompact trigger, the guard passes, allowing registerToolResult and createCacheEditsBlock to run. Forked agents such as session memory or prompt suggestion skip this block entirely, leaving the global cache untouched.
cachedMCState; they should always defer to the main thread’s editing path.