xonecas.io
64875
Mc

mini-coder / commit 879f01d

Remove model param from subagent tool; tighten review prompt

xonecas2026-02-20 879f01dbc9bf33998c2c9c49bb33c314fc68633a parent 49ae2b9

5 files changed

TODO.md+6−7
@@ -1,3 +1,9 @@
1+# Markdown Assistant responses
2+
3+- use our color packages to create a minimal markdown highlighter
4+
5+---
6+
17 # Fix implementation error
28
39 1. The DB only saves text — agent.ts:412–429 strips tool parts before writing to SQLite. That's the right design for persistence, but coreHistory in memory is never trimmed.
@@ -18,13 +24,6 @@ Besides undoing the conversation turn, it should restore some snapshot, using gi
1824
1925 ---
2026
21-# Plan mode changes
22-
23-- Allow read tools + mcp
24-- When plan mode is on, add a `<system-message>PLAN MODE ACTIVE: Help the user gather context for the plan -- READ ONLY</system-message>` suffix to the user messages.
25-
26----
27-
2827 # Tools output
2928
3029 Insert/read/edit/write/grep all were changed with the hashline feature, outputs needs
src/agent/agent.ts+4−4
@@ -207,13 +207,12 @@ export async function runAgent(opts: AgentOptions): Promise<void> {
207207 // Subagent runner (recursive) — depth prevents infinite recursion
208208 const runSubagent = async (
209209 prompt: string,
210- model?: string,
211210 depth = 0,
212211 ): Promise<{ result: string; inputTokens: number; outputTokens: number }> => {
213- const subModel = model ?? currentModel;
214212 const subMessages: Message[] = [{ role: "user", content: prompt }];
215213 const subTools = buildToolSet({ cwd, depth, runSubagent });
216- const subLlm = resolveModel(subModel);
214+ const subLlm = resolveModel(currentModel);
215+
217216 const systemPrompt = buildSystemPrompt(cwd);
218217
219218 let result = "";
@@ -287,7 +286,8 @@ export async function runAgent(opts: AgentOptions): Promise<void> {
287286 planMode = v;
288287 },
289288 cwd,
290- runSubagent: (prompt, model) => runSubagent(prompt, model),
289+ runSubagent: (prompt) => runSubagent(prompt),
290+
291291 undoLastTurn: () => {
292292 // Nothing to undo if there are no messages
293293 if (session.messages.length === 0) return false;
src/agent/tools.ts+2−3
@@ -57,7 +57,6 @@ export function buildToolSet(opts: {
5757 depth?: number;
5858 runSubagent: (
5959 prompt: string,
60- model?: string,
6160 depth?: number,
6261 ) => Promise<{
6362 result: string;
@@ -77,14 +76,14 @@ export function buildToolSet(opts: {
7776 withCwdDefault(insertTool as ToolDef, opts.cwd),
7877 // Shell and subagent
7978 withCwdDefault(shellTool as ToolDef, opts.cwd),
80- createSubagentTool(async (prompt, model) => {
79+ createSubagentTool(async (prompt) => {
8180 if (depth >= MAX_SUBAGENT_DEPTH) {
8281 throw new Error(
8382 `Subagent depth limit reached (max ${MAX_SUBAGENT_DEPTH}). ` +
8483 `Cannot spawn another subagent from depth ${depth}.`,
8584 );
8685 }
87- return opts.runSubagent(prompt, model, depth + 1);
86+ return opts.runSubagent(prompt, depth + 1);
8887 }) as ToolDef,
8988 ];
9089 }
src/cli/commands.ts+27−33
@@ -23,8 +23,8 @@ export interface CommandContext {
2323 connectMcpServer: (name: string) => Promise<void>;
2424 runSubagent: (
2525 prompt: string,
26- model?: string,
2726 ) => Promise<{ result: string; inputTokens: number; outputTokens: number }>;
27+
2828 cwd: string;
2929 }
3030
@@ -238,40 +238,34 @@ async function handleMcp(ctx: CommandContext, args: string): Promise<void> {
238238 // ─── Review ───────────────────────────────────────────────────────────────────
239239
240240 const REVIEW_PROMPT = (cwd: string, focus: string) => `\
241-You are a thorough code reviewer. Your job is to review the recent changes in \
242-this codebase and produce a structured, actionable report.
241+You are a code reviewer. Review recent changes and provide actionable feedback.
243242
244243 Working directory: ${cwd}
245-${focus ? `Focus area: ${focus}` : ""}
246-
247-Use the following hierarchy of concerns (most important first) to guide your review:
248-
249-1. **Comprehension & team alignment** — Is the intent of the change clear? \
250-Would a teammate be able to understand the system after reading this? \
251-Flag anything that lacks explanation or diverges from established patterns without reason.
252-
253-2. **Correctness** — Does the change actually solve the stated problem? \
254-Look for logic errors, missing edge cases, incorrect assumptions, and off-by-one errors.
255-
256-3. **Design** — Is the approach well-structured? \
257-Consider separation of concerns, abstraction quality, coupling, cohesion, \
258-and whether a simpler design could achieve the same goal.
259-
260-4. **Bugs & safety** — Identify potential runtime errors, unhandled rejections/exceptions, \
261-type unsafety, resource leaks, race conditions, or security issues.
262-
263-5. **Style & consistency** — Flag naming inconsistencies, formatting issues, \
264-dead code, missing or misleading comments — only after the above are addressed.
265-
266-Instructions:
267-- First use \`shell\` to use git diff commands to check for unstaged changes, if not focused \
268-on something else default to reviewing the git diff.
269-- Use \`glob\`, \`grep\`, and \`read\` as needed to understand the full context of changed files.
270-- Structure your output with a section per concern level above. \
271-Use "✔ nothing to flag" for levels with no issues.
272-- End with a short **Summary** of the most important items to address.
273-- Be specific: quote code, cite file names and line numbers.
274-- Be direct but constructive. Focus on the code, not the author.
244+${focus ? `Focus: ${focus}` : ""}
245+
246+## What to review
247+- No args: \`git diff\` (unstaged) + \`git diff --cached\` (staged) + \`git status --short\` (untracked)
248+- Commit hash: \`git show <hash>\`
249+- Branch: \`git diff <branch>...HEAD\`
250+- PR number/URL: \`gh pr view\` + \`gh pr diff\`
251+
252+## How to review
253+After getting the diff, read the full files changed — diffs alone miss context.
254+Check for AGENTS.md or CONVENTIONS.md for project conventions.
255+
256+## What to flag (priority order)
257+1. **Bugs** — logic errors, missing edge cases, unhandled errors, race conditions, security issues. Be certain before flagging; investigate first.
258+2. **Structure** — wrong abstraction, established patterns ignored, excessive nesting.
259+3. **Performance** — only if obviously problematic (O(n²) on unbounded data, N+1, blocking hot paths).
260+4. **Style** — only clear violations of project conventions. Don't be a zealot.
261+
262+Only review the changed code, not pre-existing code.
263+
264+## Output
265+- Be direct and specific: quote code, cite file and line number.
266+- State the scenario/input that triggers a bug — severity depends on this.
267+- No flattery, no filler. Matter-of-fact tone.
268+- End with a short **Summary** of the most important items.
275269 `;
276270
277271 async function handleReview(ctx: CommandContext, args: string): Promise<void> {
src/tools/subagent.ts+1−9
@@ -3,13 +3,6 @@ import type { ToolDef } from "../llm-api/types.ts";
33
44 const SubagentInput = z.object({
55 prompt: z.string().describe("The task or question to give the subagent"),
6- model: z
7- .string()
8- .optional()
9- .describe(
10- "Model to use for the subagent (e.g. 'zen/claude-haiku-4-5'). " +
11- "Defaults to the current model.",
12- ),
136 });
147
158 type SubagentInput = z.infer<typeof SubagentInput>;
@@ -29,7 +22,6 @@ export interface SubagentOutput {
2922 export function createSubagentTool(
3023 runSubagent: (
3124 prompt: string,
32- model?: string,
3325 ) => Promise<{ result: string; inputTokens: number; outputTokens: number }>,
3426 ): ToolDef<SubagentInput, SubagentOutput> {
3527 return {
@@ -40,7 +32,7 @@ export function createSubagentTool(
4032 "a fresh context window. The subagent has access to all the same tools.",
4133 schema: SubagentInput,
4234 execute: async (input) => {
43- return runSubagent(input.prompt, input.model);
35+ return runSubagent(input.prompt);
4436 },
4537 };
4638 }