@gamaze/hicortex 0.27.4 → 0.29.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.
Files changed (94) hide show
  1. package/assets/dashboard.html +1898 -3211
  2. package/assets/viz.html +229 -2
  3. package/dist/backfill-privacy.d.ts +68 -45
  4. package/dist/backfill-privacy.js +236 -145
  5. package/dist/calibration.d.ts +67 -68
  6. package/dist/calibration.js +75 -78
  7. package/dist/capture-health.d.ts +2 -2
  8. package/dist/capture-health.js +2 -2
  9. package/dist/classification.d.ts +141 -12
  10. package/dist/classification.js +214 -27
  11. package/dist/classify-domains.d.ts +1 -1
  12. package/dist/classify-domains.js +2 -2
  13. package/dist/cli-args.d.ts +5 -3
  14. package/dist/cli-args.js +7 -3
  15. package/dist/cli.d.ts +2 -0
  16. package/dist/cli.js +64 -16
  17. package/dist/cluster.d.ts +12 -9
  18. package/dist/cluster.js +9 -6
  19. package/dist/consolidate.d.ts +93 -43
  20. package/dist/consolidate.js +255 -119
  21. package/dist/dashboard.d.ts +48 -5
  22. package/dist/dashboard.js +55 -3
  23. package/dist/db.js +27 -6
  24. package/dist/dedup.d.ts +2 -3
  25. package/dist/dedup.js +2 -3
  26. package/dist/distill-queue.d.ts +36 -4
  27. package/dist/distill-queue.js +80 -18
  28. package/dist/distiller.d.ts +1 -1
  29. package/dist/distiller.js +13 -12
  30. package/dist/domain-classify.d.ts +8 -9
  31. package/dist/domain-classify.js +6 -7
  32. package/dist/graph.d.ts +15 -5
  33. package/dist/graph.js +46 -13
  34. package/dist/hermes-transcript-reader.d.ts +1 -1
  35. package/dist/hermes-transcript-reader.js +1 -1
  36. package/dist/init.d.ts +30 -2
  37. package/dist/init.js +48 -3
  38. package/dist/llm.d.ts +1 -1
  39. package/dist/llm.js +5 -5
  40. package/dist/mcp-server.js +323 -59
  41. package/dist/memory-instructions.d.ts +2 -2
  42. package/dist/memory-instructions.js +2 -2
  43. package/dist/nightly.d.ts +1 -1
  44. package/dist/nightly.js +64 -5
  45. package/dist/nofit.d.ts +2 -2
  46. package/dist/nofit.js +2 -2
  47. package/dist/observed-agents.d.ts +54 -0
  48. package/dist/observed-agents.js +78 -0
  49. package/dist/project-canonicalize.d.ts +6 -5
  50. package/dist/project-canonicalize.js +6 -5
  51. package/dist/prompts.d.ts +29 -8
  52. package/dist/prompts.js +39 -16
  53. package/dist/quality-scoreboard.d.ts +1 -1
  54. package/dist/recall-hook-cli.d.ts +1 -1
  55. package/dist/recall-hook-cli.js +2 -2
  56. package/dist/recall-index.d.ts +28 -14
  57. package/dist/recall-index.js +22 -10
  58. package/dist/recall-precision.d.ts +3 -3
  59. package/dist/recall-precision.js +5 -4
  60. package/dist/reconcile-projects.d.ts +2 -2
  61. package/dist/reconcile-projects.js +2 -2
  62. package/dist/reconsolidation.d.ts +9 -2
  63. package/dist/reconsolidation.js +48 -31
  64. package/dist/relink.d.ts +2 -2
  65. package/dist/relink.js +4 -4
  66. package/dist/rescore-importance.d.ts +2 -2
  67. package/dist/rescore-importance.js +22 -3
  68. package/dist/retrieval.d.ts +14 -0
  69. package/dist/retrieval.js +11 -11
  70. package/dist/schema-prototypes.d.ts +1 -1
  71. package/dist/schema-prototypes.js +1 -1
  72. package/dist/seed-lesson.js +4 -2
  73. package/dist/spaces-api.d.ts +104 -0
  74. package/dist/spaces-api.js +193 -0
  75. package/dist/spaces-cli.d.ts +90 -0
  76. package/dist/spaces-cli.js +245 -0
  77. package/dist/spaces.d.ts +187 -0
  78. package/dist/spaces.js +360 -0
  79. package/dist/storage.d.ts +47 -10
  80. package/dist/storage.js +74 -17
  81. package/dist/sweep-volatile.d.ts +2 -2
  82. package/dist/sweep-volatile.js +2 -2
  83. package/dist/telemetry-cli.d.ts +1 -1
  84. package/dist/telemetry-cli.js +1 -1
  85. package/dist/type-classify.d.ts +1 -1
  86. package/dist/type-classify.js +1 -1
  87. package/dist/type-labels.d.ts +1 -1
  88. package/dist/type-labels.js +1 -1
  89. package/dist/types.d.ts +43 -20
  90. package/dist/wrapper-prompt.d.ts +2 -2
  91. package/dist/wrapper-prompt.js +2 -2
  92. package/opencode-plugin/hicortex/index.ts +562 -364
  93. package/package.json +2 -2
  94. package/server.json +2 -2
@@ -15,7 +15,7 @@
15
15
  * the old keys so a briefly-stale reader (e.g. a snapshot taken mid-migrate)
16
16
  * renders correctly.
17
17
  *
18
- * Mapping (decided 2026-08-11, research/2026-08-11-identity-reframe-brainstorm.md):
18
+ * Mapping (the identity-reframe decision):
19
19
  * fact → knowledge
20
20
  * episode → experience
21
21
  * decision → decisions
package/dist/types.d.ts CHANGED
@@ -3,20 +3,27 @@
3
3
  * Ported from the Python hicortex codebase.
4
4
  */
5
5
  /**
6
- * The two-level memory classification (#332), carried by `memories.privacy`
7
- * (resurrected from its vestigial 0.16.x role — the legacy PUBLIC/WORK/
8
- * PERSONAL/SENSITIVE vocabulary is dead; migration v27 maps every legacy
9
- * value and NULL to 'standard'). 'confidential' is ONLY ever set by the
10
- * server: derived at intake from `source_agent` × the `confidentialAgents`
11
- * config roster, a `confidentialPaths` workspace match (#609), or marker
12
- * content validated against the server's `confidentialMarkerKey` (#614) — or
13
- * stamped by the `hicortex backfill-privacy` 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.
6
+ * The memory classification (#332), carried by `memories.privacy` and WIDENED
7
+ * IN PLACE by spaces (#642, no migration — values are data): the column now
8
+ * carries `'standard' | <configured space id>`, where the id of any space in
9
+ * the `spaces` config map is a legal value and 'confidential' is the
10
+ * LEGACY-MATERIALIZED space (confidentialAgents/confidentialPaths seed a
11
+ * pre-configured `confidential` space — an existing confidential-only install
12
+ * is the N=1 case of the same machinery, byte-for-byte). 'standard' (and
13
+ * NULL, the pre-v27 shape every NULL-safe predicate already reads as shared)
14
+ * is the FIXED shared pool, never a space id. Space ids are ONLY ever set by
15
+ * the server: derived at intake from per-space path patterns or member lists
16
+ * (deriveIntakeSpace, precedence paths → members → the confidential marker
17
+ * arm #614), or stamped by backfill; the client only RELAYS raw inputs, it
18
+ * never declares the class. The stamp is a hard gate on every agent-facing
19
+ * read path (absent/unknown requester sees shared only — other spaces' rows
20
+ * omitted, single fetch 404) and routes every LLM touch of non-shared text to
21
+ * the space's (or the confidential) model — never the main model. The
22
+ * `(string & {})` tail keeps the literal autocomplete while letting any
23
+ * configured id typecheck; write paths REFUSE unconfigured ids
24
+ * (normalizeStoredPrivacy, #642 AC-7).
18
25
  */
19
- export type MemoryPrivacy = "standard" | "confidential";
26
+ export type MemoryPrivacy = "standard" | "confidential" | (string & {});
20
27
  /** A stored memory record. */
21
28
  export interface Memory {
22
29
  id: string;
@@ -258,6 +265,13 @@ export interface ConsolidationReport {
258
265
  * paid gain; the nightly re-settle leaves them alone.
259
266
  */
260
267
  guard_skipped?: number;
268
+ /**
269
+ * #332: confidential rows held — no confidential client configured
270
+ * (retried next run, never the main model).
271
+ */
272
+ skipped_confidential?: number;
273
+ /** #642: rows held per space id — no client for that space. */
274
+ skipped_spaces?: Record<string, number>;
261
275
  };
262
276
  reflection?: {
263
277
  lessons_generated: number;
@@ -265,6 +279,10 @@ export interface ConsolidationReport {
265
279
  failed?: boolean;
266
280
  skipped?: boolean;
267
281
  reason?: string;
282
+ /** #332: the confidential cohort held — no confidential client. */
283
+ confidential_skipped?: boolean;
284
+ /** #642: every non-shared cohort that held (space ids, incl. retired). */
285
+ held_spaces?: string[];
268
286
  };
269
287
  domain_curation?: {
270
288
  curated: boolean;
@@ -288,6 +306,11 @@ export interface ConsolidationReport {
288
306
  * base_strength halved (accelerated decay toward prune).
289
307
  */
290
308
  no_association_decayed?: number;
309
+ /** #332: confidential rows held (no confidential client) — retried
310
+ * next run. */
311
+ held_confidential?: number;
312
+ /** #642: rows held per space id (no client for that space). */
313
+ held_spaces?: Record<string, number>;
291
314
  reason?: string;
292
315
  };
293
316
  links?: {
@@ -301,7 +324,7 @@ export interface ConsolidationReport {
301
324
  * Since #392 this is THE unified resolution stage: its verdict also carries
302
325
  * a `merge` disposition, and the deterministic merge zone (pairs at/above
303
326
  * the merge ceiling — release-managed since #408) runs inside it,
304
- * LLM-free, before the scan. Since #206-B (owner decision 6) it is also
327
+ * LLM-free, before the scan. Since #206-B (decision 6) it is also
305
328
  * the ONLY true-update detector — the standalone supersession stage
306
329
  * (3.7, #191 Phase B) is retired into its `supersedes` verdict action,
307
330
  * and its former `supersession` report slot no longer exists.
@@ -578,7 +601,7 @@ export interface HicortexConfig {
578
601
  * example (a wider life-sphere set) ships as
579
602
  * domains.example.json in the package root.
580
603
  *
581
- * NO fallback bucket is needed or special-cased (owner amendment 07.07):
604
+ * NO fallback bucket is needed or special-cased (spec 2026-07-07 amendment):
582
605
  * a genuine no-fit memory gets a WEAK primary from prototype cosines when
583
606
  * possible, else it decays toward pruning (see nofit.ts). A domain named
584
607
  * "Unsorted" — if configured — is just a normal domain.
@@ -649,7 +672,7 @@ export interface HicortexConfig {
649
672
  * path — applies to ALL phases (distill / reflect / classify / scoring) since one
650
673
  * model serves all of them. Default false. A thinking model with thinking ON can
651
674
  * burn the entire token budget on an unclosed <think> block and emit nothing
652
- * (probed 2026-08-04). When set (true or false), completeOpenAiCompat sends
675
+ * (observed live). When set (true or false), completeOpenAiCompat sends
653
676
  * chat_template_kwargs:{enable_thinking}. LOCAL-ENDPOINT ONLY: this is meaningful
654
677
  * only for a chat-template-aware server (ollama, mlx-lm). If the one model is a
655
678
  * cloud OpenAI-compatible endpoint (OpenAI / OpenRouter / Groq / z.ai), LEAVE THIS
@@ -666,7 +689,7 @@ export interface HicortexConfig {
666
689
  * with undici's hidden 5-minute header/body timers disabled, so this knob is
667
690
  * the ONLY ceiling: a legitimate long generation is no longer abandoned
668
691
  * client-side at 5 min while the server keeps generating for the dead
669
- * client (the 2026-08-23/24 incident's amplification mechanism). Before
692
+ * client (a production incident's amplification mechanism). Before
670
693
  * #337, scoring used a 600 s ceiling and the other phases 900 s; one knob
671
694
  * now covers all four. No effect on the ollama path (already streams) or
672
695
  * claude-cli (subprocess timeout).
@@ -768,7 +791,7 @@ export interface HicortexConfig {
768
791
  memorySoftCap?: number;
769
792
  /**
770
793
  * The cross-project recall fence bar (#566; default 0.72 — fence ON when
771
- * the key is absent, owner ruling 2026-10-28). A memory from a different
794
+ * the key is absent — #566 ruling). A memory from a different
772
795
  * project than the request's must clear this bar on a measured cosine to be
773
796
  * admitted into recall/search results; same-project and unscoped recall are
774
797
  * unchanged. `0` or any value ≤ the recall floor (0.62) = fence off
@@ -852,8 +875,8 @@ export interface HicortexConfig {
852
875
  * #332 — the confidential-circle roster: agent ids (the same sanitized id
853
876
  * namespace as `identityAgents` / `?agent=`) whose captures are stamped
854
877
  * `confidential` at intake (matched by `source_agent` with the first
855
- * `<harness>/` segment stripped, so a Hermes profile `atlas` capturing as
856
- * `hermes/atlas` matches the roster entry `atlas`) and whose read requests
878
+ * `<harness>/` segment stripped, so a Hermes profile `nova` capturing as
879
+ * `hermes/nova` matches the roster entry `nova`) and whose read requests
857
880
  * (the optional `agent` param on every agent-facing read path) see both
858
881
  * pools. Absent/empty (the default) = no circle: every capture is
859
882
  * standard, nothing is ever omitted, zero behavior change. Deploy-time
@@ -12,10 +12,10 @@
12
12
  * `<command-name>`/`<command-message>`/`<command-args>` (slash-command
13
13
  * envelope), `<local-command-stdout>`, `<system-reminder>`, and
14
14
  * `[Request interrupted…]` markers. These reach /recall-index verbatim today —
15
- * ~15% of live pushes — inflating shown_count, burning hook latency, and
15
+ * a meaningful share of live pushes — inflating shown_count, burning hook latency, and
16
16
  * polluting the Memory Precision denominator.
17
17
  *
18
- * The rule (owner decision 4, refinement A1 — skip ONLY pure plumbing):
18
+ * The rule (decision 4, refinement A1 — skip ONLY pure plumbing):
19
19
  * strip every known wrapper element, then measure PAYLOAD PROSE = the text
20
20
  * left outside wrappers PLUS the bodies of `<result>` elements and
21
21
  * `<agent-message>` elements (the payload channels — a subagent hand-back is
@@ -13,10 +13,10 @@
13
13
  * `<command-name>`/`<command-message>`/`<command-args>` (slash-command
14
14
  * envelope), `<local-command-stdout>`, `<system-reminder>`, and
15
15
  * `[Request interrupted…]` markers. These reach /recall-index verbatim today —
16
- * ~15% of live pushes — inflating shown_count, burning hook latency, and
16
+ * a meaningful share of live pushes — inflating shown_count, burning hook latency, and
17
17
  * polluting the Memory Precision denominator.
18
18
  *
19
- * The rule (owner decision 4, refinement A1 — skip ONLY pure plumbing):
19
+ * The rule (decision 4, refinement A1 — skip ONLY pure plumbing):
20
20
  * strip every known wrapper element, then measure PAYLOAD PROSE = the text
21
21
  * left outside wrappers PLUS the bodies of `<result>` elements and
22
22
  * `<agent-message>` elements (the payload channels — a subagent hand-back is