LevelCode

Agent Swarms

Agent Swarms let you spin up a coordinated team of AI agents that work together on complex tasks. A team lead agent delegates work to specialized teammates, each with a defined role and their own working context.

Quick Start

1. Enable Swarm Features

/team:enable

Or set swarmEnabled: true in your LevelCode settings.

2. Create a Team

/team:create

You will be prompted for a team name and description. LevelCode creates a shared workspace on disk where team state, tasks, and messages are stored.

3. Spawn Agents

Once a team exists, the lead agent can spawn teammates using the spawn_agents tool. Each agent gets a role, a model, and an isolated working directory. Agents communicate through a file-based message protocol and coordinate through shared tasks.

4. Assign Work

Create tasks with the task_create tool and assign them to team members. Agents pick up tasks, mark them in-progress, and report back when done.

5. Monitor Progress

/team:status

View the current phase, member list, and task summary at any time.

Slash Commands

CommandDescription
/team:createCreate a new team with a name and description
/team:deleteDelete the current team and clean up resources
/team:statusShow team overview including members, phase, and tasks
/team:phaseSet the current development phase
/team:enableEnable swarm features in settings
/team:disableDisable swarm features
/team:membersList all members with their roles and current status

Role Reference

Every agent on a team has a role that defines its responsibilities. Roles range from leadership positions that coordinate work to specialists that focus on a single concern.

Leadership Roles

RolePurpose
coordinatorTop-level orchestrator. Manages the team, assigns tasks, and drives phases forward.
ctoTechnical strategy and architecture decisions.
vp-engineeringEngineering process and cross-team coordination.
directorOversees a group of managers and their teams.
managerManages a subset of engineers, handles task breakdown.
sub-managerAssists a manager with a smaller scope.
product-leadOwns product requirements and prioritization.

Engineering Roles

RolePurpose
fellowDeep technical expertise. Advises on the hardest problems.
distinguished-engineerSenior technical leadership across the codebase.
principal-engineerDrives architecture and cross-cutting concerns.
senior-staff-engineerLeads large features end-to-end.
staff-engineerOwns significant subsystems.
super-seniorHighly experienced engineer handling complex tasks.
senior-engineerCore implementation work with mentoring responsibilities.
mid-level-engineerSolid implementation work on well-defined tasks.
junior-engineerHandles smaller, scoped tasks with guidance.
internLearning-oriented tasks with close supervision.
apprenticeIntroductory tasks under direct mentorship.

Specialist Roles

RolePurpose
researcherInvestigates solutions, reads docs, explores options.
scientistData analysis, experimentation, and technical research.
designerUI/UX design, component architecture, and visual concerns.
testerWrites and runs tests, validates correctness.
reviewerCode review, quality gates, and standards enforcement.

Development Phases

Teams progress through a linear sequence of development phases. Each phase unlocks additional tools and signals the maturity of the project.

Phase Lifecycle

PhaseDescriptionAvailable Team Tools
planningDefine goals, architecture, and task breakdown. No implementation yet.task_create, task_update, task_get, task_list
pre-alphaCore scaffolding begins. Team communication enabled.Above + send_message, team_create
alphaActive feature development and integration.All tools including team_delete, spawn_agents, spawn_agent_inline
betaStabilization, testing, and bug fixes.All tools
productionCode is production-ready and deployed.All tools
matureOngoing maintenance and incremental improvements.All tools

Phases advance forward one step at a time. Use /team:phase to move to the next phase.

Important: Non-team tools (file reads, edits, shell commands) are always available regardless of phase. Only the team-specific collaboration tools listed above are gated.

Team Tools

These tools are available to agents within a team context:

ToolDescription
team_createCreate a new team with configuration
team_deleteDisband the current team
spawn_agentsLaunch new agent teammates with specified roles
spawn_agent_inlineSpawn a single agent with inline configuration
send_messageSend a direct message or broadcast to teammates
task_createCreate a new task with subject, description, and metadata
task_getRetrieve full details of a task by ID
task_updateUpdate task status, owner, dependencies, or description
task_listList all tasks with filtering by status

Message Protocol

Agents communicate through a file-based message protocol. Message types include:

  • Direct messages -- One agent sends a message to a specific teammate.
  • Broadcasts -- A message sent to every member of the team.
  • Shutdown requests -- A lead asks an agent to gracefully stop.
  • Plan approvals -- Agents with plan_mode_required submit plans for review before proceeding.
  • Task completed -- Automatic notification when an agent finishes a task.
  • Idle notifications -- Agents signal they are ready for more work.

Messages are delivered asynchronously through each agent's inbox and polled during the agent's runtime loop.

Configuration

Team Settings

When creating a team, you can configure:

  • maxMembers -- Maximum number of agents allowed on the team (default varies by plan).
  • autoAssign -- When true, idle agents automatically pick up pending tasks.

Agent Settings

Each spawned agent has:

  • role -- One of the roles listed above.
  • model -- The AI model to use for that agent.
  • cwd -- The working directory for the agent's file operations.

Enabling/Disabling

Swarm features are controlled by the swarmEnabled setting. Toggle it with:

/team:enable # Turn on
/team:disable # Turn off

When disabled, all team slash commands and tools are hidden from the interface.

Example Workflow

Here is a typical workflow for a feature build:

  1. Planning phase -- The lead creates tasks describing the work to be done.
  2. Advance to pre-alpha -- /team:phase moves to pre-alpha, enabling messaging.
  3. Advance to alpha -- /team:phase moves to alpha, unlocking agent spawning.
  4. Spawn the team -- The lead spawns agents: a senior engineer for implementation, a tester for validation, and a researcher for dependency investigation.
  5. Work in parallel -- Each agent picks up tasks, works independently, and sends messages when blocked or finished.
  6. Advance through beta and production -- As work stabilizes, the lead advances phases, signaling the shift from feature work to hardening and release.
  7. Teardown -- /team:delete cleans up the team when the project is complete.

Tips

  • Start small. A team of 2-3 agents is easier to coordinate than a large swarm.
  • Use the planning phase to think through task breakdown before spawning agents.
  • Assign clear, well-scoped tasks. Agents work best when they know exactly what to do.
  • Use send_message for targeted communication rather than broadcast to reduce noise.
  • Monitor progress with /team:status and /team:members regularly.