config

package
v0.17.7 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AntigravityModelFieldKey is the canonical config path for agy's model display
	// string. Sync projects this typed Agent Layer setting into Antigravity's
	// generated settings.json.
	AntigravityModelFieldKey = "agents.antigravity.model"
	// ClaudeModelFieldKey is the canonical config path for Claude Code model aliases.
	ClaudeModelFieldKey = "agents.claude.model"
	// ClaudeReasoningEffortFieldKey is the canonical config path for Claude Code effort.
	ClaudeReasoningEffortFieldKey = "agents.claude.reasoning_effort"
	// CodexModelFieldKey is the canonical config path for Codex model selection.
	CodexModelFieldKey = "agents.codex.model"
	// CodexReasoningEffortFieldKey is the canonical config path for Codex reasoning effort.
	CodexReasoningEffortFieldKey = "agents.codex.reasoning_effort"
	// CopilotCLIModelFieldKey is the canonical config path for Copilot CLI model selection.
	CopilotCLIModelFieldKey = "agents.copilot_cli.model"
	// GrokModelFieldKey is the canonical config path for Grok model selection.
	GrokModelFieldKey = "agents.grok.model"
	// GrokReasoningEffortFieldKey is the canonical config path for Grok reasoning effort.
	GrokReasoningEffortFieldKey = "agents.grok.reasoning_effort"
)
View Source
const (
	// ImportedSkillsDirName is the fully managed editable source tier for
	// Git-backed skill imports, relative to .agent-layer/.
	ImportedSkillsDirName = "skills-imported"
	// SkillsLockFileName is the machine-managed skill import lock, relative to
	// .agent-layer/.
	SkillsLockFileName = "skills.lock.json"
)
View Source
const (
	// CodexApprovalPolicyKey is the top-level Codex config key for approval mode.
	CodexApprovalPolicyKey = "approval_policy"
	// CodexMCPServersKey is the top-level Codex config key for MCP servers.
	CodexMCPServersKey = "mcp_servers"
	// CodexModelKey is the top-level Codex config key for model selection.
	CodexModelKey = "model"
	// CodexReasoningEffortKey is the top-level Codex config key for reasoning effort.
	CodexReasoningEffortKey = "model_reasoning_effort"
	// CodexProjectsKey is the top-level Codex config key for trusted projects.
	CodexProjectsKey = "projects"
	// CodexSandboxModeKey is the top-level Codex config key for sandbox mode.
	CodexSandboxModeKey = "sandbox_mode"
	// CodexWebSearchKey is the top-level Codex config key for web search.
	CodexWebSearchKey = "web_search"

	// CodexSandboxReadOnly denies all writes. Codex applies it by default to
	// `codex exec`, so headless dispatch inherits it unless it is set.
	CodexSandboxReadOnly = "read-only"
	// CodexSandboxWorkspaceWrite permits writes inside the working directory and
	// temporary directories. It matches Codex's own default preset for a
	// version-controlled folder and still protects `.git` and denies network.
	CodexSandboxWorkspaceWrite = "workspace-write"
	// CodexSandboxDangerFullAccess disables the sandbox entirely.
	CodexSandboxDangerFullAccess = "danger-full-access"
	// CodexFeatureAppsKey is the Codex [features] key controlling built-in apps.
	CodexFeatureAppsKey = "apps"
	// PluginsKey is the provider-native key used for plugin settings.
	PluginsKey = "plugins"
)
View Source
const (
	// SkillTrackingTracked follows the configured branch on `al skills pull`.
	SkillTrackingTracked = skilllock.TrackingTracked
	// SkillTrackingPinned holds the locked commit until an explicit retarget.
	SkillTrackingPinned = skilllock.TrackingPinned
)

Skill import tracking modes. An omitted value is resolved from the source ref kind during the first networked add or pull: branch refs become SkillTrackingTracked and tag/commit refs become SkillTrackingPinned.

The values come from internal/skilllock, which persists them, so configuration and recorded state can never drift apart.

View Source
const (
	// SkillWritePolicyNone disables upstream writes. It is the default.
	SkillWritePolicyNone = "none"
	// SkillWritePolicyBranch pushes to an explicitly configured non-primary branch.
	SkillWritePolicyBranch = "branch"
	// SkillWritePolicyDirect pushes to the destination repository's default branch.
	SkillWritePolicyDirect = "direct"
)

Skill import write policies.

View Source
const (
	ApprovalModeAll      = "all"
	ApprovalModeCommands = "commands"
	ApprovalModeMCP      = "mcp"
	ApprovalModeNone     = "none"
	ApprovalModeYOLO     = "yolo"
)

Approval mode constants.

View Source
const (
	// DefaultDispatchMCPWaitTimeoutMinutes is how long a healthy `dispatch_wait`
	// MCP call blocks before reporting the conversation as still running.
	DefaultDispatchMCPWaitTimeoutMinutes = 30
	// DefaultDispatchMCPToolTimeoutMinutes is the hard server-side bound applied
	// to every Agent Dispatch MCP handler. It exists purely as recovery headroom
	// above the bounded wait, so a wedged handler cannot linger indefinitely.
	DefaultDispatchMCPToolTimeoutMinutes = 40
)
View Source
const (
	TransportHTTP  = "http"
	TransportStdio = "stdio"
)

MCP transport type constants.

View Source
const BuiltinRepoRootEnvVar = "AL_REPO_ROOT"

BuiltinRepoRootEnvVar is the built-in placeholder for the repo root path.

View Source
const DefaultDispatchMaxDepth = 3

DefaultDispatchMaxDepth is the maximum dispatch recursion depth when unset.

View Source
const SkillExclusionPrefix = "!"

SkillExclusionPrefix marks a selector that removes candidates from its own block's desired set.

Variables

View Source
var ErrConfigNeedsUpgrade = errors.New("config requires migration")

ErrConfigNeedsUpgrade is a sentinel wrapped alongside ErrConfigValidation when a config fails validation because it contains a legacy key that only `al upgrade` can migrate (e.g. a removed agent table). Repair tools such as the wizard cannot rewrite these keys in place, so they use errors.Is(err, ErrConfigNeedsUpgrade) to redirect the user to `al upgrade` instead of attempting a fix that would dead-end at sync.

View Source
var ErrConfigValidation = errors.New("config validation failed")

ErrConfigValidation is a sentinel that wraps config validation failures (as opposed to TOML syntax, filesystem, or other loading errors). Callers can use errors.Is(err, ErrConfigValidation) to distinguish validation problems from other LoadProjectConfig failure modes.

View Source
var LegacySkillProjections = []LegacySkillProjection{
	{Dir: []string{".codex", skillsDirName}, Suffix: skillManifestName},
	{Dir: []string{".agent", skillsDirName}, Suffix: skillManifestName},
	{Dir: []string{".gemini", skillsDirName}, Suffix: skillManifestName},
	{Dir: []string{".github", skillsDirName}, Suffix: skillManifestName},
	{Dir: []string{".vscode", "prompts"}, Suffix: ".prompt.md"},
}

LegacySkillProjections is the canonical list of retired projection paths. It is the single source of truth consumed by both the sync cleanup helper and the upgrade-readiness check.

Functions

func ClaudeStatuslineEnabled added in v0.11.0

func ClaudeStatuslineEnabled(c ClaudeConfig) bool

ClaudeStatuslineEnabled reports whether the Claude status line should be projected and wired. It is explicit opt-in: only true enables it.

func CodexBrowserFeatureKeys added in v0.12.0

func CodexBrowserFeatureKeys() []string

CodexBrowserFeatureKeys returns the Codex [features] keys controlled by the browser/computer-use wizard toggle.

func CodexKnownManagedFeatureKeys added in v0.12.0

func CodexKnownManagedFeatureKeys() []string

CodexKnownManagedFeatureKeys returns Codex [features] keys Agent Layer knows how to remove when absent from the current projection.

func CodexLocalConfigDirEnabled added in v0.12.0

func CodexLocalConfigDirEnabled(c CodexConfig) bool

CodexLocalConfigDirEnabled reports whether Agent Layer should set CODEX_HOME to the repo-local .codex directory. It is explicit opt-in: only true enables it.

func CodexManagedTopLevelKeys added in v0.12.0

func CodexManagedTopLevelKeys() []string

CodexManagedTopLevelKeys returns top-level .codex/config.toml keys managed by Agent Layer. The returned slice is caller-owned.

func CodexStatuslineEnabled added in v0.11.0

func CodexStatuslineEnabled(c CodexConfig) bool

CodexStatuslineEnabled reports whether the Codex status line should be wired. It is explicit opt-in: only true enables it.

func DispatchMCPToolTimeout added in v0.15.0

func DispatchMCPToolTimeout(c Config) time.Duration

DispatchMCPToolTimeout returns the hard bound applied to every Agent Dispatch MCP handler and projected into clients with per-server tool timeouts.

func DispatchMCPWaitTimeout added in v0.15.0

func DispatchMCPWaitTimeout(c Config) time.Duration

DispatchMCPWaitTimeout returns how long one `dispatch_wait` MCP call blocks before reporting the conversation as still running.

func DispatchMaxDepth added in v0.12.0

func DispatchMaxDepth(c Config) int

DispatchMaxDepth returns the configured Agent Dispatch maximum depth.

func ExpandPath added in v0.5.6

func ExpandPath(value string, repoRoot string) (string, error)

ExpandPath expands "~" and resolves relative paths against repoRoot. value is the resolved string (placeholders already substituted).

func ExpandPathIfNeeded added in v0.5.6

func ExpandPathIfNeeded(raw string, value string, repoRoot string) (string, error)

ExpandPathIfNeeded expands value when the raw input signals a path placeholder.

func ExtractEnvVarNames

func ExtractEnvVarNames(input string) []string

ExtractEnvVarNames returns env var names referenced by ${VAR} placeholders. input is a string that may contain placeholders; returns names in scan order.

func FieldOptionValues added in v0.8.2

func FieldOptionValues(key string) []string

FieldOptionValues returns the option values for a field as a plain string slice. Returns nil when the key is not in the catalog or has no options.

func GrokDisableMemory added in v0.17.0

func GrokDisableMemory(c GrokConfig) bool

GrokDisableMemory reports whether Agent Layer should force-disable Grok memory for this project.

func HasLegacyAntigravityAgentSpecificModel added in v0.12.0

func HasLegacyAntigravityAgentSpecificModel(data []byte) bool

HasLegacyAntigravityAgentSpecificModel reports whether `data` contains the pre-v0.12.0 Antigravity provider passthrough model key. That key is migrated to the typed `agents.antigravity.model` field by `al upgrade`; repair tools must not preserve it through lenient config rewrites.

func HasLegacyDispatchConfig added in v0.14.0

func HasLegacyDispatchConfig(data []byte) bool

HasLegacyDispatchConfig reports whether data contains retired per-agent dispatch default tables that must be removed by al upgrade.

func HasLegacyGeminiConfig added in v0.11.0

func HasLegacyGeminiConfig(data []byte) bool

HasLegacyGeminiConfig reports whether `data` contains a legacy `[agents.gemini]` table or any subkey under it. Parses the raw TOML map so whitespace, tabs, comments, and TOML inline-table forms are all handled correctly — the previous space-strip substring scan missed tab-indented and comment-style configs.

func HasProviderPassthroughKey added in v0.12.0

func HasProviderPassthroughKey(passthrough map[string]any, key string) bool

HasProviderPassthroughKey returns true when passthrough defines a top-level key.

func IsAgentEnabled added in v0.9.2

func IsAgentEnabled(p *bool) bool

IsAgentEnabled returns true if the agent-enabled pointer is non-nil and true.

func IsBuiltInEnvVar added in v0.5.6

func IsBuiltInEnvVar(name string) bool

IsBuiltInEnvVar reports whether name is reserved for built-in placeholders.

func IsSkillExclusionSelector added in v0.16.0

func IsSkillExclusionSelector(selector string) bool

IsSkillExclusionSelector reports whether a configured selector removes candidates instead of adding them.

func LoadCommandsAllowFS added in v0.5.7

func LoadCommandsAllowFS(fsys fs.FS, root string, path string) ([]string, error)

LoadCommandsAllowFS reads .agent-layer/commands.allow from fsys into a slice of prefixes. root is used for path resolution when path is absolute; path is used for error messages.

func LoadEnv

func LoadEnv(path string) (map[string]string, error)

LoadEnv reads .agent-layer/.env into a key-value map. A missing file is equivalent to an empty environment; malformed or unreadable files fail.

func LoadEnvFS added in v0.5.7

func LoadEnvFS(fsys fs.FS, root string, path string) (map[string]string, error)

LoadEnvFS reads .agent-layer/.env from fsys into a key-value map. A missing file is equivalent to an empty environment; malformed or unreadable files fail. root is used for path resolution when path is absolute; path is used for error messages.

func NormalizeSkillRepository added in v0.16.0

func NormalizeSkillRepository(repository string) string

NormalizeSkillRepository trims a configured repository reference so the same remote written with incidental whitespace or a trailing slash resolves to one configuration identity. It does not rewrite scheme, host, or path.

func NormalizeSkillSelector added in v0.16.0

func NormalizeSkillSelector(selector string) string

NormalizeSkillSelector trims a selector and normalizes its path separators so selector identity does not depend on incidental formatting. The `!` exclusion prefix is preserved.

func NotificationsChimeEnabled added in v0.12.0

func NotificationsChimeEnabled(c Config) bool

NotificationsChimeEnabled reports whether Agent Layer should project a local turn-stop chime into supported provider-native hook systems.

func RequiredEnvVarsForMCPServer

func RequiredEnvVarsForMCPServer(server MCPServer) []string

RequiredEnvVarsForMCPServer returns required env var names for a single MCP server. server is the MCP server definition; returns a sorted list of unique names.

func RequiredEnvVarsForMCPServers

func RequiredEnvVarsForMCPServers(servers []MCPServer) []string

RequiredEnvVarsForMCPServers returns required env var names across all MCP servers. servers is a list of MCP server definitions; returns a sorted list of unique names.

func SetSkillImportSelectors added in v0.16.0

func SetSkillImportSelectors(content string, identity SkillImportBlockIdentity, selectors []string) (string, error)

SetSkillImportSelectors returns config TOML content whose `[[skills.imports]]` block matching identity declares exactly selectors, preserving every unrelated line, comment, and formatting choice.

An empty selectors slice removes the matching block. A non-empty slice with no matching block appends a new block built from identity. Selector order is preserved as given so callers control the recorded configuration order.

func SharedAgentSkillsEnabled added in v0.10.0

func SharedAgentSkillsEnabled(agents AgentsConfig) bool

SharedAgentSkillsEnabled reports whether any agent that consumes the shared `.agents/skills/` projection is enabled. Adding a new shared-skill consumer means updating this function in one place; sync writers and readiness checks both read from it.

func ShouldExpandPath added in v0.5.6

func ShouldExpandPath(value string) bool

ShouldExpandPath reports whether value requests path expansion. Path expansion is enabled when the value starts with "~" or "${AL_REPO_ROOT}".

func SkillExclusionPath added in v0.16.0

func SkillExclusionPath(selector string) string

SkillExclusionPath returns the selector path with any exclusion prefix removed.

func SubstituteEnvVars

func SubstituteEnvVars(input string, env map[string]string) (string, error)

SubstituteEnvVars replaces ${VAR} placeholders using env values.

func SubstituteEnvVarsWith

func SubstituteEnvVarsWith(input string, env map[string]string, replacer EnvVarReplacer) (string, error)

SubstituteEnvVarsWith replaces ${VAR} placeholders using env values and a replacer.

func ValidateSkillSelectorPath added in v0.16.0

func ValidateSkillSelectorPath(value string) error

ValidateSkillSelectorPath enforces the repository-relative selector path syntax shared by configuration validation and `al skills add`/`remove`.

func WithBuiltInEnv added in v0.5.6

func WithBuiltInEnv(env map[string]string, repoRoot string) map[string]string

WithBuiltInEnv returns a copy of env with built-in values added. env is the parsed .env map; repoRoot should be the absolute repo root path.

Types

type AgentConfig

type AgentConfig struct {
	Enabled         *bool  `toml:"enabled"`
	Model           string `toml:"model"`
	ReasoningEffort string `toml:"reasoning_effort"`
}

AgentConfig is for agents that support enablement and model selection. ReasoningEffort is present so the TOML decoder accepts the key without raising an unknown-key error; the validator then provides a specific error message for agents that do not support reasoning effort.

type AgentsConfig

type AgentsConfig struct {
	Antigravity  AntigravityConfig `toml:"antigravity"`
	Claude       ClaudeConfig      `toml:"claude"`
	ClaudeVSCode EnableOnlyConfig  `toml:"claude_vscode"`
	Codex        CodexConfig       `toml:"codex"`
	VSCode       EnableOnlyConfig  `toml:"vscode"`
	CopilotCLI   AgentConfig       `toml:"copilot_cli"`
	Grok         GrokConfig        `toml:"grok"`
}

AgentsConfig holds per-client enablement and model selection.

type AntigravityConfig added in v0.11.0

type AntigravityConfig struct {
	Enabled       *bool               `toml:"enabled"`
	Model         string              `toml:"model"`
	AgentSpecific ProviderPassthrough `toml:"agent_specific"`
}

AntigravityConfig is for the Antigravity (`agy`) client. Model selection is a first-class Agent Layer setting and sync projects it into .agy/antigravity-cli/settings.json.

type ApprovalsConfig

type ApprovalsConfig struct {
	Mode string `toml:"mode"`
}

ApprovalsConfig controls auto-approval behavior per client.

type ClaudeConfig added in v0.8.5

type ClaudeConfig struct {
	Enabled         *bool  `toml:"enabled"`
	Model           string `toml:"model"`
	ReasoningEffort string `toml:"reasoning_effort"`
	LocalConfigDir  *bool  `toml:"local_config_dir"`
	// DisableQuestionTool, when true, blocks Claude Code's AskUserQuestion tool.
	// Sync injects permissions.deny + a PreToolUse hook into .claude/settings.json
	// (merged with any user agent_specific entries). nil/false leave it allowed.
	DisableQuestionTool *bool `toml:"disable_question_tool"`
	// Statusline controls whether Agent Layer projects the editable
	// .agent-layer/claude-statusline.sh source into .claude/claude-statusline.sh
	// and wires statusLine into .claude/settings.json on sync. It is explicit
	// opt-in: only true enables it. Read via
	// ClaudeStatuslineEnabled.
	Statusline    *bool               `toml:"statusline"`
	AgentSpecific ProviderPassthrough `toml:"agent_specific"`
}

ClaudeConfig extends AgentConfig with Claude-specific settings.

type CodexConfig

type CodexConfig struct {
	Enabled         *bool  `toml:"enabled"`
	Model           string `toml:"model"`
	ReasoningEffort string `toml:"reasoning_effort"`
	LocalConfigDir  *bool  `toml:"local_config_dir"`
	// Statusline controls whether Agent Layer reads the editable
	// .agent-layer/codex-statusline.toml source and injects its native
	// tui.status_line list into .codex/config.toml on sync. It is explicit
	// opt-in: only true enables it. Read via
	// CodexStatuslineEnabled.
	Statusline    *bool               `toml:"statusline"`
	AgentSpecific ProviderPassthrough `toml:"agent_specific"`
}

CodexConfig extends AgentConfig with Codex-specific settings.

type Config

type Config struct {
	Approvals     ApprovalsConfig     `toml:"approvals"`
	Agents        AgentsConfig        `toml:"agents"`
	Dispatch      DispatchLimits      `toml:"dispatch"`
	MCP           MCPConfig           `toml:"mcp"`
	Notifications NotificationsConfig `toml:"notifications"`
	Skills        SkillsConfig        `toml:"skills"`
	Warnings      WarningsConfig      `toml:"warnings"`
}

Config is the root configuration loaded from .agent-layer/config.toml.

func LoadConfigFS added in v0.5.7

func LoadConfigFS(fsys fs.FS, root string, path string) (*Config, error)

LoadConfigFS reads .agent-layer/config.toml from fsys and validates it. root is used for path resolution when path is absolute; path is used for error messages.

func LoadConfigLenient added in v0.8.2

func LoadConfigLenient(path string) (*Config, error)

LoadConfigLenient reads .agent-layer/config.toml without validation. Returns an error only on filesystem or TOML syntax errors.

func LoadTemplateConfig

func LoadTemplateConfig() (*Config, error)

LoadTemplateConfig returns the embedded default config template as a validated Config.

func ParseConfig

func ParseConfig(data []byte, source string) (*Config, error)

ParseConfig parses and validates config TOML data from a source identifier. data is the TOML content; source is used in error messages.

func ParseConfigLenient added in v0.8.2

func ParseConfigLenient(data []byte, source string) (*Config, error)

ParseConfigLenient parses config TOML data without validation. Returns an error only on TOML syntax errors. Missing or invalid fields are not checked, making this suitable for repair tools (wizard, doctor) that need to read partially valid configs.

func (*Config) Validate

func (c *Config) Validate(path string) error

Validate ensures the config is complete and consistent.

type DispatchLimits added in v0.12.0

type DispatchLimits struct {
	MaxDepth *int `toml:"max_depth"`
	// MCPWaitTimeoutMinutes bounds one `dispatch_wait` MCP call. Nil selects
	// DefaultDispatchMCPWaitTimeoutMinutes.
	MCPWaitTimeoutMinutes *int `toml:"mcp_wait_timeout_minutes"`
	// MCPToolTimeoutMinutes bounds every Agent Dispatch MCP handler and is
	// projected into clients that support a per-server tool timeout. Nil selects
	// DefaultDispatchMCPToolTimeoutMinutes.
	MCPToolTimeoutMinutes *int `toml:"mcp_tool_timeout_minutes"`
}

DispatchLimits controls Agent Dispatch recursion and MCP timeout limits.

type EnableOnlyConfig added in v0.8.5

type EnableOnlyConfig struct {
	Enabled *bool `toml:"enabled"`
}

EnableOnlyConfig is for agents that support enablement but not model selection.

type EnvVarReplacer

type EnvVarReplacer func(name string, value string) string

EnvVarReplacer returns a replacement string for a resolved env var.

type FieldDef added in v0.8.2

type FieldDef struct {
	Key         string
	Type        FieldType
	Required    bool
	Options     []FieldOption
	AllowCustom bool // when true, enum fields also accept freetext values
}

FieldDef describes a single config field's type, constraints, and valid options.

func Fields added in v0.8.2

func Fields() []FieldDef

Fields returns a copy of all registered field definitions in catalog order.

func LookupField added in v0.8.2

func LookupField(key string) (FieldDef, bool)

LookupField returns the field definition for the given config key. Returns false when the key is not in the catalog.

type FieldOption added in v0.8.2

type FieldOption struct {
	Value       string
	Description string // empty for options without descriptions
}

FieldOption describes a single selectable value for a field.

type FieldType added in v0.8.2

type FieldType string

FieldType classifies the kind of value a config field accepts.

const (
	// FieldBool accepts true or false.
	FieldBool FieldType = "bool"
	// FieldEnum accepts one of a fixed set of options.
	FieldEnum FieldType = "enum"
	// FieldFreetext accepts arbitrary string input.
	FieldFreetext FieldType = "freetext"
	// FieldPositiveInt accepts a positive integer.
	FieldPositiveInt FieldType = "positive_int"
)

type GrokConfig added in v0.17.0

type GrokConfig struct {
	Enabled         *bool  `toml:"enabled"`
	Model           string `toml:"model"`
	ReasoningEffort string `toml:"reasoning_effort"`
	// DisableMemory, when true, force-disables Grok's experimental memory via
	// --no-memory and GROK_MEMORY=0. nil/false leave Grok's own default (off).
	DisableMemory *bool               `toml:"disable_memory"`
	AgentSpecific ProviderPassthrough `toml:"agent_specific"`
}

GrokConfig extends AgentConfig with Grok-specific settings.

type InstructionFile

type InstructionFile struct {
	Name    string
	Content string
}

InstructionFile holds a single instruction fragment.

func LoadInstructionsFS added in v0.5.7

func LoadInstructionsFS(fsys fs.FS, root string, dir string) ([]InstructionFile, error)

LoadInstructionsFS reads .agent-layer/instructions/*.md from fsys in lexicographic order. root is used for path resolution when dir is absolute; dir is used for error messages.

type LegacySkillProjection added in v0.10.0

type LegacySkillProjection struct {
	Dir    []string
	Suffix string
}

LegacySkillProjection names a retired client-side directory that Agent Layer claims exclusive ownership of and removes during every sync. The Suffix is the file extension used to locate generated artifacts during readiness detection. See docs/SKILL-CLIENT-SPEC.md "Ownership of legacy projection paths" for the rationale.

type MCPConfig

type MCPConfig struct {
	Servers []MCPServer `toml:"servers"`
}

MCPConfig contains the external MCP servers configuration.

type MCPServer

type MCPServer struct {
	ID            string            `toml:"id"`
	Enabled       *bool             `toml:"enabled"`
	Clients       []string          `toml:"clients"`
	Transport     string            `toml:"transport"`
	HTTPTransport string            `toml:"http_transport"`
	URL           string            `toml:"url"`
	Headers       map[string]string `toml:"headers"`
	Command       string            `toml:"command"`
	Args          []string          `toml:"args"`
	Env           map[string]string `toml:"env"`
}

MCPServer defines a single MCP server entry.

func (MCPServer) AppliesToClient

func (s MCPServer) AppliesToClient(client string) bool

AppliesToClient reports whether the server is enabled for the given client.

type NotificationsConfig added in v0.12.0

type NotificationsConfig struct {
	Chime *bool `toml:"chime"`
}

NotificationsConfig controls user-visible local notification behavior.

type Paths

type Paths struct {
	Root              string
	ConfigPath        string
	EnvPath           string
	InstructionsDir   string
	SkillsDir         string
	ImportedSkillsDir string
	SkillsLockPath    string
	CommandsAllow     string
}

Paths holds resolved paths for config files and directories.

func DefaultPaths

func DefaultPaths(root string) Paths

DefaultPaths returns the default config paths for a repo root.

type ProjectConfig

type ProjectConfig struct {
	Config        Config
	Env           map[string]string
	Instructions  []InstructionFile
	Skills        []Skill
	CommandsAllow []string
	Root          string
}

ProjectConfig is the fully loaded configuration state for sync and launch.

func LoadProjectConfig

func LoadProjectConfig(root string) (*ProjectConfig, error)

LoadProjectConfig reads and validates the full Agent Layer config from disk.

func LoadProjectConfigFS added in v0.5.7

func LoadProjectConfigFS(fsys fs.FS, root string) (*ProjectConfig, error)

LoadProjectConfigFS reads and validates the full Agent Layer config from an fs.FS rooted at repo root. fsys is the filesystem to read from; root is used for error messages and built-in env values.

type ProviderPassthrough added in v0.12.0

type ProviderPassthrough = map[string]any

ProviderPassthrough stores raw provider-native config from an `agent_specific` TOML table. It is an escape hatch for settings Agent Layer does not model; Agent Layer-owned settings belong in typed fields.

type Skill added in v0.9.0

type Skill struct {
	Name        string
	Description string
	SourcePath  string
	SourceDir   string // Absolute path to the skill directory (parent of SKILL.md)
	Tree        skilltree.Tree
	// Imported is true when the skill's editable source lives under
	// .agent-layer/skills-imported/ instead of .agent-layer/skills/. Both tiers
	// project identically; the flag exists so ownership rules and `al skills
	// status` never have to infer provenance from a path prefix.
	Imported bool
}

Skill carries validated identity, provenance, and the exact canonical tree.

func LoadImportedSkillsFS added in v0.16.0

func LoadImportedSkillsFS(fsys fs.FS, root string, dir string) ([]Skill, error)

LoadImportedSkillsFS reads .agent-layer/skills-imported from fsys using the same strict directory-format rules as user-managed skills, and marks every result as imported. A missing directory contributes no skills because imports are optional; any other read failure is returned. root is used for path resolution when dir is absolute; dir is used for error messages.

func LoadSkills added in v0.9.0

func LoadSkills(dir string) ([]Skill, error)

LoadSkills reads .agent-layer/skills from disk. Supported source format: - .agent-layer/skills/<name>/SKILL.md Flat-format .agent-layer/skills/<name>.md files are rejected with actionable errors. Directories without a supported skill file also fail loudly.

func LoadSkillsFS added in v0.9.0

func LoadSkillsFS(fsys fs.FS, root string, dir string) ([]Skill, error)

LoadSkillsFS reads .agent-layer/skills from fsys. root is used for path resolution when dir is absolute; dir is used for error messages. Directories without a supported skill file fail loudly.

type SkillImport added in v0.16.0

type SkillImport struct {
	// Repository is the source Git repository reachable through the user's
	// existing Git authentication.
	Repository string `toml:"repository"`
	// Selectors are exact paths, path wildcards, or `!`-prefixed exclusions.
	Selectors []string `toml:"selectors"`
	// Ref is a branch, tag, or commit. An empty value resolves to the
	// repository's default branch on every pull.
	Ref string `toml:"ref"`
	// Tracking is SkillTrackingTracked or SkillTrackingPinned. An empty value is
	// resolved from the source ref kind during the first networked operation.
	Tracking string `toml:"tracking"`
	// WritePolicy is SkillWritePolicyNone, SkillWritePolicyBranch, or
	// SkillWritePolicyDirect. An empty value means SkillWritePolicyNone.
	WritePolicy string `toml:"write_policy"`
	// PushRepository is the destination repository. An empty value means the
	// source repository, which permits fork-based contribution when set.
	PushRepository string `toml:"push_repository"`
	// PushBranch is the required explicit destination branch for
	// SkillWritePolicyBranch.
	PushBranch string `toml:"push_branch"`
}

SkillImport declares one Git-backed skill import block. Every selector in a block shares the block's repository, source ref, tracking mode, write policy, and push destination; per-selector overrides are unsupported.

func (SkillImport) EffectivePushRepository added in v0.16.0

func (imp SkillImport) EffectivePushRepository() string

EffectivePushRepository returns the destination repository for upstream writes, falling back to the source repository when no fork is configured.

func (SkillImport) EffectiveWritePolicy added in v0.16.0

func (imp SkillImport) EffectiveWritePolicy() string

EffectiveWritePolicy returns the block's write policy with the documented `none` default applied.

func (SkillImport) ExclusionSelectors added in v0.16.0

func (imp SkillImport) ExclusionSelectors() []string

ExclusionSelectors returns the block's exclusion selectors with the `!` prefix removed, in configuration order.

func (SkillImport) Identity added in v0.16.0

func (imp SkillImport) Identity() SkillImportBlockIdentity

Identity returns the block's policy identity with defaults applied.

func (SkillImport) PositiveSelectors added in v0.16.0

func (imp SkillImport) PositiveSelectors() []string

PositiveSelectors returns the block's non-exclusion selectors in configuration order.

func (SkillImport) WriteEnabled added in v0.16.0

func (imp SkillImport) WriteEnabled() bool

WriteEnabled reports whether the block permits upstream writes.

type SkillImportBlockIdentity added in v0.16.0

type SkillImportBlockIdentity struct {
	Repository     string
	Ref            string
	Tracking       string
	WritePolicy    string
	PushRepository string
	PushBranch     string
}

SkillImportBlockIdentity is the tuple that makes two import blocks interchangeable. Configuration keeps one block per unique identity so selector additions with the same policy extend an existing block.

type SkillsConfig added in v0.16.0

type SkillsConfig struct {
	Imports []SkillImport `toml:"imports"`
}

SkillsConfig groups skill-source configuration.

type WarningsConfig

type WarningsConfig struct {
	VersionUpdateOnSync            *bool  `toml:"version_update_on_sync"`
	NoiseMode                      string `toml:"noise_mode"`
	InstructionTokenThreshold      *int   `toml:"instruction_token_threshold"`
	MCPServerThreshold             *int   `toml:"mcp_server_threshold"`
	MCPToolsTotalThreshold         *int   `toml:"mcp_tools_total_threshold"`
	MCPServerToolsThreshold        *int   `toml:"mcp_server_tools_threshold"`
	MCPSchemaTokensTotalThreshold  *int   `toml:"mcp_schema_tokens_total_threshold"`
	MCPSchemaTokensServerThreshold *int   `toml:"mcp_schema_tokens_server_threshold"`
}

WarningsConfig configures optional warning thresholds. Nil fields disable their warnings.

Jump to

Keyboard shortcuts

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