Main thread empty string agent key normalization

From ychampion/cskill-agents · View interactive version

Main thread empty string agent key normalization is an AI agent skill from the GitHub repository ychampion/cskill-agents. Normalize the main thread to a concrete empty-string key so agent-scoped state maps treat main and forked threads uniformly.

How to use this skill

Skill file

SKILL: Main-Thread Empty-String Agent Key Normalization

Domain: multi-agent

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.

Source Pattern: Distilled from reviewed multi-agent coordination and child-runtime patterns.

Core Method

Convert 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.

Key Rules

Example Application

If 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.

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.