@gamaze/hicortex 0.19.1 → 0.19.3
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/README.md +8 -4
- package/assets/identity.html +59 -8
- package/dist/identity-store.d.ts +65 -1
- package/dist/identity-store.js +132 -9
- package/dist/index.d.ts +22 -7
- package/dist/index.js +510 -86
- package/dist/learnings-identity.d.ts +19 -10
- package/dist/learnings-identity.js +30 -19
- package/dist/mcp-server.js +29 -42
- package/dist/prompts.js +21 -1
- package/dist/recall-index.d.ts +70 -4
- package/dist/recall-index.js +134 -2
- package/dist/retrieval.d.ts +26 -0
- package/dist/retrieval.js +11 -0
- package/dist/types.d.ts +14 -0
- package/hermes-plugin/hicortex/provider.py +21 -5
- package/openclaw.plugin.json +15 -7
- package/package.json +1 -1
package/dist/retrieval.js
CHANGED
|
@@ -61,6 +61,7 @@ exports.getScoringWeights = getScoringWeights;
|
|
|
61
61
|
exports.configureSessionIntent = configureSessionIntent;
|
|
62
62
|
exports.getSessionIntent = getSessionIntent;
|
|
63
63
|
exports.blendQueryVector = blendQueryVector;
|
|
64
|
+
exports.recallQueryVector = recallQueryVector;
|
|
64
65
|
exports.findSupersededIds = findSupersededIds;
|
|
65
66
|
exports.l2ToCosine = l2ToCosine;
|
|
66
67
|
exports.effectiveStrength = effectiveStrength;
|
|
@@ -250,6 +251,16 @@ function blendQueryVector(promptEmb, centroid, weight) {
|
|
|
250
251
|
? (0, schema_prototypes_js_1.l2Normalize)((0, schema_prototypes_js_1.weightedAdd)(promptEmb, 1 - weight, centroid, weight))
|
|
251
252
|
: promptEmb;
|
|
252
253
|
}
|
|
254
|
+
function recallQueryVector(registry, sessionId, promptEmb, opts) {
|
|
255
|
+
if (opts.purePrompt)
|
|
256
|
+
return promptEmb;
|
|
257
|
+
// weight=0 (kill-switch): the centroid is neither read nor written.
|
|
258
|
+
const centroid = opts.weight > 0 ? registry.getCentroid(sessionId) : undefined;
|
|
259
|
+
const queryVec = blendQueryVector(promptEmb, centroid, opts.weight);
|
|
260
|
+
if (opts.weight > 0)
|
|
261
|
+
registry.updateCentroid(sessionId, promptEmb, opts.alpha);
|
|
262
|
+
return queryVec;
|
|
263
|
+
}
|
|
253
264
|
/**
|
|
254
265
|
* Ids among `candidateIds` that have been superseded by a later memory — i.e.
|
|
255
266
|
* they are the SOURCE of a `superseded_by` link (stageSupersession links
|
package/dist/types.d.ts
CHANGED
|
@@ -399,6 +399,20 @@ export interface HicortexConfig {
|
|
|
399
399
|
* leaner system prompts.
|
|
400
400
|
*/
|
|
401
401
|
lessonsLimit?: number;
|
|
402
|
+
/**
|
|
403
|
+
* Default project name for the OpenClaw plugin (#316, Hermes `default_project`
|
|
404
|
+
* parity): sent as the `project` fallback on /recall-index, the pre-0.14
|
|
405
|
+
* /search fallback, and the search/recent/ingest tools whenever the gateway
|
|
406
|
+
* supplies no project. Absent ⇒ no scope sent.
|
|
407
|
+
*/
|
|
408
|
+
defaultProject?: string;
|
|
409
|
+
/**
|
|
410
|
+
* Max memories per recall on the OpenClaw plugin's legacy /search fallback
|
|
411
|
+
* (pre-0.14 servers, #316). Default 8. Does NOT size the pushed
|
|
412
|
+
* /recall-index — that is server config (`recallMaxItems`); the server
|
|
413
|
+
* accepts no client limit.
|
|
414
|
+
*/
|
|
415
|
+
recallLimit?: number;
|
|
402
416
|
/**
|
|
403
417
|
* Soft cap on the memory corpus (default 10000). When the corpus exceeds this,
|
|
404
418
|
* the nightly's capacity-eviction stage (#245) removes the lowest-
|
|
@@ -123,22 +123,38 @@ def _title_case_section(name: str) -> str:
|
|
|
123
123
|
return " ".join(w[:1].upper() + w[1:] for w in words)
|
|
124
124
|
|
|
125
125
|
|
|
126
|
+
# #313 scope labels — mirror of the TS ``SECTION_LABELS`` in
|
|
127
|
+
# identity-store.ts (keep in sync). "Global rules" marks the section as
|
|
128
|
+
# fleet-wide; unknown section names fall back to title-case.
|
|
129
|
+
_SECTION_LABELS = {
|
|
130
|
+
"agent_identity": "Agent identity",
|
|
131
|
+
"user": "User",
|
|
132
|
+
"rules": "Global rules",
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
126
136
|
def _order_section_names(names: Iterable[str]) -> List[str]:
|
|
127
|
-
"""Stable ordering
|
|
137
|
+
"""Stable ordering — the #313 precedence contract, mirroring the TS
|
|
138
|
+
``SECTION_PRECEDENCE`` (keep in sync): ``agent_identity`` (the agent's own
|
|
139
|
+
self + role conduct, per-agent only) first, then ``user`` (the principal),
|
|
140
|
+
then ``rules`` (fleet-wide house rules), then the rest alphabetically."""
|
|
128
141
|
names = list(names)
|
|
129
|
-
primaries = [p for p in ("user", "rules") if p in names]
|
|
130
|
-
rest = sorted(n for n in names if n not in ("user", "rules"))
|
|
142
|
+
primaries = [p for p in ("agent_identity", "user", "rules") if p in names]
|
|
143
|
+
rest = sorted(n for n in names if n not in ("agent_identity", "user", "rules"))
|
|
131
144
|
return primaries + rest
|
|
132
145
|
|
|
133
146
|
|
|
134
147
|
def _render_context_block(sections: Dict[str, Any]) -> str:
|
|
135
|
-
"""Render the ``## Identity`` block, or "" when every section is blank.
|
|
148
|
+
"""Render the ``## Identity`` block, or "" when every section is blank.
|
|
149
|
+
Headings use the #313 scope labels (``_SECTION_LABELS``); unknown sections
|
|
150
|
+
fall back to title-case."""
|
|
136
151
|
body_parts: List[str] = []
|
|
137
152
|
for name in _order_section_names(sections.keys()):
|
|
138
153
|
body = sections.get(name)
|
|
139
154
|
if not isinstance(body, str) or not body.strip():
|
|
140
155
|
continue
|
|
141
|
-
|
|
156
|
+
label = _SECTION_LABELS.get(name) or _title_case_section(name)
|
|
157
|
+
body_parts.extend([f"### {label}", "", body.strip()])
|
|
142
158
|
if not body_parts:
|
|
143
159
|
return ""
|
|
144
160
|
return "\n".join(["## Identity", "", *body_parts])
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "hicortex",
|
|
3
3
|
"name": "Hicortex — Long-term Memory That Learns",
|
|
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
|
-
"version": "0.19.
|
|
5
|
+
"version": "0.19.3",
|
|
6
6
|
"kind": "lifecycle",
|
|
7
7
|
"skills": ["./skills/hicortex-memory"],
|
|
8
8
|
"configSchema": {
|
|
@@ -17,9 +17,14 @@
|
|
|
17
17
|
"type": "string",
|
|
18
18
|
"description": "Bearer token for the Hicortex server. Localhost bypasses auth automatically. Required for remote servers — use the authToken from ~/.hicortex/config.json on the server."
|
|
19
19
|
},
|
|
20
|
-
"
|
|
20
|
+
"defaultProject": {
|
|
21
21
|
"type": "string",
|
|
22
|
-
"description": "
|
|
22
|
+
"description": "Optional default project name scoping recall, search, and ingest when the gateway supplies no project (Hermes default_project parity)."
|
|
23
|
+
},
|
|
24
|
+
"recallLimit": {
|
|
25
|
+
"type": "number",
|
|
26
|
+
"default": 8,
|
|
27
|
+
"description": "Max memories per recall on the pre-0.14 /search fallback (default 8). The pushed recall index is sized by SERVER config (recallMaxItems) — the server accepts no client limit."
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
30
|
"required": []
|
|
@@ -34,10 +39,13 @@
|
|
|
34
39
|
"sensitive": true,
|
|
35
40
|
"placeholder": "Required for remote servers"
|
|
36
41
|
},
|
|
37
|
-
"
|
|
38
|
-
"label": "
|
|
39
|
-
"placeholder": "
|
|
40
|
-
|
|
42
|
+
"defaultProject": {
|
|
43
|
+
"label": "Default Project",
|
|
44
|
+
"placeholder": "Optional — scopes recall/ingest when the gateway sends no project"
|
|
45
|
+
},
|
|
46
|
+
"recallLimit": {
|
|
47
|
+
"label": "Recall Limit",
|
|
48
|
+
"placeholder": "8"
|
|
41
49
|
}
|
|
42
50
|
}
|
|
43
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamaze/hicortex",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.3",
|
|
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, and Pi.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|