diff --git a/packages/memory-graph/src/constants.ts b/packages/memory-graph/src/constants.ts index d191ee39..97364f09 100644 --- a/packages/memory-graph/src/constants.ts +++ b/packages/memory-graph/src/constants.ts @@ -9,22 +9,22 @@ export const MEMORY_BORDER_KEYS = { export const FORCE_CONFIG = { linkStrength: { - docMemory: 0.25, - version: 0.8, - docDocBase: 0.15, - fallback: 0.15, + docMemory: 0.12, + version: 0.5, + docDocBase: 0.08, + fallback: 0.08, }, - linkDistance: 200, - docMemoryDistance: 150, - chargeStrength: -1500, - collisionRadius: { document: 60, memory: 30 }, - collisionStrength: 0.6, - centeringStrength: 0.25, - alphaDecay: 0.04, + linkDistance: 300, + docMemoryDistance: 220, + chargeStrength: -2500, + collisionRadius: { document: 70, memory: 35 }, + collisionStrength: 0.7, + centeringStrength: 0.08, + alphaDecay: 0.025, alphaMin: 0.001, - velocityDecay: 0.6, + velocityDecay: 0.45, alphaTarget: 0.3, - preSettleTicks: 120, + preSettleTicks: 250, } export const GRAPH_SETTINGS = { diff --git a/packages/memory-graph/src/hooks/use-graph-data.ts b/packages/memory-graph/src/hooks/use-graph-data.ts index e50136b0..68d6060d 100644 --- a/packages/memory-graph/src/hooks/use-graph-data.ts +++ b/packages/memory-graph/src/hooks/use-graph-data.ts @@ -11,7 +11,7 @@ import type { const SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000 const ONE_DAY_MS = 24 * 60 * 60 * 1000 -const MEMORY_ORBIT_BASE = 120 +const MEMORY_ORBIT_BASE = 200 export function getMemoryBorderColor( mem: GraphApiMemory, @@ -86,9 +86,9 @@ export function useGraphData( const cx = canvasWidth / 2 const cy = canvasHeight / 2 const docCount = documents.length - // Compact spiral -- just enough to avoid overlap. The simulation - // handles the final spread via charge repulsion. - const spiralScale = Math.sqrt(docCount) * 25 + // Wide spiral so documents start well-separated. The simulation + // refines positions but the initial spread prevents clustering. + const spiralScale = Math.sqrt(docCount) * 60 // Golden angle (~137.5 deg) produces optimal packing in a spiral const goldenAngle = Math.PI * (3 - Math.sqrt(5)) @@ -149,7 +149,7 @@ export function useGraphData( // with slight randomness from hash for organic feel const memAngle = (i / memCount) * 2 * Math.PI + hashToUnit(mem.id) * 0.5 - const memRadius = MEMORY_ORBIT_BASE + hashToUnit(`${mem.id}-r`) * 60 + const memRadius = MEMORY_ORBIT_BASE + hashToUnit(`${mem.id}-r`) * 120 memNode = { id: mem.id, type: "memory",