Class: Tools::Think

Inherits:
Base
  • Object
show all
Defined in:
lib/tools/think.rb

Overview

A deliberate reasoning space for the agent’s inner voice. Creates a pause between tool calls where the agent can organize thoughts, plan next steps, or make decisions without interrupting the user.

Think events bridge the gap between the analytical brain (subconscious background processing) and speech (user-facing messages). Without this tool, reasoning leaks into tool arguments as comments.

Two visibility modes control how thoughts appear in the TUI:

  • inner (default) — silent reasoning, visible only in verbose/debug

  • aloud — narration shown in all view modes with a thought bubble

Examples:

Silent planning between tool calls

think(thoughts: "Three auth failures — likely a config issue, not individual tests.")

Narrating approach for the user

think(thoughts: "Checking the OAuth config first.", visibility: "aloud")

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, schema

Constructor Details

This class inherits a constructor from Tools::Base

Class Method Details

.descriptionObject



24
# File 'lib/tools/think.rb', line 24

def self.description = "Think out loud or silently."

.input_schemaObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tools/think.rb', line 26

def self.input_schema
  {
    type: "object",
    properties: {
      thoughts: {type: "string"},
      visibility: {
        type: "string",
        enum: ["inner", "aloud"],
        description: "inner (default) is silent. aloud is shown to the user."
      }
    },
    required: ["thoughts"]
  }
end

.tool_nameObject



22
# File 'lib/tools/think.rb', line 22

def self.tool_name = "think"

Instance Method Details

#execute(input) ⇒ String

Returns acknowledgement — the value is in the call, not the result.

Parameters:

  • input (Hash)

    with “thoughts” and optional “visibility”

Returns:

  • (String)

    acknowledgement — the value is in the call, not the result



43
44
45
46
47
48
# File 'lib/tools/think.rb', line 43

def execute(input)
  thoughts = input["thoughts"].to_s
  return {error: "Thoughts cannot be blank"} if thoughts.strip.empty?

  "OK"
end