warp

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

warp

The warp package implements the Workspace Agent Resource Protocol (WARP) — a provider-agnostic, declarative format for defining AI agents and their supporting resources.

License

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.

Getting Started

To add warp to your Go project:

go get github.com/masterkeysrd/warp

File Format

Resources can be authored either as Markdown files with YAML front-matter or as pure .yaml / .yml files:

---
apiVersion: warp/v1alpha1
kind: Agent
metadata:
  name: my-agent
  description: A helpful assistant.
spec:
  models: ["gpt-4o"]
  temperature: 0.7
  skills:
    - finance
  commands:
    - report
  tools:
    - git-toolkit
---

# My Agent

You are a helpful assistant that specializes in financial analysis...

Resource Kinds

Kind Purpose
Workspace Root authority for the session (WORKSPACE.md); declares active projects, plugins, and workspace-wide policies.
Context Identity, instructions, and explicit resource references for a project scope (AGENTS.md).
Plugin Manifest declaring a plugin's identity and exported resources (PLUGIN.md).
Agent An autonomous agent with LLM configuration, inheritance (extends), policies, and references to skills, commands, tools/toolkits, MCPs, and subagents.
Skill A bundle of expertise guidelines for a specific domain. Agents load skills to adopt a persona or follow conventions.
Command A discrete, reusable operation an agent can invoke (e.g. "generate a report").
ModelProvider Configuration for an LLM provider (API key env var, base URL, available models, default thinking config).
Tool A custom tool definition (input schema, execution binding, and safety annotations).
Toolkit A collection of referenced ($ref) or inline Tool definitions that can be attached to an Agent as a unit.
MCP A Model Context Protocol server configuration (stdio or sse).

Loading & Resolving Resources

Load a Workspace
reg, err := warp.LoadWorkspace(".")
if err != nil {
    log.Fatal(err)
}

if err := reg.Validate(); err != nil {
    log.Fatal(err)
}
Load a Single Resource Directory
reg, err := warp.LoadDefault() // or warp.Load("/path/to/.agents")
Scoped Resolution
// Locate the active project owning a subdirectory path
proj, err := reg.ProjectFromPath("/path/to/workspace/services/api/cmd")
if err != nil {
    log.Fatal(err)
}

// Scope the registry to that project
scoped := reg.Project(proj.Name)

// Resolve an executable Agent (evaluates inheritance, Toolkits, policies, and globs)
resolved, err := scoped.ResolveAgent("my-agent")
Programmatic Plugin Discovery & Installation
// Discover resources exposed by a plugin before installing it.
resources, err := warp.DiscoverPluginResources("github.com/acme/finance-skills", "v1.2.0")
for _, r := range resources {
    fmt.Printf("Resource: %s/%s (%s)\n", r.Kind, r.Name, r.Description)
}

// Install a plugin into the workspace at the current directory.
err = warp.InstallPlugin(".", "github.com/acme/finance-skills", "v1.2.0", []string{"Skill/hello"})

Directory Layout

The default resource directory is .agents. Inside it, resources are organized by kind into sub-directories:

WORKSPACE.md          # Optional workspace manifest
AGENTS.md             # Project context instructions (kind: Context)
.agents/
├── agents/           # Agent definitions (or defs/)
│   └── analyst.md    # kind: Agent
├── commands/         # Command definitions
│   └── report.md     # kind: Command
├── skills/           # Skill definitions
│   └── finance.md    # kind: Skill
├── tools/            # Tool definitions (kind: Tool)
├── toolkits/         # Toolkit definitions (kind: Toolkit)
├── mcps/             # MCP server definitions (kind: MCP)
└── providers/        # Model Provider definitions (kind: ModelProvider)

API Reference

  • Registry / ScopedRegistry – multi-tenant resource store supporting 3-part qualified names (namespace/Kind/name), short-name resolution, and deterministic listing (ListResources, ListProjects, Resources).
    • Project(name string) *ScopedRegistry / ProjectFromPath(path string) (*Project, error) — scopes resolution to a project namespace.
    • ResolveAgent(ref string) (*ResolvedAgent, error) — resolves an executable Agent (evaluating inheritance, Toolkits, policies, and globs).
    • Validate() error — validates all resources, inheritance chains, and cross-references across the workspace.
  • LoadWorkspace(dir string, opts ...LoadOption) (*Registry, error) — discovers and loads a workspace starting from dir.
  • Load(dir string) (*Registry, error) — loads a single .agents resource directory.
  • LoadDefault() (*Registry, error) — loads resources from the default .agents directory in the current working directory.
  • Parse(filename, content string) (*ParseResult, error) — parses a single WARP Markdown or YAML string into a typed resource.
  • Format(r Resource) ([]byte, error) — serializes a WARP resource into canonical YAML or Markdown front-matter format.
  • DiscoverPluginResources(source, version string) ([]DiscoveredResource, error) — fetches a plugin at the given source/version and lists its exported resources.
  • InstallPlugin(workspaceDir, source, version string, imports []string) error — downloads a plugin, records its SHA-256 hash in warp.lock, and registers it in WORKSPACE.md.

CLI Tool

Warp includes a CLI tool (cmd/warp) for validating, inspecting, rendering, formatting, and installing plugins in a workspace.

# Build the CLI
go build -o warp ./cmd/warp

# Validate a workspace (displays warnings and validation errors)
./warp validate [path]

# List all discovered projects and resources
./warp list [path]

# Render a resource's instructions template (Agent, Command, Skill, Context)
./warp render [-dir ./services/api] my-agent [args...]

# Canonicalize YAML and Markdown front-matter formatting
./warp fmt [-w] .agents/agents/my-agent.md

# Install or inspect a plugin
./warp get --include Skill/hello github.com/acme/finance-skills@v1.2.0
./warp get --list github.com/acme/finance-skills@v1.2.0

JSON Schema

A JSON Schema is available at schema/warp.json to provide real-time validation and autocompletion in IDEs like VS Code.

To use it in VS Code, add the following to your settings (requires the YAML extension):

"yaml.schemas": {
  "https://raw.githubusercontent.com/masterkeysrd/warp/main/schema/warp.json": [
    "**/.agents/**/*.md",
    "**/.agents/**/*.yaml",
    "**/AGENTS.md",
    "**/WORKSPACE.md",
    "**/PLUGIN.md"
  ]
}

Contributing

We welcome contributions! Please see the CONTRIBUTING.md file (if available) or open an issue to discuss your proposed changes.

License

This project is licensed under the Apache License 2.0.

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

Ten 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.
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

View Source
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"
)
View Source
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.

View Source
const (
	// APIVersion is the expected apiVersion value in all resource front-matter.
	APIVersion = "warp/v1alpha1"
)

Variables

View Source
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

func Format(res Resource) ([]byte, error)

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

func InstallPlugin(workspaceDir, source, version string, imports []string) error

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

func MakeQualifiedName(namespace string, kind Kind, name string) string

MakeQualifiedName constructs the "namespace/Kind/name" qualified name.

func NamespacePriority

func NamespacePriority(ns string) int

NamespacePriority returns the numeric priority for a namespace name. Unknown namespaces return 0.

func RecommendedExtension added in v0.0.3

func RecommendedExtension(kind Kind) string

RecommendedExtension returns the standard file extension (.md or .yaml) for the given resource kind.

func Render added in v0.0.2

func Render(res Resource, opts *RenderOptions) (string, error)

Render processes the resource's instructions as a template. It supports both standard Go text/template syntax ({{.Name}}) and a convenient shorthand syntax ($Name, $1).

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.

func (*Agent) DeepCopy

func (in *Agent) DeepCopy() *Agent

DeepCopy returns a deep copy of the Agent.

func (*Agent) Render added in v0.0.3

func (a *Agent) Render(opts *AgentRenderOptions) (string, error)

Render processes the agent's instructions as a template. It acts as a rich extension that injects Workspace, Project, and fully hydrated Agent metadata into the generic Render.

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"`
	// 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.

func (*AgentSpec) DeepCopy

func (in *AgentSpec) DeepCopy() *AgentSpec

DeepCopy returns a deep copy of the AgentSpec.

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) GetKind

func (b *BaseResource) GetKind() Kind

GetKind implements Resource.

func (*BaseResource) GetMetadata added in v0.0.2

func (b *BaseResource) GetMetadata() Metadata

GetMetadata implements Resource.

func (*BaseResource) GetName

func (b *BaseResource) GetName() string

GetName 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.

func (*Command) DeepCopy

func (in *Command) DeepCopy() *Command

DeepCopy returns a deep copy of the Command.

func (*Command) Render added in v0.0.3

func (c *Command) Render(opts *CommandRenderOptions) (string, error)

Render processes the command's instructions as a template. It acts as a rich extension that injects Workspace, Project scope, and Args into the generic Render.

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.

func (*Context) DeepCopy

func (in *Context) DeepCopy() *Context

DeepCopy returns a deep copy of the Context.

func (*Context) Render added in v0.0.3

func (c *Context) Render(opts *ContextRenderOptions) (string, error)

Render processes the context's instructions as a template. It acts as a rich extension that injects Workspace and Project scope into the generic Render.

type ContextRenderOptions added in v0.0.3

type ContextRenderOptions struct {
	Workspace *Workspace
	Project   *Project
	Globals   map[string]any
}

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 DiscoveredResource added in v0.0.3

type DiscoveredResource struct {
	Kind        Kind
	Name        string
	Description string
}

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, 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"
	// 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"
)

func ParseQualifiedName

func ParseQualifiedName(qn string) (namespace string, kind Kind, name string, ok bool)

ParseQualifiedName splits a qualified name of the form "namespace/Kind/name" into its three components. Returns ok=false when the input does not contain exactly two "/" separators.

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.

func (*MCP) DeepCopy

func (in *MCP) DeepCopy() *MCP

DeepCopy returns a deep copy of the MCP.

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 or sse
	Endpoint    string                    `yaml:"endpoint,omitempty"`    // HTTP URL for the MCP server if type: sse
	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
	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.

func (*MCPSpec) DeepCopy

func (in *MCPSpec) DeepCopy() *MCPSpec

DeepCopy returns a deep copy of the MCPSpec.

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.

func (*Metadata) DeepCopy

func (in *Metadata) DeepCopy() *Metadata

DeepCopy returns a deep copy of the Metadata.

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"
	Endpoint     string            `yaml:"endpoint"`                                   // API base URL
	DefaultModel string            `yaml:"defaultModel"`                               // Model to use if none specified
	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 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.

func (*Plugin) DeepCopy added in v0.0.3

func (in *Plugin) DeepCopy() *Plugin

DeepCopy returns a deep copy of the Plugin.

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.

func (*Policies) DeepCopy added in v0.0.3

func (in *Policies) DeepCopy() *Policies

DeepCopy returns a deep copy of the 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.

func (*Project) AbsPath

func (p *Project) AbsPath() string

AbsPath returns the absolute filesystem path to the project directory.

func (*Project) DeepCopy

func (p *Project) DeepCopy() *Project

DeepCopy returns a deep copy of the Project.

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 and output token 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 {
	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

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"`               // 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"`               // 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

type ProviderModelCostTierCondition added in v0.0.3

type ProviderModelCostTierCondition struct {
	Type string `yaml:"type"` // e.g., "context"
	Size int    `yaml:"size"` // e.g., 200000
}

type ProviderModelLimits

type ProviderModelLimits struct {
	Context int `yaml:"context"` // Max context length in tokens
	Output  int `yaml:"output"`  // Max output length in tokens
}

ProviderModelLimits defines the token 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

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

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

func NewRegistry(ws *Workspace) *Registry

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

func (r *Registry) AddProject(p *Project)

AddProject registers project metadata in the registry.

func (*Registry) GetProject

func (r *Registry) GetProject(slug string) (*Project, bool)

GetProject returns the project with the given slug, or (nil, false) when not found.

func (*Registry) ListProjects

func (r *Registry) ListProjects() []*Project

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

func (r *Registry) ProjectFromPath(absPath string) (*Project, bool)

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) ResolveResource

func (r *Registry) ResolveResource(ref string) (Resource, bool)

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

func (r *Registry) Resources() []Resource

Resources returns all resources stored in the registry across all namespaces, sorted deterministically by qualified name.

func (*Registry) Set

func (r *Registry) Set(qualifiedName string, res Resource)

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

func (r *Registry) Validate() error

Validate checks every resource for structural correctness and resolves cross-references. Returns the first error encountered.

func (*Registry) Warnings

func (r *Registry) Warnings() []string

Warnings returns non-fatal issues collected during loading.

func (*Registry) WorkspaceSpec

func (r *Registry) WorkspaceSpec() *Workspace

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
}

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
	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) 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.

func (*Skill) DeepCopy

func (s *Skill) DeepCopy() *Skill

DeepCopy returns a deep copy of the Skill.

func (*Skill) Render added in v0.0.3

func (s *Skill) Render(opts *SkillRenderOptions) (string, error)

Render processes the skill's instructions as a template. It acts as a rich extension that injects Workspace, Project, and the invoking Agent into the generic Render.

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.

func (*SkillSpec) DeepCopy

func (s *SkillSpec) DeepCopy() *SkillSpec

DeepCopy returns a deep copy of the SkillSpec.

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

type TemplateContext struct {
	Instructions string
	Path         string
}

TemplateContext represents the context view model for templates.

type TemplateProject added in v0.0.3

type TemplateProject struct {
	Name        string
	DisplayName string
	Dir         string
}

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

type TemplateTool struct {
	Name        string
	Description string
}

TemplateTool represents the tool view model for templates.

type TemplateWorkspace added in v0.0.3

type TemplateWorkspace struct {
	Dir  string
	Path string
}

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.

func (*Tool) DeepCopy

func (in *Tool) DeepCopy() *Tool

DeepCopy returns a deep copy of the Tool.

type ToolAnnotation

type ToolAnnotation struct {
	IsOpenWorld  bool   `yaml:"isOpenWorld"`  // Interacts with external resources
	IsDangerous  bool   `yaml:"isDangerous"`  // Can perform destructive actions
	IsReadOnly   bool   `yaml:"isReadOnly"`   // Does not modify state
	IsIdempotent bool   `yaml:"isIdempotent"` // Safe to retry
	UserHint     string `yaml:"userHint"`     // 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.

func (*ToolSpec) DeepCopy

func (in *ToolSpec) DeepCopy() *ToolSpec

DeepCopy returns a deep copy of the ToolSpec.

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.

func (*Toolkit) DeepCopy

func (in *Toolkit) DeepCopy() *Toolkit

DeepCopy returns a deep copy of the Toolkit.

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.

func (*Workspace) DeepCopy

func (w *Workspace) DeepCopy() *Workspace

DeepCopy returns a deep copy of the Workspace spec, making the value safe to use as an immutable snapshot independent of the original.

func (*Workspace) Render added in v0.0.3

func (w *Workspace) Render(opts *WorkspaceRenderOptions) (string, error)

Render processes the workspace's instructions as a template. It delegates to the generic Render engine which natively handles WorkspaceDef fields.

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,flow"`
	DefaultProvider string            `yaml:"defaultProvider"`
	DefaultAgent    string            `yaml:"defaultAgent"`
	Plugins         []WorkspacePlugin `yaml:"plugins"`
	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.

Directories

Path Synopsis
cmd
schema-gen command
warp command
internal

Jump to

Keyboard shortcuts

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