@gamaze/hicortex 0.15.2 → 0.16.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.
package/dist/types.d.ts CHANGED
@@ -40,6 +40,10 @@ export interface MemorySearchResult {
40
40
  access_count: number;
41
41
  memory_type: string;
42
42
  project: string | null;
43
+ /** Origin agent (e.g. "hermes/atlas", "cc/mbp5") — surfaced in the recall
44
+ * one-liner so agents can calibrate trust (#202 provenance). Optional on the
45
+ * result type (matches how `domain` is threaded) to avoid breaking fixtures. */
46
+ source_agent?: string | null;
43
47
  created_at: string;
44
48
  connections: number;
45
49
  /** True cosine similarity to the query for vector-matched candidates; null
package/dist/uninstall.js CHANGED
@@ -101,14 +101,28 @@ async function runUninstall() {
101
101
  }
102
102
  catch { /* no settings */ }
103
103
  }
104
- // 3. Remove CC custom commands
104
+ // 3. Remove CC custom commands — only files we actually wrote. `learn.md` is
105
+ // a generic name a user may own; guard on the "hicortex" marker the installer
106
+ // always embedded, so uninstall never deletes an unrelated user command.
107
+ let removedCmds = 0;
105
108
  for (const cmd of ["learn.md", "hicortex-activate.md"]) {
106
109
  const cmdPath = (0, node_path_1.join)(CC_COMMANDS_DIR, cmd);
107
- if ((0, node_fs_1.existsSync)(cmdPath)) {
108
- (0, node_fs_1.unlinkSync)(cmdPath);
110
+ if (!(0, node_fs_1.existsSync)(cmdPath))
111
+ continue;
112
+ try {
113
+ if (!(0, node_fs_1.readFileSync)(cmdPath, "utf-8").toLowerCase().includes("hicortex")) {
114
+ console.log(` ⚠ Skipping ${cmd} — not a Hicortex file, left untouched`);
115
+ continue;
116
+ }
117
+ }
118
+ catch {
119
+ continue;
109
120
  }
121
+ (0, node_fs_1.unlinkSync)(cmdPath);
122
+ removedCmds++;
110
123
  }
111
- console.log(" ✓ Removed /learn and /hicortex-activate commands");
124
+ if (removedCmds > 0)
125
+ console.log(` ✓ Removed ${removedCmds} legacy CC command${removedCmds > 1 ? "s" : ""} (/learn, /hicortex-activate)`);
112
126
  // 4. Remove SessionStart hook (JSON merge — filter out entries containing "lessons-context")
113
127
  try {
114
128
  const raw = (0, node_fs_1.readFileSync)(CC_SETTINGS, "utf-8");
@@ -218,13 +218,15 @@ class HicortexClient:
218
218
  reset: bool = False,
219
219
  project: Optional[str] = None,
220
220
  privacy: Optional[str] = None,
221
+ mission_domains: Optional[list[str]] = None,
221
222
  ) -> tuple[int, dict[str, Any]]:
222
223
  """Pushed recall index (0.14). ``prompt`` → ``{block, shown, turn}``
223
224
  where ``block`` is None when nothing is new/relevant; ``reset=True``
224
- clears the session's server-side dedup (context rebuilt). ``project``
225
- and ``privacy`` (CSV accepted server-side) scope the recall exactly
226
- like the legacy /search prefetch did. Returns the status so the caller
227
- can old-server-guard on 404 (pre-0.14)."""
225
+ clears the session's server-side dedup (context rebuilt). ``project``,
226
+ ``privacy`` (CSV accepted server-side), and ``mission_domains`` (list)
227
+ scope the recall all SOFT on a 0.16+ server (affinity boosts, never
228
+ hard filters); ``project``/``privacy`` stay hard on older servers.
229
+ Returns the status so the caller can old-server-guard on 404."""
228
230
  body: dict[str, Any] = {"session_id": session_id}
229
231
  if reset:
230
232
  body["reset"] = True
@@ -234,6 +236,8 @@ class HicortexClient:
234
236
  body["project"] = project
235
237
  if privacy:
236
238
  body["privacy"] = privacy
239
+ if mission_domains:
240
+ body["mission_domains"] = mission_domains
237
241
  return self._post("/recall-index", body, timeout=self.RECALL_TIMEOUT)
238
242
 
239
243
  def get_memory(
@@ -71,6 +71,17 @@ CONFIG_SCHEMA: list[dict[str, Any]] = [
71
71
  ),
72
72
  "required": False,
73
73
  },
74
+ {
75
+ "key": "mission_domains",
76
+ "label": "Mission domains",
77
+ "description": (
78
+ "Comma-separated knowledge domains this agent works in (e.g. Health, "
79
+ "or Finance,Work). Recall boosts memories tagged into these domains "
80
+ "(soft — never excludes others). Pick from the domains in your "
81
+ "Hicortex config; leave blank for a general-purpose agent."
82
+ ),
83
+ "required": False,
84
+ },
74
85
  # NOTE: recall-only plugin — no capture config. Capture is handled by the
75
86
  # nightly server-side reader of each agent's session store.
76
87
  ]
@@ -152,6 +152,7 @@ class HicortexProvider(MemoryProvider):
152
152
  self._project: Optional[str] = None
153
153
  self._recall_limit: int = 5
154
154
  self._privacy: Optional[str] = "WORK,PERSONAL"
155
+ self._mission_domains: List[str] = [] # #203 scope (set from config in initialize)
155
156
  self._agent_name: Optional[str] = None
156
157
  self._prefetch_cache: Dict[str, str] = {}
157
158
  self._bg_threads: List[threading.Thread] = []
@@ -208,6 +209,10 @@ class HicortexProvider(MemoryProvider):
208
209
  except (TypeError, ValueError):
209
210
  self._recall_limit = 5
210
211
  self._privacy = cfg.get("privacy_filter", "WORK,PERSONAL")
212
+ # #203 scope: declared knowledge domains for this role-bound agent
213
+ # (e.g. Lenny → Health). Soft affinity boost on recall; never excludes.
214
+ _md_raw = cfg.get("mission_domains") or ""
215
+ self._mission_domains = [d.strip() for d in _md_raw.split(",") if d.strip()]
211
216
  self._agent_name = _resolve_agent_name(cfg)
212
217
  try:
213
218
  self._client = self._build_client()
@@ -290,6 +295,7 @@ class HicortexProvider(MemoryProvider):
290
295
  prompt=query,
291
296
  project=self._project,
292
297
  privacy=self._privacy,
298
+ mission_domains=self._mission_domains,
293
299
  )
294
300
  if status == 404:
295
301
  # Old-server guard: pre-0.14 has no /recall-index. Latch
@@ -475,8 +481,11 @@ class HicortexProvider(MemoryProvider):
475
481
  "Fetch ONE memory's full content by id — use this to lazy-load "
476
482
  "entries from the recall index or from search results whose "
477
483
  "snippet was not enough. Fetching a memory marks it as used "
478
- "(strengthens it), so only fetch what you actually need. When "
479
- "the memory shapes your answer, cite it as given in the response."
484
+ "(strengthens it), so fetch entries that could change your "
485
+ "action not every shown one. When the memory shapes your "
486
+ "answer, cite it as given in the response — mark a fetched "
487
+ "memory FETCHED and a one-line entry cited unread SNIPPET; "
488
+ "don't pass SNIPPET off as established."
480
489
  ),
481
490
  "parameters": {
482
491
  "type": "object",
@@ -4,7 +4,7 @@
4
4
  "description": "Your agents remember past decisions, avoid repeated mistakes, and get smarter every day. Nightly reflection generates actionable lessons that automatically update agent behavior.",
5
5
  "version": "0.10.0",
6
6
  "kind": "lifecycle",
7
- "skills": ["./skills/hicortex-memory", "./skills/hicortex-learn", "./skills/hicortex-activate"],
7
+ "skills": ["./skills/hicortex-memory"],
8
8
  "configSchema": {
9
9
  "type": "object",
10
10
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamaze/hicortex",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "description": "Self-learning memory for AI agents — experience captured automatically, distilled into lessons overnight, shared across your whole fleet. Works with Hermes, OpenClaw, Claude Code, and Pi.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -38,6 +38,7 @@
38
38
  "test": "vitest run",
39
39
  "test:watch": "vitest",
40
40
  "eval": "node dist/eval/run-eval.js",
41
+ "eval:recall-sweep": "node dist/eval/recall-sweep.js",
41
42
  "prepack": "npm run build && rm -rf ./hermes-plugin && mkdir -p ./hermes-plugin && cp -r ../../hermes-plugin/hicortex ./hermes-plugin/ && find ./hermes-plugin -name __pycache__ -type d -exec rm -rf {} + 2>/dev/null || true",
42
43
  "prepublishOnly": "npm run build && rm -rf ./hermes-plugin && mkdir -p ./hermes-plugin && cp -r ../../hermes-plugin/hicortex ./hermes-plugin/ && find ./hermes-plugin -name __pycache__ -type d -exec rm -rf {} + 2>/dev/null || true"
43
44
  },
@@ -1,53 +0,0 @@
1
- ---
2
- name: hicortex-activate
3
- description: Activate a Hicortex license key. Use when the user says they purchased Hicortex, has a license key, or wants to upgrade from the free tier.
4
- version: 0.2.0
5
- user-invocable: true
6
- disable-model-invocation: false
7
- ---
8
-
9
- # Activate Hicortex License
10
-
11
- When the user wants to activate their license key, guide them through it.
12
-
13
- ## If they provide the key (e.g. `/hicortex-activate hctx-abc123`)
14
-
15
- Run this command to apply the key:
16
-
17
- ```bash
18
- openclaw config set plugins.entries.hicortex.config.licenseKey "THE_KEY_HERE"
19
- ```
20
-
21
- Then restart the gateway:
22
-
23
- ```bash
24
- openclaw gateway restart
25
- ```
26
-
27
- Tell the user: "License activated! Hicortex now has unlimited memory. Your agent will keep learning and improving from every session."
28
-
29
- ## If they don't have a key yet
30
-
31
- Tell them:
32
-
33
- "You can get a license key at https://hicortex.gamaze.com/ — after purchase, you'll receive your key by email. Then come back and tell me the key, and I'll activate it for you."
34
-
35
- ## If activation fails
36
-
37
- If the `openclaw config set` command fails, fall back to telling the user to manually add it:
38
-
39
- "Open ~/.openclaw/openclaw.json, find the hicortex plugin entry, and add your key:
40
-
41
- ```json
42
- "config": {
43
- "licenseKey": "hctx-your-key-here"
44
- }
45
- ```
46
-
47
- Then restart: `openclaw gateway restart`"
48
-
49
- ## Rules
50
-
51
- - Never ask the user to open a terminal or edit files unless the automatic method fails
52
- - Always confirm the key was applied by checking the gateway log after restart
53
- - Be encouraging — they just bought the product
@@ -1,40 +0,0 @@
1
- ---
2
- name: hicortex-learn
3
- description: Save an explicit learning or insight to Hicortex long-term memory. Use when you discover something worth remembering across sessions — a lesson, a correction, a pattern, a decision.
4
- version: 0.2.0
5
- user-invocable: true
6
- disable-model-invocation: false
7
- ---
8
-
9
- # Save Learning to Hicortex
10
-
11
- When invoked with `/learn <text>`, store the learning in long-term memory via hicortex_ingest.
12
-
13
- ## Steps
14
-
15
- 1. Parse the text after `/learn`
16
- 2. Clean it up into a clear, self-contained statement that will make sense months from now
17
- 3. Add today's date
18
- 4. Call the `hicortex_ingest` tool with:
19
- - `content`: The learning text
20
- - `project`: "global" (unless clearly project-specific)
21
- - `memory_type`: "lesson"
22
-
23
- ## Example
24
-
25
- ```
26
- /learn always check provider docs before assuming an API uses the same auth scheme as OpenAI
27
- ```
28
-
29
- Becomes:
30
- ```
31
- hicortex_ingest(content="LEARNING: always check provider docs before assuming an API uses the same auth scheme as OpenAI — header names and token formats vary widely (Bearer vs x-api-key vs custom). (2026-04-07)", project="global", memory_type="lesson")
32
- ```
33
-
34
- ## Rules
35
-
36
- - Keep it concise — one clear statement
37
- - Include the "why" when relevant
38
- - Include the date for temporal context
39
- - Prefix with "LEARNING:" so it's identifiable in search
40
- - Confirm to the user what was saved (title + confirmation)