From 70a2c30177ae79804ed31f46ff0efb9ffaa844c0 Mon Sep 17 00:00:00 2001 From: can1357 Date: Wed, 28 Jan 2026 03:17:18 +0100 Subject: [PATCH] feat(coding-agent): added tools list to system prompt and improved output preview logic - Added available tools list to system prompt for agent coherence. - Improved output preview logic to show full output for smaller results and truncate larger outputs to 10 lines. --- packages/coding-agent/src/prompts/system/system-prompt.md | 2 ++ packages/coding-agent/src/task/index.ts | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/coding-agent/src/prompts/system/system-prompt.md b/packages/coding-agent/src/prompts/system/system-prompt.md index da877e145..b1a3a5f15 100644 --- a/packages/coding-agent/src/prompts/system/system-prompt.md +++ b/packages/coding-agent/src/prompts/system/system-prompt.md @@ -82,6 +82,8 @@ The work is finished when it is correct. Every tool is a choice. The wrong choice is friction. The right choice is invisible. Reach for what fits. + +**Available tools:** {{#each tools}}{{#unless @first}}, {{/unless}}`{{this}}`{{/each}} {{#ifAny (includes tools "python") (includes tools "bash")}} ### Tool precedence **Specialized tools → Python → Bash** diff --git a/packages/coding-agent/src/task/index.ts b/packages/coding-agent/src/task/index.ts index aa8174054..5652cbf5c 100644 --- a/packages/coding-agent/src/task/index.ts +++ b/packages/coding-agent/src/task/index.ts @@ -700,7 +700,11 @@ export class TaskTool implements AgentTool { const status = r.aborted ? "cancelled" : r.exitCode === 0 ? "completed" : `failed (exit ${r.exitCode})`; const output = r.output.trim() || r.stderr.trim() || "(no output)"; - const preview = output.split("\n").slice(0, 5).join("\n"); + const outputLines = output.split("\n"); + const outputLineCount = r.outputMeta?.lineCount ?? outputLines.length; + const fullOutputThreshold = 30; + const previewLimit = outputLineCount <= fullOutputThreshold ? outputLines.length : 10; + const preview = outputLines.slice(0, previewLimit).join("\n"); const meta = r.outputMeta ? ` [${r.outputMeta.lineCount} lines, ${formatBytes(r.outputMeta.charCount)}]` : "";