prism-mcp-server 8.0.2 → 8.0.3

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.
@@ -138,13 +138,20 @@ export async function propagateActivation(anchors, linkFetcher, config = {}) {
138
138
  break;
139
139
  }
140
140
  totalEdgesTraversed += edges.length;
141
- // Compute out-degree per active source node (for fan effect)
141
+ // Compute out-degree per active source node (for forward fan effect)
142
142
  const outDegree = new Map();
143
143
  for (const edge of edges) {
144
144
  if (activeNodes.has(edge.source_id)) {
145
145
  outDegree.set(edge.source_id, (outDegree.get(edge.source_id) || 0) + 1);
146
146
  }
147
147
  }
148
+ // Compute in-degree per active target node (for backward fan effect)
149
+ const inDegree = new Map();
150
+ for (const edge of edges) {
151
+ if (activeNodes.has(edge.target_id)) {
152
+ inDegree.set(edge.target_id, (inDegree.get(edge.target_id) || 0) + 1);
153
+ }
154
+ }
148
155
  // Next-iteration activation: starts with current values (activation persists)
149
156
  const nextNodes = new Map(activeNodes);
150
157
  for (const edge of edges) {
@@ -171,7 +178,11 @@ export async function propagateActivation(anchors, linkFetcher, config = {}) {
171
178
  if (activeNodes.has(edge.target_id) && !visitedEdges.has(reverseEdgeKey)) {
172
179
  visitedEdges.add(reverseEdgeKey);
173
180
  const targetEnergy = activeNodes.get(edge.target_id);
174
- const flow = (cfg.spreadFactor * 0.5) * (strength * targetEnergy);
181
+ // Dampened fan effect for backward flow: prevents hub nodes with many
182
+ // inbound edges from blasting energy to all sources equally.
183
+ const inDegreeCount = inDegree.get(edge.target_id) || 1;
184
+ const dampedFanBack = Math.log(inDegreeCount + Math.E);
185
+ const flow = (cfg.spreadFactor * 0.5) * (strength * targetEnergy / dampedFanBack);
175
186
  nextNodes.set(edge.source_id, (nextNodes.get(edge.source_id) || 0) + flow);
176
187
  // Track hop distance for backward discoveries
177
188
  const targetHops = hopDistance.get(edge.target_id) ?? 0;
@@ -166,7 +166,7 @@ export class SqliteStorage {
166
166
  VALUES ('delete', old.rowid, old.project, old.summary, old.decisions, old.keywords);
167
167
  END;
168
168
 
169
- CREATE TRIGGER IF NOT EXISTS ledger_fts_update AFTER UPDATE ON session_ledger BEGIN
169
+ CREATE TRIGGER IF NOT EXISTS ledger_fts_update AFTER UPDATE OF project, summary, decisions, keywords ON session_ledger BEGIN
170
170
  INSERT INTO ledger_fts(ledger_fts, rowid, project, summary, decisions, keywords)
171
171
  VALUES ('delete', old.rowid, old.project, old.summary, old.decisions, old.keywords);
172
172
  INSERT INTO ledger_fts(rowid, project, summary, decisions, keywords)
@@ -2847,7 +2847,7 @@ export class SqliteStorage {
2847
2847
  WITH input_kw(kw) AS (VALUES ${placeholders})
2848
2848
  SELECT sl.id, COUNT(DISTINCT ik.kw) AS shared_count
2849
2849
  FROM session_ledger sl,
2850
- json_each(sl.keywords) AS je,
2850
+ json_each(COALESCE(sl.keywords, '[]')) AS je,
2851
2851
  input_kw ik
2852
2852
  WHERE sl.user_id = ?
2853
2853
  AND sl.project = ?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prism-mcp-server",
3
- "version": "8.0.2",
3
+ "version": "8.0.3",
4
4
  "mcpName": "io.github.dcostenco/prism-mcp",
5
5
  "description": "The Mind Palace for AI Agents — a true Cognitive Architecture with Hebbian learning (episodic→semantic consolidation), ACT-R spreading activation (multi-hop causal reasoning), uncertainty-aware rejection gates (agents that know when they don't know), adversarial evaluation (anti-sycophancy), fail-closed Dark Factory pipelines, persistent memory (SQLite/Supabase), multi-agent Hivemind, time travel & visual dashboard. Zero-config local mode.",
6
6
  "module": "index.ts",