#21959: feat(config): add per-agent thinkingDefault, heartbeat thinking override, and per-agent QMD extra collections
docs
gateway
agents
size: M
trusted-contributor
Cluster:
Agent Thinking Defaults Enhancement
## Summary
Multi-agent users can already split agents by workspace/model, but three gaps still made behavior inconsistent:
- Thinking defaults were effectively global, so one agent could not be deep while another stayed cheap and fast.
- Heartbeats could override model but not thinking level, so scheduled runs could not tune reasoning independently.
- QMD session transcripts are isolated per-agent, with no explicit way for one agent to search another agent's indexed sessions.
This PR adds per-agent controls for those cases, while keeping precedence deterministic and backward-compatible.
## What Changed
### Per-agent thinkingDefault
- Added `thinkingDefault` to `agents.list[]` config/type/schema surfaces.
- Wired per-agent config into runtime resolution so per-agent defaults are applied during reply/model selection.
- Updated thinking resolution order docs for chat/cron/heartbeat behavior.
Key files:
- `src/config/types.agents.ts`
- `src/config/zod-schema.agent-runtime.ts`
- `src/agents/agent-scope.ts`
- `src/auto-reply/reply/get-reply.ts`
- `src/auto-reply/reply/model-selection.ts`
- `docs/tools/thinking.md`
### Heartbeat thinking override
- Added `heartbeat.thinking` support in config types/schemas/docs.
- Threaded heartbeat thinking through `runHeartbeatOnce` into reply directive resolution.
- Applied heartbeat precedence so heartbeat-specific thinking can override session/agent/global defaults for heartbeat turns.
Key files:
- `src/config/types.agent-defaults.ts`
- `src/config/zod-schema.agent-runtime.ts`
- `src/infra/heartbeat-runner.ts`
- `src/auto-reply/types.ts`
- `src/auto-reply/reply/get-reply-directives.ts`
- `docs/gateway/configuration-reference.md`
### Per-agent QMD extra collections
- Added `memorySearch.qmd.extraCollections` under `agents.list[]`.
- Extended memory backend resolution to include these collections only for the configured agent.
- Keeps cross-agent session search directional and opt-in instead of globally shared.
Key files:
- `src/config/types.tools.ts`
- `src/config/zod-schema.agent-runtime.ts`
- `src/memory/backend-config.ts`
- `docs/concepts/multi-agent.md`
- `docs/gateway/configuration-reference.md`
## Design Notes
- Per-agent overrides are merged into `agentCfg` in `get-reply.ts` so downstream logic uses one consistent config object.
- `model` merging remains special-cased to preserve existing primary/fallback behavior.
- `resolveAgentConfig` now conditionally includes `thinkingDefault` only when set, preventing `undefined` from unintentionally clobbering global defaults during merge.
- QMD extra collections are scoped per agent by design for explicit control over cross-agent memory visibility.
## Testing
Added and updated tests for each behavior:
- `src/auto-reply/reply/model-selection.test.ts`: per-agent `thinkingDefault` takes precedence over global default.
- `src/infra/heartbeat-runner.model-override.test.ts`: heartbeat `thinking` override propagation and per-agent/default merge behavior.
- `src/memory/backend-config.test.ts`: per-agent QMD extra collections are included only for the targeted agent.
- `src/config/config.schema-regressions.test.ts`: schema acceptance for new config fields.
- `src/agents/agent-scope.e2e.test.ts`: agent config resolution includes `thinkingDefault`.
## AI Disclosure
- [x] AI-assisted
- [x] Fully tested
## Related Issues
- #21097
- #16843
- #17781
- #11120
- #18582
- #14494
- #21846
---
Closes #11479
Closes #21624
Closes #22261
Most Similar PRs
#18695: feat(agents): add per-agent thinkingDefault override
by cathrynlavery · 2026-02-17
86.9%
#15030: Agents: support per-agent thinking defaults
by sauerdaniel · 2026-02-12
83.3%
#16899: feat(config): per-agent and per-model thinking defaults
by jh280722 · 2026-02-15
83.3%
#21558: config: support agents.list[].thinkingDefault
by Uarmagan · 2026-02-20
80.8%
#19329: feat: add per-agent compaction and context pruning overrides
by curtismercier · 2026-02-17
75.4%
#19022: memory: support per-agent QMD collection paths
by Whoaa512 · 2026-02-17
73.9%
#20954: feat: per-agent model allowlist
by coletebou · 2026-02-19
73.4%
#20458: feat: per-model thinkingDefault config and /think default directive
by kmixter · 2026-02-18
72.0%
#14487: feat(config): support per-agent compaction overrides (#14446)
by lailoo · 2026-02-12
70.5%
#14640: feat(agents): support per-agent temperature and maxTokens in agents...
by lailoo · 2026-02-12
70.1%