Repository navigation
fix(core): allow question tool by default for primary-mode agents #372
Description
Important
Problem — The question tool is denied for every config-defined agent. The shared permission defaults in the agent registry include question: "deny", and only the two native primary agents (build, plan) explicitly override it to allow. Any agent created through config (agent cards, user config) merges only the defaults plus user config, so it silently loses the question tool. This breaks agent-card-driven interview/ask flows that assume a primary director can ask the user a question.
Approach — After the config-agent merge loop, add a normalizing pass over resolved agents: any agent whose resolved mode is not subagent and is not hidden, and which has no explicit question permission rule, gets question: "allow" merged in. Explicit config always wins; hidden internal agents keep their deny-all posture; subagents stay denied (they must never block on the user).
Scope — in: agent permission resolution + tests · out: tool registry gating, per-client tool availability flags, changes to build/plan behavior.
Acceptance Criteria
- A config-defined agent with
mode: primary(noquestionin its config) resolves with thequestiontool allowed. - A config-defined agent with
mode: subagentstill resolves withquestiondenied. - A config-defined agent with an explicit
question: denyin its config keeps the explicit deny (config wins over the new default). - Hidden native agents (
compaction,title,summary) are unaffected — no implicit question allow appears. - Native
buildandplanbehavior is unchanged.
Testing Decisions
Extend the existing agent-registry tests (the suite that covers config-defined agents and permission merging). No new suite; this is a small extension of covered surface.
Key Decisions
- Normalize after the config-agent loop, when each agent's final
modeis known — the pass must see card/user mode overrides, not pre-loop defaults. - Treat "explicit rule exists" the same way the existing
external_directorynormalization pass does (scan the resolved permission rules for aquestionrule), so wildcard-only configs still get the grant. - Deny remains the default for
mode: subagent— asking a question from a cast subagent deadlocks the loop.
Constraints & Invariants
- User/card config is the highest authority: an explicit
questionrule in config must never be clobbered by the normalization pass. - No behavior change for clients where the question tool isn't in the registry (tool availability gating elsewhere stays as-is).
Prior Art
- The agent registry's existing post-loop normalization pass for
external_directory— same pattern (scan rules, conditional merge). - The native
build/plandefinitions, which already mergequestion: "allow"on top of defaults.
Notes
Found while wiring Amico director mode cards: the develop/research mode-card agents (config-defined, mode: primary) could not use the question tool while build/plan could. The card fix (explicit question: allow in card frontmatter) is tracked separately in harmoniqs/amicode as belt-and-braces; this issue is the harness-level fix so any future primary agent gets the interview flow by default.
Activity
fix(core): allow question tool by default for primary-mode agents (#372)