mneme-ai 3.136.0 → 3.138.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.
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme cosmos` (v3.138.0) — the cosmo-quantum memory core (classically real).
|
|
3
|
+
* Two black-sheep engines over your repo's accumulated context (.mneme/passport):
|
|
4
|
+
*
|
|
5
|
+
* inflate — SINGULARITY CODEC: compress all your context into a dense seed, then
|
|
6
|
+
* expand ONLY the slice a problem needs (touch a fraction, not all).
|
|
7
|
+
* gravity — ENTANGLED-GRAVITY: memories are linked by shared entities; a query
|
|
8
|
+
* falls toward the densest relevant cluster, visiting far fewer nodes.
|
|
9
|
+
*
|
|
10
|
+
* mneme cosmos inflate --problem "fixing the auth refresh"
|
|
11
|
+
* mneme cosmos gravity --query "payments ledger"
|
|
12
|
+
*/
|
|
13
|
+
import type { Command } from "commander";
|
|
14
|
+
export declare function registerCosmosCommands(program: Command): void;
|
|
15
|
+
//# sourceMappingURL=cosmos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmos.d.ts","sourceRoot":"","sources":["../../src/commands/cosmos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAazC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8B7D"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme cosmos` (v3.138.0) — the cosmo-quantum memory core (classically real).
|
|
3
|
+
* Two black-sheep engines over your repo's accumulated context (.mneme/passport):
|
|
4
|
+
*
|
|
5
|
+
* inflate — SINGULARITY CODEC: compress all your context into a dense seed, then
|
|
6
|
+
* expand ONLY the slice a problem needs (touch a fraction, not all).
|
|
7
|
+
* gravity — ENTANGLED-GRAVITY: memories are linked by shared entities; a query
|
|
8
|
+
* falls toward the densest relevant cluster, visiting far fewer nodes.
|
|
9
|
+
*
|
|
10
|
+
* mneme cosmos inflate --problem "fixing the auth refresh"
|
|
11
|
+
* mneme cosmos gravity --query "payments ledger"
|
|
12
|
+
*/
|
|
13
|
+
import { readFileSync, existsSync, readdirSync } from "node:fs";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { cosmos } from "@mneme-ai/core";
|
|
16
|
+
function out(s) { process.stdout.write(s + "\n"); }
|
|
17
|
+
function readContext() {
|
|
18
|
+
const acc = [];
|
|
19
|
+
const d = join(process.cwd(), ".mneme", "passport");
|
|
20
|
+
try {
|
|
21
|
+
if (existsSync(d))
|
|
22
|
+
for (const f of readdirSync(d)) {
|
|
23
|
+
if (!f.endsWith(".jsonl"))
|
|
24
|
+
continue;
|
|
25
|
+
for (const l of readFileSync(join(d, f), "utf8").split("\n")) {
|
|
26
|
+
if (l.trim()) {
|
|
27
|
+
try {
|
|
28
|
+
acc.push(JSON.parse(l));
|
|
29
|
+
}
|
|
30
|
+
catch { /* */ }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch { /* */ }
|
|
36
|
+
return acc;
|
|
37
|
+
}
|
|
38
|
+
export function registerCosmosCommands(program) {
|
|
39
|
+
const c = program.command("cosmos").alias("cosmo")
|
|
40
|
+
.description("🌌 COSMOS — the cosmo-quantum memory core (quantum-INSPIRED, classically real). inflate = compress your context into a dense seed, expand only the problem-shaped pocket. gravity = entangled memories pull a query toward the densest relevant cluster, visiting far fewer nodes. ★Measured: inflate-precision 1.0 · gravity matches a full scan ≥98.5% at a fraction of the work.");
|
|
41
|
+
c.command("inflate").description("expand only the problem-relevant slice of your accumulated context")
|
|
42
|
+
.requiredOption("--problem <p>", "the problem to inflate context for")
|
|
43
|
+
.option("--top <n>", "max facts", "12").option("--json", "JSON")
|
|
44
|
+
.action((o) => {
|
|
45
|
+
const lessons = readContext().map((e) => ({ text: e.text || "", weight: 1 })).filter((l) => l.text);
|
|
46
|
+
const seed = cosmos.compress(lessons);
|
|
47
|
+
if (!seed.n) {
|
|
48
|
+
out("no context yet (contribute with: mneme ctx contribute …)");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const inf = cosmos.inflate(seed, o.problem, { max: parseInt(o.top, 10) || 12 });
|
|
52
|
+
if (o.json) {
|
|
53
|
+
out(JSON.stringify(inf, null, 2));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
out(`🌌 inflated ${inf.working.length} relevant fact(s) — touched ${inf.touched}/${inf.total} of the seed (${Math.round(inf.ratio * 100)}%, the rest stayed compressed)`);
|
|
57
|
+
for (const f of inf.working)
|
|
58
|
+
out(` ✦ ${f.text}`);
|
|
59
|
+
if (!inf.working.length)
|
|
60
|
+
out(" (nothing in the seed matched — add context or rephrase)");
|
|
61
|
+
});
|
|
62
|
+
c.command("gravity").description("retrieve memories pulled toward the densest relevant cluster (sub-scan)")
|
|
63
|
+
.requiredOption("--query <q>", "the query")
|
|
64
|
+
.option("--top <n>", "max results", "8").option("--json", "JSON")
|
|
65
|
+
.action((o) => {
|
|
66
|
+
const mems = readContext().map((e) => ({ text: e.text || "", cites: e.citations || [] })).filter((m) => m.text);
|
|
67
|
+
const g = cosmos.entangle(mems);
|
|
68
|
+
if (!g.total) {
|
|
69
|
+
out("no context yet (contribute with: mneme ctx contribute …)");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const r = cosmos.gravity(g, o.query, { top: parseInt(o.top, 10) || 8 });
|
|
73
|
+
if (o.json) {
|
|
74
|
+
out(JSON.stringify(r, null, 2));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
out(`🌌 pulled ${r.ranked.length} memory(ies) toward "${o.query}" — visited ${r.touched}/${r.total} nodes (${Math.round((r.touched / (r.total || 1)) * 100)}%, the gravity well, not a full scan)`);
|
|
78
|
+
for (const m of r.ranked)
|
|
79
|
+
out(` ✦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,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;YAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAAC,OAAO;QAAC,CAAC;QACxD,GAAG,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,MAAM,wBAAwB,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,uCAAuC,CAAC,CAAC;QACpM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM;YAAE,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiNA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAonNvD"}
|
package/dist/index.js
CHANGED
|
@@ -139,6 +139,7 @@ import { registerPrCommentCommands } from "./commands/pr-comment.js";
|
|
|
139
139
|
import { registerCtxCommands } from "./commands/ctx.js";
|
|
140
140
|
import { registerLaunchCommands } from "./commands/launch.js";
|
|
141
141
|
import { registerArkCommands } from "./commands/ark.js";
|
|
142
|
+
import { registerCosmosCommands } from "./commands/cosmos.js";
|
|
142
143
|
import { registerMoatCommands } from "./commands/moat.js";
|
|
143
144
|
import { attachRegretOracle } from "./commands/regret.js";
|
|
144
145
|
import { registerTrustCommands } from "./commands/trust.js";
|
|
@@ -4835,6 +4836,7 @@ export async function run(argv) {
|
|
|
4835
4836
|
registerCtxCommands(program);
|
|
4836
4837
|
registerLaunchCommands(program);
|
|
4837
4838
|
registerArkCommands(program);
|
|
4839
|
+
registerCosmosCommands(program);
|
|
4838
4840
|
registerMoatCommands(program);
|
|
4839
4841
|
// ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
|
|
4840
4842
|
registerTrustCommands(program);
|