agent

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// Core fields (all tools)
	Name        string `yaml:"name" json:"name"`
	Description string `yaml:"description" json:"description"`
	Content     string `yaml:"-" json:"content,omitempty"` // Markdown body (system prompt)
	Scope       string `yaml:"-" json:"scope"`             // "local" or "global"
	Tool        string `yaml:"-" json:"tool"`              // Source tool (claude, copilot, cursor, opencode)
	Path        string `yaml:"-" json:"path,omitempty"`    // File path

	// Model selection
	Model string `yaml:"model,omitempty" json:"model,omitempty"` // Model to use (inherit, sonnet, opus, haiku, fast, etc.)

	// Tool access control
	Tools           []string `yaml:"tools,omitempty" json:"tools,omitempty"`                     // Allowed tools
	DisallowedTools []string `yaml:"disallowedTools,omitempty" json:"disallowedTools,omitempty"` // Denied tools (Claude)

	// Claude-specific
	PermissionMode string   `yaml:"permissionMode,omitempty" json:"permissionMode,omitempty"` // default, acceptEdits, dontAsk, bypassPermissions, plan
	Skills         []string `yaml:"skills,omitempty" json:"skills,omitempty"`                 // Preloaded skills

	// Cursor-specific
	ReadOnly     bool `yaml:"readonly,omitempty" json:"readonly,omitempty"`           // Restrict write operations
	IsBackground bool `yaml:"is_background,omitempty" json:"is_background,omitempty"` // Run asynchronously

	// OpenCode-specific
	Temperature float64 `yaml:"temperature,omitempty" json:"temperature,omitempty"` // Response randomness (0.0-1.0)
	MaxSteps    int     `yaml:"maxSteps,omitempty" json:"maxSteps,omitempty"`       // Max iterations
	Mode        string  `yaml:"mode,omitempty" json:"mode,omitempty"`               // primary, subagent, all
	Hidden      bool    `yaml:"hidden,omitempty" json:"hidden,omitempty"`           // Exclude from autocomplete
	Disabled    bool    `yaml:"disable,omitempty" json:"disabled,omitempty"`        // Agent disabled

	// Copilot-specific
	Target   string            `yaml:"target,omitempty" json:"target,omitempty"`     // vscode, github-copilot
	Infer    bool              `yaml:"infer,omitempty" json:"infer,omitempty"`       // Auto-selection based on context
	Metadata map[string]string `yaml:"metadata,omitempty" json:"metadata,omitempty"` // Custom annotations
}

Agent represents a custom agent/subagent for AI coding tools. Agents are configured via markdown files with YAML frontmatter. Supported tools: Claude Code, GitHub Copilot, Cursor, OpenCode

func LoadAll

func LoadAll(dir string) ([]*Agent, error)

LoadAll loads all agents from a directory (simple wrapper for syncing)

func LoadFromDirectory

func LoadFromDirectory(dir string, scope string, tool string) ([]*Agent, error)

LoadFromDirectory loads all agents from a directory

func LoadFromFile

func LoadFromFile(path string) (*Agent, error)

LoadFromFile loads an agent from a markdown file with YAML frontmatter

func ParseAgentMarkdown

func ParseAgentMarkdown(data []byte) (*Agent, error)

ParseAgentMarkdown parses a markdown file with YAML frontmatter into an Agent

func (*Agent) InspectContent

func (a *Agent) InspectContent() string

InspectContent returns the formatted content for the inspector viewport

func (*Agent) InspectTitle

func (a *Agent) InspectTitle() string

InspectTitle returns the display name for the inspector modal header

func (*Agent) Save

func (a *Agent) Save(dir string) error

Save saves an agent to a directory using the agent's name as the filename

func (*Agent) SaveToFile

func (a *Agent) SaveToFile(path string) error

SaveToFile saves an agent to a markdown file with YAML frontmatter

func (*Agent) ToToolFormat

func (a *Agent) ToToolFormat(targetTool string) *Agent

ToToolFormat converts the agent to a tool-specific format This can be used when syncing agents to different tools

Jump to

Keyboard shortcuts

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