@ouro.bot/cli 0.1.0-alpha.1322 → 0.1.0-alpha.1324

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.
package/changelog.json CHANGED
@@ -1,6 +1,18 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1324",
6
+ "changes": [
7
+ "note, consult_notes, read_config and update_config have Ouro AX cards; their failures end with a code, and read_config states a low-risk profile."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1323",
12
+ "changes": [
13
+ "The evolution tools carry Ouro AX cards, and their argument, case and close errors carry a code the card explains."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.1322",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1322",
2
+ "runtimeVersion": "0.1.0-alpha.1324",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1322</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1324</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -39,6 +39,7 @@ const path = __importStar(require("path"));
39
39
  const runtime_1 = require("../nerves/runtime");
40
40
  const identity_1 = require("../heart/identity");
41
41
  const config_registry_1 = require("../heart/config-registry");
42
+ const tool_error_code_1 = require("./tool-error-code");
42
43
  exports.configToolDefinitions = [
43
44
  {
44
45
  tool: {
@@ -112,6 +113,10 @@ exports.configToolDefinitions = [
112
113
  (0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.read_config", message: `read_config returned ${result.length} entries`, meta: { count: result.length, topic: a.related_to ?? null } });
113
114
  return JSON.stringify({ entries: result }, null, 2);
114
115
  },
116
+ riskProfile: { mutates: "none", risk: "low" },
117
+ ax: { id: "tool:read_config", group: "turn-config", when: "Pick this to see your settings with current values, defaults and effects, optionally by topic, before you change one with update_config.", effect: "read", idempotent: true, errors: [
118
+ { code: "invalid-arguments", means: "related_to isn't text.", fix: "Call read_config again with a topic word such as model or logging, or with no arguments." },
119
+ ] },
115
120
  },
116
121
  {
117
122
  tool: {
@@ -133,7 +138,7 @@ exports.configToolDefinitions = [
133
138
  const entry = (0, config_registry_1.getRegistryEntry)(a.path);
134
139
  if (!entry) {
135
140
  (0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.update_config_error", message: `unknown config path: ${a.path}`, meta: { path: a.path } });
136
- return `Error: unknown config path "${a.path}". Use read_config to see available paths.`;
141
+ return (0, tool_error_code_1.withCode)(`Error: unknown config path "${a.path}". Use read_config to see available paths.`, "unknown-config-path");
137
142
  }
138
143
  let parsedValue;
139
144
  try {
@@ -141,7 +146,7 @@ exports.configToolDefinitions = [
141
146
  }
142
147
  catch {
143
148
  (0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.update_config_error", message: `invalid JSON value for ${a.path}`, meta: { path: a.path, value: a.value } });
144
- return `Error: invalid JSON value. Provide value as valid JSON (e.g., 25, "debug", ["terminal"]).`;
149
+ return (0, tool_error_code_1.withCode)(`Error: invalid JSON value. Provide value as valid JSON (e.g., 25, "debug", ["terminal"]).`, "invalid-json");
145
150
  }
146
151
  // Validate value against registry entry's validator
147
152
  /* v8 ignore next -- all current entries have validators; guard kept for future entries without one @preserve */
@@ -149,13 +154,13 @@ exports.configToolDefinitions = [
149
154
  const validationError = entry.validate(parsedValue);
150
155
  if (validationError) {
151
156
  (0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.update_config_error", message: `validation failed for ${a.path}: ${validationError}`, meta: { path: a.path, value: a.value, validationError } });
152
- return `Error: validation failed for "${a.path}": ${validationError}`;
157
+ return (0, tool_error_code_1.withCode)(`Error: validation failed for "${a.path}": ${validationError}`, "invalid-config-value");
153
158
  }
154
159
  }
155
160
  // Managed: refuse
156
161
  if (entry.tier === "managed") {
157
162
  (0, runtime_1.emitNervesEvent)({ component: "repertoire", event: "repertoire.update_config_refused", message: `refused managed change to ${a.path}`, meta: { path: a.path, tier: "managed" } });
158
- return `This key is managed by the harness and cannot be modified directly.`;
163
+ return (0, tool_error_code_1.withCode)(`This key is managed by the harness and cannot be modified directly.`, "managed-key");
159
164
  }
160
165
  const agentRoot = (0, identity_1.getAgentRoot)();
161
166
  const configPath = path.join(agentRoot, "agent.json");
@@ -165,7 +170,7 @@ exports.configToolDefinitions = [
165
170
  }
166
171
  catch {
167
172
  /* v8 ignore next -- defensive: agent.json read failure in update_config @preserve */
168
- return `Error: failed to read agent.json at ${configPath}`;
173
+ return (0, tool_error_code_1.withCode)(`Error: failed to read agent.json at ${configPath}`, "config-unreadable");
169
174
  }
170
175
  // Apply change immediately
171
176
  const parts = entry.path.split(".");
@@ -182,5 +187,13 @@ exports.configToolDefinitions = [
182
187
  return `Success: "${a.path}" updated to ${JSON.stringify(parsedValue)}. Change applied immediately.`;
183
188
  },
184
189
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "writes agent.json" },
190
+ ax: { id: "tool:update_config", group: "turn-config", when: "Pick this to change one of your own settings in agent.json, taking effect at once; read_config lists the paths and allowed values.", effect: "write", idempotent: true, errors: [
191
+ { code: "unknown-config-path", means: "No setting has that dot path.", fix: "Call read_config and copy a path from its entries." },
192
+ { code: "invalid-json", means: "value isn't valid JSON; a string needs its own quotes.", fix: "Send value as JSON, such as 25, \"debug\" or [\"terminal\"]." },
193
+ { code: "invalid-config-value", means: "The value is valid JSON but not allowed for this setting; the message says why.", fix: "Check the setting's description and default in read_config, then send an allowed value." },
194
+ { code: "managed-key", means: "The harness owns this setting, so it can't be changed here.", fix: "Leave it; ask your owner if it really needs to change." },
195
+ { code: "config-unreadable", means: "agent.json couldn't be read or parsed, so nothing was changed.", fix: "Read agent.json with read_file to see what is wrong, and tell your owner." },
196
+ { code: "orientation-hold", means: "This turn is on a correction hold, so settings changes wait.", fix: "Call orientation_get, settle what the person meant, then change the setting if it is still wanted." },
197
+ ] },
185
198
  },
186
199
  ];
@@ -181,9 +181,10 @@ function buildEvidence(args) {
181
181
  function caseOrError(agentRoot, caseId) {
182
182
  const item = (0, evolution_1.readEvolutionCase)(agentRoot, caseId);
183
183
  if (!item)
184
- return { ok: false, error: `Evolution case not found: ${caseId}` };
184
+ return { ok: false, error: `Evolution case not found: ${caseId}`, code: "case-not-found" };
185
185
  return { ok: true, case: item };
186
186
  }
187
+ const ORIENTATION_HOLD_ERROR = { code: "orientation-hold", means: "This turn is on a correction hold, so evolution records wait until you know what the person meant.", fix: "Call orientation_get, settle the correction, then record it if it is still right." };
187
188
  const rawEvolutionToolDefinitions = [
188
189
  {
189
190
  /* v8 ignore next -- static OpenAI tool schema is validated by the registry contract */
@@ -203,6 +204,9 @@ const rawEvolutionToolDefinitions = [
203
204
  return json({ ok: true, count: openCases.length, openCases });
204
205
  },
205
206
  riskProfile: { mutates: "none", risk: "low", reason: "reads evolution case summaries" },
207
+ ax: { id: "tool:evolution_status", group: "turn-evolution", when: "Pick this to see every open case and what each one needs next, before opening one with evolution_case.", effect: "read", idempotent: true, errors: [
208
+ { code: "tool-changed", means: "evolution_status is no longer in this turn's tool selection.", fix: "Use the tools this turn offers now; open cases also appear in the active work summary." },
209
+ ] },
206
210
  },
207
211
  {
208
212
  tool: {
@@ -222,7 +226,7 @@ const rawEvolutionToolDefinitions = [
222
226
  handler: (args) => {
223
227
  const caseId = required(args, "caseId");
224
228
  if (!caseId)
225
- return json({ ok: false, error: "caseId is required" });
229
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
226
230
  const agentRoot = (0, identity_1.getAgentRoot)();
227
231
  const result = caseOrError(agentRoot, caseId);
228
232
  if (!result.ok)
@@ -230,6 +234,10 @@ const rawEvolutionToolDefinitions = [
230
234
  return json({ ok: true, case: result.case, trace: (0, evolution_1.readEvolutionTrace)(agentRoot, caseId) });
231
235
  },
232
236
  riskProfile: { mutates: "none", risk: "low", reason: "reads a local evolution case and trace" },
237
+ ax: { id: "tool:evolution_case", group: "turn-evolution", when: "Pick this to read one case in full, with every trace event, before deciding, verifying or closing it.", effect: "read", idempotent: true, errors: [
238
+ { code: "bad-argument", means: "caseId is missing.", fix: "Call again with a caseId from evolution_status, such as evo-..." },
239
+ { code: "case-not-found", means: "No evolution case has that id on this agent.", fix: "Call evolution_status for the open case ids, and use one of those." },
240
+ ] },
233
241
  },
234
242
  {
235
243
  tool: {
@@ -268,27 +276,27 @@ const rawEvolutionToolDefinitions = [
268
276
  const originLabel = required(args, "originLabel");
269
277
  const originLocator = required(args, "originLocator");
270
278
  if (!title)
271
- return json({ ok: false, error: "title is required" });
279
+ return json({ ok: false, error: "title is required", code: "bad-argument" });
272
280
  if (!problemStatement)
273
- return json({ ok: false, error: "problemStatement is required" });
281
+ return json({ ok: false, error: "problemStatement is required", code: "bad-argument" });
274
282
  if (!desiredBehavior)
275
- return json({ ok: false, error: "desiredBehavior is required" });
283
+ return json({ ok: false, error: "desiredBehavior is required", code: "bad-argument" });
276
284
  if (!originKindRaw)
277
- return json({ ok: false, error: "originKind is required" });
285
+ return json({ ok: false, error: "originKind is required", code: "bad-argument" });
278
286
  if (!originLabel)
279
- return json({ ok: false, error: "originLabel is required" });
287
+ return json({ ok: false, error: "originLabel is required", code: "bad-argument" });
280
288
  if (!originLocator)
281
- return json({ ok: false, error: "originLocator is required" });
289
+ return json({ ok: false, error: "originLocator is required", code: "bad-argument" });
282
290
  const originKind = parseEnum(originKindRaw, ORIGIN_KINDS, "originKind");
283
291
  if (typeof originKind === "string" && !ORIGIN_KINDS.has(originKind))
284
- return json({ ok: false, error: originKind });
292
+ return json({ ok: false, error: originKind, code: "bad-argument" });
285
293
  const budgetProfileRaw = optional(args, "budgetProfile") ?? "conservative";
286
294
  const budgetProfile = parseEnum(budgetProfileRaw, BUDGET_PROFILES, "budgetProfile");
287
295
  if (typeof budgetProfile === "string" && !BUDGET_PROFILES.has(budgetProfile))
288
- return json({ ok: false, error: budgetProfile });
296
+ return json({ ok: false, error: budgetProfile, code: "bad-argument" });
289
297
  const evidence = buildEvidence(args);
290
298
  if (typeof evidence === "string")
291
- return json({ ok: false, error: evidence });
299
+ return json({ ok: false, error: evidence, code: "bad-argument" });
292
300
  const frictionSignature = optional(args, "frictionSignature");
293
301
  const packetId = optional(args, "packetId");
294
302
  const obligationId = optional(args, "obligationId");
@@ -306,6 +314,10 @@ const rawEvolutionToolDefinitions = [
306
314
  return json({ ok: true, case: item, nextAction: (0, evolution_1.nextEvolutionActionForStatus)(item.status) });
307
315
  },
308
316
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "creates durable evolution case and trace state" },
317
+ ax: { id: "tool:evolution_capture", group: "turn-evolution", when: "Pick this when friction or a wished-for behavior in the harness should become a tracked case rather than a passing remark.", effect: "write", errors: [
318
+ { code: "bad-argument", means: "A required field is empty, or originKind, budgetProfile or an evidence field isn't an allowed value; error names it.", fix: "Fill in or correct the field error names; evidence needs all three of evidenceKind, evidenceLocator and evidenceReason." },
319
+ ORIENTATION_HOLD_ERROR,
320
+ ] },
309
321
  },
310
322
  {
311
323
  tool: {
@@ -331,18 +343,18 @@ const rawEvolutionToolDefinitions = [
331
343
  const actionRaw = required(args, "action");
332
344
  const reason = required(args, "reason");
333
345
  if (!caseId)
334
- return json({ ok: false, error: "caseId is required" });
346
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
335
347
  if (!decisionRaw)
336
- return json({ ok: false, error: "decision is required" });
348
+ return json({ ok: false, error: "decision is required", code: "bad-argument" });
337
349
  if (!DECISIONS.has(decisionRaw))
338
- return json({ ok: false, error: `invalid decision: ${decisionRaw}` });
350
+ return json({ ok: false, error: `invalid decision: ${decisionRaw}`, code: "bad-argument" });
339
351
  if (!actionRaw)
340
- return json({ ok: false, error: "action is required" });
352
+ return json({ ok: false, error: "action is required", code: "bad-argument" });
341
353
  const action = parseEnum(actionRaw, EVOLUTION_ACTIONS, "action");
342
354
  if (typeof action === "string" && !EVOLUTION_ACTIONS.has(action))
343
- return json({ ok: false, error: action });
355
+ return json({ ok: false, error: action, code: "bad-argument" });
344
356
  if (!reason)
345
- return json({ ok: false, error: "reason is required" });
357
+ return json({ ok: false, error: "reason is required", code: "bad-argument" });
346
358
  const agentRoot = (0, identity_1.getAgentRoot)();
347
359
  const gate = (0, evolution_1.evaluateEvolutionAction)(agentRoot, caseId, action);
348
360
  if (!gate.allowed) {
@@ -356,6 +368,10 @@ const rawEvolutionToolDefinitions = [
356
368
  return json({ ok: true, action, case: item });
357
369
  },
358
370
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "records durable evolution decision state" },
371
+ ax: { id: "tool:evolution_decide", group: "turn-evolution", when: "Pick this to choose what to do about a case, such as act, defer or ask, once its authority and budget allow it.", effect: "write", errors: [
372
+ { code: "bad-argument", means: "caseId, decision, action or reason is empty, or decision or action isn't an allowed value; error names it.", fix: "Fill in or correct the field error names; a reply with blocked: true instead carries the gate's own code and reason." },
373
+ ORIENTATION_HOLD_ERROR,
374
+ ] },
359
375
  },
360
376
  {
361
377
  tool: {
@@ -384,22 +400,22 @@ const rawEvolutionToolDefinitions = [
384
400
  const statusRaw = required(args, "status");
385
401
  const objective = required(args, "objective");
386
402
  if (!caseId)
387
- return json({ ok: false, error: "caseId is required" });
403
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
388
404
  if (!statusRaw)
389
- return json({ ok: false, error: "status is required" });
405
+ return json({ ok: false, error: "status is required", code: "bad-argument" });
390
406
  if (!VERIFICATION_STATUSES.has(statusRaw))
391
- return json({ ok: false, error: `invalid status: ${statusRaw}` });
407
+ return json({ ok: false, error: `invalid status: ${statusRaw}`, code: "bad-argument" });
392
408
  if (!objective)
393
- return json({ ok: false, error: "objective is required" });
409
+ return json({ ok: false, error: "objective is required", code: "bad-argument" });
394
410
  const commands = parseStringArray(optional(args, "commands"), "commands");
395
411
  if (typeof commands === "string")
396
- return json({ ok: false, error: commands });
412
+ return json({ ok: false, error: commands, code: "bad-argument" });
397
413
  const evidenceRefs = parseStringArray(optional(args, "evidenceRefs"), "evidenceRefs");
398
414
  if (typeof evidenceRefs === "string")
399
- return json({ ok: false, error: evidenceRefs });
415
+ return json({ ok: false, error: evidenceRefs, code: "bad-argument" });
400
416
  const missingChecks = parseStringArray(optional(args, "missingChecks"), "missingChecks");
401
417
  if (typeof missingChecks === "string")
402
- return json({ ok: false, error: missingChecks });
418
+ return json({ ok: false, error: missingChecks, code: "bad-argument" });
403
419
  const item = (0, evolution_1.recordEvolutionVerification)((0, identity_1.getAgentRoot)(), caseId, {
404
420
  status: statusRaw,
405
421
  checkedAt: optional(args, "checkedAt") ?? nowIso(),
@@ -412,6 +428,10 @@ const rawEvolutionToolDefinitions = [
412
428
  return json({ ok: true, case: item });
413
429
  },
414
430
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "records durable evolution verification state" },
431
+ ax: { id: "tool:evolution_verify", group: "turn-evolution", when: "Pick this after a change is made, to record whether the checks for the case's objective passed and which are still missing.", effect: "write", errors: [
432
+ { code: "bad-argument", means: "caseId, status or objective is empty, status isn't allowed, or a list isn't a JSON array, newline list or comma list.", fix: "Fill in or correct the field error names; send commands and evidenceRefs as a JSON array of strings." },
433
+ ORIENTATION_HOLD_ERROR,
434
+ ] },
415
435
  },
416
436
  {
417
437
  tool: {
@@ -432,14 +452,18 @@ const rawEvolutionToolDefinitions = [
432
452
  handler: (args) => {
433
453
  const caseId = required(args, "caseId");
434
454
  if (!caseId)
435
- return json({ ok: false, error: "caseId is required" });
455
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
436
456
  const delivery = parseDelivery(optional(args, "delivery"));
437
457
  if (typeof delivery === "string")
438
- return json({ ok: false, error: delivery });
458
+ return json({ ok: false, error: delivery, code: "bad-argument" });
439
459
  const item = (0, evolution_1.recordEvolutionDelivery)((0, identity_1.getAgentRoot)(), caseId, delivery);
440
460
  return json({ ok: true, case: item });
441
461
  },
442
462
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "records durable evolution delivery state" },
463
+ ax: { id: "tool:evolution_deliver", group: "turn-evolution", when: "Pick this as a fix ships, to record its branch, commits, pull request, merge, release or install for the case.", effect: "write", errors: [
464
+ { code: "bad-argument", means: "caseId is empty, or delivery is missing, isn't valid JSON or isn't a JSON object.", fix: "Send delivery as a JSON object string keyed by stage, such as pullRequest with its url and openedAt." },
465
+ ORIENTATION_HOLD_ERROR,
466
+ ] },
443
467
  },
444
468
  {
445
469
  tool: {
@@ -463,14 +487,18 @@ const rawEvolutionToolDefinitions = [
463
487
  handler: (args) => {
464
488
  const caseId = required(args, "caseId");
465
489
  if (!caseId)
466
- return json({ ok: false, error: "caseId is required" });
490
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
467
491
  const ratification = buildRatification(args);
468
492
  if (typeof ratification === "string")
469
- return json({ ok: false, error: ratification });
493
+ return json({ ok: false, error: ratification, code: "bad-argument" });
470
494
  const item = (0, evolution_1.recordEvolutionRatification)((0, identity_1.getAgentRoot)(), caseId, ratification);
471
495
  return json({ ok: true, case: item });
472
496
  },
473
497
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "records durable evolution ratification state" },
498
+ ax: { id: "tool:evolution_ratify", group: "turn-evolution", when: "Pick this once a verified case has taught something, to record where the lesson landed, or none_needed if nowhere.", effect: "write", errors: [
499
+ { code: "bad-argument", means: "caseId, destination, locator or reason is empty, or destination isn't an allowed place.", fix: "Fill in the field error names; use destination none_needed when no lasting lesson should be written." },
500
+ ORIENTATION_HOLD_ERROR,
501
+ ] },
474
502
  },
475
503
  {
476
504
  tool: {
@@ -495,21 +523,26 @@ const rawEvolutionToolDefinitions = [
495
523
  const caseId = required(args, "caseId");
496
524
  const reason = required(args, "reason");
497
525
  if (!caseId)
498
- return json({ ok: false, error: "caseId is required" });
526
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
499
527
  if (!reason)
500
- return json({ ok: false, error: "reason is required" });
528
+ return json({ ok: false, error: "reason is required", code: "bad-argument" });
501
529
  const ratification = optional(args, "destination") ? buildRatification(args) : undefined;
502
530
  if (typeof ratification === "string")
503
- return json({ ok: false, error: ratification });
531
+ return json({ ok: false, error: ratification, code: "bad-argument" });
504
532
  try {
505
533
  const item = (0, evolution_1.closeEvolutionCase)((0, identity_1.getAgentRoot)(), caseId, { reason, ...(ratification ? { ratification } : {}) });
506
534
  return json({ ok: true, case: item });
507
535
  }
508
536
  catch (error) {
509
- return json({ ok: false, error: error.message });
537
+ return json({ ok: false, error: error.message, code: "close-failed" });
510
538
  }
511
539
  },
512
540
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "closes durable evolution case state" },
541
+ ax: { id: "tool:evolution_close", group: "turn-evolution", when: "Pick this to finish a case whose lesson is ratified; pass destination here to ratify and close in one call.", effect: "write", errors: [
542
+ { code: "bad-argument", means: "caseId or reason is empty, or the inline ratification fields are incomplete.", fix: "Fill in the field error names, then close again." },
543
+ ORIENTATION_HOLD_ERROR,
544
+ { code: "close-failed", means: "The case can't close yet, usually because no ratification is recorded; error says why.", fix: "Call again with destination and locator, or destination none_needed, so it ratifies as it closes." },
545
+ ] },
513
546
  },
514
547
  ];
515
548
  exports.evolutionToolDefinitions = rawEvolutionToolDefinitions.map((definition) => ({
@@ -43,6 +43,7 @@ const record_paths_1 = require("../mind/record-paths");
43
43
  const friends_1 = require("@ouro.bot/friends");
44
44
  const runtime_1 = require("../nerves/runtime");
45
45
  const identity_1 = require("../heart/identity");
46
+ const tool_error_code_1 = require("./tool-error-code");
46
47
  const NOTES_INDEX_VERSION = 1;
47
48
  const NOTE_SLUG_MAX_CHARS = 40;
48
49
  const DEFAULT_LIMIT = 5;
@@ -317,7 +318,7 @@ async function getFreshIndex(notesDir, indexPath, provider) {
317
318
  function createProviderForTool(toolName) {
318
319
  const provider = (0, embedding_provider_1.createDefaultEmbeddingProvider)();
319
320
  if (!provider) {
320
- return `error: ${toolName} couldn't use notes because embeddings are not configured.`;
321
+ return (0, tool_error_code_1.withCode)(`error: ${toolName} couldn't use notes because embeddings are not configured.`, "embeddings-not-configured");
321
322
  }
322
323
  return provider;
323
324
  }
@@ -361,11 +362,11 @@ exports.recordToolDefinitions = [
361
362
  },
362
363
  handler: async (args, ctx) => {
363
364
  if (!hasSelfTrust(ctx))
364
- return "error: note requires self trust and cannot be used from an external caller context.";
365
+ return (0, tool_error_code_1.withCode)("error: note requires self trust and cannot be used from an external caller context.", "self-trust-required");
365
366
  const rawArgs = args;
366
367
  const content = typeof rawArgs.content === "string" ? rawArgs.content.trim() : "";
367
368
  if (!content)
368
- return "content is required";
369
+ return (0, tool_error_code_1.withCode)("content is required", "missing-argument");
369
370
  const provider = createProviderForTool("note");
370
371
  if (typeof provider === "string")
371
372
  return provider;
@@ -400,11 +401,18 @@ exports.recordToolDefinitions = [
400
401
  message: "canonical note save failed",
401
402
  meta: { reason: error instanceof Error ? error.message : String(error) },
402
403
  });
403
- return "error: couldn't save the note right now.";
404
+ return (0, tool_error_code_1.withCode)("error: couldn't save the note right now.", "note-save-failed");
404
405
  }
405
406
  },
406
407
  summaryKeys: ["content", "tags"],
407
408
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "writes canonical Desk record note" },
409
+ ax: { id: "tool:note", group: "turn-record", when: "Pick this to keep a longer tagged markdown note in your own record, from your own context only; short facts suit diary_write.", effect: "write", errors: [
410
+ { code: "self-trust-required", means: "note runs only in your own private context, and this call came from someone else's.", fix: "Use diary_write for a fact from this chat, or write the note later in your own private runtime." },
411
+ { code: "missing-argument", means: "content is empty or isn't text.", fix: "Call note again with the note's text as content." },
412
+ { code: "embeddings-not-configured", means: "No embedding provider is set up, so notes can't be indexed.", fix: "Keep the fact with diary_write, and tell your owner notes need an embedding provider." },
413
+ { code: "note-save-failed", means: "Writing the note file or its index failed.", fix: "Try once more; if it fails again, keep the fact with diary_write." },
414
+ { code: "orientation-hold", means: "This turn is on a correction hold, so new notes wait.", fix: "Call orientation_get, settle what the person meant, then write the note if it still holds." },
415
+ ] },
408
416
  },
409
417
  {
410
418
  tool: {
@@ -426,7 +434,7 @@ exports.recordToolDefinitions = [
426
434
  },
427
435
  handler: async (args, ctx) => {
428
436
  if (!hasRecordReadTrust(ctx))
429
- return "error: consult_notes requires trusted record-read access.";
437
+ return (0, tool_error_code_1.withCode)("error: consult_notes requires trusted record-read access.", "record-read-denied");
430
438
  const rawArgs = args;
431
439
  const query = typeof rawArgs.query === "string" ? rawArgs.query.trim() : "";
432
440
  if (!query)
@@ -474,9 +482,15 @@ exports.recordToolDefinitions = [
474
482
  message: "canonical notes consult failed",
475
483
  meta: { reason: error instanceof Error ? error.message : String(error) },
476
484
  });
477
- return "error: consult_notes couldn't search notes right now.";
485
+ return (0, tool_error_code_1.withCode)("error: consult_notes couldn't search notes right now.", "notes-search-failed");
478
486
  }
479
487
  },
480
488
  summaryKeys: ["query"],
489
+ // A stale notes index is rebuilt and saved before the search, so this changes the agent's own files.
490
+ ax: { id: "tool:consult_notes", group: "turn-record", when: "Pick this to search your longer markdown notes by meaning, paging with cursor; diary entries are searched with search_facts.", effect: "write", idempotent: true, errors: [
491
+ { code: "record-read-denied", means: "This caller isn't trusted to read your notes.", fix: "Answer without the notes, or look them up from a chat with a trusted person." },
492
+ { code: "embeddings-not-configured", means: "No embedding provider is set up, so notes can't be searched.", fix: "Search the diary with search_facts, or grep the notes folder for exact words." },
493
+ { code: "notes-search-failed", means: "Building the index or embedding the query failed.", fix: "Try again once; then fall back to grep over the notes folder." },
494
+ ] },
481
495
  },
482
496
  ];
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1322",
3
+ "version": "0.1.0-alpha.1324",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1322",
9
+ "version": "0.1.0-alpha.1324",
10
10
  "bundleDependencies": [
11
11
  "@ouro.bot/friends"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1322",
3
+ "version": "0.1.0-alpha.1324",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },