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

add-activity

Skill4 starsChanged 9 months agoMITView on GitHub

Add a new duroxide activity to the runtime. Activities are the durable boundary between the orchestration and session management — they dispatch to ManagedSession or SessionManager methods.

The file

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 ctx.scheduleActivityOnSession() (not ctx.scheduleActivity()) to maintain session affinity.

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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 Activity

Activities are the durable boundary between the orchestration generator and the session layer. They must only accept and return serializable data.

Steps

  1. Define the activity function in src/session-proxy.ts inside registerActivities():
    runtime.registerActivity("myActivity", async (ctx: any, input: any) => {
        const { sessionId, ...args } = input;
        const session = await sessionManager.getOrCreate(sessionId, args.config);
        const result = await session.myMethod(args);
        return result;
    });
  2. Create a proxy function in createSessionProxy() (session-scoped) or createSessionManagerProxy() (manager-scoped):
    myActivity: (args: any) => {
        return ctx.scheduleActivityOnSession(
            "myActivity",
            { sessionId, ...args },
            affinityKey,
        );
    }
  3. Call it from the orchestration in src/orchestration.ts:
    const result = yield session.myActivity(args);
  4. Add tests in test/sdk.test.js.

Key constraints

  • Activities must only accept and return serializable data (no functions, no class instances).
  • Activity functions should be thin — delegate business logic to ManagedSession or SessionManager.
  • Use ctx.scheduleActivityOnSession() (not ctx.scheduleActivity()) to maintain session affinity.
  • The affinityKey ensures the activity runs on the same worker that holds the in-memory session.

Key files

  • src/session-proxy.ts — activity definitions and proxy factories
  • src/orchestration.ts — orchestration generator function
  • src/types.ts — type definitions for activity inputs/outputs

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.