agentleFS
MicrosoftKnown publishermicrosoft/PilotSwarm/.github/skills/add-event/SKILL.md

add-event

Skill14 starsChanged 8 months agoMITView on GitHub

Add a new event type that flows from the LLM session through to client subscribers. Covers firing the event from ManagedSession, persisting to CMS, and filtering in PilotSwarmSession.on().

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use dot-separated names: category.action (e.g., assistant.message, tool.execution_start).

    line 35

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Add a New Event Type

Events flow from the Copilot SDK through ManagedSession, get persisted to CMS, and are delivered to client subscribers.

Steps

  1. Fire the event from ManagedSession in src/managed-session.ts:
    • Events are captured via the onEvent callback passed to runTurn().
    • Inside the copilotSession.on() handler, events are captured as CapturedEvent objects:
      const captured: CapturedEvent = {
          eventType: "my.event_type",
          data: eventData,
      };
      collectedEvents.push(captured);
      opts?.onEvent?.(captured);
  2. Persist to CMS — events are automatically persisted by the activity in src/session-proxy.ts via the onEvent callback, which calls catalog.recordEvents(). No changes needed unless you want special handling.
  3. Filter in PilotSwarmSession.on() — if the event needs special client-side filtering (e.g., excluding ephemeral events from persistence), add logic in src/client.ts:
    session.on("my.event_type", (event) => { ... });
  4. Add a test — verify the event appears in session.getMessages() and/or via session.on() polling.

Event naming conventions

  • Use dot-separated names: category.action (e.g., assistant.message, tool.execution_start).
  • Ephemeral events (like assistant.message_delta) should NOT be persisted to CMS — they are filtered out in session-proxy.ts.

Event flow

CopilotSession.on(event)           ← Copilot SDK fires event
  ↓
ManagedSession captures as CapturedEvent
  ↓
onEvent callback → session-proxy.ts → catalog.recordEvents()   ← persisted to CMS
  ↓
PilotSwarmSession.on() polls CMS → delivers to client subscribers

Key files

  • src/managed-session.ts — event capture during runTurn()
  • src/session-proxy.ts — event persistence to CMS
  • src/cms.ts — recordEvents() and getSessionEvents()
  • src/client.ts — PilotSwarmSession.on() polling and dispatch

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.