brain-memory 0.1.0-beta.34 → 0.1.0-beta.36
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/CHANGELOG.md +74 -0
- package/README.md +29 -0
- package/bin/brain.js +13 -0
- package/bin/import.js +132 -0
- package/bin/memorize.js +5 -28
- package/bin/recall.js +6 -0
- package/bin/restore.js +130 -0
- package/bin/session-start.js +4 -0
- package/commands/brain/import.md +125 -0
- package/commands/brain/remember.md +2 -2
- package/package.json +2 -2
- package/prompts/antigravity.md +4 -1
- package/prompts/claude.md +4 -1
- package/prompts/copilot.md +4 -1
- package/prompts/kilo.md +4 -1
- package/prompts/openai.md +4 -1
- package/prompts/opencode.md +4 -1
- package/src/cloud-sync.js +94 -0
- package/src/git-sync.js +115 -0
- package/src/harvest.js +562 -0
- package/src/provenance.js +79 -0
- package/src/receipt.js +10 -2
- package/src/scorer.js +13 -2
package/src/scorer.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* by external tools.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
const { trustFactor } = require('./provenance');
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* Compute the effective (decayed) strength of a memory.
|
|
12
14
|
*
|
|
@@ -407,9 +409,14 @@ function rankMemories(memories, relevanceFn, options = {}) {
|
|
|
407
409
|
const sources = options.relevanceFloor != null
|
|
408
410
|
? scored.filter((m) => m.relevance >= options.relevanceFloor)
|
|
409
411
|
: scored;
|
|
412
|
+
// Source strength is damped by origin trust: a clique of co-tagged
|
|
413
|
+
// low-trust memories (planted writes auto-link via tag_overlap edges)
|
|
414
|
+
// must not self-amplify past trusted memories through activation alone.
|
|
410
415
|
const scoredSummary = sources.map((m) => ({
|
|
411
416
|
id: m.id,
|
|
412
|
-
score:
|
|
417
|
+
score:
|
|
418
|
+
(0.55 * m.relevance + 0.30 * m.decayed_strength + 0.15 * m.recency_bonus) *
|
|
419
|
+
trustFactor(m.origin),
|
|
413
420
|
}));
|
|
414
421
|
|
|
415
422
|
const bonuses = computeSpreadingActivationBatch(
|
|
@@ -446,12 +453,16 @@ function rankMemories(memories, relevanceFn, options = {}) {
|
|
|
446
453
|
if (mem.context_match > 0) extras.contextMatch = mem.context_match;
|
|
447
454
|
if (mem.salience != null) extras.salience = mem.salience;
|
|
448
455
|
|
|
456
|
+
// Origin trust multiplies the composite: trust bounds entrenchment and
|
|
457
|
+
// volume, not relevance — a clearly more relevant low-trust memory can
|
|
458
|
+
// still win, but it can't win on bulk. Missing origin weighs as the
|
|
459
|
+
// memorize default, so legacy memories keep their relative order.
|
|
449
460
|
const score = fin(computeRecallScore(
|
|
450
461
|
mem.relevance,
|
|
451
462
|
mem.decayed_strength,
|
|
452
463
|
mem.recency_bonus,
|
|
453
464
|
extras
|
|
454
|
-
));
|
|
465
|
+
)) * trustFactor(mem.origin);
|
|
455
466
|
|
|
456
467
|
return {
|
|
457
468
|
...mem,
|