{"id":"fcb2e46b-9484-4ee7-8936-c0d4dd2032be","shortId":"C8m47E","kind":"skill","title":"autocompact-recursion-guards","tagline":"Block autocompact from running in recursive contexts so forks and helpers don’t deadlock.","description":"# SKILL: Autocompact Recursion Guards\n**Domain:** context-management  \n**Trigger:** Apply when auto-compacting logic runs inside recursive agents (session memory, compact helpers, context collapse) and must avoid deadlocking by re-entering itself.\n**Source Pattern:** Distilled from reviewed session memory, compaction, and context-budgeting implementations.\n\n## Core Method\nProtect the proactive compaction gate with explicit exclusion rules for forked agents and context-specialized modes. Check whether the caller is already within the `session_memory` or `compact` subagent, whether a context-collapse or reactive-only mode is engaged, and whether features that manage their own context already control compaction. If any guard trips, return `false` so the recursion never fires again and the specialized agent can manage its own compaction cycle.\n\n## Key Rules\n- Identify contexts that already own compaction (session memory, compact, marble_origami, reactive compact, context collapse) and short-circuit the auto-compact decision for them.\n- Keep the guards in should auto compact separate from the general thresholds so the recursion detection stays runnable even when feature flags change.\n- Use feature gates to keep these checks dead-code-eliminated in builds that lack the implicated subsystems.\n- Document why each guard exists so future engineers do not re-enable auto-compact in those contexts.\n- Log or metrics may note when a guard prevented compaction so you can tune thresholds without reintroducing loops.\n\n## Example Application\nWhen a forked session-memory compactor would otherwise trigger auto-compact, the guard sees query source 'session memory' and returns `false`, letting the fork run its own compaction without conflicting with the main thread.\n\n## Anti-Patterns (What NOT to do)\n- Don’t let auto-compact run inside the compact agent or session memory; it will deadlock with itself.\n- Don’t tie these guards to mutable thresholds; they must fire even when the token usage looks high.","tags":["autocompact","recursion","guards","cskill","agents","ychampion","agent-skills","ai-agents","cli","coding-agents","context-engineering","developer-tools"],"capabilities":["skill","source-ychampion","skill-autocompact-recursion-guards","topic-agent-skills","topic-ai-agents","topic-cli","topic-coding-agents","topic-context-engineering","topic-developer-tools","topic-mcp","topic-multi-agent","topic-terminal-ui"],"categories":["cskill-agents"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/ychampion/cskill-agents/autocompact-recursion-guards","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add ychampion/cskill-agents","source_repo":"https://github.com/ychampion/cskill-agents","install_from":"skills.sh"}},"qualityScore":"0.467","qualityRationale":"deterministic score 0.47 from registry signals: · indexed on github topic:agent-skills · 34 github stars · SKILL.md body (2,012 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-22T06:56:45.276Z","embedding":null,"createdAt":"2026-04-18T22:19:48.289Z","updatedAt":"2026-04-22T06:56:45.276Z","lastSeenAt":"2026-04-22T06:56:45.276Z","tsv":"'agent':37,79,136,304 'alreadi':90,118,148 'anti':288 'anti-pattern':287 'appli':28 'applic':250 'auto':31,166,176,226,262,298 'auto-compact':30,165,225,261,297 'autocompact':2,6,20 'autocompact-recursion-guard':1 'avoid':46 'block':5 'budget':64 'build':206 'caller':88 'chang':193 'check':85,200 'circuit':163 'code':203 'collaps':43,102,159 'compact':32,40,60,71,96,120,141,150,153,157,167,177,227,240,263,280,299,303 'compactor':257 'conflict':282 'context':11,25,42,63,82,101,117,146,158,230 'context-budget':62 'context-collaps':100 'context-manag':24 'context-speci':81 'control':119 'core':66 'cycl':142 'dead':202 'dead-code-elimin':201 'deadlock':18,47,310 'decis':168 'detect':186 'distil':55 'document':212 'domain':23 'elimin':204 'enabl':224 'engag':109 'engin':219 'enter':51 'even':189,324 'exampl':249 'exclus':75 'exist':216 'explicit':74 'fals':126,273 'featur':112,191,195 'fire':131,323 'flag':192 'fork':13,78,253,276 'futur':218 'gate':72,196 'general':181 'guard':4,22,123,173,215,238,265,317 'helper':15,41 'high':330 'identifi':145 'implement':65 'implic':210 'insid':35,301 'keep':171,198 'key':143 'lack':208 'let':274,296 'log':231 'logic':33 'look':329 'loop':248 'main':285 'manag':26,114,138 'marbl':154 'may':234 'memori':39,59,94,152,256,270,307 'method':67 'metric':233 'mode':84,107 'must':45,322 'mutabl':319 'never':130 'note':235 'origami':155 'otherwis':259 'pattern':54,289 'prevent':239 'proactiv':70 'protect':68 'queri':267 're':50,223 're-en':222 're-ent':49 'reactiv':105,156 'reactive-on':104 'recurs':3,10,21,36,129,185 'reintroduc':247 'return':125,272 'review':57 'rule':76,144 'run':8,34,277,300 'runnabl':188 'see':266 'separ':178 'session':38,58,93,151,255,269,306 'session-memori':254 'short':162 'short-circuit':161 'skill':19 'skill-autocompact-recursion-guards' 'sourc':53,268 'source-ychampion' 'special':83,135 'stay':187 'subag':97 'subsystem':211 'thread':286 'threshold':182,245,320 'tie':315 'token':327 'topic-agent-skills' 'topic-ai-agents' 'topic-cli' 'topic-coding-agents' 'topic-context-engineering' 'topic-developer-tools' 'topic-mcp' 'topic-multi-agent' 'topic-terminal-ui' 'trigger':27,260 'trip':124 'tune':244 'usag':328 'use':194 'whether':86,98,111 'within':91 'without':246,281 'would':258","prices":[{"id":"f1d23f4d-4f1c-45e8-9936-3efee973e379","listingId":"fcb2e46b-9484-4ee7-8936-c0d4dd2032be","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"ychampion","category":"cskill-agents","install_from":"skills.sh"},"createdAt":"2026-04-18T22:19:48.289Z"}],"sources":[{"listingId":"fcb2e46b-9484-4ee7-8936-c0d4dd2032be","source":"github","sourceId":"ychampion/cskill-agents/autocompact-recursion-guards","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/autocompact-recursion-guards","isPrimary":false,"firstSeenAt":"2026-04-18T22:19:48.289Z","lastSeenAt":"2026-04-22T06:56:45.276Z"}],"details":{"listingId":"fcb2e46b-9484-4ee7-8936-c0d4dd2032be","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"autocompact-recursion-guards","github":{"repo":"ychampion/cskill-agents","stars":34,"topics":["agent-skills","ai-agents","cli","coding-agents","context-engineering","developer-tools","mcp","multi-agent","terminal-ui"],"license":"mit","html_url":"https://github.com/ychampion/cskill-agents","pushed_at":"2026-04-04T14:13:23Z","description":"Agent skills for coding CLIs, multi-agent runtimes, context engines, MCP extensions, and terminal tooling. Instead of using claude code's source code, give your agent skills to create your own!","skill_md_sha":"52b2c4f00df146e11e5fdcb04ced5466bcebea86","skill_md_path":"skills/autocompact-recursion-guards/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/autocompact-recursion-guards"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"autocompact-recursion-guards","description":"Block autocompact from running in recursive contexts so forks and helpers don’t deadlock."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/autocompact-recursion-guards"},"updatedAt":"2026-04-22T06:56:45.276Z"}}