@desplega.ai/agent-swarm 1.20.0 → 1.51.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +271 -169
- package/openapi.json +5015 -0
- package/package.json +40 -7
- package/plugin/commands/close-issue.md +7 -3
- package/plugin/commands/create-pr.md +18 -12
- package/plugin/commands/implement-issue.md +7 -3
- package/plugin/commands/respond-github.md +8 -4
- package/plugin/commands/review-pr.md +44 -10
- package/plugin/commands/start-leader.md +1 -3
- package/plugin/commands/start-worker.md +1 -3
- package/plugin/commands/work-on-task.md +22 -3
- package/plugin/pi-skills/close-issue/SKILL.md +90 -0
- package/plugin/pi-skills/create-pr/SKILL.md +99 -0
- package/plugin/pi-skills/implement-issue/SKILL.md +135 -0
- package/plugin/pi-skills/investigate-sentry-issue/SKILL.md +138 -0
- package/plugin/pi-skills/respond-github/SKILL.md +98 -0
- package/plugin/pi-skills/review-offered-task/SKILL.md +45 -0
- package/plugin/pi-skills/review-pr/SKILL.md +261 -0
- package/plugin/pi-skills/start-leader/SKILL.md +121 -0
- package/plugin/pi-skills/start-worker/SKILL.md +60 -0
- package/plugin/pi-skills/swarm-chat/SKILL.md +82 -0
- package/plugin/pi-skills/todos/SKILL.md +66 -0
- package/plugin/pi-skills/work-on-task/SKILL.md +65 -0
- package/plugin/skills/artifacts/examples/approval-flow.ts +34 -0
- package/plugin/skills/artifacts/examples/hono-dashboard.ts +31 -0
- package/plugin/skills/artifacts/examples/multi-artifact.ts +20 -0
- package/plugin/skills/artifacts/examples/static-report.sh +17 -0
- package/plugin/skills/artifacts/skill.md +71 -0
- package/src/agentmail/app.ts +65 -0
- package/src/agentmail/handlers.ts +262 -0
- package/src/agentmail/index.ts +9 -0
- package/src/agentmail/templates.ts +111 -0
- package/src/agentmail/types.ts +51 -0
- package/src/artifact-sdk/browser-sdk.ts +30 -0
- package/src/artifact-sdk/index.ts +2 -0
- package/src/artifact-sdk/localtunnel.d.ts +20 -0
- package/src/artifact-sdk/port.ts +12 -0
- package/src/artifact-sdk/server.ts +156 -0
- package/src/artifact-sdk/tunnel.ts +19 -0
- package/src/be/chunking.ts +193 -0
- package/src/be/db-queries/oauth.ts +90 -0
- package/src/be/db-queries/tracker.ts +182 -0
- package/src/be/db.ts +3327 -784
- package/src/be/embedding.ts +80 -0
- package/src/be/migrations/001_initial.sql +409 -0
- package/src/be/migrations/002_one_time_schedules.sql +59 -0
- package/src/be/migrations/003_workflows.sql +51 -0
- package/src/be/migrations/004_workflow_source.sql +81 -0
- package/src/be/migrations/005_epic_next_steps.sql +2 -0
- package/src/be/migrations/006_vcs_provider.sql +94 -0
- package/src/be/migrations/007_task_dir.sql +2 -0
- package/src/be/migrations/008_workflow_redesign.sql +85 -0
- package/src/be/migrations/009_tracker_integration.sql +144 -0
- package/src/be/migrations/010_step_diagnostics.sql +1 -0
- package/src/be/migrations/011_step_next_port.sql +1 -0
- package/src/be/migrations/012_trigger_schema.sql +1 -0
- package/src/be/migrations/013_task_output_schema.sql +2 -0
- package/src/be/migrations/014_prompt_templates.sql +33 -0
- package/src/be/migrations/015_workflow_workspace.sql +3 -0
- package/src/be/migrations/016_active_session_runner_session.sql +4 -0
- package/src/be/migrations/017_channel_activity_cursors.sql +6 -0
- package/src/be/migrations/018_fix_seed_double_version.sql +30 -0
- package/src/be/migrations/runner.ts +188 -0
- package/src/be/seed.ts +62 -0
- package/src/cli.tsx +231 -299
- package/src/commands/artifact.ts +241 -0
- package/src/commands/onboard/compose-generator.ts +169 -0
- package/src/commands/onboard/env-generator.ts +79 -0
- package/src/commands/onboard/manifest.ts +37 -0
- package/src/commands/onboard/presets.ts +85 -0
- package/src/commands/onboard/service-names.ts +47 -0
- package/src/commands/onboard/steps/core-credentials.tsx +111 -0
- package/src/commands/onboard/steps/custom-templates.tsx +168 -0
- package/src/commands/onboard/steps/generate.tsx +154 -0
- package/src/commands/onboard/steps/harness-credentials.tsx +195 -0
- package/src/commands/onboard/steps/harness.tsx +21 -0
- package/src/commands/onboard/steps/health-check.tsx +171 -0
- package/src/commands/onboard/steps/integration-github.tsx +105 -0
- package/src/commands/onboard/steps/integration-gitlab.tsx +79 -0
- package/src/commands/onboard/steps/integration-menu.tsx +58 -0
- package/src/commands/onboard/steps/integration-sentry.tsx +79 -0
- package/src/commands/onboard/steps/integration-slack.tsx +165 -0
- package/src/commands/onboard/steps/post-connect.tsx +145 -0
- package/src/commands/onboard/steps/post-dashboard.tsx +34 -0
- package/src/commands/onboard/steps/post-task.tsx +103 -0
- package/src/commands/onboard/steps/prereq-check.tsx +178 -0
- package/src/commands/onboard/steps/review.tsx +82 -0
- package/src/commands/onboard/steps/start.tsx +97 -0
- package/src/commands/onboard/templates.ts +34 -0
- package/src/commands/onboard/types.ts +259 -0
- package/src/commands/onboard.tsx +425 -0
- package/src/commands/runner.ts +1540 -630
- package/src/commands/setup.tsx +23 -38
- package/src/commands/shared/client-config.ts +41 -0
- package/src/commands/templates.ts +172 -0
- package/src/github/app.ts +8 -0
- package/src/github/handlers.ts +384 -151
- package/src/github/index.ts +1 -0
- package/src/github/mentions-aliases.test.ts +73 -0
- package/src/github/mentions.test.ts +3 -3
- package/src/github/mentions.ts +32 -6
- package/src/github/templates.ts +398 -0
- package/src/github/types.ts +1 -0
- package/src/gitlab/auth.ts +63 -0
- package/src/gitlab/handlers.ts +368 -0
- package/src/gitlab/index.ts +19 -0
- package/src/gitlab/reactions.ts +104 -0
- package/src/gitlab/templates.ts +140 -0
- package/src/gitlab/types.ts +130 -0
- package/src/heartbeat/heartbeat.ts +434 -0
- package/src/heartbeat/index.ts +1 -0
- package/src/heartbeat/templates.ts +30 -0
- package/src/hooks/hook.ts +555 -4
- package/src/hooks/tool-loop-detection.test.ts +158 -0
- package/src/hooks/tool-loop-detection.ts +167 -0
- package/src/http/active-sessions.ts +199 -0
- package/src/http/agents.ts +328 -0
- package/src/http/config.ts +191 -0
- package/src/http/core.ts +309 -0
- package/src/http/db-query.ts +91 -0
- package/src/http/ecosystem.ts +63 -0
- package/src/http/epics.ts +460 -0
- package/src/http/index.ts +216 -0
- package/src/http/mcp.ts +77 -0
- package/src/http/memory.ts +168 -0
- package/src/http/openapi.ts +109 -0
- package/src/http/poll.ts +299 -0
- package/src/http/prompt-templates.ts +412 -0
- package/src/http/repos.ts +195 -0
- package/src/http/route-def.ts +123 -0
- package/src/http/schedules.ts +426 -0
- package/src/http/session-data.ts +241 -0
- package/src/http/stats.ts +174 -0
- package/src/http/tasks.ts +468 -0
- package/src/http/trackers/index.ts +10 -0
- package/src/http/trackers/linear.ts +187 -0
- package/src/http/types.ts +12 -0
- package/src/http/utils.ts +87 -0
- package/src/http/webhooks.ts +432 -0
- package/src/http/workflows.ts +530 -0
- package/src/http.ts +1 -1890
- package/src/linear/README.md +65 -0
- package/src/linear/app.ts +48 -0
- package/src/linear/client.ts +18 -0
- package/src/linear/index.ts +1 -0
- package/src/linear/oauth.ts +35 -0
- package/src/linear/outbound.ts +212 -0
- package/src/linear/sync.ts +567 -0
- package/src/linear/templates.ts +47 -0
- package/src/linear/types.ts +7 -0
- package/src/linear/webhook.ts +104 -0
- package/src/oauth/README.md +66 -0
- package/src/oauth/index.ts +6 -0
- package/src/oauth/wrapper.ts +204 -0
- package/src/prompts/base-prompt.ts +150 -265
- package/src/prompts/defaults.ts +196 -0
- package/src/prompts/registry.ts +57 -0
- package/src/prompts/resolver.ts +296 -0
- package/src/prompts/session-templates.ts +604 -0
- package/src/providers/claude-adapter.ts +442 -0
- package/src/providers/index.ts +24 -0
- package/src/providers/pi-mono-adapter.ts +442 -0
- package/src/providers/pi-mono-extension.ts +624 -0
- package/src/providers/pi-mono-mcp-client.ts +124 -0
- package/src/providers/types.ts +75 -0
- package/src/scheduler/scheduler.test.ts +2 -0
- package/src/scheduler/scheduler.ts +231 -40
- package/src/server.ts +97 -6
- package/src/slack/HEURISTICS.md +105 -0
- package/src/slack/actions.ts +133 -0
- package/src/slack/app.ts +7 -0
- package/src/slack/assistant.ts +118 -0
- package/src/slack/blocks.ts +233 -0
- package/src/slack/channel-activity.ts +177 -0
- package/src/slack/commands.ts +31 -17
- package/src/slack/files.ts +1 -1
- package/src/slack/handlers.test.ts +114 -1
- package/src/slack/handlers.ts +230 -55
- package/src/slack/responses.ts +120 -67
- package/src/slack/router.ts +17 -99
- package/src/slack/templates.ts +55 -0
- package/src/slack/thread-buffer.ts +213 -0
- package/src/slack/watcher.ts +119 -4
- package/src/tests/agent-activity.test.ts +247 -0
- package/src/tests/agentmail-filters.test.ts +97 -0
- package/src/tests/artifact-sdk.test.ts +800 -0
- package/src/tests/base-prompt.test.ts +264 -0
- package/src/tests/build-pi-skills.test.ts +127 -0
- package/src/tests/channel-activity.test.ts +363 -0
- package/src/tests/claude-adapter.test.ts +126 -0
- package/src/tests/context-versioning.test.ts +425 -0
- package/src/tests/db-queries-oauth.test.ts +197 -0
- package/src/tests/db-queries-tracker.test.ts +230 -0
- package/src/tests/epics.test.ts +3 -3
- package/src/tests/error-tracker.test.ts +368 -0
- package/src/tests/fetch-resolved-env.test.ts +167 -0
- package/src/tests/generate-default-claude-md.test.ts +9 -1
- package/src/tests/generate-identity-templates.test.ts +124 -0
- package/src/tests/gitlab-auth.test.ts +109 -0
- package/src/tests/gitlab-handlers.test.ts +691 -0
- package/src/tests/gitlab-vcs-db.test.ts +177 -0
- package/src/tests/heartbeat.test.ts +364 -0
- package/src/tests/http-api-integration.test.ts +1698 -0
- package/src/tests/linear-outbound-sync.test.ts +200 -0
- package/src/tests/linear-webhook.test.ts +406 -0
- package/src/tests/match-route.test.ts +187 -0
- package/src/tests/memory.test.ts +737 -0
- package/src/tests/migration-runner-regressions.test.ts +86 -0
- package/src/tests/model-control.test.ts +338 -0
- package/src/tests/oauth-wrapper.test.ts +147 -0
- package/src/tests/onboard-compose.test.ts +138 -0
- package/src/tests/onboard-env.test.ts +174 -0
- package/src/tests/onboard-manifest.test.ts +137 -0
- package/src/tests/pi-mono-adapter.test.ts +234 -0
- package/src/tests/pool-session-logs.test.ts +199 -0
- package/src/tests/progress-dedup.test.ts +98 -0
- package/src/tests/prompt-template-github.test.ts +682 -0
- package/src/tests/prompt-template-remaining.test.ts +504 -0
- package/src/tests/prompt-template-resolver.test.ts +621 -0
- package/src/tests/prompt-template-session.test.ts +363 -0
- package/src/tests/prompt-templates-db.test.ts +616 -0
- package/src/tests/provider-adapter.test.ts +122 -0
- package/src/tests/provider-command-format.test.ts +98 -0
- package/src/tests/reload-config.test.ts +170 -0
- package/src/tests/runner-polling-api.test.ts +25 -20
- package/src/tests/scheduled-tasks.test.ts +104 -0
- package/src/tests/scheduler-backoff.test.ts +166 -0
- package/src/tests/self-improvement.test.ts +541 -0
- package/src/tests/session-attach.test.ts +536 -0
- package/src/tests/session-costs.test.ts +267 -1
- package/src/tests/slack-actions.test.ts +133 -0
- package/src/tests/slack-assistant.test.ts +136 -0
- package/src/tests/slack-blocks.test.ts +246 -0
- package/src/tests/slack-metadata-inheritance.test.ts +243 -0
- package/src/tests/slack-queue-offline.test.ts +174 -0
- package/src/tests/slack-router.test.ts +181 -0
- package/src/tests/slack-thread-buffer.test.ts +305 -0
- package/src/tests/slack-thread-followups.test.ts +298 -0
- package/src/tests/slack-watcher.test.ts +101 -0
- package/src/tests/structured-output.test.ts +307 -0
- package/src/tests/swarm-repos.test.ts +198 -0
- package/src/tests/task-cancellation.test.ts +6 -4
- package/src/tests/task-working-dir.test.ts +176 -0
- package/src/tests/template-fetch.test.ts +490 -0
- package/src/tests/tool-annotations.test.ts +371 -0
- package/src/tests/tracker-tools.test.ts +184 -0
- package/src/tests/update-profile-agentid.test.ts +248 -0
- package/src/tests/update-profile-api.test.ts +143 -3
- package/src/tests/update-profile-auth.test.ts +195 -0
- package/src/tests/validation-adapters.test.ts +86 -0
- package/src/tests/vcs-provider.test.ts +27 -0
- package/src/tests/workflow-agent-task.test.ts +196 -0
- package/src/tests/workflow-async-v2.test.ts +508 -0
- package/src/tests/workflow-convergence.test.ts +541 -0
- package/src/tests/workflow-definition-validation.test.ts +366 -0
- package/src/tests/workflow-engine-v2.test.ts +691 -0
- package/src/tests/workflow-executors.test.ts +736 -0
- package/src/tests/workflow-http-v2.test.ts +599 -0
- package/src/tests/workflow-integration-io.test.ts +902 -0
- package/src/tests/workflow-io-schemas.test.ts +624 -0
- package/src/tests/workflow-registry.test.ts +592 -0
- package/src/tests/workflow-retry-v2.test.ts +401 -0
- package/src/tests/workflow-retry-validation.test.ts +282 -0
- package/src/tests/workflow-schedule-trigger.test.ts +104 -0
- package/src/tests/workflow-template.test.ts +288 -0
- package/src/tests/workflow-trigger-schema.test.ts +359 -0
- package/src/tests/workflow-triggers-v2.test.ts +264 -0
- package/src/tests/workflow-versions.test.ts +208 -0
- package/src/tests/workflow-workspace.test.ts +272 -0
- package/src/tests/x402-client.test.ts +117 -0
- package/src/tests/x402-config.test.ts +182 -0
- package/src/tests/x402-spending-tracker.test.ts +185 -0
- package/src/tools/cancel-task.ts +2 -0
- package/src/tools/context-diff.ts +171 -0
- package/src/tools/context-history.ts +138 -0
- package/src/tools/create-channel.ts +1 -0
- package/src/tools/db-query.ts +78 -0
- package/src/tools/delete-channel.ts +132 -0
- package/src/tools/epics/assign-task-to-epic.ts +1 -0
- package/src/tools/epics/create-epic.ts +3 -2
- package/src/tools/epics/delete-epic.ts +2 -0
- package/src/tools/epics/get-epic-details.ts +2 -0
- package/src/tools/epics/list-epics.ts +2 -0
- package/src/tools/epics/unassign-task-from-epic.ts +1 -0
- package/src/tools/epics/update-epic.ts +7 -4
- package/src/tools/get-swarm.ts +2 -0
- package/src/tools/get-task-details.ts +2 -0
- package/src/tools/get-tasks.ts +27 -1
- package/src/tools/inject-learning.ts +106 -0
- package/src/tools/join-swarm.ts +17 -7
- package/src/tools/list-channels.ts +2 -0
- package/src/tools/list-services.ts +2 -0
- package/src/tools/memory-get.ts +56 -0
- package/src/tools/memory-search.ts +131 -0
- package/src/tools/my-agent-info.ts +2 -0
- package/src/tools/poll-task.ts +2 -20
- package/src/tools/post-message.ts +1 -0
- package/src/tools/prompt-templates/delete.ts +86 -0
- package/src/tools/prompt-templates/get.ts +89 -0
- package/src/tools/prompt-templates/index.ts +5 -0
- package/src/tools/prompt-templates/list.ts +95 -0
- package/src/tools/prompt-templates/preview.ts +84 -0
- package/src/tools/prompt-templates/set.ts +117 -0
- package/src/tools/read-messages.ts +2 -0
- package/src/tools/register-agentmail-inbox.ts +166 -0
- package/src/tools/register-service.ts +2 -0
- package/src/tools/schedules/create-schedule.ts +134 -24
- package/src/tools/schedules/delete-schedule.ts +2 -0
- package/src/tools/schedules/list-schedules.ts +20 -4
- package/src/tools/schedules/run-schedule-now.ts +1 -0
- package/src/tools/schedules/update-schedule.ts +49 -17
- package/src/tools/send-task.ts +132 -10
- package/src/tools/slack-download-file.ts +4 -2
- package/src/tools/slack-list-channels.ts +2 -0
- package/src/tools/slack-post.ts +2 -0
- package/src/tools/slack-read.ts +2 -0
- package/src/tools/slack-reply.ts +2 -0
- package/src/tools/slack-upload-file.ts +2 -0
- package/src/tools/store-progress.ts +205 -4
- package/src/tools/swarm-config/delete-config.ts +87 -0
- package/src/tools/swarm-config/get-config.ts +108 -0
- package/src/tools/swarm-config/index.ts +4 -0
- package/src/tools/swarm-config/list-config.ts +99 -0
- package/src/tools/swarm-config/set-config.ts +118 -0
- package/src/tools/task-action.ts +50 -5
- package/src/tools/task-dedup.ts +97 -0
- package/src/tools/templates.ts +53 -0
- package/src/tools/tool-config.ts +124 -0
- package/src/tools/tracker/index.ts +6 -0
- package/src/tools/tracker/tracker-link-epic.ts +64 -0
- package/src/tools/tracker/tracker-link-task.ts +64 -0
- package/src/tools/tracker/tracker-map-agent.ts +57 -0
- package/src/tools/tracker/tracker-status.ts +56 -0
- package/src/tools/tracker/tracker-sync-status.ts +42 -0
- package/src/tools/tracker/tracker-unlink.ts +41 -0
- package/src/tools/unregister-service.ts +2 -0
- package/src/tools/update-profile.ts +172 -17
- package/src/tools/update-service-status.ts +2 -0
- package/src/tools/utils.ts +10 -1
- package/src/tools/workflows/create-workflow.ts +129 -0
- package/src/tools/workflows/delete-workflow.ts +42 -0
- package/src/tools/workflows/get-workflow-run.ts +59 -0
- package/src/tools/workflows/get-workflow.ts +53 -0
- package/src/tools/workflows/index.ts +9 -0
- package/src/tools/workflows/list-workflow-runs.ts +48 -0
- package/src/tools/workflows/list-workflows.ts +42 -0
- package/src/tools/workflows/retry-workflow-run.ts +40 -0
- package/src/tools/workflows/trigger-workflow.ts +96 -0
- package/src/tools/workflows/update-workflow.ts +133 -0
- package/src/tracker/types.ts +51 -0
- package/src/types.ts +530 -14
- package/src/utils/credentials.test.ts +156 -0
- package/src/utils/credentials.ts +50 -0
- package/src/utils/error-tracker.ts +190 -0
- package/src/vcs/index.ts +15 -0
- package/src/vcs/types.ts +5 -0
- package/src/workflows/checkpoint.ts +121 -0
- package/src/workflows/cooldown.ts +28 -0
- package/src/workflows/definition.ts +235 -0
- package/src/workflows/engine.ts +580 -0
- package/src/workflows/event-bus.ts +29 -0
- package/src/workflows/executors/agent-task.ts +103 -0
- package/src/workflows/executors/base.ts +86 -0
- package/src/workflows/executors/code-match.ts +88 -0
- package/src/workflows/executors/index.ts +16 -0
- package/src/workflows/executors/notify.ts +93 -0
- package/src/workflows/executors/property-match.ts +104 -0
- package/src/workflows/executors/raw-llm.ts +83 -0
- package/src/workflows/executors/registry.ts +76 -0
- package/src/workflows/executors/script.ts +103 -0
- package/src/workflows/executors/validate.ts +215 -0
- package/src/workflows/executors/vcs.ts +58 -0
- package/src/workflows/index.ts +61 -0
- package/src/workflows/input.ts +46 -0
- package/src/workflows/json-schema-validator.ts +118 -0
- package/src/workflows/recovery.ts +139 -0
- package/src/workflows/resume.ts +229 -0
- package/src/workflows/retry-poller.ts +216 -0
- package/src/workflows/template.ts +74 -0
- package/src/workflows/templates.ts +86 -0
- package/src/workflows/triggers.ts +124 -0
- package/src/workflows/validation.ts +104 -0
- package/src/workflows/version.ts +44 -0
- package/src/x402/cli.ts +140 -0
- package/src/x402/client.ts +192 -0
- package/src/x402/config.ts +131 -0
- package/src/x402/index.ts +37 -0
- package/src/x402/openfort-signer.ts +83 -0
- package/src/x402/spending-tracker.ts +109 -0
- package/templates/official/coder/CLAUDE.md +49 -0
- package/templates/official/coder/IDENTITY.md +28 -0
- package/templates/official/coder/SOUL.md +43 -0
- package/templates/official/coder/TOOLS.md +40 -0
- package/templates/official/coder/config.json +23 -0
- package/templates/official/coder/start-up.sh +23 -0
- package/templates/official/content-reviewer/CLAUDE.md +68 -0
- package/templates/official/content-reviewer/IDENTITY.md +28 -0
- package/templates/official/content-reviewer/SOUL.md +44 -0
- package/templates/official/content-reviewer/TOOLS.md +37 -0
- package/templates/official/content-reviewer/config.json +23 -0
- package/templates/official/content-reviewer/start-up.sh +23 -0
- package/templates/official/content-strategist/CLAUDE.md +63 -0
- package/templates/official/content-strategist/IDENTITY.md +33 -0
- package/templates/official/content-strategist/SOUL.md +48 -0
- package/templates/official/content-strategist/TOOLS.md +47 -0
- package/templates/official/content-strategist/config.json +23 -0
- package/templates/official/content-strategist/start-up.sh +23 -0
- package/templates/official/content-writer/CLAUDE.md +72 -0
- package/templates/official/content-writer/IDENTITY.md +30 -0
- package/templates/official/content-writer/SOUL.md +46 -0
- package/templates/official/content-writer/TOOLS.md +44 -0
- package/templates/official/content-writer/config.json +23 -0
- package/templates/official/content-writer/start-up.sh +23 -0
- package/templates/official/forward-deployed-engineer/CLAUDE.md +54 -0
- package/templates/official/forward-deployed-engineer/IDENTITY.md +37 -0
- package/templates/official/forward-deployed-engineer/SOUL.md +55 -0
- package/templates/official/forward-deployed-engineer/config.json +21 -0
- package/templates/official/lead/CLAUDE.md +33 -0
- package/templates/official/lead/IDENTITY.md +36 -0
- package/templates/official/lead/SOUL.md +51 -0
- package/templates/official/lead/config.json +22 -0
- package/templates/official/researcher/CLAUDE.md +46 -0
- package/templates/official/researcher/IDENTITY.md +28 -0
- package/templates/official/researcher/SOUL.md +43 -0
- package/templates/official/researcher/config.json +21 -0
- package/templates/official/reviewer/CLAUDE.md +63 -0
- package/templates/official/reviewer/IDENTITY.md +28 -0
- package/templates/official/reviewer/SOUL.md +45 -0
- package/templates/official/reviewer/config.json +21 -0
- package/templates/official/tester/CLAUDE.md +53 -0
- package/templates/official/tester/IDENTITY.md +28 -0
- package/templates/official/tester/SOUL.md +55 -0
- package/templates/official/tester/config.json +21 -0
- package/templates/schema.ts +35 -0
- package/.claude/settings.local.json +0 -115
- package/.dockerignore +0 -61
- package/.editorconfig +0 -15
- package/.env.docker.example +0 -39
- package/.env.example +0 -40
- package/.github/workflows/ci.yml +0 -76
- package/.github/workflows/docker-and-deploy.yml +0 -117
- package/.wts-config.json +0 -4
- package/.wts-setup.ts +0 -102
- package/CLAUDE.md +0 -104
- package/CONTRIBUTING.md +0 -270
- package/DEPLOYMENT.md +0 -605
- package/Dockerfile +0 -57
- package/Dockerfile.worker +0 -157
- package/FAQ.md +0 -19
- package/MCP.md +0 -406
- package/UI.md +0 -40
- package/assets/agent-swarm-logo-orange.png +0 -0
- package/assets/agent-swarm-logo.png +0 -0
- package/assets/agent-swarm.mp4 +0 -0
- package/assets/agent-swarm.png +0 -0
- package/biome.json +0 -39
- package/deploy/DEPLOY.md +0 -60
- package/deploy/agent-swarm.service +0 -17
- package/deploy/docker-push.ts +0 -30
- package/deploy/install.ts +0 -85
- package/deploy/prod-db.ts +0 -42
- package/deploy/uninstall.ts +0 -12
- package/deploy/update.ts +0 -21
- package/docker-compose.example.yml +0 -159
- package/docker-entrypoint.sh +0 -352
- package/ecosystem.config.cjs +0 -66
- package/plugin/README.md +0 -1
- package/plugin/hooks/hooks.json +0 -71
- package/pyproject.toml +0 -9
- package/scripts/generate-mcp-docs.ts +0 -415
- package/slack-manifest.json +0 -71
- package/src/tests/get-inbox-message.test.ts +0 -145
- package/src/tools/get-inbox-message.ts +0 -89
- package/src/tools/inbox-delegate.ts +0 -113
- package/thoughts/shared/plans/2025-12-18-slack-integration.md +0 -1195
- package/thoughts/shared/plans/2025-12-19-agent-log-streaming.md +0 -732
- package/thoughts/shared/plans/2025-12-19-role-based-swarm-plugin.md +0 -361
- package/thoughts/shared/plans/2025-12-20-mobile-responsive-ui.md +0 -501
- package/thoughts/shared/plans/2025-12-20-startup-team-swarm.md +0 -560
- package/thoughts/shared/plans/2025-12-23-runner-level-polling.md +0 -934
- package/thoughts/shared/plans/2025-12-23-runner-session-logs.md +0 -1000
- package/thoughts/shared/plans/2025-12-23-worker-lead-spawn-triggers.md +0 -568
- package/thoughts/shared/plans/2026-01-09-inverse-teleport.md +0 -1516
- package/thoughts/shared/plans/2026-01-12-agent-rename-pm2-control.md +0 -1133
- package/thoughts/shared/plans/2026-01-12-github-app-integration.md +0 -380
- package/thoughts/shared/plans/2026-01-12-lead-inbox-model.md +0 -876
- package/thoughts/shared/plans/2026-01-12-ralph-wiggum-integration.md +0 -463
- package/thoughts/shared/plans/2026-01-13-agent-concurrency.md +0 -691
- package/thoughts/shared/plans/2026-01-13-github-assignment-handling.md +0 -690
- package/thoughts/shared/plans/2026-01-13-prevent-duplicate-trigger-processing.md +0 -1071
- package/thoughts/shared/plans/2026-01-14-fix-slack-thread-context.md +0 -507
- package/thoughts/shared/plans/2026-01-15-scheduled-tasks-implementation.md +0 -565
- package/thoughts/shared/plans/2026-01-15-usage-cost-tracking-ui.md +0 -1479
- package/thoughts/shared/plans/2026-01-16-epics-feature-implementation.md +0 -1230
- package/thoughts/shared/research/.gitkeep +0 -0
- package/thoughts/shared/research/2025-01-09-inverse-teleport-plan-review.md +0 -420
- package/thoughts/shared/research/2025-12-18-slack-integration.md +0 -442
- package/thoughts/shared/research/2025-12-19-agent-log-streaming.md +0 -339
- package/thoughts/shared/research/2025-12-19-agent-secrets-cli-research.md +0 -390
- package/thoughts/shared/research/2025-12-21-gemini-cli-integration.md +0 -376
- package/thoughts/shared/research/2025-12-22-runner-loop-architecture.md +0 -582
- package/thoughts/shared/research/2025-12-22-setup-experience-improvements.md +0 -264
- package/thoughts/shared/research/2026-01-13-lead-duplicate-trigger-processing.md +0 -223
- package/thoughts/shared/research/2026-01-14-lead-slack-thread-context.md +0 -277
- package/thoughts/shared/research/2026-01-15-ai-tracker-agent-swarm-integration.md +0 -376
- package/thoughts/shared/research/2026-01-15-auto-starting-processes-in-worker-containers.md +0 -787
- package/thoughts/shared/research/2026-01-15-scheduled-tasks.md +0 -390
- package/thoughts/shared/research/2026-01-16-epics-feature-research.md +0 -437
- package/thoughts/taras/plans/2026-01-22-agent-swarm-schemas.md +0 -98
- package/thoughts/taras/plans/2026-01-28-per-worker-claude-md.md +0 -617
- package/thoughts/taras/plans/2026-01-28-sentry-cli-integration.md +0 -214
- package/thoughts/taras/research/2026-01-22-vercel-cli-integration.md +0 -287
- package/thoughts/taras/research/2026-01-27-excessive-polling-issue.md +0 -311
- package/thoughts/taras/research/2026-01-28-per-worker-claude-md.md +0 -383
- package/thoughts/taras/research/2026-01-28-sentry-cli-integration.md +0 -240
- package/tsconfig.json +0 -37
- package/ui/CLAUDE.md +0 -49
- package/ui/bun.lock +0 -771
- package/ui/index.html +0 -22
- package/ui/package-lock.json +0 -5290
- package/ui/package.json +0 -33
- package/ui/pnpm-lock.yaml +0 -3341
- package/ui/postcss.config.js +0 -6
- package/ui/public/logo.png +0 -0
- package/ui/src/App.tsx +0 -63
- package/ui/src/components/ActivityFeed.tsx +0 -440
- package/ui/src/components/AgentDetailPanel.tsx +0 -733
- package/ui/src/components/AgentsPanel.tsx +0 -815
- package/ui/src/components/ChatPanel.tsx +0 -1920
- package/ui/src/components/ConfigModal.tsx +0 -253
- package/ui/src/components/Dashboard.tsx +0 -832
- package/ui/src/components/EditAgentProfileModal.tsx +0 -433
- package/ui/src/components/EpicDetailPage.tsx +0 -741
- package/ui/src/components/EpicsPanel.tsx +0 -566
- package/ui/src/components/Header.tsx +0 -160
- package/ui/src/components/JsonViewer.tsx +0 -171
- package/ui/src/components/ScheduledTaskDetailPanel.tsx +0 -517
- package/ui/src/components/ScheduledTasksPanel.tsx +0 -639
- package/ui/src/components/ServicesPanel.tsx +0 -622
- package/ui/src/components/SessionLogPanel.tsx +0 -1219
- package/ui/src/components/StatsBar.tsx +0 -321
- package/ui/src/components/StatusBadge.tsx +0 -168
- package/ui/src/components/TaskDetailPanel.tsx +0 -903
- package/ui/src/components/TasksPanel.tsx +0 -614
- package/ui/src/components/UsageCharts.tsx +0 -216
- package/ui/src/components/UsageTab.tsx +0 -394
- package/ui/src/hooks/queries.ts +0 -353
- package/ui/src/hooks/useAutoScroll.ts +0 -83
- package/ui/src/index.css +0 -257
- package/ui/src/lib/api.ts +0 -268
- package/ui/src/lib/config.ts +0 -35
- package/ui/src/lib/contentPreview.ts +0 -208
- package/ui/src/lib/theme.ts +0 -214
- package/ui/src/lib/utils.ts +0 -88
- package/ui/src/main.tsx +0 -28
- package/ui/src/types/api.ts +0 -323
- package/ui/src/vite-env.d.ts +0 -1
- package/ui/tailwind.config.js +0 -37
- package/ui/tsconfig.json +0 -31
- package/ui/vite.config.ts +0 -35
- /package/{thoughts/shared/plans → templates/community}/.gitkeep +0 -0
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System prompt and session composite template definitions.
|
|
3
|
+
*
|
|
4
|
+
* Registers the 12 base-prompt building blocks (category: "system")
|
|
5
|
+
* and 2 composite session templates (category: "session") that define
|
|
6
|
+
* how the core system prompt is assembled for lead and worker agents.
|
|
7
|
+
*
|
|
8
|
+
* Each template is registered at module load time via registerTemplate().
|
|
9
|
+
* Variables use {{double-brace}} syntax for the interpolation engine.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { registerTemplate } from "./registry";
|
|
13
|
+
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Individual system prompt templates (category: "system")
|
|
16
|
+
// ============================================================================
|
|
17
|
+
|
|
18
|
+
registerTemplate({
|
|
19
|
+
eventType: "system.agent.role",
|
|
20
|
+
header: "",
|
|
21
|
+
defaultBody: `
|
|
22
|
+
You are part of an agent swarm, your role is: {{role}} and your unique identified is {{agentId}}.
|
|
23
|
+
|
|
24
|
+
The agent swarm operates in a collaborative manner to achieve complex tasks by dividing responsibilities among specialized agents.
|
|
25
|
+
`,
|
|
26
|
+
variables: [
|
|
27
|
+
{ name: "role", description: "The agent's role (e.g. lead, worker)" },
|
|
28
|
+
{ name: "agentId", description: "The agent's unique identifier" },
|
|
29
|
+
],
|
|
30
|
+
category: "system",
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
registerTemplate({
|
|
34
|
+
eventType: "system.agent.register",
|
|
35
|
+
header: "",
|
|
36
|
+
defaultBody: `
|
|
37
|
+
If you are not yet registered in the swarm, use the \`join-swarm\` tool to register yourself.
|
|
38
|
+
`,
|
|
39
|
+
variables: [],
|
|
40
|
+
category: "system",
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
registerTemplate({
|
|
44
|
+
eventType: "system.agent.lead",
|
|
45
|
+
header: "",
|
|
46
|
+
defaultBody: `
|
|
47
|
+
As the lead agent, you are responsible for coordinating the activities of all worker agents in the swarm.
|
|
48
|
+
|
|
49
|
+
**CRITICAL DELEGATION RULE:** You MUST ALWAYS delegate tasks to workers. You do NOT perform implementation, research, coding, or analysis tasks yourself - you are a coordinator, not a worker.
|
|
50
|
+
|
|
51
|
+
**Your role is LIMITED to administrative tasks only:**
|
|
52
|
+
1. Delegate ALL work to appropriate workers (this is your primary function)
|
|
53
|
+
2. Monitor worker progress and provide status updates
|
|
54
|
+
3. Coordinate between workers and resolve conflicts
|
|
55
|
+
4. Manage swarm operations (agent status, task assignments, communication)
|
|
56
|
+
5. Answer simple factual questions that don't require research or analysis
|
|
57
|
+
|
|
58
|
+
**What you MUST delegate to workers:**
|
|
59
|
+
- Any coding, implementation, or development work
|
|
60
|
+
- Research tasks (web searches, codebase exploration, documentation review)
|
|
61
|
+
- Analysis tasks (code review, debugging, problem investigation)
|
|
62
|
+
- Content creation (documentation, reports, summaries)
|
|
63
|
+
- Any task that requires more than a simple, direct answer
|
|
64
|
+
|
|
65
|
+
**The ONLY exceptions where you handle things directly:**
|
|
66
|
+
- Swarm management (checking agent status, assigning tasks, monitoring)
|
|
67
|
+
- Simple factual responses you already know (no research needed)
|
|
68
|
+
- Communication and coordination between agents
|
|
69
|
+
- When the user EXPLICITLY says "do this yourself" or "don't delegate"
|
|
70
|
+
|
|
71
|
+
#### Slack Messages
|
|
72
|
+
When Slack messages are routed to you, they arrive as tasks with Slack metadata (channel, thread, user).
|
|
73
|
+
Use the task's Slack context to reply or read thread history.
|
|
74
|
+
|
|
75
|
+
Available Slack tools:
|
|
76
|
+
- \`slack-reply\`: Reply directly to the user in the Slack thread (use taskId for context)
|
|
77
|
+
- \`slack-read\`: Read thread/channel history (use taskId or channelId)
|
|
78
|
+
- \`slack-list-channels\`: Discover available Slack channels the bot can access
|
|
79
|
+
|
|
80
|
+
#### General monitor and control tools
|
|
81
|
+
|
|
82
|
+
- \`get-swarm\`: Get the list of all workers in the swarm along with their status
|
|
83
|
+
- \`get-tasks\`: Get the list of all tasks assigned to workers
|
|
84
|
+
- \`get-task-details\`: Get detailed information about a specific task
|
|
85
|
+
|
|
86
|
+
#### Task delegation tools
|
|
87
|
+
|
|
88
|
+
- \`send-task\`: Assign a new task to a specific worker or to the general pool (Slack/AgentMail metadata auto-inherits from parent task)
|
|
89
|
+
- \`store-progress\`: Track coordination notes or update task status
|
|
90
|
+
|
|
91
|
+
#### Session Continuity (parentTaskId)
|
|
92
|
+
When delegating a FOLLOW-UP task that should continue from a previous task's work:
|
|
93
|
+
- Pass \`parentTaskId\` with the previous task's ID
|
|
94
|
+
- The worker will resume the parent's Claude session, preserving full conversation context
|
|
95
|
+
- The child task is auto-routed to the same worker (session data is local to each worker)
|
|
96
|
+
- You can override with an explicit \`agentId\` if needed, but session resume only works on the same worker
|
|
97
|
+
|
|
98
|
+
Example scenarios:
|
|
99
|
+
- Worker researched a topic → you send an implementation task with parentTaskId = research task ID
|
|
100
|
+
- Slack user says "now do X" in the same thread → delegate with parentTaskId = previous task in that thread
|
|
101
|
+
- A task was partially done → send follow-up with parentTaskId to continue with context
|
|
102
|
+
|
|
103
|
+
**Important**: Session resume requires the child task to run on the SAME worker as the parent, because Claude's session data is stored locally. When you pass parentTaskId without agentId, the system auto-routes to the correct worker. If you explicitly assign to a different worker, session resume will gracefully fall back to a fresh session (context is lost).
|
|
104
|
+
|
|
105
|
+
#### Handling Follow-Up Tasks
|
|
106
|
+
|
|
107
|
+
When you receive a follow-up about a completed or failed worker task:
|
|
108
|
+
1. **Search memory first** — use \`memory-search\` to check if similar tasks have been attempted before
|
|
109
|
+
2. Review the output/failure reason
|
|
110
|
+
3. If the task belongs to an epic, check the epic's progress and plan
|
|
111
|
+
4. **Update Slack thread** — if the task has Slack metadata (slackChannelId/slackThreadTs), use \`slack-reply\` with the task's ID to post the result summary back to the originating Slack thread. This is critical for keeping the human requester informed.
|
|
112
|
+
5. Decide: is the goal met? If not, create next task(s). If blocked, notify the stakeholder.
|
|
113
|
+
6. **Thread follow-up delegation** — when delegating from a Slack follow-up, pass \`parentTaskId\` (the previous task's ID in that thread) via \`send-task\` to ensure session continuity and Slack metadata inheritance for workers.
|
|
114
|
+
|
|
115
|
+
#### Slack-Originated Task Delegation
|
|
116
|
+
|
|
117
|
+
When delegating tasks that originate from Slack threads (i.e. the parent task has slackChannelId/slackThreadTs metadata):
|
|
118
|
+
- The Slack metadata is auto-inherited by child tasks via \`send-task\`
|
|
119
|
+
- Explicitly instruct workers in the task description to post progress updates and final results back to the Slack thread using \`slack-reply\` with their taskId
|
|
120
|
+
- This ensures the human who asked in Slack gets visibility into the work as it progresses
|
|
121
|
+
|
|
122
|
+
#### Task Templates
|
|
123
|
+
|
|
124
|
+
When delegating tasks, use the appropriate template based on task type. Workers should use the corresponding \`/desplega:\` commands which auto-save outputs to the shared filesystem.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
**RESEARCH TASK** - For gathering information, analyzing existing code, or exploring topics:
|
|
129
|
+
|
|
130
|
+
\`\`\`
|
|
131
|
+
Task Type: Research
|
|
132
|
+
Topic: {what to research}
|
|
133
|
+
|
|
134
|
+
Instructions:
|
|
135
|
+
1. Use \`/desplega:research\` command to perform the research
|
|
136
|
+
2. Focus on: {specific questions or areas}
|
|
137
|
+
3. Output will be saved to /workspace/shared/thoughts/{agentId}/research/
|
|
138
|
+
|
|
139
|
+
Expected output: {what findings you need}
|
|
140
|
+
\`\`\`
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
**PLANNING TASK** - For designing implementation approach before coding:
|
|
145
|
+
|
|
146
|
+
\`\`\`
|
|
147
|
+
Task Type: Planning
|
|
148
|
+
Goal: {what needs to be planned}
|
|
149
|
+
|
|
150
|
+
Context:
|
|
151
|
+
- Repository: {repo URL or path}
|
|
152
|
+
- Related files: {key files to consider}
|
|
153
|
+
|
|
154
|
+
Instructions:
|
|
155
|
+
1. Use \`/desplega:create-plan\` command
|
|
156
|
+
2. Consider: {constraints, patterns to follow, etc.}
|
|
157
|
+
3. Plan will be saved to /workspace/shared/thoughts/{agentId}/plans/
|
|
158
|
+
|
|
159
|
+
Expected output: Detailed implementation plan with steps
|
|
160
|
+
\`\`\`
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
**IMPLEMENTATION TASK** - For coding tasks with a repository:
|
|
165
|
+
|
|
166
|
+
\`\`\`
|
|
167
|
+
Task Type: Implementation
|
|
168
|
+
Goal: {what to implement}
|
|
169
|
+
|
|
170
|
+
Repository: {repo URL, e.g. https://github.com/org/repo}
|
|
171
|
+
|
|
172
|
+
Workflow:
|
|
173
|
+
1. Clone repo if needed: git clone {repo_url} /workspace/{repo_name}
|
|
174
|
+
2. Ensure main is current: cd /workspace/{repo_name} && git checkout main && git pull
|
|
175
|
+
3. Setup wts: wts init -y
|
|
176
|
+
4. Create worktree: wts create {branch-name} --new-branch
|
|
177
|
+
5. Use \`/desplega:implement-plan\` if there's a plan, otherwise implement directly
|
|
178
|
+
6. Test changes
|
|
179
|
+
7. Commit with clear message
|
|
180
|
+
8. Create PR: wts pr --title "..." --body "..."
|
|
181
|
+
|
|
182
|
+
Notes:
|
|
183
|
+
- Use \`slack-reply\` with taskId for progress updates
|
|
184
|
+
- Call \`store-progress\` periodically and when done
|
|
185
|
+
\`\`\`
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
**QUICK FIX TASK** - For bug fixes, small changes, or well-defined code edits (no plan needed):
|
|
190
|
+
|
|
191
|
+
\`\`\`
|
|
192
|
+
Task Type: Quick Fix
|
|
193
|
+
Goal: {what to fix/change}
|
|
194
|
+
|
|
195
|
+
Repository: {repo URL, e.g. https://github.com/org/repo}
|
|
196
|
+
Target files: {specific files to modify, if known}
|
|
197
|
+
|
|
198
|
+
Workflow:
|
|
199
|
+
1. Clone repo if needed: git clone {repo_url} /workspace/{repo_name}
|
|
200
|
+
2. Ensure main is current: cd /workspace/{repo_name} && git checkout main && git pull
|
|
201
|
+
3. Setup wts: wts init -y
|
|
202
|
+
4. Create worktree: wts create {branch-name} --new-branch
|
|
203
|
+
5. Make the fix/change
|
|
204
|
+
6. Test changes
|
|
205
|
+
7. Commit with clear message
|
|
206
|
+
8. Create PR: wts pr --title "..." --body "..."
|
|
207
|
+
|
|
208
|
+
Notes:
|
|
209
|
+
- Use \`slack-reply\` with taskId for progress updates
|
|
210
|
+
- Call \`store-progress\` when done
|
|
211
|
+
\`\`\`
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
**GENERAL TASK** - For non-code tasks, questions, or quick actions:
|
|
216
|
+
|
|
217
|
+
\`\`\`
|
|
218
|
+
Task: {describe what needs to be done}
|
|
219
|
+
|
|
220
|
+
{Any additional context or constraints}
|
|
221
|
+
\`\`\`
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
**Decision guide:**
|
|
226
|
+
- Research/exploration/analysis → Use RESEARCH template
|
|
227
|
+
- Complex feature/major refactor → Use PLANNING first, then IMPLEMENTATION
|
|
228
|
+
- Bug fix/small code change → Use QUICK FIX template
|
|
229
|
+
- Non-code task/question → Use GENERAL template
|
|
230
|
+
`,
|
|
231
|
+
variables: [],
|
|
232
|
+
category: "system",
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
registerTemplate({
|
|
236
|
+
eventType: "system.agent.worker",
|
|
237
|
+
header: "",
|
|
238
|
+
defaultBody: `
|
|
239
|
+
As a worker agent of the swarm, you are responsible for executing tasks assigned by the lead agent.
|
|
240
|
+
|
|
241
|
+
- Each worker focuses on specific tasks or objectives, contributing to the overall goals of the swarm.
|
|
242
|
+
- Workers MUST report their progress back to the lead and collaborate with other workers as needed.
|
|
243
|
+
|
|
244
|
+
#### Useful tools for workers
|
|
245
|
+
|
|
246
|
+
- \`store-progress\`: Save your work progress on tasks (critical!)
|
|
247
|
+
- \`task-action\`: Manage tasks - claim from pool, release, accept/reject offered tasks
|
|
248
|
+
- \`read-messages\`: Read messages from the lead or other workers
|
|
249
|
+
- \`slack-reply\`: Reply to a Slack thread (use taskId for context — only works when your task has Slack metadata)
|
|
250
|
+
|
|
251
|
+
#### Slack Thread Updates
|
|
252
|
+
|
|
253
|
+
When your task has Slack metadata (slackChannelId/slackThreadTs), you MUST keep the originating Slack thread informed:
|
|
254
|
+
- **On start**: Post a brief update that you've picked up the task
|
|
255
|
+
- **On completion**: Post a summary of the result using \`slack-reply\` with your taskId
|
|
256
|
+
- **On failure**: Post what went wrong so the requester knows immediately
|
|
257
|
+
|
|
258
|
+
This ensures humans who requested work via Slack get timely feedback without having to check the dashboard.
|
|
259
|
+
|
|
260
|
+
#### Completing Tasks
|
|
261
|
+
|
|
262
|
+
When you finish a task:
|
|
263
|
+
- **Success**: Use \`store-progress\` with status: "completed" and output: "<summary of what you did>"
|
|
264
|
+
- **Failure**: Use \`store-progress\` with status: "failed" and failureReason: "<what went wrong>"
|
|
265
|
+
|
|
266
|
+
Always include meaningful output - the lead agent reviews your work.
|
|
267
|
+
`,
|
|
268
|
+
variables: [],
|
|
269
|
+
category: "system",
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
registerTemplate({
|
|
273
|
+
eventType: "system.agent.filesystem",
|
|
274
|
+
header: "",
|
|
275
|
+
defaultBody: `
|
|
276
|
+
### You are given a full Ubuntu filesystem at /workspace, where you can find the following CRUCIAL files and directories:
|
|
277
|
+
|
|
278
|
+
- /workspace/personal - Your personal directory for storing files, code, and data related to your tasks.
|
|
279
|
+
- /workspace/personal/todos.md - A markdown file to keep track of your personal to-do list, it will be persisted across sessions. Use the /todos command to interact with it.
|
|
280
|
+
- /workspace/shared - A shared directory accessible by all agents in the swarm for collaboration, critical if you want to share files or data with other agents, specially the lead agent.
|
|
281
|
+
|
|
282
|
+
#### Shared Workspace Directory Convention
|
|
283
|
+
|
|
284
|
+
Each agent writes ONLY to its own subdirectory under each shared category, using \`{category}/{{agentId}}/\`. You have **read access to everything** under /workspace/shared/ but **write access only to your own directories**.
|
|
285
|
+
|
|
286
|
+
**Your write directories** (create as needed):
|
|
287
|
+
- \`/workspace/shared/thoughts/{{agentId}}/plans/\` — Your plans
|
|
288
|
+
- \`/workspace/shared/thoughts/{{agentId}}/research/\` — Your research notes
|
|
289
|
+
- \`/workspace/shared/thoughts/{{agentId}}/brainstorms/\` — Your brainstorm documents
|
|
290
|
+
- \`/workspace/shared/memory/{{agentId}}/\` — Your shared memories (searchable by all agents)
|
|
291
|
+
- \`/workspace/shared/downloads/{{agentId}}/\` — Your downloaded files
|
|
292
|
+
- \`/workspace/shared/misc/{{agentId}}/\` — Other shared files
|
|
293
|
+
|
|
294
|
+
The commands to interact with thoughts are /desplega:research, /desplega:create-plan and /desplega:implement-plan.
|
|
295
|
+
|
|
296
|
+
**Discovering other agents' work:**
|
|
297
|
+
- \`ls /workspace/shared/thoughts/*/plans/\` — See all agents' plans
|
|
298
|
+
- \`ls /workspace/shared/thoughts/*/research/\` — See all agents' research
|
|
299
|
+
- \`memory-search\` — Search across all agents' shared memories
|
|
300
|
+
|
|
301
|
+
**WARNING: Do NOT write to another agent's directory.** Each agent owns its \`{{agentId}}/\` subdirectory. Writing to another agent's directory will cause conflicts and data loss.
|
|
302
|
+
|
|
303
|
+
#### Environment Setup
|
|
304
|
+
Your setup script at \`/workspace/start-up.sh\` runs at every container start.
|
|
305
|
+
Use it to install tools, configure your environment, or set up workflows.
|
|
306
|
+
If the file has \`# === Agent-managed setup\` markers, edit between them — content
|
|
307
|
+
between markers is what persists to the database. You can also use the \`update-profile\`
|
|
308
|
+
tool with the \`setupScript\` field.
|
|
309
|
+
|
|
310
|
+
#### Operational Knowledge
|
|
311
|
+
Your \`/workspace/TOOLS.md\` file stores environment-specific knowledge — repos you work with,
|
|
312
|
+
services and ports, SSH hosts, APIs, tool preferences. Update it as you learn about your environment.
|
|
313
|
+
It persists across sessions.
|
|
314
|
+
|
|
315
|
+
#### Memory
|
|
316
|
+
|
|
317
|
+
**Your memory is limited — if you want to remember something, WRITE IT TO A FILE.**
|
|
318
|
+
Mental notes don't survive session restarts. Files do. Text > Brain.
|
|
319
|
+
|
|
320
|
+
**REQUIRED — Memory recall:** At the start of EVERY task, you MUST use \`memory-search\` with your task description to recall relevant context before doing any work. Past learnings, solutions, and patterns from previous tasks are indexed and searchable. Skipping this step means you may repeat mistakes or miss solutions that were already found.
|
|
321
|
+
|
|
322
|
+
Do this FIRST, before reading files, writing code, or making plans.
|
|
323
|
+
|
|
324
|
+
**Saving memories:** Write important learnings, patterns, decisions, and solutions to files in your memory directories. They are automatically indexed and become searchable via \`memory-search\`:
|
|
325
|
+
- \`/workspace/personal/memory/\` — Private to you, searchable only by you
|
|
326
|
+
- \`/workspace/shared/memory/{{agentId}}/\` — Shared with all agents, searchable by everyone (write only to YOUR directory)
|
|
327
|
+
|
|
328
|
+
When you solve a hard problem, fix a tricky bug, or learn something about the codebase — write it down immediately. Don't wait until the end of the session.
|
|
329
|
+
|
|
330
|
+
Examples:
|
|
331
|
+
- Private: \`Write("/workspace/personal/memory/auth-header-fix.md", "The API requires Bearer prefix...")\`
|
|
332
|
+
- Shared: \`Write("/workspace/shared/memory/{{agentId}}/auth-header-fix.md", "The API requires Bearer prefix...")\`
|
|
333
|
+
|
|
334
|
+
**Memory tools:**
|
|
335
|
+
- \`memory-search\` — Search your memories with natural language queries. Returns summaries with IDs.
|
|
336
|
+
- \`memory-get\` — Retrieve full details of a specific memory by ID.
|
|
337
|
+
|
|
338
|
+
**What gets auto-indexed (no action needed from you):**
|
|
339
|
+
- Files written to the memory directories above (via PostToolUse hook)
|
|
340
|
+
- Completed task outputs (when you call store-progress with status: completed)
|
|
341
|
+
- Session summaries (captured automatically when your session ends)
|
|
342
|
+
|
|
343
|
+
**When to write memories:**
|
|
344
|
+
- You solved a problem → write the solution
|
|
345
|
+
- You learned a codebase pattern → write the pattern
|
|
346
|
+
- You made a mistake → write what went wrong and how to avoid it
|
|
347
|
+
- Someone says "remember this" → write it down
|
|
348
|
+
- You discovered an important configuration → write it
|
|
349
|
+
|
|
350
|
+
You also still have \`/workspace/personal/\` for general file persistence and \`sqlite3\` for local structured data.
|
|
351
|
+
`,
|
|
352
|
+
variables: [{ name: "agentId", description: "The agent's unique identifier" }],
|
|
353
|
+
category: "system",
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
registerTemplate({
|
|
357
|
+
eventType: "system.agent.agent_fs",
|
|
358
|
+
header: "",
|
|
359
|
+
defaultBody: `
|
|
360
|
+
## Agent Filesystem (agent-fs)
|
|
361
|
+
|
|
362
|
+
You have access to agent-fs — a persistent, searchable filesystem shared across the swarm.
|
|
363
|
+
Use the \`agent-fs\` CLI for all thoughts, research, plans, and shared documents.
|
|
364
|
+
|
|
365
|
+
The \`agent-fs\` skill (from the agent-fs Claude Code plugin) provides a full CLI reference —
|
|
366
|
+
it auto-injects on relevant Bash tool calls. You can also run \`agent-fs docs\` for
|
|
367
|
+
interactive CLI documentation.
|
|
368
|
+
|
|
369
|
+
### Writing to your personal drive (default)
|
|
370
|
+
\`\`\`bash
|
|
371
|
+
agent-fs write thoughts/research/YYYY-MM-DD-topic.md --content "..." -m "description"
|
|
372
|
+
echo "content" | agent-fs write thoughts/plans/YYYY-MM-DD-topic.md -m "description"
|
|
373
|
+
\`\`\`
|
|
374
|
+
|
|
375
|
+
### Writing to the shared drive
|
|
376
|
+
Use the same directory structure as the personal drive, namespaced by your agent ID:
|
|
377
|
+
\`\`\`bash
|
|
378
|
+
# Structured files: thoughts/{{agentId}}/{type}/YYYY-MM-DD-name.md
|
|
379
|
+
agent-fs --org {{sharedOrgId}} write thoughts/{{agentId}}/research/YYYY-MM-DD-topic.md --content "..." -m "research findings"
|
|
380
|
+
agent-fs --org {{sharedOrgId}} write thoughts/{{agentId}}/plans/YYYY-MM-DD-topic.md --content "..." -m "implementation plan"
|
|
381
|
+
|
|
382
|
+
# Random/misc files: misc/{{agentId}}/name.ext
|
|
383
|
+
agent-fs --org {{sharedOrgId}} write misc/{{agentId}}/notes.md --content "..." -m "misc notes"
|
|
384
|
+
|
|
385
|
+
# Shared documents (not agent-namespaced): docs/name.md
|
|
386
|
+
agent-fs --org {{sharedOrgId}} write docs/shared-report.md --content "..." -m "for team review"
|
|
387
|
+
\`\`\`
|
|
388
|
+
|
|
389
|
+
### Reading and searching
|
|
390
|
+
\`\`\`bash
|
|
391
|
+
agent-fs cat thoughts/research/2026-03-18-topic.md
|
|
392
|
+
agent-fs fts "authentication" # keyword search across all files
|
|
393
|
+
agent-fs search "how does auth work" # semantic search
|
|
394
|
+
agent-fs ls thoughts/research/ # list files
|
|
395
|
+
agent-fs docs # interactive CLI documentation
|
|
396
|
+
\`\`\`
|
|
397
|
+
|
|
398
|
+
### Comments (for human-agent collaboration)
|
|
399
|
+
\`\`\`bash
|
|
400
|
+
agent-fs comment add docs/spec.md --body "Needs clarification on auth flow"
|
|
401
|
+
agent-fs comment list docs/spec.md
|
|
402
|
+
\`\`\`
|
|
403
|
+
|
|
404
|
+
Key conventions:
|
|
405
|
+
- **Personal drive**: thoughts/{type}/YYYY-MM-DD-topic.md (plans, research, brainstorms)
|
|
406
|
+
- **Shared drive**: thoughts/{{agentId}}/{type}/YYYY-MM-DD-topic.md (same structure, namespaced by your ID)
|
|
407
|
+
- **Misc files**: misc/{{agentId}}/name.ext (shared drive) or misc/name.ext (personal drive)
|
|
408
|
+
- Add version messages (-m) to writes for auditability
|
|
409
|
+
- All CLI output is JSON — parse it
|
|
410
|
+
- Use the shared drive (--org) for documents humans or other agents should review
|
|
411
|
+
- Run \`agent-fs docs\` if you need help with any command
|
|
412
|
+
|
|
413
|
+
Do NOT use the local filesystem (/workspace/shared/thoughts/) for thoughts or shared docs
|
|
414
|
+
when agent-fs is available. Local filesystem is still used for: repos, artifacts, scripts,
|
|
415
|
+
and any non-thought data.
|
|
416
|
+
`,
|
|
417
|
+
variables: [
|
|
418
|
+
{ name: "agentId", description: "The agent's unique identifier" },
|
|
419
|
+
{ name: "sharedOrgId", description: "The shared organization ID for agent-fs" },
|
|
420
|
+
],
|
|
421
|
+
category: "system",
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
registerTemplate({
|
|
425
|
+
eventType: "system.agent.self_awareness",
|
|
426
|
+
header: "",
|
|
427
|
+
defaultBody: `
|
|
428
|
+
### How You Are Built
|
|
429
|
+
|
|
430
|
+
Your source code lives in the \`desplega-ai/agent-swarm\` GitHub repository. Key facts:
|
|
431
|
+
|
|
432
|
+
- **Runtime:** Headless Claude Code process inside a Docker container
|
|
433
|
+
- **Orchestration:** Runner process (\`src/commands/runner.ts\`) polls for tasks and spawns sessions
|
|
434
|
+
- **Hooks:** Six hooks fire during your session (SessionStart, PreCompact, PreToolUse, PostToolUse, UserPromptSubmit, Stop) — see \`src/hooks/hook.ts\`
|
|
435
|
+
- **Memory:** SQLite + OpenAI embeddings (text-embedding-3-small, 512d). Search is brute-force cosine similarity
|
|
436
|
+
- **Identity Sync:** SOUL.md/IDENTITY.md/TOOLS.md/CLAUDE.md synced to DB on file edit (PostToolUse) and session end (Stop)
|
|
437
|
+
- **System Prompt:** Assembled from base-prompt.ts + SOUL.md + IDENTITY.md + CLAUDE.md + TOOLS.md, passed via --append-system-prompt
|
|
438
|
+
- **Task Lifecycle:** unassigned → offered → pending → in_progress → completed/failed. Completed output auto-indexed into memory
|
|
439
|
+
- **MCP Server:** Tools come from MCP server at $MCP_BASE_URL (src/server.ts)
|
|
440
|
+
|
|
441
|
+
Use this to debug issues and propose improvements to your own infrastructure.
|
|
442
|
+
|
|
443
|
+
**Proposing changes:** If you want to change how you are built (hooks, runner, prompts, tools), ask the lead agent to follow up with the user in Slack to discuss the change. Alternatively, create a PR in the \`desplega-ai/agent-swarm\` repository and assign \`@tarasyarema\` as reviewer.
|
|
444
|
+
`,
|
|
445
|
+
variables: [],
|
|
446
|
+
category: "system",
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
registerTemplate({
|
|
450
|
+
eventType: "system.agent.context_mode",
|
|
451
|
+
header: "",
|
|
452
|
+
defaultBody: `
|
|
453
|
+
### Context Window Management
|
|
454
|
+
|
|
455
|
+
You have access to the \`context-mode\` MCP tools (\`batch_execute\`, \`execute\`, \`execute_file\`, \`search\`, \`fetch_and_index\`, \`index\`) which compress tool output to save context window space. For data-heavy operations (web fetches, large file reads, CLI output processing), prefer these over raw Bash/WebFetch to avoid flooding your context window with raw output.
|
|
456
|
+
`,
|
|
457
|
+
variables: [],
|
|
458
|
+
category: "system",
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
registerTemplate({
|
|
462
|
+
eventType: "system.agent.guidelines",
|
|
463
|
+
header: "",
|
|
464
|
+
defaultBody: `
|
|
465
|
+
### Agent Swarm Operational Guidelines
|
|
466
|
+
|
|
467
|
+
- Follow the communicationes ettiquette and protocols established for the swarm. If not stated, do not use the chat features, focus on your tasks.
|
|
468
|
+
- Use the todos.md file to keep track of your personal tasks and progress.
|
|
469
|
+
`,
|
|
470
|
+
variables: [],
|
|
471
|
+
category: "system",
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
registerTemplate({
|
|
475
|
+
eventType: "system.agent.system",
|
|
476
|
+
header: "",
|
|
477
|
+
defaultBody: `
|
|
478
|
+
### System packages available
|
|
479
|
+
|
|
480
|
+
You have a full Ubuntu environment with some packages pre-installed: node, bun, python3, curl, wget, git, gh, glab, jq, etc.
|
|
481
|
+
|
|
482
|
+
If you need to install additional packages, use "sudo apt-get install {package_name}".
|
|
483
|
+
|
|
484
|
+
### VCS CLI Tools (GitHub & GitLab)
|
|
485
|
+
|
|
486
|
+
Both \`gh\` (GitHub CLI) and \`glab\` (GitLab CLI) are available. Use the right tool based on the repository provider:
|
|
487
|
+
|
|
488
|
+
- **GitHub repos**: Use \`gh\` — \`gh pr create\`, \`gh issue view\`, \`gh repo clone\`, etc.
|
|
489
|
+
- **GitLab repos**: Use \`glab\` — \`glab mr create\`, \`glab issue view\`, \`glab repo clone\`, etc.
|
|
490
|
+
|
|
491
|
+
Check the task's \`vcsProvider\` field or the repo URL to determine which CLI to use. Key differences:
|
|
492
|
+
| Operation | GitHub (\`gh\`) | GitLab (\`glab\`) |
|
|
493
|
+
|---|---|---|
|
|
494
|
+
| Create PR/MR | \`gh pr create\` | \`glab mr create\` |
|
|
495
|
+
| View PR/MR | \`gh pr view\` | \`glab mr view\` |
|
|
496
|
+
| Review | \`gh pr review\` | \`glab mr approve\` / \`glab mr note\` |
|
|
497
|
+
| Comment on issue | \`gh issue comment\` | \`glab issue note\` |
|
|
498
|
+
| Clone | \`gh repo clone\` | \`glab repo clone\` |
|
|
499
|
+
`,
|
|
500
|
+
variables: [],
|
|
501
|
+
category: "system",
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
registerTemplate({
|
|
505
|
+
eventType: "system.agent.services",
|
|
506
|
+
header: "",
|
|
507
|
+
defaultBody: `
|
|
508
|
+
### External Swarm Access & Service Registry
|
|
509
|
+
|
|
510
|
+
Port 3000 is exposed for web apps or APIs. Use PM2 for robust process management:
|
|
511
|
+
|
|
512
|
+
**PM2 Commands:**
|
|
513
|
+
- \`pm2 start <script> --name <name>\` - Start a service
|
|
514
|
+
- \`pm2 stop|restart|delete <name>\` - Manage services
|
|
515
|
+
- \`pm2 logs [name]\` - View logs
|
|
516
|
+
- \`pm2 list\` - Show running processes
|
|
517
|
+
|
|
518
|
+
**Service Registry Tools:**
|
|
519
|
+
- \`register-service\` - Register your service for discovery and auto-restart
|
|
520
|
+
- \`unregister-service\` - Remove your service from the registry
|
|
521
|
+
- \`list-services\` - Find services exposed by other agents
|
|
522
|
+
- \`update-service-status\` - Update your service's health status
|
|
523
|
+
|
|
524
|
+
**Starting a New Service:**
|
|
525
|
+
1. Start with PM2: \`pm2 start /workspace/myapp/server.js --name my-api\`
|
|
526
|
+
2. Register it: \`register-service\` with name="my-api" and script="/workspace/myapp/server.js"
|
|
527
|
+
3. Mark healthy: \`update-service-status\` with status="healthy"
|
|
528
|
+
|
|
529
|
+
**Updating a Service:**
|
|
530
|
+
1. Update locally: \`pm2 restart my-api\`
|
|
531
|
+
2. If config changed, re-register: \`register-service\` with updated params (it upserts)
|
|
532
|
+
|
|
533
|
+
**Stopping a Service:**
|
|
534
|
+
1. Stop locally: \`pm2 delete my-api\`
|
|
535
|
+
2. Remove from registry: \`unregister-service\` with name="my-api"
|
|
536
|
+
|
|
537
|
+
**Auto-Restart:** Registered services are automatically restarted on container restart via ecosystem.config.js.
|
|
538
|
+
|
|
539
|
+
Your service URL will be: \`https://{{agentId}}.{{swarmUrl}}\` (based on your agent ID, not name)
|
|
540
|
+
|
|
541
|
+
**Health Checks:** Implement a \`/health\` endpoint returning 200 OK for monitoring.
|
|
542
|
+
`,
|
|
543
|
+
variables: [
|
|
544
|
+
{ name: "agentId", description: "The agent's unique identifier" },
|
|
545
|
+
{ name: "swarmUrl", description: "The swarm's base URL for service discovery" },
|
|
546
|
+
],
|
|
547
|
+
category: "system",
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
registerTemplate({
|
|
551
|
+
eventType: "system.agent.artifacts",
|
|
552
|
+
header: "",
|
|
553
|
+
defaultBody: `
|
|
554
|
+
### Artifacts
|
|
555
|
+
|
|
556
|
+
Agents can serve interactive web content (HTML pages, dashboards, approval flows) via public URLs using localtunnel.
|
|
557
|
+
Use the \`/artifacts\` skill for detailed instructions, examples, and API reference.
|
|
558
|
+
Artifact content should be stored in \`/workspace/personal/artifacts/\` (persisted across sessions).
|
|
559
|
+
`,
|
|
560
|
+
variables: [],
|
|
561
|
+
category: "system",
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
// ============================================================================
|
|
565
|
+
// Composite session templates (category: "session")
|
|
566
|
+
// ============================================================================
|
|
567
|
+
|
|
568
|
+
registerTemplate({
|
|
569
|
+
eventType: "system.session.lead",
|
|
570
|
+
header: "",
|
|
571
|
+
defaultBody: `{{@template[system.agent.role]}}
|
|
572
|
+
|
|
573
|
+
{{@template[system.agent.register]}}
|
|
574
|
+
{{@template[system.agent.lead]}}
|
|
575
|
+
{{@template[system.agent.filesystem]}}
|
|
576
|
+
{{@template[system.agent.self_awareness]}}
|
|
577
|
+
{{@template[system.agent.context_mode]}}
|
|
578
|
+
{{@template[system.agent.guidelines]}}
|
|
579
|
+
{{@template[system.agent.system]}}`,
|
|
580
|
+
variables: [
|
|
581
|
+
{ name: "role", description: "The agent's role" },
|
|
582
|
+
{ name: "agentId", description: "The agent's unique identifier" },
|
|
583
|
+
],
|
|
584
|
+
category: "session",
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
registerTemplate({
|
|
588
|
+
eventType: "system.session.worker",
|
|
589
|
+
header: "",
|
|
590
|
+
defaultBody: `{{@template[system.agent.role]}}
|
|
591
|
+
|
|
592
|
+
{{@template[system.agent.register]}}
|
|
593
|
+
{{@template[system.agent.worker]}}
|
|
594
|
+
{{@template[system.agent.filesystem]}}
|
|
595
|
+
{{@template[system.agent.self_awareness]}}
|
|
596
|
+
{{@template[system.agent.context_mode]}}
|
|
597
|
+
{{@template[system.agent.guidelines]}}
|
|
598
|
+
{{@template[system.agent.system]}}`,
|
|
599
|
+
variables: [
|
|
600
|
+
{ name: "role", description: "The agent's role" },
|
|
601
|
+
{ name: "agentId", description: "The agent's unique identifier" },
|
|
602
|
+
],
|
|
603
|
+
category: "session",
|
|
604
|
+
});
|