noormme 1.2.3 → 1.2.4

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 (126) hide show
  1. package/dist/cjs/agentic/ActionJournal.d.ts +6 -6
  2. package/dist/cjs/agentic/ActionJournal.js +10 -10
  3. package/dist/cjs/agentic/CapabilityManager.d.ts +5 -5
  4. package/dist/cjs/agentic/CapabilityManager.js +34 -19
  5. package/dist/cjs/agentic/Cortex.js +12 -13
  6. package/dist/cjs/agentic/PersonaManager.d.ts +4 -4
  7. package/dist/cjs/agentic/PersonaManager.js +18 -10
  8. package/dist/cjs/agentic/PolicyEnforcer.d.ts +4 -8
  9. package/dist/cjs/agentic/PolicyEnforcer.js +25 -22
  10. package/dist/cjs/agentic/improvement/AblationEngine.d.ts +7 -3
  11. package/dist/cjs/agentic/improvement/AblationEngine.js +51 -24
  12. package/dist/cjs/agentic/improvement/ActionRefiner.d.ts +1 -1
  13. package/dist/cjs/agentic/improvement/ActionRefiner.js +25 -15
  14. package/dist/cjs/agentic/improvement/EvolutionRitual.js +2 -1
  15. package/dist/cjs/agentic/improvement/EvolutionaryPilot.d.ts +1 -1
  16. package/dist/cjs/agentic/improvement/EvolutionaryPilot.js +17 -19
  17. package/dist/cjs/agentic/improvement/GovernanceManager.d.ts +5 -5
  18. package/dist/cjs/agentic/improvement/GovernanceManager.js +12 -22
  19. package/dist/cjs/agentic/improvement/HiveLink.d.ts +3 -3
  20. package/dist/cjs/agentic/improvement/HiveLink.js +15 -157
  21. package/dist/cjs/agentic/improvement/KnowledgeDistiller.d.ts +15 -29
  22. package/dist/cjs/agentic/improvement/KnowledgeDistiller.js +66 -349
  23. package/dist/cjs/agentic/improvement/QuotaManager.d.ts +1 -1
  24. package/dist/cjs/agentic/improvement/QuotaManager.js +11 -11
  25. package/dist/cjs/agentic/improvement/RecursiveReasoner.d.ts +4 -4
  26. package/dist/cjs/agentic/improvement/RecursiveReasoner.js +10 -10
  27. package/dist/cjs/agentic/improvement/ReflectionEngine.d.ts +2 -2
  28. package/dist/cjs/agentic/improvement/ReflectionEngine.js +2 -2
  29. package/dist/cjs/agentic/improvement/RitualOrchestrator.d.ts +3 -3
  30. package/dist/cjs/agentic/improvement/RitualOrchestrator.js +12 -9
  31. package/dist/cjs/agentic/improvement/SelfEvolution.d.ts +1 -1
  32. package/dist/cjs/agentic/improvement/SelfEvolution.js +21 -18
  33. package/dist/cjs/agentic/improvement/SelfTestRegistry.d.ts +1 -1
  34. package/dist/cjs/agentic/improvement/SelfTestRegistry.js +31 -19
  35. package/dist/cjs/agentic/improvement/SovereignMetrics.d.ts +6 -6
  36. package/dist/cjs/agentic/improvement/SovereignMetrics.js +12 -12
  37. package/dist/cjs/agentic/improvement/StrategicPlanner.d.ts +10 -54
  38. package/dist/cjs/agentic/improvement/StrategicPlanner.js +43 -396
  39. package/dist/cjs/agentic/improvement/distillation/ConflictChallenger.d.ts +3 -0
  40. package/dist/cjs/agentic/improvement/distillation/ConflictChallenger.js +54 -0
  41. package/dist/cjs/agentic/improvement/distillation/FactDistiller.d.ts +10 -0
  42. package/dist/cjs/agentic/improvement/distillation/FactDistiller.js +115 -0
  43. package/dist/cjs/agentic/improvement/distillation/KnowledgeConsolidator.d.ts +6 -0
  44. package/dist/cjs/agentic/improvement/distillation/KnowledgeConsolidator.js +63 -0
  45. package/dist/cjs/agentic/improvement/distillation/RelationshipArchitect.d.ts +6 -0
  46. package/dist/cjs/agentic/improvement/distillation/RelationshipArchitect.js +73 -0
  47. package/dist/cjs/agentic/improvement/governance/MaintenanceOracle.js +5 -5
  48. package/dist/cjs/agentic/improvement/governance/PersonaAuditor.js +4 -4
  49. package/dist/cjs/agentic/improvement/governance/RemediationEngine.js +8 -3
  50. package/dist/cjs/agentic/improvement/hive/DomainMaster.d.ts +4 -0
  51. package/dist/cjs/agentic/improvement/hive/DomainMaster.js +19 -0
  52. package/dist/cjs/agentic/improvement/hive/KnowledgePromoter.d.ts +6 -0
  53. package/dist/cjs/agentic/improvement/hive/KnowledgePromoter.js +56 -0
  54. package/dist/cjs/agentic/improvement/hive/SkillPropagator.d.ts +6 -0
  55. package/dist/cjs/agentic/improvement/hive/SkillPropagator.js +91 -0
  56. package/dist/cjs/agentic/improvement/strategy/EvolutionVerificator.d.ts +6 -0
  57. package/dist/cjs/agentic/improvement/strategy/EvolutionVerificator.js +48 -0
  58. package/dist/cjs/agentic/improvement/strategy/MutationEngine.d.ts +10 -0
  59. package/dist/cjs/agentic/improvement/strategy/MutationEngine.js +119 -0
  60. package/dist/cjs/agentic/improvement/strategy/PerformanceAnalyst.d.ts +6 -0
  61. package/dist/cjs/agentic/improvement/strategy/PerformanceAnalyst.js +84 -0
  62. package/dist/cjs/cli/index.js +0 -0
  63. package/dist/cjs/types/index.d.ts +8 -0
  64. package/dist/esm/agentic/ActionJournal.d.ts +6 -6
  65. package/dist/esm/agentic/ActionJournal.js +10 -10
  66. package/dist/esm/agentic/CapabilityManager.d.ts +5 -5
  67. package/dist/esm/agentic/CapabilityManager.js +34 -19
  68. package/dist/esm/agentic/Cortex.js +12 -13
  69. package/dist/esm/agentic/PersonaManager.d.ts +4 -4
  70. package/dist/esm/agentic/PersonaManager.js +18 -10
  71. package/dist/esm/agentic/PolicyEnforcer.d.ts +4 -8
  72. package/dist/esm/agentic/PolicyEnforcer.js +25 -22
  73. package/dist/esm/agentic/improvement/AblationEngine.d.ts +7 -3
  74. package/dist/esm/agentic/improvement/AblationEngine.js +51 -24
  75. package/dist/esm/agentic/improvement/ActionRefiner.d.ts +1 -1
  76. package/dist/esm/agentic/improvement/ActionRefiner.js +25 -15
  77. package/dist/esm/agentic/improvement/EvolutionRitual.js +2 -1
  78. package/dist/esm/agentic/improvement/EvolutionaryPilot.d.ts +1 -1
  79. package/dist/esm/agentic/improvement/EvolutionaryPilot.js +17 -19
  80. package/dist/esm/agentic/improvement/GovernanceManager.d.ts +5 -5
  81. package/dist/esm/agentic/improvement/GovernanceManager.js +12 -22
  82. package/dist/esm/agentic/improvement/HiveLink.d.ts +3 -3
  83. package/dist/esm/agentic/improvement/HiveLink.js +15 -157
  84. package/dist/esm/agentic/improvement/KnowledgeDistiller.d.ts +15 -29
  85. package/dist/esm/agentic/improvement/KnowledgeDistiller.js +66 -349
  86. package/dist/esm/agentic/improvement/QuotaManager.d.ts +1 -1
  87. package/dist/esm/agentic/improvement/QuotaManager.js +11 -11
  88. package/dist/esm/agentic/improvement/RecursiveReasoner.d.ts +4 -4
  89. package/dist/esm/agentic/improvement/RecursiveReasoner.js +10 -10
  90. package/dist/esm/agentic/improvement/ReflectionEngine.d.ts +2 -2
  91. package/dist/esm/agentic/improvement/ReflectionEngine.js +2 -2
  92. package/dist/esm/agentic/improvement/RitualOrchestrator.d.ts +3 -3
  93. package/dist/esm/agentic/improvement/RitualOrchestrator.js +12 -9
  94. package/dist/esm/agentic/improvement/SelfEvolution.d.ts +1 -1
  95. package/dist/esm/agentic/improvement/SelfEvolution.js +21 -18
  96. package/dist/esm/agentic/improvement/SelfTestRegistry.d.ts +1 -1
  97. package/dist/esm/agentic/improvement/SelfTestRegistry.js +31 -19
  98. package/dist/esm/agentic/improvement/SovereignMetrics.d.ts +6 -6
  99. package/dist/esm/agentic/improvement/SovereignMetrics.js +12 -12
  100. package/dist/esm/agentic/improvement/StrategicPlanner.d.ts +10 -54
  101. package/dist/esm/agentic/improvement/StrategicPlanner.js +43 -396
  102. package/dist/esm/agentic/improvement/distillation/ConflictChallenger.d.ts +3 -0
  103. package/dist/esm/agentic/improvement/distillation/ConflictChallenger.js +51 -0
  104. package/dist/esm/agentic/improvement/distillation/FactDistiller.d.ts +10 -0
  105. package/dist/esm/agentic/improvement/distillation/FactDistiller.js +112 -0
  106. package/dist/esm/agentic/improvement/distillation/KnowledgeConsolidator.d.ts +6 -0
  107. package/dist/esm/agentic/improvement/distillation/KnowledgeConsolidator.js +60 -0
  108. package/dist/esm/agentic/improvement/distillation/RelationshipArchitect.d.ts +6 -0
  109. package/dist/esm/agentic/improvement/distillation/RelationshipArchitect.js +70 -0
  110. package/dist/esm/agentic/improvement/governance/MaintenanceOracle.js +5 -5
  111. package/dist/esm/agentic/improvement/governance/PersonaAuditor.js +4 -4
  112. package/dist/esm/agentic/improvement/governance/RemediationEngine.js +8 -3
  113. package/dist/esm/agentic/improvement/hive/DomainMaster.d.ts +4 -0
  114. package/dist/esm/agentic/improvement/hive/DomainMaster.js +16 -0
  115. package/dist/esm/agentic/improvement/hive/KnowledgePromoter.d.ts +6 -0
  116. package/dist/esm/agentic/improvement/hive/KnowledgePromoter.js +53 -0
  117. package/dist/esm/agentic/improvement/hive/SkillPropagator.d.ts +6 -0
  118. package/dist/esm/agentic/improvement/hive/SkillPropagator.js +88 -0
  119. package/dist/esm/agentic/improvement/strategy/EvolutionVerificator.d.ts +6 -0
  120. package/dist/esm/agentic/improvement/strategy/EvolutionVerificator.js +45 -0
  121. package/dist/esm/agentic/improvement/strategy/MutationEngine.d.ts +10 -0
  122. package/dist/esm/agentic/improvement/strategy/MutationEngine.js +116 -0
  123. package/dist/esm/agentic/improvement/strategy/PerformanceAnalyst.d.ts +6 -0
  124. package/dist/esm/agentic/improvement/strategy/PerformanceAnalyst.js +81 -0
  125. package/dist/esm/types/index.d.ts +8 -0
  126. package/package.json +40 -44
@@ -10,11 +10,13 @@ export declare class HiveLink {
10
10
  private cortex;
11
11
  private config;
12
12
  private knowledgeTable;
13
+ private promoter;
14
+ private propagator;
15
+ private domainMaster;
13
16
  constructor(db: Kysely<any>, cortex: Cortex, config?: AgenticConfig);
14
17
  private get typedDb();
15
18
  /**
16
19
  * Promote high-confidence local knowledge to global "Hive" knowledge.
17
- * This creates a new, session-agnostic entry or updates an existing global one.
18
20
  */
19
21
  broadcastKnowledge(options?: {
20
22
  minConfidence?: number;
@@ -23,12 +25,10 @@ export declare class HiveLink {
23
25
  }): Promise<number>;
24
26
  /**
25
27
  * Strengthen knowledge related to a specific domain (tag).
26
- * Increases confidence of all items with this tag, representing "domain mastery".
27
28
  */
28
29
  syncDomain(domainTag: string, boostFactor?: number): Promise<number>;
29
30
  /**
30
31
  * Propagate high-performing capabilities globally using the "Sovereign Draft" protocol.
31
- * Uses Bayesian Convergence and Shadow Promotion to avoid deadlocks.
32
32
  */
33
33
  broadcastSkills(): Promise<number>;
34
34
  /**
@@ -1,5 +1,7 @@
1
1
  /// <reference types="./HiveLink.d.ts" />
2
- import { sql } from '../../raw-builder/sql.js';
2
+ import { KnowledgePromoter } from './hive/KnowledgePromoter.js';
3
+ import { SkillPropagator } from './hive/SkillPropagator.js';
4
+ import { DomainMaster } from './hive/DomainMaster.js';
3
5
  /**
4
6
  * HiveLink facilitates "Collective Intelligence" by synchronizing
5
7
  * knowledge and lessons learned across different agent personas.
@@ -9,108 +11,53 @@ export class HiveLink {
9
11
  cortex;
10
12
  config;
11
13
  knowledgeTable;
14
+ promoter;
15
+ propagator;
16
+ domainMaster;
12
17
  constructor(db, cortex, config = {}) {
13
18
  this.db = db;
14
19
  this.cortex = cortex;
15
20
  this.config = config;
16
21
  this.knowledgeTable = config.knowledgeTable || 'agent_knowledge_base';
22
+ this.promoter = new KnowledgePromoter();
23
+ this.propagator = new SkillPropagator();
24
+ this.domainMaster = new DomainMaster();
17
25
  }
18
26
  get typedDb() {
19
27
  return this.db;
20
28
  }
21
29
  /**
22
30
  * Promote high-confidence local knowledge to global "Hive" knowledge.
23
- * This creates a new, session-agnostic entry or updates an existing global one.
24
31
  */
25
32
  async broadcastKnowledge(options = {}) {
26
33
  const minConfidence = options.minConfidence ?? 0.9;
27
34
  const limit = options.limit ?? 100;
28
35
  const offset = options.offset ?? 0;
29
36
  console.log(`[HiveLink] Broadcasting knowledge (limit=${limit}, offset=${offset}) with confidence >= ${minConfidence}`);
30
- // Find high-confidence items that are "local" (have a source_session_id)
31
37
  const items = (await this.typedDb
32
38
  .selectFrom(this.knowledgeTable)
33
39
  .selectAll()
34
40
  .where('confidence', '>=', minConfidence)
35
- .where('source_session_id', 'is not', null) // Only local items
41
+ .where('source_session_id', 'is not', null)
36
42
  .limit(limit)
37
43
  .offset(offset)
38
44
  .execute());
39
45
  let promotedCount = 0;
40
46
  for (const item of items) {
41
- await this.db.transaction().execute(async (trx) => {
42
- // Check if a global version already exists
43
- const existingGlobal = await trx
44
- .selectFrom(this.knowledgeTable)
45
- .selectAll()
46
- .where('entity', '=', item.entity)
47
- .where('fact', '=', item.fact)
48
- .where('source_session_id', 'is', null)
49
- .forUpdate() // Audit Phase 15: prevent concurrent promotion duplication
50
- .executeTakeFirst();
51
- if (existingGlobal) {
52
- // Reinforce existing global knowledge
53
- const newConfidence = Math.min(0.99, Math.max(existingGlobal.confidence, item.confidence) + 0.01);
54
- await trx
55
- .updateTable(this.knowledgeTable)
56
- .set({
57
- confidence: newConfidence,
58
- updated_at: new Date(),
59
- })
60
- .where('id', '=', existingGlobal.id)
61
- .execute();
62
- }
63
- else {
64
- // Create new global knowledge
65
- const tags = item.tags ? [...item.tags] : [];
66
- if (!tags.includes('hive_mind'))
67
- tags.push('hive_mind');
68
- await trx
69
- .insertInto(this.knowledgeTable)
70
- .values({
71
- entity: item.entity,
72
- fact: item.fact,
73
- confidence: item.confidence,
74
- source_session_id: null,
75
- tags: JSON.stringify(tags),
76
- metadata: JSON.stringify({
77
- ...item.metadata,
78
- promoted_from: item.id,
79
- promoted_at: new Date(),
80
- }),
81
- created_at: new Date(),
82
- updated_at: new Date(),
83
- })
84
- .execute();
85
- promotedCount++;
86
- }
87
- });
47
+ const promoted = await this.promoter.promote(this.db, this.cortex, this.config, this.knowledgeTable, item);
48
+ if (promoted)
49
+ promotedCount++;
88
50
  }
89
51
  return promotedCount;
90
52
  }
91
53
  /**
92
54
  * Strengthen knowledge related to a specific domain (tag).
93
- * Increases confidence of all items with this tag, representing "domain mastery".
94
55
  */
95
56
  async syncDomain(domainTag, boostFactor = 0.05) {
96
- console.log(`[HiveLink] Syncing/Boosting domain '${domainTag}' (Set-Based)`);
97
- // Use a single SQL update for high throughput
98
- const result = await this.db
99
- .updateTable(this.knowledgeTable)
100
- .set({
101
- confidence: sql `MIN(1.0, confidence + ${boostFactor})`,
102
- updated_at: new Date(),
103
- })
104
- .where('tags', 'like', `%"${domainTag}"%`)
105
- .where('confidence', '<', 1.0)
106
- .execute();
107
- // Kysely update .execute() returns an array of results or similar depending on adapter
108
- // For simple update, we might just return the count if supported or 1
109
- return Number(result[0]?.numUpdatedRows ?? 1);
57
+ return this.domainMaster.boostDomain(this.db, this.knowledgeTable, domainTag, boostFactor);
110
58
  }
111
59
  /**
112
60
  * Propagate high-performing capabilities globally using the "Sovereign Draft" protocol.
113
- * Uses Bayesian Convergence and Shadow Promotion to avoid deadlocks.
114
61
  */
115
62
  async broadcastSkills() {
116
63
  if (!this.config.evolution?.enableHiveLink &&
@@ -119,96 +66,7 @@ export class HiveLink {
119
66
  return 0;
120
67
  }
121
68
  console.log(`[HiveLink] Executing Sovereign Draft for emergent skills...`);
122
- let broadcastCount = 0;
123
- const capTable = this.config.capabilitiesTable || 'agent_capabilities';
124
- // 1. Resolve Verified Skills with Bayesian "Alpha" selection
125
- const verifiedSkills = await this.cortex.capabilities.getCapabilities('verified');
126
- // Group verified skills by lineage (base tool name)
127
- const lineageGroups = new Map();
128
- for (const skill of verifiedSkills) {
129
- const meta = typeof skill.metadata === 'string' ? JSON.parse(skill.metadata) : (skill.metadata || {});
130
- const lineage = meta.lineage || skill.name;
131
- if (!lineageGroups.has(lineage))
132
- lineageGroups.set(lineage, []);
133
- lineageGroups.get(lineage).push({ skill, meta });
134
- }
135
- for (const [lineage, variants] of lineageGroups.entries()) {
136
- // Bayesian Winner Selection
137
- // Score = (anchored_reliability * totalCount + K * prior) / (totalCount + K)
138
- // For simplicity, we use anchored_reliability which already incorporates this weighting
139
- const alphaCandidate = variants.reduce((prev, curr) => {
140
- const pAnchored = prev.meta.anchored_reliability ?? 0;
141
- const cAnchored = curr.meta.anchored_reliability ?? 0;
142
- return cAnchored > pAnchored ? curr : prev;
143
- });
144
- // Non-Blocking Set Update: Flag Alpha and Shadow versions
145
- await this.db.transaction().execute(async (trx) => {
146
- const currentMeta = alphaCandidate.meta || {};
147
- const updatedMeta = {
148
- ...currentMeta,
149
- is_alpha: true,
150
- broadcasted: true,
151
- broadcasted_at: new Date()
152
- };
153
- // Flag the winner as Alpha
154
- // Audit Phase 15: Lock candidate before promotion
155
- const winner = await trx
156
- .selectFrom(capTable)
157
- .select('id')
158
- .where('id', '=', alphaCandidate.skill.id)
159
- .forUpdate()
160
- .executeTakeFirst();
161
- if (winner) {
162
- await trx
163
- .updateTable(capTable)
164
- .set({
165
- metadata: JSON.stringify(updatedMeta),
166
- })
167
- .where('id', '=', winner.id)
168
- .execute();
169
- }
170
- // Flag others in the same lineage as Shadow (Dialect-safe approach)
171
- const shadowIds = variants
172
- .filter(v => v.skill.id !== alphaCandidate.skill.id)
173
- .map(v => v.skill.id);
174
- if (shadowIds.length > 0) {
175
- // We fetch and update individually or use a bulk update if the dialect supports complex JSON manipulation.
176
- // For maximum compatibility (Postgres/SQLite), we do it in a loop for the shadows if the count is small.
177
- for (const sid of shadowIds) {
178
- const sMatch = variants.find(v => v.skill.id === sid);
179
- const sMeta = sMatch?.meta || {};
180
- await trx.updateTable(capTable)
181
- .set({
182
- metadata: JSON.stringify({ ...sMeta, is_alpha: false, is_shadow: true }),
183
- status: 'experimental'
184
- })
185
- .where('id', '=', sid)
186
- .execute();
187
- }
188
- }
189
- });
190
- broadcastCount += variants.length;
191
- }
192
- // 2. Broadcast Blacklisted Skills (Immune Prophet)
193
- const blacklisted = await this.cortex.capabilities.getCapabilities('blacklisted');
194
- const blackIDs = blacklisted
195
- .filter(s => {
196
- const meta = typeof s.metadata === 'string' ? JSON.parse(s.metadata) : (s.metadata || {});
197
- return !meta.broadcasted;
198
- })
199
- .map(s => s.id);
200
- if (blackIDs.length > 0) {
201
- await this.db
202
- .updateTable(capTable)
203
- .set({
204
- metadata: sql `json_set(metadata, '$.broadcasted', true, '$.hive_blacklisted', true)`,
205
- updated_at: new Date()
206
- })
207
- .where('id', 'in', blackIDs)
208
- .execute();
209
- broadcastCount += blackIDs.length;
210
- }
211
- return broadcastCount;
69
+ return this.propagator.propagate(this.db, this.cortex, this.config);
212
70
  }
213
71
  /**
214
72
  * Simple semver-style version comparison.
@@ -35,50 +35,33 @@ export declare class KnowledgeDistiller {
35
35
  private knowledgeTable;
36
36
  private linksTable;
37
37
  private bloomFilter;
38
- constructor(db: Kysely<any>, // accepting any Kysely but casting internally for our specific tables
39
- config?: AgenticConfig);
40
- /**
41
- * typedDb helper to cast the generic DB to our specific schema
42
- */
43
- private get typedDb();
38
+ private distiller;
39
+ private challenger;
40
+ private architect;
41
+ private consolidator;
42
+ constructor(db: Kysely<any>, config?: AgenticConfig);
44
43
  /**
45
44
  * Add or update a knowledge item with robust merging and transaction support.
46
45
  */
47
46
  distill(entity: string, fact: string, confidence: number, sourceSessionId?: string | number, tags?: string[], metadata?: Record<string, any>, source?: 'user' | 'assistant' | 'system'): Promise<KnowledgeItem>;
47
+ /**
48
+ * Manually challenge an existing fact with competing information.
49
+ */
50
+ challengeKnowledge(entity: string, fact: string, confidence: number, trxOrDb?: any): Promise<void>;
48
51
  /**
49
52
  * Verify and reinforce existing knowledge.
50
- * Increases confidence if the fact matches.
51
53
  */
52
54
  verifyKnowledge(id: number | string, reinforcement?: number): Promise<KnowledgeItem | null>;
53
55
  /**
54
56
  * Search knowledge by entity with optional tag filtering.
55
- * Records a "hit" for each retrieved item to track utility.
56
57
  */
57
58
  getKnowledgeByEntity(entity: string, filterTags?: string[]): Promise<KnowledgeItem[]>;
58
59
  /**
59
- * Record a retrieval hit for a knowledge item.
60
+ * Record a retrieval hit for a knowledge item and emit hotspot telemetry.
60
61
  */
61
62
  recordHit(id: number | string): Promise<void>;
62
- /**
63
- * Calculate the "Fitness" of a memory item.
64
- * Score = (Confidence * 0.4) + (SignalToNoise * 0.4) + (SourceMultiplier * 0.2)
65
- */
66
- calculateFitness(item: KnowledgeItem): number;
67
- /**
68
- * Challenge existing knowledge with new evidence.
69
- * If confidence of new fact is high and contradicts existing ones (same entity, different fact),
70
- * we degrade the confidence of the old facts.
71
- */
72
- challengeKnowledge(entity: string, competingFact: string, confidence: number, trxOrDb?: any): Promise<void>;
73
- /**
74
- * Automatic Semantic Linking
75
- * Scans for entity mentions in facts and creates links.
76
- * Production Hardening: Uses batched cross-similarity and NER-style tokenization.
77
- */
78
- private autoLinkKnowledge;
79
63
  /**
80
64
  * Link two knowledge items together with a relationship.
81
- * Transaction-aware version.
82
65
  */
83
66
  linkKnowledge(sourceId: number | string, targetId: number | string, relationship: string, metadata?: Record<string, any>, trxOrDb?: any): Promise<void>;
84
67
  /**
@@ -97,10 +80,13 @@ export declare class KnowledgeDistiller {
97
80
  pruneLowConfidence(threshold?: number): Promise<number>;
98
81
  /**
99
82
  * Consolidate knowledge by merging similar facts for the same entity.
100
- * Production Hardening: Iterative bucketed approach to avoid recursive stack issues.
101
83
  */
102
84
  consolidateKnowledge(): Promise<number>;
103
- private mergeItems;
85
+ /**
86
+ * Calculate the "Fitness" of a knowledge item.
87
+ * Score = (Confidence * 0.4) + (SignalToNoise * 0.4) + (SourceMultiplier * 0.2)
88
+ */
89
+ calculateFitness(item: KnowledgeItem): number;
104
90
  private bloomHash;
105
91
  private parseKnowledge;
106
92
  }