memgineering 0.28.0 → 0.28.1

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 CHANGED
@@ -9,6 +9,44 @@ upgrade and by agents summarising a release, and both re-render it in whatever
9
9
  language the reader wants. The bilingual rule the monorepo applies to
10
10
  `@rayul/kordis` does not extend here.
11
11
 
12
+ ## [0.28.1] — 2026-11-22
13
+
14
+ ### Changed
15
+
16
+ - **The package page now links to the public repository
17
+ [memgineering/memgineering-cli](https://github.com/memgineering/memgineering-cli)**,
18
+ which holds each published version exactly as npm serves it. Issues go there
19
+ too.
20
+
21
+ ### Fixed
22
+
23
+ - **`memgineering undo` on a folder brain no longer acts on a path outside the
24
+ brain.** The ledger lives inside the brain folder, so anyone who can write
25
+ that folder — a synced or shared vault, a folder handed over by someone else —
26
+ could add one line naming a target such as `../../Library/LaunchAgents/x.plist`.
27
+ The next `undo` then created that file with the line's own content (an
28
+ `exclude` or `unexclude` line) or deleted a file whose hash the line supplied
29
+ (a `remember` line). Now a target that leaves the brain, or reaches outside
30
+ through a symlink, is refused with `ledger_divergence` before anything is
31
+ read, written or removed: nothing is created, changed or removed, and the
32
+ hint says the line was not acted on and points to `memgineering log`. An
33
+ ordinary `undo` inside the brain behaves as before, including the
34
+ `undo_conflict` answer when the note was deleted since.
35
+ - **A comment written at the left edge inside a note's `memgineering:` block no
36
+ longer makes a change lose the note's id.** Before, a `conflict` change that
37
+ set `binding` or `never_store` — `memgineering revise --action conflict` with
38
+ `--rule` or `--never-store` — on a note whose block had such a comment between
39
+ two of its keys (a line starting with `#` in column 0) wrote the key it changed
40
+ twice. The note then failed to read, and was treated as having no id, no
41
+ `binding` and no `never_store` words, while the command reported success. Now
42
+ the comment stays inside the block: the keys around it are changed once, and the
43
+ comment keeps its text and its place but is indented with the rest of the block
44
+ (its column is not kept). `unbind` on such a note, which was refused, now goes
45
+ through. Every write is also checked against the note it started from, and one
46
+ that would leave the note unreadable or without the id it had is refused with
47
+ "Nothing was written." A note already damaged this way is restored by
48
+ `memgineering undo` on a folder brain, as long as it has not been edited since.
49
+
12
50
  ## [0.28.0] — 2026-11-01
13
51
 
14
52
  ### Added
@@ -2,7 +2,7 @@
2
2
  name: memgineering
3
3
  description: Use whenever the user refers to something they told you before, asks what was decided, tells you something worth keeping, or settles something that should hold next time. The memory lives in their own folder and outlives this session; check it before answering from guesswork, and write to it when you learn something durable.
4
4
  type: skill
5
- version: 0.28.0
5
+ version: 0.28.1
6
6
  ---
7
7
 
8
8
  # memgineering
package/dist/index.js CHANGED
@@ -4108,16 +4108,12 @@ function findBlock(lines2) {
4108
4108
  if (start === -1) return null;
4109
4109
  if (inlineValueOf(lines2[start] ?? "") !== null) return { start, end: start + 1 };
4110
4110
  let end = start + 1;
4111
- while (end < lines2.length) {
4112
- const line = lines2[end] ?? "";
4113
- if (line.trim() === "") {
4114
- end += 1;
4115
- continue;
4116
- }
4111
+ for (let i = start + 1; i < lines2.length; i += 1) {
4112
+ const line = lines2[i] ?? "";
4113
+ if (line.trim() === "" || line.startsWith("#")) continue;
4117
4114
  if (!/^\s/.test(line)) break;
4118
- end += 1;
4115
+ end = i + 1;
4119
4116
  }
4120
- while (end > start + 1 && (lines2[end - 1] ?? "").trim() === "") end -= 1;
4121
4117
  return { start, end };
4122
4118
  }
4123
4119
  function blockBodyOf(lines2, span) {
@@ -4392,8 +4388,28 @@ function readNamespace(noteContent) {
4392
4388
  return {};
4393
4389
  }
4394
4390
  }
4391
+ function hasUnreadableFrontmatter(mapped) {
4392
+ return mapped.issues.some((issue) => issue.startsWith(UNREADABLE_FRONTMATTER));
4393
+ }
4395
4394
  function verifyPatch(patched, proposal, before) {
4396
4395
  const mapped = mapNoteToMemory({ path: proposal.target.path, content: patched, revision: null });
4396
+ if (before !== void 0) {
4397
+ const was = mapNoteToMemory({ path: proposal.target.path, content: before, revision: null });
4398
+ if (!hasUnreadableFrontmatter(was)) {
4399
+ if (hasUnreadableFrontmatter(mapped)) {
4400
+ throw new PatchError(
4401
+ "the patched note has frontmatter that no longer parses, so the note would lose what it declared",
4402
+ "This is a defect in the patcher, not in your note \u2014 it would have dropped the note\u2019s id, binding and never-store words. Nothing was written."
4403
+ );
4404
+ }
4405
+ if (mapped.memory.id !== was.memory.id) {
4406
+ throw new PatchError(
4407
+ `the patched note no longer reads with its own id (${was.memory.id})`,
4408
+ "This is a defect in the patcher, not in your note \u2014 a note that loses its id is a different memory to everything that points at it. Nothing was written."
4409
+ );
4410
+ }
4411
+ }
4412
+ }
4397
4413
  if (isLifecycleAction(proposal.action)) {
4398
4414
  const want = STATUS_FOR_ACTION[proposal.action];
4399
4415
  if (mapped.memory.status !== want) {
@@ -4629,7 +4645,7 @@ function reversePatch(content, patch) {
4629
4645
  }
4630
4646
  return null;
4631
4647
  }
4632
- var NAMESPACE2, FENCE_RE, LOOKS_FENCED_RE, PatchError, BLOCK_KEY_RE, ANY_INDENTED_KEY_RE;
4648
+ var NAMESPACE2, FENCE_RE, LOOKS_FENCED_RE, PatchError, BLOCK_KEY_RE, ANY_INDENTED_KEY_RE, UNREADABLE_FRONTMATTER;
4633
4649
  var init_patch = __esm({
4634
4650
  "../../packages/memory-engine/src/proposal/patch.ts"() {
4635
4651
  "use strict";
@@ -4650,6 +4666,7 @@ var init_patch = __esm({
4650
4666
  };
4651
4667
  BLOCK_KEY_RE = /^([^\s#][^:]*?)\s*:/;
4652
4668
  ANY_INDENTED_KEY_RE = /^(\s*)([^\s#][^:]*?)\s*:/;
4669
+ UNREADABLE_FRONTMATTER = "frontmatter is not valid YAML";
4653
4670
  }
4654
4671
  });
4655
4672
 
@@ -25297,6 +25314,7 @@ init_src();
25297
25314
  import { readFile as readFile31, rm as rm9 } from "fs/promises";
25298
25315
  import { join as join33 } from "path";
25299
25316
  import { Command as Command43 } from "commander";
25317
+ init_walk();
25300
25318
  init_atomic();
25301
25319
  init_errors();
25302
25320
  init_cloud_brain();
@@ -25392,7 +25410,7 @@ ${matches.slice(0, 8).map((id) => ` ${id}`).join("\n")}${matches.length > 8 ? "
25392
25410
  );
25393
25411
  }
25394
25412
  const record = await withWriteLock(brain.root, async () => {
25395
- const absolute = join33(brain.root, target.target);
25413
+ const absolute = await containedTarget(brain.root, target);
25396
25414
  const current = await readFile31(absolute, "utf8").catch(() => null);
25397
25415
  const actualHash = current === null ? null : hashContent(current);
25398
25416
  if (actualHash !== target.hash_after) {
@@ -25402,7 +25420,7 @@ ${matches.slice(0, 8).map((id) => ` ${id}`).join("\n")}${matches.length > 8 ? "
25402
25420
  await conflictHint(brain.root, target)
25403
25421
  );
25404
25422
  }
25405
- const reverted = await reverse(brain, target, current);
25423
+ const reverted = await reverse(brain, target, absolute, current);
25406
25424
  return appendOp(brain.root, {
25407
25425
  verb: "undo",
25408
25426
  target: target.target,
@@ -25454,8 +25472,7 @@ function minutesSince(iso) {
25454
25472
  if (!Number.isFinite(at)) return null;
25455
25473
  return Math.max(0, Math.floor((Date.now() - at) / 6e4));
25456
25474
  }
25457
- async function reverse(brain, op, current) {
25458
- const absolute = join33(brain.root, op.target);
25475
+ async function reverse(brain, op, absolute, current) {
25459
25476
  if (op.verb === "remember") {
25460
25477
  if (current === null) {
25461
25478
  throw memgError(
@@ -25507,6 +25524,19 @@ async function reverse(brain, op, current) {
25507
25524
  }
25508
25525
  return reverted;
25509
25526
  }
25527
+ async function containedTarget(root, op) {
25528
+ try {
25529
+ return await resolveRealInside(root, op.target);
25530
+ } catch (err) {
25531
+ const code = err.code;
25532
+ if (code === "ENOENT" || code === "ENOTDIR") return resolveInside(root, op.target);
25533
+ throw memgError(
25534
+ "ledger_divergence",
25535
+ `${oneLine(op.op_id, WIDTH.handle)} names a path outside this brain, or one that is not a plain file path inside it`,
25536
+ "The ledger names a path outside this brain (or one reached through a symlink), so that line was not acted on and nothing was created, changed or removed. This tool only records files inside the brain, so the line was added or edited by something else. `memgineering log --verbose` shows what the ledger says; check who can write this brain's folder, and do not undo by id until the line is explained."
25537
+ );
25538
+ }
25539
+ }
25510
25540
  async function conflictHint(vaultRoot, op) {
25511
25541
  const base2 = `Nothing was changed. Someone \u2014 you, an editor, or a sync \u2014 has written to that file since.
25512
25542
  Read what it says now, then decide what should stay.`;
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "memgineering",
3
- "version": "0.28.0",
3
+ "version": "0.28.1",
4
4
  "private": false,
5
5
  "description": "One memory for the AI you connect. Recall, remember, and revise a brain your agents share — stored in your own folder.",
6
6
  "license": "Apache-2.0",
7
7
  "homepage": "https://memgineering.com",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/memgineering/memgineering.git"
10
+ "url": "git+https://github.com/memgineering/memgineering-cli.git",
11
+ "directory": "memgineering"
11
12
  },
12
13
  "bugs": {
13
- "url": "https://github.com/memgineering/memgineering/issues"
14
+ "url": "https://github.com/memgineering/memgineering-cli/issues"
14
15
  },
15
16
  "type": "module",
16
17
  "bin": {