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 SaveGlobalEndpoints(cfg Config) error
- func SaveProfile(name string, agents map[string]AgentConfig) error
- func SaveProjectRole(root, name string, ac AgentConfig) error
- func UseProviderGlobal(runnerName, provider, model string, allRoles bool) error
- func UseRunnerGlobalFresh(runnerName, model string) 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 ModelPrice
- type NotifyConfig
- type PluginAgent
- type Profile
- type ProjectConfig
- type ScopeConfig
- type SemanticIndexConfig
- type UIConfig
- type WorkspaceConfig
Constants ¶
const ( ModeText = "text" // the runner answers with text and decsr writes the file blocks ModeAgent = "agent" // the runner edits files itself with its own tools )
Agent modes of a workspace role.
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 LeadRole = "pm"
LeadRole is the role that splits tasks in the workspace.
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 SaveGlobalEndpoints ¶ added in v0.7.0
SaveGlobalEndpoints is SaveGlobal that also writes base_url and provider of every agent in cfg exactly as given, so an empty value removes it from the file (a plain SaveGlobal keeps the old value when the new one is empty).
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, base_url, api_key_env, description, read_only, mode 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 UseProviderGlobal ¶ added in v0.7.0
UseProviderGlobal writes runner, model and (for a saved custom provider) provider into ~/.decsr/config.yaml for the lead role only, or for every role. Only names are written; an API key never goes into a config file.
func UseRunnerGlobalFresh ¶ added in v0.7.0
UseRunnerGlobalFresh makes runnerName and model the global choice of every role, replacing what the roles had before: their model, effort and endpoint are reset, so nothing left over from another runner stays. Only names are written.
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
BaseURL string `yaml:"base_url,omitempty"` // API runners (openai, deepseek): endpoint base, e.g. https://openrouter.ai/api/v1
Provider string `yaml:"provider,omitempty"` // API runners: name of a saved custom provider (decsr connect custom) whose base_url is used when base_url is empty
APIKeyEnv string `yaml:"api_key_env,omitempty"` // API runners: NAME of the env var holding the key; the key is never stored
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
Mode string `yaml:"mode,omitempty"` // workspace roles: "" = by runner, "text" (decsr writes file blocks) or "agent" (the runner edits files with its own tools)
MCP bool `yaml:"mcp,omitempty"` // claude runner: load the user's own MCP servers (default: none, for lean runs)
Skills []string `yaml:"-"` // always from defaults, never persisted
UserSkills []string `yaml:"skills,omitempty"` // file-based skills (.decsr/skills/<name>.md)
}
func (AgentConfig) EffectiveMode ¶ added in v0.7.0
func (ac AgentConfig) EffectiveMode() string
EffectiveMode is the explicit mode, else "agent" for opencode, codex and dsh and "text" for every other runner.
func (AgentConfig) ModeError ¶ added in v0.7.0
func (ac AgentConfig) ModeError() error
ModeError explains why the role's mode cannot run, or returns nil. Agent mode needs a CLI that edits files with its own tools. opencode has no reliable read-only switch, so text mode (where decsr alone writes the files) cannot be guaranteed for it.
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"`
UI UIConfig `yaml:"ui,omitempty"`
// Pricing is the USD price per million tokens, keyed by a model id or a
// glob (path.Match) such as "deepseek-*". There are no built-in prices.
Pricing map[string]ModelPrice `yaml:"pricing,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 ModelPrice ¶ added in v0.7.0
type ModelPrice struct {
InputPerMTok float64 `yaml:"input_per_mtok"`
OutputPerMTok float64 `yaml:"output_per_mtok"`
}
ModelPrice is the price of one model in USD per million tokens.
type NotifyConfig ¶
type NotifyConfig struct {
DisableCMux bool `yaml:"disable_cmux,omitempty"` // true = never send cmux notifications
DisableBell bool `yaml:"disable_bell,omitempty"` // true = never ring the terminal bell
DisableDesktop bool `yaml:"disable_desktop,omitempty"` // true = never send desktop notifications
Webhook string `yaml:"webhook,omitempty"` // URL that receives a POST per notification; "" = off
WebhookFormat string `yaml:"webhook_format,omitempty"` // "ntfy" (default) | "slack" | "discord"
}
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 UIConfig ¶ added in v0.7.0
type UIConfig struct {
// Icons picks the glyph set for runner identity: "unicode" (default),
// "ascii" or "nerd". "" = unicode.
Icons string `yaml:"icons,omitempty"`
// Tmux makes plain `decsr` behave like `decsr --tmux`.
Tmux bool `yaml:"tmux,omitempty"`
// Theme picks the colour theme: "auto" (default, asks the terminal and
// falls back to dark), "dark" or "light". "" = auto.
Theme string `yaml:"theme,omitempty"`
// Markdown renders agent and lead messages as Markdown. nil = on.
Markdown *bool `yaml:"markdown,omitempty"`
}
UIConfig holds presentation settings.
func (UIConfig) MarkdownOn ¶ added in v0.7.0
MarkdownOn reports whether messages are rendered as Markdown.
type WorkspaceConfig ¶ added in v0.3.0
type WorkspaceConfig struct {
MaxParallel int `yaml:"max_parallel,omitempty"` // 0 = default (3)
// Isolation is "worktree" (each node works in its own git worktree),
// "shared" (all nodes work in the project checkout) or "" (auto: worktree
// inside a git repo with a commit, shared otherwise).
Isolation string `yaml:"isolation,omitempty"`
// Pull request loop (/pr).
PRBase string `yaml:"pr_base,omitempty"` // "" = the branch checked out in the project
PRRemote string `yaml:"pr_remote,omitempty"` // "" = origin
PRPollSeconds int `yaml:"pr_poll_seconds,omitempty"` // 0 = 60; at least 15
MaxCIFixes int `yaml:"max_ci_fixes,omitempty"` // 0 = 3
PRAutoFix bool `yaml:"pr_auto_fix,omitempty"` // run the fix nodes of /pr watch without asking
// BudgetUSD stops new nodes from starting once the known cost of a
// session reaches it; 0 = no budget. BudgetWarnPct is the share of the
// budget that raises a warning; 0 = 80.
BudgetUSD float64 `yaml:"budget_usd,omitempty"`
BudgetWarnPct int `yaml:"budget_warn_pct,omitempty"`
// Autonomy is how much the Workspace does on its own: 1 manual (also 0 or
// empty), 2 assisted, 3 unattended (needs a budget and worktree isolation).
// MaxAutoFixes is the number of fix nodes level 2 and 3 add after a failed
// Build & test per session; 0 = 2.
Autonomy int `yaml:"autonomy,omitempty"`
MaxAutoFixes int `yaml:"max_auto_fixes,omitempty"`
// Coordinator turns on the lead's review after each batch of nodes: it
// proposes adding, changing or cancelling nodes. Off by default; the
// session's /coordinator overrides it.
Coordinator bool `yaml:"coordinator,omitempty"`
}
WorkspaceConfig controls the node workspace.