stellar-memory 0.6.0 → 0.8.0
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/init.d.ts +2 -0
- package/dist/cli/init.js +117 -21
- package/dist/cli/init.js.map +1 -1
- package/dist/engine/consolidation.d.ts +27 -0
- package/dist/engine/consolidation.js +78 -1
- package/dist/engine/consolidation.js.map +1 -1
- package/dist/engine/content-weight.d.ts +24 -0
- package/dist/engine/content-weight.js +94 -0
- package/dist/engine/content-weight.js.map +1 -0
- package/dist/engine/gravity.d.ts +31 -2
- package/dist/engine/gravity.js +52 -3
- package/dist/engine/gravity.js.map +1 -1
- package/dist/engine/orbit.d.ts +39 -41
- package/dist/engine/orbit.js +96 -76
- package/dist/engine/orbit.js.map +1 -1
- package/dist/engine/planet.js +89 -11
- package/dist/engine/planet.js.map +1 -1
- package/dist/engine/types.d.ts +12 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +50 -19
- package/dist/mcp/server.js.map +1 -1
- package/dist/service/scheduler.d.ts +1 -1
- package/dist/service/scheduler.js +1 -1
- package/dist/service/scheduler.js.map +1 -1
- package/dist/storage/queries.d.ts +2 -0
- package/dist/storage/queries.js +15 -0
- package/dist/storage/queries.js.map +1 -1
- package/dist/utils/config.js +10 -1
- package/dist/utils/config.js.map +1 -1
- package/package.json +1 -1
package/dist/engine/gravity.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* gravity.ts — Relevance calculation (keyword + vector)
|
|
2
|
+
* gravity.ts — Relevance calculation (keyword + vector) and retrieval scoring
|
|
3
3
|
*
|
|
4
4
|
* Phase 1: keyword overlap between memory content and sun context.
|
|
5
5
|
* Phase 2: cosine vector similarity + hybrid score combining both.
|
|
6
6
|
*
|
|
7
|
-
* Hybrid formula: 0.7 × vectorRelevance + 0.3 × keywordRelevance
|
|
7
|
+
* Hybrid formula (storage relevance): 0.7 × vectorRelevance + 0.3 × keywordRelevance
|
|
8
|
+
*
|
|
9
|
+
* Retrieval formula (search ranking):
|
|
10
|
+
* retrieval_score = semanticW × semantic_similarity
|
|
11
|
+
* + keywordW × keyword_overlap
|
|
12
|
+
* + proximityW × proximity_bonus
|
|
13
|
+
* where proximity_bonus = 1.0 - (distance / 100)
|
|
8
14
|
*
|
|
9
15
|
* The keyword score is retained as a fast fallback when embeddings are not
|
|
10
16
|
* available (e.g., during unit tests or before the model has loaded).
|
|
11
17
|
*/
|
|
12
|
-
// Hybrid weighting constants
|
|
18
|
+
// Hybrid weighting constants (storage relevance)
|
|
13
19
|
const VECTOR_WEIGHT = 0.7;
|
|
14
20
|
const KEYWORD_WEIGHT = 0.3;
|
|
21
|
+
// Default retrieval scoring weights
|
|
22
|
+
const DEFAULT_RETRIEVAL_SEMANTIC_WEIGHT = 0.55;
|
|
23
|
+
const DEFAULT_RETRIEVAL_KEYWORD_WEIGHT = 0.25;
|
|
24
|
+
const DEFAULT_RETRIEVAL_PROXIMITY_WEIGHT = 0.20;
|
|
15
25
|
/**
|
|
16
26
|
* Tokenize text: split by whitespace, lowercase, strip punctuation, filter
|
|
17
27
|
* words shorter than 2 characters.
|
|
@@ -118,4 +128,43 @@ export function hybridRelevance(memoryText, sunText, memoryEmbedding, sunEmbeddi
|
|
|
118
128
|
return kwScore;
|
|
119
129
|
return Math.min(1.0, VECTOR_WEIGHT * vecScore + KEYWORD_WEIGHT * kwScore);
|
|
120
130
|
}
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
// Retrieval score (search ranking)
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
/**
|
|
135
|
+
* Calculate retrieval score for ranking search results.
|
|
136
|
+
*
|
|
137
|
+
* Separate from storage importance — this score is computed at query time
|
|
138
|
+
* and reflects how well a memory matches the user's current query, biased
|
|
139
|
+
* toward memories that are already close (high proximity bonus).
|
|
140
|
+
*
|
|
141
|
+
* retrieval_score = semanticW × semantic_similarity
|
|
142
|
+
* + keywordW × keyword_overlap
|
|
143
|
+
* + proximityW × proximity_bonus
|
|
144
|
+
*
|
|
145
|
+
* proximity_bonus = 1.0 - clamp(distance / 100, 0, 1)
|
|
146
|
+
* → 1.0 for a memory at 0 AU (core), 0.0 at 100 AU (forgotten)
|
|
147
|
+
*
|
|
148
|
+
* Falls back to keyword + proximity when embeddings are absent.
|
|
149
|
+
*
|
|
150
|
+
* Weights default to 0.55 / 0.25 / 0.20 but can be overridden from config.
|
|
151
|
+
*/
|
|
152
|
+
export function retrievalScore(memoryText, queryText, memoryDistance, memoryEmbedding, queryEmbedding, weights) {
|
|
153
|
+
const w = weights ?? {
|
|
154
|
+
semantic: DEFAULT_RETRIEVAL_SEMANTIC_WEIGHT,
|
|
155
|
+
keyword: DEFAULT_RETRIEVAL_KEYWORD_WEIGHT,
|
|
156
|
+
proximity: DEFAULT_RETRIEVAL_PROXIMITY_WEIGHT,
|
|
157
|
+
};
|
|
158
|
+
const semantic = vectorRelevance(memoryEmbedding, queryEmbedding);
|
|
159
|
+
const keyword = keywordRelevance(memoryText, queryText);
|
|
160
|
+
const proximity = 1.0 - Math.min(1.0, Math.max(0.0, memoryDistance / 100));
|
|
161
|
+
// When no embeddings available, redistribute semantic weight to keyword
|
|
162
|
+
if (!memoryEmbedding || !queryEmbedding) {
|
|
163
|
+
const totalNonSemantic = w.keyword + w.proximity;
|
|
164
|
+
const kwNorm = totalNonSemantic > 0 ? w.keyword / totalNonSemantic : 0.5;
|
|
165
|
+
const prxNorm = totalNonSemantic > 0 ? w.proximity / totalNonSemantic : 0.5;
|
|
166
|
+
return Math.min(1.0, kwNorm * keyword + prxNorm * proximity);
|
|
167
|
+
}
|
|
168
|
+
return Math.min(1.0, w.semantic * semantic + w.keyword * keyword + w.proximity * proximity);
|
|
169
|
+
}
|
|
121
170
|
//# sourceMappingURL=gravity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gravity.js","sourceRoot":"","sources":["../../src/engine/gravity.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C1D,MAAM,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,GAAG,CAAC,CAAC,CAAC;IAE3E,wEAAwE;IACxE,IAAI,CAAC,eAAe,IAAI,CAAC,cAAc,EAAE,CAAC;QACxC,MAAM,gBAAgB,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,SAAS,CAAC;QACjD,MAAM,MAAM,GAAI,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAK,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC;QAC5E,MAAM,OAAO,GAAG,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC;QAC5E,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,GAAG,QAAQ,GAAG,CAAC,CAAC,OAAO,GAAG,OAAO,GAAG,CAAC,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;AAC9F,CAAC"}
|
package/dist/engine/orbit.d.ts
CHANGED
|
@@ -1,55 +1,68 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* orbit.ts — Core importance function and orbital mechanics
|
|
3
3
|
*
|
|
4
|
-
* Implements
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
4
|
+
* Implements an ACT-R-inspired activation model:
|
|
5
|
+
* - Adaptive half-life grows with access count (stable memories decay slower)
|
|
6
|
+
* - Activation = 0.6×recency + 0.4×frequency (replaces raw recency/frequency weights)
|
|
7
|
+
* - storageImportance = activation × contentWeight × qualityModifier
|
|
8
|
+
* - Segment-based distance mapping for sharper zone boundaries
|
|
9
|
+
*
|
|
10
|
+
* High importance → small orbital distance (close to the sun)
|
|
11
|
+
* Low importance → large orbital distance (far from the sun, fading)
|
|
9
12
|
*/
|
|
10
13
|
import type { Memory, ImportanceComponents, OrbitChange, StellarConfig } from './types.js';
|
|
11
14
|
import type { MemoryType } from './types.js';
|
|
12
15
|
/**
|
|
13
|
-
* Calculate recency score using
|
|
16
|
+
* Calculate recency score using ACT-R adaptive half-life.
|
|
17
|
+
*
|
|
18
|
+
* The effective half-life grows with access count so that frequently-accessed
|
|
19
|
+
* memories decay much more slowly (stable memories persist longer).
|
|
20
|
+
*
|
|
21
|
+
* effectiveHalflife = min(maxStabilityHours, baseHalfLife × stabilityGrowth^min(accessCount,15))
|
|
14
22
|
*
|
|
15
|
-
* Formula: 0.5 ^ (hoursSince /
|
|
23
|
+
* Formula: 0.5 ^ (hoursSince / effectiveHalflife)
|
|
16
24
|
* - At t=0 → score = 1.0
|
|
17
25
|
* - At t=halfLife → score = 0.5
|
|
18
|
-
* - At t=2×halfLife → score = 0.25
|
|
19
|
-
*
|
|
20
|
-
* Procedural memories use a slower decay rate (halfLife / 0.3 ≈ 240h for default 72h)
|
|
21
|
-
* so hard-won knowledge persists longer.
|
|
22
26
|
*
|
|
23
27
|
* Returns a value in [0, 1].
|
|
24
28
|
*/
|
|
25
|
-
export declare function recencyScore(lastAccessedAt: string | null, createdAt: string, halfLifeHours?: number, memoryType?: MemoryType): number;
|
|
29
|
+
export declare function recencyScore(lastAccessedAt: string | null, createdAt: string, halfLifeHours?: number, memoryType?: MemoryType, accessCount?: number, stabilityGrowth?: number, maxStabilityHours?: number): number;
|
|
26
30
|
/**
|
|
27
|
-
* Calculate frequency
|
|
31
|
+
* Calculate frequency factor using logarithmic saturation.
|
|
28
32
|
*
|
|
29
33
|
* Formula: log(1 + count) / log(1 + saturationPoint)
|
|
30
34
|
* - Grows quickly for the first few accesses.
|
|
31
|
-
* - Plateaus as count approaches saturationPoint.
|
|
35
|
+
* - Plateaus as count approaches saturationPoint (default 50).
|
|
32
36
|
*
|
|
33
37
|
* Returns a value in [0, 1].
|
|
34
38
|
*/
|
|
35
39
|
export declare function frequencyScore(accessCount: number, saturationPoint?: number): number;
|
|
36
40
|
/**
|
|
37
|
-
* Calculate overall importance
|
|
41
|
+
* Calculate overall importance using ACT-R activation model.
|
|
42
|
+
*
|
|
43
|
+
* activation = activationRecencyWeight × recency + activationFrequencyWeight × frequencyFactor
|
|
44
|
+
* storageImportance = clamp(activation × contentWeight × qualityModifier, 0, 1)
|
|
38
45
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
46
|
+
* qualityModifier ∈ [0.7, 1.2]: 0.7 + 0.5 × qualityScore
|
|
47
|
+
* contentWeight: injected externally (defaults to memory.impact for backward compat)
|
|
48
|
+
*
|
|
49
|
+
* The legacy weights (recency/frequency/impact/relevance) are ignored in the
|
|
50
|
+
* new activation path but kept in the return value for callers that inspect them.
|
|
41
51
|
*/
|
|
42
|
-
export declare function calculateImportance(memory: Memory, sunText: string, config: StellarConfig): ImportanceComponents;
|
|
52
|
+
export declare function calculateImportance(memory: Memory, sunText: string, config: StellarConfig, contentWeight?: number): ImportanceComponents;
|
|
43
53
|
/**
|
|
44
|
-
* Convert importance (0–1) to orbital distance (0.1–100).
|
|
54
|
+
* Convert importance (0–1) to orbital distance (0.1–100 AU).
|
|
45
55
|
*
|
|
46
|
-
* Uses
|
|
47
|
-
*
|
|
48
|
-
* - importance = 0.0 → distance = 100 (Oort cloud / nearly forgotten)
|
|
56
|
+
* Uses segment-based linear interpolation aligned with ORBIT_ZONES boundaries,
|
|
57
|
+
* giving sharper zone transitions than the old quadratic formula.
|
|
49
58
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
59
|
+
* Zone thresholds:
|
|
60
|
+
* Core [0.85, 1.0] → [0.1, 1.0)
|
|
61
|
+
* Near [0.65, 0.85) → [1.0, 5.0)
|
|
62
|
+
* Active [0.40, 0.65) → [5.0, 15.0)
|
|
63
|
+
* Archive [0.20, 0.40) → [15.0, 40.0)
|
|
64
|
+
* Fading [0.05, 0.20) → [40.0, 70.0)
|
|
65
|
+
* Forgotten [0, 0.05) → [70.0, 100.0]
|
|
53
66
|
*/
|
|
54
67
|
export declare function importanceToDistance(importance: number): number;
|
|
55
68
|
/**
|
|
@@ -60,32 +73,17 @@ export declare function importanceToDistance(importance: number): number;
|
|
|
60
73
|
export declare function distanceToImportance(distance: number): number;
|
|
61
74
|
/**
|
|
62
75
|
* Return the orbit zone label for a given distance.
|
|
63
|
-
*
|
|
64
|
-
* Iterates ORBIT_ZONES in definition order (core → forgotten) and returns the
|
|
65
|
-
* first zone whose [min, max) range contains the distance. Falls back to
|
|
66
|
-
* the 'forgotten' label for any distance at or beyond 70.
|
|
67
76
|
*/
|
|
68
77
|
export declare function getOrbitZone(distance: number): string;
|
|
69
78
|
/**
|
|
70
79
|
* Apply access boost — pull a memory closer when it is recalled.
|
|
71
80
|
*
|
|
72
|
-
*
|
|
73
|
-
* - Far-away memories (high distance) receive a large absolute pull.
|
|
74
|
-
* - Close memories (low distance) are nudged only slightly.
|
|
75
|
-
*
|
|
81
|
+
* Proportional to current distance so far-away memories get a larger pull.
|
|
76
82
|
* MIN_BOOST ensures even core memories get a small reward.
|
|
77
|
-
* The floor of 0.1 prevents distance from going below the core minimum.
|
|
78
83
|
*/
|
|
79
84
|
export declare function applyAccessBoost(currentDistance: number): number;
|
|
80
85
|
/**
|
|
81
86
|
* Run a full orbit recalculation for all memories in a project.
|
|
82
|
-
*
|
|
83
|
-
* Called during stellar_commit and stellar_orbit. For each non-deleted memory:
|
|
84
|
-
* 1. Compute new importance using current sun context.
|
|
85
|
-
* 2. Map importance → distance.
|
|
86
|
-
* 3. If the distance shifted by more than 0.01, persist the change and log it.
|
|
87
|
-
*
|
|
88
|
-
* Returns every OrbitChange that was actually written.
|
|
89
87
|
*/
|
|
90
88
|
export declare function recalculateOrbits(project: string, config: StellarConfig): OrbitChange[];
|
|
91
89
|
//# sourceMappingURL=orbit.d.ts.map
|
package/dist/engine/orbit.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* orbit.ts — Core importance function and orbital mechanics
|
|
3
3
|
*
|
|
4
|
-
* Implements
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
4
|
+
* Implements an ACT-R-inspired activation model:
|
|
5
|
+
* - Adaptive half-life grows with access count (stable memories decay slower)
|
|
6
|
+
* - Activation = 0.6×recency + 0.4×frequency (replaces raw recency/frequency weights)
|
|
7
|
+
* - storageImportance = activation × contentWeight × qualityModifier
|
|
8
|
+
* - Segment-based distance mapping for sharper zone boundaries
|
|
9
|
+
*
|
|
10
|
+
* High importance → small orbital distance (close to the sun)
|
|
11
|
+
* Low importance → large orbital distance (far from the sun, fading)
|
|
9
12
|
*/
|
|
10
13
|
import { ORBIT_ZONES } from './types.js';
|
|
11
14
|
import { keywordRelevance, hybridRelevance } from './gravity.js';
|
|
@@ -18,19 +21,20 @@ import { getProceduralDecayMultiplier } from './procedural.js';
|
|
|
18
21
|
// Scoring primitives
|
|
19
22
|
// ---------------------------------------------------------------------------
|
|
20
23
|
/**
|
|
21
|
-
* Calculate recency score using
|
|
24
|
+
* Calculate recency score using ACT-R adaptive half-life.
|
|
25
|
+
*
|
|
26
|
+
* The effective half-life grows with access count so that frequently-accessed
|
|
27
|
+
* memories decay much more slowly (stable memories persist longer).
|
|
28
|
+
*
|
|
29
|
+
* effectiveHalflife = min(maxStabilityHours, baseHalfLife × stabilityGrowth^min(accessCount,15))
|
|
22
30
|
*
|
|
23
|
-
* Formula: 0.5 ^ (hoursSince /
|
|
31
|
+
* Formula: 0.5 ^ (hoursSince / effectiveHalflife)
|
|
24
32
|
* - At t=0 → score = 1.0
|
|
25
33
|
* - At t=halfLife → score = 0.5
|
|
26
|
-
* - At t=2×halfLife → score = 0.25
|
|
27
|
-
*
|
|
28
|
-
* Procedural memories use a slower decay rate (halfLife / 0.3 ≈ 240h for default 72h)
|
|
29
|
-
* so hard-won knowledge persists longer.
|
|
30
34
|
*
|
|
31
35
|
* Returns a value in [0, 1].
|
|
32
36
|
*/
|
|
33
|
-
export function recencyScore(lastAccessedAt, createdAt, halfLifeHours = 72, memoryType) {
|
|
37
|
+
export function recencyScore(lastAccessedAt, createdAt, halfLifeHours = 72, memoryType, accessCount = 0, stabilityGrowth = 1.5, maxStabilityHours = 8760) {
|
|
34
38
|
const referenceTime = lastAccessedAt ?? createdAt;
|
|
35
39
|
// Append 'Z' only when there is no existing timezone designator so that
|
|
36
40
|
// Date.parse interprets bare ISO strings as UTC rather than local time.
|
|
@@ -42,22 +46,24 @@ export function recencyScore(lastAccessedAt, createdAt, halfLifeHours = 72, memo
|
|
|
42
46
|
throw new Error(`Invalid reference date: "${referenceTime}"`);
|
|
43
47
|
const now = new Date();
|
|
44
48
|
const hoursSince = (now.getTime() - refMs) / (1000 * 60 * 60);
|
|
45
|
-
//
|
|
46
|
-
|
|
49
|
+
// Adaptive half-life: grows with access frequency, capped at maxStabilityHours
|
|
50
|
+
// Procedural memories use a slower base decay rate (~3.3× slower than normal)
|
|
51
|
+
const baseHalfLife = memoryType === 'procedural'
|
|
47
52
|
? halfLifeHours / getProceduralDecayMultiplier()
|
|
48
53
|
: halfLifeHours;
|
|
49
|
-
|
|
54
|
+
const effectiveHalflife = Math.min(maxStabilityHours, baseHalfLife * Math.pow(stabilityGrowth, Math.min(accessCount, 15)));
|
|
55
|
+
return Math.pow(0.5, Math.max(0, hoursSince) / effectiveHalflife);
|
|
50
56
|
}
|
|
51
57
|
/**
|
|
52
|
-
* Calculate frequency
|
|
58
|
+
* Calculate frequency factor using logarithmic saturation.
|
|
53
59
|
*
|
|
54
60
|
* Formula: log(1 + count) / log(1 + saturationPoint)
|
|
55
61
|
* - Grows quickly for the first few accesses.
|
|
56
|
-
* - Plateaus as count approaches saturationPoint.
|
|
62
|
+
* - Plateaus as count approaches saturationPoint (default 50).
|
|
57
63
|
*
|
|
58
64
|
* Returns a value in [0, 1].
|
|
59
65
|
*/
|
|
60
|
-
export function frequencyScore(accessCount, saturationPoint =
|
|
66
|
+
export function frequencyScore(accessCount, saturationPoint = 50) {
|
|
61
67
|
if (saturationPoint <= 0)
|
|
62
68
|
throw new Error('saturationPoint must be positive');
|
|
63
69
|
return Math.min(1.0, Math.log(1 + accessCount) / Math.log(1 + saturationPoint));
|
|
@@ -66,20 +72,35 @@ export function frequencyScore(accessCount, saturationPoint = 20) {
|
|
|
66
72
|
// Composite importance
|
|
67
73
|
// ---------------------------------------------------------------------------
|
|
68
74
|
/**
|
|
69
|
-
* Calculate overall importance
|
|
75
|
+
* Calculate overall importance using ACT-R activation model.
|
|
76
|
+
*
|
|
77
|
+
* activation = activationRecencyWeight × recency + activationFrequencyWeight × frequencyFactor
|
|
78
|
+
* storageImportance = clamp(activation × contentWeight × qualityModifier, 0, 1)
|
|
79
|
+
*
|
|
80
|
+
* qualityModifier ∈ [0.7, 1.2]: 0.7 + 0.5 × qualityScore
|
|
81
|
+
* contentWeight: injected externally (defaults to memory.impact for backward compat)
|
|
70
82
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
83
|
+
* The legacy weights (recency/frequency/impact/relevance) are ignored in the
|
|
84
|
+
* new activation path but kept in the return value for callers that inspect them.
|
|
73
85
|
*/
|
|
74
|
-
export function calculateImportance(memory, sunText, config) {
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
86
|
+
export function calculateImportance(memory, sunText, config, contentWeight) {
|
|
87
|
+
const stabilityGrowth = config.stabilityGrowth ?? 1.5;
|
|
88
|
+
const maxStabilityHours = config.maxStabilityHours ?? 8760;
|
|
89
|
+
const recencyWeight = config.activationRecencyWeight ?? 0.6;
|
|
90
|
+
const frequencyWeight = config.activationFrequencyWeight ?? 0.4;
|
|
91
|
+
// Effective half-life exposed for callers
|
|
92
|
+
const baseHalfLife = memory.type === 'procedural'
|
|
93
|
+
? config.decayHalfLifeHours / getProceduralDecayMultiplier()
|
|
94
|
+
: config.decayHalfLifeHours;
|
|
95
|
+
const effectiveHalflife = Math.min(maxStabilityHours, baseHalfLife * Math.pow(stabilityGrowth, Math.min(memory.access_count, 15)));
|
|
96
|
+
const rec = recencyScore(memory.last_accessed_at, memory.created_at, config.decayHalfLifeHours, memory.type, memory.access_count, stabilityGrowth, maxStabilityHours);
|
|
81
97
|
const freq = frequencyScore(memory.access_count, config.frequencySaturationPoint);
|
|
82
|
-
|
|
98
|
+
// ACT-R activation
|
|
99
|
+
const activation = recencyWeight * rec + frequencyWeight * freq;
|
|
100
|
+
// contentWeight: externally injected (future content-weight agent), fallback to impact
|
|
101
|
+
const cw = contentWeight ?? memory.impact;
|
|
102
|
+
// qualityModifier ∈ [0.7, 1.2]
|
|
103
|
+
const qualityModifier = 0.7 + 0.5 * (memory.quality_score ?? 0.5);
|
|
83
104
|
// Combine content + tags so tags act as relevance boosters.
|
|
84
105
|
const memoryText = memory.content + ' ' + memory.tags.join(' ');
|
|
85
106
|
// Attempt to load embeddings synchronously from the vec table for hybrid relevance.
|
|
@@ -94,7 +115,6 @@ export function calculateImportance(memory, sunText, config) {
|
|
|
94
115
|
: sunText;
|
|
95
116
|
if (memRow?.embedding) {
|
|
96
117
|
const memEmbedding = new Float32Array(memRow.embedding.buffer, memRow.embedding.byteOffset, memRow.embedding.byteLength / 4);
|
|
97
|
-
// Look up the sun embedding via the most-recent sun memory, if available.
|
|
98
118
|
const sunRow = db.prepare(`SELECT mv.embedding FROM memory_vec mv
|
|
99
119
|
JOIN memories m ON m.id = mv.memory_id
|
|
100
120
|
WHERE m.project = ? AND m.deleted_at IS NULL
|
|
@@ -111,38 +131,53 @@ export function calculateImportance(memory, sunText, config) {
|
|
|
111
131
|
catch {
|
|
112
132
|
rel = keywordRelevance(memoryText, sunText);
|
|
113
133
|
}
|
|
114
|
-
const total =
|
|
115
|
-
config.weights.frequency * freq +
|
|
116
|
-
config.weights.impact * imp +
|
|
117
|
-
config.weights.relevance * rel;
|
|
134
|
+
const total = Math.max(0, Math.min(1, activation * cw * qualityModifier));
|
|
118
135
|
return {
|
|
136
|
+
// Sub-components
|
|
119
137
|
recency: rec,
|
|
138
|
+
frequencyFactor: freq,
|
|
139
|
+
effectiveHalflife,
|
|
140
|
+
// Composite
|
|
141
|
+
activation,
|
|
142
|
+
contentWeight: cw,
|
|
143
|
+
qualityModifier,
|
|
144
|
+
// Legacy aliases
|
|
120
145
|
frequency: freq,
|
|
121
|
-
impact:
|
|
146
|
+
impact: cw,
|
|
122
147
|
relevance: rel,
|
|
123
|
-
total
|
|
148
|
+
total,
|
|
124
149
|
};
|
|
125
150
|
}
|
|
126
151
|
// ---------------------------------------------------------------------------
|
|
127
|
-
// Distance mapping
|
|
152
|
+
// Distance mapping — segment-based
|
|
128
153
|
// ---------------------------------------------------------------------------
|
|
129
154
|
/**
|
|
130
|
-
* Convert importance (0–1) to orbital distance (0.1–100).
|
|
155
|
+
* Convert importance (0–1) to orbital distance (0.1–100 AU).
|
|
131
156
|
*
|
|
132
|
-
* Uses
|
|
133
|
-
*
|
|
134
|
-
* - importance = 0.0 → distance = 100 (Oort cloud / nearly forgotten)
|
|
157
|
+
* Uses segment-based linear interpolation aligned with ORBIT_ZONES boundaries,
|
|
158
|
+
* giving sharper zone transitions than the old quadratic formula.
|
|
135
159
|
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
160
|
+
* Zone thresholds:
|
|
161
|
+
* Core [0.85, 1.0] → [0.1, 1.0)
|
|
162
|
+
* Near [0.65, 0.85) → [1.0, 5.0)
|
|
163
|
+
* Active [0.40, 0.65) → [5.0, 15.0)
|
|
164
|
+
* Archive [0.20, 0.40) → [15.0, 40.0)
|
|
165
|
+
* Fading [0.05, 0.20) → [40.0, 70.0)
|
|
166
|
+
* Forgotten [0, 0.05) → [70.0, 100.0]
|
|
139
167
|
*/
|
|
140
168
|
export function importanceToDistance(importance) {
|
|
141
|
-
const MIN_DISTANCE = 0.1;
|
|
142
|
-
const MAX_DISTANCE = 100.0;
|
|
143
169
|
const clamped = Math.min(1.0, Math.max(0.0, importance));
|
|
144
|
-
|
|
145
|
-
|
|
170
|
+
if (clamped >= 0.85)
|
|
171
|
+
return 0.1 + (1.0 - clamped) / 0.15 * 0.9;
|
|
172
|
+
if (clamped >= 0.65)
|
|
173
|
+
return 1.0 + (0.85 - clamped) / 0.20 * 4.0;
|
|
174
|
+
if (clamped >= 0.40)
|
|
175
|
+
return 5.0 + (0.65 - clamped) / 0.25 * 10.0;
|
|
176
|
+
if (clamped >= 0.20)
|
|
177
|
+
return 15.0 + (0.40 - clamped) / 0.20 * 25.0;
|
|
178
|
+
if (clamped >= 0.05)
|
|
179
|
+
return 40.0 + (0.20 - clamped) / 0.15 * 30.0;
|
|
180
|
+
return 70.0 + (0.05 - clamped) / 0.05 * 30.0;
|
|
146
181
|
}
|
|
147
182
|
/**
|
|
148
183
|
* Inverse of importanceToDistance — derive importance from a given distance.
|
|
@@ -150,18 +185,21 @@ export function importanceToDistance(importance) {
|
|
|
150
185
|
* Used when a user manually drags a memory to a new orbital position.
|
|
151
186
|
*/
|
|
152
187
|
export function distanceToImportance(distance) {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
188
|
+
const clamped = Math.min(100.0, Math.max(0.1, distance));
|
|
189
|
+
if (clamped < 1.0)
|
|
190
|
+
return 1.0 - (clamped - 0.1) / 0.9 * 0.15;
|
|
191
|
+
if (clamped < 5.0)
|
|
192
|
+
return 0.85 - (clamped - 1.0) / 4.0 * 0.20;
|
|
193
|
+
if (clamped < 15.0)
|
|
194
|
+
return 0.65 - (clamped - 5.0) / 10.0 * 0.25;
|
|
195
|
+
if (clamped < 40.0)
|
|
196
|
+
return 0.40 - (clamped - 15.0) / 25.0 * 0.20;
|
|
197
|
+
if (clamped < 70.0)
|
|
198
|
+
return 0.20 - (clamped - 40.0) / 30.0 * 0.15;
|
|
199
|
+
return Math.max(0, 0.05 - (clamped - 70.0) / 30.0 * 0.05);
|
|
158
200
|
}
|
|
159
201
|
/**
|
|
160
202
|
* Return the orbit zone label for a given distance.
|
|
161
|
-
*
|
|
162
|
-
* Iterates ORBIT_ZONES in definition order (core → forgotten) and returns the
|
|
163
|
-
* first zone whose [min, max) range contains the distance. Falls back to
|
|
164
|
-
* the 'forgotten' label for any distance at or beyond 70.
|
|
165
203
|
*/
|
|
166
204
|
export function getOrbitZone(distance) {
|
|
167
205
|
for (const [, zone] of Object.entries(ORBIT_ZONES)) {
|
|
@@ -169,7 +207,6 @@ export function getOrbitZone(distance) {
|
|
|
169
207
|
return zone.label;
|
|
170
208
|
}
|
|
171
209
|
}
|
|
172
|
-
// Beyond all defined zones — treat as forgotten.
|
|
173
210
|
return ORBIT_ZONES.forgotten.label;
|
|
174
211
|
}
|
|
175
212
|
// ---------------------------------------------------------------------------
|
|
@@ -178,12 +215,8 @@ export function getOrbitZone(distance) {
|
|
|
178
215
|
/**
|
|
179
216
|
* Apply access boost — pull a memory closer when it is recalled.
|
|
180
217
|
*
|
|
181
|
-
*
|
|
182
|
-
* - Far-away memories (high distance) receive a large absolute pull.
|
|
183
|
-
* - Close memories (low distance) are nudged only slightly.
|
|
184
|
-
*
|
|
218
|
+
* Proportional to current distance so far-away memories get a larger pull.
|
|
185
219
|
* MIN_BOOST ensures even core memories get a small reward.
|
|
186
|
-
* The floor of 0.1 prevents distance from going below the core minimum.
|
|
187
220
|
*/
|
|
188
221
|
export function applyAccessBoost(currentDistance) {
|
|
189
222
|
const BOOST_FACTOR = 0.3;
|
|
@@ -196,20 +229,12 @@ export function applyAccessBoost(currentDistance) {
|
|
|
196
229
|
// ---------------------------------------------------------------------------
|
|
197
230
|
/**
|
|
198
231
|
* Run a full orbit recalculation for all memories in a project.
|
|
199
|
-
*
|
|
200
|
-
* Called during stellar_commit and stellar_orbit. For each non-deleted memory:
|
|
201
|
-
* 1. Compute new importance using current sun context.
|
|
202
|
-
* 2. Map importance → distance.
|
|
203
|
-
* 3. If the distance shifted by more than 0.01, persist the change and log it.
|
|
204
|
-
*
|
|
205
|
-
* Returns every OrbitChange that was actually written.
|
|
206
232
|
*/
|
|
207
233
|
export function recalculateOrbits(project, config) {
|
|
208
234
|
const memories = getMemoriesByProject(project);
|
|
209
235
|
if (memories.length === 0) {
|
|
210
236
|
return [];
|
|
211
237
|
}
|
|
212
|
-
// Build sun context text for relevance scoring.
|
|
213
238
|
const sunState = getSunState(project);
|
|
214
239
|
const sunText = sunState
|
|
215
240
|
? [sunState.current_work, ...sunState.recent_decisions, ...sunState.next_steps].join(' ')
|
|
@@ -218,11 +243,9 @@ export function recalculateOrbits(project, config) {
|
|
|
218
243
|
for (const memory of memories) {
|
|
219
244
|
const components = calculateImportance(memory, sunText, config);
|
|
220
245
|
const newImportance = components.total;
|
|
221
|
-
// Apply quality-based orbit adjustment: low-quality memories drift further out
|
|
222
246
|
const qualityScore = memory.quality_score ?? 0.5;
|
|
223
247
|
const newDistance = importanceToDistance(newImportance) * qualityOrbitAdjustment(qualityScore);
|
|
224
248
|
const velocity = newDistance - memory.distance;
|
|
225
|
-
// Skip negligible drifts to avoid write churn.
|
|
226
249
|
if (Math.abs(velocity) <= 0.01) {
|
|
227
250
|
continue;
|
|
228
251
|
}
|
|
@@ -239,10 +262,7 @@ export function recalculateOrbits(project, config) {
|
|
|
239
262
|
insertOrbitLog(change);
|
|
240
263
|
changes.push(change);
|
|
241
264
|
}
|
|
242
|
-
// Prune orbit log entries older than 90 days to prevent unbounded growth.
|
|
243
265
|
cleanupOrbitLog(90);
|
|
244
|
-
// Refresh the corona cache after orbit recalculation so distance changes
|
|
245
|
-
// are reflected in the in-memory tier immediately.
|
|
246
266
|
corona.warmup(project);
|
|
247
267
|
return changes;
|
|
248
268
|
}
|
package/dist/engine/orbit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orbit.js","sourceRoot":"","sources":["../../src/engine/orbit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"orbit.js","sourceRoot":"","sources":["../../src/engine/orbit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAG/D,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAC1B,cAA6B,EAC7B,SAAiB,EACjB,gBAAwB,EAAE,EAC1B,UAAuB,EACvB,cAAsB,CAAC,EACvB,kBAA0B,GAAG,EAC7B,oBAA4B,IAAI;IAEhC,MAAM,aAAa,GAAG,cAAc,IAAI,SAAS,CAAC;IAClD,wEAAwE;IACxE,wEAAwE;IACxE,MAAM,UAAU,GAAG,wBAAwB,CAAC,IAAI,CAAC,aAAa,CAAC;QAC7D,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,aAAa,GAAG,GAAG,CAAC;IACxB,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;IAC7C,IAAI,KAAK,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,aAAa,GAAG,CAAC,CAAC;IAChF,MAAM,GAAG,GAAG,IAAI,IAAI,E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