Skip to content

Commit 80971b8

Browse files
fix: remove built-in tools from LLM visibility and harden system prompt (#10)
Remove get_current_time and calculate from tool definitions exposed to the LLM to prevent small models from proactively calling tools on greetings. The tools remain callable in tool_engine but are no longer advertised. Also fix stale +2 offset in get_filtered_definitions_json and strengthen the system prompt to explicitly forbid tool calls for casual conversation. Bump version to 0.3.1.
1 parent 5e703b9 commit 80971b8

4 files changed

Lines changed: 8 additions & 26 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if(POLICY CMP0177)
55
endif()
66
set(CMAKE_POLICY_VERSION_MINIMUM 3.5 CACHE STRING "" FORCE)
77

8-
project(rcli VERSION 0.3.0 LANGUAGES C CXX)
8+
project(rcli VERSION 0.3.1 LANGUAGES C CXX)
99

1010
set(CMAKE_CXX_STANDARD 17)
1111
set(CMAKE_CXX_STANDARD_REQUIRED ON)

src/actions/action_registry.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ std::string ActionRegistry::get_definitions_json() const {
2828
oss << "[\n";
2929
bool first = true;
3030

31-
// Built-in tools (time, calculate)
32-
oss << " {\"name\": \"get_current_time\", \"description\": \"Get the current date and time\", \"parameters\": {}}";
33-
first = false;
34-
oss << ",\n {\"name\": \"calculate\", \"description\": \"Evaluate a math expression\", \"parameters\": {\"expression\": \"math expression like 2 + 2\"}}";
35-
3631
for (auto& [name, entry] : actions_) {
3732
if (enabled_.count(name) == 0) continue;
3833
if (!first) oss << ",\n";
@@ -89,15 +84,6 @@ std::string ActionRegistry::get_filtered_definitions_json(
8984

9085
std::vector<ScoredAction> scored;
9186

92-
// Score built-in tools the same way as macOS actions
93-
scored.push_back({"get_current_time",
94-
"Get the current date and time", "{}",
95-
score_haystack("get_current_time get the current date and time")});
96-
scored.push_back({"calculate",
97-
"Evaluate a math expression",
98-
"{\"expression\": \"math expression like 2 + 2\"}",
99-
score_haystack("calculate evaluate a math expression")});
100-
10187
for (auto& [name, entry] : actions_) {
10288
if (enabled_.count(name) == 0) continue;
10389

@@ -129,8 +115,7 @@ std::string ActionRegistry::get_filtered_definitions_json(
129115

130116
if (!any_relevant) return "";
131117

132-
// Return full set: built-in tools are already in `scored`, plus
133-
// top-k macOS actions (all of them if there are fewer than max_tools).
118+
// Return top-k macOS actions (all of them if there are fewer than max_tools).
134119
std::ostringstream oss;
135120
oss << "[\n";
136121
int included = 0;
@@ -140,7 +125,7 @@ std::string ActionRegistry::get_filtered_definitions_json(
140125
<< "\", \"description\": \"" << sa.description
141126
<< "\", \"parameters\": " << sa.parameters_json << "}";
142127
included++;
143-
if (included >= max_tools + 2) break; // +2 for built-in tools
128+
if (included >= max_tools) break;
144129
}
145130
oss << "\n]";
146131
return oss.str();

src/core/constants.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ static constexpr const char* RCLI_SYSTEM_PROMPT =
77
"You answer questions, explain topics, have conversations, and can also perform actions on the Mac.\n"
88
"Your responses will be spoken aloud, so keep them natural and conversational.\n"
99
"RULES:\n"
10-
"1. For questions, explanations, chitchat, greetings, or anything conversational, "
11-
"just answer directly. Do NOT mention tools. Do NOT say you lack a tool. Just answer the question.\n"
12-
"2. Only use tools when the user asks you to DO something on the Mac "
13-
"(open, create, play, send, search, set timer, etc.). Pick the most specific tool.\n"
10+
"1. For greetings (hi, hello, hey), chitchat, questions, or explanations, "
11+
"just respond naturally. NEVER call tools for greetings or casual conversation.\n"
12+
"2. Only use tools when the user explicitly asks you to DO something on the Mac "
13+
"(open, create, play, send, search, set volume, etc.). Pick the most specific tool.\n"
1414
"3. Never use asterisks, bullet points, numbered lists, markdown formatting, "
1515
"or any special symbols. Write in plain conversational sentences only.\n"
1616
"4. When you use a tool, output ONLY the tool call block with no other text.\n"

src/tools/tool_defs.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
namespace rastack {
66

7-
static const char* DEFAULT_TOOL_DEFS_JSON = R"([
8-
{"name": "get_current_time", "description": "Get the current date and time", "parameters": {}},
9-
{"name": "calculate", "description": "Evaluate a math expression", "parameters": {"expression": "math expression like '2 + 2'"}}
10-
])";
7+
static const char* DEFAULT_TOOL_DEFS_JSON = R"([])";
118

129
} // namespace rastack

0 commit comments

Comments
 (0)