playbook

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package playbook defines Fort's reusable, deterministic agent pipelines. Resolution is a pure function of an explicit override, an explicit task type, or fixed text rules. It never calls a model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(r ResolvedRoute) graph.Flow

Compile converts a resolved route into the restricted graph subset used by playbooks: sequential task stages and, when requested, one human plan gate after the first stage. Resolution/validation happens before compilation.

func Validate

func Validate(c Catalog) error

Validate rejects definitions whose resolution would be ambiguous or unsafe.

Types

type Assignment

type Assignment struct {
	TaskType TaskType `json:"task_type,omitempty" yaml:"task_type,omitempty"`
	Profile  string   `json:"profile,omitempty" yaml:"profile,omitempty"`
	Agent    string   `json:"agent" yaml:"agent"`
	Model    string   `json:"model,omitempty" yaml:"model,omitempty"`
}

Assignment selects an agent and optional model for one task type. An empty TaskType is the required default branch for its stage.

type Catalog

type Catalog struct {
	Playbooks []Playbook `json:"playbooks" yaml:"playbooks"`
}

Catalog is the currently-addressable set of immutable playbook revisions.

func DefaultCatalog

func DefaultCatalog() Catalog

DefaultCatalog returns a fresh, valid starter catalog matching the approved Feature work, Bug fix, Quick answer, and Research handoff designs.

func InterimConfiguredDefaultCatalog added in v0.13.0

func InterimConfiguredDefaultCatalog() Catalog

InterimConfiguredDefaultCatalog returns the exact correction deployed before GPT-5.5 was explicitly approved. It is migration input only.

func LegacyDefaultCatalogRevision1 added in v0.13.0

func LegacyDefaultCatalogRevision1() Catalog

LegacyDefaultCatalogRevision1 returns the exact built-in definitions that shipped before 5.6 work was assigned directly to Codex. It exists only so the control adapter can recognize untouched persisted defaults and append a corrected immutable revision without mistaking user edits for defaults.

func LegacyGPT55DefaultCatalog added in v0.13.0

func LegacyGPT55DefaultCatalog() Catalog

LegacyGPT55DefaultCatalog returns the exact defaults shipped before Feature work's unavailable OpenClaw design stage was replaced. It is migration input only; prior immutable runs continue to resolve against their stored revision.

func (Catalog) Resolve

func (c Catalog) Resolve(req RouteRequest) (ResolvedRoute, error)

Resolve chooses and snapshots a playbook without performing I/O or inference.

type Delivery

type Delivery string

Delivery controls whether the resolved pipeline creates an assignment or returns an answer outside the assignment board.

const (
	DeliveryAssignment Delivery = "assignment"
	DeliveryAnswer     Delivery = "answer"
)

type Playbook

type Playbook struct {
	ID        string   `json:"id" yaml:"id"`
	Name      string   `json:"name" yaml:"name"`
	Revision  int      `json:"revision" yaml:"revision"`
	IsDefault bool     `json:"is_default" yaml:"is_default"`
	PlanGate  bool     `json:"plan_gate" yaml:"plan_gate"`
	Trigger   Trigger  `json:"trigger" yaml:"trigger"`
	Delivery  Delivery `json:"delivery" yaml:"delivery"`
	Stages    []Stage  `json:"stages" yaml:"stages"`
}

Playbook is an immutable revision of a reusable pipeline. Persistence owns revision creation; Resolve carries the selected revision into its result.

type ResolvedRoute

type ResolvedRoute struct {
	PlaybookID       string          `json:"playbook_id"`
	PlaybookRevision int             `json:"playbook_revision"`
	PlaybookName     string          `json:"playbook_name"`
	TaskType         TaskType        `json:"task_type"`
	Source           RouteSource     `json:"source"`
	Delivery         Delivery        `json:"delivery"`
	PlanGate         bool            `json:"plan_gate"`
	Stages           []ResolvedStage `json:"stages"`
}

ResolvedRoute is an immutable execution snapshot suitable for previewing or compiling. PlaybookRevision prevents later catalog edits from changing it.

type ResolvedStage

type ResolvedStage struct {
	Order   int    `json:"order"`
	Name    string `json:"name"`
	Prompt  string `json:"prompt,omitempty"`
	Profile string `json:"profile,omitempty"`
	Agent   string `json:"agent"`
	Model   string `json:"model,omitempty"`
	Memory  bool   `json:"memory"`
}

ResolvedStage is a stage with its task-type branch selected.

type RouteRequest

type RouteRequest struct {
	Direction  string   `json:"direction"`
	TaskType   TaskType `json:"task_type,omitempty"`
	PlaybookID string   `json:"playbook_id,omitempty"`
}

RouteRequest is the pure resolver input. PlaybookID has highest precedence; TaskType, when present, takes precedence over fixed text classification.

type RouteSource

type RouteSource string

RouteSource explains why a playbook was selected.

const (
	SourceManual  RouteSource = "manual"
	SourceTrigger RouteSource = "trigger"
	SourceDefault RouteSource = "default"
)

type Stage

type Stage struct {
	Order       int          `json:"order" yaml:"order"`
	Name        string       `json:"name" yaml:"name"`
	Prompt      string       `json:"prompt,omitempty" yaml:"prompt,omitempty"`
	Description string       `json:"description,omitempty" yaml:"description,omitempty"`
	Assignments []Assignment `json:"assignments" yaml:"assignments"`
	Memory      bool         `json:"memory" yaml:"memory"`
}

Stage is one ordered step in a playbook.

type TaskType

type TaskType string

TaskType is the deterministic classification signal used by triggers and per-stage assignment branches.

const (
	TaskQuestion TaskType = "question"
	TaskBug      TaskType = "bug"
	TaskResearch TaskType = "research"
	TaskFeature  TaskType = "feature"
	TaskManual   TaskType = "manual"
)

func ClassifyTaskType

func ClassifyTaskType(direction string) TaskType

ClassifyTaskType applies fixed, inspectable text rules. The order is part of the contract: question, then bug, then research, with feature as the default.

type Trigger

type Trigger struct {
	Kind    TaskType `json:"kind" yaml:"kind"`
	Enabled bool     `json:"enabled" yaml:"enabled"`
}

Trigger binds one classified task type to a playbook. Disabled triggers are ignored during automatic resolution but do not prevent explicit selection.

Jump to

Keyboard shortcuts

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