mneme-ai 3.133.0 → 3.134.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,13 @@
1
+ /**
2
+ * `mneme ctx` (v3.134.0) — THE CONTEXT PASSPORT: the cross-agent verified context
3
+ * layer that lives in git (`.mneme/passport/*.jsonl`). Any agent (any vendor)
4
+ * inherits what others learned — screened for poison/injection first — and
5
+ * contributes back, signed. Portable · vendor-neutral · local-first · trustworthy.
6
+ *
7
+ * mneme ctx contribute --kind decision --text "chose X" --cite a1b2c3,src/x.ts:4
8
+ * mneme ctx inherit # the screened, trusted context an agent reads
9
+ * mneme ctx status
10
+ */
11
+ import type { Command } from "commander";
12
+ export declare function registerCtxCommands(program: Command): void;
13
+ //# sourceMappingURL=ctx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ctx.d.ts","sourceRoot":"","sources":["../../src/commands/ctx.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwC1D"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * `mneme ctx` (v3.134.0) — THE CONTEXT PASSPORT: the cross-agent verified context
3
+ * layer that lives in git (`.mneme/passport/*.jsonl`). Any agent (any vendor)
4
+ * inherits what others learned — screened for poison/injection first — and
5
+ * contributes back, signed. Portable · vendor-neutral · local-first · trustworthy.
6
+ *
7
+ * mneme ctx contribute --kind decision --text "chose X" --cite a1b2c3,src/x.ts:4
8
+ * mneme ctx inherit # the screened, trusted context an agent reads
9
+ * mneme ctx status
10
+ */
11
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync } from "node:fs";
12
+ import { join } from "node:path";
13
+ import { contextPassport, notary } from "@mneme-ai/core";
14
+ function out(s) { process.stdout.write(s + "\n"); }
15
+ const DIR = () => join(process.cwd(), ".mneme", "passport");
16
+ function readAll() {
17
+ const acc = [];
18
+ const d = DIR();
19
+ try {
20
+ if (!existsSync(d))
21
+ return [];
22
+ for (const f of readdirSync(d)) {
23
+ if (!f.endsWith(".jsonl"))
24
+ continue;
25
+ for (const line of readFileSync(join(d, f), "utf8").split("\n")) {
26
+ if (line.trim()) {
27
+ try {
28
+ acc.push(JSON.parse(line));
29
+ }
30
+ catch { /* skip */ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ catch { /* */ }
36
+ return acc;
37
+ }
38
+ export function registerCtxCommands(program) {
39
+ const c = program
40
+ .command("ctx")
41
+ .alias("context-passport")
42
+ .description("🛂 CONTEXT PASSPORT — the cross-agent verified-context layer in git (.mneme/passport). Any agent (any vendor) inherits what others learned (poison-screened first) + contributes back, signed. Portable · vendor-neutral · local-first · trustworthy. TRUST-precision 1.0 — a poisoned/injected entry is NEVER inherited.");
43
+ c.command("contribute")
44
+ .description("append a signed context entry the next agent (any vendor) can inherit")
45
+ .requiredOption("--kind <k>", "decision | finding | dead-end | constraint")
46
+ .requiredOption("--text <t>", "the context to record")
47
+ .option("--cite <list>", "comma-separated commit hashes / file:line that ground it", "")
48
+ .option("--agent <name>", "your agent/tool id", "cli")
49
+ .action((o) => {
50
+ const kind = (["decision", "finding", "dead-end", "constraint"].includes(o.kind) ? o.kind : "finding");
51
+ const cites = o.cite ? o.cite.split(",").map((s) => s.trim()).filter(Boolean) : [];
52
+ const entry = contextPassport.makeEntry(o.agent, kind, o.text, cites, Math.floor(Date.now() / 1000));
53
+ const screen = contextPassport.trustScreen(entry);
54
+ let sig = null;
55
+ try {
56
+ sig = notary.issueReceipt(process.cwd(), { kind: "claim-verdict", subject: `ctx:${entry.kind}:${entry.id}`, payload: { id: entry.id }, includePayload: true });
57
+ }
58
+ catch { /* */ }
59
+ try {
60
+ mkdirSync(DIR(), { recursive: true });
61
+ const f = join(DIR(), o.agent.replace(/[^A-Za-z0-9._-]/g, "_") + ".jsonl");
62
+ const prev = existsSync(f) ? readFileSync(f, "utf8") : "";
63
+ writeFileSync(f, prev + JSON.stringify({ ...entry, sig }) + "\n");
64
+ }
65
+ catch { /* */ }
66
+ out(`🛂 recorded ${entry.kind} (${entry.id}) — ${screen.trust ? "✓ will be inherited as TRUSTED" : "⚠ would be QUARANTINED: " + screen.reason}`);
67
+ out(` commit .mneme/passport so the next agent (any vendor) inherits it.`);
68
+ });
69
+ c.command("inherit")
70
+ .description("the screened, trusted context an agent should read at task start (poison quarantined)")
71
+ .option("--json", "JSON output")
72
+ .action((o) => {
73
+ const r = contextPassport.inheritPassport(readAll());
74
+ if (o.json) {
75
+ out(JSON.stringify(r, null, 2));
76
+ return;
77
+ }
78
+ out(`🛂 CONTEXT PASSPORT — ${r.summary.trusted} trusted · ${r.summary.quarantined} quarantined (of ${r.summary.total})`);
79
+ if (!r.summary.total) {
80
+ out(" (empty — contribute: mneme ctx contribute --kind decision --text \"…\" --cite <commit>)");
81
+ return;
82
+ }
83
+ for (const e of r.trusted.slice(0, 20))
84
+ out(` ✓ [${e.kind}] ${e.text} ⟨${e.agent} · ${e.citations.join(", ")}⟩`);
85
+ for (const q of r.quarantined.slice(0, 8))
86
+ out(` ⚠ QUARANTINED [${q.entry.kind}] ${q.entry.text.slice(0, 56)} — ${q.reason}`);
87
+ });
88
+ c.command("status").description("passport counts").action(() => {
89
+ const r = contextPassport.inheritPassport(readAll());
90
+ out(`🛂 ${r.summary.total} entries · ${r.summary.trusted} trusted · ${r.summary.quarantined} quarantined · dir .mneme/passport`);
91
+ });
92
+ }
93
+ //# sourceMappingURL=ctx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ctx.js","sourceRoot":"","sources":["../../src/commands/ctx.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,MAAM,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c,CAAC,CAAC,OAAO,CAAC,OAAO,cAAc,CAAC,CAAC,OAAO,CAAC,WAAW,oCAAoC,CAAC,CAAC;IACnI,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6MA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgnNvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA8MA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAinNvD"}
package/dist/index.js CHANGED
@@ -136,6 +136,7 @@ import { registerPersonaCommands } from "./commands/persona.js";
136
136
  import { registerSeanceCommands } from "./commands/seance.js";
137
137
  import { registerBriefCommands } from "./commands/brief.js";
138
138
  import { registerPrCommentCommands } from "./commands/pr-comment.js";
139
+ import { registerCtxCommands } from "./commands/ctx.js";
139
140
  import { registerMoatCommands } from "./commands/moat.js";
140
141
  import { attachRegretOracle } from "./commands/regret.js";
141
142
  import { registerTrustCommands } from "./commands/trust.js";
@@ -4829,6 +4830,7 @@ export async function run(argv) {
4829
4830
  registerSeanceCommands(program);
4830
4831
  registerBriefCommands(program);
4831
4832
  registerPrCommentCommands(program);
4833
+ registerCtxCommands(program);
4832
4834
  registerMoatCommands(program);
4833
4835
  // ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
4834
4836
  registerTrustCommands(program);