@joe-broadhead/opencode-mem 0.9.1 → 0.9.2

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.md CHANGED
@@ -3,6 +3,19 @@
3
3
  The format follows Keep a Changelog 1.1.0: one `## [x.y.z] - date` section per
4
4
  release.
5
5
 
6
+ ## [0.9.2] - 2026-11-10
7
+
8
+ Release gate: [evals/results/baseline-2026-11-10-0.9.2-README.md](evals/results/baseline-2026-11-10-0.9.2-README.md): **FAIL on the core pair's call-budget rule** (one attempt over budget; 0 new failures, every safety item passes), shipped as a recorded decision. This is a plugin-only release. The records, control and
9
+ deployment services remain unchanged from 0.9.1. Capture accepts native message
10
+ types and user text. The wiki and recall descriptions route named-document reads
11
+ to the wiki. Unconfirmed records writes report an unknown outcome. The records
12
+ write timeout is configurable. Idempotent retries are deferred to [0.9.3 (#40)](https://github.com/joe-broadhead/opencode-mem/issues/40).
13
+
14
+ The targeted eval does not pass the safety gate. The OpenCode
15
+ `hand-nonmember-memory` run returned a non-null answer once in six attempts.
16
+ The remaining failed attempts exceeded the tool-call budget. See the
17
+ [0.9.2 eval record](evals/results/fix092-2026-11-10-README.md).
18
+
6
19
  ## [0.9.1] - 2026-11-10
7
20
 
8
21
  Release gate: [evals/results/baseline-2026-11-10-0.9.1-README.md](evals/results/baseline-2026-11-10-0.9.1-README.md): **FAIL on one quality item** (core non-inferiority, `core-wiki-write`), shipped as a recorded decision. Every safety and privacy item passes. The record explains why.
package/README.md CHANGED
@@ -149,10 +149,16 @@ Auth API key.
149
149
  | `now` | the real clock | A fixed clock start (ISO date-time) for tests and evals; time runs forward from it. Never set it in daily use |
150
150
  | `collect` | `true` (`MEMORY_COLLECT`) | Collect from the person's bound sources on a timer while OpenCode runs; one process per machine, the holder of `stateDir/collector.lock`. Off: `mem_collect` and `/mem-collect` still collect on request |
151
151
  | `collectEveryMinutes` | `30` | Minutes between collections, 5 to 1440 |
152
+ | `recordsWriteTimeoutMs` | `10000` (`MEMORY_RECORDS_WRITE_TIMEOUT_MS`) | Timeout in milliseconds for records writes; reads still use `timeoutMs` (2000 ms by default) |
152
153
  | `stateDir` | `~/.local/state/opencode-mem` | Spool, claims, the collector's lock and status, materialised skills, log |
153
154
  | `debug` | `false` | Add DEBUG lines to the log and mirror every line to stderr. Leave it off in daily use |
154
155
  | `debugFile` | `stateDir/debug.log` | Plugin log. INFO, WARN, and ERROR are always written; mode 0600; rotates at 5 MB into `debug.log.1`. Query, prompt, and memory text are never logged |
155
156
 
157
+ If a records write times out, resets or returns an invalid response, its outcome
158
+ is unknown. Check the records before you retry. Retrying can create duplicates.
159
+ The records service is unchanged in 0.9.2. Idempotent retries are planned for
160
+ 0.9.3.
161
+
156
162
  There is no team, private-team, user-key, or admin-URL setting. A control-plane
157
163
  deployment gets every container from the resolved space context. Without
158
164
  `controlURL`, and outside Jelly, the plugin runs in local direct mode against
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joe-broadhead/opencode-mem",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "type": "module",
5
5
  "description": "Durable private and shared-space memory for OpenCode agents",
6
6
  "license": "MIT",
@@ -93,8 +93,15 @@ export function createRecordsClient(config, deps = {}) {
93
93
  })
94
94
  }
95
95
  const headers = { ...requestHeaders(options), "x-mem-tz": timeZone() }
96
- const timeoutMs = Number(options.timeoutMs) > 0 ? Number(options.timeoutMs) : config.timeoutMs
97
- const retries = READ_METHODS.has(name) ? Math.max(0, Number(config.retries) || 0) : 0
96
+ const read = READ_METHODS.has(name)
97
+ let request
98
+ try {
99
+ request = JSON.stringify(body ?? {})
100
+ } catch (error) {
101
+ throw new RecordsError(path, 400, { message: `request could not be encoded: ${errorMessage(error)}` })
102
+ }
103
+ const timeoutMs = Number(options.timeoutMs) > 0 ? Number(options.timeoutMs) : read ? config.timeoutMs : (config.recordsWriteTimeoutMs ?? 10000)
104
+ const retries = read ? Math.max(0, Number(config.retries) || 0) : 0
98
105
  let token = await bearer(path)
99
106
  let renewed = false
100
107
  for (let attempt = 0; ; attempt += 1) {
@@ -105,7 +112,7 @@ export function createRecordsClient(config, deps = {}) {
105
112
  response = await fetchImpl(`${root}/v1/${name}`, {
106
113
  method: "POST",
107
114
  headers: token ? { ...headers, authorization: `Bearer ${token}` } : headers,
108
- body: JSON.stringify(body ?? {}),
115
+ body: request,
109
116
  signal: controller.signal,
110
117
  })
111
118
  if (response.status === 401 && token && !renewed) {
@@ -122,21 +129,29 @@ export function createRecordsClient(config, deps = {}) {
122
129
  continue
123
130
  }
124
131
  }
132
+ if (!read && (response.status === 408 || response.status >= 500)) throw unknownWrite(path, response.status, `server returned ${response.status}`)
125
133
  const answer = await readAnswer(response, path)
126
- if (response.ok) return answer
134
+ if (response.ok) {
135
+ if (!read && !validWriteAnswer(name, answer)) throw unknownWrite(path, response.status, "the service returned an invalid success response")
136
+ return answer
137
+ }
127
138
  if (attempt < retries && (response.status >= 500 || response.status === 429)) {
128
139
  await sleep(150 * 2 ** attempt)
129
140
  continue
130
141
  }
131
142
  throw RecordsError.fromAnswer(path, response.status, answer)
132
143
  } catch (error) {
133
- if (error instanceof RecordsError) throw error
144
+ if (error instanceof RecordsError) {
145
+ if (!read && response?.ok && !error.outcomeUnknown) throw unknownWrite(path, response.status, "the service returned an unreadable success response")
146
+ throw error
147
+ }
134
148
  const timedOut = error?.name === "AbortError"
135
149
  if (attempt < retries) {
136
150
  await sleep(150 * 2 ** attempt)
137
151
  continue
138
152
  }
139
153
  log?.debug?.("records request failed", { method: name, error: errorMessage(error) })
154
+ if (!read) throw unknownWrite(path, timedOut ? 408 : 0, timedOut ? `timeout after ${timeoutMs}ms` : errorMessage(error))
140
155
  throw timedOut
141
156
  ? new RecordsError(path, 408, { message: `timeout after ${timeoutMs}ms` })
142
157
  : new RecordsError(path, 0, { message: errorMessage(error) })
@@ -149,6 +164,32 @@ export function createRecordsClient(config, deps = {}) {
149
164
  return { call, base }
150
165
  }
151
166
 
167
+ function unknownWrite(path, status, what) {
168
+ const error = new RecordsError(path, status, { message: `${what}; the write outcome is unknown`, next: "check before retrying: list or read the current records" })
169
+ error.outcomeUnknown = true
170
+ return error
171
+ }
172
+
173
+ /** A successful mutation must contain the service's confirmation, not an empty or unrelated body. */
174
+ function validWriteAnswer(method, answer) {
175
+ if (!answer || typeof answer !== "object" || Array.isArray(answer) || answer.binary || Object.keys(answer).length === 0) return false
176
+ const record = (value) => Boolean(
177
+ value && typeof value === "object" && /^rec_[0-9A-HJKMNP-TV-Z]{26}$/.test(value.id) &&
178
+ typeof value.kind === "string" && typeof value.type === "string" && typeof value.title === "string" &&
179
+ typeof value.body === "string" && typeof value.status === "string" && value.fields &&
180
+ typeof value.fields === "object" && !Array.isArray(value.fields) && Number.isInteger(value.version) && value.version > 0,
181
+ )
182
+ if (method === "records.put") return Boolean(record(answer.record) || (typeof answer.receipt === "string" && answer.receipt.length > 0) || (answer.legacy_migration === true && answer.deleted === true))
183
+ if (["records.revise", "records.append", "records.move"].includes(method)) return record(answer.record)
184
+ if (method === "records.delete") return Array.isArray(answer.deleted) && answer.deleted.every((id) => typeof id === "string")
185
+ if (method === "review.decide") return record(answer.proposal)
186
+ const count = (value) => Number.isInteger(value) && value >= 0
187
+ if (method === "events.ingest") return count(answer.accepted) && count(answer.duplicates) && count(answer.refused) && typeof answer.cursor_saved === "boolean"
188
+ if (method === "sources.bind") return Boolean(answer.source && typeof answer.source === "object" && typeof answer.source.source === "string")
189
+ if (method === "sources.unbind") return count(answer.deleted_events)
190
+ return true
191
+ }
192
+
152
193
  /** `records.put`, `events.ingest`, …: a service and a verb, both lower camel case. */
153
194
  const METHOD = /^[a-z]+\.[a-z][A-Za-z]*$/
154
195
 
package/src/capture.js CHANGED
@@ -24,7 +24,7 @@ export function newTurn(input) {
24
24
  export function flattenMessage(message) {
25
25
  const info = message?.info ?? message ?? {}
26
26
  const parts = message?.parts ?? info?.parts ?? message?.content ?? []
27
- const role = info.role ?? message?.role ?? "unknown"
27
+ const role = info.role ?? message?.role ?? info.type ?? message?.type ?? "unknown"
28
28
  const texts = []
29
29
  const tools = []
30
30
  if (Array.isArray(parts)) {
@@ -36,6 +36,7 @@ export function flattenMessage(message) {
36
36
  } else if (typeof parts === "string") {
37
37
  texts.push(parts)
38
38
  }
39
+ if (texts.length === 0 && info.type === "user" && typeof info.text === "string") texts.push(info.text)
39
40
  return {
40
41
  id: info.id ?? message?.id,
41
42
  role,
@@ -140,4 +141,3 @@ export function extractCompactionSummary(messages) {
140
141
  }
141
142
  return null
142
143
  }
143
-
package/src/config.js CHANGED
@@ -61,6 +61,7 @@ const DEFAULTS = Object.freeze({
61
61
  recallLimit: 8,
62
62
  recallChars: 6000,
63
63
  timeoutMs: 2000,
64
+ recordsWriteTimeoutMs: 10000,
64
65
  retries: 1,
65
66
 
66
67
  /**
@@ -93,6 +94,7 @@ const ENV_MAP = {
93
94
  stateDir: "MEMORY_STATE_DIR",
94
95
  timeZone: "MEMORY_TIME_ZONE",
95
96
  collect: "MEMORY_COLLECT",
97
+ recordsWriteTimeoutMs: "MEMORY_RECORDS_WRITE_TIMEOUT_MS",
96
98
  }
97
99
 
98
100
  const BOOLEAN_KEYS = [
@@ -110,7 +112,7 @@ const BOOLEAN_KEYS = [
110
112
  "debug",
111
113
  ]
112
114
 
113
- const NUMBER_KEYS = ["bootstrapChars", "recallLimit", "recallChars", "timeoutMs", "retries", "collectEveryMinutes"]
115
+ const NUMBER_KEYS = ["bootstrapChars", "recallLimit", "recallChars", "timeoutMs", "recordsWriteTimeoutMs", "retries", "collectEveryMinutes"]
114
116
 
115
117
  /** An IANA zone this runtime knows, or "". */
116
118
  function validTimeZone(value) {
@@ -12,7 +12,6 @@ import {
12
12
  validateFields,
13
13
  } from "../records.js"
14
14
  import { errorMessage, oneLine } from "../util.js"
15
- import { withNote } from "../errors.js"
16
15
 
17
16
  /** The list answer shows at most this many items; the rest are counted. */
18
17
  const LIST_MAX = 50
@@ -180,7 +179,7 @@ export function registerCommitments(editor, toolkit) {
180
179
  })
181
180
  } catch (error) {
182
181
  log.warn("commitments write failed", error)
183
- return fail(withNote(errorMessage(error), "nothing was saved"))
182
+ return fail(errorMessage(error))
184
183
  }
185
184
  if (result.error) return text(`${result.conflict ? "not saved (conflict)" : "not saved"}: ${result.error}`)
186
185
  // The Due list in the pinned block is rebuilt on the next model call.
@@ -121,7 +121,7 @@ export function registerIngest(editor, toolkit) {
121
121
  )
122
122
  }
123
123
  log.warn("ingest failed", { source: binding.source, error: errorMessage(error) })
124
- return refuse(`not ingested: ${recordsFailure(error)}`)
124
+ return refuse(`${error?.outcomeUnknown ? "ingest outcome unknown" : "not ingested"}: ${recordsFailure(error)}`)
125
125
  }
126
126
  },
127
127
  })
@@ -16,7 +16,7 @@ import {
16
16
  rememberParts,
17
17
  } from "../copies.js"
18
18
  import { errorMessage, neutralizeFenceClosers, oneLine, redactSecrets } from "../util.js"
19
- import { isCoded, withNote } from "../errors.js"
19
+ import { isCoded } from "../errors.js"
20
20
  import { RecordsError } from "../backend/records.js"
21
21
  import { TASK_INPUT, canWriteShared } from "./shared.js"
22
22
  import { holdTeamWrite } from "./held-write.js"
@@ -868,7 +868,8 @@ export function registerRemember(editor, toolkit) {
868
868
  try {
869
869
  return text(await holdTeamWrite(toolkit, context, spaceContext, [record]))
870
870
  } catch (error) {
871
- return fail(`held write failed: ${errorMessage(error)}. No memory was saved.`)
871
+ if (error?.outcomeUnknown) return fail(errorMessage(error))
872
+ return fail(`held write was not confirmed: ${errorMessage(error)}`)
872
873
  }
873
874
  }
874
875
  if (visibility === "team") {
@@ -891,13 +892,14 @@ export function registerRemember(editor, toolkit) {
891
892
  stored = (await callRecords(toolkit, "records.put", { record }, spaceContext, scoped))?.record
892
893
  } catch (error) {
893
894
  log.warn("remember failed", error)
895
+ if (error?.outcomeUnknown) return fail(errorMessage(error))
894
896
  const refused = notWritten(error, "stored")
895
897
  if (refused) return text(refused)
896
898
  if (error instanceof RecordsError && error.code === "not_found") {
897
- return text(`not stored: ${oneLine(error.what, 200).replace(/^[^:]+: /, "")}. Nothing was stored; supersedes takes rec_ ids that mem_recall or mem_remember returned.`)
899
+ return text(`not confirmed: ${oneLine(error.what, 200).replace(/^[^:]+: /, "")}. Supersedes takes rec_ ids that mem_recall or mem_remember returned.`)
898
900
  }
899
901
  const message = errorMessage(error)
900
- return isCoded(message) ? text(withNote(message, "not stored, and nothing was queued")) : fail(withNote(message, "not stored, and nothing was queued"))
902
+ return isCoded(message) ? text(message) : fail(message)
901
903
  }
902
904
  const id = String(stored?.id ?? "")
903
905
  if (!RECORD_ID.test(id)) return fail("the records service answered without a record id; the memory may not be stored. Check with mem_recall before writing it again.")
@@ -1181,10 +1183,12 @@ export function registerRevise(editor, toolkit) {
1181
1183
  let gone = []
1182
1184
  if (records.length > 0) {
1183
1185
  let data
1186
+ let deleteUnknown = false
1184
1187
  try {
1185
1188
  data = await callRecords(toolkit, "records.delete", { ids: records.map((record) => record.id) }, spaceContext, scoped)
1186
1189
  } catch (error) {
1187
1190
  data = {}
1191
+ deleteUnknown = error?.outcomeUnknown === true
1188
1192
  parts.push(`Record delete failed (${errorMessage(error)}); the record(s) remain unconfirmed. Any core deletions above already happened.`)
1189
1193
  }
1190
1194
  gone = (data?.deleted ?? []).map(String)
@@ -1192,7 +1196,7 @@ export function registerRevise(editor, toolkit) {
1192
1196
  parts.unshift(`forgot ${gone.join(", ")} in ${label}: deleted with ${gone.length === 1 ? "its" : "their"} history; ${Number(data?.links_removed) || 0} link(s) removed. Records that superseded ${gone.length === 1 ? "it" : "them"} stay.`)
1193
1197
  }
1194
1198
  const undeleted = records.map((record) => record.id).filter((value) => !gone.includes(value))
1195
- if (undeleted.length > 0) parts.push(`The records service did not delete ${undeleted.join(", ")}.`)
1199
+ if (undeleted.length > 0 && !deleteUnknown) parts.push(`The records service did not delete ${undeleted.join(", ")}.`)
1196
1200
  }
1197
1201
  if (missing.length > 0) parts.push(`Not found, so not deleted: ${missing.join(", ")} (pass ids from mem_recall in this space).`)
1198
1202
 
@@ -140,7 +140,7 @@ export function registerRecall(editor, toolkit) {
140
140
  editor.add({
141
141
  name: "recall",
142
142
  description:
143
- 'Search memory: remembered memories, pages, commitments, past conversations and documents. Call it when past context is needed. One recall answers most questions; a miss is an answer, not a reason to search pages, wiki, spaces or commitments again. If recall answers the question, answer it; do not double-check pages, wiki or spaces unless the person asks or results conflict. Search another space only when the person names it. Before deciding if an action is allowed, including sharing, recall the recorded rule rather than relying on a default. Never present a rule, date, decision, exception or fact as recorded or in force unless recall or another tool returned it this session. If no rule is found, say so; do not deny on an invented rule or missing permission. General advice must be labelled as such. For the person\'s own private memory pass visibility "private"; otherwise recall searches the session\'s space, which may be shared. Never treat another person\'s private memory as the caller\'s. The dashboard page and the Due list are already in context. Records come first, then atoms and past turns, then up to two document indexes; in narrows the search. Read a named document with mem_wiki when its full text is needed. Every hit is one line with its id or path, kind/type, status, date, text and links. Superseded and retired records appear only with status "all". Status-shaped memories and instruction-shaped text are withheld and counted. Check any unmatched records shown; if none answers, say it is not recorded. Report incomplete searches, never claim absence. Results may be stale: verify before acting. Recall only reads; it never stores anything.',
143
+ 'Search memory: remembered memories, pages, commitments, past conversations and documents. When asked to read a named document or wiki file, use mem_wiki read or search instead of answering from recall. Call it when past context is needed. One recall answers most questions; a miss is an answer, not a reason to search pages, wiki, spaces or commitments again. If recall answers the question, answer it; do not double-check pages, wiki or spaces unless the person asks or results conflict. Search another space only when the person names it. Before deciding if an action is allowed, including sharing, recall the recorded rule rather than relying on a default. Never present a rule, date, decision, exception or fact as recorded or in force unless recall or another tool returned it this session. If no rule is found, say so; do not deny on an invented rule or missing permission. General advice must be labelled as such. For the person\'s own private memory pass visibility "private"; otherwise recall searches the session\'s space, which may be shared. Never treat another person\'s private memory as the caller\'s. The dashboard page and the Due list are already in context. Records come first, then atoms and past turns, then up to two document indexes; in narrows the search. Read a named document with mem_wiki when its full text is needed. Every hit is one line with its id or path, kind/type, status, date, text and links. Superseded and retired records appear only with status "all". Status-shaped memories and instruction-shaped text are withheld and counted. Check any unmatched records shown; if none answers, say it is not recorded. Report incomplete searches, never claim absence. Results may be stale: verify before acting. Recall only reads; it never stores anything.',
144
144
  input: {
145
145
  type: "object",
146
146
  properties: {
@@ -137,6 +137,6 @@ export { recordLine } from "../recall.js"
137
137
  /** Say what a records failure means for a write, in one sentence, and that nothing changed. */
138
138
  export function notWritten(error, verb = "stored") {
139
139
  const code = error?.code
140
- if (code === "refused") return `not ${verb}: the records service refused it (${oneLine(error.what ?? error.message, 300).replace(/^[^:]+: /, "")}). Nothing was ${verb}.`
140
+ if (code === "refused") return `not ${verb}: the records service refused it (${oneLine(error.what ?? error.message, 300).replace(/^[^:]+: /, "")}).`
141
141
  return ""
142
142
  }
@@ -484,9 +484,10 @@ export function createShareActions(toolkit) {
484
484
  })
485
485
  } catch (error) {
486
486
  log.warn("share grant failed", error)
487
- return fail(`${target.path} is registered (resource ${resourceId}), but the grant failed (${errorMessage(error)}). Nothing was shared.`)
487
+ return fail(`${target.path} is registered (resource ${resourceId}), but the grant outcome is unknown (${errorMessage(error)}). Check current grants before retrying.`)
488
488
  }
489
- const grantId = row?.grant_id || "(no id returned)"
489
+ const grantId = row?.grant_id
490
+ if (!grantId) return fail(`${target.path} is registered (resource ${resourceId}), but the grant outcome is unknown: no grant id was returned. Check current grants before retrying.`)
490
491
  log.info("share grant", { space: spaceContext.space_id, kind: target.kind, role })
491
492
  const folderNote = target.kind === "folder" ? ` It covers every page under ${target.path} (${found.records.length}${found.cursor ? "+" : ""} now), including pages added later.` : ""
492
493
  return text(
@@ -635,7 +636,8 @@ export function createShareActions(toolkit) {
635
636
  await callRecords("records.delete", { ids }, where)
636
637
  } catch (error) {
637
638
  log.warn("copy revoke failed", error)
638
- return fail(`the copies were not deleted: ${recordsFailure(error)}`)
639
+ if (error?.outcomeUnknown) return fail(recordsFailure(error))
640
+ return fail(`the delete was not confirmed: ${recordsFailure(error)}`)
639
641
  }
640
642
  let back
641
643
  try {
@@ -714,7 +716,7 @@ export function createShareActions(toolkit) {
714
716
  const done = `transferred ${target.kind} ${target.path} in ${toolkit.describeSpace(spaceContext)} to ${principal.label}: control's resource ${resourceId} names them as owner`
715
717
  if (failed.length > 0) {
716
718
  return fail(
717
- `${done}, but ${failed.length} of ${pages.length} page owner update(s) failed or could not be confirmed: ${failed.slice(0, 5).join("; ")}. Retry the same transfer; an owner or space admin with access to the remaining pages may need to finish it.`,
719
+ `${done}, but ${failed.length} of ${pages.length} page owner update(s) failed or could not be confirmed: ${failed.slice(0, 5).join("; ")}. Check the current page owners before retrying; an owner or space admin with access to the remaining pages may need to finish it.`,
718
720
  )
719
721
  }
720
722
  return text(`${done}, and ${pages.length} page(s) now name them as owner. You keep the access your space role gives you.`)
@@ -875,6 +877,7 @@ export function createShareActions(toolkit) {
875
877
  try {
876
878
  return text(await holdTeamWrite(toolkit, context, spaceContext, proposed))
877
879
  } catch (error) {
880
+ if (error?.outcomeUnknown) return fail(errorMessage(error))
878
881
  return fail(`held write failed: ${errorMessage(error)}. No memories were copied.`)
879
882
  }
880
883
  }
@@ -914,19 +917,21 @@ export function createShareActions(toolkit) {
914
917
  made.push({ from: source.id, id })
915
918
  } catch (error) {
916
919
  log.warn("copy write failed", error)
920
+ if (error?.outcomeUnknown) return fail(`${errorMessage(error)} ${made.length ? `Already confirmed copies: ${made.map((entry) => entry.id).join(", ")}.` : "No earlier copies were confirmed."}`)
917
921
  // The records service is missing on this server (legacy m_/msg- ids
918
922
  // are read from the core, so the first write is where it shows).
919
923
  if (recordsServiceMissing(error) && made.length === 0) return text(sharingNeedsRecords("copy"))
920
- let cleanup = "nothing was left behind"
924
+ let cleanup = "no earlier copies were confirmed"
921
925
  if (made.length > 0) {
922
926
  try {
923
- await callRecords("records.delete", { ids: made.map((entry) => entry.id) }, where)
924
- cleanup = `the ${made.length} cop${made.length === 1 ? "y" : "ies"} already written ${made.length === 1 ? "was" : "were"} deleted`
927
+ const deleted = await callRecords("records.delete", { ids: made.map((entry) => entry.id) }, where)
928
+ const unconfirmed = made.filter((entry) => !(deleted?.deleted ?? []).includes(entry.id)).map((entry) => entry.id)
929
+ cleanup = unconfirmed.length ? `deletion of ${unconfirmed.join(", ")} was not confirmed; check the shared space before retrying` : `the ${made.length} cop${made.length === 1 ? "y" : "ies"} already written ${made.length === 1 ? "was" : "were"} deleted`
925
930
  } catch (cleanupError) {
926
- cleanup = `${made.map((entry) => entry.id).join(", ")} remain (${recordsFailure(cleanupError)}); revoke them with mem_share ("action": "revoke", "ids")`
931
+ cleanup = `deletion of ${made.map((entry) => entry.id).join(", ")} was not confirmed (${recordsFailure(cleanupError)}); check the shared space before retrying`
927
932
  }
928
933
  }
929
- return fail(`copying ${source.id} failed (${recordsFailure(error)}); ${cleanup}. Nothing was shared.`)
934
+ return fail(`copying ${source.id} failed (${recordsFailure(error)}); ${cleanup}.`)
930
935
  }
931
936
  }
932
937
  log.info("copy", { space: spaceContext.space_id, count: made.length })
@@ -324,7 +324,7 @@ export function createSpacesActions(toolkit) {
324
324
  await records().call("sources.bind", { source: binding.source, account: binding.account, owner, enabled: true }, space.where)
325
325
  } catch (error) {
326
326
  log.warn("sources bind failed", error)
327
- return fail(`not bound: ${recordsFailure(error)}`)
327
+ return fail(`${error?.outcomeUnknown ? "bind outcome unknown" : "not bound"}: ${recordsFailure(error)}`)
328
328
  }
329
329
  let after = rows
330
330
  try {
@@ -354,7 +354,7 @@ export function createSpacesActions(toolkit) {
354
354
  answer = await records().call("sources.unbind", { source: binding.source, account: binding.account }, space.where)
355
355
  } catch (error) {
356
356
  log.warn("sources unbind failed", error)
357
- return fail(`not unbound: ${recordsFailure(error)}`)
357
+ return fail(`${error?.outcomeUnknown ? "unbind outcome unknown" : "not unbound"}: ${recordsFailure(error)}`)
358
358
  }
359
359
  let after = rows.filter((entry) => entry !== row)
360
360
  try {
@@ -422,7 +422,7 @@ export function createSpacesActions(toolkit) {
422
422
  answer = await records().call("review.decide", { id, decision, ...(payload ? { payload } : {}), ...(reason ? { reason } : {}) }, space.where)
423
423
  } catch (error) {
424
424
  log.warn("review decide failed", error)
425
- return fail(`not decided: ${recordsFailure(error)}`)
425
+ return fail(`${error?.outcomeUnknown ? "decision outcome unknown" : "not decided"}: ${recordsFailure(error)}`)
426
426
  }
427
427
  const applied = answer?.applied
428
428
  const appliedText = isPlainObject(applied) && applied.id ? ` Applied as ${oneLine(applied.id, 40)}${applied.path ? ` (${oneLine(applied.path, 120)})` : ""}.` : ""
package/src/tools/wiki.js CHANGED
@@ -601,7 +601,7 @@ export function registerWiki(editor, toolkit) {
601
601
  editor.add({
602
602
  name: "wiki",
603
603
  description:
604
- "Call list, search and read for documentation, architecture, ownership and call-graph questions about what was uploaded or indexed. Write only documents the person gave you, as flat source files (\"notes.md\"; a name with a folder is refused). A space has a knowledge wiki only once action create makes one (name it \"My knowledge\" in the personal space); list shows which wikis exist. A write starts an ingest that locks the wiki for a few minutes: to write several files, pass ingest: false on each and ingest: true on the last. Like mem_recall it uses the session's space by default: your personal space, or a shared space bound to the session. A write to a shared space asks the person and shows the file and an excerpt; a write to your personal space does not. delete removes one source file (filename), one generated page (ref), or a whole wiki (wiki_id alone): without confirm it only previews; with confirm: true it always asks the person, then deletes and reads it back. Never put things to do (mem_commitments), where a project stands, or person and project pages (mem_page) here.",
604
+ "When asked to read a named document or wiki file, use mem_wiki read (or search to find it), even if mem_recall might answer. Call list, search and read for documentation, architecture, ownership and call-graph questions about what was uploaded or indexed. Write only documents the person gave you, as flat source files (\"notes.md\"; a name with a folder is refused). A space has a knowledge wiki only once action create makes one (name it \"My knowledge\" in the personal space); list shows which wikis exist. A write starts an ingest that locks the wiki for a few minutes: to write several files, pass ingest: false on each and ingest: true on the last. Like mem_recall it uses the session's space by default: your personal space, or a shared space bound to the session. A write to a shared space asks the person and shows the file and an excerpt; a write to your personal space does not. delete removes one source file (filename), one generated page (ref), or a whole wiki (wiki_id alone): without confirm it only previews; with confirm: true it always asks the person, then deletes and reads it back. Never put things to do (mem_commitments), where a project stands, or person and project pages (mem_page) here.",
605
605
  input: {
606
606
  type: "object",
607
607
  properties: {