@gamaze/hicortex 0.27.0 → 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.
- package/README.md +14 -11
- package/assets/dashboard.html +95 -3
- package/dist/backfill-privacy.d.ts +40 -13
- package/dist/backfill-privacy.js +139 -28
- package/dist/capture.d.ts +60 -0
- package/dist/capture.js +90 -1
- package/dist/classification.d.ts +172 -10
- package/dist/classification.js +273 -13
- package/dist/cli.js +49 -0
- package/dist/confidential-marker.d.ts +103 -0
- package/dist/confidential-marker.js +285 -0
- package/dist/consolidate.d.ts +34 -3
- package/dist/consolidate.js +84 -10
- package/dist/dashboard.d.ts +32 -0
- package/dist/dashboard.js +33 -0
- package/dist/db.js +23 -0
- package/dist/distill-queue.d.ts +9 -0
- package/dist/distill-queue.js +10 -3
- package/dist/hermes-transcript-reader.js +5 -0
- package/dist/marker-key-api.d.ts +79 -0
- package/dist/marker-key-api.js +96 -0
- package/dist/mcp-server.js +144 -13
- package/dist/nightly.js +4 -1
- package/dist/opencode-transcript-reader.js +3 -0
- package/dist/pi-transcript-reader.js +3 -0
- package/dist/prompts.d.ts +33 -1
- package/dist/prompts.js +37 -2
- package/dist/storage.js +6 -3
- package/dist/transcript-reader.d.ts +10 -0
- package/dist/transcript-reader.js +13 -0
- package/dist/types.d.ts +41 -5
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/prompts.js
CHANGED
|
@@ -10,10 +10,28 @@
|
|
|
10
10
|
* infra-name denylist cannot catch conceptual leaks, only known names.
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.REFLECTION_PRIVACY_LINE_CONFIDENTIAL = exports.REFLECTION_PRIVACY_LINE_STANDARD = void 0;
|
|
13
14
|
exports.importanceScoring = importanceScoring;
|
|
14
15
|
exports.reflection = reflection;
|
|
15
16
|
exports.distillation = distillation;
|
|
16
17
|
exports.domainCuration = domainCuration;
|
|
18
|
+
/**
|
|
19
|
+
* The STANDARD pool's reflection privacy line — pinned verbatim since #602
|
|
20
|
+
* (it was a literal inside the template before). The standard pool's prompt
|
|
21
|
+
* must stay byte-identical to the pre-#602 prompt; tests pin this exact string
|
|
22
|
+
* so nobody edits it silently.
|
|
23
|
+
*/
|
|
24
|
+
exports.REFLECTION_PRIVACY_LINE_STANDARD = "Privacy: Never include personal data (names, health, finances, credentials) in lesson text. Abstract to the process level.";
|
|
25
|
+
/**
|
|
26
|
+
* The CONFIDENTIAL pool's reflection privacy line (#602). Three elements:
|
|
27
|
+
* (a) the pool serves the owner's inner circle only (confidential circle,
|
|
28
|
+
* #598 — its lessons stay inside the pool via the inherited stamp);
|
|
29
|
+
* (b) lesson text MAY reference the user's personal domains at the process
|
|
30
|
+
* level where needed to make the lesson actionable — the standard line
|
|
31
|
+
* suppressed all confidential lessons by construction (#602 finding);
|
|
32
|
+
* (c) credentials/passwords/API keys/secrets are STILL never included.
|
|
33
|
+
*/
|
|
34
|
+
exports.REFLECTION_PRIVACY_LINE_CONFIDENTIAL = "Privacy: this pool serves the owner's inner circle only (confidential memories). Lesson text may reference the user's personal domains (names, health, finances) at the process level where needed to make the lesson actionable. Credentials, passwords, API keys, and other secrets are still never included — abstract those away.";
|
|
17
35
|
/**
|
|
18
36
|
* Importance scoring prompt. Takes a {memories_block} with indexed memories.
|
|
19
37
|
*
|
|
@@ -61,11 +79,28 @@ No explanations. Just the JSON array.`;
|
|
|
61
79
|
}
|
|
62
80
|
/**
|
|
63
81
|
* Reflection prompt. Takes a {memories_block} with today's memories.
|
|
82
|
+
*
|
|
83
|
+
* POOL-AWARE (#602): the optional `pool` argument swaps ONLY the privacy line.
|
|
84
|
+
* Absent/undefined = "standard" = the pre-#602 prompt BYTE-IDENTICAL — the
|
|
85
|
+
* standard pool's prompt must never change. The confidential variant exists
|
|
86
|
+
* because the confidential pool is BY DEFINITION personal-domain content
|
|
87
|
+
* (health, finances, the people in the owner's inner circle), so the standard
|
|
88
|
+
* line ("Never include personal data (names, health, finances, credentials)")
|
|
89
|
+
* suppressed every confidential lesson by construction — #602's measured
|
|
90
|
+
* finding: 0 confidential lessons from a real cohort. Owner ruling
|
|
91
|
+
* 2026-11-12: the confidential pool SHOULD generate lessons for the inner
|
|
92
|
+
* circle; only the PROMPT suppressed them. The confidential line keeps one
|
|
93
|
+
* absolute: credentials/passwords/API keys/secrets are never included.
|
|
94
|
+
* Everything else in the prompt (generality bar, examples, output schema) is
|
|
95
|
+
* shared verbatim by both pools — pinned by tests/reflection-prompt.test.ts.
|
|
64
96
|
*/
|
|
65
|
-
function reflection(memoriesBlock, recentLessons) {
|
|
97
|
+
function reflection(memoriesBlock, recentLessons, pool) {
|
|
66
98
|
const recentSection = recentLessons
|
|
67
99
|
? `\nRECENT LESSONS (already generated — do NOT duplicate, but DO escalate if patterns recur):\n${recentLessons}\n`
|
|
68
100
|
: "";
|
|
101
|
+
const privacyLine = pool === "confidential"
|
|
102
|
+
? exports.REFLECTION_PRIVACY_LINE_CONFIDENTIAL
|
|
103
|
+
: exports.REFLECTION_PRIVACY_LINE_STANDARD;
|
|
69
104
|
return `You are a learning analyst for a multi-agent AI system. Review today's memories and extract actionable lessons from BOTH successes and failures.
|
|
70
105
|
|
|
71
106
|
Like human learning: we grow fastest when we reinforce what works AND correct what doesn't. A system that only learns from mistakes becomes overly cautious. A system that only learns from successes never improves. The combination multiplies.
|
|
@@ -121,7 +156,7 @@ Focus on:
|
|
|
121
156
|
- CROSS-AGENT PATTERNS: same issue or success across different agents — especially high-value
|
|
122
157
|
- PROCESS FEEDBACK: user feedback about the agent's approach/behavior, not just its output
|
|
123
158
|
|
|
124
|
-
|
|
159
|
+
${privacyLine}
|
|
125
160
|
|
|
126
161
|
Skip: isolated trivial actions, already-documented rules, incident notes, changelog entries, and tool-specific recipes. However, if multiple small successes form a consistent pattern of quality, extract that pattern as a reinforcement.
|
|
127
162
|
|
package/dist/storage.js
CHANGED
|
@@ -134,9 +134,12 @@ function insertMemory(db, content, embedding, opts = {}) {
|
|
|
134
134
|
.prepare(`INSERT OR IGNORE INTO memories
|
|
135
135
|
(id, content, base_strength, last_accessed, access_count,
|
|
136
136
|
created_at, ingested_at, source_agent, source_agent_id, source_session,
|
|
137
|
-
source_domain, project, privacy, memory_type, source_machine)
|
|
138
|
-
VALUES (?, ?, ?, ?, 0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
139
|
-
.run(id, content, opts.baseStrength ?? 0.5, ts, ts, ingestedTs, opts.sourceAgent ?? "default", opts.sourceAgentId ?? null, sourceSession, opts.sourceDomain ?? null,
|
|
137
|
+
source_domain, workspace_path, project, privacy, memory_type, source_machine)
|
|
138
|
+
VALUES (?, ?, ?, ?, 0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
139
|
+
.run(id, content, opts.baseStrength ?? 0.5, ts, ts, ingestedTs, opts.sourceAgent ?? "default", opts.sourceAgentId ?? null, sourceSession, opts.sourceDomain ?? null,
|
|
140
|
+
// #609: the workspace path rides the row (metadata for the
|
|
141
|
+
// confidentialPaths match + backfill); null when the delivery had none.
|
|
142
|
+
opts.workspacePath ?? null, opts.project ?? null,
|
|
140
143
|
// #332: 'standard' is the fail-closed default class — a NULL here would
|
|
141
144
|
// pre-date migration v27's normalization and force every read gate to
|
|
142
145
|
// keep a NULL arm forever. Confidential rows always carry an explicit
|
|
@@ -20,6 +20,16 @@ export interface TranscriptBatch {
|
|
|
20
20
|
* `claude-code/<project>`. Lets per-harness readers stamp their own origin.
|
|
21
21
|
*/
|
|
22
22
|
sourceAgent?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The session's workspace path (#609) — the directory the capturing agent
|
|
25
|
+
* worked in (CC: the delta entries' `cwd`; Pi/OC: the session header `cwd`;
|
|
26
|
+
* opencode: `session.directory`). The nightly sends it on every segment
|
|
27
|
+
* POST (`workspace_path`) and walks the confidential marker from it.
|
|
28
|
+
* AUTHORITATIVE over `projectName`, which stays the lossy last-segment
|
|
29
|
+
* label. Null when the harness has no workspace (Hermes — per-profile
|
|
30
|
+
* conversations, no cwd in its store; never invented).
|
|
31
|
+
*/
|
|
32
|
+
workspacePath?: string | null;
|
|
23
33
|
/**
|
|
24
34
|
* Per-session cursor key (`<prefix>:<sessionId>`) — the capture-cursors.json
|
|
25
35
|
* key whose value gates and advances this session's incremental capture (#189).
|
|
@@ -144,6 +144,18 @@ function parseTranscriptFile(filePath, projectName, cursorKey, startCursor, gene
|
|
|
144
144
|
if (timestamps[i])
|
|
145
145
|
lastTimestamp = timestamps[i];
|
|
146
146
|
}
|
|
147
|
+
// #609: the workspace path — the first non-empty `cwd` among the DELTA's
|
|
148
|
+
// entries (CC writes the session's cwd on every entry; the delta slice keeps
|
|
149
|
+
// the value authoritative for what THIS capture covers). projectName stays
|
|
150
|
+
// the lossy directory-name decode — it keeps serving only the label.
|
|
151
|
+
let workspacePath = null;
|
|
152
|
+
for (const entry of delta) {
|
|
153
|
+
const cwd = entry?.cwd;
|
|
154
|
+
if (typeof cwd === "string" && cwd) {
|
|
155
|
+
workspacePath = cwd;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
147
159
|
return {
|
|
148
160
|
sessionId: (0, node_path_1.basename)(filePath, ".jsonl"),
|
|
149
161
|
projectName,
|
|
@@ -151,6 +163,7 @@ function parseTranscriptFile(filePath, projectName, cursorKey, startCursor, gene
|
|
|
151
163
|
? lastTimestamp.slice(0, 10)
|
|
152
164
|
: new Date().toISOString().slice(0, 10),
|
|
153
165
|
entries: delta,
|
|
166
|
+
workspacePath,
|
|
154
167
|
cursorKey,
|
|
155
168
|
startCursor: start,
|
|
156
169
|
generation: gen,
|
package/dist/types.d.ts
CHANGED
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
* PERSONAL/SENSITIVE vocabulary is dead; migration v27 maps every legacy
|
|
9
9
|
* value and NULL to 'standard'). 'confidential' is ONLY ever set by the
|
|
10
10
|
* server: derived at intake from `source_agent` × the `confidentialAgents`
|
|
11
|
-
* config roster,
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* config roster, a `confidentialPaths` workspace match (#609), or marker
|
|
12
|
+
* content validated against the server's `confidentialMarkerKey` (#614) — or
|
|
13
|
+
* stamped by the `backfill-privacy` owner command; the client only RELAYS
|
|
14
|
+
* raw inputs, it never declares the class. The class is a hard gate on every
|
|
15
|
+
* agent-facing read path (absent/unknown requester = non-member =
|
|
16
|
+
* confidential rows omitted, single fetch 404) and routes every LLM touch of
|
|
17
|
+
* confidential text to the separately configured confidential model.
|
|
16
18
|
*/
|
|
17
19
|
export type MemoryPrivacy = "standard" | "confidential";
|
|
18
20
|
/** A stored memory record. */
|
|
@@ -42,6 +44,13 @@ export interface Memory {
|
|
|
42
44
|
* above). NULL when the client declares none. Echoed back on /memory GET.
|
|
43
45
|
*/
|
|
44
46
|
source_domain: string | null;
|
|
47
|
+
/**
|
|
48
|
+
* The workspace path the capture ran in (#609, migration v28) — metadata
|
|
49
|
+
* for the confidentialPaths intake match and the path backfill. Optional
|
|
50
|
+
* because rowToMemory is a cast over SELECT * rows; NULL on every pre-v28
|
|
51
|
+
* row and on deliveries that carried no path (Hermes, pre-#609 clients).
|
|
52
|
+
*/
|
|
53
|
+
workspace_path?: string | null;
|
|
45
54
|
/**
|
|
46
55
|
* The #332 two-level classification ('standard' | 'confidential'; see
|
|
47
56
|
* MemoryPrivacy). NULL only on rows written before migration v27 — the
|
|
@@ -852,6 +861,25 @@ export interface HicortexConfig {
|
|
|
852
861
|
* Boot-time (restart to apply).
|
|
853
862
|
*/
|
|
854
863
|
confidentialAgents?: string[];
|
|
864
|
+
/**
|
|
865
|
+
* #614 — the confidential marker key: the owner-set secret the workspace
|
|
866
|
+
* marker `.hicortex-confidential` must carry (as its single-line content)
|
|
867
|
+
* for a client-marked folder to stamp `confidential` at intake. The client
|
|
868
|
+
* RELAYS the marker's content (`client_marker` on /distill); the server
|
|
869
|
+
* compares it timing-safe against this key — the pre-#614 empty marker (and
|
|
870
|
+
* the `client_confidential` boolean) were a client-writable classification
|
|
871
|
+
* channel any token holder could set, and the key closes it: forgery
|
|
872
|
+
* requires a secret token possession alone does not grant. Distributed
|
|
873
|
+
* like `authToken` — mirror the server's value into each client machine's
|
|
874
|
+
* config.json (the `hicortex confidential` command reads it there) or its
|
|
875
|
+
* env mirror HICORTEX_CONFIDENTIAL_MARKER_KEY (which overrides config on
|
|
876
|
+
* both ends). Absent/blank (the default) = markers INERT, fail-closed both
|
|
877
|
+
* directions: marker-carrying deliveries stamp standard and a boot note
|
|
878
|
+
* names the key when the circle is otherwise active. Boot-time (restart to
|
|
879
|
+
* apply). This is the N=1 form of the per-space key (#613); the marker
|
|
880
|
+
* content evolves to space-id + key without a wire change.
|
|
881
|
+
*/
|
|
882
|
+
confidentialMarkerKey?: string;
|
|
855
883
|
/**
|
|
856
884
|
* #332 — the confidential model's endpoint. With `llmConfidentialApiKey`
|
|
857
885
|
* (both required; `llmConfidentialModel` optional, `llmConfidentialProvider`
|
|
@@ -939,6 +967,14 @@ export interface InsertMemoryOptions {
|
|
|
939
967
|
* only — stamped by the nightly (config `machineName` ?? os.hostname()),
|
|
940
968
|
* accepted optionally from /distill + /ingest. Null on pre-v15 rows. */
|
|
941
969
|
sourceMachine?: string | null;
|
|
970
|
+
/**
|
|
971
|
+
* The delivery's workspace path (#609) — the directory the capturing agent
|
|
972
|
+
* worked in. Metadata only: matched at intake against `confidentialPaths`
|
|
973
|
+
* and stored so `hicortex backfill-privacy` can re-plan by path; never
|
|
974
|
+
* distilled into prompt text. Null on pre-v28 rows, Hermes deliveries (no
|
|
975
|
+
* workspace), and clients that predate the wire field.
|
|
976
|
+
*/
|
|
977
|
+
workspacePath?: string | null;
|
|
942
978
|
project?: string | null;
|
|
943
979
|
/**
|
|
944
980
|
* #332 classification stamp. Absent → 'standard' (the fail-closed default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamaze/hicortex",
|
|
3
|
-
"version": "0.27.
|
|
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.27.
|
|
6
|
+
"version": "0.27.1",
|
|
7
7
|
"packages": [
|
|
8
8
|
{
|
|
9
9
|
"registryType": "npm",
|
|
10
10
|
"identifier": "@gamaze/hicortex",
|
|
11
|
-
"version": "0.27.
|
|
11
|
+
"version": "0.27.1",
|
|
12
12
|
"transport": {
|
|
13
13
|
"type": "stdio",
|
|
14
14
|
"command": "npx",
|