@cleocode/cleo 2026.4.46 → 2026.4.47
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/dist/cli/index.js +118 -41
- package/dist/cli/index.js.map +4 -4
- package/package.json +8 -8
package/dist/cli/index.js
CHANGED
|
@@ -20589,6 +20589,27 @@ var init_intelligence = __esm({
|
|
|
20589
20589
|
}
|
|
20590
20590
|
});
|
|
20591
20591
|
|
|
20592
|
+
// packages/nexus/src/pipeline/suffix-index.ts
|
|
20593
|
+
var EMPTY_SUFFIX_INDEX;
|
|
20594
|
+
var init_suffix_index = __esm({
|
|
20595
|
+
"packages/nexus/src/pipeline/suffix-index.ts"() {
|
|
20596
|
+
"use strict";
|
|
20597
|
+
EMPTY_SUFFIX_INDEX = Object.freeze({
|
|
20598
|
+
get: () => void 0,
|
|
20599
|
+
getInsensitive: () => void 0,
|
|
20600
|
+
getFilesInDir: () => []
|
|
20601
|
+
});
|
|
20602
|
+
}
|
|
20603
|
+
});
|
|
20604
|
+
|
|
20605
|
+
// packages/nexus/src/pipeline/import-processor.ts
|
|
20606
|
+
var init_import_processor = __esm({
|
|
20607
|
+
"packages/nexus/src/pipeline/import-processor.ts"() {
|
|
20608
|
+
"use strict";
|
|
20609
|
+
init_suffix_index();
|
|
20610
|
+
}
|
|
20611
|
+
});
|
|
20612
|
+
|
|
20592
20613
|
// packages/nexus/src/pipeline/symbol-table.ts
|
|
20593
20614
|
var init_symbol_table = __esm({
|
|
20594
20615
|
"packages/nexus/src/pipeline/symbol-table.ts"() {
|
|
@@ -20608,6 +20629,7 @@ var init_resolution_context = __esm({
|
|
|
20608
20629
|
var init_call_processor = __esm({
|
|
20609
20630
|
"packages/nexus/src/pipeline/call-processor.ts"() {
|
|
20610
20631
|
"use strict";
|
|
20632
|
+
init_import_processor();
|
|
20611
20633
|
init_resolution_context();
|
|
20612
20634
|
}
|
|
20613
20635
|
});
|
|
@@ -20663,27 +20685,6 @@ var init_heritage_processor = __esm({
|
|
|
20663
20685
|
}
|
|
20664
20686
|
});
|
|
20665
20687
|
|
|
20666
|
-
// packages/nexus/src/pipeline/suffix-index.ts
|
|
20667
|
-
var EMPTY_SUFFIX_INDEX;
|
|
20668
|
-
var init_suffix_index = __esm({
|
|
20669
|
-
"packages/nexus/src/pipeline/suffix-index.ts"() {
|
|
20670
|
-
"use strict";
|
|
20671
|
-
EMPTY_SUFFIX_INDEX = Object.freeze({
|
|
20672
|
-
get: () => void 0,
|
|
20673
|
-
getInsensitive: () => void 0,
|
|
20674
|
-
getFilesInDir: () => []
|
|
20675
|
-
});
|
|
20676
|
-
}
|
|
20677
|
-
});
|
|
20678
|
-
|
|
20679
|
-
// packages/nexus/src/pipeline/import-processor.ts
|
|
20680
|
-
var init_import_processor = __esm({
|
|
20681
|
-
"packages/nexus/src/pipeline/import-processor.ts"() {
|
|
20682
|
-
"use strict";
|
|
20683
|
-
init_suffix_index();
|
|
20684
|
-
}
|
|
20685
|
-
});
|
|
20686
|
-
|
|
20687
20688
|
// packages/nexus/src/pipeline/knowledge-graph.ts
|
|
20688
20689
|
var init_knowledge_graph = __esm({
|
|
20689
20690
|
"packages/nexus/src/pipeline/knowledge-graph.ts"() {
|
|
@@ -46433,13 +46434,16 @@ async function runTierPromotion(projectRoot) {
|
|
|
46433
46434
|
try {
|
|
46434
46435
|
shortToMedium = typedAll(
|
|
46435
46436
|
nativeDb.prepare(`
|
|
46436
|
-
SELECT id, citation_count, quality_score
|
|
46437
|
+
SELECT id, citation_count, quality_score, verified
|
|
46437
46438
|
FROM ${table}
|
|
46438
46439
|
WHERE memory_tier = 'short'
|
|
46439
46440
|
AND invalid_at IS NULL
|
|
46440
46441
|
AND ${dateCol} < ?
|
|
46441
|
-
AND
|
|
46442
|
-
|
|
46442
|
+
AND (
|
|
46443
|
+
citation_count >= 3
|
|
46444
|
+
OR quality_score >= 0.7
|
|
46445
|
+
OR verified = 1
|
|
46446
|
+
)
|
|
46443
46447
|
`),
|
|
46444
46448
|
age24h
|
|
46445
46449
|
);
|
|
@@ -46449,13 +46453,15 @@ async function runTierPromotion(projectRoot) {
|
|
|
46449
46453
|
for (const row of shortToMedium) {
|
|
46450
46454
|
try {
|
|
46451
46455
|
nativeDb.prepare(`UPDATE ${table} SET memory_tier = 'medium', updated_at = ? WHERE id = ?`).run(now2, row.id);
|
|
46452
|
-
|
|
46453
|
-
|
|
46454
|
-
|
|
46455
|
-
|
|
46456
|
-
|
|
46457
|
-
|
|
46458
|
-
|
|
46456
|
+
let reason;
|
|
46457
|
+
if (row.citation_count >= 3) {
|
|
46458
|
+
reason = `citationCount=${row.citation_count} >= 3, age > 24h`;
|
|
46459
|
+
} else if ((row.quality_score ?? 0) >= 0.7) {
|
|
46460
|
+
reason = `qualityScore=${row.quality_score?.toFixed(2)} >= 0.70, age > 24h`;
|
|
46461
|
+
} else {
|
|
46462
|
+
reason = `verified=true, age > 24h`;
|
|
46463
|
+
}
|
|
46464
|
+
promoted.push({ id: row.id, table, fromTier: "short", toTier: "medium", reason });
|
|
46459
46465
|
} catch {
|
|
46460
46466
|
}
|
|
46461
46467
|
}
|
|
@@ -46463,13 +46469,12 @@ async function runTierPromotion(projectRoot) {
|
|
|
46463
46469
|
try {
|
|
46464
46470
|
mediumToLong = typedAll(
|
|
46465
46471
|
nativeDb.prepare(`
|
|
46466
|
-
SELECT id, citation_count, quality_score
|
|
46472
|
+
SELECT id, citation_count, quality_score, verified
|
|
46467
46473
|
FROM ${table}
|
|
46468
46474
|
WHERE memory_tier = 'medium'
|
|
46469
46475
|
AND invalid_at IS NULL
|
|
46470
46476
|
AND ${dateCol} < ?
|
|
46471
|
-
AND verified = 1
|
|
46472
|
-
AND citation_count >= 5
|
|
46477
|
+
AND (citation_count >= 5 OR verified = 1)
|
|
46473
46478
|
`),
|
|
46474
46479
|
age7d
|
|
46475
46480
|
);
|
|
@@ -46479,13 +46484,8 @@ async function runTierPromotion(projectRoot) {
|
|
|
46479
46484
|
for (const row of mediumToLong) {
|
|
46480
46485
|
try {
|
|
46481
46486
|
nativeDb.prepare(`UPDATE ${table} SET memory_tier = 'long', updated_at = ? WHERE id = ?`).run(now2, row.id);
|
|
46482
|
-
|
|
46483
|
-
|
|
46484
|
-
table,
|
|
46485
|
-
fromTier: "medium",
|
|
46486
|
-
toTier: "long",
|
|
46487
|
-
reason: `citationCount=${row.citation_count} >= 5, verified, age > 7d`
|
|
46488
|
-
});
|
|
46487
|
+
const reason = row.citation_count >= 5 ? `citationCount=${row.citation_count} >= 5, age > 7d` : `verified=true, age > 7d`;
|
|
46488
|
+
promoted.push({ id: row.id, table, fromTier: "medium", toTier: "long", reason });
|
|
46489
46489
|
} catch {
|
|
46490
46490
|
}
|
|
46491
46491
|
}
|
|
@@ -90093,6 +90093,7 @@ async function runBrainMaintenance(projectRoot, options) {
|
|
|
90093
90093
|
skipDecay = false,
|
|
90094
90094
|
skipConsolidation = false,
|
|
90095
90095
|
skipReconciliation = false,
|
|
90096
|
+
skipTierPromotion = false,
|
|
90096
90097
|
skipEmbeddings = false,
|
|
90097
90098
|
onProgress
|
|
90098
90099
|
} = options ?? {};
|
|
@@ -90104,6 +90105,7 @@ async function runBrainMaintenance(projectRoot, options) {
|
|
|
90104
90105
|
observationsFixed: 0,
|
|
90105
90106
|
linksRemoved: 0
|
|
90106
90107
|
};
|
|
90108
|
+
const tierPromotionResult = { promoted: 0, evicted: 0 };
|
|
90107
90109
|
const embeddingsResult = {
|
|
90108
90110
|
processed: 0,
|
|
90109
90111
|
skipped: 0,
|
|
@@ -90130,6 +90132,13 @@ async function runBrainMaintenance(projectRoot, options) {
|
|
|
90130
90132
|
reconciliationResult.linksRemoved = raw.linksRemoved;
|
|
90131
90133
|
onProgress?.("reconciliation", 1, 1);
|
|
90132
90134
|
}
|
|
90135
|
+
if (!skipTierPromotion) {
|
|
90136
|
+
onProgress?.("tier-promotion", 0, 1);
|
|
90137
|
+
const raw = await runTierPromotion(projectRoot);
|
|
90138
|
+
tierPromotionResult.promoted = raw.promoted.length;
|
|
90139
|
+
tierPromotionResult.evicted = raw.evicted.length;
|
|
90140
|
+
onProgress?.("tier-promotion", 1, 1);
|
|
90141
|
+
}
|
|
90133
90142
|
if (!skipEmbeddings) {
|
|
90134
90143
|
const raw = await populateEmbeddings(projectRoot, {
|
|
90135
90144
|
onProgress: (current, total) => {
|
|
@@ -90144,6 +90153,7 @@ async function runBrainMaintenance(projectRoot, options) {
|
|
|
90144
90153
|
decay: decayResult,
|
|
90145
90154
|
consolidation: consolidationResult,
|
|
90146
90155
|
reconciliation: reconciliationResult,
|
|
90156
|
+
tierPromotion: tierPromotionResult,
|
|
90147
90157
|
embeddings: embeddingsResult,
|
|
90148
90158
|
duration: Date.now() - startTime
|
|
90149
90159
|
};
|
|
@@ -112997,9 +113007,11 @@ __export(internal_exports, {
|
|
|
112997
113007
|
routing: () => routing_exports,
|
|
112998
113008
|
runAllMigrations: () => runAllMigrations,
|
|
112999
113009
|
runBrainMaintenance: () => runBrainMaintenance,
|
|
113010
|
+
runConsolidation: () => runConsolidation,
|
|
113000
113011
|
runDoctorFixes: () => runDoctorFixes,
|
|
113001
113012
|
runMigration: () => runMigration,
|
|
113002
113013
|
runReleaseGates: () => runReleaseGates,
|
|
113014
|
+
runTierPromotion: () => runTierPromotion,
|
|
113003
113015
|
runUpgrade: () => runUpgrade,
|
|
113004
113016
|
safestop: () => safestop,
|
|
113005
113017
|
sanitizeContent: () => sanitizeContent,
|
|
@@ -134883,6 +134895,9 @@ function registerBrainCommand(program) {
|
|
|
134883
134895
|
"--skip-decay",
|
|
134884
134896
|
"Skip the temporal decay step (confidence reduction on stale learnings)"
|
|
134885
134897
|
).option("--skip-consolidation", "Skip the memory consolidation step (merging old observations)").option("--skip-reconciliation", "Skip the cross-DB orphaned reference reconciliation step").option(
|
|
134898
|
+
"--skip-tier-promotion",
|
|
134899
|
+
"Skip the tier promotion step (short\u2192medium, medium\u2192long promotion)"
|
|
134900
|
+
).option(
|
|
134886
134901
|
"--skip-embeddings",
|
|
134887
134902
|
"Skip the embedding backfill step (vector generation for observations)"
|
|
134888
134903
|
).option("--json", "Output results as JSON").action(
|
|
@@ -134897,6 +134912,7 @@ function registerBrainCommand(program) {
|
|
|
134897
134912
|
skipDecay: !!opts.skipDecay,
|
|
134898
134913
|
skipConsolidation: !!opts.skipConsolidation,
|
|
134899
134914
|
skipReconciliation: !!opts.skipReconciliation,
|
|
134915
|
+
skipTierPromotion: !!opts.skipTierPromotion,
|
|
134900
134916
|
skipEmbeddings: !!opts.skipEmbeddings,
|
|
134901
134917
|
onProgress: isJson ? void 0 : (step, current, total) => {
|
|
134902
134918
|
if (step === "embeddings" && total > 0) {
|
|
@@ -134931,6 +134947,11 @@ function registerBrainCommand(program) {
|
|
|
134931
134947
|
` Consolidation: ${result.consolidation.merged} merged, ${result.consolidation.removed} archived`
|
|
134932
134948
|
);
|
|
134933
134949
|
}
|
|
134950
|
+
if (!opts.skipTierPromotion) {
|
|
134951
|
+
console.log(
|
|
134952
|
+
` Tier promotion: ${result.tierPromotion.promoted} promoted, ${result.tierPromotion.evicted} evicted`
|
|
134953
|
+
);
|
|
134954
|
+
}
|
|
134934
134955
|
if (!opts.skipReconciliation) {
|
|
134935
134956
|
console.log(
|
|
134936
134957
|
` Reconcile: ${result.reconciliation.decisionsFixed} decisions, ${result.reconciliation.observationsFixed} observations, ${result.reconciliation.linksRemoved} links`
|
|
@@ -137854,6 +137875,7 @@ function registerMapCommand(program) {
|
|
|
137854
137875
|
}
|
|
137855
137876
|
|
|
137856
137877
|
// packages/cleo/src/cli/commands/memory-brain.ts
|
|
137878
|
+
init_internal();
|
|
137857
137879
|
init_cli();
|
|
137858
137880
|
init_renderers();
|
|
137859
137881
|
function registerMemoryBrainCommand(program) {
|
|
@@ -138216,6 +138238,61 @@ function registerMemoryBrainCommand(program) {
|
|
|
138216
138238
|
{ command: "memory", operation: "memory.code.for-memory" }
|
|
138217
138239
|
);
|
|
138218
138240
|
});
|
|
138241
|
+
memory.command("consolidate").description(
|
|
138242
|
+
"Run the full brain consolidation pipeline: dedup, quality recompute, tier promotion, contradiction detection, soft eviction, graph strengthening, summary generation. Equivalent to the session-end sleep-time consolidation but triggered on demand."
|
|
138243
|
+
).option("--json", "Output results as JSON").action(async (opts) => {
|
|
138244
|
+
const root = getProjectRoot();
|
|
138245
|
+
const isJson = !!opts.json;
|
|
138246
|
+
if (!isJson) {
|
|
138247
|
+
console.log("Running memory consolidation (including tier promotion)...");
|
|
138248
|
+
}
|
|
138249
|
+
try {
|
|
138250
|
+
const result = await runConsolidation(root);
|
|
138251
|
+
if (isJson) {
|
|
138252
|
+
console.log(
|
|
138253
|
+
JSON.stringify(
|
|
138254
|
+
{
|
|
138255
|
+
success: true,
|
|
138256
|
+
data: result,
|
|
138257
|
+
meta: {
|
|
138258
|
+
operation: "memory.consolidate",
|
|
138259
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
138260
|
+
}
|
|
138261
|
+
},
|
|
138262
|
+
null,
|
|
138263
|
+
2
|
|
138264
|
+
)
|
|
138265
|
+
);
|
|
138266
|
+
return;
|
|
138267
|
+
}
|
|
138268
|
+
console.log("\nConsolidation complete.");
|
|
138269
|
+
console.log(` Deduplicated: ${result.deduplicated}`);
|
|
138270
|
+
console.log(` Quality recomp: ${result.qualityRecomputed}`);
|
|
138271
|
+
console.log(` Tier promoted: ${result.tierPromotions.promoted.length} entries promoted`);
|
|
138272
|
+
console.log(` Tier evicted: ${result.tierPromotions.evicted.length} entries evicted`);
|
|
138273
|
+
console.log(` Contradictions: ${result.contradictions}`);
|
|
138274
|
+
console.log(` Soft evicted: ${result.softEvicted}`);
|
|
138275
|
+
console.log(` Edges strength: ${result.edgesStrengthened}`);
|
|
138276
|
+
console.log(` Summaries gen: ${result.summariesGenerated}`);
|
|
138277
|
+
if (result.graphLinksCreated !== void 0) {
|
|
138278
|
+
console.log(` Graph links: ${result.graphLinksCreated}`);
|
|
138279
|
+
}
|
|
138280
|
+
if (result.tierPromotions.promoted.length > 0) {
|
|
138281
|
+
console.log("\nTier promotions:");
|
|
138282
|
+
for (const p2 of result.tierPromotions.promoted) {
|
|
138283
|
+
console.log(` [${p2.table}] ${p2.id}: ${p2.fromTier} \u2192 ${p2.toTier} (${p2.reason})`);
|
|
138284
|
+
}
|
|
138285
|
+
}
|
|
138286
|
+
} catch (err) {
|
|
138287
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
138288
|
+
if (isJson) {
|
|
138289
|
+
console.log(JSON.stringify({ success: false, error: message }));
|
|
138290
|
+
} else {
|
|
138291
|
+
console.error(`Memory consolidation failed: ${message}`);
|
|
138292
|
+
}
|
|
138293
|
+
process.exit(1);
|
|
138294
|
+
}
|
|
138295
|
+
});
|
|
138219
138296
|
}
|
|
138220
138297
|
|
|
138221
138298
|
// packages/cleo/src/cli/commands/migrate-claude-mem.ts
|