multiagent

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package multiagent implements specialist sub-agent task execution. Each task is processed through three sequential passes:

  1. Architect — designs the approach
  2. Coder — implements the design
  3. Reviewer — critiques the implementation

Index

Constants

View Source
const ArchitectSystemPrompt = `` /* 767-byte string literal not displayed */

ArchitectSystemPrompt is the system prompt for the architect sub-agent. The architect designs the technical approach without writing implementation code.

View Source
const CoderSystemPrompt = `` /* 594-byte string literal not displayed */

CoderSystemPrompt is the system prompt for the coder sub-agent. The coder receives the architect's design and produces the full implementation.

View Source
const ReviewerSystemPrompt = `` /* 890-byte string literal not displayed */

ReviewerSystemPrompt is the system prompt for the reviewer sub-agent. The reviewer critiques the implementation and confirms or overrides the signal.

Variables

This section is empty.

Functions

func WriteArtifacts

func WriteArtifacts(workDir string, task *pm.Task, res *Result) (string, error)

WriteArtifacts persists the three sub-agent outputs as text files under .cloop/tasks/<id>-<slug>-multiagent/ and returns the relative directory path.

Types

type Result

type Result struct {
	ArchitectOutput string
	CoderOutput     string
	ReviewerOutput  string
	// Signal is the final task signal extracted from the reviewer's output,
	// falling back to the coder's signal. One of TASK_DONE, TASK_FAILED, TASK_SKIPPED.
	Signal      pm.TaskStatus
	ArtifactDir string // relative path of the per-task artifact directory
}

Result holds the outputs of all three sub-agent passes plus the final signal.

func RunTask

func RunTask(
	ctx context.Context,
	prov provider.Provider,
	model string,
	timeout time.Duration,
	task *pm.Task,
	goal string,
	instructions string,
	projectContext string,
) (*Result, error)

RunTask executes a single PM task through the three-pass multi-agent pipeline (architect → coder → reviewer) and returns the combined result.

Each pass uses its own system prompt from roles.go. The coder receives the architect's output as context, and the reviewer receives both prior outputs. Sub-agent responses are stored as artifact files under .cloop/tasks/<id>-<slug>-multiagent/{architect,coder,reviewer}.txt.

Two stability bounds protect the pipeline:

  • ctx.Err() is checked between passes so a cancelled parent (Ctrl+C translated to cancel, or the orchestrator's per-task watchdog firing) bails before the next pass instead of running the full architect→coder →reviewer chain — each pass can run for many minutes, so an unbounded pipeline ignores cancellation for tens of minutes after the user asked it to stop.
  • Each prov.Complete call is wrapped in panic recovery so a panic inside a provider implementation (e.g. nil-pointer in a third-party SDK, malformed JSON deref) becomes a returned error instead of taking down the orchestrator and losing every other queued task.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL