Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyProfile(root, name string) error
- func DeleteProfile(name string) error
- func EnsureGlobalDir() (string, error)
- func IsBuiltinRole(name string) bool
- func KnownRunner(name string) bool
- func ListProfiles() []string
- func LoadUserSkill(root, name string) (string, error)
- func ProfilesDir() string
- func Save(root string, cfg Config) error
- func SaveGlobal(cfg Config) error
- func SaveProfile(name string, agents map[string]AgentConfig) error
- func SaveProjectRole(root, name string, ac AgentConfig) error
- func ValidName(s string) bool
- func ValidQualifiedName(s string) bool
- func ValidRoleName(name string) bool
- type AgentConfig
- type Config
- type ContextConfig
- type ContextPackConfig
- type MemoryConfig
- type ModelMemoryConfig
- type NotifyConfig
- type PluginAgent
- type Profile
- type ProjectConfig
- type ScopeConfig
- type SemanticIndexConfig
- type WorkspaceConfig
Constants ¶
const Filename = ".decsr.yaml" // legacy project config (root-level)
const GlobalDir = ".decsr"
GlobalDir is the directory for user-wide settings.
const GlobalFilename = "config.yaml"
GlobalFilename is the config file inside the global directory.
const ProjectFilename = "project.yaml"
ProjectFilename is the project config file inside the workspace directory.
Variables ¶
var BuiltinRoles = []string{"pm", "coder", "coder_fixer", "qa", "ux_reviewer", "security"}
BuiltinRoles are the agent roles shipped with DECSR, in display order.
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
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
DeleteProfile removes a saved profile.
func EnsureGlobalDir ¶
EnsureGlobalDir creates ~/.decsr if it doesn't exist.
func IsBuiltinRole ¶ added in v0.3.0
IsBuiltinRole reports whether name is one of the built-in roles.
func KnownRunner ¶ added in v0.4.0
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
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 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
ValidName reports whether s is a valid profile, command or skill name.
func ValidQualifiedName ¶ added in v0.5.0
ValidQualifiedName reports whether s is "<plugin>:<name>", both parts valid per ValidName. It names plugin skills, commands and agent roles.
func ValidRoleName ¶ added in v0.3.0
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"`
// PluginAgents are the roles loaded from plugins, keyed "<plugin>:<agent>".
// They are filled in at run time and never written to a config file.
PluginAgents map[string]PluginAgent `yaml:"-"`
}
func DefaultConfig ¶
func DefaultConfig() Config
func Load ¶
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 ¶
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 PluginAgent ¶ added in v0.5.0
type PluginAgent struct {
Description string // one line
Prompt string // the role prompt (the agent file body)
ReadOnly bool
}
PluginAgent is a workspace role defined by a plugin agent file.
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
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 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.