Documentation
¶
Overview ¶
Package warp implements the Workspace Agent Resource Protocol (WARP) — a provider-agnostic, declarative format for defining AI agents and their supporting resources.
Warp is not tied to any particular LLM provider, orchestration framework, or runtime. Any tool that understands the format can load and execute the same resource files unchanged.
File Format ¶
Each warp resource is either a Markdown file (delimited by "---") or a pure YAML/YML configuration file.
For Markdown files, the YAML front-matter carries metadata and configuration, while the Markdown body below the closing delimiter becomes the resource's Instructions field.
---
apiVersion: warp/v1alpha1
kind: Agent
metadata:
name: my-agent
description: A helpful assistant.
spec:
models: ["gpt-4o"]
temperature: 0.7
skills:
- skills/finance.md
commands:
- cmd/report.md
---
# My Agent
You are a helpful assistant that specialises in...
Resource Kinds ¶
Eleven resource kinds are supported:
Workspace – root authority for the session; declares active projects
(WORKSPACE.md, optionally without front-matter).
Context – identity and instructions for a project scope
(AGENTS.md, optionally without front-matter).
Plugin – manifest declaring a plugin's identity and exported resources
(PLUGIN.md, optionally without front-matter).
Agent – an autonomous agent with model configuration and references
to skills and commands it may use.
Skill – a bundle of expertise guidelines for a specific domain.
Command – a discrete, reusable operation an agent can invoke.
Decision – a probabilistic decision evaluation (predicates, choices, scores).
ModelProvider – configuration for an LLM provider.
Tool – a custom tool definition.
MCP – a Model Context Protocol server configuration.
Toolkit – a collection of referenced or inline tools.
Loading Resources ¶
Use LoadDefault to start discovery from the current working directory:
ws, err := warp.LoadDefault()
Use Load to specify a custom starting directory:
ws, err := warp.Load("/custom/path")
Use LoadWorkspace for explicit control over the starting directory:
ws, err := warp.LoadWorkspace("/absolute/path")
After loading, call [Workspace.Validate] to verify structural correctness and resolve cross-references declared inside Agent specs.
Programmatic Plugin Installation & Discovery ¶
Use DiscoverPluginResources to inspect external plugins and InstallPlugin to fetch and configure them programmatically:
resources, err := warp.DiscoverPluginResources("github.com/acme/finance-skills", "v1.2.0")
err = warp.InstallPlugin(".", "github.com/acme/finance-skills", "v1.2.0", []string{"Skill/hello"})
Index ¶
- Constants
- Variables
- func DiscoverPluginResources(source, version string) ([]DiscoveredResource, *PluginHooks, error)
- func Format(res Resource) ([]byte, error)
- func InstallPlugin(workspaceDir, source, version string, imports []string) error
- func MakeQualifiedName(namespace string, kind Kind, name string) string
- func NamespacePriority(ns string) int
- func RecommendedExtension(kind Kind) string
- func Render(res Resource, opts *RenderOptions) (string, error)
- type Agent
- type AgentRenderOptions
- type AgentSpec
- type BaseResource
- func (b *BaseResource) DeepCopy() *BaseResource
- func (b *BaseResource) GetKind() Kind
- func (b *BaseResource) GetMetadata() Metadata
- func (b *BaseResource) GetName() string
- func (b *BaseResource) GetNamespace() string
- func (b *BaseResource) QualifiedName() string
- func (b *BaseResource) SetNamespace(ns string)
- func (b *BaseResource) ValidateBase() error
- type Command
- type CommandRenderOptions
- type CommandSpec
- type Context
- type ContextRenderOptions
- type ContextSpec
- type Decision
- type DecisionCriteria
- type DecisionLevel
- type DecisionOption
- type DecisionQuestion
- type DecisionQuestionType
- type DecisionRenderOptions
- type DecisionSpec
- type DiscoveredResource
- type FSResourceProvider
- type Kind
- type MCP
- type MCPPolicies
- type MCPSpec
- type Metadata
- type ModelDefaults
- type ModelProvider
- type ModelProviderSpec
- type ModelRole
- type NamespacedFSProvider
- type NamespacedProvider
- type ParseResult
- type Plugin
- type PluginHooks
- type PluginSpec
- type Policies
- type Project
- type ProviderAuth
- type ProviderModel
- type ProviderModelCapabilities
- type ProviderModelCost
- type ProviderModelCostTier
- type ProviderModelCostTierCondition
- type ProviderModelLimits
- type ProviderModelModalities
- type ProviderModelThinkingCapability
- type QueryOptions
- type Registry
- func Assemble(ctx context.Context, providers []NamespacedProvider) (*Registry, error)
- func Load(dir string, providers ...ResourceProvider) (*Registry, error)
- func LoadDefault(providers ...ResourceProvider) (*Registry, error)
- func LoadWorkspace(startDir string, providers ...ResourceProvider) (*Registry, error)
- func NewRegistry(ws *Workspace) *Registry
- func (r *Registry) AddProject(p *Project)
- func (r *Registry) GetProject(slug string) (*Project, bool)
- func (r *Registry) ListProjects() []*Project
- func (r *Registry) ListResources(opts QueryOptions) []Resource
- func (r *Registry) Project(slug string) *ScopedRegistry
- func (r *Registry) ProjectFromPath(absPath string) (*Project, bool)
- func (r *Registry) ResolveAgent(ref string) (*ResolvedAgent, error)
- func (r *Registry) ResolveModels(role ModelRole, explicit ...string) []string
- func (r *Registry) ResolveResource(ref string) (Resource, bool)
- func (r *Registry) Resources() []Resource
- func (r *Registry) Set(qualifiedName string, res Resource)
- func (r *Registry) Validate() error
- func (r *Registry) Warnings() []string
- func (r *Registry) WorkspaceSpec() *Workspace
- type RenderOptions
- type ResolvedAgent
- type Resolver
- type Resource
- type ResourceFilter
- type ResourceProvider
- type ResourceSet
- type ScopedRegistry
- func (s *ScopedRegistry) ListResources(opts QueryOptions) []Resource
- func (s *ScopedRegistry) ResolveAgent(ref string) (*ResolvedAgent, error)
- func (s *ScopedRegistry) ResolveModels(role ModelRole, explicit ...string) []string
- func (s *ScopedRegistry) ResolveResource(ref string) (Resource, bool)
- func (s *ScopedRegistry) SkillsForAgent(agentName string) ([]Skill, error)
- func (s *ScopedRegistry) ToolsForAgent(agentName string) ([]*Tool, error)
- type Skill
- type SkillRenderOptions
- type SkillSpec
- type TemplateAgent
- type TemplateCommand
- type TemplateContext
- type TemplateDecision
- type TemplateProject
- type TemplateSkill
- type TemplateTool
- type TemplateWorkspace
- type Tool
- type ToolAnnotation
- type ToolPolicies
- type ToolSpec
- type Toolkit
- type ToolkitSpec
- type ToolkitTool
- type Workspace
- type WorkspaceDef
- type WorkspaceDefSpec
- type WorkspacePlugin
- type WorkspaceRenderOptions
Constants ¶
const ( // DefaultAgentsDir is the subdirectory that contains Agent, Skill, and // Command resource files, both at the workspace root (global) and inside // each project directory (local). DefaultAgentsDir = ".agents" // WorkspaceFileName is the name of the file that defines the workspace // root authority. WorkspaceFileName = "WORKSPACE.md" // ContextFileName is the name of the file that defines a project's // identity and instructions. ContextFileName = "AGENTS.md" // MarkdownExt is the file extension that the loader looks for when // walking the filesystem. Only files with this extension are parsed as // warp resources. MarkdownExt = ".md" )
const ( // NamespaceLocal is the highest-priority namespace, corresponding to // project-local .agents/ resources. NamespaceLocal = "local" // NamespaceWorkspace corresponds to workspace-global .agents/ resources // (only populated when projects are sub-directories). NamespaceWorkspace = "workspace" // NamespaceUser corresponds to user-level configuration resources. NamespaceUser = "user" // NamespaceSystem corresponds to embedded builtin resources shipped with // the runtime. NamespaceSystem = "system" )
Standard namespace identifiers. These are reserved; plugins must not use them.
const (
// APIVersion is the expected apiVersion value in all resource front-matter.
APIVersion = "warp/v1alpha1"
)
Variables ¶
var ErrMissingFrontMatter = errors.New("invalid file format: missing YAML front-matter delimiters")
ErrMissingFrontMatter is returned by Parse when a file does not contain YAML front-matter delimiters and is not a special inferred file.
Functions ¶
func DiscoverPluginResources ¶ added in v0.0.3
func DiscoverPluginResources(source, version string) ([]DiscoveredResource, *PluginHooks, error)
DiscoverPluginResources fetches the plugin at the given source and version, and returns the list of all resources exposed by it (filtered by the plugin's spec.exports).
func Format ¶ added in v0.0.3
Format serializes a Resource into its canonical Markdown/YAML representation. It uses a triple-dash delimiter to separate the YAML front-matter from the Markdown instructions for resources that support them (Agents, Skills, etc.).
func InstallPlugin ¶ added in v0.0.3
InstallPlugin downloads a plugin, computes its hashes, writes them to warp.lock, and registers the plugin in WORKSPACE.md.
workspaceDir is the root directory of the workspace (containing WORKSPACE.md). source is the package source (e.g. "github.com/acme/finance-skills"). version is the version (e.g. "latest" or a tag name). imports is the list of resource qualified names to import (e.g. ["Skill/hello"]). If imports is empty/nil, all exported resources are imported.
func MakeQualifiedName ¶
MakeQualifiedName constructs the "namespace/Kind/name" qualified name.
func NamespacePriority ¶
NamespacePriority returns the numeric priority for a namespace name. Unknown namespaces return 0.
func RecommendedExtension ¶ added in v0.0.3
RecommendedExtension returns the standard file extension (.md or .yaml) for the given resource kind.
Types ¶
type Agent ¶
type Agent struct {
BaseResource `yaml:",inline"`
// Spec holds the agent-specific configuration.
Spec AgentSpec `yaml:"spec"`
}
Agent is a warp resource that describes an autonomous agent: its LLM configuration, persona instructions, and the set of skills and commands it may invoke at runtime.
type AgentRenderOptions ¶ added in v0.0.3
type AgentRenderOptions struct {
Workspace *Workspace
Project *Project
Resolved *ResolvedAgent // Optional, contains fully hydrated Tools, Skills, Commands
Globals map[string]any
}
AgentRenderOptions holds options for rendering agent instructions.
type AgentSpec ¶
type AgentSpec struct {
// Extends is the Qualified Name or Short Name of another Agent resource to
// inherit from. When set, the engine merges the parent's skills and tools
// arrays (parent first) and prepends the parent's instructions to this
// agent's instructions.
Extends string `yaml:"extends,omitempty"`
// Instructions is the persona prompt populated from the Markdown body of
// the file (below the closing front-matter delimiter).
Instructions string `yaml:"instructions,omitempty"`
// Triggers defines the architectural constraints on what can invoke this agent
// (e.g., "human", "agent"). An empty list means the agent can be triggered
// by anything.
Triggers []string `yaml:"triggers,omitempty,flow"`
// Models is a prioritized list of LLM model identifiers to use (e.g.,
// ["gpt-4o", "claude-3-5-sonnet"]). The runtime should attempt to use the
// first available model.
Models []string `yaml:"models,omitempty,flow"`
// Temperature controls the randomness of the model's output (0.0–2.0).
Temperature *float64 `yaml:"temperature,omitempty"`
// Thinking specifies the runtime configuration for extended reasoning (e.g., type: effort, effort: high). Overrides the provider's default.
Thinking map[string]any `yaml:"thinking,omitempty"`
// Skills is a list of file paths (relative to the FS root) that reference
// Skill resources this agent is allowed to use.
Skills *[]string `yaml:"skills,omitempty"`
// Commands is a list of file paths (relative to the FS root) that
// reference Command resources this agent can invoke.
Commands *[]string `yaml:"commands,omitempty"`
// Subagents is a list of Agent references (Qualified or Short Names) this agent
// is allowed to delegate to.
Subagents *[]string `yaml:"subagents,omitempty"`
// Policies defines security and access policies.
Policies *Policies `yaml:"policies,omitempty"`
}
AgentSpec contains the configuration details for an Agent resource.
type BaseResource ¶
type BaseResource struct {
// APIVersion declares the schema version, e.g. "tasksmith/v1".
APIVersion string `yaml:"apiVersion"`
// Kind identifies the resource type.
Kind Kind `yaml:"kind"`
// Metadata holds the resource's name, description, and display name.
Metadata Metadata `yaml:"metadata"`
// Directory is the FS path of the directory that contains the resource
// file. It is populated by the Loader and is never serialised to YAML.
Directory string `yaml:"-"`
// Namespace is the registry namespace this resource belongs to.
// Set by the assembler; empty for resources loaded via the legacy
// filesystem path.
Namespace string `yaml:"-"`
}
BaseResource contains the fields that every resource kind shares. Embed it with `yaml:",inline"` so the top-level YAML keys are promoted into the enclosing struct.
func (*BaseResource) DeepCopy ¶
func (b *BaseResource) DeepCopy() *BaseResource
DeepCopy returns a deep copy of the BaseResource.
func (*BaseResource) GetMetadata ¶ added in v0.0.2
func (b *BaseResource) GetMetadata() Metadata
GetMetadata implements Resource.
func (*BaseResource) GetNamespace ¶
func (b *BaseResource) GetNamespace() string
GetNamespace implements Resource.
func (*BaseResource) QualifiedName ¶
func (b *BaseResource) QualifiedName() string
QualifiedName implements Resource.
func (*BaseResource) SetNamespace ¶
func (b *BaseResource) SetNamespace(ns string)
SetNamespace sets the namespace of this resource.
func (*BaseResource) ValidateBase ¶
func (b *BaseResource) ValidateBase() error
ValidateBase verifies that the mandatory front-matter fields are present and that Kind is a known value. It returns a descriptive error for the first failing check it encounters.
type Command ¶
type Command struct {
BaseResource `yaml:",inline"`
// Spec holds the command-specific configuration.
Spec CommandSpec `yaml:"spec"`
}
Command is a warp resource that encapsulates a discrete, reusable operation an agent can perform. Its instructions are authored as the Markdown body of the defining file.
type CommandRenderOptions ¶ added in v0.0.3
type CommandRenderOptions struct {
Workspace *Workspace
Project *Project
Args []string
Globals map[string]any
}
CommandRenderOptions holds options for rendering command instructions.
type CommandSpec ¶
type CommandSpec struct {
// Instructions is the expertise prompt populated from the Markdown body
// of the file (below the closing front-matter delimiter).
Instructions string `yaml:"instructions,omitempty"`
// Models is a prioritized list of LLM model identifiers to use for this
// command (e.g., ["gpt-4o-mini", "claude-3-haiku"]). Overrides agent defaults.
Models []string `yaml:"models,omitempty,flow"`
// Tools is a list of resource refs (names or paths) restricting which
// Tool resources can be used while executing this command.
Tools []string `yaml:"tools,omitempty"`
// Hints is an ordered list of argument hints (e.g., ["ticker", "year"])
// that UIs can use for autocompletion and runtimes can use for positional
// template substitution.
Hints []string `yaml:"hints,omitempty"`
}
CommandSpec contains the configuration details for a Command resource.
func (*CommandSpec) DeepCopy ¶
func (in *CommandSpec) DeepCopy() *CommandSpec
DeepCopy returns a deep copy of the CommandSpec.
type Context ¶
type Context struct {
BaseResource `yaml:",inline"`
// Spec holds the context-specific configuration.
Spec ContextSpec `yaml:"spec"`
}
Context is a warp resource that defines the identity, rules, and instructions for any agent operating within a project directory. It is the authoritative entry point for the directory scope it lives in.
A file named AGENTS.md (case-insensitive) is automatically treated as a Context. If the file lacks YAML front-matter the loader infers the apiVersion, kind, and metadata.name fields automatically.
type ContextRenderOptions ¶ added in v0.0.3
ContextRenderOptions holds options for rendering context instructions.
type ContextSpec ¶
type ContextSpec struct {
// Instructions is the directive text populated from the Markdown body of
// the file (below the closing front-matter delimiter).
Instructions string `yaml:"instructions,omitempty"`
// Resources is a list of paths to other Warp files to be explicitly
// loaded into the context.
Resources []string `yaml:"resources"`
}
ContextSpec contains the configuration details for a Context resource.
func (*ContextSpec) DeepCopy ¶
func (in *ContextSpec) DeepCopy() *ContextSpec
DeepCopy returns a deep copy of the ContextSpec.
type Decision ¶ added in v0.0.6
type Decision struct {
BaseResource `yaml:",inline"`
// Spec holds the decision-specific configuration.
Spec DecisionSpec `yaml:"spec"`
}
Decision is a warp resource that encapsulates a probabilistic decision evaluation (such as binary predicates, categorical choices, and ordinal scoring rubrics). Its general evaluation context or rubric is authored as the Markdown body of the defining file.
type DecisionCriteria ¶ added in v0.0.6
type DecisionCriteria struct {
True string `yaml:"true,omitempty"` // Description of when the predicate evaluates to true
False string `yaml:"false,omitempty"` // Description of when the predicate evaluates to false
}
DecisionCriteria defines explicit positive and negative criteria for a predicate question.
func (*DecisionCriteria) DeepCopy ¶ added in v0.0.6
func (in *DecisionCriteria) DeepCopy() *DecisionCriteria
DeepCopy returns a deep copy of the DecisionCriteria.
type DecisionLevel ¶ added in v0.0.6
type DecisionLevel struct {
Label string `yaml:"label"` // Label for this level (e.g., "low", "medium", "high")
Description string `yaml:"description,omitempty"` // Rubric description for this score level
}
DecisionLevel defines a single ordinal rubric level for a score question.
type DecisionOption ¶ added in v0.0.6
type DecisionOption struct {
Value string `yaml:"value"` // Identifier returned when this option is selected
Description string `yaml:"description,omitempty"` // Semantic description of when to select this option
}
DecisionOption defines a single categorical choice option.
type DecisionQuestion ¶ added in v0.0.6
type DecisionQuestion struct {
// Name is the unique identifier for this question within the Decision.
Name string `yaml:"name"`
// Type is the question evaluation mode: "predicate", "choice", or "score".
Type DecisionQuestionType `yaml:"type"`
// Instructions describes the specific question or condition to evaluate.
Instructions string `yaml:"instructions,omitempty"`
// Threshold is an optional minimum probability [0.0, 1.0] required for a predicate to pass.
Threshold *float64 `yaml:"threshold,omitempty"`
// MinConfidence is an optional minimum confidence [0.0, 1.0] required for an answer.
MinConfidence *float64 `yaml:"minConfidence,omitempty"`
// Criteria defines optional positive and negative evaluation criteria for a predicate question.
Criteria *DecisionCriteria `yaml:"criteria,omitempty"`
// Options defines the candidate choices when type is "choice".
Options []DecisionOption `yaml:"options,omitempty"`
// Levels defines the ordered rubric levels when type is "score".
Levels []DecisionLevel `yaml:"levels,omitempty"`
}
DecisionQuestion defines a single structured question within a Decision resource.
func (*DecisionQuestion) DeepCopy ¶ added in v0.0.6
func (in *DecisionQuestion) DeepCopy() *DecisionQuestion
DeepCopy returns a deep copy of the DecisionQuestion.
type DecisionQuestionType ¶ added in v0.0.6
type DecisionQuestionType string
DecisionQuestionType identifies the evaluation mode of a DecisionQuestion.
const ( // DecisionQuestionPredicate evaluates a binary true/false condition. DecisionQuestionPredicate DecisionQuestionType = "predicate" // DecisionQuestionChoice selects among discrete categorical options. DecisionQuestionChoice DecisionQuestionType = "choice" // DecisionQuestionScore rates an input across ordered rubric levels. DecisionQuestionScore DecisionQuestionType = "score" )
type DecisionRenderOptions ¶ added in v0.0.6
type DecisionRenderOptions struct {
Workspace *Workspace
Project *Project
Args []string
Globals map[string]any
}
DecisionRenderOptions holds options for rendering decision instructions.
type DecisionSpec ¶ added in v0.0.6
type DecisionSpec struct {
// Instructions is the evaluation prompt/rubric populated from the Markdown
// body of the file (below the closing front-matter delimiter).
Instructions string `yaml:"instructions,omitempty"`
// Models is a prioritized list of decision model identifiers to use
// (e.g., ["typesafe/jev-latest", "ollama/nimble"]). Overrides workspace/provider defaults.
Models []string `yaml:"models,omitempty,flow"`
// Hints is an ordered list of argument hints that UIs and runtimes can use
// for positional template substitution in Instructions.
Hints []string `yaml:"hints,omitempty"`
// Questions is the list of structured questions (predicates, choices, scores)
// evaluated by this Decision. Optional when questions are supplied dynamically at runtime.
Questions []DecisionQuestion `yaml:"questions,omitempty"`
}
DecisionSpec contains the configuration details for a Decision resource.
func (*DecisionSpec) DeepCopy ¶ added in v0.0.6
func (in *DecisionSpec) DeepCopy() *DecisionSpec
DeepCopy returns a deep copy of the DecisionSpec.
type DiscoveredResource ¶ added in v0.0.3
DiscoveredResource holds information about a discovered resource in a plugin.
type FSResourceProvider ¶
type FSResourceProvider struct {
BasePath string // Optional virtual root prefix for resolved resource directories (e.g. "source://plugin")
// contains filtered or unexported fields
}
FSResourceProvider loads resources from a filesystem rooted at a resource library directory. Workspace and Context resources are ignored.
func NewFSResourceProvider ¶
func NewFSResourceProvider(fsys fs.FS, basePath string) *FSResourceProvider
NewFSResourceProvider returns a resource provider that loads from fsys.
func (*FSResourceProvider) LoadResources ¶
func (p *FSResourceProvider) LoadResources() (*ResourceSet, error)
LoadResources loads Agent, Skill, Command, Decision, ModelProvider, Tool, MCP, and Toolkit resources from the provider filesystem.
type Kind ¶
type Kind string
Kind identifies the resource type declared in a file's front-matter.
const ( // KindWorkspace represents a Workspace resource (WORKSPACE.md). KindWorkspace Kind = "Workspace" // KindContext represents a Context resource (AGENTS.md). KindContext Kind = "Context" // KindAgent represents an Agent resource. KindAgent Kind = "Agent" // KindSkill represents a Skill resource. KindSkill Kind = "Skill" // KindCommand represents a Command resource. KindCommand Kind = "Command" // KindDecision represents a Decision resource. KindDecision Kind = "Decision" // KindModelProvider represents an LLM Provider resource. KindModelProvider Kind = "ModelProvider" // KindTool represents a Custom Tool resource. KindTool Kind = "Tool" // KindMCP represents an MCP Server resource. KindMCP Kind = "MCP" // KindToolkit represents a Toolkit resource. KindToolkit Kind = "Toolkit" // KindPlugin represents a Plugin resource. KindPlugin Kind = "Plugin" )
type MCP ¶
type MCP struct {
BaseResource `yaml:",inline"`
// Spec holds the MCP-specific configuration.
Spec MCPSpec `yaml:"spec"`
}
MCP is a warp resource that describes an MCP server.
type MCPPolicies ¶ added in v0.0.3
type MCPPolicies struct {
Tools *ResourceFilter `yaml:"tools,omitempty"`
Prompts *ResourceFilter `yaml:"prompts,omitempty"`
Resources *ResourceFilter `yaml:"resources,omitempty"`
}
MCPPolicies defines inclusion and exclusion rules for resources exposed by an MCP server.
func (*MCPPolicies) DeepCopy ¶ added in v0.0.3
func (in *MCPPolicies) DeepCopy() *MCPPolicies
DeepCopy returns a deep copy of the MCPPolicies.
type MCPSpec ¶
type MCPSpec struct {
Type string `yaml:"type,omitempty"` // Transport type: stdio, sse, http, or streamable-http
Endpoint string `yaml:"endpoint,omitempty"` // HTTP URL for the MCP server if type is sse, http, or streamable-http
Command []string `yaml:"command,omitempty"` // Command to start the MCP server via stdio
Env map[string]string `yaml:"env,omitempty"` // Environment variables for the MCP server
Auth *ProviderAuth `yaml:"auth,omitempty"` // Authentication configuration for remote MCP servers
Headers map[string]string `yaml:"headers,omitempty"` // Custom HTTP headers for remote MCP servers
Annotations *ToolAnnotation `yaml:"annotations,omitempty"` // Default safety profile for all exposed tools
Policies *MCPPolicies `yaml:"policies,omitempty"` // Controls which external MCP resources are exposed
Overrides map[string]ToolAnnotation `yaml:"overrides,omitempty"` // Tool-specific annotation overrides (key is tool name)
}
MCPSpec contains the configuration details for an MCP resource.
type Metadata ¶
type Metadata struct {
// Name is the unique identifier for the resource within its kind.
Name string `yaml:"name"`
// Description is a short human-readable summary of the resource.
Description string `yaml:"description,omitempty"`
// DisplayName is an optional pretty-printed label for UIs.
DisplayName string `yaml:"displayName,omitempty"`
// Labels are arbitrary key-value pairs for categorisation and filtering.
Labels map[string]string `yaml:"labels,omitempty"`
}
Metadata holds the identifying and descriptive fields shared by every resource kind. These fields map directly to the front-matter "metadata" block in a Markdown file.
type ModelDefaults ¶ added in v0.0.6
type ModelDefaults struct {
Completion string `yaml:"completion,omitempty" json:"completion,omitempty"`
Decision string `yaml:"decision,omitempty" json:"decision,omitempty"`
Embedding string `yaml:"embedding,omitempty" json:"embedding,omitempty"`
}
ModelDefaults defines role-based default models or providers for completion, decision evaluation, and embedding generation.
func (*ModelDefaults) DeepCopy ¶ added in v0.0.6
func (in *ModelDefaults) DeepCopy() *ModelDefaults
DeepCopy returns a deep copy of the ModelDefaults.
func (*ModelDefaults) ForRole ¶ added in v0.0.6
func (in *ModelDefaults) ForRole(role ModelRole) string
ForRole returns the default model configured for the given role, or "" if unset.
type ModelProvider ¶
type ModelProvider struct {
BaseResource `yaml:",inline"`
// Spec holds the provider-specific configuration.
Spec ModelProviderSpec `yaml:"spec"`
}
ModelProvider is a warp resource that describes an LLM provider configuration.
func (*ModelProvider) DeepCopy ¶
func (in *ModelProvider) DeepCopy() *ModelProvider
DeepCopy returns a deep copy of the ModelProvider.
type ModelProviderSpec ¶
type ModelProviderSpec struct {
Type string `yaml:"type"` // e.g., "ollama", "openai", "anthropic", "typesafe"
Endpoint string `yaml:"endpoint"` // API base URL
DefaultModel string `yaml:"defaultModel,omitempty"` // Default completion model to use if none specified
DefaultModels *ModelDefaults `yaml:"defaultModels,omitempty" json:"defaultModels,omitempty"` // Role-based default models (completion, decision, embedding)
Auth *ProviderAuth `yaml:"auth,omitempty" json:"auth,omitempty"` // Authentication configuration
Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"` // Custom HTTP headers for all provider requests
Config map[string]any `yaml:"config,omitempty" json:"config,omitempty"` // Provider-specific settings and custom configuration parameters
Models []ProviderModel `yaml:"models"` // Available models from this provider
}
ModelProviderSpec contains the configuration details for a ModelProvider resource.
func (*ModelProviderSpec) DeepCopy ¶
func (in *ModelProviderSpec) DeepCopy() *ModelProviderSpec
DeepCopy returns a deep copy of the ModelProviderSpec.
type ModelRole ¶ added in v0.0.6
type ModelRole string
ModelRole identifies the capability role for model resolution.
const ( // ModelRoleCompletion is the role for text/chat completion models. ModelRoleCompletion ModelRole = "completion" // ModelRoleDecision is the role for probabilistic decision evaluation models. ModelRoleDecision ModelRole = "decision" // ModelRoleEmbedding is the role for vector embedding generation models. ModelRoleEmbedding ModelRole = "embedding" )
type NamespacedFSProvider ¶
type NamespacedFSProvider struct {
BasePath string // Optional virtual root prefix (e.g., "source://system")
// contains filtered or unexported fields
}
NamespacedFSProvider wraps an fs.FS and presents its Agent, Skill, Command, ModelProvider, Tool, MCP, and Toolkit files as a NamespacedProvider.
func NewNamespacedFSProvider ¶
func NewNamespacedFSProvider(fsys fs.FS, basePath string, namespace string, priority int) *NamespacedFSProvider
NewNamespacedFSProvider returns a provider that loads resources from fsys and tags them all with the given namespace and priority.
func (*NamespacedFSProvider) GetResources ¶
func (p *NamespacedFSProvider) GetResources(ctx context.Context) ([]Resource, error)
GetResources implements NamespacedProvider.
func (*NamespacedFSProvider) Namespace ¶
func (p *NamespacedFSProvider) Namespace() string
Namespace implements NamespacedProvider.
func (*NamespacedFSProvider) Priority ¶
func (p *NamespacedFSProvider) Priority() int
Priority implements NamespacedProvider.
type NamespacedProvider ¶
type NamespacedProvider interface {
// Namespace returns the namespace all resources from this provider belong to.
Namespace() string
// Priority returns the numeric priority. Higher values beat lower ones.
Priority() int
// GetResources returns all resources this provider contributes.
GetResources(ctx context.Context) ([]Resource, error)
}
NamespacedProvider loads resources for a specific namespace with a defined priority. When multiple providers supply a resource with the same qualified name, the one with the highest Priority wins.
type ParseResult ¶
type ParseResult struct {
// Kind is the resource kind decoded from the front-matter.
Kind Kind
// Resource is the fully-typed resource pointer (*WorkspaceDef, *Context,
// *Agent, *Skill, or *Command).
Resource any
// Inferred is true when the resource metadata was inferred rather than
// read from an explicit YAML front-matter block. This happens when a
// WORKSPACE.md or AGENTS.md file is loaded without front-matter delimiters.
Inferred bool
}
ParseResult is the output of a successful Parse call. It carries the detected resource Kind and the fully-decoded, typed resource value.
func Parse ¶
func Parse(filePath, content string) (*ParseResult, error)
Parse splits a warp Markdown file into its YAML front-matter and Markdown body, decodes the resource kind, unmarshals the appropriate typed struct, and injects the body text as the resource's Instructions field.
filePath is the path of the file relative to the loader root. It is used to detect special files that may omit the YAML front-matter block:
- WORKSPACE.md (case-insensitive) is inferred as a Workspace resource.
- AGENTS.md (case-insensitive) is inferred as a Context resource.
A valid warp file has the form:
--- apiVersion: warp/v1alpha1 kind: Agent ... --- # Markdown instructions here
Parse returns an error if the delimiters are absent (and the file is not a special inferred kind), the front-matter is malformed, or the kind is unsupported.
type Plugin ¶ added in v0.0.3
type Plugin struct {
BaseResource `yaml:",inline"`
// Spec holds the Plugin-specific configuration.
Spec PluginSpec `yaml:"spec"`
}
Plugin is a warp resource that declares a repository as a distributable package.
type PluginHooks ¶ added in v0.0.3
type PluginHooks struct {
PostInstall [][]string `yaml:"postInstall,omitempty"` // Commands to run after the plugin is downloaded (e.g., ["go", "install", "./..."])
}
PluginHooks defines lifecycle commands to run when a plugin is installed.
func (*PluginHooks) DeepCopy ¶ added in v0.0.3
func (in *PluginHooks) DeepCopy() *PluginHooks
DeepCopy returns a deep copy of the PluginHooks.
type PluginSpec ¶ added in v0.0.3
type PluginSpec struct {
// Instructions is the Markdown body of the plugin file.
Instructions string `yaml:"instructions,omitempty"`
ResourceDir string `yaml:"resourceDir"` // The relative path within the repository where the loader should look for resources
Exports []string `yaml:"exports"` // Glob patterns defining which resources are exposed to consumers
Hooks *PluginHooks `yaml:"hooks,omitempty"` // Setup and installation hooks
}
PluginSpec contains the configuration details for a Plugin resource.
func (*PluginSpec) DeepCopy ¶ added in v0.0.3
func (in *PluginSpec) DeepCopy() *PluginSpec
DeepCopy returns a deep copy of the PluginSpec.
type Policies ¶ added in v0.0.3
type Policies struct {
Tools *ToolPolicies `yaml:"tools,omitempty"`
}
Policies defines security and access policies.
type Project ¶
type Project struct {
// Name is the slug identifier derived from the project's path.
Name string
// Path is the project's path relative to the workspace RootPath.
Path string
// RootPath is the absolute filesystem path of the workspace root.
// Stored here so AbsPath() works without a back-pointer to Workspace.
RootPath string
// Context is the parsed AGENTS.md resource for this project. Nil when no
// AGENTS.md was found.
Context *Context
}
Project holds metadata for a single project directory discovered during workspace loading. Resources for the project are stored in the Registry under the project's slug namespace.
type ProviderAuth ¶ added in v0.0.3
type ProviderAuth struct {
Type string `yaml:"type,omitempty" json:"type,omitempty"` // The auth scheme (e.g., "bearer", "api-key", "basic")
Header string `yaml:"header,omitempty" json:"header,omitempty"` // Custom header name if type is "api-key"
Env string `yaml:"env,omitempty" json:"env,omitempty"` // Read credential from environment variable
File string `yaml:"file,omitempty" json:"file,omitempty"` // Read credential from file path
}
ProviderAuth defines how to authenticate with the model provider.
func (*ProviderAuth) DeepCopy ¶ added in v0.0.3
func (in *ProviderAuth) DeepCopy() *ProviderAuth
DeepCopy returns a deep copy of the ProviderAuth.
type ProviderModel ¶
type ProviderModel struct {
ID string `yaml:"id"` // Unique model ID (e.g., "gpt-4")
Name string `yaml:"name"` // Model name (e.g., "gpt-4")
Label string `yaml:"label"` // Human-friendly label (e.g., "GPT-4")
Limits ProviderModelLimits `yaml:"limits"` // Context, output token, and vector dimension limits
Capabilities *ProviderModelCapabilities `yaml:"capabilities,omitempty"` // Supported features and configuration boundaries
Cost *ProviderModelCost `yaml:"cost,omitempty"` // Token pricing and conditional tiers
}
ProviderModel describes a specific model available from a provider.
func (*ProviderModel) DeepCopy ¶ added in v0.0.3
func (in *ProviderModel) DeepCopy() *ProviderModel
type ProviderModelCapabilities ¶ added in v0.0.3
type ProviderModelCapabilities struct {
Completion *bool `yaml:"completion,omitempty"` // Whether the model supports text/chat completion (defaults to true)
Decision *bool `yaml:"decision,omitempty"` // Whether the model supports probabilistic decision evaluation (defaults to false)
Embedding *bool `yaml:"embedding,omitempty"` // Whether the model supports vector embedding generation (defaults to false)
Dimensions []int `yaml:"dimensions,omitempty,flow"` // Supported output vector dimensions for configurable embedding models
Attachment *bool `yaml:"attachment,omitempty"` // Whether the model supports file/document attachments
Tools *bool `yaml:"tools,omitempty"` // Whether the model supports function/tool calling (tool_call)
StructuredOutput *bool `yaml:"structuredOutput,omitempty"` // Whether the model supports strict structured outputs
Temperature *bool `yaml:"temperature,omitempty"` // Whether the model allows configuring the sampling temperature
Thinking []ProviderModelThinkingCapability `yaml:"thinking,omitempty"` // List of supported reasoning configuration strategies
Modalities *ProviderModelModalities `yaml:"modalities,omitempty"` // Defines supported input and output data modalities
}
func (*ProviderModelCapabilities) DeepCopy ¶ added in v0.0.3
func (in *ProviderModelCapabilities) DeepCopy() *ProviderModelCapabilities
func (*ProviderModelCapabilities) SupportsCompletion ¶ added in v0.0.6
func (in *ProviderModelCapabilities) SupportsCompletion() bool
SupportsCompletion reports whether the model supports text/chat completions. Defaults to true when Capabilities or Completion is nil.
func (*ProviderModelCapabilities) SupportsDecision ¶ added in v0.0.6
func (in *ProviderModelCapabilities) SupportsDecision() bool
SupportsDecision reports whether the model supports probabilistic decision evaluation. Defaults to false when Capabilities or Decision is nil.
func (*ProviderModelCapabilities) SupportsEmbedding ¶ added in v0.0.6
func (in *ProviderModelCapabilities) SupportsEmbedding() bool
SupportsEmbedding reports whether the model supports vector embedding generation. Defaults to false when Capabilities or Embedding is nil.
type ProviderModelCost ¶ added in v0.0.3
type ProviderModelCost struct {
Input float64 `yaml:"input"` // Base cost for input tokens (typically per 1M tokens)
Output float64 `yaml:"output,omitempty"` // Base cost for output tokens
CacheRead float64 `yaml:"cacheRead,omitempty"` // Cost for reading from prompt cache
CacheWrite float64 `yaml:"cacheWrite,omitempty"` // Cost for writing to prompt cache
Tiers []ProviderModelCostTier `yaml:"tiers,omitempty"` // Array of conditional pricing tiers
}
func (*ProviderModelCost) DeepCopy ¶ added in v0.0.3
func (in *ProviderModelCost) DeepCopy() *ProviderModelCost
type ProviderModelCostTier ¶ added in v0.0.3
type ProviderModelCostTier struct {
Label string `yaml:"label"` // A human-readable label for the tier (e.g., "Context over 200k")
Tier ProviderModelCostTierCondition `yaml:"tier"` // The condition that triggers this pricing
Input float64 `yaml:"input"` // Override cost for input tokens
Output float64 `yaml:"output,omitempty"` // Override cost for output tokens
CacheRead float64 `yaml:"cacheRead,omitempty"` // Override cost for cache read
CacheWrite float64 `yaml:"cacheWrite,omitempty"` // Override cost for cache write
}
func (*ProviderModelCostTier) DeepCopy ¶ added in v0.0.3
func (in *ProviderModelCostTier) DeepCopy() *ProviderModelCostTier
type ProviderModelCostTierCondition ¶ added in v0.0.3
type ProviderModelLimits ¶
type ProviderModelLimits struct {
Context int `yaml:"context"` // Max context length in tokens
Output int `yaml:"output,omitempty"` // Max output length in tokens
Dimensions int `yaml:"dimensions,omitempty"` // Default/max output vector dimensions (for embedding models)
}
ProviderModelLimits defines the token and vector dimension limits for a specific model.
type ProviderModelModalities ¶ added in v0.0.3
type ProviderModelModalities struct {
Input []string `yaml:"input,omitempty"` // Supported input modalities (e.g., ["text", "image", "video"])
Output []string `yaml:"output,omitempty"` // Supported output modalities (e.g., ["text", "image"])
}
func (*ProviderModelModalities) DeepCopy ¶ added in v0.0.3
func (in *ProviderModelModalities) DeepCopy() *ProviderModelModalities
type ProviderModelThinkingCapability ¶ added in v0.0.3
type ProviderModelThinkingCapability struct {
Type string `yaml:"type"` // The strategy this model supports: toggle, effort, budget, or adaptive
IsDefault bool `yaml:"isDefault,omitempty"` // Marks this strategy as the primary default
AllowedEfforts []string `yaml:"allowedEfforts,omitempty"` // Used if type: effort. e.g., ["low", "medium", "high"]
MaxBudgetTokens int `yaml:"maxBudgetTokens,omitempty"` // Used if type: budget. The maximum allowed thinking tokens
Default any `yaml:"default,omitempty"` // The default value
}
func (*ProviderModelThinkingCapability) DeepCopy ¶ added in v0.0.3
func (in *ProviderModelThinkingCapability) DeepCopy() *ProviderModelThinkingCapability
type QueryOptions ¶
type QueryOptions struct {
// Kinds filters by resource kind. An empty slice matches all kinds.
Kinds []Kind
// Namespaces filters by namespace. An empty slice matches all namespaces.
Namespaces []string
// Effective applies shadowing: when true, only the highest-priority
// namespace version of each short name is returned.
Effective bool
// Filter is an optional custom predicate function called for each candidate resource.
// If set and it returns false, the resource is excluded from the results.
Filter func(Resource) bool
}
QueryOptions controls how ListResources filters and deduplicates results.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the base resource store, safe for concurrent use. Resources are keyed by their qualified name ("namespace/Kind/name"). Project-local resources are stored using the project slug as their namespace — the "local" constant is a virtual alias, never stored literally.
Consumers interact either through the base Registry (workspace-root scope: workspace/user/system/plugins) or through a ScopedRegistry obtained via Project(), which elevates a specific project namespace to the top priority.
func Assemble ¶
func Assemble(ctx context.Context, providers []NamespacedProvider) (*Registry, error)
Assemble builds a Registry populated from an ordered list of NamespacedProviders. Providers are applied from lowest priority to highest; a higher-priority provider's resource overwrites any same-qualified-name entry from a lower-priority provider.
The returned Registry has no filesystem-derived Projects, Agents, etc. — those maps remain nil. Use LoadWorkspace for the full loading path.
func Load ¶
func Load(dir string, providers ...ResourceProvider) (*Registry, error)
Load loads a workspace starting from the given directory.
reg, err := warp.Load("/my/project")
func LoadDefault ¶
func LoadDefault(providers ...ResourceProvider) (*Registry, error)
LoadDefault loads a workspace starting from the current working directory. It is equivalent to LoadWorkspace(".").
reg, err := warp.LoadDefault()
func LoadWorkspace ¶
func LoadWorkspace(startDir string, providers ...ResourceProvider) (*Registry, error)
LoadWorkspace is the primary entry point for the 3-phase WARP loading algorithm.
Phase 1 — Workspace Discovery: climbs from startDir looking for a WORKSPACE.md file. If none is found, a synthetic workspace is created with its root set to startDir.
Phase 2 — Project Mapping: determines the active project directories from the workspace's spec.projects field (["*"], explicit list, or default ["."]).
Phase 3 — Contextual Loading: for each project directory, loads its AGENTS.md (Context) and walks its .agents/ subdirectory for Agents, Skills, and Commands.
Authority Rule: when the only project is "." (WORKSPACE_PATH == PROJECT_PATH) the root .agents/ directory is owned by the Project. The workspace-global library is left empty to prevent double-loading.
func NewRegistry ¶
NewRegistry returns an empty Registry bound to the given workspace spec. ws may be nil for registries assembled outside the loading path.
func (*Registry) AddProject ¶
AddProject registers project metadata in the registry.
func (*Registry) GetProject ¶
GetProject returns the project with the given slug, or (nil, false) when not found.
func (*Registry) ListProjects ¶
ListProjects returns all registered projects sorted by project name.
func (*Registry) ListResources ¶
func (r *Registry) ListResources(opts QueryOptions) []Resource
ListResources implements Resolver for the base Registry. Project-specific namespaces are excluded; standard and plugin namespaces are included.
func (*Registry) Project ¶
func (r *Registry) Project(slug string) *ScopedRegistry
Project returns a ScopedRegistry scoped to slug. Resolution methods on the returned value treat slug as the highest-priority "local" namespace, and a ref beginning with "local/" is transparently rewritten to "<slug>/".
func (*Registry) ProjectFromPath ¶
ProjectFromPath returns the project whose directory contains absPath (matching the most specific nested project when multiple projects match), or (nil, false) when no project matches. This is the preferred way for the application layer to determine which project is "current" — callers should pass os.Getwd() or an equivalent path rather than letting the Registry inspect the process environment.
func (*Registry) ResolveAgent ¶
func (r *Registry) ResolveAgent(ref string) (*ResolvedAgent, error)
ResolveAgent resolves an agent by ref, applying recursive inheritance merging. Returns the fully merged *ResolvedAgent or an error if the ref is not found, is not an Agent, or if a circular inheritance chain is detected.
func (*Registry) ResolveModels ¶ added in v0.0.6
ResolveModels returns the prioritized list of model identifiers for the given capability role, following the WARP model resolution hierarchy:
- Non-empty explicit model overrides (e.g., from Agent, Command, or Decision).
- Workspace role-specific default (spec.defaultModels.<role>), falling back to spec.defaultModel when role is ModelRoleCompletion.
- Default Provider role-specific default (spec.defaultModels.<role>), falling back to spec.defaultModel when role is ModelRoleCompletion.
Any resolved model lacking a "<provider>/" prefix is automatically qualified with the workspace's defaultProvider when set.
func (*Registry) ResolveResource ¶
ResolveResource implements Resolver for the base Registry. Qualified refs ("namespace/Kind/name") are direct key lookups. Short names are resolved through global and plugin namespaces; project-specific namespaces are never returned, ensuring workspace-root isolation.
func (*Registry) Resources ¶ added in v0.0.2
Resources returns all resources stored in the registry across all namespaces, sorted deterministically by qualified name.
func (*Registry) Set ¶
Set stores a resource under the given qualified name. It overwrites any existing entry. Use this for programmatic registry construction in tests or custom providers. For loader paths, use the internal set() method instead.
func (*Registry) Validate ¶
Validate checks every resource for structural correctness and resolves cross-references. Returns the first error encountered.
func (*Registry) WorkspaceSpec ¶
WorkspaceSpec returns the immutable workspace specification.
type RenderOptions ¶ added in v0.0.2
type RenderOptions struct {
// Args are the positional arguments provided by the caller (typically for Commands).
Args []string
// Globals are WARP-managed contextual variables (e.g., project directories,
// active environments) provided by the runtime.
Globals map[string]any
}
RenderOptions holds the context for rendering a resource's instructions.
type ResolvedAgent ¶ added in v0.0.3
type ResolvedAgent struct {
Agent *Agent
Tools []*Tool
Skills []Skill
Commands []*Command
Subagents []*Agent
}
ResolvedAgent represents a fully hydrated agent, with all inheritance merged and capabilities resolved and filtered by policies.
type Resolver ¶
type Resolver interface {
ResolveResource(ref string) (Resource, bool)
ListResources(opts QueryOptions) []Resource
ResolveModels(role ModelRole, explicit ...string) []string
}
Resolver is the common interface satisfied by both Registry (workspace-root scope) and ScopedRegistry (project scope).
type Resource ¶
type Resource interface {
// GetKind returns the resource's Kind (e.g. KindSkill).
GetKind() Kind
// GetName returns the short metadata name declared in the YAML front-matter.
GetName() string
// GetNamespace returns the namespace this resource was loaded into. Empty
// when the resource was loaded via the legacy filesystem path and has not
// been assigned to a namespace.
GetNamespace() string
// QualifiedName returns the "namespace/Kind/name" key that uniquely
// identifies this resource in the registry.
QualifiedName() string
// GetMetadata returns the resource's Metadata block.
GetMetadata() Metadata
}
Resource is the common interface satisfied by every warp resource value stored in the registry. All concrete types (*Agent, *Skill, *Command, etc.) satisfy this interface through their embedded BaseResource.
type ResourceFilter ¶ added in v0.0.3
type ResourceFilter struct {
Include []string `yaml:"include,omitempty"` // Glob patterns for resources to expose
Exclude []string `yaml:"exclude,omitempty"` // Glob patterns for resources to block (applied after include)
}
ResourceFilter defines inclusion and exclusion rules based on glob patterns.
func (*ResourceFilter) DeepCopy ¶ added in v0.0.3
func (in *ResourceFilter) DeepCopy() *ResourceFilter
DeepCopy returns a deep copy of the ResourceFilter.
type ResourceProvider ¶
type ResourceProvider interface {
LoadResources() (*ResourceSet, error)
}
ResourceProvider loads workspace-global resources that should be merged into a workspace after filesystem discovery. Existing workspace resources keep precedence over provider resources.
type ResourceSet ¶
type ResourceSet struct {
Agents map[string]*Agent
Skills map[string]*Skill
Commands map[string]*Command
Decisions map[string]*Decision
ModelProviders map[string]*ModelProvider
Tools map[string]*Tool
MCPs map[string]*MCP
Toolkits map[string]*Toolkit
}
ResourceSet contains non-project, non-workspace resources that can be merged into a loaded workspace.
type ScopedRegistry ¶
type ScopedRegistry struct {
// contains filtered or unexported fields
}
ScopedRegistry wraps a Registry with a project slug, implementing Resolver with that slug treated as the top-priority "local" namespace. Obtain one via Registry.Project(slug).
func (*ScopedRegistry) ListResources ¶
func (s *ScopedRegistry) ListResources(opts QueryOptions) []Resource
ListResources implements Resolver for ScopedRegistry. When opts.Effective is true, the active project namespace wins over all others for each short name.
func (*ScopedRegistry) ResolveAgent ¶
func (s *ScopedRegistry) ResolveAgent(ref string) (*ResolvedAgent, error)
ResolveAgent resolves an agent by ref within this project scope, applying recursive inheritance merging. The project slug is the highest-priority namespace during resolution of every step in the chain.
func (*ScopedRegistry) ResolveModels ¶ added in v0.0.6
func (s *ScopedRegistry) ResolveModels(role ModelRole, explicit ...string) []string
ResolveModels resolves models for the given role within this project scope.
func (*ScopedRegistry) ResolveResource ¶
func (s *ScopedRegistry) ResolveResource(ref string) (Resource, bool)
ResolveResource implements Resolver for ScopedRegistry.
- "local/<Kind>/<name>" is rewritten to "<projectSlug>/<Kind>/<name>".
- Other qualified refs ("namespace/Kind/name") are direct key lookups.
- Short names are resolved through [projectSlug, workspace, user, system, plugins].
func (*ScopedRegistry) SkillsForAgent ¶
func (s *ScopedRegistry) SkillsForAgent(agentName string) ([]Skill, error)
SkillsForAgent returns the Skill resources available to the named agent within this project scope. Inheritance is resolved first via ResolveAgent, so the merged skill list from the full inheritance chain is used. If the merged agent declares a non-empty Skills list, only those referenced skills are returned. When the list is empty every skill visible in this project scope is returned.
func (*ScopedRegistry) ToolsForAgent ¶
func (s *ScopedRegistry) ToolsForAgent(agentName string) ([]*Tool, error)
ToolsForAgent returns the Tool resources available to the named agent within this project scope. Inheritance is resolved first via ResolveAgent, so the merged tool list from the full inheritance chain is used.
type Skill ¶
type Skill struct {
BaseResource `yaml:",inline"`
// Spec holds the skill-specific configuration.
Spec SkillSpec `yaml:"spec"`
}
Skill is a warp resource that bundles expertise guidelines for a specific domain. An agent loads a skill's instructions to adopt its persona or follow its conventions.
type SkillRenderOptions ¶ added in v0.0.3
type SkillRenderOptions struct {
Workspace *Workspace
Project *Project
Agent *Agent // The invoking agent
Globals map[string]any
}
SkillRenderOptions holds options for rendering skill instructions.
type SkillSpec ¶
type SkillSpec struct {
// UseWhen provides explicit routing instructions to the LLM on when to
// trigger this skill (e.g., "Use this when the user asks for X").
UseWhen string `yaml:"useWhen,omitempty"`
// Keywords is an array of semantic tags used for discovery and prompting.
Keywords []string `yaml:"keywords,omitempty,flow"`
// Instructions is the expertise prompt populated from the Markdown body
// of the file (below the closing front-matter delimiter).
Instructions string `yaml:"instructions,omitempty"`
}
SkillSpec contains the configuration details for a Skill resource.
type TemplateAgent ¶ added in v0.0.3
type TemplateAgent struct {
Name string
Description string
Dir string
Path string
Skills []TemplateSkill
Tools []TemplateTool
Commands []TemplateCommand
Subagents []TemplateAgent
}
TemplateAgent represents the agent view model for templates.
type TemplateCommand ¶ added in v0.0.3
type TemplateCommand struct {
Name string
Description string
Dir string
Path string
Tools []TemplateTool
}
TemplateCommand represents the command view model for templates.
type TemplateContext ¶ added in v0.0.3
TemplateContext represents the context view model for templates.
type TemplateDecision ¶ added in v0.0.6
TemplateDecision represents the decision view model for templates.
type TemplateProject ¶ added in v0.0.3
TemplateProject represents the project view model for templates.
type TemplateSkill ¶ added in v0.0.3
type TemplateSkill struct {
Name string
Description string
UseWhen string
Keywords []string
Dir string
Path string
}
TemplateSkill represents the skill view model for templates.
type TemplateTool ¶ added in v0.0.3
TemplateTool represents the tool view model for templates.
type TemplateWorkspace ¶ added in v0.0.3
TemplateWorkspace represents the workspace view model for templates.
type Tool ¶
type Tool struct {
BaseResource `yaml:",inline"`
// Spec holds the tool-specific configuration.
Spec ToolSpec `yaml:"spec"`
}
Tool is a warp resource that describes a custom tool.
type ToolAnnotation ¶
type ToolAnnotation struct {
IsOpenWorld bool `yaml:"isOpenWorld,omitempty"` // Interacts with external resources
IsDangerous bool `yaml:"isDangerous,omitempty"` // Can perform destructive actions
IsReadOnly bool `yaml:"isReadOnly,omitempty"` // Does not modify state
IsIdempotent bool `yaml:"isIdempotent,omitempty"` // Safe to retry
UserHint string `yaml:"userHint,omitempty"` // Human-readable hint for approval prompts
}
ToolAnnotation defines the safety profile for a tool.
func (*ToolAnnotation) DeepCopy ¶
func (in *ToolAnnotation) DeepCopy() *ToolAnnotation
DeepCopy returns a deep copy of the ToolAnnotation.
type ToolPolicies ¶ added in v0.0.3
type ToolPolicies struct {
AllowDangerous *bool `yaml:"allowDangerous,omitempty"`
AllowOpenWorld *bool `yaml:"allowOpenWorld,omitempty"`
Include []string `yaml:"include,omitempty"`
Exclude []string `yaml:"exclude,omitempty"`
}
ToolPolicies defines restrictions for tool usage.
func (*ToolPolicies) DeepCopy ¶ added in v0.0.3
func (in *ToolPolicies) DeepCopy() *ToolPolicies
DeepCopy returns a deep copy of the ToolPolicies.
type ToolSpec ¶
type ToolSpec struct {
// Instructions is the detailed description of what the tool does, populated from the Markdown body.
Instructions string `yaml:"instructions,omitempty"`
Name string `yaml:"name,omitempty"` // Used only when defined inline in a Toolkit
Description string `yaml:"description,omitempty"` // Short description (used in YAML tools or inline Toolkit tools)
Command []string `yaml:"command"` // Executable and static args (e.g., ["python", "script.py"])
Env map[string]string `yaml:"env,omitempty"` // Environment variables injected into the process
InputSchema map[string]any `yaml:"inputSchema,omitempty"` // JSON Schema object defining arguments the LLM must pass
OutputSchema map[string]any `yaml:"outputSchema,omitempty"` // JSON Schema object defining the tool's output
Annotations *ToolAnnotation `yaml:"annotations,omitempty"` // Safety profile for Tool Execution Security
}
ToolSpec contains the configuration details for a Tool resource.
type Toolkit ¶
type Toolkit struct {
BaseResource `yaml:",inline"`
// Spec holds the toolkit-specific configuration.
Spec ToolkitSpec `yaml:"spec"`
}
Toolkit is a warp resource that describes a collection of tools.
type ToolkitSpec ¶
type ToolkitSpec struct {
Tools []ToolkitTool `yaml:"tools"` // Array of tools (referenced or inline)
}
ToolkitSpec contains the configuration details for a Toolkit resource.
func (*ToolkitSpec) DeepCopy ¶
func (in *ToolkitSpec) DeepCopy() *ToolkitSpec
DeepCopy returns a deep copy of the ToolkitSpec.
type ToolkitTool ¶
type ToolkitTool struct {
Ref string `yaml:"$ref,omitempty"` // Path to external tool (e.g., "tools/formatter.yaml")
ToolSpec `yaml:",inline"` // Inline Tool definition
}
ToolkitTool can be either a reference to an external file or a fully inline ToolSpec.
func (*ToolkitTool) DeepCopy ¶
func (in *ToolkitTool) DeepCopy() *ToolkitTool
DeepCopy returns a deep copy of the ToolkitTool.
type Workspace ¶
type Workspace struct {
// Def is the parsed WORKSPACE.md resource. Nil when Synthetic is true.
Def *WorkspaceDef
// RootPath is the absolute filesystem path to the workspace root directory.
RootPath string
// Synthetic is true when no WORKSPACE.md was found during discovery and
// the workspace was inferred from the starting directory.
Synthetic bool
}
Workspace holds the immutable specification of a WARP workspace. All loaded resources and projects live in a Registry. Use DeepCopy to obtain a safe, independent snapshot of the spec.
type WorkspaceDef ¶
type WorkspaceDef struct {
BaseResource `yaml:",inline"`
Spec WorkspaceDefSpec `yaml:"spec"`
}
WorkspaceDef is the parsed representation of a WORKSPACE.md resource.
func (*WorkspaceDef) DeepCopy ¶
func (w *WorkspaceDef) DeepCopy() *WorkspaceDef
DeepCopy returns a deep copy of the WorkspaceDef.
func (*WorkspaceDef) ValidateBase ¶
func (w *WorkspaceDef) ValidateBase() error
ValidateBase validates the WorkspaceDef base fields.
type WorkspaceDefSpec ¶
type WorkspaceDefSpec struct {
Projects []string `yaml:"projects,omitempty,flow"`
DefaultProvider string `yaml:"defaultProvider,omitempty"`
DefaultModel string `yaml:"defaultModel,omitempty"`
DefaultModels *ModelDefaults `yaml:"defaultModels,omitempty"`
DefaultAgent string `yaml:"defaultAgent,omitempty"`
Plugins []WorkspacePlugin `yaml:"plugins,omitempty"`
Policies *Policies `yaml:"policies,omitempty"`
Instructions string `yaml:"instructions,omitempty"`
}
WorkspaceDefSpec contains configuration for a Workspace resource.
func (*WorkspaceDefSpec) DeepCopy ¶
func (in *WorkspaceDefSpec) DeepCopy() *WorkspaceDefSpec
DeepCopy returns a deep copy of the WorkspaceDefSpec.
type WorkspacePlugin ¶ added in v0.0.3
type WorkspacePlugin struct {
Source string `yaml:"source"`
Version string `yaml:"version,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Imports *ResourceFilter `yaml:"imports,omitempty"`
}
WorkspacePlugin defines an external repository to load as a plugin.
func (*WorkspacePlugin) DeepCopy ¶ added in v0.0.3
func (in *WorkspacePlugin) DeepCopy() *WorkspacePlugin
DeepCopy returns a deep copy of the WorkspacePlugin.
type WorkspaceRenderOptions ¶ added in v0.0.3
type WorkspaceRenderOptions struct {
// Globals are custom runtime variables to inject into the template.
Globals map[string]any
}
WorkspaceRenderOptions holds options for rendering workspace instructions.