Skip to content

feat: Structured model preference & squad-level defaults#245

Merged
bradygaster merged 5 commits intodevfrom
squad/223-model-config
Mar 7, 2026
Merged

feat: Structured model preference & squad-level defaults#245
bradygaster merged 5 commits intodevfrom
squad/223-model-config

Conversation

@bradygaster
Copy link
Copy Markdown
Owner

Summary

Closes #223 — Model & reasoning-level configuration not reliably applied by agents.

Working as Fenster (Core Dev).

Problem

The \model\ field in \AgentDefinition\ was a bare string. Charter generation output a flat *Model:* {value}\ line instead of the ## Model\ section that the charter-compiler expects (with **Preferred:**\ format). This meant model preferences set via SDK config were silently dropped during the parse → compile round-trip.

Changes

SDK types (\packages/squad-sdk/src/builders/types.ts):

  • Added \ModelPreference\ interface: { preferred, rationale?, fallback? }\
  • \AgentDefinition.model\ now accepts \string | ModelPreference\ (backwards compatible)
  • Added \DefaultsDefinition\ with \model\ field for squad-level defaults
  • Added \defaults?\ field to \SquadSDKConfig\

Builder validation (\packages/squad-sdk/src/builders/index.ts):

  • Added \�ssertModelPreference()\ validator for string-or-object model fields
  • Added \defineDefaults()\ builder function
  • Updated \defineSquad()\ to validate defaults

Charter generation (\packages/squad-cli/src/cli/commands/build.ts):

  • Charter output now emits a proper ## Model\ section with **Preferred:, **Rationale:, and **Fallback:**\ lines
  • Applies \defaults.model\ when an agent doesn't specify its own model

Charter compiler (\packages/squad-sdk/src/agents/charter-compiler.ts):

  • Now extracts \modelRationale\ and \modelFallback\ from ## Model\ section
  • \ParsedCharter\ interface expanded with \modelRationale?\ and \modelFallback?\

Exports (\packages/squad-sdk/src/index.ts):

  • Exports \defineDefaults, \ModelPreference, \DefaultsDefinition\

Tests: Updated \ est/build-command.test.ts\ and \ est/charter-compiler.test.ts\ — all 62+36 tests pass.

Usage

\\ s
// Per-agent (string — backwards compatible)
defineAgent({ name: 'edie', role: 'TS Eng', model: 'claude-sonnet-4' });

// Per-agent (structured)
defineAgent({
name: 'edie',
role: 'TS Eng',
model: { preferred: 'claude-sonnet-4', rationale: 'Best for type work', fallback: 'claude-haiku-4.5' },
});

// Squad-level default
defineSquad({
team: defineTeam({ ... }),
agents: [...],
defaults: defineDefaults({ model: 'claude-sonnet-4' }),
});
\\

bradygaster and others added 3 commits March 7, 2026 06:09
Add command routing for rc, copilot-bridge, init-remote, and rc-tunnel
which existed in packages/squad-cli/src/cli/commands/ but had no route
in cli-entry.ts. Also add help text entries for all four.

- rc / remote-control: starts RemoteBridge with --tunnel, --port, --path
- copilot-bridge: checks Copilot ACP stdio compatibility
- init-remote: standalone shorthand for init --mode remote <path>
- rc-tunnel: checks devtunnel CLI availability

aspire, link, loop, and hire were already wired.

Closes #237

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add ModelPreference interface (preferred, rationale, fallback) to builders/types.ts
- AgentDefinition.model now accepts string or ModelPreference object (backwards compatible)
- Add DefaultsDefinition with model field to SquadSDKConfig
- Add defineDefaults() builder function with validation
- Update charter generation to emit proper ## Model section with Preferred/Rationale/Fallback
- Charter generation applies squad defaults.model when agent has no model specified
- Update charter-compiler to extract rationale and fallback from ## Model section
- Export new types and defineDefaults from SDK entry point
- Update tests for build-command and charter-compiler

Closes #223

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bradygaster bradygaster force-pushed the squad/223-model-config branch from e11f598 to 1bf8866 Compare March 7, 2026 14:14
Add test coverage for all 8 CLI commands that had zero tests:
- link (10 tests): validation, fs operations, gitignore handling
- init-remote (8 tests): config structure, relative paths, idempotency
- watch (6 tests): module exports, reportBoard pure function
- start (3 tests): module exports, function arity
- rc-tunnel (10 tests): exports, getMachineId, getGitInfo, devtunnel availability
- extract (5 tests): exports, error handling for missing/invalid config
- copilot (6 tests): exports, error on missing squad dir, add/remove flow
- copilot-bridge (8 tests): class instantiation, lifecycle, safe-before-init

Add command wiring regression test (21 tests) that verifies every .ts
file in commands/ has a corresponding route in cli-entry.ts, preventing
the recurring unwired command bug class (issues #224, #236, #237).

Add subpath exports to squad-cli package.json for the 6 commands that
were missing package exports (watch, start, rc-tunnel, extract, copilot,
copilot-bridge).

Total: 77 new tests, all passing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bradygaster added a commit that referenced this pull request Mar 7, 2026
Session: 2026-03-07T14-16-00Z-next-wave-fenster-completions
Requested by: Scribe (autonomous)

Changes:
- Logged agent-32 completion: CLI command wiring (#237) — 4 commands wired, 3655 tests pass, PR #244
- Logged agent-31 completion: Model config reliability (#223) — root cause fixed, backwards compatible, PR #245
- Updated Fenster's history.md with cross-agent context about CLI wiring and model config patterns
The model config changes added legitimate help text lines, pushing output from ~68 to 72 lines. Bump threshold to 80 for headroom.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bradygaster added a commit that referenced this pull request Mar 7, 2026
Matches the same fix applied to PR #245. New CLI commands added legitimate help text.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bradygaster bradygaster merged commit 363a0a8 into dev Mar 7, 2026
1 check passed
@bradygaster bradygaster deleted the squad/223-model-config branch March 7, 2026 14:25
jongio pushed a commit to jongio/squad that referenced this pull request Mar 9, 2026
* docs: migration guide — GitHub-native to npm (bradygaster#218)

Closes bradygaster#218

Adds docs/migration-github-to-npm.md for users migrating from GitHub-native distribution to npm packages (@bradygaster/squad-cli and @bradygaster/squad-sdk).

Changes:
- New migration guide with before/after examples, insider channel info, comparison table, and troubleshooting
- Updated README.md to reference migration guide in Legacy Distribution section

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat: message routing + shell commands (bradygaster#245, bradygaster#246)

Add message router (src/cli/shell/router.ts):
- Slash command parsing (/status, /help, etc.)
- @agent direct addressing with case-insensitive matching
- AgentName, message comma syntax support
- Coordinator fallback for unmatched input

Add shell commands (src/cli/shell/commands.ts):
- /status — squad status and active agents
- /history — recent message history with limit
- /agents — list registered agents with status icons
- /clear — ANSI clear screen
- /help — command reference
- /quit, /exit — clean shutdown

Both modules exported from src/cli/shell/index.ts barrel.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jongio pushed a commit to jongio/squad that referenced this pull request Mar 9, 2026
)

Add message router (src/cli/shell/router.ts):
- Slash command parsing (/status, /help, etc.)
- @agent direct addressing with case-insensitive matching
- AgentName, message comma syntax support
- Coordinator fallback for unmatched input

Add shell commands (src/cli/shell/commands.ts):
- /status — squad status and active agents
- /history — recent message history with limit
- /agents — list registered agents with status icons
- /clear — ANSI clear screen
- /help — command reference
- /quit, /exit — clean shutdown

Both modules exported from src/cli/shell/index.ts barrel.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant