agentcontextconfig

package
v2.34.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

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

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

func ResolvePath(raw, baseDir string) string

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

func ResolvePaths(raw, baseDir string) []string

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

func NewAPI(workingDir func() string, cfg Config) *API

NewAPI creates a context configuration API. The working directory closure is evaluated lazily per request.

func (*API) MCPConfigFiles

func (api *API) MCPConfigFiles() []string

MCPConfigFiles returns the resolved MCP configuration file paths for the agent's MCP manager.

func (*API) Routes

func (api *API) Routes() http.Handler

Routes returns the HTTP handler for the context config endpoint.

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.

Jump to

Keyboard shortcuts

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