ποΈ Architecture¶
How SLMCode stays sharp when the model is small, tired, or both. π΄β‘οΈπ
Design thesis π§ ¶
30B-class SLMs fail when asked to βbe a frontier agentβ in one free-form loop.
Routing in Go. Tiny packs per specialist. Disk evidence over vibes.
π¦ Turkey rule
If you stuff the whole repo into context, don't be surprised when the model naps.
β Narrative version: π§ Concepts
Package map π¦¶
cmd/slmcode CLI + embedded Studio (go:embed ui/)
pkg/orchestrator Pipeline runner + coordinator + sessions
pkg/pipeline Config-driven phases / slots / loop agents
pkg/loop Parallel execute β review β correct
pkg/agents Specialist prompts + custom YAML factory
pkg/plan Kanban, sanitize, discover
pkg/context Markdown store + TaskPack budgeter
pkg/knowledge SKILLS.md + learned evolution
pkg/learning Wave lessons / deltas
pkg/instructions AGENTS.md / PROJECT loader
pkg/session Resumable snapshots + ReAct resume
pkg/permissions auto | dry-run | review
pkg/multipass Think β critique β refine
pkg/stream Live events (CLI + SSE)
pkg/server Studio HTTP + SSE
pkg/skills SKILL.md loader
pkg/workspace Real FS/git tools
pkg/backends OpenAI-compat / Ollama / optional CLIs
pkg/harness Public embed API
pkg/cli Terminal UX
pkg/config Presets + project config
pkg/repair SLM JSON repair
pkg/retrieval Embeddings / lexical ranking
Pipeline graph is loaded from .slmcode/pipeline.yaml β see Pipeline.
Live streaming π‘¶
stream.Event fields: phase, kind, agent, task_id, scope, output. Consumers: CLI, Studio SSE (/api/events), /api/runs/latest.
Explore reuse Β· critic Β· flywheel π¶
- Reuse when CONTEXT/MEMORY are rich (override with
SLMCODE_FORCE_EXPLORE=1) β»οΈ - Critic: worker β reviewer β corrector loop; disk evidence preferred π
- Flywheel: MEMORY / CONTEXT / SKILLS / sessions after each run π¦
Quality + HITL gates π‘οΈ¶
worker β smoke + acceptance smoke + static/claims
β reviewer / corrector (β€ max_retries)
β escalate? β Studio/TUI pause (timeout β @escalate decides)
finalize β placeholder polish β completeness bar β QA gate (pytest preferred)
β continue-ask if work remains
- Greenfield Python QA prefers pytest, not
compileall - Whitelisted acceptance commands (
pytest,go test,python main.py, β¦) run after workers - Syntax-only QA cannot alone mark the run successful
- Escalate timeout β dedicated @escalate arbitrator (or
escalate_timeout_agent)
β Config Β· Studio HITL Β· Agents
Parallelism β‘¶
SubAgentExecutor runs ready tasks up to max_parallel. Soft-skip blocked deps so one stuck locate can't freeze the board. One blocked task should not become a board-wide existential crisis.
Embed π§©¶
import "github.com/UnicoLab/slmcode/pkg/harness"
h, _ := harness.New("/path/to/project")
_ = h.Init()
res, err := h.Run(ctx, "refactor pkg/auth")
Dependency: github.com/piotrlaczkowski/GoLangGraph (optional local replace for hacking).
βοΈ Made with β₯ by UnicoLab