@gamaze/hicortex 0.16.9 → 0.16.10

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 CHANGED
@@ -203,7 +203,7 @@ Config at `~/.hicortex/config.json`. Created by `init`. Key options:
203
203
  | `numCtx` | Context window for ollama (default 8192, one value for all phases). Scoring uses ~850 tokens, so 2048 is ample; distill/reflect/classify need more for `detectChunkSize`'s chunk sizing. |
204
204
  | `enableThinking` | Toggle the model's internal reasoning ("thinking") stream for OpenAI-compatible endpoints (default false). Only meaningful for local chat-template-aware servers (ollama, mlx-lm); leave unset for cloud OpenAI/OpenRouter/Groq endpoints (they 400 on the unknown `chat_template_kwargs` field). |
205
205
  | `maxTokens` | Max output tokens for all phases (default 8192). A ceiling, not a target — the model stops early when done. |
206
- | `ollamaFlushEvery` | Flush ollama's accumulated memory every N scoring calls (default 0 = off). Workaround for ollama's memory-growth bug (~171 MB/call). N=15 caps a cycle at ~2.5 GB. Scoped to the fast tier (scoring) only. |
206
+ | `ollamaFlushEvery` | Flush ollama's accumulated memory every N scoring calls. **Off by default (0)** opt-in only for an **ollama** install whose runner RSS growth (~171 MB/call) swap-thrashes long consolidations on a RAM-constrained box; N=15 caps a cycle at ~2.5 GB. Gated on the provider being ollama (local **or** remote) — no effect for non-ollama providers. Only you can judge whether your ollama endpoint actually suffers the growth (a managed/cloud ollama host may not), so it stays off until you set it. |
207
207
  | `ollamaFlushWaitMs` | Milliseconds to wait after an ollama flush for the runner to exit + release memory (default 180000 = 3 min). |
208
208
  | `authToken` | Bearer token for endpoint auth. Generated on first `init` in server mode. Find the active token with `hicortex status` or in `~/.hicortex/config.json`. |
209
209
  | `corsAllowedOrigins` | Browser origins allowed to read cross-origin responses, e.g. `["https://ui.example.com"]`. **Empty by default** — the server sends no `Access-Control-Allow-Origin` and never `Allow-Credentials`, so no external web page can read its data. The bundled `/viz` and `/context/ui` pages are same-origin and need no entry. |
@@ -29,3 +29,10 @@ export declare function readStrictBoolean(config: Record<string, unknown>, key:
29
29
  * value (e.g. ollamaFlushEvery).
30
30
  */
31
31
  export declare function readNonNegativeConfig(config: Record<string, unknown>, key: string, def: number): number;
32
+ /**
33
+ * Warn if the saved config carries keys that 0.16.8+ ignores. Call at every
34
+ * config read (daemon boot + nightly). The warning clears once the keys are
35
+ * removed and (for the model keys) the model is consolidated into
36
+ * llmModel/llmBaseUrl/llmProvider.
37
+ */
38
+ export declare function warnIgnoredConfigKeys(savedConfig: Record<string, unknown> | null | undefined): void;
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.readPositiveConfig = readPositiveConfig;
17
17
  exports.readStrictBoolean = readStrictBoolean;
18
18
  exports.readNonNegativeConfig = readNonNegativeConfig;
19
+ exports.warnIgnoredConfigKeys = warnIgnoredConfigKeys;
19
20
  /**
20
21
  * Read a positive finite number from a config object. Returns `def` when the
21
22
  * key is absent OR present-but-invalid (with a warn in the latter case).
@@ -58,3 +59,49 @@ function readNonNegativeConfig(config, key, def) {
58
59
  console.warn(`[hicortex] config "${key}" = ${String(v)} is not a non-negative finite number — using default ${def}.`);
59
60
  return def;
60
61
  }
62
+ /**
63
+ * Config keys that ≤0.16.7 accepted and 0.16.8+ IGNORES. Two groups:
64
+ * - per-stage model keys + the nested `models` block (#231): one model now
65
+ * serves all phases, so distillation/reflection/classification silently run
66
+ * on `llmModel` — a quality downgrade if a larger model was on a distill/
67
+ * reflect tier.
68
+ * - `distillFallback` (#232): removed; strict mode is default. A `"local"`
69
+ * value no longer falls back — failures retry next run.
70
+ * Both were public (documented in the README config table). Warn loudly at the
71
+ * config boundary so neither change is silent.
72
+ *
73
+ * NOTE: this list is deliberately WIDER than the `HicortexConfig` type. In
74
+ * ≤0.16.7 most of these keys (the flat `distill*`/`reflect*` set and
75
+ * `distillFallback`) were NEVER declared in the interface — they were
76
+ * accepted-but-untyped, read loosely off the config object, with the README
77
+ * config table as their only public contract. So deriving this list from the
78
+ * type would miss them. The list is the README's documented keys; don't trim it
79
+ * to match the interface (a future audit that did so would silently re-introduce
80
+ * the ignored-key gap this warning exists to close).
81
+ */
82
+ const IGNORED_CONFIG_KEYS = [
83
+ "distillModel", "distillBaseUrl", "distillApiKey", "distillProvider",
84
+ "reflectModel", "reflectBaseUrl", "reflectApiKey", "reflectProvider",
85
+ "classifyModel", "classifyBaseUrl", "classifyApiKey", "classifyProvider",
86
+ "distillFallback",
87
+ ];
88
+ /**
89
+ * Warn if the saved config carries keys that 0.16.8+ ignores. Call at every
90
+ * config read (daemon boot + nightly). The warning clears once the keys are
91
+ * removed and (for the model keys) the model is consolidated into
92
+ * llmModel/llmBaseUrl/llmProvider.
93
+ */
94
+ function warnIgnoredConfigKeys(savedConfig) {
95
+ if (!savedConfig)
96
+ return;
97
+ const present = IGNORED_CONFIG_KEYS.filter((k) => savedConfig[k] !== undefined);
98
+ const hasModelsBlock = savedConfig.models !== undefined;
99
+ if (present.length === 0 && !hasModelsBlock)
100
+ return;
101
+ const detail = [...present, ...(hasModelsBlock ? ["models"] : [])].join(", ");
102
+ console.warn(`[hicortex] config has keys IGNORED since 0.16.8 (${detail}). They have no effect now. ` +
103
+ `Per-stage model keys / the \`models\` block: one model serves all phases — set ` +
104
+ `llmModel/llmBaseUrl/llmProvider (+ llmApiKey) to your intended model. ` +
105
+ `distillFallback: removed (strict mode is default — a failed distill retries next run). ` +
106
+ `Remove these keys to clear this warning. See the 0.16.8 changelog.`);
107
+ }
@@ -57,6 +57,7 @@ const zod_1 = require("zod");
57
57
  const db_js_1 = require("./db.js");
58
58
  const llm_js_1 = require("./llm.js");
59
59
  const features_js_1 = require("./features.js");
60
+ const config_read_js_1 = require("./config-read.js");
60
61
  const state_js_1 = require("./state.js");
61
62
  const embedder_js_1 = require("./embedder.js");
62
63
  const storage = __importStar(require("./storage.js"));
@@ -373,6 +374,9 @@ async function startServer(options = {}) {
373
374
  // If nothing is configured: start recall-only with an unmissable warning.
374
375
  // One model serves all phases (#231) — no per-tier overlay here.
375
376
  const savedConfig = readConfigFile(stateDir);
377
+ // 0.16.8 upgrade guard: per-stage keys are silently ignored now. Warn loudly
378
+ // so a carried-over distill/reflect model doesn't silently downgrade quality.
379
+ (0, config_read_js_1.warnIgnoredConfigKeys)(savedConfig);
376
380
  // 0.16.2 activation gap: self-heal the agentId provenance field for
377
381
  // pre-0.16.2 server installs on first boot after upgrade. The server's own
378
382
  // nightly captures its sessions to localhost:8787/distill and needs this id;
package/dist/nightly.js CHANGED
@@ -219,6 +219,8 @@ async function runNightly(options = {}) {
219
219
  (0, state_js_1.migrateLegacyState)(stateDir);
220
220
  // Check mode: client or server
221
221
  const savedConfig = readNightlyConfig(stateDir);
222
+ // 0.16.8 upgrade guard: warn if ignored per-stage keys are still present.
223
+ (0, config_read_js_1.warnIgnoredConfigKeys)(savedConfig);
222
224
  // 0.16.2 activation gap: pre-0.16.2 installs never re-run init, so their
223
225
  // config has no agentId → capture sent source_agent_id: null forever (the
224
226
  // provenance feature was inert for the whole existing fleet). Self-heal on
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamaze/hicortex",
3
- "version": "0.16.9",
3
+ "version": "0.16.10",
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": {