pilotswarm-sdk-builder
Skill14 starsChanged 8 months agoMITView on GitHub
Use when creating or updating an SDK-first app on top of PilotSwarm. Covers the client/worker split, plugin layering, tool registration, tests, and the DevOps sample structure.
- Reads credentials
We split this skill into the rules it gives an agent
44 rules. About 0 are common, 25 are distinctive, and 19 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈25
Distinctive · estimate
This author's own choices. Worth a look.
19
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 40
Run a guided intake before scaffolding.
- Very specific: line 42
Treat plugin/agents/default.agent.md as the app-wide default overlay, not as a replacement for PilotSwarm's embedded framework base.
- Very specific: line 43
Every generated .agent.md must include schemaVersion: 1 and a version string.
- Distinctive: line 47
Keep client session config serializable.
- Distinctive: line 51
Add a checked-in cleanup script that drops database schemas and removes session state (handles both local and remote modes).
- Distinctive: line 52
Add a local example or test that exercises the intended app flow.
- Very specific: line 54
When agents need recurring autonomous work, use durable timers: cron(seconds=N, reason="...") for fixed intervals, cron_at(minute=M, …
- Very specific: line 59
When the app needs stock PostgreSQL runtime storage plus HorizonDB enhanced facts/search/graph, follow the pilotswarm-hybrid-datastore …
- Distinctive: line 63
Before generating files, ask:
- Distinctive: line 65
Should the app allow generic sessions under the default agent, or should usage be steered into named agents through a restrictive session …
- Distinctive: line 69
If the user has not specified the agent roster, what workflows should the app support so you can derive the first agent set?
- Distinctive: line 75
Do not guess these answers when the user has not provided them.
- Very specific: line 92
Treat DATABASE_URL as the canonical PostgreSQL connection input.
- Very specific: line 93
Treat DATABASE_URL as the canonical runtime PostgreSQL connection input.
- Very specific: line 96
If the app needs a custom model catalog, check in a type-only .model_providers.example.json and create the real .model_providers.json …
- Very specific: line 102
Do not copy a sample toolCatalog opt-in without validating the target Chat Completions endpoint.
- Very specific: line 106
Do not generate redundant PGHOST, PGPORT, PGUSER, PGPASSWORD, or PGDATABASE entries unless the user explicitly needs them.
- Very specific: line 107
Prefer a checked-in .env.example plus a local gitignored .env.
- Very specific: line 108
Prefer a checked-in type-only .model_providers.example.json plus a local gitignored .model_providers.json containing endpoint/type metadata …
- Very specific: line 110
Add both .env and .model_providers.json to .gitignore in runnable scaffolds.
- Very specific: line 113
Do not scaffold LLM_PROVIDER_TYPE, LLM_ENDPOINT, LLM_API_KEY, or LLM_API_VERSION.
- Distinctive: line 115
Only copy secrets from another repo or local file after the user explicitly asks for that behavior.
- Distinctive: line 119
When the user wants runnable scaffolding, do more than write files: install dependencies and run a smoke test.
- Very specific: line 120
Do not treat --help output or a dry import as proof that the full app path actually starts.
- Distinctive: line 121
Check the declared runtime requirements and compare them against the current machine.
- Distinctive: line 122
If the scaffold defaults or inferred decisions matter, record them in the generated README.
- Very specific: line 132
Use .env for local mode and .env.remote for remote mode.
- Very specific: line 135
Keep compatibility workarounds in the launcher or postinstall scripts, not scattered across README steps.
- Distinctive: line 139
If the generated app hits a known dependency issue during setup, isolate the workaround in setup scripts or a clearly documented bootstrap …
- Very specific: line 140
Prefer deterministic fixes that can be re-applied after reinstall, such as postinstall or setup-time verification, over one-off manual …
- Distinctive: line 141
Remove or simplify compatibility shims once the upstream dependency is fixed.
- Distinctive: line 145
If the user names agents, scaffold those agents directly.
- Distinctive: line 146
If the user only describes workflows, derive a starter agent set from those workflows and explain the mapping.
- Distinctive: line 147
Keep the first scaffold minimal but coherent.
- Distinctive: line 151
Do not assume the client can execute tools.
- Distinctive: line 152
Do not collapse prompts, worker logic, and app wiring into one file unless the user explicitly wants a tiny demo.
- Distinctive: line 153
Prefer plugin files for prompts and skills even in SDK-first apps.
- Distinctive: line 154
Keep session policy and agent restrictions in config files rather than hand-wavy prompt text.
- Very specific: line 155
Never use "default" as an agent name for session-bound agents — PilotSwarm reserves it as a prompt overlay and rejects session creation for …
- Distinctive: line 156
Use the DevOps sample as the reference for the layered split, not as a literal one-size-fits-all template.
- Distinctive: line 163
Never substitute a name-only registry install.
- Distinctive: line 164
If the scaffold documents artifact handoffs, explain both text and binary cases so app builders do not assume artifacts are UTF-8 only.
- Very specific: line 180
Follow the pattern in PilotSwarm's DevOps sample scripts/cleanup-local-db.js.
- Distinctive: line 181
Document what the cleanup script removes in the generated README.
≈ “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.
Files
PilotSwarm SDK Builder
Build layered SDK-first applications on top of PilotSwarm.
Canonical References
- Source quickstart:
https://github.com/microsoft/PilotSwarm/blob/main/docs/quickstart/local.md - SDK guide:
https://github.com/microsoft/PilotSwarm/blob/main/docs/developer/building/sdk-apps.md - SDK agent guide:
https://github.com/microsoft/PilotSwarm/blob/main/docs/developer/building/sdk-agents.md - Plugin architecture:
https://github.com/microsoft/PilotSwarm/blob/main/docs/developer/building/plugins.md - DevOps sample:
https://github.com/microsoft/PilotSwarm/tree/main/examples/devops-command-center
Preferred Structure
my-sdk-app/
├── plugin/
│ ├── agents/ # optional named workflows
│ ├── skills/
│ ├── .mcp.json
│ └── session-policy.json
├── scripts/
│ ├── run.sh
│ └── cleanup-local-db.js
├── src/
│ ├── tools.ts
│ ├── worker.ts
│ ├── client.ts
│ └── app.ts
└── test/Workflow
- Run a guided intake before scaffolding.
- Separate plugin content from runtime code. Put reusable methods in skills, executable actions in worker tools or MCP servers, and add an agent only for a complex authored workflow or durable named entry point. A package with no agents is valid and discoverable by Base Agent V2 sessions.
- Treat
plugin/agents/default.agent.mdas the app-wide default overlay, not as a replacement for PilotSwarm's embedded framework base. It is not a selectable session agent — PilotSwarm excludes it at all three layers (worker, client, TUI). Do not name any other agent filedefault. - Every generated
.agent.mdmust includeschemaVersion: 1and aversionstring. Useversion: 1.0.0for new agents by default. When editing an existing agent, bump itsversionaccording to the app's versioning style; prefer SemVer when the app uses it. - Define tools with
defineTool()in worker-side code. - Register tool handlers on the worker.
- Reference those handlers from sessions via
toolNames. - Keep client session config serializable.
- Add
session-policy.jsonif the user does not want generic sessions. The policy is enforced in both local and remote modes. If the app should expose SDK-bundled optional agents, add them undercreation.bundledAgents, for example"bundledAgents": ["generic-crawler"]; app-authored agents and inline custom agents still load independently of that allowlist. - Build
.env.exampleand a gitignored.envby copying/adapting the PilotSwarm repo's example env shape when the user wants runnable scaffolding. - Build
.model_providers.example.jsonand a gitignored.model_providers.jsonby copying/adapting the PilotSwarm repo's example model-catalog shape when the scaffold needs a custom model catalog. - Add a checked-in cleanup script that drops database schemas and removes session state (handles both local and remote modes).
- Add a local example or test that exercises the intended app flow.
- When agents need durable structured memory or cross-agent shared state, use PilotSwarm's built-in facts tools (
store_fact,read_facts,delete_fact). They are available to every agent session by default, including system agents, and should be treated as the primary memory mechanism instead of inventing a one-off app-specific table. - When agents need recurring autonomous work, use durable timers:
cron(seconds=N, reason="...")for fixed intervals,cron_at(minute=M, hour=H, tz="Area/City", reason="...")for wall-clock schedules, andcron(action="cancel")/cron_at(action="cancel")to stop. Do not build wall-clock jobs by waking every N minutes to check the clock. - When generated agents delegate work, teach them to set
contract.wakeOn:anyfor chatty work,material_changefor finite task results and watcher changes, andcompletiononly for actual terminal lifecycle outcomes. A finite child's ordinary final reply leaves it alive and idle, so generated parents validate the result and close it explicitly withcomplete_agent. Parent coordination is reactive: qualifying updates wake the parent automatically, so never generate a parentwait/cronloop whose only action ischeck_agents. - Agents can read their context usage (current tokens, token limit) from the session status
contextUsagefield. Use this for agents that need to manage context window budgets or trigger compaction. - When the scaffold needs downloadable files, use
write_artifactand include the returnedartifact://link in responses. Files that already exist on the worker upload viafromFile(streamed, sha256 in the result); consumers fetch binaries withread_artifact({toFile})or adopt them withfromArtifact. Reserve inlinecontent+encoding: "base64"for small model-authored binaries, and document that browser hosts download non-text artifacts instead of previewing them inline. - When the app needs to ingest external sources into durable, searchable knowledge or an open knowledge graph, follow the
pilotswarm-knowledge-harvesterskill: enable the optional EnhancedFactStore / GraphStore providers viahorizonConfigFromEnv(), author acrawler: trueagent for the crawl→graph→mark loop, and keep reader agents free of crawler frontmatter. - When the app needs stock PostgreSQL runtime storage plus HorizonDB enhanced facts/search/graph, follow the
pilotswarm-hybrid-datastoreskill: keepDATABASE_URLas the runtime store, addHORIZON_DATABASE_URL/HORIZON_GRAPH_DATABASE_URLfor optional providers, and wirehorizonConfigFromEnv()into worker, client, and management client.
Guided Intake Questions
Before generating files, ask:
- Should the app allow generic sessions under the default agent, or should usage be steered into named agents through a restrictive session policy?
- Which worker connection values should be plugged into
.envnow?DATABASE_URLis required;GITHUB_TOKENis optional bootstrap compatibility because provider credentials are runtime CMS state. - If the user has not specified the agent roster, what workflows should the app support so you can derive the first agent set?
- Which topology should the scaffold target?
- local-only, using Docker Postgres
- standard remote topology using AKS + PostgreSQL + Blob storage
- custom topology supplied by the user
Do not guess these answers when the user has not provided them. Offer the standard topology choices explicitly so the guided experience stays fast.
Web API Topology Guidance
- Deployments expose one integration surface: the portal's Web API
(
/api/v1+/api/v1/ws). Generated app/client code targeting a shared deployment must usenew PilotSwarmClient({ apiUrl })/new PilotSwarmManagementClient({ apiUrl })— never a database URL. - Workers always connect direct (
{ store: DATABASE_URL }); keep that secret on the worker side of the scaffold. - Direct
{ store }client construction is reserved for single-process demos, tests, and cleanup scripts. - Facts/graph access for clients goes through the Web API data-plane
(
createWebFactStore/createWebGraphStore).
Env File Guidance
- Treat
DATABASE_URLas the canonical PostgreSQL connection input. - Treat
DATABASE_URLas the canonical runtime PostgreSQL connection input. Do not repurpose it as the HorizonDB facts/graph connection in hybrid apps. - For hybrid apps, document optional
HORIZON_DATABASE_URL,HORIZON_FACTS_SCHEMA,HORIZON_GRAPH_DATABASE_URL,HORIZON_GRAPH_SCHEMA, andHORIZON_EMBED_*vars in a separate HorizonDB block or.env.horizondb.example. - The starter/local Docker path should continue to run with stock PostgreSQL by default; HorizonDB is an opt-in provider configuration, not a Docker image requirement.
- If the app needs a custom model catalog, check in a type-only
.model_providers.example.jsonand create the real.model_providers.jsonlocally from it. Do not put credentials ordefaultModelin new catalogs. Provision shared/personal runtime providers through the management API or Admin Console, then callsetModelDefaultandsetSystemModelDefaultas needed. Env-backed catalog credentials are legacy bootstrap compatibility. - Do not copy a sample
toolCatalogopt-in without validating the target Chat Completions endpoint. Omit it by default; router names do not enable overflow dispatch. Put an approved policy on the model entry in its provider-type catalog, not in a prompt or environment flag. - Do not generate redundant
PGHOST,PGPORT,PGUSER,PGPASSWORD, orPGDATABASEentries unless the user explicitly needs them. - Prefer a checked-in
.env.exampleplus a local gitignored.env. - Prefer a checked-in type-only
.model_providers.example.jsonplus a local gitignored.model_providers.jsoncontaining endpoint/type metadata only. - Add both
.envand.model_providers.jsonto.gitignorein runnable scaffolds. - Align the variable set with the chosen topology:
DATABASE_URL, optional bootstrapGITHUB_TOKEN, optional Horizon/storage/deployment variables. Do not scaffoldLLM_PROVIDER_TYPE,LLM_ENDPOINT,LLM_API_KEY, orLLM_API_VERSION; runtime provider instances own those concerns. - Only copy secrets from another repo or local file after the user explicitly asks for that behavior.
Validation Guidance
- When the user wants runnable scaffolding, do more than write files: install dependencies and run a smoke test.
- Do not treat
--helpoutput or a dry import as proof that the full app path actually starts. - Check the declared runtime requirements and compare them against the current machine.
- If the scaffold defaults or inferred decisions matter, record them in the generated README.
Launcher Script Guidance
- Generate a single
scripts/run.shthat supports both local and remote modes:./scripts/run.shor./scripts/run.sh local— local mode./scripts/run.sh remote— remote mode connecting to AKS workers
- Wire
package.jsonscripts to point atrun.sh:"start": "./scripts/run.sh"for local"start:remote": "./scripts/run.sh remote"for remote
- Use
.envfor local mode and.env.remotefor remote mode. The script selects the right file based on the mode argument. - Include preflight checks (env file exists, plugin dir exists).
- Make the script executable and verify the executable bit after creation.
- Keep compatibility workarounds in the launcher or
postinstallscripts, not scattered across README steps.
Compatibility Guidance
- If the generated app hits a known dependency issue during setup, isolate the workaround in setup scripts or a clearly documented bootstrap path and explain why it exists.
- Prefer deterministic fixes that can be re-applied after reinstall, such as
postinstallor setup-time verification, over one-off manual instructions. - Remove or simplify compatibility shims once the upstream dependency is fixed.
Agent Derivation Guidance
- If the user names agents, scaffold those agents directly.
- If the user only describes workflows, derive a starter agent set from those workflows and explain the mapping.
- Keep the first scaffold minimal but coherent; do not invent a large agent roster without justification.
Guardrails
- Do not assume the client can execute tools.
- Do not collapse prompts, worker logic, and app wiring into one file unless the user explicitly wants a tiny demo.
- Prefer plugin files for prompts and skills even in SDK-first apps.
- Keep session policy and agent restrictions in config files rather than hand-wavy prompt text. The policy is enforced in both local and remote modes.
- Never use
"default"as an agent name for session-bound agents — PilotSwarm reserves it as a prompt overlay and rejects session creation for it at the client layer. - Use the DevOps sample as the reference for the layered split, not as a literal one-size-fits-all template.
- Assume apps consume
pilotswarm-sdk, whose built-in framework and management plugins are embedded rather than copied into the app repo. - Assume PostgreSQL-backed apps can opt into the built-in facts tools with agent
toolslists instead of re-implementing fact storage from scratch. - Install
pilotswarm-sdkfrom a verified public GitHub Release tarball; add matching optional providers when needed. Followhttps://github.com/microsoft/PilotSwarm/blob/main/docs/quickstart/packages.md. Pin file specs and lock integrity; restore ignored tarballs beforenpm ci. Never substitute a name-only registry install. - If the scaffold documents artifact handoffs, explain both text and binary cases so app builders do not assume artifacts are UTF-8 only.
Database Cleanup Guidance
- Generate a single cleanup script (
scripts/cleanup-local-db.js) that handles both local and remote modes:node scripts/cleanup-local-db.js— uses.env(local)node scripts/cleanup-local-db.js remote— uses.env.remote
- Parse
sslmodefrom theDATABASE_URLand passssl: { rejectUnauthorized: false }to thepgclient when connecting to Azure PostgreSQL. Follow the pattern in the DevOps sample's cleanup script. - Query session IDs from CMS (
copilot_sessions.sessions) before dropping schemas. - In local mode, also remove local files for each session:
- Artifact directories at
~/.copilot/artifacts/<sessionId>/ - Session state dirs at
~/.copilot/session-state/<sessionId>/ - Session store archives at
~/.copilot/session-store/<sessionId>.tar.gzand.meta.json
- Artifact directories at
- In remote mode, skip local file cleanup (artifacts live in blob storage).
- Drop
duroxideandcopilot_sessionsschemas. - In remote mode, print the
kubectl rollout restartcommand to recreate schemas. - Follow the pattern in PilotSwarm's DevOps sample
scripts/cleanup-local-db.js. - Document what the cleanup script removes in the generated README.
In this repository50 other files it gives its agents.
- packages/sdk/examples/repo-workspaces/seed/home/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-repair-loopSkill
- duroxide-orchestration-versioningSkill
- editorial-standardsSkill
- finance-research-standardsSkill
- valuation-methodsSkill
- pilotswarm-architectureSkill
- deployment-safetySkill
- incident-responseSkill
- add-activitySkill
- add-eventSkill
- add-testSkill
- add-toolSkill
- agent-versioningSkill
- azure-ps-test-runner-vmSkill
- debug-orchestrationSkill
- debug-testSkill
- horizondb-idiosyncrasiesSkill
- horizon-facts-eval-sweepSkill
- investigate-duroxide-runtimeSkill
- pilotswarm-aks-deploySkill
- pilotswarm-aks-resetSkill
- pilotswarm-new-env-deploySkill
- pilotswarm-perfSkill
- pilotswarm-portal-app-regSkill
- pilotswarm-portal-auth-assignmentsSkill
- pilotswarm-releaseSkill
- pilotswarm-tuiSkill
- pilotswarm-vpn-client-profileSkill
- schema-migrationSkill
- notesSkill
- share-a-fileSkill
- cost-latency-analysisSkill
- graph-debugSkill
- orchestration-session-lifecycleSkill
- resourcemgrSkill
- sweeperSkill
- canvas-appsSkill
- html-visualsSkill
- pilotswarm-agent-versioningSkill
- pilotswarm-aks-identitySkill
- pilotswarm-azure-deployerSkill
- pilotswarm-azure-lessonsSkill
- pilotswarm-cli-builderSkill
- pilotswarm-duroxide-versioningSkill
- pilotswarm-hybrid-datastoreSkill
- pilotswarm-knowledge-harvesterSkill
- pilotswarm-portal-builderSkill
- pilotswarm-three-tierSkill
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.

