# Swarm-Forge Agent Backends: Supporting Claude, Codex, Copilot, and Grok for Different Roles

> Discover Swarm-Forge agent backends supporting Claude, Codex, Copilot, and Grok. Configure LLM providers for different roles easily in your .swarmforge/roles.tsv file.

- Repository: [Robert C. Martin/swarm-forge](https://github.com/unclebob/swarm-forge)
- Tags: deep-dive
- Published: 2026-08-08

---

**Swarm-Forge supports all four major LLM providers—Claude, Codex, Copilot, and Grok—allowing each role to specify its backend via the `.swarmforge/roles.tsv` configuration file.**

Swarm-Forge is an agent orchestration framework that assigns specific **agent backends** to distinct roles such as `coder`, `cleaner`, and `reviewer`. According to the `unclebob/swarm-forge` source code, the system treats backend selection as a configurable property, enabling teams to route tasks to OpenAI Codex, xAI Grok, Anthropic Claude, or GitHub Copilot based on workload requirements.

## Supported Agent Backends for Swarm-Forge Roles

The repository's test suite validates that **Codex** and **Grok** are fully operational, while the architecture is designed to accept **Claude** and **Copilot** without modification.

### Codex (OpenAI)

In `test/swarmforge/script_test.clj` at line 68, the test suite verifies Codex integration for the `coder` role:

```clojure
"...\tCoder\tcodex\ttask\n"

```

Line 69 demonstrates a `cleaner` role also using Codex but in `batch` mode:

```clojure
"...\tCleaner\tcodex\tbatch\n"

```

### Grok (xAI)

Grok support is validated through specific test cases including `grok-launch-command-passes-initial-prompt` and `grok-launch-command-uses-bypass-permissions-with-always-approve`. The tests confirm that Grok receives the `--cwd` flag for directory context (see `script_test.clj` lines 231‑233).

### Claude and Copilot

While the current test harness focuses on Codex and Grok, `handoff_lib.bb` accepts any string value for the backend parameter. The [`swarmforge/handoff-protocol.md`](https://github.com/unclebob/swarm-forge/blob/main/swarmforge/handoff-protocol.md) specification confirms that `claude` and `copilot` are valid backend identifiers ready for use in production roles.

## How Role-Backend Assignment Works

Swarm-Forge maps roles to backends through a tab-separated values file located at `.swarmforge/roles.tsv`. Each row defines seven columns:

```

<role-id>    <worktree-name>    <root-path>    <session-type>    <Role-display-name>    <backend>    <mode>

```

The **backend** column accepts literal strings: `codex`, `grok`, `claude`, or `copilot`. The **mode** column specifies execution style: `task` for single-turn requests or `batch` for multi-turn workflows.

When `handoff_lib.bb` processes a role, it extracts these values and constructs a launch command:

```bash
swarmforge.sh window <role> <backend> <worktree>

```

## Configuring Backends in the Roles TSV File

To assign a specific LLM to a role, edit `.swarmforge/roles.tsv` using tab separation:

```tsv
coder    swarmforge-coder    /path/to/project    session    Coder    codex    task
reviewer    swarmforge-reviewer    /path/to/project    session    Reviewer    claude    batch
assistant    swarmforge-assistant    /path/to/project    session    Assistant    copilot    task

```

For Grok-specific roles, ensure the launcher receives the working directory context:

```tsv
architect    swarmforge-arch    /path/to/project    session    Architect    grok    batch

```

## Launching Agents with Specific Backends

The `swarmforge/scripts/swarmforge.bb` launcher receives the backend identifier as an argument and delegates to the appropriate provider-specific launch script. For Grok-backed roles, the launch command validation confirms the presence of the `--cwd` flag pointing to the worktree root.

Example invocation for a Grok-backed coder role:

```bash
swarmforge.sh window coder grok master

```

This executes Grok with the initial prompt and bypass permissions configured for the `master` worktree context.

## Summary

- Swarm-Forge supports **four agent backends**: Claude, Codex, Copilot, and Grok.
- Backend assignment occurs in `.swarmforge/roles.tsv` via the sixth column.
- **Codex** and **Grok** are explicitly tested in `test/swarmforge/script_test.clj`.
- **Claude** and **Copilot** are architecturally supported through the string-based backend parameter in `handoff_lib.bb`.
- Execution modes (`task` vs `batch`) determine whether the agent runs single-turn or multi-turn workflows.
- Adding new providers requires only updating the launch scripts to recognize the backend name string.

## Frequently Asked Questions

### How do I configure a role to use Claude instead of Codex?

Edit `.swarmforge/roles.tsv` and change the sixth column from `codex` to `claude`. Ensure the columns are tab-separated. The `handoff_lib.bb` library will pass the string `claude` to the launcher without requiring code changes.

### What is the difference between task and batch modes?

The **mode** column in the roles TSV determines workflow style. `task` mode executes a single-turn request suitable for quick code generation, while `batch` mode enables multi-turn conversations for complex refactoring or review sessions.

### Where are the backend launch commands validated?

Validation occurs in `test/swarmforge/script_test.clj`, which verifies that Codex receives standard parameters and Grok includes the `--cwd` flag (lines 231‑233). The `test/swarmforge/handoff_test.clj` file validates TSV parsing and backend column extraction.

### Can I add a custom LLM provider beyond the four supported backends?

Yes. Because `handoff_lib.bb` treats the backend as an opaque string, you can add any provider name to the TSV file. You must update [`swarmforge.sh`](https://github.com/unclebob/swarm-forge/blob/main/swarmforge.sh) or `swarmforge.bb` to recognize the new backend string and invoke the appropriate launch command for that provider.