@gamaze/hicortex 0.26.3 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +21 -13
  2. package/assets/dashboard.html +95 -3
  3. package/dist/backfill-privacy.d.ts +109 -0
  4. package/dist/backfill-privacy.js +304 -0
  5. package/dist/capture.d.ts +60 -0
  6. package/dist/capture.js +90 -1
  7. package/dist/classification.d.ts +315 -0
  8. package/dist/classification.js +525 -0
  9. package/dist/classify-domains.js +24 -7
  10. package/dist/cli.js +80 -0
  11. package/dist/cluster.d.ts +15 -8
  12. package/dist/cluster.js +10 -3
  13. package/dist/confidential-marker.d.ts +103 -0
  14. package/dist/confidential-marker.js +285 -0
  15. package/dist/consolidate.d.ts +65 -5
  16. package/dist/consolidate.js +275 -48
  17. package/dist/dashboard.d.ts +32 -0
  18. package/dist/dashboard.js +33 -0
  19. package/dist/db.js +49 -1
  20. package/dist/dedup.d.ts +5 -3
  21. package/dist/dedup.js +26 -12
  22. package/dist/distill-queue.d.ts +34 -1
  23. package/dist/distill-queue.js +57 -10
  24. package/dist/graph.d.ts +28 -3
  25. package/dist/graph.js +46 -4
  26. package/dist/hermes-transcript-reader.js +5 -0
  27. package/dist/init.d.ts +18 -9
  28. package/dist/init.js +111 -81
  29. package/dist/marker-key-api.d.ts +79 -0
  30. package/dist/marker-key-api.js +96 -0
  31. package/dist/mcp-server.js +317 -32
  32. package/dist/nightly.js +36 -7
  33. package/dist/opencode-transcript-reader.js +3 -0
  34. package/dist/pi-transcript-reader.js +3 -0
  35. package/dist/prompts.d.ts +33 -1
  36. package/dist/prompts.js +37 -2
  37. package/dist/recall-index.d.ts +19 -9
  38. package/dist/recall-index.js +14 -4
  39. package/dist/recall-precision.js +3 -1
  40. package/dist/reconsolidation.d.ts +10 -0
  41. package/dist/reconsolidation.js +80 -17
  42. package/dist/redact.d.ts +9 -1
  43. package/dist/redact.js +32 -1
  44. package/dist/rescore-importance.js +21 -4
  45. package/dist/retrieval.d.ts +23 -6
  46. package/dist/retrieval.js +41 -15
  47. package/dist/seed-lesson.js +3 -1
  48. package/dist/storage.d.ts +23 -4
  49. package/dist/storage.js +43 -11
  50. package/dist/transcript-reader.d.ts +10 -0
  51. package/dist/transcript-reader.js +13 -0
  52. package/dist/type-classify.js +22 -7
  53. package/dist/types.d.ts +117 -15
  54. package/dist/uninstall.js +6 -5
  55. package/hermes-plugin/hicortex/README.md +4 -0
  56. package/hermes-plugin/hicortex/client.py +36 -9
  57. package/hermes-plugin/hicortex/plugin.yaml +1 -1
  58. package/hermes-plugin/hicortex/provider.py +28 -6
  59. package/package.json +1 -1
  60. package/server.json +2 -2
package/dist/uninstall.js CHANGED
@@ -124,11 +124,12 @@ async function runUninstall() {
124
124
  return;
125
125
  }
126
126
  console.log();
127
- // 1. Stop and remove daemon + capture/nightly timers (all units, or a timer
128
- // keeps firing against a half-removed install). Since 0.17 there are two
129
- // scheduled jobs: the capture timer (hicortex-capture) and the
130
- // consolidation timer (hicortex-nightly); remove both either way (a client
131
- // install has no consolidation timer, a server install has both).
127
+ // 1. Stop and remove the daemon + every Hicortex timer (or a timer keeps
128
+ // firing against a half-removed install). Current installs have one
129
+ // scheduled job — the consolidation timer (hicortex-nightly; server /
130
+ // co-located only). Legacy units are removed too: the capture watchdog
131
+ // (hicortex-capture, retired #596 — an old install keeps it until its
132
+ // next init/uninstall) and the pre-0.17 single nightly.
132
133
  const os = (0, node_os_1.platform)();
133
134
  if (os === "darwin") {
134
135
  for (const name of ["com.gamaze.hicortex.plist", "com.gamaze.hicortex-nightly.plist", "com.gamaze.hicortex-capture.plist"]) {
@@ -27,6 +27,10 @@ The plugin warns once at startup when `hicortex_url` is plain `http://` on a non
27
27
 
28
28
  That's the whole surface. No `sync_turn`, no compaction/session-end capture — those are intentionally absent.
29
29
 
30
+ ### Confidential-circle membership on every read (0.7.11, server ≥ 0.27)
31
+
32
+ Servers with a `confidentialAgents` roster (the #332 classification) serve the **confidential pool** only to requests that identify a rostered agent — every other caller gets a hard omit (a confidential memory's single fetch answers 404). The plugin threads its already-resolved profile id (the same `agent_name` / `HERMES_PROFILE` / `HERMES_HOME` resolution as the standing-context layer) into **every read call**: the per-turn `/recall-index`, the legacy `/search` fallback, the session-start lessons fetch, and the `hicortex_search` / `hicortex_get` / `hicortex_recent` / `hicortex_lessons` / `hicortex_graph` tools. A rostered profile therefore sees its own confidential memories and confidential lessons end-to-end; an unrostered profile sees exactly what it saw before. Servers without the feature ignore the parameter — the plugin change is invisible on old servers, and nothing changes on servers with no roster configured.
33
+
30
34
  ### Pushed recall index (0.7.0, server ≥ 0.14)
31
35
 
32
36
  Instead of injecting full memory content every turn, `prefetch` sends the user's message to the server's `POST /recall-index` and injects the returned **index block** verbatim — one line per memory (id, title, date), capped and relevance-gated server-side. The agent fetches full content with `hicortex_get(id)` only when a line is actually relevant; that fetch is what strengthens the memory (exposure ≠ use). All tuning knobs (`recallMaxItems`, `recallMinSimilarity`, `recallReshowTurns`, `recallMinPromptChars`, …) are release-managed constants on the server (they ship with each release and change only with published eval evidence) — the plugin carries none, and neither does the server's config. Dedup is turn-based and server-side per session; the plugin resets it at `initialize` (the Hermes `MemoryProvider` interface exposes no compaction signal, so a mid-session context rebuild cannot trigger a reset — the server's turn-based re-show window covers that gap). Against a pre-0.14 server (404) the plugin falls back to the 0.6.x `GET /search` full-content prefetch, fail-soft, re-probing the endpoint every 10 minutes so a later server upgrade is picked up without a gateway restart. The recall calls carry the profile's configured `default_project` (and `mission_domains`) and use a short dedicated timeout (1.5 s) so a slow server can never stall a turn. (`privacy_filter` is deprecated since 0.7.2 — the server ignores privacy; see [Configuration](#configure-activate).)
@@ -176,10 +176,15 @@ class HicortexClient:
176
176
  limit: int = 5,
177
177
  project: Optional[str] = None,
178
178
  privacy: Optional[str] = None,
179
+ agent: Optional[str] = None,
179
180
  ) -> list[dict]:
181
+ """Search shared memory. ``agent`` (plugin 0.7.11, server ≥ #332) is
182
+ this profile's id — a server-rostered id also sees the confidential
183
+ pool; absent/unknown stays non-member (the server hard-omits
184
+ confidential rows). Older servers ignore the parameter."""
180
185
  return self._get(
181
186
  "/search",
182
- {"query": query, "limit": limit, "project": project, "privacy": privacy},
187
+ {"query": query, "limit": limit, "project": project, "privacy": privacy, "agent": agent},
183
188
  ).get("results", [])
184
189
 
185
190
  def recent(
@@ -187,13 +192,18 @@ class HicortexClient:
187
192
  project: Optional[str] = None,
188
193
  limit: int = 10,
189
194
  privacy: Optional[str] = None,
195
+ agent: Optional[str] = None,
190
196
  ) -> list[dict]:
197
+ """Recent memories. ``agent`` — see :meth:`search` (#332 membership)."""
191
198
  return self._get(
192
- "/recent", {"project": project, "limit": limit, "privacy": privacy}
199
+ "/recent",
200
+ {"project": project, "limit": limit, "privacy": privacy, "agent": agent},
193
201
  ).get("results", [])
194
202
 
195
- def lessons(self) -> dict[str, Any]:
196
- return self._get("/lessons")
203
+ def lessons(self, agent: Optional[str] = None) -> dict[str, Any]:
204
+ """Lessons + memory index. ``agent`` — see :meth:`search` (#332:
205
+ confidential lessons serve to rostered agents only)."""
206
+ return self._get("/lessons", {"agent": agent})
197
207
 
198
208
  def context(self, agent: Optional[str] = None) -> dict[str, Any]:
199
209
  """Standing context layer (L2). When ``agent`` is set, the server
@@ -213,7 +223,10 @@ class HicortexClient:
213
223
  limit: Optional[int] = None,
214
224
  domain: Optional[str] = None,
215
225
  relationship: Optional[str] = None,
226
+ agent: Optional[str] = None,
216
227
  ) -> dict[str, Any]:
228
+ """Graph query (neighbors/hubs/path). ``agent`` — see :meth:`search`
229
+ (#332 membership; the export op is the ungated owner surface)."""
217
230
  return self._get(
218
231
  "/graph",
219
232
  {
@@ -223,6 +236,7 @@ class HicortexClient:
223
236
  "limit": limit,
224
237
  "domain": domain,
225
238
  "relationship": relationship,
239
+ "agent": agent,
226
240
  },
227
241
  )
228
242
 
@@ -281,6 +295,7 @@ class HicortexClient:
281
295
  project: Optional[str] = None,
282
296
  privacy: Optional[str] = None,
283
297
  mission_domains: Optional[list[str]] = None,
298
+ agent: Optional[str] = None,
284
299
  ) -> tuple[int, dict[str, Any]]:
285
300
  """Pushed recall index (0.14). ``prompt`` → ``{block, shown, turn}``
286
301
  where ``block`` is None when nothing is new/relevant; ``reset=True``
@@ -288,7 +303,11 @@ class HicortexClient:
288
303
  ``privacy`` (CSV accepted server-side), and ``mission_domains`` (list)
289
304
  scope the recall — all SOFT on a 0.16+ server (affinity boosts, never
290
305
  hard filters); ``project``/``privacy`` stay hard on older servers.
291
- Returns the status so the caller can old-server-guard on 404."""
306
+ ``agent`` (plugin 0.7.11, server ≥ #332) is this profile's id for the
307
+ confidential-circle membership gate (rostered ids see both pools in
308
+ the index; absent/unknown hard-omits confidential rows). Older servers
309
+ ignore the field. Returns the status so the caller can old-server-guard
310
+ on 404."""
292
311
  body: dict[str, Any] = {"session_id": session_id}
293
312
  if reset:
294
313
  body["reset"] = True
@@ -300,16 +319,24 @@ class HicortexClient:
300
319
  body["privacy"] = privacy
301
320
  if mission_domains:
302
321
  body["mission_domains"] = mission_domains
322
+ if agent:
323
+ body["agent"] = agent
303
324
  return self._post("/recall-index", body, timeout=self.RECALL_TIMEOUT)
304
325
 
305
326
  def get_memory(
306
- self, id: str, privacy: Optional[str] = None
327
+ self,
328
+ id: str,
329
+ privacy: Optional[str] = None,
330
+ agent: Optional[str] = None,
307
331
  ) -> tuple[int, dict[str, Any]]:
308
332
  """Fetch ONE memory's full content (lazy-load counterpart of the recall
309
333
  index). The server marks it as USED (access_count + 1) and returns
310
334
  ``{memory, citation}`` — citation is server-rendered so every harness
311
- surfaces the same provenance norm. ``privacy`` (CSV) makes an
312
- out-of-scope memory read as 404 (the server never reveals existence)."""
335
+ surfaces the same provenance norm. ``agent`` (plugin 0.7.11, server ≥
336
+ #332) is the membership gate: a confidential memory fetched by a
337
+ non-member answers 404 (the server never reveals existence)."""
313
338
  return self._get_with_status(
314
- "/memory", {"id": id, "privacy": privacy}, timeout=self.RECALL_TIMEOUT
339
+ "/memory",
340
+ {"id": id, "privacy": privacy, "agent": agent},
341
+ timeout=self.RECALL_TIMEOUT,
315
342
  )
@@ -1,5 +1,5 @@
1
1
  name: hicortex
2
- version: 0.7.10
2
+ version: 0.7.11
3
3
  description: "Self-learning memory for Hermes agents — every session is distilled into lessons overnight, and your agent wakes up wiser. Pushes a compact per-turn recall index (lazy-loaded with hicortex_get), injects fresh lessons plus a per-agent standing context block, and exposes the full 9-tool memory surface (search, get, recent, ingest, lessons, index, graph, update, delete) via a shared Hicortex server. Stdlib-only. AFTER INSTALL: run `hermes memory setup`, select hicortex, enter the server URL + token (see the token env var description for where to find it)."
4
4
  pip_dependencies: []
5
5
  hooks: []
@@ -333,6 +333,11 @@ class HicortexProvider(MemoryProvider):
333
333
  project=self._project,
334
334
  privacy=self._privacy,
335
335
  mission_domains=self._mission_domains,
336
+ # #332: the profile's id rides every read call — the
337
+ # server's confidential-circle gate keys on it (rostered
338
+ # ids see both pools; absent/unknown hard-omits). Old
339
+ # servers ignore the field.
340
+ agent=self._agent_name,
336
341
  )
337
342
  if status == 404:
338
343
  # Old-server guard: pre-0.14 has no /recall-index. Latch
@@ -385,7 +390,11 @@ class HicortexProvider(MemoryProvider):
385
390
  return cached
386
391
  try:
387
392
  hits = client.search(
388
- query, limit=self._recall_limit, project=self._project, privacy=self._privacy
393
+ query,
394
+ limit=self._recall_limit,
395
+ project=self._project,
396
+ privacy=self._privacy,
397
+ agent=self._agent_name,
389
398
  )
390
399
  return self._format_hits(hits)
391
400
  except Exception as e:
@@ -408,7 +417,11 @@ class HicortexProvider(MemoryProvider):
408
417
  def _bg() -> None:
409
418
  try:
410
419
  hits = client.search(
411
- query, limit=self._recall_limit, project=self._project, privacy=self._privacy
420
+ query,
421
+ limit=self._recall_limit,
422
+ project=self._project,
423
+ privacy=self._privacy,
424
+ agent=self._agent_name,
412
425
  )
413
426
  self._prefetch_cache[key] = self._format_hits(hits)
414
427
  except Exception as e:
@@ -467,7 +480,9 @@ class HicortexProvider(MemoryProvider):
467
480
 
468
481
  def _lessons_block(self, client: HicortexClient) -> str:
469
482
  try:
470
- data = client.lessons()
483
+ # #332: the profile id threads into the lessons fetch too —
484
+ # confidential lessons serve to rostered agents only.
485
+ data = client.lessons(agent=self._agent_name)
471
486
  except Exception as e:
472
487
  logger.debug("hicortex lessons fetch failed: %s", e)
473
488
  return ""
@@ -690,6 +705,7 @@ class HicortexProvider(MemoryProvider):
690
705
  args.get("query", ""),
691
706
  limit=int(args.get("limit", 5)),
692
707
  project=args.get("project") or self._project,
708
+ agent=self._agent_name,
693
709
  )
694
710
  return json.dumps(hits)
695
711
 
@@ -698,8 +714,12 @@ class HicortexProvider(MemoryProvider):
698
714
  if not id_val:
699
715
  return json.dumps({"error": "id is required"})
700
716
  # The configured privacy filter rides along (review F1): an
701
- # out-of-scope memory reads as 404 server-side.
702
- status, resp = client.get_memory(id_val, privacy=self._privacy)
717
+ # out-of-scope memory reads as 404 server-side. #332: so does
718
+ # the profile id — a confidential memory is a clean 404 for a
719
+ # non-member (existence never revealed).
720
+ status, resp = client.get_memory(
721
+ id_val, privacy=self._privacy, agent=self._agent_name
722
+ )
703
723
  if status == 404:
704
724
  # Either no such memory (0.14+) or a pre-0.14 server with
705
725
  # no /memory endpoint — the id hint covers the common case.
@@ -720,6 +740,7 @@ class HicortexProvider(MemoryProvider):
720
740
  hits = client.recent(
721
741
  project=args.get("project") or self._project,
722
742
  limit=int(args.get("limit", 10)),
743
+ agent=self._agent_name,
723
744
  )
724
745
  return json.dumps(hits)
725
746
 
@@ -739,7 +760,7 @@ class HicortexProvider(MemoryProvider):
739
760
  return json.dumps({"id": id_val, "message": f"Memory stored (id: {id_val[:8]})"})
740
761
 
741
762
  elif tool_name == "hicortex_lessons":
742
- data = client.lessons()
763
+ data = client.lessons(agent=self._agent_name)
743
764
  lessons = (data.get("lessons") or [])
744
765
  if not lessons:
745
766
  return json.dumps({"message": "No Learnings found."})
@@ -757,6 +778,7 @@ class HicortexProvider(MemoryProvider):
757
778
  limit=args.get("limit"),
758
779
  domain=args.get("domain"),
759
780
  relationship=args.get("relationship"),
781
+ agent=self._agent_name,
760
782
  )
761
783
  return json.dumps(result)
762
784
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamaze/hicortex",
3
- "version": "0.26.3",
3
+ "version": "0.27.1",
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.26.3",
6
+ "version": "0.27.1",
7
7
  "packages": [
8
8
  {
9
9
  "registryType": "npm",
10
10
  "identifier": "@gamaze/hicortex",
11
- "version": "0.26.3",
11
+ "version": "0.27.1",
12
12
  "transport": {
13
13
  "type": "stdio",
14
14
  "command": "npx",