Skip to content

Commit 324a45f

Browse files
v0.12.1: fast_model for lightweight agents — massive speed boost
- New config field: fast_model — smaller/faster model for lightweight agents (reviewer, coordinator, splitter, planner, context, architect, clarifier, etc.) - Worker, corrector, tester still use main model for quality - Factory.EffectiveModel routes fast_model to light agents, main model to heavy agents - Config schema + CLI config set support for fast_model - AutoFixFormatting: gofmt/ruff auto-fix before QA gate (no LLM needed) - QA gate: smart skip when no test files, go build check before full tests - Tester prompt: always JSON, never prose, never attempts file fixes - Fix: go.mod corruption prevention via focus guard - All 36 test packages passing
1 parent 6d3e5fe commit 324a45f

5 files changed

Lines changed: 34 additions & 2 deletions

File tree

‎cmd/slmcode/cmd_util.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"net/http"
77
"os"
88
"os/exec"
9-
"runtime"
109
"path/filepath"
10+
"runtime"
1111
"strings"
1212
"time"
1313

@@ -224,6 +224,8 @@ func configCmd() *cobra.Command {
224224
switch k {
225225
case "model":
226226
c.Model = v
227+
case "fast_model":
228+
c.FastModel = v
227229
case "provider":
228230
next := config.NormalizeProvider(v)
229231
if next != config.NormalizeProvider(c.Provider) && flagEndpoint == "" {

‎pkg/agents/factory.go‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ type Factory struct {
229229
Model string
230230
Provider string
231231
CustomDirs []string
232+
FastModel string // optional faster model for lightweight agents
232233
// ModelProfiles resolves caps against each agent's effective model
233234
// (per-agent override ?? global stack/config model).
234235
ModelProfiles map[string]config.ModelProfile
@@ -243,17 +244,32 @@ func NewFactory(llmManager *llm.ProviderManager, toolReg *tools.ToolRegistry, mo
243244
return &Factory{LLM: llmManager, Tools: toolReg, Model: model, Provider: provider}
244245
}
245246

246-
// EffectiveModel returns the model an agent will use (override or global).
247+
// EffectiveModel returns the model an agent will use (per-agent override → fast model for light agents → global).
247248
func (f *Factory) EffectiveModel(spec RoleSpec) string {
248249
if strings.TrimSpace(spec.Model) != "" {
249250
return strings.TrimSpace(spec.Model)
250251
}
251252
if f == nil {
252253
return ""
253254
}
255+
// Use fast model for lightweight agents that don't need deep reasoning
256+
if f.FastModel != "" && isLightAgent(spec.ID) {
257+
return f.FastModel
258+
}
254259
return f.Model
255260
}
256261

262+
// SetFastModel sets the model for lightweight agents.
263+
func (f *Factory) SetFastModel(m string) { f.FastModel = m }
264+
265+
var lightAgents = map[string]bool{
266+
"reviewer": true, "coordinator": true, "splitter": true, "planner": true,
267+
"context": true, "architect": true, "clarifier": true, "interviewer": true,
268+
"orchestrator": true, "memory": true, "docs": true, "escalate": true,
269+
}
270+
271+
func isLightAgent(id string) bool { return lightAgents[strings.ToLower(id)] }
272+
257273
// EffectiveProvider returns the friendly provider name (not registry key).
258274
func (f *Factory) EffectiveProvider(spec RoleSpec) string {
259275
if strings.TrimSpace(spec.Provider) != "" {

‎pkg/config/config.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ type Config struct {
126126
Endpoint string `yaml:"endpoint" json:"endpoint"`
127127
APIKey string `yaml:"api_key,omitempty" json:"api_key,omitempty"`
128128
Model string `yaml:"model" json:"model"`
129+
// FastModel optionally specifies a smaller/faster model for lightweight agents
130+
// (reviewer, coordinator, splitter, planner, context, architect, clarifier).
131+
// Empty = use the main Model for all agents.
132+
FastModel string `yaml:"fast_model" json:"fast_model"`
129133

130134
Backend string `yaml:"backend" json:"backend"` // slmcode | claude-code
131135

@@ -652,6 +656,7 @@ func normalize(c *Config) {
652656
// Patch is a partial config update. Nil fields are left unchanged.
653657
type Patch struct {
654658
Model *string `json:"model,omitempty"`
659+
FastModel *string `json:"fast_model,omitempty"`
655660
Provider *string `json:"provider,omitempty"`
656661
Endpoint *string `json:"endpoint,omitempty"`
657662
APIKey *string `json:"api_key,omitempty"`
@@ -726,6 +731,9 @@ func (c *Config) ApplyPatch(p Patch) {
726731
if p.Model != nil && *p.Model != "" {
727732
c.Model = *p.Model
728733
}
734+
if p.FastModel != nil {
735+
c.FastModel = strings.TrimSpace(*p.FastModel)
736+
}
729737
prevProvider := NormalizeProvider(c.Provider)
730738
prevDefaultEP := DefaultEndpointFor(prevProvider)
731739
providerChanged := false

‎pkg/config/schema.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ func Schema() []FieldSchema {
1818
Description: "LLM provider id (omlx, openai, ollama, …)"},
1919
{Key: "model", Type: "string", Label: "Model", Group: "model", Patchable: true,
2020
Description: "Default model id"},
21+
{Key: "fast_model", Type: "string", Label: "Fast model", Group: "model", Patchable: true,
22+
Description: "Smaller model for lightweight agents (reviewer, planner, etc.). Empty = use main model."},
2123
{Key: "endpoint", Type: "string", Label: "Endpoint", Group: "model", Patchable: true,
2224
Description: "OpenAI-compatible base URL"},
2325
{Key: "enabled_models", Type: "string[]", Label: "Enabled models", Group: "model", Patchable: true,

‎pkg/orchestrator/orchestrator.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ func New(cfg *config.Config) (*Orchestrator, error) {
213213
factory.ProfileMaxTurns = prof.MaxTurns
214214
factory.ProfileTemp = prof.Temperature
215215
}
216+
// Use fast model for lightweight agents when configured
217+
if cfg.FastModel != "" {
218+
factory.SetFastModel(cfg.FastModel)
219+
}
216220

217221
// Auto-register providers for per-agent overrides (custom agents / builtin patches)
218222
// so rebuild never leaves an agent pointing at an unregistered provider.

0 commit comments

Comments
 (0)