@gamaze/hicortex 0.5.0 → 0.5.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.
@@ -24,7 +24,7 @@ export declare function parseJsonLenient<T>(text: string, fallback: T): T;
24
24
  /**
25
25
  * Run the full consolidation pipeline. Returns a structured report.
26
26
  */
27
- export declare function runConsolidation(db: Database.Database, llm: LlmClient, embedFn: EmbedFn, dryRun?: boolean): Promise<ConsolidationReport>;
27
+ export declare function runConsolidation(db: Database.Database, llm: LlmClient, embedFn: EmbedFn, dryRun?: boolean, skipReflection?: boolean): Promise<ConsolidationReport>;
28
28
  /**
29
29
  * Calculate milliseconds until the next occurrence of a given hour (local time).
30
30
  */
@@ -388,7 +388,7 @@ function stageDecayPrune(db, dryRun) {
388
388
  /**
389
389
  * Run the full consolidation pipeline. Returns a structured report.
390
390
  */
391
- async function runConsolidation(db, llm, embedFn, dryRun = false) {
391
+ async function runConsolidation(db, llm, embedFn, dryRun = false, skipReflection = false) {
392
392
  const start = new Date();
393
393
  const report = {
394
394
  started_at: start.toISOString(),
@@ -424,7 +424,16 @@ async function runConsolidation(db, llm, embedFn, dryRun = false) {
424
424
  // Stage 2: Importance Scoring
425
425
  report.stages.importance = await stageImportance(db, scoreMemories, llm, budget, dryRun);
426
426
  // Stage 2.5: Reflection
427
- report.stages.reflection = await stageReflection(db, precheck.newMemories, llm, budget, embedFn, dryRun);
427
+ if (skipReflection) {
428
+ report.stages.reflection = {
429
+ lessons_generated: 0,
430
+ skipped: true,
431
+ reason: "reflect_endpoint_offline",
432
+ };
433
+ }
434
+ else {
435
+ report.stages.reflection = await stageReflection(db, precheck.newMemories, llm, budget, embedFn, dryRun);
436
+ }
428
437
  // Stage 3: Link Discovery
429
438
  report.stages.links = await stageLinks(db, precheck.newMemories, embedFn, dryRun);
430
439
  // Stage 4: Decay & Prune
package/dist/nightly.js CHANGED
@@ -270,8 +270,24 @@ async function runNightly(options = {}) {
270
270
  console.log(`[hicortex] Distillation complete: ${memoriesIngested} new memories`);
271
271
  // Step 3: Consolidation
272
272
  if (!dryRun) {
273
+ // Pre-flight health check for the reflect endpoint.
274
+ // If reflectBaseUrl points to a remote Ollama and it's down (MBP offline),
275
+ // skip reflection entirely instead of waiting through 3 retries (~3.5 min).
276
+ // Scoring + linking + decay still run (they use the local model or don't need LLM).
277
+ let skipReflection = false;
278
+ if (llmConfig.reflectBaseUrl && (llmConfig.reflectProvider ?? llmConfig.provider) === "ollama") {
279
+ const reflectModel = llmConfig.reflectModel ?? llmConfig.model;
280
+ const health = await (0, llm_js_1.probeOllamaModel)(llmConfig.reflectBaseUrl, reflectModel);
281
+ if (!health.ok) {
282
+ const reason = health.reason === "unreachable"
283
+ ? `reflect endpoint unreachable (${llmConfig.reflectBaseUrl})`
284
+ : `reflect model not loaded (${reflectModel} missing on ${llmConfig.reflectBaseUrl})`;
285
+ console.warn(`[hicortex] ${reason} — skipping reflection, scoring + linking will still run`);
286
+ skipReflection = true;
287
+ }
288
+ }
273
289
  console.log(`[hicortex] Running consolidation...`);
274
- const report = await (0, consolidate_js_1.runConsolidation)(db, llm, embedder_js_1.embed, dryRun);
290
+ const report = await (0, consolidate_js_1.runConsolidation)(db, llm, embedder_js_1.embed, dryRun, skipReflection);
275
291
  console.log(`[hicortex] Consolidation ${report.status} in ${report.elapsed_seconds}s` +
276
292
  (report.stages.reflection ? ` (${report.stages.reflection.lessons_generated} lessons)` : ""));
277
293
  }
@@ -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.5.0",
5
+ "version": "0.5.1",
6
6
  "kind": "lifecycle",
7
7
  "skills": ["./skills/hicortex-memory", "./skills/hicortex-learn", "./skills/hicortex-activate"],
8
8
  "configSchema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamaze/hicortex",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Human-like memory for self-improving AI agents. Automatic capturing, nightly reflection, and cross-agent learning. Works with Claude Code and OpenClaw.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {