Skip to content

fix: persist user model preference across sessions (#284)#491

Merged
bradygaster merged 1 commit intodevfrom
squad/284-model-preference-fix
Mar 22, 2026
Merged

fix: persist user model preference across sessions (#284)#491
bradygaster merged 1 commit intodevfrom
squad/284-model-preference-fix

Conversation

@bradygaster
Copy link
Copy Markdown
Owner

Closes #284

Problem

Users reported that Squad forgets their model preference. Saying 'always use opus' would only apply within a session — the next session would revert to the default 4-layer hierarchy, spawning haiku/sonnet instead of the requested model.

Root Cause

The model selection hierarchy had no persistent storage layer. User directives were session-only (Layer 1), so they were lost on session end.

Fix

Added Layer 0 — Persistent Config to the model selection hierarchy. When a user says 'always use X', the preference is written to '.squad/config.json' as 'defaultModel' and persists across sessions.

5-Layer Hierarchy (new)

Layer Name Persistence
0a Per-Agent Config Persistent
0b Global Config Persistent
1 Session Directive Session-only
2 Charter Preference Persistent (charter)
3 Task-Aware Auto Computed
4 Default (haiku) Hardcoded

Changes

  • SDK: Added 'readModelPreference', 'writeModelPreference', 'readAgentModelOverrides', 'writeAgentModelOverrides', and 'resolveModel' to 'packages/squad-sdk/src/config/models.ts'
  • Coordinator: Updated '.squad-templates/squad.agent.md' with Layer 0 instructions
  • Skill: Created '.squad/skills/model-selection/SKILL.md' documenting the 5-layer hierarchy
  • Docs: Updated 'docs/src/content/docs/features/model-selection.md'
  • Tests: 32 new tests covering read/write/resolve round-trips (all passing)

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

Add Layer 0 (Persistent Config) to the model selection hierarchy.
When a user says 'always use opus', the preference is now written
to .squad/config.json as 'defaultModel' and persists across sessions.
Per-agent overrides are stored under 'agentModelOverrides'.

Changes:
- SDK: Add readModelPreference, writeModelPreference, readAgentModelOverrides,
  writeAgentModelOverrides, and resolveModel functions to config/models.ts
- Coordinator: Update squad.agent.md with Layer 0 instructions for reading
  config.json on session start and persisting user model directives
- Skill: Create .squad/skills/model-selection/SKILL.md documenting the
  5-layer hierarchy (Persistent Config > Session Directive > Charter >
  Task-Aware Auto > Default)
- Docs: Update model-selection.md with persistent preference documentation
- Tests: Add 32 tests covering read/write/resolve round-trips

Closes #284

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bradygaster bradygaster merged commit 0f51a32 into dev Mar 22, 2026
1 of 2 checks passed
chrislomonico pushed a commit to clomonico/squad that referenced this pull request Mar 26, 2026
Session: 2026-02-24-wave-d-kickoff
Requested by: Brady

Changes:
- Logged orchestration for Hockney (PR bradygaster#487), Keaton (issues bradygaster#488bradygaster#493), Fenster (timeout fix)
- Created session log for Wave D kickoff with summary and next steps
- Merged Wave D readiness assessment from inbox into decisions.md
- Notified Cheritto, Kovash, Fortier of Wave D Batch 1 assignments via history.md updates
- Cross-agent updates: Cheritto assigned P1 UX items (bradygaster#488bradygaster#490), Kovash P2 hardening (bradygaster#491bradygaster#492), Fortier streamBuffer cleanup (bradygaster#493)

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
Implements configurable message history cap (default: 200) to prevent
unbounded memory growth in long REPL sessions.

- Lower DEFAULT_LIMITS.maxMessages from 1000 to 200
- Add MemoryManager.trimWithArchival() returning kept + archived arrays
- Wire trimming into App.tsx via appendMessages() helper
- All message append paths route through cap enforcement
- Archived messages preserved in React state (not deleted)
- Optional maxMessages prop on AppProps for configuration
- Update stress test assertion for new default

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
Session: 2026-02-24T07-30-00Z-wave-d-batch1-impl
Requested by: Coordinator

Changes:
- Logged orchestration for Cheritto (bradygaster#488, PR bradygaster#495): Unified Status Display
- Logged orchestration for Fortier (bradygaster#493, PR bradygaster#494): StreamBuffer Cleanup on Error
- Logged orchestration for Kovash (bradygaster#491, PR bradygaster#496): Message History Cap
- Session log: Wave D batch 1 implementation summary
- Decision inbox: empty (no new decisions to merge)

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.

Squad forgets which model I want agents to use

1 participant