Skip to content

Swarm agent workflow prompt and template changes #561

@acreeger

Description

@acreeger

Summary

Add swarm-specific template variables and workflow modifications to issue-prompt.txt so that agents running in swarm mode create PRs targeting the epic branch, skip merging (supervisor handles it), and close the issue via API.

Context

Part of the Autonomous Swarm Mode epic (#557). When il spin -p runs inside a swarm, the agent needs different behavior than the standard issue workflow: it targets the epic branch instead of main, creates a PR but doesn't merge, and closes the issue after PR creation.

Scope

New Template Variables

Add to IgniteCommand template variable building (in buildTemplateVariables()):

  • SWARM_MODE (boolean) — true when running as a swarm agent
  • EPIC_BRANCH (string) — the epic's integration branch name (e.g., issue-42-swarm-mode)
  • EPIC_ISSUE_NUMBER (string) — the parent epic's issue number

These should be passed via CLI flags or environment variables from the supervisor to il spin.

Prompt Template Changes (issue-prompt.txt)

Add a swarm-mode section (Handlebars conditional):

{{#if SWARM_MODE}}
## Swarm Mode Instructions

You are running as an autonomous swarm agent. Follow these specific rules:

1. **PR Target**: Create your PR targeting the `{{EPIC_BRANCH}}` branch, NOT main.
2. **Do NOT merge**: Create the PR but do not merge it. The supervisor handles merges sequentially.
3. **Close the issue**: After creating the PR, close issue #{{ISSUE_NUMBER}} via the issue management MCP tool with a comment linking to the PR.
4. **No review phase**: Skip the review step (already forced by -p flag).
5. **Be concise**: Minimize token usage. Focus on implementation, not explanation.
{{/if}}

Todo List Updates

Add swarm-specific todo items when SWARM_MODE is true:

  • Adjusted step for PR creation (target epic branch)
  • Remove merge step
  • Add issue closing step

CLI/Environment Passing

The supervisor needs to pass swarm context to il spin. Options:

  • Environment variables: ILOOM_SWARM_MODE=1, ILOOM_EPIC_BRANCH=..., ILOOM_EPIC_ISSUE=...
  • Or CLI flags on il spin: --swarm-mode --epic-branch <branch> --epic-issue <number>

Prefer environment variables (simpler, no CLI changes needed on spin).

Acceptance Criteria

  • SWARM_MODE, EPIC_BRANCH, EPIC_ISSUE_NUMBER template variables work in issue-prompt.txt
  • Agent creates PR targeting epic branch when in swarm mode
  • Agent does NOT attempt to merge the PR
  • Agent closes the issue after PR creation
  • Non-swarm mode is completely unaffected
  • Unit tests verify template variable substitution

Scope Boundaries

  • Does NOT modify the supervisor or spawn logic
  • Does NOT change the non-swarm agent workflow
  • Only touches: issue-prompt.txt, IgniteCommand (template vars), possibly cli.ts (env var reading)

Dependencies

None — this is an independent template/prompt change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions