{"id":"d2c90460-8db0-4de4-94b8-48eafe51aa75","shortId":"yWghRH","kind":"skill","title":"main-thread-empty-string-agent-key-normalization","tagline":"Normalize the main thread to a concrete empty-string key so agent-scoped state maps treat main and forked threads uniformly.","description":"# SKILL: Main-Thread Empty-String Agent Key Normalization\n**Domain:** multi-agent  \n**Trigger:** Apply when thread-scoped state is keyed by agent identity, but the main thread has no explicit agent ID and still needs stable map behavior.\n**Source Pattern:** Distilled from reviewed multi-agent coordination and child-runtime patterns.\n\n## Core Method\nConvert the main thread's missing agent identifier into a concrete sentinel key before interacting with shared maps. Using one normalized value such as `''` lets the main thread participate in the same per-agent state structure as forked agents without special branching at every lookup or write. This keeps map semantics uniform and ensures the main thread's state is stable across reads, inserts, and resume paths.\n\n## Key Rules\n- Normalize missing main-thread IDs at the boundary where the key is derived, not later at individual map operations.\n- Use one stable sentinel for the main thread so every lookup and write resolves to the same slot.\n- Keep forked agents on their real IDs; the sentinel is only for the thread that lacks an explicit identifier.\n- Build the rest of the state logic on the normalized key so the map layer does not need separate main-thread code paths.\n\n## Example Application\nIf an attachment pipeline tracks which announcements each agent has already seen, derive `agentKey` from `agentId ?? ''` before looking up the sent-state map. The main thread then uses the empty-string slot consistently, while spawned agents continue using their concrete IDs.\n\n## Anti-Patterns (What NOT to do)\n- Do not let `undefined` flow directly into some map operations and a fallback value into others; that splits one logical thread across multiple keys.\n- Do not create separate ad hoc main-thread branches for every state lookup when one normalized sentinel key will unify the behavior.","tags":["main","thread","empty","string","agent","key","normalization","cskill","agents","ychampion","agent-skills","ai-agents"],"capabilities":["skill","source-ychampion","skill-main-thread-empty-string-agent-key-normalization","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/main-thread-empty-string-agent-key-normalization","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,852 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:50.444Z","embedding":null,"createdAt":"2026-04-18T22:20:38.028Z","updatedAt":"2026-04-22T06:56:50.444Z","lastSeenAt":"2026-04-22T06:56:50.444Z","tsv":"'across':151,313 'ad':320 'agent':6,22,39,45,56,65,80,95,123,128,199,250,279 'agent-scop':21 'agentid':257 'agentkey':255 'alreadi':252 'announc':248 'anti':286 'anti-pattern':285 'appli':47 'applic':241 'attach':244 'behavior':72,338 'boundari':167 'branch':131,325 'build':216 'child':84 'child-runtim':83 'code':238 'concret':15,99,283 'consist':276 'continu':280 'convert':89 'coordin':81 'core':87 'creat':318 'deriv':172,254 'direct':297 'distil':75 'domain':42 'empti':4,17,37,273 'empty-str':16,36,272 'ensur':143 'everi':133,188,327 'exampl':240 'explicit':64,214 'fallback':304 'flow':296 'fork':29,127,198 'hoc':321 'id':66,164,203,284 'ident':57 'identifi':96,215 'individu':176 'insert':153 'interact':103 'keep':138,197 'key':7,19,40,54,101,157,170,226,315,334 'lack':212 'later':174 'layer':230 'let':113,294 'logic':222,311 'look':259 'lookup':134,189,329 'main':2,11,27,34,60,91,115,145,162,185,236,267,323 'main-thread':33,161,235,322 'main-thread-empty-string-agent-key-norm':1 'map':25,71,106,139,177,229,265,300 'method':88 'miss':94,160 'multi':44,79 'multi-ag':43,78 'multipl':314 'need':69,233 'normal':8,9,41,109,159,225,332 'one':108,180,310,331 'oper':178,301 'other':307 'particip':117 'path':156,239 'pattern':74,86,287 'per':122 'per-ag':121 'pipelin':245 'read':152 'real':202 'resolv':192 'rest':218 'resum':155 'review':77 'rule':158 'runtim':85 'scope':23,51 'seen':253 'semant':140 'sent':263 'sent-stat':262 'sentinel':100,182,205,333 'separ':234,319 'share':105 'skill':32 'skill-main-thread-empty-string-agent-key-normalization' 'slot':196,275 'sourc':73 'source-ychampion' 'spawn':278 'special':130 'split':309 'stabl':70,150,181 'state':24,52,124,148,221,264,328 'still':68 'string':5,18,38,274 'structur':125 'thread':3,12,30,35,50,61,92,116,146,163,186,210,237,268,312,324 'thread-scop':49 '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' 'track':246 'treat':26 'trigger':46 'undefin':295 'unifi':336 'uniform':31,141 'use':107,179,270,281 'valu':110,305 'without':129 'write':136,191","prices":[{"id":"fa841479-41ee-407b-9a18-f710a75310f4","listingId":"d2c90460-8db0-4de4-94b8-48eafe51aa75","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:20:38.028Z"}],"sources":[{"listingId":"d2c90460-8db0-4de4-94b8-48eafe51aa75","source":"github","sourceId":"ychampion/cskill-agents/main-thread-empty-string-agent-key-normalization","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/main-thread-empty-string-agent-key-normalization","isPrimary":false,"firstSeenAt":"2026-04-18T22:20:38.028Z","lastSeenAt":"2026-04-22T06:56:50.444Z"}],"details":{"listingId":"d2c90460-8db0-4de4-94b8-48eafe51aa75","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"main-thread-empty-string-agent-key-normalization","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":"c426943011ba11e3252ae0374ef22786f65b1304","skill_md_path":"skills/main-thread-empty-string-agent-key-normalization/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/main-thread-empty-string-agent-key-normalization"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"main-thread-empty-string-agent-key-normalization","description":"Normalize the main thread to a concrete empty-string key so agent-scoped state maps treat main and forked threads uniformly."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/main-thread-empty-string-agent-key-normalization"},"updatedAt":"2026-04-22T06:56:50.444Z"}}