@unblocklabs/unblock-memory 0.3.21 → 0.3.23

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.
@@ -0,0 +1,217 @@
1
+ # Response quality and sentiment
2
+
3
+ [Overview](../README.md) · [Configuration and credentials](configuration.md)
4
+
5
+ `responseAudit` evaluates bounded human-agent exchanges in the background. It is
6
+ separate from chunk-quality auditing and never changes memories or prompts. It
7
+ creates private response-review tasks, not memory-curation tasks.
8
+ Its primary purpose is tracking delivery quality over time: visible fulfillment,
9
+ deliverable fit, clear underdelivery and its observable reason. Memory gaps are only
10
+ an optional diagnostic lead, not a proxy for performance.
11
+
12
+ This reads the host transcript database directly: it does not require a `sessions`
13
+ corpus, People Primer, whisperers or clustering. Configure [shared TypeSafe
14
+ credentials](configuration.md#shared-typesafe-credentials) separately. Begin with
15
+ the dry-run command below before requesting inference.
16
+ Only approved Slack sender IDs with trusted `senderKind: human` or owner metadata
17
+ qualify (older Slack records use unknown senderKind even for known owners).
18
+ Explicit bots, unverified identities, internal messages, other senders and thread changes form
19
+ hard boundaries. Synthetic delivery mirrors and gateway-injected answers are excluded.
20
+ Assistant progress messages are grouped with the terminal answer.
21
+ Recognized Slack envelopes are stripped even inside `upstreamUserText`; embedded
22
+ history is not treated as current human text. Ambiguous envelopes are excluded.
23
+ Removed history marks the context as limited; ordinary Markdown/JSON is preserved.
24
+ Human feedback closes when the next assistant turn starts. Still-open feedback,
25
+ no-response exchanges, incomplete/failed turns and oversized inputs are not graded.
26
+
27
+ Place this fragment under `plugins.entries.unblock-memory.config`. The optional
28
+ `memoryCorpora` names must already exist as file corpora; use `[]` to omit memory
29
+ investigation while still tracking response quality and sentiment.
30
+
31
+ ```json
32
+ {
33
+ "responseAudit": {
34
+ "enabled": true,
35
+ "sentimentEnabled": true,
36
+ "senderIds": ["YOUR_SLACK_USER_ID"],
37
+ "chatTypes": ["direct"],
38
+ "historyMessages": 6,
39
+ "lookbackDays": 30,
40
+ "maxEpisodes": 20,
41
+ "intervalMinutes": 60,
42
+ "memoryCorpora": ["memory", "knowledge"]
43
+ }
44
+ }
45
+ ```
46
+
47
+ This is explicit approval to send those exchanges to TypeSafe. Sender IDs apply
48
+ across the agent's Slack accounts; use only identities approved in all such accounts.
49
+ `memoryCorpora` is optional and separately approves configured **file** corpora for
50
+ memory-gap investigation. Leave it empty to send no indexed memory evidence.
51
+ `typesafe.enabled: false` or missing credentials prevents evaluation. An interval
52
+ of zero means manual-only. Defaults are disabled, no approved senders, direct chats,
53
+ 6 preceding visible messages, 30 days, 20 episodes per run and a 60-minute interval.
54
+ `sentimentEnabled` defaults to **true within that opt-in audit**; it does not bypass
55
+ approved senders or TypeSafe credentials. Set it false to omit polarity, annoyance,
56
+ frustration and intensity questions while retaining quality/repair judgments.
57
+ `intervalMinutes` controls their shared cadence; no second sentiment timer is needed.
58
+ For example, `720` means every 12 hours; `0` means manual-only. `maxEpisodes`
59
+ defaults to 20 per run (maximum 100), so one scheduled run may not clear a backlog.
60
+ The Gateway checks a durable per-agent due time on startup and every minute (no
61
+ agent-turn cron or separate launchd job). First enablement waits one interval;
62
+ restarts preserve the due time and an overdue schedule gets one bounded catch-up,
63
+ not one run per missed interval. Each attempt advances the due time before work,
64
+ including missing-key skips, failures or interrupted runs, to prevent retry storms.
65
+ Changing the interval recalculates the due time from the last scheduled attempt
66
+ (or initial enablement). The Gateway must be running; manual audits do not change
67
+ the automatic schedule. Missing/unreadable credentials skip all quality and sentiment
68
+ inference without failing Gateway startup or normal memory functionality.
69
+ Changing the interval does not invalidate cached results. Changing the sentiment
70
+ toggle selects a separate reporting cohort, so older missing sentiment is not
71
+ treated as neutral; unchanged quality/feedback stages are reused across the toggle.
72
+
73
+ Operator commands (not agent tools):
74
+
75
+ ```sh
76
+ openclaw memory-responses audit --agent main --dry-run
77
+ openclaw memory-responses audit --agent main
78
+ openclaw memory-responses report --agent main
79
+ openclaw memory-responses report --agent main --episode EPISODE_ID
80
+ openclaw memory-responses report --agent main --sender SLACK_USER_ID --account ACCOUNT_SCOPE --bucket day --since 2026-09-01 --until 2026-10-01
81
+ openclaw memory-responses report --agent main --person PERSON_ID
82
+ openclaw memory-responses tasks --agent main
83
+ openclaw memory-responses review --agent main --id TASK_ID --status deferred --reviewer human --note "Review the linked exchanges before changing preferences"
84
+ openclaw memory-responses annotate --agent main --date 2026-09-18 --kind prompt --note "Known prompt revision deployed"
85
+ openclaw memory-responses retry-failed --agent main
86
+ ```
87
+
88
+ Reports group by scoped human identity as well as task/model/time. Names are not
89
+ identity keys. Existing active people-store links are resolved read-only at assessment
90
+ time; missing links do not prevent analysis. Unknown account scopes stay isolated
91
+ per session. No new identity fields are sent to TypeSafe. Date ranges are UTC with
92
+ an inclusive start and exclusive end. `periodStart` identifies a day/week bucket;
93
+ legacy `week`/`fromWeek`/`toWeek` fields remain aliases. `--task-type` and `--model`
94
+ further narrow comparisons. Human-specific scores are not rankings of the humans:
95
+ task difficulty, feedback habits and selection bias remain important.
96
+
97
+ Session checkpoints hash bounded active source bytes; unchanged sessions skip
98
+ extraction and all inference. Changed sessions are re-extracted within the existing
99
+ budget, then stage hashes reuse unchanged quality, feedback, sentiment and later
100
+ evidence judgments. Only hashes/counts are checkpointed, never a transcript copy.
101
+ A persisted cursor rotates through discovery and tracked-session reconciliation;
102
+ `deferredByLimit` includes known backlog and a lower-bound marker for unvisited
103
+ sessions. `stages` exposes pending/failed/succeeded counts and exhausted retries
104
+ for the cohort/date range, before person filters. `retry-failed` only resets failed
105
+ work; successful stages remain cached. Source freshness is checked before activation.
106
+
107
+ Review tasks distinguish `delivery_quality` shortfalls from `human_experience`
108
+ complaints. The latter requires at least 0.8 probability mass at intensity levels
109
+ 2/3, at least 0.8 combined mass across agent-related/mixed targets, and annoyance
110
+ or frustration yes-probability of at least 0.8. It uses grouped probabilities, not
111
+ an expected-intensity cutoff or certainty about one precise target. These are
112
+ review leads, not proof the agent was at fault. Status can be `pending`, `resolved`,
113
+ `dismissed` or `deferred`, with a required review note.
114
+ Stable task keys include exchange, scoped human and issue
115
+ family. Decisions survive rescoring; stale source evidence and superseded findings
116
+ are labeled separately. Review status/provenance never changes the raw judgments.
117
+ Tasks and change annotations are operator-only and stay out of memory/whisperer
118
+ prompts. `--reviewer` records human/agent provenance, not authentication or a new
119
+ permission grant. Task lists disclose their 1,000-item cap. There are no automatic
120
+ dossier updates: review the evidence and approve any concrete preference separately.
121
+ Old cohorts remain stored; the first staged-cohort run does not silently import
122
+ unverified older rubric judgments. Audit-history retention is not automatic.
123
+
124
+ Separate original-answer and feedback passes prevent human feedback from influencing the original
125
+ fulfillment/deliverable-fit grade. The feedback pass distinguishes acceptance,
126
+ correction, continuation, unrelated replies, expressed sentiment, repeated constraints
127
+ and avoidable rework. Current-index memory investigation runs only for a strong
128
+ memory-gap signal: lexical retrieval selects up to three whole short documents from
129
+ approved collections. This is an investigation lead, **not proof of historical
130
+ availability, factual truth, or agent fault**. Tool-call counts do not establish what
131
+ the model saw or whether it should have searched. Unseen artifacts are unassessable.
132
+
133
+ Deliverable kind/format/scope has its own assessability gate, independent of whether
134
+ execution or external facts can be verified. Feedback attribution distinguishes the
135
+ current answer, earlier behavior, delivery, missing proactive action, external events,
136
+ new work and mixed/unclear targets. A reported forgotten instruction does not prove
137
+ searchable memory existed. A third, separate request examines the original exchange,
138
+ human feedback and available next assistant block for specific reported shortfalls,
139
+ acknowledgment, explicit factual corrections, delivery failures and regressions. These are
140
+ retrospective signals, not independently verified facts and never inputs to the
141
+ original grade. Clean text preceding a synthetic error/delivery notice can be assessed
142
+ as **partial** evidence; the notice itself is excluded and no successful completion
143
+ is inferred. Later evidence is capped at six messages/12K characters; incomplete,
144
+ unsafe or oversized blocks stay explicitly pending/unavailable/oversized. New later
145
+ evidence changes the input hash; only changed assessment stages are re-evaluated,
146
+ within normal audit budgets. Successful stages survive failures in later stages.
147
+ When the next block is unavailable, the third pass uses only the original exchange
148
+ and feedback; it cannot infer a missing delivery from missing later evidence.
149
+
150
+ Code combines narrow, confident evidence into an **observed outcome**, preserving
151
+ its basis and reason. A concrete original-answer shortfall or later admission takes
152
+ precedence over praise. Broad reported failures are used only when they do not
153
+ depend on a newly introduced requirement. Accurate explanations of earlier mistakes,
154
+ ordinary follow-ups, necessary clarification and unseen work are not automatically
155
+ failures. Sentiment and earlier-workflow complaints remain separate review signals.
156
+ Sentiment includes independent annoyance and frustration yes-probabilities (both
157
+ can apply), plus an expressed-dissatisfaction intensity score from 0 to 3. Intensity
158
+ means no expressed displeasure / restrained displeasure / pointed complaint /
159
+ explicit rejection or loss of trust. It is **not confidence or failure severity**.
160
+ External frustration, brevity and factual corrections alone do not establish
161
+ annoyance or frustration; mixed praise and complaints can still carry both signals.
162
+ Daily/weekly reports show dissatisfaction, annoyance and frustration rates, intensity
163
+ means, unknown counts and their own assessment denominators. Unassessed results
164
+ are never counted as neutral. Sentiment deltas require 20 samples in both periods
165
+ and matching assessment coverage; they remain descriptive, not causal evidence.
166
+ Outcome, evidence basis and failure reasons remain distinct: a correction does not
167
+ automatically mean `incorrect_claim`. Confident reason judgments and direct
168
+ delivery/regression admissions supply reasons; otherwise `reasonStatus` is
169
+ `uncertain`. `reasonDetails` retain each label's source and strength, distinguishing
170
+ Choice confidence from Noul yes-probability. Multiple supported reasons can coexist.
171
+ `reportVersion` identifies composition/reporting semantics independently of the
172
+ judge rubric, allowing cached judgments to be re-reported without re-inference.
173
+
174
+ Results live in operator-only tables in the agent's private
175
+ `unblock-memory/unblock-memory.sqlite`, outside the memory index. These tables
176
+ are not searched or injected into agent prompts. They store judgments and source event references/hashes, not copies
177
+ of conversations. Identical successful inputs are cached; source rewrites invalidate
178
+ in-scope results on the next scan. Reports partition by fixed judge/rubric/context
179
+ configuration, scoped human, UTC day/week, task type and agent model. They expose eligible/assessed
180
+ counts, excluded cases, confidence-qualified score means with per-dimension denominators, rework rates with Wilson
181
+ intervals, and evidence IDs. Small groups (<20) are marked explicitly. Confidence
182
+ thresholds are provisional, not calibrated guarantees. Human-reviewed evaluation
183
+ data is still needed before drawing performance conclusions.
184
+ Reports include dated clear-underdelivery examples and reason counts. Descriptive
185
+ score deltas compare successive available UTC buckets within the same human, task type,
186
+ agent model and rubric/configuration, with at least 20 confident scores per dimension
187
+ in each period and unchanged scored coverage; changed coverage withholds the score
188
+ delta. Outcome trends show acknowledgment, reported-shortfall and unknown rates
189
+ against **all evaluated exchanges**, with at least 20 evaluated exchanges per period.
190
+ Read the three rates together: fewer acknowledgments can mean more unknowns, not
191
+ more failures. Every delta includes before/after values, sample counts, denominator
192
+ and coverage-change flags. Unknown task types/models cannot produce deltas. These
193
+ are not statistical change-point detections or proof of causality; model/version
194
+ changes remain visible as separate groups rather than silently mixing cohorts.
195
+ The legacy `observedSuccessRate` group field remains acknowledgment / known outcomes
196
+ for compatibility, but is not used for trends. Unknowns are never successes.
197
+ Coverage changes and threshold variability can move rates; acknowledgment is not
198
+ factual verification. Week buckets
199
+ may be partial, and several exchanges in one session are not independent. Wilson
200
+ intervals are descriptive, not calibrated confidence about overall agent ability.
201
+
202
+ Each run selects at most 100 recent sessions for inference, each at most 2,000 active events/2M
203
+ characters; episodes must fit 24K characters and six feedback messages without
204
+ truncating the answer. Coverage counts describe the scanned sessions; only episodes
205
+ within `lookbackDays` are judged. Caps, failures and no-feedback cases remain visible.
206
+ Saved sessions in the report window are also reconciled independently of that
207
+ selection, so removing an entire active branch retires its scores. Oversized saved
208
+ sessions defer reconciliation rather than being treated as deleted; the report
209
+ exposes `reconciledSessions` and `reconciliationDeferred`. All reconciliation shares
210
+ the run deadline. Freshness checks compare the assessed episode, not unrelated
211
+ later session activity. Actual snapshot races do not exhaust provider retries.
212
+ The whole run has a two-minute deadline, at most three provider attempts per input (ten-minute
213
+ backoff), and a cross-process lease. Scheduling never starts inference on the agent
214
+ turn path or boots a QMD manager. No model downloads or source re-indexing occur.
215
+ The report is observational: different task mixes, selective human replies and judge
216
+ changes can produce apparent trends. It does not automatically declare regressions,
217
+ rewrite prompts, or treat silence as success.