#15030: Agents: support per-agent thinking defaults
commands
agents
size: XS
Cluster:
Agent Thinking Defaults Enhancement
## Summary
Adds a `thinkingDefault` field to agent config so each agent can have its own default thinking level (`off`, `low`, `medium`, `high`).
### Changes
- **Config schema**: Add optional `thinkingDefault` to agent config with validation
- **Model selection**: Resolve per-agent thinking default when no explicit level is set
- **Chat server**: Thread agent thinking default through reply pipeline
- **Lint fix**: Remove unused imports in chat server methods
### Testing
- Fully tested, using it in production with 11 agents at different thinking levels
---
*Clean rebased branch — 3 commits on current main.*
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds an optional `thinkingDefault` field to per-agent configuration (schema + types), threads it through agent config resolution, and uses it during reply/model selection and in the gateway chat history response. It also includes a small lint-only cleanup in the chat server.
Key integration points:
- `src/agents/agent-scope.ts` exposes `thinkingDefault` via `resolveAgentConfig`.
- `src/auto-reply/reply/get-reply.ts` and `src/commands/agent.ts` merge per-agent values into `cfg.agents.defaults` so the existing reply pipeline can consume them.
- `src/auto-reply/reply/model-selection.ts` adjusts default thinking resolution to prefer the per-agent value.
Main issue to fix before merge: `getReplyFromConfig` currently uses a truthiness check when merging `thinkingDefault`, which breaks the ability to set a per-agent default of `"off"` to override a global non-off default.
<h3>Confidence Score: 3/5</h3>
- This PR is close, but there is at least one confirmed precedence bug that can prevent per-agent config from taking effect in common configurations.
- Most changes are straightforward schema/plumbing. However, `getReplyFromConfig` will ignore an explicit per-agent `thinkingDefault: "off"` when global defaults set a non-off value, which contradicts the feature intent and will produce wrong runtime behavior for affected agents. There is also a significant precedence behavior change in model-selection that should be confirmed as intended.
- src/auto-reply/reply/get-reply.ts, src/auto-reply/reply/model-selection.ts
<sub>Last reviewed commit: 804fd10</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
## AI-Assisted
Yes — implemented and reviewed with AI assistance.
## Local Validation
```bash
pnpm build && pnpm check && pnpm test
```
All tests pass. TypeScript compilation clean. Lint passes.
Most Similar PRs
#21558: config: support agents.list[].thinkingDefault
by Uarmagan · 2026-02-20
90.0%
#16899: feat(config): per-agent and per-model thinking defaults
by jh280722 · 2026-02-15
88.7%
#18695: feat(agents): add per-agent thinkingDefault override
by cathrynlavery · 2026-02-17
87.4%
#21959: feat(config): add per-agent thinkingDefault, heartbeat thinking ove...
by heyhudson · 2026-02-20
83.3%
#10998: fix(agents): pass session thinking/reasoning levels to session_stat...
by wony2 · 2026-02-07
77.4%
#16399: feat: auto-escalate thinking level based on context window usage
by cmfinlan · 2026-02-14
77.4%
#19329: feat: add per-agent compaction and context pruning overrides
by curtismercier · 2026-02-17
76.6%
#16298: feat(xai): switch grok-4-1-fast variants by thinking level
by avirweb · 2026-02-14
76.1%
#15606: LLM Task: add explicit thinking level wiring
by xadenryan · 2026-02-13
75.6%
#22797: Feat/auto thinking mode
by jrthib · 2026-02-21
75.0%