Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(agent-runtime): prevent subagent tool-mismatch by strengthening selection guidance (#983)
Lan42e76dc724c1
diff --git a/packages/agent-runtime/src/subagent-definitions.ts b/packages/agent-runtime/src/subagent-definitions.tsindex ba0c9cc4a..9c12dc298 100644--- a/packages/agent-runtime/src/subagent-definitions.ts+++ b/packages/agent-runtime/src/subagent-definitions.ts@@ -59,7 +59,7 @@ export function subagentDefinitionDir(_workspaceRoot: string): string {export const BUILTIN_SUBAGENT_DOCUMENTS: readonly string[] = [`---name: explorer-description: Fast codebase search and pattern matching — find files, locate implementations and answer "where is X?" / "how does Y work?". Use when answering needs a sweep over many files and you only want the conclusion.+description: Fast codebase search and pattern matching — find files, locate implementations and answer "where is X?" / "how does Y work?". Use when answering needs a sweep over many files and you only want the conclusion. Has Bash — use it when the task needs CLI commands (gh, git, npm, cargo, etc.).tools: [Read, Glob, Grep, Bash]---@@ -84,12 +84,17 @@ than a guess.</answer>`,`---name: code-reviewer-description: Review specific code or a specific change for defects. Use for a second opinion on correctness, edge cases and missing tests before you commit.+description: Review specific code or a specific change for defects. Use for a second opinion on correctness, edge cases and missing tests before you commit. Has NO Bash or shell access — cannot run CLI commands (gh, git, npm, etc.). If the task needs shell commands, use explorer or fixer instead.tools: [Read, Glob, Grep]---Review only what the task names, and read enough surrounding code to judge it.+- You have NO shell or terminal access. Do not attempt to run commands.+ If the task requires CLI output (gh, git log, npm, cargo, etc.), report+ that limitation in one sentence and stop — do not pad the report with+ unrelated code reading.+- Prefer defects that change behavior: wrong results, unhandled failures,broken invariants, races, resource leaks, missing test coverage.- Check the code against how its callers and neighbors actually use it, notdiff --git a/packages/agent-runtime/src/subagent.ts b/packages/agent-runtime/src/subagent.tsindex 66c8c664f..cfe8c5eb9 100644--- a/packages/agent-runtime/src/subagent.ts+++ b/packages/agent-runtime/src/subagent.ts@@ -191,6 +191,7 @@ export function composeSubagentSystemPrompt(options: {: "You have no tools that change files or run commands, so never report an edit you could not have made.","Your final message is the report the main agent receives when you finish. Make it self-contained: what you did, what you found with exact paths and line numbers, and anything you could not finish.","Keep the report tight. Report findings, not narration, and never pad it with a summary of your own process.",+ "If you discover in the first few turns that you lack a tool essential to the task (e.g. no Bash when shell commands are needed), stop immediately with a one-sentence report naming the missing capability. Do not attempt workarounds or pad the report with unrelated reading.",].join("\n");return [framing, definition.prompt, ...(options.guidance ?? [])].filter((block) => block.trim().length > 0)