Architecture / MVP

Repository layout

One repository and one Go module, arranged so that any top-level component can later become its own module or move to its own repository.

View .md

For the MVP, Convoy is one repository, github.com/convoyharness/convoy, with one Go module of the same path, so every change lands in one commit and nothing has to be tagged in order. Import paths are standard GitHub paths; there is no custom import domain. The layout is designed so that any top-level component can later become its own Go module inside this repository, which keeps its import path, or move to its own repository, public or private, which changes it. See Moving a component out.

Layout

Text
convoy/                         one go.mod: module github.com/convoyharness/convoy
  dsl/                          everything that understands a .cvy file
    config/                     the swarm types, re-exported by dsl
    parse/ decode/ eval/ graph/ validate/ bundle/ prices/
    manifest/                   provider type manifests and the three built-in types
    types/                      type expressions as text
    hcldiags/                   diagnostics and their renderer (public)
    internal/{dag,hclfuncs,didyoumean}
    spec/                       REFERENCE.md and tools.json, generated
  api/                          wire types for the HTTP API and the start file
    client/                     Go client for the HTTP API
    contract/                   golden JSON the runner tests against
  sdk/
    proc/                       the process Backend interface
      proctest/                 a fake backend for tests
  cli/                          the convoy command; cli.Main is its only export
    internal/{commands,goalgen,render,examples}
  server/                       convoyd; server.Run is its only export
    internal/{httpapi,store,board,controller,overseer,proclocal,providers}
    internal/{clock,spec,runcfg}
  cmd/convoy/main.go            calls cli.Main
  cmd/convoyd/main.go           parses flags, calls server.Run
  runner/                       the Python runner and plugin SDK, with its own pyproject.toml
  examples/                     the sample swarms, a reference provider plugin, and the Commit0 acceptance tooling
  website/                      this site
  boundaries_test.go            enforces rule 1
  contracts_test.go             checks the runner's and the website's contract copies (rule 2)
  examples_test.go              loads examples/ and the CLI's examples with dsl.Load
  integration_test.go           convoyd with the real Python runner and its fake driver
  integration_providers_test.go a preset and a driver plugin, pushed and run end to end

Three rules

Rule 1: dependencies point only toward what could be public

A public repository cannot depend on a private one. So the packages that could be published sit at the bottom of the import graph, and the ones that might stay private sit at the top.

Package treeMay import (inside Convoy)Third-party dependencies
dsl/...nothing outside dsl/hcl/v2, go-cty, afero, go-versions (provider version constraints), and the extractions’ small dependencies
api/...dsl/bundle, dsl/hcldiagsstandard library only
sdk/...nothingstandard library only
cli/...dsl, apiurfave/cli/v3, the two model SDKs
server/...dsl, api, sdkSQLite, the MCP SDK
cmd/convoycli
cmd/convoydserver
runner/no Go code; wire contracts onlyPython packages

cli and server never import each other. Whatever is later kept closed is at the top of the graph, so extracting a component never forces something private into the open.

boundaries_test

boundaries_test.go at the repository root enforces the table. It runs go list -deps -json ./... and fails on any github.com/convoyharness/convoy/... import not allowed above, and on any new third-party dependency of dsl, api or sdk that is not in its allowlist.

Rule 2: every seam is a public Go package or a versioned wire contract

No component reaches into another’s internals. A component that consumes a contract file (the runner) keeps a copy of it, not a path into another component’s tree. contracts_test.go fails when a copy differs from its source, and make contracts refreshes the copies. The full list of seams is on Seams and contracts.

Rule 3: each component has its own internal/

There is no repository-wide internal/ directory. Each component’s private code is under its own internal/ (cli/internal/, server/internal/, dsl/internal/), so Go’s internal rule stops one component from importing another’s private packages without any tooling. cli and server each export one entry point, which cmd/ calls.

Tests follow the same boundary: a package’s tests read only files under its own directory. Tests that need files from several components (examples_test.go, contracts_test.go, and convoyd’s end-to-end test in server/) say so and sit at the root or with the component that puts the others together.

Moving a component out

There are two steps, taken separately and only when needed:

  • Its own module, same repository. Add a go.mod at the component root (for example module github.com/convoyharness/convoy/dsl) and tag it with the directory prefix (dsl/v0.1.0). The import path does not change, so no consumer notices. This is enough to version a component independently.
  • Its own repository. Needed to make a component public while the rest stays private, or the reverse. The import path changes to the new repository’s path. Before anything outside Convoy imports the component, that is a find-and-replace. After, it is a breaking change for those importers, so do it before the first outside user if possible.

Moving to a new repository:

  1. git filter-repo --path <component>/ creates the new repository with that directory’s history only. Commit messages travel with it, so write commits that touch dsl/, api/, sdk/, cli/ or runner/ as if they were already public.
  2. Add a go.mod with the new path (for example module github.com/convoyharness/dsl), tag v0.x.0, and replace the directory in this repository with a require of that version.
  3. Rewrite imports from github.com/convoyharness/convoy/<component> to the new path, here and in any outside project. For a private repository, consumers set GOPRIVATE=github.com/convoyharness/<repo> and authenticate to git.
  4. Move any copied contract files the component consumed into its own tree, and keep the boundaries table as the new repository’s dependency rule.

Likely order: sdk/proc first, when the first out-of-tree sandbox backend is written; dsl when an outside tool, such as an editor plugin or a module registry, needs it. Until a component has an outside consumer, it stays here.

Packages extracted from OpenTofu

Convoy’s language is HCL, and OpenTofu already solved several of the problems around it. Four packages are taken from it. All sit under dsl/ as packages of that module, not separate modules, until an outside project needs one.

PackageOrigin in OpenTofuWhat it is
dsl/hcldiagsinternal/tfdiags and the diagnostic renderer from internal/command/formatDiagnostics with source ranges, severity, and terminal rendering with code snippets. Public, because dsl returns these types and the CLI and server render them
dsl/internal/daginternal/dagDirected acyclic graph: vertices, edges, cycle detection, topological order, parallel walk
dsl/internal/hclfuncsinternal/lang/funcs (a subset) and the table in internal/lang/functions.goThe expression functions available in .cvy files
dsl/internal/didyoumeaninternal/didyoumeanName suggestions for typos in block names and attributes

Each keeps OpenTofu’s MPL-2.0 license and per-file headers, with a LICENSE and a NOTICE file in the package directory naming the origin commit. MPL-2.0 is file-scoped, so new files in those packages and everything else in the repository can be under any license.

Shared conventions

  • Go 1.25 or newer (hcl/v2 v2.25 requires it). The module pins hcl/v2 v2.25 and go-cty v1.19, the versions OpenTofu pins today.
  • Every error shown to a person is a diagnostic with a source range when one exists. Plain error values never reach the terminal.
  • Identifiers in the DSL match ^[a-zA-Z_][a-zA-Z0-9_]*$. Agent instance names add a bracketed key: researcher[nvidia].
  • JSON on the wire uses snake_case keys. Timestamps are RFC 3339 in UTC. Durations are Go duration strings.
  • Every HTTP error body is {"error": {"code": "<snake_case>", "message": "<text>"}}.
Last updated 2026-11-05
esc
    ↑↓ to move · ↵ to open
    Menu
    Get started
    IntroductionInstallQuickstartYour first swarm
    Concepts
    Swarms and runsAgents and turnsTopics and the boardThe overseerSpawning agentsBudgets and limits
    DSL
    Language rulesswarmprovidertopicagentReferences and functionsValidation rules
    Providers
    Provider typesUsing a provider typeWriting a provider type
    CLI
    Overviewconvoy goalconvoy validateconvoy runconvoy statusconvoy watchconvoy sayconvoy stopconvoy uiconvoy provider
    Runtime
    convoydControllerMessage boardRunnerSwarm tools (MCP)Web UIDurability
    Architecture
    OverviewRepository layoutSeams and contractsHTTP API
    Examples
    OverviewWriter and criticResearch teamCode teamPaperBench replicationCommit0 libraryVending-BenchSWE-Lancer bountyτ²-bench loop
    Inspiration
    What we borrowedThe harness landscape