Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,11 @@ Team files are declarative only: don't add includes, overlays, inheritance, vari

`OrchestrationConfig` and its records are now an internal compile target. Every user-visible fact (a path, a route, an end condition) must have exactly one home in the team file; don't add a team field that duplicates one, and don't add a field that is ignored in some mode — make it a load error instead.

When adding a gate check, add it to `TeamChecks` (name, options, compiled predicates, the sentence agents are told), to the table in `docs/configuration.md#gates`, and to `docs/validators.md`.
When adding a gate check, add it to `TeamChecks` (name, options, compiled predicates, the sentence agents are told, and `Guidance` if it parses a format the agent writes), to the table in `docs/configuration.md#gates`, and to `docs/validators.md`.

`config/examples/` contains runnable examples and `fuseraft init` templates live in `src/Cli/Commands/InitTemplates*.cs`. `InitTemplatesTests` compiles every example and every template, and checks that no agent's instructions name a route it doesn't have. Keep them passing when the schema changes.
`config/examples/` contains runnable examples. Built-in `fuseraft init` templates are plain files in `templates/<name>/` (`template.yaml` + `team.yaml`), embedded in the binary; the engine is `src/Cli/Templates/` (`TemplateLoader`, `TemplateCatalog`, `TemplateRenderer`, `TemplateScaffolder`). Template variables are `{{name}}` and are filled once by `init`; runtime tokens are `{session_id}`-style. Every placeholder and special string is documented in `docs/variables.md`: add a new one there. `BuiltinTemplatesTests` compiles every example and every template, runs the template check on each, and uses `TeamLint` to check that no agent's instructions name a route it doesn't have. Keep them passing when the schema changes.

Don't put tool-use or gate-format rules in a template: tool rules shared by the REPL and orchestration live in `AgentGuidance` (added per plugin by `SystemPromptBuilder.BuildPluginGuidanceBlock`), and a gate that parses what an agent writes carries its format as `CompiledCheck.Guidance`, which `TeamPrompt` prints under "What the checks need".

When adding a new `FailureAction` or `FailureType` value, update:
- `FailureHandlingConfig.cs` (enum + default config + `GetConfig` switch)
Expand Down Expand Up @@ -204,6 +206,7 @@ When adding a new `FailureAction` or `FailureType` value, update:
|----------|--------------|
| How is the next agent selected? | `Steps` flows run on `src/Orchestration/Strategies/StateMachineSelectionStrategy.cs`; patterns on their own orchestrators (see `docs/strategies.md`) |
| How is a team file loaded and compiled? | `src/Cli/Team/` (`TeamConfigLoader`, `TeamCompiler`, `TeamChecks`, `TeamPrompt`) |
| How do `fuseraft init` templates work? | `templates/` (built-ins), `src/Cli/Templates/`, `docs/templates.md`, `docs/variables.md` |
| How does map-reduce work? | `src/Orchestration/MapReduceOrchestrator.cs`, `src/Core/Models/Orchestration/MapReduceConfig.cs` |
| How does scatter-gather work? | `src/Orchestration/ScatterGatherOrchestrator.cs`, `src/Core/Models/Orchestration/ScatterGatherConfig.cs` |
| How does adversarial orchestration work? | `src/Orchestration/AdversarialOrchestrator.cs` |
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ More in the [REPL guide](https://fuseraft.ai/fuseraft-cli/repl/).
`fuseraft run` drives a team of agents defined in YAML. Each one has its own model, instructions and tools, and gates block a handoff until the evidence exists: a brief on disk, the files the agent said it wrote, a passing test run.

```bash
fuseraft init --template pipeline # Planner → Developer → Tester → Reviewer
fuseraft init --template swe # Planner → Developer → Tester → Reviewer, gated on evidence
fuseraft run -c .fuseraft/config/orchestration.yaml "Add JWT auth to the API"
fuseraft run --resume # continue the last unfinished session
```
Expand All @@ -83,7 +83,7 @@ flowchart LR
Reviewer -->|"APPROVED"| Done(["✓ Done"])
```

Teams can run in sequence, as a state machine or graph with parallel branches, under an LLM manager (Magentic), as generator-and-critic pairs, or as map-reduce and scatter-gather fan-outs. Every turn is checkpointed. `fuseraft init --list-templates` shows the other starting points (`solo`, `swe`, `debate`, …).
Teams can run in sequence, as a state machine or graph with parallel branches, under an LLM manager (Magentic), as generator-and-critic pairs, or as map-reduce and scatter-gather fan-outs. Every turn is checkpointed. `fuseraft init --list-templates` shows the other starting points (`solo`, `research`, `debate`, …), and any team you've tuned can become a [template](https://fuseraft.ai/fuseraft-cli/templates/) your whole team starts from.

Start with [Configuration](https://fuseraft.ai/fuseraft-cli/configuration/), [Flows](https://fuseraft.ai/fuseraft-cli/strategies/) and [Gates](https://fuseraft.ai/fuseraft-cli/validators/).

Expand Down
2 changes: 2 additions & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default defineConfig({
label: 'Agent teams',
items: [
{ label: 'Configuration', link: '/configuration/' },
{ label: 'Templates', link: '/templates/' },
{ label: 'Models & Providers', link: '/models/' },
{ label: 'Flows', link: '/strategies/' },
{ label: 'Gates', link: '/validators/' },
Expand Down Expand Up @@ -93,6 +94,7 @@ export default defineConfig({
label: 'Reference',
items: [
{ label: 'CLI Reference', link: '/cli-reference/' },
{ label: 'Variables & Special Strings', link: '/variables/' },
{ label: 'Scripting & Automation', link: '/scripting/' },
{ label: 'Design', link: '/design/' },
],
Expand Down
120 changes: 72 additions & 48 deletions docs/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ fuseraft config --list

## `fuseraft init`

Generate a ready-to-run team file from an interactive wizard or explicit flags.
Write a ready-to-run team file from a [template](templates.md), in a short wizard or with flags.

```
fuseraft init [output] [options]
Expand All @@ -1417,40 +1417,38 @@ fuseraft init [output] [options]

| Argument | Default | Description |
|----------|---------|-------------|
| `[output]` | `.fuseraft/config/orchestration.yaml` | Path to write the generated config. |
| `[output]` | `.fuseraft/config/orchestration.yaml` | Where to write the team file. The template's other files (such as `agents/*.md`) go next to it. |

**Options**

| Flag | Default | Description |
|------|---------|-------------|
| `-t, --template <name>` | interactive | Team template to use. See templates below. |
| `-m, --model <id>` | auto-detected | Model ID to use for all agents. Auto-detected from your API keys if omitted. |
| `-e, --endpoint <url>` | `~/.fuseraft/config` | Provider API endpoint URL. Defaults to the endpoint saved in `~/.fuseraft/config` if present. At run time, agents without an explicit `endpoint` also inherit this value automatically. |
| `-t, --template <name\|path>` | interactive; `swe` with `--no-interactive` | A template name (see `--list-templates`), or the path to a template folder or a team file. |
| `-m, --model <id>` | auto-detected | The `{{model}}` variable. Auto-detected if omitted (see below). |
| `-e, --endpoint <url>` | `~/.fuseraft/config` | The `{{endpoint}}` variable: the provider URL. Defaults to the endpoint saved in `~/.fuseraft/config`. When it's empty, the template's `endpoint:` lines are left out. |
| `--var <name=value>` | — | Set a template variable. Repeat for each one. The wizard asks for any you leave out; with `--no-interactive`, a required one you leave out is an error. |
| `--no-interactive` | off | Skip all prompts and generate with the supplied options and defaults. |
| `--no-boilerplate` | off | Skip `architecture.yaml` and `knowledge/lifecycle.yaml` — for small or single-purpose projects that won't use `fuseraft arch check` or `fuseraft knowledge gc`. |
| `-f, --force` | off | Overwrite the config and all agent files without prompting, even if they already exist. |
| `--list-templates` | off | List the templates and exit. |
| `-f, --force` | off | Overwrite the team file and every file the template writes without prompting, even if they already exist. |
| `--list-templates` | off | List the templates (built-in, yours and the project's) and exit. |
| `--json` | off | Print one JSON object naming the files written, or the templates with `--list-templates` (see [Wire Protocol](protocol.md#resource-queries)). Implies `--no-interactive`. |

**Overwrite behavior**
**Checked before writing**

Before writing anything, `init` checks whether the config file or any of its agent files (`agents/*.yaml`) already exist. If any do, it lists every conflicting path and asks for confirmation — declining, or passing `--no-interactive` without `--force`, aborts with no files written. Pass `--force` to skip the check and overwrite everything unconditionally, including any hand-edited agent files.
`init` renders every file in memory and loads the result exactly as `fuseraft run` would before it writes anything. An unknown `{{variable}}` or a team that doesn't load is an error, and leaves the disk untouched. Then, if any file it would write already exists, it lists them and asks for confirmation; declining, or `--no-interactive` without `--force`, aborts with nothing written.

**Templates**

| Template | Description |
|----------|-------------|
| `solo` | Single capable agent with file and shell tools and lossless compaction — the right starting point for simple tasks |
| `pipeline` | Planner → Developer → Tester → Reviewer as a directed graph; investigation tooling on Developer and Tester; no evidence contracts — use `swe` for production work |
| `swe` | Full SWE pipeline: Preflight → Planner → PlannerCritic → Developer → Tester → Reviewer with evidence contracts, a periodic Verifier, adaptive ContextBudget, and lossless compaction |
| `greenfield` | Preflight → Planner → Developer → Tester → Reviewer, tuned for new projects: no PlannerCritic or Verifier, a Planner with greenfield rules (manifest required, smoke-test `verify_command`), and a Tester that re-runs after each Developer fix |
| `brownfield` | Archaeology-first pipeline as a directed graph: Archaeologist recons the codebase once, then Planner → Developer → Reviewer; Reviewer routes to Developer (REVISION REQUIRED) or Planner (REPLAN REQUIRED) |
| `research` | Researcher gathers cited findings → Critic adversarially reviews for gaps and unsupported claims → Writer synthesises the final document |
| `data` | DataEngineer fetches and structures raw data → Analyst computes findings → Reporter synthesises a final document; contracts prevent fabricated analysis |
| `devops` | OpsPlanner writes an ops plan with `rollback_command` → Executor runs steps → Verifier health-checks; Verifier can trigger a rollback cycle if checks fail |
| `debate` | Decision-focused adversarial pipeline: Proposer argues a position → Challenger critiques adversarially → Moderator synthesises a structured final verdict |
| `audit` | Auditor scans for security / quality / compliance issues → Prioritizer triages by severity → Developer fixes with hypothesis tracking → Verifier confirms |
| `magentic` | AI-managed team: a manager LLM plans and coordinates five specialist workers (Researcher, Planner, Developer, Tester, Critic) dynamically; user approves the plan before execution |
| `solo` | One agent with file and shell tools. The right start for simple tasks, scripts and one-shot jobs. |
| `swe` | Preflight → Planner → PlannerCritic → Developer → Tester → Reviewer, every handoff gated on evidence, with a periodic Verifier and lossless compaction. |
| `brownfield` | An Archaeologist maps an existing codebase and its conventions once, then Planner → Developer → Reviewer work inside them. |
| `research` | Researcher gathers cited findings → Critic reviews them for gaps → Writer produces the final document. |
| `debate` | Proposer argues a position → Challenger attacks it → Moderator writes the verdict. |
| `magentic` | A manager model plans the work and coordinates five specialists dynamically; you approve the plan first. |

Your own templates and the project's (`.fuseraft/templates/`) appear alongside these, and can replace one by using its name. See [Templates](templates.md) to write and share one, and [`fuseraft templates`](#fuseraft-templates) to manage them. `pipeline`, `greenfield`, `data`, `devops` and `audit` were retired; asking for one says what to use instead.

**Model auto-detection**

Expand All @@ -1470,50 +1468,29 @@ If no key is set, `gpt-4o` is used as the fallback default.
**Examples**

```bash
# Interactive wizard (prompts for template, model, provider URL, and output path)
# Interactive wizard (template, model, provider URL, the template's own variables, output path)
fuseraft init

# Write to a custom path
fuseraft init .fuseraft/config/my-team.yaml

# Single agent — simplest starting point
fuseraft init --template solo
fuseraft init --template solo --no-interactive

# Standard dev pipeline (graph) — no evidence contracts
fuseraft init --template pipeline --model claude-sonnet-4-6

# Full SWE pipeline — evidence contracts, periodic Verifier
# Full SWE pipeline on a chosen model and provider
fuseraft init --template swe --model claude-sonnet-4-6
fuseraft init .fuseraft/config/swe.yaml --template swe --model claude-sonnet-4-6

# Brownfield codebase — Archaeologist recons first, then plan → implement → review
fuseraft init --template brownfield
fuseraft init --template brownfield --model claude-sonnet-4-6 --endpoint https://api.anthropic.com

# Research pipeline — Researcher → Critic → Writer
fuseraft init --template research --model claude-sonnet-4-6

# Data analysis pipeline — DataEngineer → Analyst → Reporter
fuseraft init --template data

# Infrastructure and deployment with rollback
fuseraft init --template devops
# A template folder, with its own variables
fuseraft init --template ./review-team --var ticket=SHOP-12 --var testCommand="pytest -q"

# Adversarial deliberation for decisions and design reviews
fuseraft init --template debate

# Security / quality / compliance audit
fuseraft init --template audit --model claude-sonnet-4-6

# AI-managed Magentic team
fuseraft init --template magentic
fuseraft init .fuseraft/config/magentic-team.yaml --template magentic --model gpt-4o
# Start from an example team file
fuseraft init --template config/examples/research-team.yaml

# CI / scripted usage
fuseraft init .fuseraft/config/ci-team.yaml --template swe --model gpt-4o --no-interactive

# Regenerate an existing config and agent files without prompting
# Regenerate without prompting
fuseraft init --template swe --model claude-sonnet-4-6 --no-interactive --force
```

Expand Down Expand Up @@ -2487,6 +2464,53 @@ The second terminal sees the same `agent_starting`/`tool_calling` progress live,

---

## `fuseraft templates`

Manage the templates `fuseraft init` writes from. See [Templates](templates.md) for the format.

### `fuseraft templates list`

```
fuseraft templates list [--json]
```

Lists every template `init` can use: the project's (`.fuseraft/templates/`), yours (`~/.fuseraft/templates/`) and the built-ins, with each one's source and variables. Notes any template hidden by another of the same name, and any that failed to load. `--json` prints the same list as `init --list-templates --json`.

### `fuseraft templates validate`

```
fuseraft templates validate [template]
```

| Argument | Default | Description |
|----------|---------|-------------|
| `[template]` | `.` | A template name, or the path to a template folder or team file. |

Renders the template with sample values, with and without an endpoint, and loads the result as `fuseraft run` would. Writes nothing. Exits 1 on an error (an unknown variable, a team that doesn't load); warns about routes an agent is told to take but doesn't have, unused variables, and a template that never uses `{{model}}`.

### `fuseraft templates add`

```
fuseraft templates add <path> [--project] [--force]
```

| Flag | Description |
|------|-------------|
| `--project` | Install into `.fuseraft/templates/` to share it through the repo, instead of `~/.fuseraft/templates/`. |
| `-f, --force` | Replace an installed template of the same name. Files the new version dropped are removed. |

Checks a template folder as `validate` does, then copies it (without `.git/`) under its name. Installing one with a built-in's name replaces that built-in for you, or for the project.

### `fuseraft templates remove`

```
fuseraft templates remove <name> [--project]
```

Deletes an installed template; `--project` removes the project's copy. Built-ins can't be removed.

---

## `fuseraft skills`

Install, list, remove, and validate global skills available to all agent sessions. Skills are stored in `~/.fuseraft/skills/` and registered in an FTS5 search index so fuseraft can automatically identify which ones are relevant to a given task.
Expand Down
9 changes: 6 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ An agent with no `model` uses your default model from `~/.fuseraft/config`. See

The schema describes the camelCase spelling. `fuseraft validate` remains the full check: it also catches what a schema can't, such as a flow naming an agent that isn't declared.

**Team files are data, not code.** There are no includes, overlays, variables or expressions, so every team file reads the same way and its handoff gates can always be checked before a run starts. To share an agent between teams, give it its own [markdown file](#agent-files). If you need logic (one team per environment, generated agent lists), write a script in any language that produces the team file, and check the result with `fuseraft validate`.
**Team files are data, not code.** There are no includes, overlays, variables or expressions, so every team file reads the same way and its handoff gates can always be checked before a run starts. (A [template](templates.md) has `{{variables}}`, but `fuseraft init` fills them all in once; the team file it writes has none. The `{session_id}` and `${ENV_VAR}` tokens the runtime expands are listed in [Variables & Special Strings](variables.md).) To share an agent between teams, give it its own [markdown file](#agent-files). If you need logic (one team per environment, generated agent lists), write a script in any language that produces the team file, and check the result with `fuseraft validate`.

---

Expand Down Expand Up @@ -87,7 +87,7 @@ artifacts:

| Field | Required | Description |
|-------|----------|-------------|
| `path` | yes | File path, relative to the working directory. `{project_slug}` and `{session_id}` are expanded at run time. |
| `path` | yes | File path, relative to the working directory. `{project_slug}` and `{session_id}` are expanded at run time ([all tokens](variables.md#runtime-tokens-name)). |
| `shape` | no | A sketch of the JSON the file must hold. Gates that name the artifact check the file against it. |

**Shape syntax**
Expand Down Expand Up @@ -154,7 +154,10 @@ agents:
fuseraft appends a **Team protocol** section to every agent's instructions, built from the team file:

- each artifact the agent reads or writes, with its path, and the shape it must write;
- for agents in a `steps` flow, the routes it may hand off on, when to take each one, and the checks fuseraft runs before letting it through.
- for agents in a `steps` flow, the routes it may hand off on, when to take each one, and the checks fuseraft runs before letting it through;
- for a gate that reads what the agent writes (`reviewJudgement`, and `testReport` with `hasAssertions`), the exact format it needs.

Agents also get short rules for the tools they have: how to read files efficiently with `FileSystem` (the same rule the REPL follows), and when to use `SessionContext` and `Subagent`.

Don't repeat any of that in `instructions`. Write about the work itself.

Expand Down
Loading