agent

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSystemPrompt

func BuildSystemPrompt(instructions []InstructionSource) string

BuildSystemPrompt concatenates all discovered instructions into a system prompt.

func CreateDefinition

func CreateDefinition(def AgentDefinition) error

CreateDefinition writes a new agent definition YAML to ~/.ratchet/agents/<name>.yaml.

Types

type AgentDefinition

type AgentDefinition struct {
	Name          string   `yaml:"name"`
	Role          string   `yaml:"role"`
	Model         string   `yaml:"model"`
	Provider      string   `yaml:"provider"`
	SystemPrompt  string   `yaml:"system_prompt"`
	Tools         []string `yaml:"tools"`
	MaxIterations int      `yaml:"max_iterations"`
}

AgentDefinition defines a reusable AI agent configuration.

func LoadBuiltins

func LoadBuiltins() ([]AgentDefinition, error)

LoadBuiltins returns the built-in agent definitions embedded in the binary.

func LoadDefinitions

func LoadDefinitions(workingDir string) ([]AgentDefinition, error)

LoadDefinitions discovers agent definitions from standard locations. Searches: ~/.ratchet/agents/*.yaml, .ratchet/agents/*.yaml, .claude/agents/*.md

func (AgentDefinition) EffectiveModel

func (d AgentDefinition) EffectiveModel(defaultModel string) string

EffectiveModel returns the agent's model, falling back to defaultModel if unset.

func (AgentDefinition) EffectiveProvider

func (d AgentDefinition) EffectiveProvider(defaultProvider string) string

EffectiveProvider returns the agent's provider, falling back to defaultProvider if unset.

type Coordinator

type Coordinator struct {
	// contains filtered or unexported fields
}

Coordinator manages workspace awareness across sessions.

func NewCoordinator

func NewCoordinator(sessions SessionRegistry) *Coordinator

func (*Coordinator) CheckFileConflict

func (c *Coordinator) CheckFileConflict(sessionID, filePath string) []string

CheckFileConflict returns session IDs of other sessions in the same workspace directory.

func (*Coordinator) FileLockHolder

func (c *Coordinator) FileLockHolder(filePath string) string

FileLockHolder returns the session ID that holds the lock, or empty string.

func (*Coordinator) InjectCoordinationContext

func (c *Coordinator) InjectCoordinationContext(sessionID, workingDir string) string

InjectCoordinationContext builds awareness messages for agent prompts.

func (*Coordinator) LockFile

func (c *Coordinator) LockFile(sessionID, filePath string)

LockFile marks a file as being written by a session.

func (*Coordinator) UnlockFile

func (c *Coordinator) UnlockFile(filePath string)

UnlockFile releases a file lock.

type InstructionSource

type InstructionSource struct {
	Path    string
	Source  string // "claude", "copilot", "cursor", "windsurf", "ratchet"
	Scope   string // "global", "project"
	Content string
}

InstructionSource represents a discovered instruction file.

func DiscoverInstructions

func DiscoverInstructions(workingDir string, enabledSources []string, providerFilter string) []InstructionSource

DiscoverInstructions finds all instruction files for the given working directory. enabledSources controls which tool conventions to discover (e.g., ["claude", "copilot"]). providerFilter limits model-specific files to the current provider (e.g., "anthropic").

type Orchestrator

type Orchestrator struct {
	// contains filtered or unexported fields
}

Orchestrator manages multi-agent team execution.

func NewOrchestrator

func NewOrchestrator() *Orchestrator

func (*Orchestrator) GetTeam

func (o *Orchestrator) GetTeam(id string) (*Team, bool)

GetTeam returns a team by ID.

func (*Orchestrator) SpawnTeam

func (o *Orchestrator) SpawnTeam(task string, defs []AgentDefinition) (*Team, error)

SpawnTeam creates a team of agents for a complex task. The team ID is returned immediately; execution is async.

func (*Orchestrator) UpdateAgentStatus

func (o *Orchestrator) UpdateAgentStatus(teamID, agentID, status, currentTask string)

UpdateAgentStatus updates an agent's status within a team.

type SessionRegistry

type SessionRegistry interface {
	SessionsInDir(dir string) []string
}

SessionRegistry is the interface for looking up workspace sessions.

type Team

type Team struct {
	ID     string
	Task   string
	Agents []TeamAgent
	Status string // running, completed, failed
	// contains filtered or unexported fields
}

Team represents a group of agents working on a task.

type TeamAgent

type TeamAgent struct {
	ID          string
	Name        string
	Role        string
	Model       string
	Provider    string
	Status      string // idle, running, done
	CurrentTask string
}

TeamAgent is a member of a Team.

Jump to

Keyboard shortcuts

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