@yemi33/minions 0.1.2349 → 0.1.2350
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/engine/kb-sweep.js +14 -2
- package/package.json +1 -1
package/engine/kb-sweep.js
CHANGED
|
@@ -658,8 +658,14 @@ ${body}`;
|
|
|
658
658
|
return { processed, bytesBefore, bytesAfter };
|
|
659
659
|
}
|
|
660
660
|
|
|
661
|
-
function _applyLlmPlan(plan, manifest, opts = {}) {
|
|
661
|
+
function _applyLlmPlan(plan, manifest, changedIdx, opts = {}) {
|
|
662
662
|
let removed = 0, merged = 0, reclassified = 0;
|
|
663
|
+
// changedIdx is the set of manifest indices actually content-analyzed by
|
|
664
|
+
// the LLM this batch (see _llmBatchSweep's scannedIdx). Duplicate pairs
|
|
665
|
+
// referencing only unanalyzed indices (LLM hallucination / stale index
|
|
666
|
+
// mis-reference) must never be archived — a pair is only trustworthy if
|
|
667
|
+
// at least one side was actually analyzed this batch (W-mrb447th00062813).
|
|
668
|
+
const changedSet = new Set(changedIdx || []);
|
|
663
669
|
for (const r of (plan.remove || [])) {
|
|
664
670
|
const entry = manifest[r.index];
|
|
665
671
|
if (!entry) continue;
|
|
@@ -667,6 +673,11 @@ function _applyLlmPlan(plan, manifest, opts = {}) {
|
|
|
667
673
|
if (_archiveKbFile(path.join(KB_DIR, entry.category, entry.file), `stale: ${r.reason || ''}`)) removed++;
|
|
668
674
|
}
|
|
669
675
|
for (const d of (plan.duplicates || [])) {
|
|
676
|
+
const pairIdx = [d.keep, ...(d.remove || [])];
|
|
677
|
+
if (!pairIdx.some((idx) => changedSet.has(idx))) {
|
|
678
|
+
log('warn', `[kb-sweep] duplicate pair (keep=${d.keep}, remove=${JSON.stringify(d.remove)}) references no analyzed (changedIdx) entry — skipping archive to avoid acting on a hallucinated/stale LLM reference`);
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
670
681
|
for (const idx of (d.remove || [])) {
|
|
671
682
|
const entry = manifest[idx];
|
|
672
683
|
if (!entry) continue;
|
|
@@ -954,7 +965,7 @@ async function _runKbSweepImpl(opts = {}) {
|
|
|
954
965
|
// Only runs against survivors, but we need indices that match the LIST sent to the LLM
|
|
955
966
|
const llmManifest = afterConsolidate;
|
|
956
967
|
const { plan, scannedIdx: llmScannedIdx } = await _llmBatchSweep(llmManifest, callLLM, trackEngineUsage, opts);
|
|
957
|
-
const llmActions = _applyLlmPlan(plan, llmManifest, opts);
|
|
968
|
+
const llmActions = _applyLlmPlan(plan, llmManifest, llmScannedIdx, opts);
|
|
958
969
|
summary.llmDuplicatesArchived = llmActions.merged;
|
|
959
970
|
summary.staleRemoved = llmActions.removed;
|
|
960
971
|
summary.reclassified = llmActions.reclassified;
|
|
@@ -1170,6 +1181,7 @@ module.exports = {
|
|
|
1170
1181
|
_llmBatchSweep,
|
|
1171
1182
|
_classifyLlmScanFreshness,
|
|
1172
1183
|
_markLlmScanned,
|
|
1184
|
+
_applyLlmPlan,
|
|
1173
1185
|
LLM_SCAN_FLAG_KEY,
|
|
1174
1186
|
CONSOLIDATION_DIGEST_PREFIX,
|
|
1175
1187
|
COMPRESS_THRESHOLD_BYTES,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2350",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|