{"id":"6dafea83-09ea-4845-b125-ffcd4c696408","shortId":"yLBYEZ","kind":"skill","title":"session-memory-first-compaction","tagline":"Attempt session-memory compaction before full conversation compaction so lightweight summaries win when available.","description":"# SKILL: Session Memory First Compaction\n**Domain:** context-management  \n**Trigger:** Apply when an auto-compact flow can query a session-memory summary before running the heavier legacy compaction path.\n**Source Pattern:** Distilled from reviewed lightweight summary-first and fallback compaction implementations.\n\n## Core Method\nWhen auto-compaction fires, try the lightweight session-memory summary path first. If it returns a usable summary, treat that as a successful compaction and skip the heavier full-conversation compaction path. Only fall back to the heavyweight path when the lightweight summary is unavailable. This keeps cached or precomputed summaries in charge whenever possible and reserves the costly path for true misses.\n\n## Key Rules\n- Try the lightweight session-memory compaction path before the heavyweight full-conversation path every time auto-compaction triggers.\n- On success, reset last summarized IDs and run any post-compact cleanup to keep boundary metadata in sync.\n- Notify prompt-cache break detection so repeated compactions don’t misreport context flushes.\n- Return early with `wasCompacted: true` so callers skip the fallback path.\n- Only fall through to `compactConversation` when session memory compaction returns `null`.\n\n## Example Application\nAuto-compaction finds a fresh session-memory summary, accepts it as the compaction result, records success, and avoids calling the heavyweight compaction path at all.\n\n## Anti-Patterns (What NOT to do)\n- Don’t always run the heavyweight compaction first; you waste CPU and risk prompt-too-long errors that session memory could avoid.\n- Don’t skip the cleanup steps that reset `lastSummarizedMessageId` and notify cache detectors when the lightweight path wins.","tags":["session","memory","first","compaction","cskill","agents","ychampion","agent-skills","ai-agents","cli","coding-agents","context-engineering"],"capabilities":["skill","source-ychampion","skill-session-memory-first-compaction","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/session-memory-first-compaction","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 (1,747 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-22T00:56:56.126Z","embedding":null,"createdAt":"2026-04-18T22:21:15.610Z","updatedAt":"2026-04-22T00:56:56.126Z","lastSeenAt":"2026-04-22T00:56:56.126Z","tsv":"'accept':223 'alway':249 'anti':241 'anti-pattern':240 'appli':31 'applic':212 'attempt':6 'auto':35,69,153,214 'auto-compact':34,68,152,213 'avail':20 'avoid':232,269 'back':104 'boundari':171 'break':179 'cach':117,178,281 'call':233 'caller':195 'charg':122 'cleanup':168,274 'compact':5,10,14,25,36,50,63,70,92,100,141,154,167,183,208,215,227,236,253 'compactconvers':204 'context':28,187 'context-manag':27 'convers':13,99,148 'core':65 'cost':128 'could':268 'cpu':257 'detect':180 'detector':282 'distil':54 'domain':26 'earli':190 'error':264 'everi':150 'exampl':211 'fall':103,201 'fallback':62,198 'find':216 'fire':71 'first':4,24,60,80,254 'flow':37 'flush':188 'fresh':218 'full':12,98,147 'full-convers':97,146 'heavier':48,96 'heavyweight':107,145,235,252 'id':161 'implement':64 'keep':116,170 'key':133 'last':159 'lastsummarizedmessageid':278 'legaci':49 'lightweight':16,57,74,111,137,285 'long':263 'manag':29 'memori':3,9,23,43,77,140,207,221,267 'metadata':172 'method':66 'misreport':186 'miss':132 'notifi':175,280 'null':210 'path':51,79,101,108,129,142,149,199,237,286 'pattern':53,242 'possibl':124 'post':166 'post-compact':165 'precomput':119 'prompt':177,261 'prompt-cach':176 'prompt-too-long':260 'queri':39 'record':229 'repeat':182 'reserv':126 'reset':158,277 'result':228 'return':83,189,209 'review':56 'risk':259 'rule':134 'run':46,163,250 'session':2,8,22,42,76,139,206,220,266 'session-memori':7,41,75,138,219 'session-memory-first-compact':1 'skill':21 'skill-session-memory-first-compaction' 'skip':94,196,272 'sourc':52 'source-ychampion' 'step':275 'success':91,157,230 'summar':160 'summari':17,44,59,78,86,112,120,222 'summary-first':58 'sync':174 'time':151 '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' 'treat':87 'tri':72,135 'trigger':30,155 'true':131,193 'unavail':114 'usabl':85 'wascompact':192 'wast':256 'whenev':123 'win':18,287","prices":[{"id":"bfd72bb3-aa4a-4c80-a53f-31f11cbcc2f8","listingId":"6dafea83-09ea-4845-b125-ffcd4c696408","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:21:15.610Z"}],"sources":[{"listingId":"6dafea83-09ea-4845-b125-ffcd4c696408","source":"github","sourceId":"ychampion/cskill-agents/session-memory-first-compaction","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/session-memory-first-compaction","isPrimary":false,"firstSeenAt":"2026-04-18T22:21:15.610Z","lastSeenAt":"2026-04-22T00:56:56.126Z"}],"details":{"listingId":"6dafea83-09ea-4845-b125-ffcd4c696408","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"session-memory-first-compaction","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":"34557f1579f1852f0ceb9fc6910cc55672bee112","skill_md_path":"skills/session-memory-first-compaction/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/session-memory-first-compaction"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"session-memory-first-compaction","description":"Attempt session-memory compaction before full conversation compaction so lightweight summaries win when available."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/session-memory-first-compaction"},"updatedAt":"2026-04-22T00:56:56.126Z"}}