Skip to content

πŸ—οΈ Architecture

How SLMCode stays sharp when the model is small, tired, or both. 😴➑️😎

πŸ¦ƒ

Design thesis: routing in Go. Tiny packs per specialist. Disk evidence over vibes. If you stuff the whole repo into context, don’t be surprised when the model naps.


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).

β†’ 🀝 Contributing

β˜€οΈ Made with β™₯ by UnicoLab