← Back to PRs

#21959: feat(config): add per-agent thinkingDefault, heartbeat thinking override, and per-agent QMD extra collections

by heyhudson open 2026-02-20 15:32 View on GitHub →
docs gateway agents size: M trusted-contributor
## 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