config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 10 Imported by: 0 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.

Documentation

Index

Constants

View Source
const Filename = ".decsr.yaml" // legacy project config (root-level)
View Source
const GlobalDir = ".decsr"

GlobalDir is the directory for user-wide settings.

View Source
const GlobalFilename = "config.yaml"

GlobalFilename is the config file inside the global directory.

View Source
const ProjectFilename = "project.yaml"

ProjectFilename is the project config file inside the workspace directory.

Variables

View Source
var BuiltinRoles = []string{"pm", "coder", "coder_fixer", "qa", "ux_reviewer", "security"}

BuiltinRoles are the agent roles shipped with DECSR, in display order.

View Source
var SupportedProgrammingLanguages = []string{
	"python",
	"java",
	"csharp",
	"cpp",
	"c",
	"go",
	"javascript",
	"typescript",
	"rust",
	"ruby",
	"elixir",
	"swift",
	"kotlin",
	"scala",
}

SupportedProgrammingLanguages lists selectable project programming languages.

Functions

func ApplyProfile added in v0.4.0

func ApplyProfile(root, name string) error

ApplyProfile writes the profile's roles into <root>/.decsr/project.yaml (roles not in the profile are left alone) and records the profile name. It fails without writing when the profile is invalid or project.yaml cannot be parsed.

func DeleteProfile added in v0.4.0

func DeleteProfile(name string) error

DeleteProfile removes a saved profile.

func EnsureGlobalDir

func EnsureGlobalDir() (string, error)

EnsureGlobalDir creates ~/.decsr if it doesn't exist.

func IsBuiltinRole added in v0.3.0

func IsBuiltinRole(name string) bool

IsBuiltinRole reports whether name is one of the built-in roles.

func KnownRunner added in v0.4.0

func KnownRunner(name string) bool

KnownRunner reports whether name is a runner the factory accepts.

func ListProfiles added in v0.4.0

func ListProfiles() []string

ListProfiles returns the saved profile names, sorted.

func LoadUserSkill added in v0.4.0

func LoadUserSkill(root, name string) (string, error)

LoadUserSkill returns the skill document <root>/.decsr/skills/<name>.md, or else ~/.decsr/skills/<name>.md. The name is validated and the file is capped at 64 KB.

func ProfilesDir added in v0.4.0

func ProfilesDir() string

ProfilesDir is ~/.decsr/profiles ("" when the home directory is unknown).

func Save

func Save(root string, cfg Config) error

Save writes cfg to <root>/.decsr/project.yaml.

func SaveGlobal

func SaveGlobal(cfg Config) error

SaveGlobal writes cfg to ~/.decsr/config.yaml.

func SaveProfile added in v0.4.0

func SaveProfile(name string, agents map[string]AgentConfig) error

SaveProfile stores agents as profile name. Only runner, model, effort, description, read_only and skills are kept; roles with none of them set are left out.

func SaveProjectRole added in v0.3.0

func SaveProjectRole(root, name string, ac AgentConfig) error

SaveProjectRole sets agents[name] in <root>/.decsr/project.yaml, keeping the rest of the project settings. It fails without touching the file when project.yaml exists but cannot be parsed.

func ValidName added in v0.4.0

func ValidName(s string) bool

ValidName reports whether s is a valid profile, command or skill name.

func ValidRoleName added in v0.3.0

func ValidRoleName(name string) bool

ValidRoleName reports whether name is a valid custom role name.

Types

type AgentConfig

type AgentConfig struct {
	Runner           string   `yaml:"runner,omitempty"`
	Model            string   `yaml:"model,omitempty"`
	Description      string   `yaml:"description,omitempty"`        // role description (custom workspace roles)
	Effort           string   `yaml:"effort,omitempty"`             // "" = unset, "default" = provider default
	MaxContextTokens int      `yaml:"max_context_tokens,omitempty"` // 0 = no limit (for local models)
	ReadOnly         bool     `yaml:"read_only,omitempty"`          // workspace role that reports only and never writes files
	Skills           []string `yaml:"-"`                            // always from defaults, never persisted
	UserSkills       []string `yaml:"skills,omitempty"`             // file-based skills (.decsr/skills/<name>.md)
}

type Config

type Config struct {
	Project        ProjectConfig          `yaml:"project,omitempty"`
	Agents         map[string]AgentConfig `yaml:"agents,omitempty"`
	PromptLanguage string                 `yaml:"prompt_language,omitempty"`
	ModelMemory    ModelMemoryConfig      `yaml:"model_memory,omitempty"`
	Notifications  NotifyConfig           `yaml:"notifications,omitempty"`
	Workspace      WorkspaceConfig        `yaml:"workspace,omitempty"`
}

func DefaultConfig

func DefaultConfig() Config

func Load

func Load(root string) (Config, error)

Load reads config with layered precedence: 1. Built-in defaults 2. ~/.decsr/config.yaml (global user settings — models, runners, skills) 3. <root>/.decsr/project.yaml (project-specific overrides)

func LoadProject

func LoadProject(root string) Config

LoadProject reads only the project-level config (<root>/.decsr/project.yaml) without layering defaults or global settings. Returns an empty config if the file does not exist.

type ContextConfig

type ContextConfig struct {
	AlwaysInclude   []string            `yaml:"always_include,omitempty"`
	ExcludePatterns []string            `yaml:"exclude_patterns,omitempty"`
	SemanticIndex   SemanticIndexConfig `yaml:"semantic_index,omitempty"`
	Memory          MemoryConfig        `yaml:"memory,omitempty"`
	Pack            ContextPackConfig   `yaml:"pack,omitempty"`

	// ScopedContextShadow enables measurement-only logging of symbol-scoped
	// source context during review: the scoped context is rendered and its
	// token estimate logged (agent="<role>-shadow") alongside the whole-file
	// context that is actually sent. It does NOT change what agents receive.
	// Requires the semantic index to be enabled. Default false.
	ScopedContextShadow bool `yaml:"scoped_context_shadow,omitempty"`

	// ScopedContextCoderFix enables ADDITIVE symbol-scoped related context in
	// the coder fix loop: the changed/error files are still rendered whole, and
	// semantically related declarations are appended scoped (cheaply) to improve
	// fix recall. Non-destructive — it never removes the code being fixed.
	// Requires the semantic index to be enabled. Default false.
	ScopedContextCoderFix bool `yaml:"scoped_context_coder_fix,omitempty"`
}

type ContextPackConfig

type ContextPackConfig struct {
	Disable         bool `yaml:"disable,omitempty"`
	MaxOutputTokens int  `yaml:"max_output_tokens,omitempty"` // cap for the generated portion
}

ContextPackConfig controls the PM-compacted repository context pack that is generated and approved before planning. The pack is enabled by default; Disable follows the layered config's "true overrides" convention.

type MemoryConfig

type MemoryConfig struct {
	Enabled           bool    `yaml:"enabled,omitempty"`             // default true
	TopK              int     `yaml:"top_k,omitempty"`               // default 8
	ChunkTokens       int     `yaml:"chunk_tokens,omitempty"`        // default 400
	OverlapTokens     int     `yaml:"overlap_tokens,omitempty"`      // default 80
	HybridAlpha       float64 `yaml:"hybrid_alpha,omitempty"`        // default 0.5; 1.0 = pure BM25
	MaxRecallChars    int     `yaml:"max_recall_chars,omitempty"`    // default 6000
	MaxPinnedChars    int     `yaml:"max_pinned_chars,omitempty"`    // default 4000
	UseEmbeddings     bool    `yaml:"use_embeddings,omitempty"`      // default false
	Embedder          string  `yaml:"embedder,omitempty"`            // "openai" | "ollama" | "cybertron"
	EmbedderModel     string  `yaml:"embedder_model,omitempty"`      // default per backend
	EmbedderBaseURL   string  `yaml:"embedder_base_url,omitempty"`   // for openai/ollama
	EmbedderAPIKey    string  `yaml:"embedder_api_key,omitempty"`    // env var indirection acceptable
	EmbedderModelsDir string  `yaml:"embedder_models_dir,omitempty"` // cybertron model cache; default ~/.decsr/cybertron-models
	AutoPromote       bool    `yaml:"auto_promote,omitempty"`        // default true; promote decisions to MEMORY.md
}

MemoryConfig controls OpenClaw-style persistent project memory. Memory is stored as Markdown files under .decsr/memory and indexed by SQLite FTS5/BM25. When UseEmbeddings is true an embedder backend computes dense vectors for hybrid retrieval.

type ModelMemoryConfig

type ModelMemoryConfig struct {
	Mode             string  `yaml:"mode,omitempty"`               // "ram" | "context" | ""
	MaxRAMGB         float64 `yaml:"max_ram_gb,omitempty"`         // used when Mode == "ram"
	MaxContextTokens int     `yaml:"max_context_tokens,omitempty"` // used when Mode == "context"
}

ModelMemoryConfig bounds how much memory local models may use. The two modes are mutually exclusive (a toggle):

  • Mode "ram": the user sets MaxRAMGB and DECSR derives a per-agent maximum context size from the agent's model (see runner.ContextTokensForRAM).
  • Mode "context": the user sets MaxContextTokens directly and it is applied verbatim to every agent.

Mode "" (empty) disables the feature, leaving per-agent context limits as configured elsewhere.

type NotifyConfig

type NotifyConfig struct {
	DisableCMux bool `yaml:"disable_cmux,omitempty"` // true = never send cmux notifications
}

NotifyConfig controls external notifications (e.g. cmux alerts on approval gates, completion, and errors). Notifications are enabled by default and only fire when the target tool is actually running, so the opt-out is expressed as a "disable" flag to fit the layered config's "true overrides" merge rule.

type Profile added in v0.4.0

type Profile struct {
	Name   string                 `yaml:"-"`
	Agents map[string]AgentConfig `yaml:"agents"`
}

Profile is a named set of role settings that can be applied to a project.

func LoadProfile added in v0.4.0

func LoadProfile(name string) (Profile, error)

LoadProfile reads a saved profile.

type ProjectConfig

type ProjectConfig struct {
	Name           string        `yaml:"name,omitempty"`
	Language       string        `yaml:"language,omitempty"`
	ModulePath     string        `yaml:"module_path,omitempty"`
	TestCmd        string        `yaml:"test_cmd,omitempty"`
	LintCmd        string        `yaml:"lint_cmd,omitempty"`
	MaxFixAttempts int           `yaml:"max_fix_attempts,omitempty"`
	Scope          ScopeConfig   `yaml:"scope,omitempty"`
	Context        ContextConfig `yaml:"context,omitempty"`
	Profile        string        `yaml:"profile,omitempty"` // name of the last applied role profile
}

type ScopeConfig

type ScopeConfig struct {
	Allow []string `yaml:"allow,omitempty"`
	Deny  []string `yaml:"deny,omitempty"`
}

type SemanticIndexConfig

type SemanticIndexConfig struct {
	Enabled  bool   `yaml:"enabled,omitempty"`
	Embedder string `yaml:"embedder,omitempty"` // currently only "ollama"
	Model    string `yaml:"model,omitempty"`    // e.g. "nomic-embed-text"
	BaseURL  string `yaml:"base_url,omitempty"` // optional override for embedder endpoint
	TopK     int    `yaml:"top_k,omitempty"`    // default 20
}

SemanticIndexConfig controls the optional embeddings-based file index. Disabled by default; when enabled it requires a reachable embedder backend.

type WorkspaceConfig added in v0.3.0

type WorkspaceConfig struct {
	MaxParallel int `yaml:"max_parallel,omitempty"` // 0 = default (3)
}

WorkspaceConfig controls the node workspace.

Jump to

Keyboard shortcuts

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