mneme-ai 3.127.0 → 3.129.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,12 @@
1
+ /**
2
+ * `mneme seance` (v3.128.0) — talk to your past self. Reconstruct the decision
3
+ * context around any commit (or "N months ago") from real git history — what you
4
+ * said, what you were working on, the TODOs you had open, and what you abandoned —
5
+ * all cited to real commits. Then reason FROM it (HPE-guarded), never invent.
6
+ *
7
+ * mneme seance --at <ref>
8
+ * mneme seance --months 8
9
+ */
10
+ import type { Command } from "commander";
11
+ export declare function registerSeanceCommands(program: Command): void;
12
+ //# sourceMappingURL=seance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seance.d.ts","sourceRoot":"","sources":["../../src/commands/seance.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwCzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuB7D"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * `mneme seance` (v3.128.0) — talk to your past self. Reconstruct the decision
3
+ * context around any commit (or "N months ago") from real git history — what you
4
+ * said, what you were working on, the TODOs you had open, and what you abandoned —
5
+ * all cited to real commits. Then reason FROM it (HPE-guarded), never invent.
6
+ *
7
+ * mneme seance --at <ref>
8
+ * mneme seance --months 8
9
+ */
10
+ import { spawnSync } from "node:child_process";
11
+ import { seance } from "@mneme-ai/core";
12
+ function out(s) { process.stdout.write(s + "\n"); }
13
+ function git(args) { const r = spawnSync("git", args, { encoding: "utf8", maxBuffer: 128 * 1024 * 1024 }); return r.status === 0 ? (r.stdout || "") : ""; }
14
+ function readCommits(max = 4000) {
15
+ const US = "\x1f", RS = "\x1e";
16
+ const o = git(["log", "--no-merges", "-n", String(max), `--format=${RS}%H${US}%an${US}%at${US}%s${US}%b`]);
17
+ const byHash = new Map();
18
+ for (const blk of o.split(RS)) {
19
+ if (!blk.trim())
20
+ continue;
21
+ const [hash, author, at, subject, ...rest] = blk.split(US);
22
+ if (!hash)
23
+ continue;
24
+ byHash.set(hash.trim(), { hash: hash.trim(), author: (author || "").trim(), ts: parseInt(at || "0", 10) || 0, subject: (subject || "").trim(), body: (rest.join(US) || "").trim(), files: [] });
25
+ }
26
+ return [...byHash.values()];
27
+ }
28
+ /** Resolve --at ref or --months N to a full commit hash. */
29
+ function resolveRef(ref, months) {
30
+ if (ref) {
31
+ const h = git(["rev-parse", ref]).trim();
32
+ return h ? { ref, hash: h } : null;
33
+ }
34
+ if (months) {
35
+ const h = git(["rev-list", "-1", `--before=${months} months ago`, "HEAD"]).trim();
36
+ return h ? { ref: `${months} months ago`, hash: h } : null;
37
+ }
38
+ const h = git(["rev-parse", "HEAD"]).trim();
39
+ return h ? { ref: "HEAD", hash: h } : null;
40
+ }
41
+ /** TODO/FIXME alive at a ref → cited file:line. */
42
+ function todosAtRef(hash) {
43
+ const o = git(["grep", "-nI", "-E", "TODO|FIXME|HACK|XXX", hash, "--", "*.ts", "*.tsx", "*.js", "*.py", "*.go", "*.rs", "*.rb", "*.java"]);
44
+ const todos = [];
45
+ for (const line of o.split("\n")) {
46
+ // format: <ref>:<file>:<line>:<text>
47
+ const m = line.match(/^[^:]+:([^:]+):(\d+):(.*)$/);
48
+ if (m)
49
+ todos.push({ file: m[1], line: parseInt(m[2], 10), text: m[3].trim().slice(0, 120) });
50
+ if (todos.length >= 30)
51
+ break;
52
+ }
53
+ return todos;
54
+ }
55
+ export function registerSeanceCommands(program) {
56
+ program
57
+ .command("seance")
58
+ .description("🔮 SÉANCE — talk to your past self. Reconstruct the DECISION CONTEXT around any commit (what you said · were working on · had open as TODOs · abandoned), cited to real commits, so you (or an agent) can answer 'why did I choose this?' grounded in the record — never invented. Git-native shared context, local-first. HONEST: deterministic projection of git, not spirit-channeling; HPE-guard any answer.")
59
+ .option("--at <ref>", "a commit ref / sha / tag to summon")
60
+ .option("--months <n>", "summon your self from N months ago")
61
+ .option("--json", "JSON output (the full grounded packet)")
62
+ .action((opts) => {
63
+ const commits = readCommits();
64
+ if (!commits.length) {
65
+ out("no commits found (run inside a git repo)");
66
+ process.exitCode = 2;
67
+ return;
68
+ }
69
+ const r = resolveRef(opts.at, opts.months);
70
+ if (!r) {
71
+ out("could not resolve that ref");
72
+ process.exitCode = 2;
73
+ return;
74
+ }
75
+ const packet = seance.reconstructSeance(commits, r.hash, { ref: r.ref, todosThen: todosAtRef(r.hash), now: Math.floor(Date.now() / 1000) });
76
+ if (opts.json) {
77
+ out(JSON.stringify(packet, null, 2));
78
+ return;
79
+ }
80
+ out(`🔮 SÉANCE — your self at ${packet.at.ref} (${packet.at.monthsAgo} month(s) ago · ${packet.at.hash})`);
81
+ out(`\n 💬 What you said:\n "${packet.decision.subject}"${packet.decision.body ? `\n ${packet.decision.body.split("\n")[0]}` : ""}`);
82
+ if (packet.themes.length)
83
+ out(`\n 🎯 What you were focused on: ${packet.themes.join(" · ")}`);
84
+ if (packet.window.length) {
85
+ out(`\n 🕰 Leading up to it:`);
86
+ for (const w of packet.window.slice(0, 6))
87
+ out(` ${w.hash} ${w.subject}`);
88
+ }
89
+ if (packet.abandoned.length) {
90
+ out(`\n 👻 Paths you abandoned:`);
91
+ for (const a of packet.abandoned)
92
+ out(` ${a.hash} ${a.subject}`);
93
+ }
94
+ if (packet.todosThen.length) {
95
+ out(`\n 📌 Intentions you had open then:`);
96
+ for (const t of packet.todosThen.slice(0, 6))
97
+ out(` ${t.file}:${t.line} ${t.text}`);
98
+ }
99
+ out(`\n 🧷 ${packet.citations.length} citations · packetId ${packet.packetId.slice(0, 16)}…`);
100
+ out(` ${packet.groundingNote}`);
101
+ });
102
+ }
103
+ //# sourceMappingURL=seance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seance.js","sourceRoot":"","sources":["../../src/commands/seance.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,SAAS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AAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0MA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6mNvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2MA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA8mNvD"}
package/dist/index.js CHANGED
@@ -133,6 +133,7 @@ import { registerStatguardCommands } from "./commands/statguard.js";
133
133
  import { registerHpeCommands } from "./commands/hpe.js";
134
134
  import { registerVericertCommands } from "./commands/vericert.js";
135
135
  import { registerPersonaCommands } from "./commands/persona.js";
136
+ import { registerSeanceCommands } from "./commands/seance.js";
136
137
  import { registerMoatCommands } from "./commands/moat.js";
137
138
  import { attachRegretOracle } from "./commands/regret.js";
138
139
  import { registerTrustCommands } from "./commands/trust.js";
@@ -4823,6 +4824,7 @@ export async function run(argv) {
4823
4824
  registerHpeCommands(program);
4824
4825
  registerVericertCommands(program);
4825
4826
  registerPersonaCommands(program);
4827
+ registerSeanceCommands(program);
4826
4828
  registerMoatCommands(program);
4827
4829
  // ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
4828
4830
  registerTrustCommands(program);