config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 5 Imported by: 0

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 SupportedProgrammingLanguages = []string{
	"go",
	"rust",
	"python",
	"javascript",
	"typescript",
	"java",
	"ruby",
	"elixir",
	"c",
	"cpp",
	"csharp",
	"swift",
	"kotlin",
	"scala",
}

SupportedProgrammingLanguages lists selectable project programming languages.

Functions

func EnsureGlobalDir

func EnsureGlobalDir() (string, error)

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

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.

Types

type AgentConfig

type AgentConfig struct {
	Runner           string   `yaml:"runner,omitempty"`
	Model            string   `yaml:"model,omitempty"`
	MaxContextTokens int      `yaml:"max_context_tokens,omitempty"` // 0 = no limit (for local models)
	Skills           []string `yaml:"-"`                            // always from defaults, never persisted
}

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"`
}

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 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"`
}

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.

Jump to

Keyboard shortcuts

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