Skip to content

feat: read .devswarm/config.toml for per-role backend/model routing (rebased)#339

Merged
yxlyx merged 3 commits intomainfrom
feat/config-toml-routing-v2
Mar 22, 2026
Merged

feat: read .devswarm/config.toml for per-role backend/model routing (rebased)#339
yxlyx merged 3 commits intomainfrom
feat/config-toml-routing-v2

Conversation

@yxlyx
Copy link
Copy Markdown
Collaborator

@yxlyx yxlyx commented Mar 22, 2026

Rebased version of #293 with conflict resolution.

Summary

  • Add src/config.zig — a minimal TOML parser that reads .devswarm/config.toml
  • Wire config into resolveWithProbe() for per-role and global provider settings
  • Add src/notify.zig for MCP progress notifications
  • Add title param to run_swarm for human-readable labels

Resolution chain (highest priority first)

  1. MCP param override (model: "opus" in tool call)
  2. config.toml [agents.<role>].model / .backend / .sandbox / .max_turns
  3. Static role spec (roles.zig built-in defaults)
  4. Grid tier (grid.zig role→model table)
  5. config.toml [provider].claude_default (global default model)
  6. Mode default (smart→Sonnet, deep→Opus, etc.)

Closes #293

justrach and others added 3 commits March 22, 2026 15:30
Add src/config.zig — a minimal TOML parser that reads the config file
written by `devswarm init`. Wire it into resolveWithProbe() so that
per-role and global provider settings from config.toml take effect at
runtime without any MCP param changes.

Resolution chain (highest priority first):
  1. MCP param override (model: "opus" in tool call)
  2. config.toml [agents.<role>].model / .backend / .sandbox / .max_turns
  3. Static role spec (roles.zig built-in defaults)
  4. Grid tier (grid.zig role→model table)
  5. config.toml [provider].claude_default (global default model)
  6. Mode default (smart→Sonnet, deep→Opus, etc.)

Example .devswarm/config.toml that makes reviewer use Opus on Codex:
  [agents.reviewer]
  model   = "opus"
  backend = "codex"

All 64 existing tests pass + 4 new config tests + 3 new resolve tests.

Generated with AI

Co-Authored-By: AI <ai@example.com>
Adds src/notify.zig — a thread-safe notifications/message emitter that
writes JSON-RPC notifications to stdout while a long-running tool is
executing. MCP clients (Claude Code) display these inline during the
"Running…" wait, giving real-time feedback.

How it works:
  JSON-RPC is full-duplex. The server sends notifications (no `id` field)
  at any point while processing a `tools/call` request. The client shows
  them as status lines. The final result is correlated by the original id.

Changes:
- src/notify.zig: mutex-protected send(), supports Content-Length framing
- src/main.zig: call notify.init(g_use_headers) after framing detection
- src/swarm.zig: emit phase markers — "decomposing", "N agents running",
  "synthesizing" — so users see swarm progress instead of just "Running…"
- src/tools.zig: add optional `title` param to run_swarm; displayed in
  the phase notification so tool calls show a readable label rather than
  the full raw prompt blob

Generated with AI

Co-Authored-By: AI <ai@example.com>
@yxlyx yxlyx merged commit 1cd3b37 into main Mar 22, 2026
2 checks passed
@yxlyx yxlyx deleted the feat/config-toml-routing-v2 branch March 22, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants