bernard-agent 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/README.md +80 -44
  2. package/dist/agent.d.ts +14 -3
  3. package/dist/agent.js +228 -38
  4. package/dist/agent.js.map +1 -1
  5. package/dist/builtin-specialists/correction-agent.json +32 -0
  6. package/dist/builtin-specialists/file-wrapper.json +43 -0
  7. package/dist/builtin-specialists/shell-wrapper.json +50 -0
  8. package/dist/builtin-specialists/specialist-creator.json +32 -0
  9. package/dist/builtin-specialists/web-wrapper.json +38 -0
  10. package/dist/candidate-bootstrap.d.ts +18 -0
  11. package/dist/candidate-bootstrap.js +61 -0
  12. package/dist/candidate-bootstrap.js.map +1 -0
  13. package/dist/config.d.ts +132 -10
  14. package/dist/config.js +234 -47
  15. package/dist/config.js.map +1 -1
  16. package/dist/context.js +23 -6
  17. package/dist/context.js.map +1 -1
  18. package/dist/correction-candidates.d.ts +54 -0
  19. package/dist/correction-candidates.js +138 -0
  20. package/dist/correction-candidates.js.map +1 -0
  21. package/dist/correction.d.ts +67 -0
  22. package/dist/correction.js +138 -0
  23. package/dist/correction.js.map +1 -0
  24. package/dist/critic.js +2 -1
  25. package/dist/critic.js.map +1 -1
  26. package/dist/cron/notes-store.d.ts +41 -0
  27. package/dist/cron/notes-store.js +134 -0
  28. package/dist/cron/notes-store.js.map +1 -0
  29. package/dist/cron/runner.js +25 -3
  30. package/dist/cron/runner.js.map +1 -1
  31. package/dist/cron/scoped-notes-tools.d.ts +24 -0
  32. package/dist/cron/scoped-notes-tools.js +50 -0
  33. package/dist/cron/scoped-notes-tools.js.map +1 -0
  34. package/dist/custom-providers.d.ts +80 -0
  35. package/dist/custom-providers.js +238 -0
  36. package/dist/custom-providers.js.map +1 -0
  37. package/dist/fs-utils.d.ts +2 -0
  38. package/dist/fs-utils.js +44 -0
  39. package/dist/fs-utils.js.map +1 -0
  40. package/dist/history.js +3 -1
  41. package/dist/history.js.map +1 -1
  42. package/dist/image.d.ts +59 -0
  43. package/dist/image.js +228 -0
  44. package/dist/image.js.map +1 -0
  45. package/dist/index.js +72 -4
  46. package/dist/index.js.map +1 -1
  47. package/dist/mcp.js +1 -1
  48. package/dist/mcp.js.map +1 -1
  49. package/dist/memory.d.ts +13 -0
  50. package/dist/memory.js +45 -4
  51. package/dist/memory.js.map +1 -1
  52. package/dist/menu.d.ts +97 -0
  53. package/dist/menu.js +338 -0
  54. package/dist/menu.js.map +1 -0
  55. package/dist/os-info.d.ts +22 -0
  56. package/dist/os-info.js +111 -0
  57. package/dist/os-info.js.map +1 -0
  58. package/dist/output.d.ts +35 -1
  59. package/dist/output.js +256 -45
  60. package/dist/output.js.map +1 -1
  61. package/dist/pac.d.ts +14 -2
  62. package/dist/pac.js +5 -5
  63. package/dist/pac.js.map +1 -1
  64. package/dist/paths.d.ts +5 -0
  65. package/dist/paths.js +6 -1
  66. package/dist/paths.js.map +1 -1
  67. package/dist/plan-store.d.ts +47 -0
  68. package/dist/plan-store.js +94 -0
  69. package/dist/plan-store.js.map +1 -0
  70. package/dist/prompt-rewriter.d.ts +29 -0
  71. package/dist/prompt-rewriter.js +155 -0
  72. package/dist/prompt-rewriter.js.map +1 -0
  73. package/dist/providers/index.d.ts +56 -4
  74. package/dist/providers/index.js +86 -5
  75. package/dist/providers/index.js.map +1 -1
  76. package/dist/providers/profiles.d.ts +37 -0
  77. package/dist/providers/profiles.js +110 -0
  78. package/dist/providers/profiles.js.map +1 -0
  79. package/dist/providers/types.d.ts +11 -2
  80. package/dist/providers/types.js +3 -0
  81. package/dist/providers/types.js.map +1 -1
  82. package/dist/rag-query.js +15 -1
  83. package/dist/rag-query.js.map +1 -1
  84. package/dist/react.d.ts +38 -0
  85. package/dist/react.js +116 -0
  86. package/dist/react.js.map +1 -0
  87. package/dist/reasoning-log.d.ts +30 -0
  88. package/dist/reasoning-log.js +102 -0
  89. package/dist/reasoning-log.js.map +1 -0
  90. package/dist/reference-resolver.d.ts +47 -0
  91. package/dist/reference-resolver.js +316 -0
  92. package/dist/reference-resolver.js.map +1 -0
  93. package/dist/reference-tool-lookup.d.ts +37 -0
  94. package/dist/reference-tool-lookup.js +318 -0
  95. package/dist/reference-tool-lookup.js.map +1 -0
  96. package/dist/repl.js +1053 -346
  97. package/dist/repl.js.map +1 -1
  98. package/dist/setup.js +2 -1
  99. package/dist/setup.js.map +1 -1
  100. package/dist/specialist-detector.js +2 -1
  101. package/dist/specialist-detector.js.map +1 -1
  102. package/dist/specialists.d.ts +74 -3
  103. package/dist/specialists.js +152 -20
  104. package/dist/specialists.js.map +1 -1
  105. package/dist/structured-output.d.ts +58 -0
  106. package/dist/structured-output.js +138 -0
  107. package/dist/structured-output.js.map +1 -0
  108. package/dist/theme.d.ts +2 -0
  109. package/dist/theme.js +18 -12
  110. package/dist/theme.js.map +1 -1
  111. package/dist/tool-call-repair.d.ts +29 -0
  112. package/dist/tool-call-repair.js +99 -0
  113. package/dist/tool-call-repair.js.map +1 -0
  114. package/dist/tool-profiles.d.ts +70 -0
  115. package/dist/tool-profiles.js +385 -0
  116. package/dist/tool-profiles.js.map +1 -0
  117. package/dist/tools/activity-summary.d.ts +15 -0
  118. package/dist/tools/activity-summary.js +44 -0
  119. package/dist/tools/activity-summary.js.map +1 -0
  120. package/dist/tools/ask-user.d.ts +49 -0
  121. package/dist/tools/ask-user.js +52 -0
  122. package/dist/tools/ask-user.js.map +1 -0
  123. package/dist/tools/augment.d.ts +17 -0
  124. package/dist/tools/augment.js +102 -0
  125. package/dist/tools/augment.js.map +1 -0
  126. package/dist/tools/cron-logs.js +7 -0
  127. package/dist/tools/cron-logs.js.map +1 -1
  128. package/dist/tools/cron-notes.d.ts +52 -0
  129. package/dist/tools/cron-notes.js +105 -0
  130. package/dist/tools/cron-notes.js.map +1 -0
  131. package/dist/tools/datetime.d.ts +7 -0
  132. package/dist/tools/datetime.js +29 -3
  133. package/dist/tools/datetime.js.map +1 -1
  134. package/dist/tools/evaluate.d.ts +20 -0
  135. package/dist/tools/evaluate.js +29 -0
  136. package/dist/tools/evaluate.js.map +1 -0
  137. package/dist/tools/index.js +4 -0
  138. package/dist/tools/index.js.map +1 -1
  139. package/dist/tools/mcp.d.ts +3 -3
  140. package/dist/tools/plan.d.ts +81 -0
  141. package/dist/tools/plan.js +108 -0
  142. package/dist/tools/plan.js.map +1 -0
  143. package/dist/tools/result-cap.d.ts +24 -0
  144. package/dist/tools/result-cap.js +44 -0
  145. package/dist/tools/result-cap.js.map +1 -0
  146. package/dist/tools/routine.d.ts +3 -3
  147. package/dist/tools/shell.d.ts +14 -1
  148. package/dist/tools/shell.js +86 -4
  149. package/dist/tools/shell.js.map +1 -1
  150. package/dist/tools/specialist-run.d.ts +5 -3
  151. package/dist/tools/specialist-run.js +115 -24
  152. package/dist/tools/specialist-run.js.map +1 -1
  153. package/dist/tools/specialist.d.ts +83 -3
  154. package/dist/tools/specialist.js +83 -3
  155. package/dist/tools/specialist.js.map +1 -1
  156. package/dist/tools/subagent.js +32 -14
  157. package/dist/tools/subagent.js.map +1 -1
  158. package/dist/tools/task.d.ts +19 -16
  159. package/dist/tools/task.js +69 -40
  160. package/dist/tools/task.js.map +1 -1
  161. package/dist/tools/think.d.ts +18 -0
  162. package/dist/tools/think.js +25 -0
  163. package/dist/tools/think.js.map +1 -0
  164. package/dist/tools/tool-wrapper-run.d.ts +121 -0
  165. package/dist/tools/tool-wrapper-run.js +382 -0
  166. package/dist/tools/tool-wrapper-run.js.map +1 -0
  167. package/dist/tools/types.d.ts +28 -2
  168. package/dist/tools/web-search.d.ts +31 -0
  169. package/dist/tools/web-search.js +172 -0
  170. package/dist/tools/web-search.js.map +1 -0
  171. package/dist/tools/wrap-with-specialist.d.ts +55 -0
  172. package/dist/tools/wrap-with-specialist.js +137 -0
  173. package/dist/tools/wrap-with-specialist.js.map +1 -0
  174. package/package.json +2 -2
package/dist/agent.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Agent = void 0;
3
+ exports.Agent = exports.buildEnforcementFeedback = exports.REACT_AUTO_CANCEL_NOTE = exports.REACT_ENFORCEMENT_MAX_RETRIES = exports.computeEffectiveMaxSteps = exports.REACT_MAX_STEPS_CEILING = exports.shouldEnforcePlan = exports.REACT_COORDINATOR_PROMPT = void 0;
4
4
  exports.buildSystemPrompt = buildSystemPrompt;
5
5
  const ai_1 = require("ai");
6
6
  const index_js_1 = require("./providers/index.js");
@@ -14,10 +14,34 @@ const context_js_1 = require("./context.js");
14
14
  const routines_js_1 = require("./routines.js");
15
15
  const specialists_js_1 = require("./specialists.js");
16
16
  const specialist_run_js_1 = require("./tools/specialist-run.js");
17
+ const tool_wrapper_run_js_1 = require("./tools/tool-wrapper-run.js");
18
+ const correction_candidates_js_1 = require("./correction-candidates.js");
17
19
  const specialist_matcher_js_1 = require("./specialist-matcher.js");
18
20
  const memory_context_js_1 = require("./memory-context.js");
19
21
  const rag_query_js_1 = require("./rag-query.js");
20
22
  const datetime_js_1 = require("./tools/datetime.js");
23
+ const tool_profiles_js_1 = require("./tool-profiles.js");
24
+ const augment_js_1 = require("./tools/augment.js");
25
+ const image_js_1 = require("./image.js");
26
+ const plan_store_js_1 = require("./plan-store.js");
27
+ const reference_resolver_js_1 = require("./reference-resolver.js");
28
+ const plan_js_1 = require("./tools/plan.js");
29
+ const think_js_1 = require("./tools/think.js");
30
+ const ask_user_js_1 = require("./tools/ask-user.js");
31
+ const evaluate_js_1 = require("./tools/evaluate.js");
32
+ const wrap_with_specialist_js_1 = require("./tools/wrap-with-specialist.js");
33
+ const tool_call_repair_js_1 = require("./tool-call-repair.js");
34
+ /**
35
+ * Directs the model to publish brief reasoning via the `think` tool so the
36
+ * user can follow along. Injected only for model families where narrating
37
+ * intent does not conflict with the family's `systemSuffix` guidance
38
+ * (reasoning families like o-series and grok reasoning tell the model NOT
39
+ * to narrate chain-of-thought, so we skip this block for them).
40
+ */
41
+ const SHARE_REASONING_PROMPT = `## Share your reasoning
42
+ Call the \`think\` tool to publish 1-3 sentences of your reasoning whenever you're about to do something non-trivial: deciding between approaches, interpreting an unexpected result, or committing to a multi-step plan. The user sees these thoughts — they're how they follow along. Don't narrate every mechanical step; do think out loud at decision points, before tool-call batches, and when you catch yourself course-correcting.`;
43
+ /** Model families whose `systemSuffix` explicitly forbids chain-of-thought narration. */
44
+ const REASONING_FAMILIES = new Set(['openai-reasoning', 'xai-grok-reasoning']);
21
45
  const BASE_SYSTEM_PROMPT = `# Identity
22
46
 
23
47
  You are Bernard, a local CLI AI agent with direct shell access, persistent memory, and a suite of tools for system tasks, web reading, and scheduling.
@@ -37,7 +61,7 @@ You exist only while processing a user message. Each response is a single turn:
37
61
  ## Decision Rules
38
62
  - Use tools when the task requires system interaction (files, git, processes, network). Answer from knowledge when no tool is needed.
39
63
  - If a command fails, read the error message carefully, explain the cause, and try an alternative approach. Never retry the exact same command that just failed.
40
- - When uncertain about intent, ask a clarifying question rather than guessing.
64
+ - When uncertain about intent, call the \`ask_user\` tool to ask a clarifying question rather than guessing. Do NOT write the question as prose — prose gets no answer back and, in coordinator mode, will trigger plan enforcement and abort the turn.
41
65
  - If a request is ambiguous or risky, state your assumptions before acting.
42
66
 
43
67
  ## Planning
@@ -48,6 +72,12 @@ Before executing any task that requires more than two tool calls:
48
72
 
49
73
  This makes your reasoning visible and reduces errors on multi-step tasks. For simple tasks (1-2 tool calls), skip the plan and act directly.
50
74
 
75
+ ## Temporary Scripts
76
+ For complex multi-step shell work, JSON parsing pipelines, retry loops, or anything you expect to iterate on, prefer writing a short throwaway script to a temp path (e.g. \`/tmp/bernard-<task>.sh\`, \`/tmp/bernard-<task>.py\`, \`/tmp/bernard-<task>.mjs\`) and running it instead of cramming logic into a single inline shell command. Use \`file_write\` to author the script, then \`shell\` to execute it. Edit and re-run with \`file_edit_lines\` when you need to adjust. Clean up temp files when the task is finished.
77
+
78
+ ## Tool-Call Argument Size
79
+ Never embed file content, scripts, JSON bodies, or any other payload larger than ~500 bytes inside a \`shell\` command (no heredocs like \`cat > file <<EOF\`, no \`printf\`/\`echo\` of long literals, no inline JSON over a few lines). Large single-string tool arguments can be truncated mid-response, producing JSON-parse failures that abort the turn. The correct pattern is always: write the payload to a file with \`file_write\`, then reference that file from \`shell\`.
80
+
51
81
  ## Tool Execution Integrity
52
82
  - NEVER simulate, fabricate, or narrate tool execution. If a task requires running a command, you MUST call the shell tool — do not write prose describing what a command "would return" or pretend you already ran it.
53
83
  - Your text output can only describe results you actually received from a tool call in this conversation. If you have not called a tool, you have no results to report.
@@ -73,6 +103,7 @@ Tool schemas describe each tool's parameters and purpose. Behavioral notes:
73
103
  - **specialist_run** — Invoke a saved specialist to handle a task using its custom persona. The specialist runs as an independent sub-agent with its own system prompt and guidelines. Use when a task matches an existing specialist's domain.
74
104
  - **mcp_config / mcp_add_url** — Manage MCP server connections. Changes require a restart.
75
105
  - **datetime / time_range / time_range_total** — Time and duration utilities.
106
+ - **ask_user** — Ask the user one or more clarifying questions and wait for their answers. Provide each as an entry in \`questions\`; supply \`choices\` per question when the answer is constrained, otherwise the user gets a free-form prompt. Batch related questions in one call (e.g. title + body + labels) — the user sees a tab strip showing progress. Always prefer this over writing the question in prose.
76
107
 
77
108
  ## Context Awareness
78
109
  - Your context may include **Recalled Context** (auto-retrieved past observations), **Persistent Memory**, and **Scratch Notes**.
@@ -80,6 +111,31 @@ Tool schemas describe each tool's parameters and purpose. Behavioral notes:
80
111
  - Persistent Memory is user-curated and more authoritative than recalled context, but still defer to the user's current instructions when they conflict.
81
112
  - When context is compressed, older conversation is replaced with a summary. Scratch notes and memory persist through compression.
82
113
 
114
+ ## Context Gathering
115
+ Before synthesizing any answer that references prior state, an ongoing exchange, or a named topic, gather the full context rather than reasoning from a single observation:
116
+
117
+ - **Follow the thread.** When a tool result is part of an ongoing exchange (email reply, PR/issue comment, chat follow-up), fetch the preceding item in the same thread before summarizing. For email, pull the thread/parent via the thread ID. For GitHub, read the PR or issue body, not just the latest comment. Do not summarize a reply in isolation.
118
+ - **Search memory and recalled context before committing to a summary.** If the user names an entity or topic ("the Tesla wrap", "the CRM PR", "my morning triage"), use the \`memory\` tool (\`list\` to see stored keys, \`read\` for relevant ones) and re-read the injected Recalled Context for that phrase before drafting the final answer, not after.
119
+ - **Flag implicit numbers, counts, prices, and dates.** If your synthesis involves arithmetic or totals and a factor was *inferred* rather than read, either retrieve it (thread or memory) or ask. Never silently multiply against an assumed count.
120
+ - **Ask when uncertainty remains.** After gathering, if the answer still hinges on an unconfirmed factor, call the \`ask_user\` tool with one focused question (use \`choices\` when the answer is constrained). Do not write the question as prose, and do not guess and ship.
121
+ - **Show the work when it matters.** For summaries that include numbers or derived claims, cite the source inline — e.g., "vendor quoted $45/seat × 12 seats (from original RFP) = $540". If a factor is unknown, say so: "vendor quoted $45/seat — please confirm the seat count".
122
+
123
+ ### Examples
124
+ Each pair is a task → wrong one-shot answer → right gathered answer.
125
+
126
+ - **PR comment triage.** "Summarize the latest comment on PR #42."
127
+ - ❌ Run \`gh pr view 42 --comments\`, summarize the last comment in isolation.
128
+ - ✅ Run \`gh pr view 42\` (body + status) first, then \`gh pr view 42 --comments\`, and frame the comment against what the PR actually does.
129
+ - **Fixing an ongoing bug.** "Fix the bug in \`src/auth.ts\`."
130
+ - ❌ Read \`src/auth.ts\`, guess, edit.
131
+ - ✅ \`git log -5 src/auth.ts\` and \`git diff HEAD~1 -- src/auth.ts\` for recent intent, search memory for "auth" notes, read the file, *then* edit.
132
+ - **Recurring task.** "Run my morning triage."
133
+ - ❌ Invent a triage sequence on the spot.
134
+ - ✅ Check for a saved routine (\`/morning-triage\`), read \`memory\` and \`scratch\` for prior triage notes, only then proceed or ask.
135
+ - **Time-windowed count.** "How many commits this week?"
136
+ - ❌ \`git log --since=7.days.ago | wc -l\` and report a number.
137
+ - ✅ Clarify the window ("since Monday" vs. "last 7 days") and/or branch/author scope; cite the exact \`--since\`/\`--author\` flags in the summary.
138
+
83
139
  # Safety
84
140
 
85
141
  ## Destructive Actions
@@ -120,7 +176,7 @@ Good: "Run \`curl -s http://localhost:3000/health\` and report: (a) HTTP status
120
176
 
121
177
  Do NOT use sub-agents for tasks that are sequential or depend on each other's results — handle those yourself step by step. Also avoid sub-agents for trivially quick single operations where the overhead isn't worth it.
122
178
 
123
- **agent vs. task** — Use \`agent\` for open-ended work where you need a narrative report. Use \`task\` when you need a discrete, machine-readable JSON result — tasks are truly single-step/atomic (1 LLM call + tools), return Zod-validated structured JSON, and are ideal for routine chaining where you need to branch on success/error. Both share the same concurrency pool.`;
179
+ **agent vs. task** — Use \`agent\` for open-ended work where you need a narrative report. Use \`task\` when you need a discrete, machine-readable JSON result — tasks are truly single-step/atomic (1 LLM call + tools), return Zod-validated structured JSON, and are ideal for routine chaining where you need to branch on success/error. Tasks are the preferred delegation mechanism when you need a discrete, verifiable result. Both share the same concurrency pool.`;
124
180
  const CRITIC_MODE_PROMPT = `## Reliability Mode (Active)
125
181
 
126
182
  You are operating with enhanced reliability. Follow these additional rules:
@@ -143,6 +199,18 @@ In addition to stating your plan in text, persist it to scratch for reliability:
143
199
  ### Verification
144
200
  - After any mutation (file write, git commit, API call), immediately verify the outcome with a read-only command.
145
201
  - Your work will be reviewed by a critic agent afterward. Only claim what you can prove with tool output.`;
202
+ // ReAct primitives live in ./react.js so tools/* can use them without forming
203
+ // a circular import via agent.ts. Re-exported here because agent.test.ts and
204
+ // other callers import them from './agent.js'.
205
+ var react_js_1 = require("./react.js");
206
+ Object.defineProperty(exports, "REACT_COORDINATOR_PROMPT", { enumerable: true, get: function () { return react_js_1.REACT_COORDINATOR_PROMPT; } });
207
+ Object.defineProperty(exports, "shouldEnforcePlan", { enumerable: true, get: function () { return react_js_1.shouldEnforcePlan; } });
208
+ Object.defineProperty(exports, "REACT_MAX_STEPS_CEILING", { enumerable: true, get: function () { return react_js_1.REACT_MAX_STEPS_CEILING; } });
209
+ Object.defineProperty(exports, "computeEffectiveMaxSteps", { enumerable: true, get: function () { return react_js_1.computeEffectiveMaxSteps; } });
210
+ Object.defineProperty(exports, "REACT_ENFORCEMENT_MAX_RETRIES", { enumerable: true, get: function () { return react_js_1.REACT_ENFORCEMENT_MAX_RETRIES; } });
211
+ Object.defineProperty(exports, "REACT_AUTO_CANCEL_NOTE", { enumerable: true, get: function () { return react_js_1.REACT_AUTO_CANCEL_NOTE; } });
212
+ Object.defineProperty(exports, "buildEnforcementFeedback", { enumerable: true, get: function () { return react_js_1.buildEnforcementFeedback; } });
213
+ const react_js_2 = require("./react.js");
146
214
  /**
147
215
  * Assembles the full system prompt including base instructions, memory context, and MCP status.
148
216
  * @internal Exported for testing only.
@@ -154,13 +222,19 @@ In addition to stating your plan in text, persist it to scratch for reliability:
154
222
  * @param specialistSummaries - Specialist summaries to list in the prompt
155
223
  * @param specialistMatches - Pre-computed specialist match results for the current input
156
224
  */
157
- function buildSystemPrompt(config, memoryStore, mcpServerNames, ragResults, routineSummaries, specialistSummaries, specialistMatches) {
225
+ function buildSystemPrompt(config, memoryStore, mcpServerNames, ragResults, routineSummaries, specialistSummaries, specialistMatches, resolvedReferences) {
158
226
  let prompt = BASE_SYSTEM_PROMPT + `\n\nCurrent date and time: ${(0, datetime_js_1.formatCurrentDateTime)()}.`;
159
227
  prompt += `\nYou are running as provider: ${config.provider}, model: ${config.model}. The user can switch with /provider and /model.`;
160
228
  if (config.criticMode) {
161
229
  prompt += '\n\n' + CRITIC_MODE_PROMPT;
162
230
  }
231
+ if (config.reactMode) {
232
+ prompt += '\n\n' + react_js_2.REACT_COORDINATOR_PROMPT;
233
+ }
163
234
  prompt += (0, memory_context_js_1.buildMemoryContext)({ memoryStore, ragResults, includeScratch: true });
235
+ if (resolvedReferences && resolvedReferences.length > 0) {
236
+ prompt += '\n\n' + (0, reference_resolver_js_1.renderResolvedBlock)(resolvedReferences);
237
+ }
164
238
  prompt += `\n\n## MCP Servers
165
239
 
166
240
  MCP (Model Context Protocol) servers provide additional tools. Use the mcp_config tool to manage stdio-based MCP servers (command + args). Use the mcp_add_url tool to add URL-based MCP servers (SSE/HTTP endpoints) — just give it a name and URL. Changes take effect after restarting Bernard.`;
@@ -194,17 +268,22 @@ MCP (Model Context Protocol) servers provide additional tools. Use the mcp_confi
194
268
  }
195
269
  prompt += '\n\n## Specialists';
196
270
  if (specialistSummaries && specialistSummaries.length > 0) {
197
- prompt += '\n\nAvailable specialist agents you can delegate to via specialist_run:\n';
271
+ prompt += '\n\nAvailable specialist agents:\n';
198
272
  prompt += specialistSummaries
199
273
  .map((s) => {
200
274
  const modelTag = s.provider || s.model ? ` [${s.provider ?? 'default'}/${s.model ?? 'default'}]` : '';
201
- return `- ${s.id} ${s.name}: ${s.description}${modelTag}`;
275
+ const kindTag = s.kind && s.kind !== 'persona' ? ` [${s.kind}]` : '';
276
+ return `- ${s.id} — ${s.name}: ${s.description}${kindTag}${modelTag}`;
202
277
  })
203
278
  .join('\n');
204
279
  prompt +=
205
280
  "\n\nWhen a user request clearly falls within a saved specialist's domain, delegate to it via specialist_run without asking for permission. If the match is partial or ambiguous, briefly confirm with the user before dispatching.";
206
281
  prompt +=
207
- '\n\nYou can pass optional `provider` and `model` parameters to specialist_run, agent, and task tools to override the model used for that execution. Specialists with a model override configured will automatically use their specified model.';
282
+ '\n\nFor specialists tagged [tool-wrapper] or [meta], use `tool_wrapper_run` instead of `specialist_run`. They return strict JSON {status, result, error?, reasoning?} and expose a scoped tool set with domain-specific examples. Prefer them for tool-heavy operations (shell, file edits, web research) where safe examples and error handling reduce misuse.';
283
+ prompt +=
284
+ '\n\nIf the user asks for help with a tool or CLI for which no tool-wrapper specialist exists, dispatch `tool_wrapper_run` with `specialistId: "specialist-creator"` and a description of the target tool. It will research (man/--help/web) and create a validated wrapper for future use. If the user asks you to "create a specialist for X", use specialist-creator.';
285
+ prompt +=
286
+ '\n\nYou can pass optional `provider` and `model` parameters to specialist_run, tool_wrapper_run, agent, and task tools to override the model used for that execution. Specialists with a model override configured will automatically use their specified model.';
208
287
  if (specialistMatches && specialistMatches.length > 0) {
209
288
  prompt +=
210
289
  '\n\n### Specialist Match Advisory (current message)\nThe following specialists may match this request:\n';
@@ -246,9 +325,12 @@ class Agent {
246
325
  routineStore;
247
326
  specialistStore;
248
327
  candidateStore;
328
+ correctionStore;
329
+ toolProfileStore;
249
330
  stepLimitHitCount = 0;
250
331
  lastStepLimitHit = false;
251
- constructor(config, toolOptions, memoryStore, mcpTools, mcpServerNames, alertContext, initialHistory, ragStore, routineStore, specialistStore, candidateStore) {
332
+ planStore = new plan_store_js_1.PlanStore();
333
+ constructor(config, toolOptions, memoryStore, mcpTools, mcpServerNames, alertContext, initialHistory, ragStore, routineStore, specialistStore, candidateStore, correctionStore) {
252
334
  this.config = config;
253
335
  this.toolOptions = toolOptions;
254
336
  this.memoryStore = memoryStore;
@@ -259,6 +341,8 @@ class Agent {
259
341
  this.routineStore = routineStore ?? new routines_js_1.RoutineStore();
260
342
  this.specialistStore = specialistStore ?? new specialists_js_1.SpecialistStore();
261
343
  this.candidateStore = candidateStore;
344
+ this.correctionStore = correctionStore ?? new correction_candidates_js_1.CorrectionCandidateStore();
345
+ this.toolProfileStore = new tool_profiles_js_1.ToolProfileStore();
262
346
  if (initialHistory) {
263
347
  this.history = [...initialHistory];
264
348
  this.lastPromptTokens = Math.ceil(JSON.stringify(initialHistory).length / 4);
@@ -268,6 +352,14 @@ class Agent {
268
352
  getHistory() {
269
353
  return this.history;
270
354
  }
355
+ /** Returns the store that queues tool-wrapper correction candidates for this session. */
356
+ getCorrectionStore() {
357
+ return this.correctionStore;
358
+ }
359
+ /** Returns the specialist store used by this agent. */
360
+ getSpecialistStore() {
361
+ return this.specialistStore;
362
+ }
271
363
  /** Returns the RAG search results from the most recent `processInput` call. */
272
364
  getLastRAGResults() {
273
365
  return this.lastRAGResults;
@@ -298,16 +390,35 @@ class Agent {
298
390
  * @param userInput - The raw text from the user's REPL input
299
391
  * @throws Error wrapping the underlying API error if generation fails for non-abort, non-overflow reasons
300
392
  */
301
- async processInput(userInput) {
393
+ async processInput(userInput, images, resolvedReferences) {
302
394
  this.lastStepLimitHit = false;
303
- const timestamped = (0, datetime_js_1.timestampUserMessage)(userInput);
304
- this.history.push({ role: 'user', content: timestamped });
395
+ this.planStore.clear();
396
+ (0, output_js_1.clearPinnedRegion)('plan');
397
+ const profile = (0, index_js_1.getModelProfile)(this.config.provider, this.config.model, this.config.customProviders?.[this.config.provider]?.sdk);
398
+ // Wrap is outermost so `<user_request>` / `# Request` opens the text at position 0;
399
+ // the timestamp prefix lives inside the wrapper.
400
+ const wrappedInput = profile.wrapUserMessage((0, datetime_js_1.timestampUserMessage)(userInput));
401
+ if (images && images.length > 0) {
402
+ const contentParts = [
403
+ { type: 'text', text: wrappedInput },
404
+ ...images.map((img) => ({
405
+ type: 'image',
406
+ image: img.data,
407
+ mimeType: img.mimeType,
408
+ })),
409
+ ];
410
+ this.history.push({ role: 'user', content: contentParts });
411
+ }
412
+ else {
413
+ this.history.push({ role: 'user', content: wrappedInput });
414
+ }
305
415
  this.abortController = new AbortController();
306
416
  this.lastStepPromptTokens = 0;
307
417
  this.lastRAGResults = [];
308
418
  try {
309
419
  // Check if context compression is needed
310
- const newMessageEstimate = Math.ceil(timestamped.length / 4);
420
+ const imageTokens = images ? images.length * image_js_1.IMAGE_TOKEN_ESTIMATE : 0;
421
+ const newMessageEstimate = Math.ceil(wrappedInput.length / 4) + imageTokens;
311
422
  if ((0, context_js_1.shouldCompress)(this.lastPromptTokens, newMessageEstimate, this.config.model, this.config.tokenWindow)) {
312
423
  (0, output_js_1.printInfo)('Compressing conversation context...');
313
424
  this.history = await (0, context_js_1.compressHistory)(this.history, this.config, this.ragStore);
@@ -341,10 +452,25 @@ class Agent {
341
452
  const routineSummaries = this.routineStore.getSummaries();
342
453
  const specialistSummaries = this.specialistStore.getSummaries();
343
454
  const specialistMatches = (0, specialist_matcher_js_1.matchSpecialists)(userInput, specialistSummaries);
344
- let systemPrompt = buildSystemPrompt(this.config, this.memoryStore, this.mcpServerNames, ragResults, routineSummaries, specialistSummaries, specialistMatches);
455
+ let systemPrompt = buildSystemPrompt(this.config, this.memoryStore, this.mcpServerNames, ragResults, routineSummaries, specialistSummaries, specialistMatches, resolvedReferences);
345
456
  if (this.alertContext) {
346
457
  systemPrompt += '\n\n' + this.alertContext;
347
458
  }
459
+ // Model-specific advisory block (XML usage notes for Claude, strip-CoT for reasoning, etc.)
460
+ if (profile.systemSuffix) {
461
+ systemPrompt += '\n\n' + profile.systemSuffix;
462
+ }
463
+ // Encourage brief `think`-tool reasoning for families that welcome narration.
464
+ // Skip for reasoning families — their systemSuffix tells the model NOT to
465
+ // narrate chain-of-thought, and contradicting it confuses the model.
466
+ if (!REASONING_FAMILIES.has(profile.family)) {
467
+ systemPrompt += '\n\n' + SHARE_REASONING_PROMPT;
468
+ }
469
+ // Inject tool usage profiles (guidelines + observed bad examples)
470
+ const profilesBlock = (0, tool_profiles_js_1.buildToolProfilesPrompt)(this.toolProfileStore);
471
+ if (profilesBlock) {
472
+ systemPrompt += '\n\n' + profilesBlock;
473
+ }
348
474
  // Pre-flight token guard: emergency truncate if estimated tokens exceed 90% of context window
349
475
  const HARD_LIMIT_RATIO = 0.9;
350
476
  const contextWindow = (0, context_js_1.getContextWindow)(this.config.model, this.config.tokenWindow);
@@ -362,15 +488,50 @@ class Agent {
362
488
  agent: (0, subagent_js_1.createSubAgentTool)(this.config, this.toolOptions, this.memoryStore, this.mcpTools, this.ragStore),
363
489
  task: (0, task_js_1.createTaskTool)(this.config, this.toolOptions, this.memoryStore, this.mcpTools, this.ragStore, this.routineStore),
364
490
  specialist_run: (0, specialist_run_js_1.createSpecialistRunTool)(this.config, this.toolOptions, this.memoryStore, this.specialistStore, this.mcpTools, this.ragStore),
491
+ tool_wrapper_run: (0, tool_wrapper_run_js_1.createToolWrapperRunTool)(this.config, this.toolOptions, this.memoryStore, this.specialistStore, this.correctionStore, this.mcpTools, this.ragStore, this.routineStore, this.candidateStore),
492
+ think: (0, think_js_1.createThinkTool)(),
493
+ ask_user: (0, ask_user_js_1.createAskUserTool)(this.toolOptions.askUser),
494
+ ...(this.config.reactMode
495
+ ? {
496
+ plan: (0, plan_js_1.createPlanTool)(this.planStore),
497
+ evaluate: (0, evaluate_js_1.createEvaluateTool)(),
498
+ }
499
+ : {}),
365
500
  };
501
+ // Route low-level tool calls (shell, web_read, file_*) through their
502
+ // wrapper specialists transparently, then wrap every tool's execute to
503
+ // observe errors and record profiles. Shim routing happens only at the
504
+ // main-agent level — sub-agents and specialists keep raw tools.
505
+ const shimmedTools = (0, wrap_with_specialist_js_1.applyShimRouting)(tools, {
506
+ config: this.config,
507
+ options: this.toolOptions,
508
+ memoryStore: this.memoryStore,
509
+ specialistStore: this.specialistStore,
510
+ correctionStore: this.correctionStore,
511
+ mcpTools: this.mcpTools,
512
+ ragStore: this.ragStore,
513
+ routineStore: this.routineStore,
514
+ candidateStore: this.candidateStore,
515
+ });
516
+ const augmentedTools = (0, augment_js_1.augmentTools)(shimmedTools, this.toolProfileStore);
517
+ // Coordinator (ReAct) mode triples the step budget for the main agent,
518
+ // clamped to REACT_MAX_STEPS_CEILING to bound worst-case cost.
519
+ // Subagents are unaffected — they keep their own step budgets.
520
+ const effectiveMaxSteps = (0, react_js_2.computeEffectiveMaxSteps)(this.config.maxSteps, this.config.reactMode);
366
521
  const callGenerateText = (messages) => (0, ai_1.generateText)({
367
- model: (0, index_js_1.getModel)(this.config.provider, this.config.model),
368
- tools,
369
- maxSteps: this.config.maxSteps,
522
+ model: (0, index_js_1.getModelForConfig)(this.config, this.config.provider, this.config.model),
523
+ providerOptions: (0, index_js_1.getProviderOptionsForConfig)(this.config, this.config.provider),
524
+ tools: augmentedTools,
525
+ maxSteps: effectiveMaxSteps,
370
526
  maxTokens: this.config.maxTokens,
371
527
  system: systemPrompt,
372
528
  messages: messages ?? this.history,
373
529
  abortSignal: this.abortController.signal,
530
+ experimental_repairToolCall: (0, tool_call_repair_js_1.makeRepairHook)({
531
+ config: this.config,
532
+ label: 'main',
533
+ abortSignal: this.abortController.signal,
534
+ }),
374
535
  onStepFinish: ({ text, toolCalls, toolResults, usage }) => {
375
536
  if (usage) {
376
537
  this.lastStepPromptTokens = usage.promptTokens;
@@ -381,11 +542,9 @@ class Agent {
381
542
  }
382
543
  }
383
544
  for (const tc of toolCalls) {
384
- (0, logger_js_1.debugLog)(`onStepFinish:toolCall:${tc.toolName}`, tc.args);
385
545
  (0, output_js_1.printToolCall)(tc.toolName, tc.args);
386
546
  }
387
547
  for (const tr of toolResults) {
388
- (0, logger_js_1.debugLog)(`onStepFinish:toolResult:${tr.toolName}`, tr.result);
389
548
  (0, output_js_1.printToolResult)(tr.toolName, tr.result);
390
549
  }
391
550
  if (text) {
@@ -397,6 +556,21 @@ class Agent {
397
556
  }
398
557
  },
399
558
  });
559
+ // Shared retry path for critic and ReAct enforcement loops: truncate the
560
+ // last tool results, push them + a feedback message into history, and
561
+ // re-invoke the model. Returns null when the retry itself errors.
562
+ const pushAndRetry = async (previousResult, feedback, debugTag) => {
563
+ try {
564
+ const truncatedResultMessages = (0, context_js_1.truncateToolResults)(previousResult.response.messages);
565
+ this.history.push(...truncatedResultMessages);
566
+ this.history.push({ role: 'user', content: feedback });
567
+ return await callGenerateText();
568
+ }
569
+ catch (retryErr) {
570
+ (0, logger_js_1.debugLog)(debugTag, retryErr instanceof Error ? retryErr.message : String(retryErr));
571
+ return null;
572
+ }
573
+ };
400
574
  let result;
401
575
  try {
402
576
  result = await callGenerateText();
@@ -453,12 +627,12 @@ class Agent {
453
627
  }
454
628
  }
455
629
  // Detect maxSteps exhaustion
456
- if (result.finishReason === 'tool-calls' && result.steps.length >= this.config.maxSteps) {
630
+ if (result.finishReason === 'tool-calls' && result.steps.length >= effectiveMaxSteps) {
457
631
  this.lastStepLimitHit = true;
458
632
  this.stepLimitHitCount++;
459
633
  const msg = this.stepLimitHitCount >= 2
460
- ? `Stopped at loop limit of ${this.config.maxSteps}. Use /options max-steps to adjust permanently.`
461
- : `Stopped at loop limit of ${this.config.maxSteps}.`;
634
+ ? `Stopped at loop limit of ${effectiveMaxSteps}. Use /options max-steps to adjust permanently.`
635
+ : `Stopped at loop limit of ${effectiveMaxSteps}.`;
462
636
  (0, output_js_1.printWarning)(msg);
463
637
  }
464
638
  // Run critic verification if enabled and tool calls were made
@@ -485,27 +659,42 @@ class Agent {
485
659
  }
486
660
  retryCount++;
487
661
  (0, output_js_1.printCriticRetry)(retryCount, critic_js_1.CRITIC_MAX_RETRIES);
488
- // Push current attempt's messages + critic feedback into history before retrying
489
- try {
490
- const truncatedResultMessages = (0, context_js_1.truncateToolResults)(result.response.messages);
491
- this.history.push(...truncatedResultMessages);
492
- this.history.push({
493
- role: 'user',
494
- content: `The critic agent reviewed your work and found issues:\n\nVERDICT: ${criticResult.verdict}\n${criticResult.explanation}\n\nPlease address these issues and try again.`,
495
- });
496
- result = await callGenerateText();
497
- toolLog = (0, critic_js_1.extractToolCallLog)(result.steps);
498
- // If no tool calls in retry, nothing more to verify
499
- if (toolLog.length === 0)
500
- break;
501
- }
502
- catch (retryErr) {
503
- (0, logger_js_1.debugLog)('agent:critic:retry-error', retryErr instanceof Error ? retryErr.message : String(retryErr));
662
+ const retryResult = await pushAndRetry(result, `The critic agent reviewed your work and found issues:\n\nVERDICT: ${criticResult.verdict}\n${criticResult.explanation}\n\nPlease address these issues and try again.`, 'agent:critic:retry-error');
663
+ if (!retryResult)
664
+ break;
665
+ result = retryResult;
666
+ toolLog = (0, critic_js_1.extractToolCallLog)(result.steps);
667
+ // If no tool calls in retry, nothing more to verify
668
+ if (toolLog.length === 0)
504
669
  break;
505
- }
506
670
  }
507
671
  }
508
672
  }
673
+ // Coordinator (ReAct) plan enforcement — re-prompt when steps are still
674
+ // pending/in_progress. Bounded retries mirror the critic loop.
675
+ if ((0, react_js_2.shouldEnforcePlan)({
676
+ reactMode: this.config.reactMode,
677
+ aborted: this.abortController?.signal.aborted === true,
678
+ stepLimitHit: this.lastStepLimitHit,
679
+ hasSteps: this.planStore.unresolvedCount() > 0,
680
+ })) {
681
+ let enforcementAttempts = 0;
682
+ while (!this.planStore.isComplete() &&
683
+ enforcementAttempts < react_js_2.REACT_ENFORCEMENT_MAX_RETRIES) {
684
+ if (this.abortController?.signal.aborted)
685
+ break;
686
+ enforcementAttempts++;
687
+ (0, output_js_1.printWarning)(`Plan has ${this.planStore.unresolvedCount()} unresolved step(s). Prompting to resolve... (${enforcementAttempts}/${react_js_2.REACT_ENFORCEMENT_MAX_RETRIES})`);
688
+ const retryResult = await pushAndRetry(result, (0, react_js_2.buildEnforcementFeedback)(this.planStore.render()), 'agent:react:enforcement-error');
689
+ if (!retryResult)
690
+ break;
691
+ result = retryResult;
692
+ }
693
+ if (!this.planStore.isComplete()) {
694
+ this.planStore.cancelAllUnresolved(react_js_2.REACT_AUTO_CANCEL_NOTE);
695
+ (0, output_js_1.printInfo)('Auto-cancelled unresolved plan steps after enforcement retries.');
696
+ }
697
+ }
509
698
  // Track token usage for compression decisions — use last step's prompt tokens
510
699
  // (result.usage.promptTokens is the aggregate across ALL steps, not the last step)
511
700
  this.lastPromptTokens = this.lastStepPromptTokens ?? result.usage?.promptTokens ?? 0;
@@ -523,6 +712,7 @@ class Agent {
523
712
  finally {
524
713
  this.abortController = null;
525
714
  this.spinnerStats = null;
715
+ (0, output_js_1.clearPinnedRegion)('plan');
526
716
  }
527
717
  }
528
718
  /** Compresses conversation history in-place, returning token usage stats. */
package/dist/agent.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;AAsLA,8CAmFC;AAzQD,2BAAoD;AACpD,mDAAgD;AAChD,+CAAiE;AACjE,qDAAyD;AACzD,6CAAiD;AACjD,2CAUqB;AACrB,2CAAuC;AACvC,2CAAgF;AAChF,6CAQsB;AAItB,+CAAkE;AAClE,qDAA2E;AAE3E,iEAAoE;AACpE,mEAAiF;AACjF,2DAAyD;AACzD,iDAKwB;AACxB,qDAAkF;AAEl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AC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAA,6BAAiB,EAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,6EAA6E;IAC7E,KAAK,CAAC,cAAc;QAClB,MAAM,YAAY,GAAG,IAAA,kCAAqB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,MAAM,UAAU,GAAG,MAAM,IAAA,4BAAe,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnF,MAAM,SAAS,GAAG,UAAU,KAAK,IAAI,CAAC,OAAO,CAAC;QAC9C,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;YAC1B,IAAI,CAAC,gBAAgB,GAAG,IAAA,kCAAqB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,CAAC;QACD,MAAM,WAAW,GAAG,IAAA,kCAAqB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;IAClD,CAAC;IAED,8FAA8F;IAC9F,YAAY;QACV,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;QAChC,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;CACF;AAzkBD,sBAykBC"}
@@ -0,0 +1,32 @@
1
+ {
2
+ "id": "correction-agent",
3
+ "name": "Correction Agent",
4
+ "description": "Meta specialist that reviews failed tool-wrapper invocations, proposes a validated fix, and — only when the fix actually executes successfully — appends good/bad examples to the target specialist.",
5
+ "kind": "meta",
6
+ "targetTools": ["specialist", "tool_wrapper_run"],
7
+ "structuredOutput": true,
8
+ "systemPrompt": "You are the correction agent. You receive a record of a failed tool-wrapper invocation and your job is to teach the target specialist how to do it correctly — WITHOUT introducing hallucinated patterns.\n\nWorkflow (STRICT — do not skip steps):\n1. Read the candidate: target specialist ID, original request, attempted call, error.\n2. Use the `specialist` tool with `action: \"read\"` to inspect the target specialist's current system prompt, good examples, and bad examples. Understand what it was trying to do.\n3. Formulate a `proposedGood` tool call — a corrected version of the attempted call that should actually work for the original request.\n4. **VALIDATE** by invoking `tool_wrapper_run` on the target specialist with the original input. If the returned JSON has `status: \"ok\"`, the fix is valid. If `status: \"error\"`, your proposed fix failed — revise and try at most one more time. Two validation failures → abandon with `applied: false, validated: false`.\n5. Only after successful validation, call `specialist` with `action: \"update\"` and append the new good/bad pair to the target specialist's `goodExamples`/`badExamples`. Include all EXISTING examples plus your new one (read the specialist first to get the current lists).\n6. Return a JSON object: `{validated: boolean, applied: boolean, notes: string}`.\n\nHard rules:\n- NEVER update a specialist with a proposed good example you haven't actually executed and confirmed returned `status: \"ok\"`.\n- NEVER drop existing good/bad examples unless there are already 10+ and you're making room per the store's cap.\n- If the original request is ambiguous or the error is environmental (network down, missing file), mark `applied: false, validated: false` with a note — don't guess a fix.\n- Reasoning log the validation attempt in your `reasoning` array so future audits can see what you ran.",
9
+ "guidelines": [
10
+ "Validate every proposed fix by actually running it via tool_wrapper_run.",
11
+ "Never commit an example you have not executed successfully.",
12
+ "Preserve existing examples when updating.",
13
+ "Bail out cleanly on ambiguous or environmental failures."
14
+ ],
15
+ "goodExamples": [
16
+ {
17
+ "input": "Candidate: shell-wrapper failed with 'rm: unset variable'. Attempted call: rm -rf $LOGDIR/*.log",
18
+ "call": "1) specialist read shell-wrapper → 2) tool_wrapper_run shell-wrapper with a safe variant using `${LOGDIR:?}` → 3) specialist update with the validated good/bad pair.",
19
+ "note": "Three-step validate-then-commit flow."
20
+ }
21
+ ],
22
+ "badExamples": [
23
+ {
24
+ "input": "Candidate: web-wrapper failed with a 403 when fetching example.com",
25
+ "call": "specialist update web-wrapper { badExamples: [...existing, new-bad] } without running tool_wrapper_run first.",
26
+ "error": "Committed a new example without validation — this is exactly the hallucination failure mode we're preventing.",
27
+ "fix": "Run tool_wrapper_run web-wrapper with the corrected approach; only commit if it returns status: \"ok\"."
28
+ }
29
+ ],
30
+ "createdAt": "2026-01-01T00:00:00.000Z",
31
+ "updatedAt": "2026-01-01T00:00:00.000Z"
32
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "id": "file-wrapper",
3
+ "name": "File Wrapper",
4
+ "description": "Tool-augmented file I/O specialist. Reads and edits files via line-numbered operations, preferring scoped ranges and atomic edits.",
5
+ "kind": "tool-wrapper",
6
+ "targetTools": ["file_read_lines", "file_edit_lines", "shell"],
7
+ "structuredOutput": true,
8
+ "systemPrompt": "You are a file I/O specialist. You receive a natural-language request about reading or modifying a file and must use the `file_read_lines` and `file_edit_lines` tools (falling back to `shell` only for operations those cannot express).\n\nCore rules:\n- Always read the target region with `file_read_lines` BEFORE any edit. Line numbers change after every edit — never assume pre-edit numbers still apply.\n- Prefer line-ranged reads over whole-file reads for files larger than ~200 lines. Use `offset` + `limit`.\n- For edits, use `file_edit_lines` with explicit operations (replace/insert/delete/append). Edits are atomic; if any sub-operation fails, the whole edit reverts.\n- Do not use `shell` with `sed -i` / `awk -i` / redirects for edits. Those are hard to audit and not atomic.\n- For bulk find-and-replace across many files, or binary manipulation, shell is acceptable — state why in your reasoning.\n- After mutating a file, read the modified region back and confirm the change took effect.\n\nReturn the JSON output format. In `result`, report what changed: file path, line ranges touched, and a 1-line summary. Put exact operations in `reasoning`.",
9
+ "guidelines": [
10
+ "Always read before editing; line numbers shift after edits.",
11
+ "Prefer scoped ranges for large files.",
12
+ "Shell-based file edits require justification in `reasoning`.",
13
+ "Verify every mutation by reading the affected range back."
14
+ ],
15
+ "goodExamples": [
16
+ {
17
+ "input": "show lines 40-80 of src/config.ts",
18
+ "call": "file_read_lines { path: \"src/config.ts\", offset: 40, limit: 41 }",
19
+ "note": "limit = end - start + 1."
20
+ },
21
+ {
22
+ "input": "rename `foo` to `bar` on line 123 of src/utils.ts",
23
+ "call": "file_edit_lines { path: \"src/utils.ts\", operations: [{ type: \"replace\", startLine: 123, endLine: 123, newContent: \"... bar ...\" }] } (after first reading line 123 to get exact current text).",
24
+ "note": "Read first, then replace with the full new line content."
25
+ }
26
+ ],
27
+ "badExamples": [
28
+ {
29
+ "input": "change the port in src/server.ts from 3000 to 4000",
30
+ "call": "shell { command: \"sed -i 's/3000/4000/' src/server.ts\" }",
31
+ "error": "sed -i replaces every occurrence of 3000, not just the port; also non-atomic on BSD sed (requires an extra '' arg on macOS).",
32
+ "fix": "Read the region with file_read_lines to find the exact line, then use file_edit_lines to replace just that line."
33
+ },
34
+ {
35
+ "input": "read all of src/big-file.ts (8000 lines)",
36
+ "call": "file_read_lines { path: \"src/big-file.ts\" }",
37
+ "error": "Wastes tokens and context on a full-file read when only a region is needed.",
38
+ "fix": "Ask the caller which symbol/range they need, or use shell `grep -n` to locate the target line first, then a scoped file_read_lines."
39
+ }
40
+ ],
41
+ "createdAt": "2026-01-01T00:00:00.000Z",
42
+ "updatedAt": "2026-01-01T00:00:00.000Z"
43
+ }