Documentation
¶
Index ¶
Constants ¶
const ( EnvInstructionsDirs = "CODER_AGENT_EXP_INSTRUCTIONS_DIRS" EnvInstructionsFile = "CODER_AGENT_EXP_INSTRUCTIONS_FILE" EnvSkillsDirs = "CODER_AGENT_EXP_SKILLS_DIRS" EnvSkillMetaFile = "CODER_AGENT_EXP_SKILL_META_FILE" EnvMCPConfigFiles = "CODER_AGENT_EXP_MCP_CONFIG_FILES" )
Env var names for context configuration. Prefixed with EXP_ to indicate these are experimental and may change.
const ( DefaultInstructionsDir = "~/.coder" DefaultInstructionsFile = "AGENTS.md" DefaultSkillsDir = "~/.coder/skills,.agents/skills" DefaultSkillMetaFile = "SKILL.md" DefaultMCPConfigFile = ".mcp.json" )
Default values for agent-internal configuration. These are used when the corresponding env vars are unset.
DefaultSkillsDir is a comma-separated list so home-scoped skills override project-scoped ones with the same name (discoverSkills picks the first occurrence per skill name).
Variables ¶
This section is empty.
Functions ¶
func ClearEnvVars ¶ added in v2.33.0
func ClearEnvVars()
ClearEnvVars removes the CODER_AGENT_EXP_* environment variables from the current process so they are not inherited by child processes.
func ContextPartsFromDir ¶ added in v2.33.0
func ContextPartsFromDir(dir string) []codersdk.ChatMessagePart
ContextPartsFromDir reads instruction files and discovers skills from a specific directory, using default file names. This is used by the CLI chat context commands to read context from an arbitrary directory without consulting agent env vars.
func Resolve ¶ added in v2.33.0
func Resolve(workingDir string, cfg Config) (workspacesdk.ContextConfigResponse, []string)
Resolve reads instruction files, discovers skills, and resolves MCP config file paths for the given config and working directory.
func ResolvePath ¶
ResolvePath resolves a single path that may be absolute, home-relative (~/ or ~), or relative to the given base directory. Returns an absolute path. Empty input returns empty.
func ResolvePaths ¶
ResolvePaths splits a comma-separated list of paths and resolves each entry independently. Empty entries and entries that resolve to empty strings are skipped.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API exposes the resolved context configuration through the agent's HTTP API.
func NewAPI ¶
NewAPI creates a context configuration API. The working directory closure is evaluated lazily per request.
func (*API) MCPConfigFiles ¶
MCPConfigFiles returns the resolved MCP configuration file paths for the agent's MCP manager.
type Config ¶
type Config struct {
InstructionsDirs string
InstructionsFile string
SkillsDirs string
SkillMetaFile string
MCPConfigFiles string
}
Config holds the agent's context configuration. Defaults are applied by NewAPI, not by the zero value.
func ReadEnvConfig ¶ added in v2.33.0
func ReadEnvConfig() Config
ReadEnvConfig reads the CODER_AGENT_EXP_* environment variables, falling back to defaults for unset values.