@gamaze/hicortex 0.25.0 → 0.26.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.
@@ -7,13 +7,13 @@
7
7
  * memory — a menu, not the meal); the agent lazy-loads full content with
8
8
  * `hicortex_get(id)` only when a line is actually relevant.
9
9
  *
10
- * Strengthening semantics (the recall/decay alignment):
11
- * - Appearing in the index = exposure: shown_count + last_accessed refresh
12
- * (mild, temporary strengthen — the decay clock resets) via
13
- * storage.touchMemoriesShown. NO access_count bump: the promotion signal
14
- * (#448), the prune shield, and the adoption metric stay driven by real
15
- * use.
16
- * - hicortex_get = use: full strengthen (access_count + 1).
10
+ * Strengthening semantics (the recall/decay alignment, refined #569):
11
+ * - Appearing in the index = exposure ONLY: shown_count via
12
+ * storage.touchMemoriesShown. NO last_accessed write (that is the use
13
+ * clock — #569 closed the exposure-refresh loop that kept never-fetched
14
+ * noise young forever) and NO access_count bump: the promotion signal
15
+ * (#448) and the adoption metric stay driven by real use.
16
+ * - hicortex_get = use: full strengthen (access_count + 1, clock refresh).
17
17
  *
18
18
  * Anti-bloat gates: relevance floor (measured cosine, or a real BM25 match),
19
19
  * per-session TURN-based dedup (SessionRecallRegistry), short-prompt skip,
@@ -8,13 +8,13 @@
8
8
  * memory — a menu, not the meal); the agent lazy-loads full content with
9
9
  * `hicortex_get(id)` only when a line is actually relevant.
10
10
  *
11
- * Strengthening semantics (the recall/decay alignment):
12
- * - Appearing in the index = exposure: shown_count + last_accessed refresh
13
- * (mild, temporary strengthen — the decay clock resets) via
14
- * storage.touchMemoriesShown. NO access_count bump: the promotion signal
15
- * (#448), the prune shield, and the adoption metric stay driven by real
16
- * use.
17
- * - hicortex_get = use: full strengthen (access_count + 1).
11
+ * Strengthening semantics (the recall/decay alignment, refined #569):
12
+ * - Appearing in the index = exposure ONLY: shown_count via
13
+ * storage.touchMemoriesShown. NO last_accessed write (that is the use
14
+ * clock — #569 closed the exposure-refresh loop that kept never-fetched
15
+ * noise young forever) and NO access_count bump: the promotion signal
16
+ * (#448) and the adoption metric stay driven by real use.
17
+ * - hicortex_get = use: full strengthen (access_count + 1, clock refresh).
18
18
  *
19
19
  * Anti-bloat gates: relevance floor (measured cosine, or a real BM25 match),
20
20
  * per-session TURN-based dedup (SessionRecallRegistry), short-prompt skip,
@@ -358,7 +358,8 @@ async function handleRecallIndex(deps, body) {
358
358
  // before any precision recording, so a pure plumbing payload (CC delivers
359
359
  // task-notifications/command envelopes as user-role messages; any client
360
360
  // could POST one) gets {block: null} with NO recall_pushes row, NO turn
361
- // burn, NO shown_count bump, NO last_accessed refresh. The SAME shared
361
+ // burn, NO shown_count bump — no exposure of any kind (and since #569
362
+ // exposure never writes last_accessed anyway). The SAME shared
362
363
  // classifier the hook client guards with (wrapper-prompt.ts) — defense in
363
364
  // depth. A wrapper carrying real payload prose falls through and recalls on
364
365
  // the full text, exactly today's behavior (owner decision 4).
@@ -497,7 +498,10 @@ async function handleRecallIndex(deps, body) {
497
498
  // Fail-soft like every recording site.
498
499
  if (deps.precision) {
499
500
  try {
500
- deps.precision.recorder(deps.db, { sessionId, prompt, ids: [] });
501
+ // #578: the canonicalized project label threads into the push row
502
+ // too (attribution) — filters.project is already computed above; a
503
+ // silent turn carries it like any other.
504
+ deps.precision.recorder(deps.db, { sessionId, prompt, ids: [], project: filters.project ?? null });
501
505
  }
502
506
  catch (err) {
503
507
  console.warn(`[hicortex] recall-precision push recording failed (fail-soft): ` +
@@ -510,8 +514,8 @@ async function handleRecallIndex(deps, body) {
510
514
  deps.registry.markShown(sessionId, ids);
511
515
  const nowIso = new Date().toISOString();
512
516
  // #476 Memory Precision: record the push + per-line events IN THE SAME
513
- // TRANSACTION as the exposure write (the recorder owns the unit — it calls
514
- // touchMemoriesShown inside its own transaction). FAIL-SOFT: on any error
517
+ // TRANSACTION as the exposure counter write (the recorder owns the unit —
518
+ // it calls touchMemoriesShown inside its own transaction). FAIL-SOFT: on any error
515
519
  // (or when the seams are absent — library callers, test doubles) the plain
516
520
  // exposure write runs instead, so shown_count NEVER depends on telemetry.
517
521
  let exposureWritten = false;
@@ -521,7 +525,7 @@ async function handleRecallIndex(deps, body) {
521
525
  deps.precision.promptEmbed(prompt),
522
526
  deps.precision.basis(deps.db),
523
527
  ]);
524
- deps.precision.recorder(deps.db, { ts: nowIso, sessionId, prompt, ids, promptEmbedding: promptEmb }, basis);
528
+ deps.precision.recorder(deps.db, { ts: nowIso, sessionId, prompt, ids, promptEmbedding: promptEmb, project: filters.project ?? null }, basis);
525
529
  exposureWritten = true;
526
530
  }
527
531
  catch (err) {
@@ -530,8 +534,9 @@ async function handleRecallIndex(deps, body) {
530
534
  }
531
535
  }
532
536
  if (!exposureWritten) {
533
- // Exposure signal: shown_count + last_accessed refresh, NOT access_count.
534
- storage.touchMemoriesShown(deps.db, ids, nowIso);
537
+ // Exposure signal: shown_count only — NOT last_accessed (the use clock,
538
+ // #569), NOT access_count.
539
+ storage.touchMemoriesShown(deps.db, ids);
535
540
  }
536
541
  const lines = picked.map((r) => formatIndexLine(r, titleChars));
537
542
  const block = [
@@ -21,8 +21,9 @@
21
21
  * FAIL-SOFT LAW: recording is telemetry. Any error here is caught by the
22
22
  * CALLER (handleRecallIndex / handleMemoryGet) and swallowed — the recall
23
23
  * response (status 200 + block) is never affected, and the exposure signal
24
- * (touchMemoriesShown) never depends on it (the handler falls back to the
25
- * plain exposure write when recording is absent or fails).
24
+ * (touchMemoriesShown — shown_count only, never the use clock #569) never
25
+ * depends on it (the handler falls back to the plain exposure write when
26
+ * recording is absent or fails).
26
27
  *
27
28
  * The perf law (bounded hot-path cost): the recorder computes cosines with
28
29
  * the request's ALREADY-MEMOIZED prompt embedding (createRecallRetrieveFn's
@@ -31,6 +32,7 @@
31
32
  * that already writes and spends ~100-300 ms embedding and searching.
32
33
  */
33
34
  import type Database from "better-sqlite3";
35
+ import type { QualityTier1, QualityChangeDelta } from "./quality-scoreboard.js";
34
36
  /** One non-skipped /recall-index call to record (recorder seam contract —
35
37
  * recall-index.ts types its precision deps against this). */
36
38
  export interface RecallPushEntry {
@@ -48,14 +50,21 @@ export interface RecallPushEntry {
48
50
  * memoized embed; unused on a silent turn, so no embed is ever spent on
49
51
  * recording). */
50
52
  promptEmbedding?: Float32Array;
53
+ /** #578: the request's CANONICALIZED project label — exactly the value the
54
+ * #566 fence gated with (handleRecallIndex's filters.project). Null when
55
+ * the request carried none. Stored on recall_pushes (migration v26) so the
56
+ * quality scoreboard attributes pushes from the row itself going forward;
57
+ * pre-v26 history attributes via the `#`-prefix join on
58
+ * memories.source_session (segment-scoped — bare equality matches 0). */
59
+ project?: string | null;
51
60
  }
52
61
  /**
53
62
  * Record one /recall-index push: the push row + (when lines were shown) the
54
63
  * per-line kind='shown' event rows, in ONE transaction WITH the existing
55
- * exposure write (storage.touchMemoriesShown — the spec's "same transaction";
56
- * better-sqlite3 nests the inner transaction as a savepoint, so a recording
57
- * failure rolls back the whole unit and the CALLER's fallback re-runs the
58
- * exposure touch alone — shown_count never depends on telemetry).
64
+ * exposure counter write (storage.touchMemoriesShown — the spec's "same
65
+ * transaction"; better-sqlite3 nests the inner transaction as a savepoint, so
66
+ * a recording failure rolls back the whole unit and the CALLER's fallback
67
+ * re-runs the exposure touch alone — shown_count never depends on telemetry).
59
68
  *
60
69
  * similarity = cosine(memory embedding, PURE prompt embedding), computed
61
70
  * UNIFORMLY via cosineBetweenVectors against the stored vector — FTS-sourced
@@ -84,6 +93,13 @@ export declare function recordRecallFetch(db: Database.Database, memoryId: strin
84
93
  * window the store no longer has rows for). Inclusive cutoff: the last N
85
94
  * calendar days with today counted stay (day >= today−(N−1)), the complement
86
95
  * is deleted — retained rows == window rows.
96
+ *
97
+ * #578 retention split — recall_verdicts rides the SAME horizon with ONE
98
+ * carve-out: grader='owner' rows are NEVER dropped (they are the owner's
99
+ * calibration reference, tiny volume by construction — about
100
+ * five thumbs a week). Machine rows ('auto', 'revealed') prune with the events
101
+ * they were derived from — a revealed verdict outliving its own event rows
102
+ * would claim a window the store no longer holds.
87
103
  */
88
104
  export declare function pruneRecallPrecision(db: Database.Database): void;
89
105
  /**
@@ -159,7 +175,15 @@ export interface MemoryPrecisionLevel2 {
159
175
  uses_per_showing: number | null;
160
176
  }
161
177
  /** The whole /dashboard/data memory_precision block (one card's payload,
162
- * budget ≤ 2 KB — the top-3 divergence lines are the only content). */
178
+ * budget ≤ 2 KB — the top-3 divergence lines are the only content).
179
+ *
180
+ * #578 adds the OPTIONAL `tier1` (deterministic quality metrics — block
181
+ * size, cross-project share + coverage, sub-bar share, recycling) and
182
+ * `changes` (per-registry-entry before/after deltas, computed from raw
183
+ * events at render) beside the original fields; both come from
184
+ * quality-scoreboard.ts and are spread in by handleDashboardData. Optional
185
+ * so older callers (and the ≤ 2 KB test's minimal shapes) keep the base
186
+ * contract; the card guards on their absence like every block before it. */
163
187
  export interface MemoryPrecision {
164
188
  /** The EFFECTIVE window (min(range, retention)); the page renders
165
189
  * "last N days" from this echo, never a hardcoded literal. */
@@ -180,6 +204,11 @@ export interface MemoryPrecision {
180
204
  shown: number;
181
205
  }>;
182
206
  };
207
+ /** #578: the Tier-1 quality metrics over the SAME effective window. */
208
+ tier1?: QualityTier1;
209
+ /** #578: before/after deltas for every change-registry entry the raw
210
+ * event window still covers (numbers computed at render, never frozen). */
211
+ changes?: QualityChangeDelta[];
183
212
  }
184
213
  /** Read-time seams (the #408 experiment pattern — the eval/tests sweep
185
214
  * values through them; production never passes anything). */
@@ -190,6 +219,11 @@ export interface MemoryPrecisionReadOptions {
190
219
  * only the share, never a stored row). */
191
220
  redundantAbove?: number;
192
221
  }
222
+ /** The EFFECTIVE memory-precision window for a range: min(range, retention)
223
+ * — the #578 quality metrics (quality-scoreboard.ts) ride the SAME window
224
+ * as the block they extend, so tier1/changes and level1 never disagree on
225
+ * which days they cover. Exported for handleDashboardData's spread. */
226
+ export declare function effectivePrecisionWindowDays(range: string): number;
193
227
  /**
194
228
  * The window aggregation behind /dashboard/data's memory_precision block
195
229
  * (the readCaptureHealthWindow pattern). Effective window = min(range,
@@ -22,8 +22,9 @@
22
22
  * FAIL-SOFT LAW: recording is telemetry. Any error here is caught by the
23
23
  * CALLER (handleRecallIndex / handleMemoryGet) and swallowed — the recall
24
24
  * response (status 200 + block) is never affected, and the exposure signal
25
- * (touchMemoriesShown) never depends on it (the handler falls back to the
26
- * plain exposure write when recording is absent or fails).
25
+ * (touchMemoriesShown — shown_count only, never the use clock #569) never
26
+ * depends on it (the handler falls back to the plain exposure write when
27
+ * recording is absent or fails).
27
28
  *
28
29
  * The perf law (bounded hot-path cost): the recorder computes cosines with
29
30
  * the request's ALREADY-MEMOIZED prompt embedding (createRecallRetrieveFn's
@@ -70,6 +71,7 @@ exports.recordRecallFetch = recordRecallFetch;
70
71
  exports.pruneRecallPrecision = pruneRecallPrecision;
71
72
  exports.identityServedToAllClients = identityServedToAllClients;
72
73
  exports.createStandingContextBasis = createStandingContextBasis;
74
+ exports.effectivePrecisionWindowDays = effectivePrecisionWindowDays;
73
75
  exports.readMemoryPrecision = readMemoryPrecision;
74
76
  const storage = __importStar(require("./storage.js"));
75
77
  const retrieval_js_1 = require("./retrieval.js");
@@ -80,10 +82,10 @@ const calibration_js_1 = require("./calibration.js");
80
82
  /**
81
83
  * Record one /recall-index push: the push row + (when lines were shown) the
82
84
  * per-line kind='shown' event rows, in ONE transaction WITH the existing
83
- * exposure write (storage.touchMemoriesShown — the spec's "same transaction";
84
- * better-sqlite3 nests the inner transaction as a savepoint, so a recording
85
- * failure rolls back the whole unit and the CALLER's fallback re-runs the
86
- * exposure touch alone — shown_count never depends on telemetry).
85
+ * exposure counter write (storage.touchMemoriesShown — the spec's "same
86
+ * transaction"; better-sqlite3 nests the inner transaction as a savepoint, so
87
+ * a recording failure rolls back the whole unit and the CALLER's fallback
88
+ * re-runs the exposure touch alone — shown_count never depends on telemetry).
87
89
  *
88
90
  * similarity = cosine(memory embedding, PURE prompt embedding), computed
89
91
  * UNIFORMLY via cosineBetweenVectors against the stored vector — FTS-sourced
@@ -103,13 +105,14 @@ function recordRecallPush(db, entry, basis = []) {
103
105
  VALUES (?, ?, ?, ?, ?, ?, 'shown')`);
104
106
  const tx = db.transaction(() => {
105
107
  if (entry.ids.length > 0) {
106
- // The exposure write rides INSIDE the recording transaction (spec: one
107
- // atomic unit). Nested db.transaction → savepoint.
108
- storage.touchMemoriesShown(db, entry.ids, ts);
108
+ // The exposure counter write rides INSIDE the recording transaction
109
+ // (spec: one atomic unit; shown_count only — never the use clock, #569).
110
+ // Nested db.transaction → savepoint.
111
+ storage.touchMemoriesShown(db, entry.ids);
109
112
  }
110
113
  const info = db
111
- .prepare("INSERT INTO recall_pushes (ts, day, session_id, prompt_excerpt) VALUES (?, ?, ?, ?)")
112
- .run(ts, day, entry.sessionId, excerpt);
114
+ .prepare("INSERT INTO recall_pushes (ts, day, session_id, prompt_excerpt, project) VALUES (?, ?, ?, ?, ?)")
115
+ .run(ts, day, entry.sessionId, excerpt, entry.project ?? null);
113
116
  const pushId = Number(info.lastInsertRowid);
114
117
  if (entry.ids.length === 0)
115
118
  return; // silent turn — push row only
@@ -156,10 +159,20 @@ function recordRecallFetch(db, memoryId, ts) {
156
159
  * window the store no longer has rows for). Inclusive cutoff: the last N
157
160
  * calendar days with today counted stay (day >= today−(N−1)), the complement
158
161
  * is deleted — retained rows == window rows.
162
+ *
163
+ * #578 retention split — recall_verdicts rides the SAME horizon with ONE
164
+ * carve-out: grader='owner' rows are NEVER dropped (they are the owner's
165
+ * calibration reference, tiny volume by construction — about
166
+ * five thumbs a week). Machine rows ('auto', 'revealed') prune with the events
167
+ * they were derived from — a revealed verdict outliving its own event rows
168
+ * would claim a window the store no longer holds.
159
169
  */
160
170
  function pruneRecallPrecision(db) {
161
171
  db.exec(`DELETE FROM recall_pushes WHERE day < date('now', '-${calibration_js_1.MEMORY_PRECISION_WINDOW_DAYS - 1} days')`);
162
172
  db.exec(`DELETE FROM recall_events WHERE day < date('now', '-${calibration_js_1.MEMORY_PRECISION_WINDOW_DAYS - 1} days')`);
173
+ db.exec(`DELETE FROM recall_verdicts
174
+ WHERE grader != 'owner'
175
+ AND day < date('now', '-${calibration_js_1.MEMORY_PRECISION_WINDOW_DAYS - 1} days')`);
163
176
  }
164
177
  // ---------------------------------------------------------------------------
165
178
  // Standing-context basis — the redundancy reference (what every session
@@ -263,6 +276,13 @@ function rangeToDays(range) {
263
276
  const n = parseInt(range, 10);
264
277
  return Number.isFinite(n) && n > 0 ? n : null;
265
278
  }
279
+ /** The EFFECTIVE memory-precision window for a range: min(range, retention)
280
+ * — the #578 quality metrics (quality-scoreboard.ts) ride the SAME window
281
+ * as the block they extend, so tier1/changes and level1 never disagree on
282
+ * which days they cover. Exported for handleDashboardData's spread. */
283
+ function effectivePrecisionWindowDays(range) {
284
+ return Math.min(rangeToDays(range) ?? calibration_js_1.MEMORY_PRECISION_WINDOW_DAYS, calibration_js_1.MEMORY_PRECISION_WINDOW_DAYS);
285
+ }
266
286
  /**
267
287
  * The window aggregation behind /dashboard/data's memory_precision block
268
288
  * (the readCaptureHealthWindow pattern). Effective window = min(range,
@@ -282,7 +302,7 @@ function rangeToDays(range) {
282
302
  function readMemoryPrecision(db, range, liveAdoption, opts) {
283
303
  const now = opts?.now ?? new Date();
284
304
  const redundantAbove = opts?.redundantAbove ?? calibration_js_1.MEMORY_PRECISION_REDUNDANT_ABOVE;
285
- const windowDays = Math.min(rangeToDays(range) ?? calibration_js_1.MEMORY_PRECISION_WINDOW_DAYS, calibration_js_1.MEMORY_PRECISION_WINDOW_DAYS);
305
+ const windowDays = effectivePrecisionWindowDays(range);
286
306
  // Inclusive window start (UTC YYYY-MM-DD): today counts as day 1.
287
307
  const cutoffDay = new Date(now.getTime() - (windowDays - 1) * DAY_MS).toISOString().slice(0, 10);
288
308
  // --- Level 1: group the window's shown events (raw values, no thresholds
package/dist/retrieval.js CHANGED
@@ -982,8 +982,9 @@ async function retrieve(db, embedFn, query, options) {
982
982
  source: t.source,
983
983
  }));
984
984
  // 7. Strengthen — skipped for pushed recall (#192): appearing in a pushed
985
- // index is exposure, not use; the /recall-index path records shown_count +
986
- // last_accessed via storage.touchMemoriesShown instead.
985
+ // index is exposure, not use; the /recall-index path records shown_count
986
+ // via storage.touchMemoriesShown instead (#569: exposure never touches the
987
+ // use clock, so no last_accessed write happens there either).
987
988
  if (!options?.noStrengthen) {
988
989
  strengthen(db, top.map((t) => t.mem), now);
989
990
  }
package/dist/state.d.ts CHANGED
@@ -136,6 +136,15 @@ export interface HicortexState {
136
136
  * (`stages.reconsolidation.band_stats`).
137
137
  */
138
138
  resolutionBandStats?: Record<string, ResolutionBandStat>;
139
+ /**
140
+ * #578 — the weekly quality-grade stage's ISO-week cursor ("YYYY-Www",
141
+ * UTC). Set to the week a pass COMPLETED (the supersessionCursor
142
+ * advance-past-confirmed-work convention): a capped, deadlined, or failed
143
+ * pass holds the cursor so the ungraded remainder retries on the next
144
+ * nightly — dup-over-loss, never a hole in the trend. Absent = the stage
145
+ * has never completed a week.
146
+ */
147
+ qualityGradeWeek?: string;
139
148
  }
140
149
  /**
141
150
  * Load the state file. Returns an empty state if the file is missing
package/dist/storage.d.ts CHANGED
@@ -66,12 +66,17 @@ export declare function enrichMemory(db: Database.Database, memoryId: string, no
66
66
  } | null;
67
67
  /**
68
68
  * Record that memories appeared in a pushed recall index (#192): bump
69
- * shown_count and refresh last_accessed (a mild strengthen — the decay clock
70
- * resets so topically-live memories stop sinking) WITHOUT touching
71
- * access_count, which stays reserved for real use (the promotion signal
72
- * #448 + the prune shield).
73
- */
74
- export declare function touchMemoriesShown(db: Database.Database, memoryIds: string[], nowIsoStr: string): void;
69
+ * shown_count ONLY. #569 closed the exposure-refresh loop: last_accessed is
70
+ * the USE clock — the clock effectiveStrength decays on, i.e. the strength
71
+ * term of computeScore, the stageDecayPrune predicate, and the
72
+ * stageMemoryCapEviction ordering — and a memory the index keeps choosing
73
+ * must still age when nobody ever fetches it. Exposure is not use. It is
74
+ * written ONLY by insert (= created_at), strengthenMemory (real use),
75
+ * enrichMemory (owner corroboration), updateMemory (explicit), and the dedup
76
+ * canonical merge (max). access_count likewise stays reserved for real use
77
+ * (the promotion signal #448 + the adoption metric).
78
+ */
79
+ export declare function touchMemoriesShown(db: Database.Database, memoryIds: string[]): void;
75
80
  /**
76
81
  * Delete a memory, its vector, its tags, and all its links.
77
82
  */
package/dist/storage.js CHANGED
@@ -172,8 +172,9 @@ const ALLOWED_UPDATE_FIELDS = new Set([
172
172
  "last_accessed",
173
173
  "access_count",
174
174
  // shown_count is normally maintained by touchMemoriesShown (bulk +1 per
175
- // recall-index appearance); it's also allowed here so `hicortex dedup`
176
- // (#100) can sum a merged cluster's counters onto the canonical row.
175
+ // recall-index appearance — exposure only, never the use clock, #569); it's
176
+ // also allowed here so `hicortex dedup` (#100) can sum a merged cluster's
177
+ // counters onto the canonical row.
177
178
  "shown_count",
178
179
  "source_agent",
179
180
  "source_session",
@@ -258,20 +259,25 @@ function enrichMemory(db, memoryId, nowIsoStr) {
258
259
  }
259
260
  /**
260
261
  * Record that memories appeared in a pushed recall index (#192): bump
261
- * shown_count and refresh last_accessed (a mild strengthen — the decay clock
262
- * resets so topically-live memories stop sinking) WITHOUT touching
263
- * access_count, which stays reserved for real use (the promotion signal
264
- * #448 + the prune shield).
265
- */
266
- function touchMemoriesShown(db, memoryIds, nowIsoStr) {
262
+ * shown_count ONLY. #569 closed the exposure-refresh loop: last_accessed is
263
+ * the USE clock — the clock effectiveStrength decays on, i.e. the strength
264
+ * term of computeScore, the stageDecayPrune predicate, and the
265
+ * stageMemoryCapEviction ordering — and a memory the index keeps choosing
266
+ * must still age when nobody ever fetches it. Exposure is not use. It is
267
+ * written ONLY by insert (= created_at), strengthenMemory (real use),
268
+ * enrichMemory (owner corroboration), updateMemory (explicit), and the dedup
269
+ * canonical merge (max). access_count likewise stays reserved for real use
270
+ * (the promotion signal #448 + the adoption metric).
271
+ */
272
+ function touchMemoriesShown(db, memoryIds) {
267
273
  if (memoryIds.length === 0)
268
274
  return;
269
275
  const stmt = db.prepare(`UPDATE memories
270
- SET shown_count = COALESCE(shown_count, 0) + 1, last_accessed = ?
276
+ SET shown_count = COALESCE(shown_count, 0) + 1
271
277
  WHERE id = ?`);
272
278
  const run = db.transaction((ids) => {
273
279
  for (const id of ids)
274
- stmt.run(nowIsoStr, id);
280
+ stmt.run(id);
275
281
  });
276
282
  run(memoryIds);
277
283
  }
package/dist/types.d.ts CHANGED
@@ -661,6 +661,23 @@ export interface HicortexConfig {
661
661
  * value is ignored (warned), never coerced.
662
662
  */
663
663
  distillQueue?: boolean;
664
+ /**
665
+ * #582 explicit opt-in for the weekly recall-quality grading lane. Default
666
+ * OFF — the lane sends prompt-derived text to a third-party decisions
667
+ * endpoint, so it runs only when this is `true` AND `qualityGradeModel` is
668
+ * set AND the endpoint key resolves; anything missing fails CLOSED (the
669
+ * stage skips with a greppable health line, never an error). Read through
670
+ * readStrictBoolean — a non-boolean value is ignored (warned), never
671
+ * coerced, and the lane stays off.
672
+ */
673
+ qualityGrading?: boolean;
674
+ /**
675
+ * #582 the model id the weekly grading lane requests when `qualityGrading`
676
+ * is on. No default — an egress path never gets an implicit model choice;
677
+ * absent/blank (read through readStringConfig) the stage skips with its
678
+ * own health line.
679
+ */
680
+ qualityGradeModel?: string;
664
681
  /**
665
682
  * #529 optional interactive-yield signal: a URL the drain polls BETWEEN
666
683
  * items. A 2xx answer whose body is JSON with a truthy `busy` field — or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamaze/hicortex",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "Persistent agent identity for AI agents \u2014 a hand-edited identity layer, nightly-distilled experience, and lessons injected every session, shared across your whole fleet. Works with Hermes, OpenClaw, Claude Code, Pi, and opencode.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/server.json CHANGED
@@ -3,12 +3,12 @@
3
3
  "name": "io.github.gamaze-labs/hicortex",
4
4
  "title": "Hicortex \u2014 AI Fleet Memory",
5
5
  "description": "Shared fleet memory for AI agents: nightly self-correction, recall every prompt (supported agents).",
6
- "version": "0.25.0",
6
+ "version": "0.26.0",
7
7
  "packages": [
8
8
  {
9
9
  "registryType": "npm",
10
10
  "identifier": "@gamaze/hicortex",
11
- "version": "0.25.0",
11
+ "version": "0.26.0",
12
12
  "transport": {
13
13
  "type": "stdio",
14
14
  "command": "npx",