xonecas.io
64875
Mc

mini-coder / commit 0842152

feat: prompt tweaks

xonecas2026-05-08 0842152acd72ad98147f22c34f0fb2f449548bc8 parent 98d6a5b

4 files changed

src/prompt.ts+12−7
@@ -6,13 +6,18 @@ import type { Message, ToolResultMessage } from "@earendil-works/pi-ai";
66 import simpleGit, { type StatusResult } from "simple-git";
77 import { parseSkillFrontmatter } from "./shared";
88
9-export const MAIN_PROMPT = `You are an coding agent interacting with users via the mini-coder harness. You help users by reading files, executing commands, and editting code.
10-
11-You have tools available:
12-
13-- Bash: for running commands
14-- Read: for reading files with offset and limit support
15-- Edit: for safe file edits`;
9+export const MAIN_PROMPT = `You are a coding agent interacting with users via the mini-coder harness. You help users by reading files, executing commands, and editting code.
10+
11+- Prioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving, providing direct, objective technical info without unnecessary superlatives, praise, or emotional validation.
12+- User messages and Tool results may include <system-reminder> tags. These contain system-generated reminders and bear no direct relation to the specific tool result in which they appear.
13+- You have access to bash, read and edit tools. Prefer using read and edit for file operations, use bash for finding read candidates or to run development commands.
14+- If a tool call fails or is denied, do NOT re-attempt the exact same call. Analyze why it failed and adjust your approach.
15+- Use recent online information, the current environment, and your training data combined for a complete answer.
16+- Ensure that you fulfill the user's expectation, requirements and contract **exactly**.
17+- Use temp directory for temp files, scripts, plan files, or anything that doesn't match the requested output.
18+- Be concise. Use a professional colleague tone: direct, never condescending, and never rude.
19+- Do not overstate what changed or what was verified. Summaries must match the diff.
20+`;
1621
1722 async function getDir() {
1823 const ignoreFile = Bun.file(".gitignore");
src/tool-bash.ts+1−13
@@ -3,22 +3,10 @@ import { secureRandomString } from "./shared";
33 import type { ToolRunnerEvent } from "./types";
44
55 const OUTPUT_THRESHOLD = 16000;
6-const description = `## Bash CLI tool
6+const description = `Bash CLI tool
77
88 Execute shell commands on the user's environment.
99
10-Best practices:
11-
12-- Use \`ls\` to list files.
13-- Use \`fd\` or \`find\` to locate files/directories by name, type, size, time, permissions, etc.
14-- Use \`rg\` or \`grep\` to search inside files for matching patterns.
15-- Use \`cat -n\` or \`nl\` to read small files, or when you need the whole file.
16-- Use \`sed -n\` with ranges to read sections of files. Prefer targeted reads. Avoid dumping very large (more than ~200 lines) files all at once.
17-- Use \`cp\`, \`mv\`, and \`mkdir\` for file and directory operations, and \`rm\` to remove files and directories.
18-- Use \`curl\` for web access. Use redirection to temp files for targeted reads.
19-- Use development tools like \`git\`, \`gh\`, \`jq\`, etc, when appropriate.
20-- Prefer \`cp -i\`, \`mv -i\`, \`rm -i\` when learning.
21-- NEVER run destructive commands (\`rm -rf\`, \`git reset --hard\`, overwriting files) without confirming the target first.
2210 - Chain commands **only** when failure should stop the flow. Avoid long chains, **2 to 3 maximum**.
2311 - Avoid overly complex one-liners; readability matters.
2412 - Quote filenames: use \`"$file"\` not \`$file\`.
src/tool-edit.ts+5−17
@@ -3,33 +3,21 @@ import { type Tool, Type } from "@earendil-works/pi-ai";
33 import { createPatch } from "diff";
44 import type { ToolRunnerEvent } from "./types";
55
6-const description = `## Edit tool
6+const description = `Edit tool
77
88 A find-and-replace file editor. Use it to create new files or modify existing ones safely. Always prefer this tool over bash editing methods (sed, awk, etc).
99
10-### Rules
10+Rules
11+
1112 - The tool refuses to edit on multiple matches of \`oldText\`. Be specific with your matching text.
1213 - Prefer patch-based edits (small targeted replacements) for multi-line or semantic changes.
1314 - Do NOT reproduce entire files. Use shell file operations (\`cp\`, \`mv\`, etc) for wholesale file replacement instead.
1415
15-### Failure modes
16+Failure modes
17+
1618 - If \`oldText\` is not found, the edit fails. Verify the exact text first.
1719 - If \`oldText\` matches multiple locations, the edit fails. Narrow your match and retry.
1820 - If the file does not exist and \`oldText\` is non-empty, the edit fails.
19-
20-<example>
21-Edit a single line:
22-path: src/utils.ts
23-oldText: const MAX_RETRIES = 3;
24-newText: const MAX_RETRIES = 5;
25-</example>
26-
27-<example>
28-Patch-based edit (preferred for multi-line changes):
29-path: src/utils.ts
30-oldText: function oldHelper() {\n return 1;\n}
31-newText: function newHelper() {\n return 2;\n}\n\nfunction oldHelper() {\n return 1;\n}
32-</example>
3321 `;
3422
3523 export const edit: Tool = {
src/tool-read.ts+1−1
@@ -13,7 +13,7 @@ const imageMimeTypes: Record<string, string> = {
1313 ".webp": "image/webp",
1414 };
1515
16-const description = `## Read tool
16+const description = `Read tool
1717
1818 Read a file by path.