feat: prioritize batched reads for turn efficiency
ci / check (macos-latest) (push) Canceled after 0s
ci / check (ubuntu-latest) (push) Canceled after 0s
ci / check (windows-latest) (push) Canceled after 0s

Move read_many_files to core tool set so it is always offered. Strengthen
system-prompt guidance: read_file now redirects to read_many_files for
multiple files, read_many_files is framed as the primary reading tool with
an explicit batch range (2-20). Add a 'How to work' rule on read
efficiency, and a read-batching instruction in the deep agent variant.
861 tests pass; build clean.
This commit is contained in:
asepharyana
2026-09-11 19:06:04 +07:00
parent 7d77408a41
commit b0da909454
7 changed files with 61 additions and 6 deletions
+12
View File
@@ -10,6 +10,18 @@ test('every documented tool has usable guidance', () => {
}
});
test('read guidance steers the model to batch reads for efficiency', () => {
const readMany = TOOL_DOCS.find((d) => d.name === 'read_many_files');
const readOne = TOOL_DOCS.find((d) => d.name === 'read_file');
expect(readMany?.line).toContain('batch');
expect(readMany?.line).toContain('read_file');
expect(readOne?.line).toContain('read_many_files');
// The "How to work" block also instructs batched reading.
const prompt = systemPrompt({ cwd: '/repo', availableTools: ['read_file', 'read_many_files'] });
expect(prompt).toContain('Read efficiently');
expect(prompt).toContain('read_many_files');
});
test('only the offered tools are described', () => {
const rendered = renderTools(['read_file', 'grep']);
expect(rendered).toContain('read_file');
+2
View File
@@ -307,6 +307,8 @@ test('session tools survive tool-set gating, since they are not part of that bud
test('toolSetOf names the set a tool came from, and nothing for a session tool', () => {
expect(toolSetOf('read_file')).toBe('core');
// Batched reading is core so it is always offered — efficiency, not an extra set.
expect(toolSetOf('read_many_files')).toBe('core');
expect(toolSetOf('multi_edit')).toBe('edit-plus');
expect(toolSetOf('git_log')).toBe('git');
expect(toolSetOf('todo_write')).toBeUndefined();