Skip to content

feat: economy mode for cost-conscious model selection (#500)#504

Merged
bradygaster merged 2 commits intodevfrom
squad/500-economy-mode
Mar 22, 2026
Merged

feat: economy mode for cost-conscious model selection (#500)#504
bradygaster merged 2 commits intodevfrom
squad/500-economy-mode

Conversation

@bradygaster
Copy link
Copy Markdown
Owner

Summary

Implements economy mode per issue #500 — a cost-conscious model selection modifier.

Working as EECOM (Core Dev)

Closes #500

What changed

SDK (packages/squad-sdk)

  • config/models.ts: Added \ECONOMY_MODEL_MAP, \�pplyEconomyMode(),
    eadEconomyMode(), \writeEconomyMode(). Updated
    esolveModel()\ with \�conomyMode?\ option that reads from config.json when not explicitly provided.
  • �gents/model-selector.ts: Updated
    esolveModel()\ and \selectModelForTask()\ with \�conomyMode?\ support.

CLI (\packages/squad-cli)

  • **\cli-entry.ts**: Added --economy\ global flag (sets \SQUAD_ECONOMY_MODE=1\ for the session) + \squad economy\ command routing.
  • **\cli/commands/economy.ts**: New \squad economy [on|off]\ command that reads/writes \�conomyMode\ in .squad/config.json.

Tests

  • **\ est/economy-mode.test.ts**: 34 new tests — all passing.

Economy model table

Normal Economy Task
\claude-opus-4.6\ \claude-sonnet-4.5\ Architecture/review
\claude-sonnet-4.6\ \gpt-4.1\ Code writing
\claude-haiku-4.5\ \gpt-4.1\ Docs/mechanical

Design

Economy mode only affects Layers 3–4 (auto-selection). Layers 0–2 (explicit config.json overrides, session directives, charter preferences) are never modified — user intent is always respected.

bradygaster and others added 2 commits March 22, 2026 02:43
- Add .squad/skills/economy-mode/SKILL.md: Layer 3 cost modifier
  - Economy table shifts code tasks to gpt-4.1/gpt-5-mini, arch to sonnet
  - Activation: session phrase, config.json economyMode:true, or --economy flag
  - Layer 0/1/2 (user intent) always overrides economy mode
  - 💰 indicator in spawn acknowledgments
  - Confidence: low (first implementation)

- Add .squad/decisions/inbox/procedures-economy-mode-governance.md
  - Draft additions to squad.agent.md for Flight review
  - Economy mode paragraph after Layer 0, updated table, 💰 convention
  - Valid models catalog audit findings (claude-sonnet-4.6 missing, etc.)

- Add .squad/decisions/inbox/procedures-personal-squad-governance.md
  - Five gap analysis: Init Mode, consult mode detection, TEAM_ROOT semantics,
    charter templates, missing consult-mode skill
  - Proposed CONSULT_MODE spawn signal and 🧳 acknowledgment format
  - Proposed new consult-mode skill (post-governance-approval)

- Update procedures history.md with learnings

Closes #500
References #344

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add economy mode that shifts model selection to cheaper alternatives
at Layer 3 (task-aware auto) and Layer 4 (default). Explicit user
preferences at Layers 0-2 are never overridden.

SDK changes:
- Add ECONOMY_MODEL_MAP and applyEconomyMode() to config/models.ts
- Add readEconomyMode() / writeEconomyMode() for config.json persistence
- Update resolveModel() in config/models.ts with economyMode option
- Update resolveModel() in agents/model-selector.ts with economyMode option

CLI changes:
- Add 'squad economy [on|off]' command for persistent toggle
- Add --economy global flag for session-level activation (SQUAD_ECONOMY_MODE=1)

Tests:
- 34 new tests in test/economy-mode.test.ts (all passing)

Economy model table:
  claude-opus-4.6   -> claude-sonnet-4.5 (architecture/review)
  claude-sonnet-4.6 -> gpt-4.1           (code writing)
  claude-haiku-4.5  -> gpt-4.1           (docs/mechanical)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bradygaster added a commit that referenced this pull request Mar 22, 2026
- Merged 9 inbox decisions → decisions.md (personal squad impl plan, economy mode design/governance, persistent model preference, user directives, template sync, ESM fix)
- Deleted inbox files (merge complete)
- Updated agent histories: Flight (personal squad plan), EECOM (economy mode), Procedures (governance proposals)
- Appended team updates to agent contexts

Fleet Status:
- Flight: Personal squad design validated, 19-task plan across 4 PRs (MVP = PR #1+3)
- EECOM: Economy mode complete (34 tests), PR #504 open
- Procedures: Economy + consult-mode governance drafted, PR #503 open
- Directives: #464 rate limit UX (soft dep #500), #502 bug P1 next-up, triage includes discussions

Ready for execution: EECOM Phase 1, Procedures Phase 3 (concurrent).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bradygaster added a commit that referenced this pull request Mar 22, 2026
* feat: economy mode skill, governance proposals for #500 and #344

- Add .squad/skills/economy-mode/SKILL.md: Layer 3 cost modifier
  - Economy table shifts code tasks to gpt-4.1/gpt-5-mini, arch to sonnet
  - Activation: session phrase, config.json economyMode:true, or --economy flag
  - Layer 0/1/2 (user intent) always overrides economy mode
  - 💰 indicator in spawn acknowledgments
  - Confidence: low (first implementation)

- Add .squad/decisions/inbox/procedures-economy-mode-governance.md
  - Draft additions to squad.agent.md for Flight review
  - Economy mode paragraph after Layer 0, updated table, 💰 convention
  - Valid models catalog audit findings (claude-sonnet-4.6 missing, etc.)

- Add .squad/decisions/inbox/procedures-personal-squad-governance.md
  - Five gap analysis: Init Mode, consult mode detection, TEAM_ROOT semantics,
    charter templates, missing consult-mode skill
  - Proposed CONSULT_MODE spawn signal and 🧳 acknowledgment format
  - Proposed new consult-mode skill (post-governance-approval)

- Update procedures history.md with learnings

Closes #500
References #344

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

* feat: economy mode for cost-conscious model selection (#500)

Add economy mode that shifts model selection to cheaper alternatives
at Layer 3 (task-aware auto) and Layer 4 (default). Explicit user
preferences at Layers 0-2 are never overridden.

SDK changes:
- Add ECONOMY_MODEL_MAP and applyEconomyMode() to config/models.ts
- Add readEconomyMode() / writeEconomyMode() for config.json persistence
- Update resolveModel() in config/models.ts with economyMode option
- Update resolveModel() in agents/model-selector.ts with economyMode option

CLI changes:
- Add 'squad economy [on|off]' command for persistent toggle
- Add --economy global flag for session-level activation (SQUAD_ECONOMY_MODE=1)

Tests:
- 34 new tests in test/economy-mode.test.ts (all passing)

Economy model table:
  claude-opus-4.6   -> claude-sonnet-4.5 (architecture/review)
  claude-sonnet-4.6 -> gpt-4.1           (code writing)
  claude-haiku-4.5  -> gpt-4.1           (docs/mechanical)

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

* Scribe: Wave 1 decisions merged (#329/#344/#500)

- Merged 9 inbox decisions → decisions.md (personal squad impl plan, economy mode design/governance, persistent model preference, user directives, template sync, ESM fix)
- Deleted inbox files (merge complete)
- Updated agent histories: Flight (personal squad plan), EECOM (economy mode), Procedures (governance proposals)
- Appended team updates to agent contexts

Fleet Status:
- Flight: Personal squad design validated, 19-task plan across 4 PRs (MVP = PR #1+3)
- EECOM: Economy mode complete (34 tests), PR #504 open
- Procedures: Economy + consult-mode governance drafted, PR #503 open
- Directives: #464 rate limit UX (soft dep #500), #502 bug P1 next-up, triage includes discussions

Ready for execution: EECOM Phase 1, Procedures Phase 3 (concurrent).

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

* fix: hard-fail on Node <22.5.0 with clear message (#502)

node:sqlite (required by the Copilot SDK for session storage) was added
in Node 22.5.0. Previously Squad only warned and continued, leading to
cryptic ERR_UNKNOWN_BUILTIN_MODULE crashes later.

Changes:
- cli-entry.ts: replace soft warn+continue with hard process.exit(1) and
  a clear upgrade message when Node <22.5.0 is detected at startup.
  Remove now-redundant checkNodeSqlite() function and its call site.
- doctor.ts: add checkNodeVersion() check to squad doctor diagnostics
  so users can detect the version gap proactively.
- package.json (root, squad-cli, squad-sdk): correct engines field from
  >=20 to >=22.5.0, enabling npm/npx to warn at install time.
- test/cli/doctor.test.ts: add 5 tests for checkNodeVersion pass/fail
  paths; update check-count assertion.

Closes #502

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bradygaster bradygaster merged commit a30252f into dev Mar 22, 2026
0 of 2 checks passed
@bradygaster bradygaster deleted the squad/500-economy-mode branch March 22, 2026 10:17
bradygaster added a commit that referenced this pull request Mar 22, 2026
Orchestration log for 2026-03-22 session covering:
- #500 economy mode (PR #504)
- #502 node:sqlite fix (PR #506)
- #464 rate limit UX (PR #505)
- #500/#344 governance (PR #503)
- #329/#344 architecture plan (Flight, no PR yet)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
chrislomonico pushed a commit to clomonico/squad that referenced this pull request Mar 26, 2026
…radygaster#540)

Wires 5 ghost commands: hire→init, heartbeat→doctor, shell→REPL, loop→triage, run→stub with redirect.

Closes bradygaster#501, Closes bradygaster#503, Closes bradygaster#504, Closes bradygaster#507, Closes bradygaster#509

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.

feat: Economy mode for cost-conscious model selection

1 participant