Skip to content

Commit b09ab86

Browse files
author
X
committed
Add list_tools and improve tool documentation
1 parent 53950f6 commit b09ab86

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

core/agent-loop.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,17 +435,33 @@ const AgentLoop = {
435435
${personaPrompt}
436436
437437
## Tools
438-
- list_files: explore directories
439-
- read_file: read file contents
440-
- write_file: create or modify files
441-
- delete_file: remove files
442-
- create_tool: make new tools in /tools/
443-
- improve_core_module: modify core modules
438+
439+
### Discovery
440+
- list_tools: returns array of all available tool names (no args)
441+
- list_files: explore directories { "path": "/dir/" }
442+
443+
### File Operations
444+
- read_file: read file contents { "path": "/file.js" }
445+
- write_file: create or modify files { "path": "/file.js", "content": "..." }
446+
- delete_file: remove files { "path": "/file.js" }
447+
448+
### Self-Modification (RSI)
449+
- create_tool: create new tool in /tools/ { "name": "my_tool", "code": "..." }
450+
- name MUST be lowercase with underscores only (e.g., "my_tool" not "MyTool")
451+
- code MUST include: export const tool = {...} and export default call;
452+
- improve_core_module: modify /core/ modules { "module": "utils", "code": "..." }
453+
- module is just the name (e.g., "utils"), NOT a path
454+
- only works for files in /core/
455+
- load_module: hot-reload any module { "path": "/capabilities/x.js" }
444456
445457
## Tool Call Format
446458
TOOL_CALL: tool_name
447459
ARGS: { "key": "value" }
448460
461+
Example:
462+
TOOL_CALL: list_tools
463+
ARGS: {}
464+
449465
Example:
450466
TOOL_CALL: read_file
451467
ARGS: { "path": "/core/agent-loop.js" }

core/tool-runner.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ const ToolRunner = {
6969
// Core Modification (Level 2 RSI)
7070
improve_core_module: async ({ module, code }) => {
7171
return await MetaToolWriter.improveCore(module, code);
72+
},
73+
74+
// Tool Discovery
75+
list_tools: async () => {
76+
return Array.from(_tools.keys());
7277
}
7378
};
7479

0 commit comments

Comments
 (0)