Skip to content

Add built-in wait tool for explicit no-op turns #207

@aebrer

Description

@aebrer

Summary

Some models (notably Kimi) do not reliably understand that ending a turn without a tool call is the correct way to wait. Instead, they invoke the bash tool to run echo "Waiting...", which consumes an extra full turn and wastes tokens. Adding an explicit wait tool gives these models a sanctioned no-op action that cleanly ends the turn.

Current Behavior

When an agent is told to wait (e.g., for a background subagent to complete), models may invent a useless bash call to simulate waiting. This costs tokens and adds noise to the session.

Proposed Behavior

A built-in wait tool that does nothing, returns immediately, and ends the agent's turn. Its description and prompt guidelines will explicitly tell the model: "If you are told to wait for something, use this tool instead of running a shell command."

Acceptance Criteria

  • New packages/coding-agent/src/core/tools/wait.ts implementing a no-op wait tool with no parameters
  • Tool registered in allTools, allToolDefinitions, createAllToolDefinitions, and createAllTools in packages/coding-agent/src/core/tools/index.ts
  • ToolName type updated to include "wait"
  • Tool renders silently or with minimal output in the TUI (e.g., a brief "Waiting…" indicator)
  • Root README.md updated: built-in tool count bumped (10 → 11) and wait added to the tool list
  • packages/coding-agent/README.md updated: wait added to the built-in tools list and --tools documentation
  • packages/coding-agent/docs/extensions.md updated if built-in tools are enumerated there
  • No functional side effects — the tool must be a pure no-op

Context

This is a pragmatic fix for model-specific behavior where certain providers prefer to "do something" rather than end a turn empty-handed. The wait tool is the hammer for that nail.

Technical Notes

  • Pattern after suggest-next.ts or tasks.ts for a lightweight tool definition
  • No parameters needed — a Type.Object({}) or Type.Object({ reason: Type.Optional(Type.String()) }) schema
  • The tool execute should return immediately with a simple confirmation text
  • Keep render call/result minimal to avoid TUI noise

Risks / Considerations

  • Models could over-use wait if instructions are too broad. Guidelines should narrowly scope it to "when explicitly told to wait" and "when background subagents are running and you have no other work"
  • Should this be opt-in via --tools or always available? Probably always available since it is harmless, but it should appear in --tools restrictions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions