memgineering 0.28.1 → 0.29.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.
- package/CHANGELOG.md +33 -0
- package/assets/MEMGINEERING.md +1 -1
- package/assets/memgineering-setup/SKILL.md +18 -0
- package/dist/index.js +105 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,39 @@ 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.29.0] — 2026-11-23
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- **`memgineering setup` no longer deletes your own notes from an instruction
|
|
17
|
+
file whose guide markers were damaged.** The guide sits between
|
|
18
|
+
`<!-- memgineering-start -->` and `<!-- memgineering-end -->` inside files
|
|
19
|
+
such as `CLAUDE.md`. If the end marker was lost with your own text below the
|
|
20
|
+
guide, the next run appended a second guide after your text, and the run after
|
|
21
|
+
that replaced everything from the first start to the new end, your text
|
|
22
|
+
included (measured: the notes were gone after the second run). Now the guide
|
|
23
|
+
is replaced only when the file has exactly one start line and one end line,
|
|
24
|
+
start first. Any other shape (a start with no end, an end with no start, an
|
|
25
|
+
end before the start, more than one of either) is refused for that file:
|
|
26
|
+
nothing is written, the report says which shape was found, and the hint names
|
|
27
|
+
the file and what to fix. Other files in the same run are still applied, and
|
|
28
|
+
`--dry-run` reports the same refusal. With `--json` the refusal is in
|
|
29
|
+
`marker_refusals` with `code: guide_markers_malformed`, `shape`, `file` and
|
|
30
|
+
`hint`; the hint gives the line numbers of the markers found, never tells you
|
|
31
|
+
where to put an end marker, and says that a marker quoted in your own notes
|
|
32
|
+
counts too (matching is by plain text), so change that mention. `memgineering
|
|
33
|
+
setup --web` now reports the same refusals when it finishes in the foreground
|
|
34
|
+
(it used to print "N tool(s) installed" and drop them), with exit 1. A file with no markers at all behaves as before. This also ends the
|
|
35
|
+
earlier self-repair for a lost end marker (the run after the damage appended a
|
|
36
|
+
block, the next collapsed it): that only held when nothing followed the guide.
|
|
37
|
+
|
|
38
|
+
### Agent guidance
|
|
39
|
+
|
|
40
|
+
- **The `memgineering-setup` skill now covers a guide refused over its
|
|
41
|
+
markers.** It says what the refusal means, the `--json` fields, and to fix the
|
|
42
|
+
markers by following the hint rather than guessing where a marker goes. Restart the agent session
|
|
43
|
+
after upgrading to pick up the new text.
|
|
44
|
+
|
|
12
45
|
## [0.28.1] — 2026-11-22
|
|
13
46
|
|
|
14
47
|
### Changed
|
package/assets/MEMGINEERING.md
CHANGED
|
@@ -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.
|
|
5
|
+
version: 0.29.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# memgineering
|
|
@@ -194,6 +194,24 @@ again. Two outcomes are worth recognising:
|
|
|
194
194
|
file is not mistaken for a clean install. Put the markers back around the
|
|
195
195
|
block, or delete the block, then run setup again. Never append a second copy
|
|
196
196
|
by hand: two guides means both are in the user's context every session.
|
|
197
|
+
- **A guide file refused over its markers** — setup replaces the guide only
|
|
198
|
+
where the file holds exactly one start line and one end line, start first.
|
|
199
|
+
A start with no end, an end with no start, an end before the start, or more
|
|
200
|
+
than one of either leaves that file untouched, because setup cannot tell
|
|
201
|
+
where the guide stops and the user's own text begins. Everything else in the
|
|
202
|
+
run is still applied, and the exit code is non-zero. The message (and, under
|
|
203
|
+
`--json`, `marker_refusals[]` with `code: guide_markers_malformed`, `shape`,
|
|
204
|
+
`file`, `hint`; the same fields in the `setup --web` result) names the file,
|
|
205
|
+
the shape and the line numbers where markers were found, and what to do. Follow
|
|
206
|
+
that hint, and tell the user which file it is. **Never add or move a marker by
|
|
207
|
+
guessing where the guide ends**: the next run replaces everything between the
|
|
208
|
+
markers, the user's own notes included. Delete the lone marker and the guide
|
|
209
|
+
text next to it only if you can see exactly where the guide ends; otherwise
|
|
210
|
+
move the user's own notes out of the file, delete the guide block and the
|
|
211
|
+
markers, run setup, and put the notes back outside them. If the marker text is
|
|
212
|
+
quoted in the user's own notes (a code example, say), change that mention so
|
|
213
|
+
it is no longer an exact copy: markers are matched as plain text, so a mention
|
|
214
|
+
anywhere in the file counts. Then run setup again.
|
|
197
215
|
- **`Appended below an unmarked guide`** — the same shape, on a file setup has
|
|
198
216
|
no record of writing, so it installed rather than refusing. Look at the file:
|
|
199
217
|
if an older unmarked copy is now sitting above the new block, delete that copy.
|
package/dist/index.js
CHANGED
|
@@ -8678,9 +8678,11 @@ async function applyAnswers(setupToken, claim, detected, guards = { candidates:
|
|
|
8678
8678
|
// and a later flag-less refresh keeps it only if it is recorded as one.
|
|
8679
8679
|
hookAnswer: answers.hook ? "on" : "off"
|
|
8680
8680
|
};
|
|
8681
|
-
await applySetup(choice, false);
|
|
8681
|
+
const results = await applySetup(choice, false);
|
|
8682
|
+
const refusals = results.filter((r) => r.result === "refused");
|
|
8682
8683
|
const parts = [];
|
|
8683
8684
|
parts.push(`${choice.tools.length} tool(s) installed`);
|
|
8685
|
+
if (refusals.length > 0) parts.push(`${refusals.length} file(s) refused`);
|
|
8684
8686
|
if (answers.location === "local" && answers.local_path) {
|
|
8685
8687
|
if (answers.local_mode === "link") {
|
|
8686
8688
|
const target = await openLinkTarget(answers.local_path, { quiet: true });
|
|
@@ -8740,7 +8742,7 @@ async function applyAnswers(setupToken, claim, detected, guards = { candidates:
|
|
|
8740
8742
|
}
|
|
8741
8743
|
}
|
|
8742
8744
|
if (account?.email) parts.push(`signed in as ${account.email}`);
|
|
8743
|
-
return { summary: parts.join(" \xB7 ") };
|
|
8745
|
+
return { summary: parts.join(" \xB7 "), refusals };
|
|
8744
8746
|
}
|
|
8745
8747
|
async function whoIs(token) {
|
|
8746
8748
|
const me = await apiRequest({ method: "GET", path: "/v1/me", token }).catch(() => null);
|
|
@@ -8916,15 +8918,36 @@ async function runSetupCloud(opts) {
|
|
|
8916
8918
|
${line}`));
|
|
8917
8919
|
return;
|
|
8918
8920
|
}
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8921
|
+
const { refusals } = outcome;
|
|
8922
|
+
const hints = refusalHints(refusals);
|
|
8923
|
+
const label = refusals.map((r) => `${r.what} (${r.tool})`).join(", ");
|
|
8924
|
+
if (isJsonMode()) {
|
|
8925
|
+
notice(
|
|
8926
|
+
JSON.stringify({
|
|
8927
|
+
setup_web: "applied",
|
|
8928
|
+
...refusals.length > 0 ? {
|
|
8929
|
+
refused: refusals.map((r) => `${r.what} (${r.tool})`),
|
|
8930
|
+
...refusals.some((r) => r.reason !== void 0) ? { marker_refusals: markerRefusalsJson(refusals) } : {},
|
|
8931
|
+
hint: hints.join("\n\n")
|
|
8932
|
+
} : {}
|
|
8933
|
+
})
|
|
8934
|
+
);
|
|
8935
|
+
} else {
|
|
8936
|
+
printHuman(
|
|
8937
|
+
refusals.length > 0 ? c.yellow("\nSetup finished, except for the file(s) listed below.") : c.green("\nSetup finished.")
|
|
8938
|
+
);
|
|
8922
8939
|
printHuman(
|
|
8923
8940
|
c.gray(
|
|
8924
8941
|
" recall and remember work now.\n The newly installed guidance is read from the next conversation on."
|
|
8925
8942
|
)
|
|
8926
8943
|
);
|
|
8944
|
+
if (refusals.length > 0) {
|
|
8945
|
+
printHuman(c.yellow(`
|
|
8946
|
+
Could not touch ${refusals.length} file(s): ${label}`));
|
|
8947
|
+
printHuman(c.gray(` ${hints.join("\n\n").split("\n").join("\n ")}`));
|
|
8948
|
+
}
|
|
8927
8949
|
}
|
|
8950
|
+
if (refusals.length > 0) process.exitCode = 1;
|
|
8928
8951
|
}
|
|
8929
8952
|
function insideFolder(target, folder) {
|
|
8930
8953
|
const real = (p) => {
|
|
@@ -9087,7 +9110,7 @@ function setupCommand() {
|
|
|
9087
9110
|
(r) => Object.values(HOOK_WHAT).includes(r.what) && r.result !== "refused" && r.result !== "removed"
|
|
9088
9111
|
);
|
|
9089
9112
|
const hints = [
|
|
9090
|
-
...refusals
|
|
9113
|
+
...refusalHints(refusals),
|
|
9091
9114
|
...duplicated.length > 0 ? [DUPLICATE_HINT] : [],
|
|
9092
9115
|
...notByName !== null ? [globalInstallHint(notByName, hooksLanded)] : [],
|
|
9093
9116
|
/*
|
|
@@ -9139,6 +9162,8 @@ function setupCommand() {
|
|
|
9139
9162
|
brains_linked: brains.length,
|
|
9140
9163
|
...refusals.length > 0 ? { refused: refusals.map((r) => `${r.what} (${r.tool})`) } : {},
|
|
9141
9164
|
...duplicated.length > 0 ? { duplicated: duplicated.map((r) => `${r.what} (${r.tool})`) } : {},
|
|
9165
|
+
// Guides refused over their markers, as data: the shape found, the file, the fix.
|
|
9166
|
+
...refusals.some((r) => r.reason !== void 0) ? { marker_refusals: markerRefusalsJson(refusals) } : {},
|
|
9142
9167
|
/*
|
|
9143
9168
|
* One key, composed above in order, instead of three spreads racing
|
|
9144
9169
|
* for it. Written as three conditionals the last one won — and the
|
|
@@ -9313,7 +9338,7 @@ Run: memgineering link ${path.trim()}`));
|
|
|
9313
9338
|
c.yellow(`
|
|
9314
9339
|
\u2717 ${refusals.length} file(s) could not be written: ${label(refusals)}`)
|
|
9315
9340
|
);
|
|
9316
|
-
printHuman(c.gray(` ${
|
|
9341
|
+
printHuman(c.gray(` ${refusalHints(refusals).join("\n\n").split("\n").join("\n ")}`));
|
|
9317
9342
|
}
|
|
9318
9343
|
process.exitCode = 1;
|
|
9319
9344
|
}
|
|
@@ -9372,6 +9397,7 @@ async function applySetup(choice, dryRun) {
|
|
|
9372
9397
|
tool: tool.label,
|
|
9373
9398
|
what: "guide",
|
|
9374
9399
|
result: written.outcome,
|
|
9400
|
+
...written.shape !== void 0 && written.hint !== void 0 ? { reason: written.shape, file: hubPath, hint: written.hint } : {},
|
|
9375
9401
|
...wasEdited(hubPath, written.before) ? { edited: true } : {}
|
|
9376
9402
|
});
|
|
9377
9403
|
if (!dryRun && written.after !== null) mark(hubPath, written.after);
|
|
@@ -9457,6 +9483,54 @@ function globalInstallHint(reason, hooks) {
|
|
|
9457
9483
|
return `${hooks ? "The hooks and the guide call" : "The guide tells your agent to run"} \`memgineering\` by name, and ${reason} \u2014
|
|
9458
9484
|
so nothing reaches it until a global install exists: \`npm i -g memgineering\`. Nothing needs re-running after that.`;
|
|
9459
9485
|
}
|
|
9486
|
+
function linesOf(text, needle) {
|
|
9487
|
+
const lines2 = [];
|
|
9488
|
+
for (let at = text.indexOf(needle); at !== -1; at = text.indexOf(needle, at + needle.length)) {
|
|
9489
|
+
lines2.push(text.slice(0, at).split("\n").length);
|
|
9490
|
+
}
|
|
9491
|
+
return lines2;
|
|
9492
|
+
}
|
|
9493
|
+
function markerFindings(text) {
|
|
9494
|
+
const starts = linesOf(text, BRAND.hubMarkerStart);
|
|
9495
|
+
const ends = linesOf(text, BRAND.hubMarkerEnd);
|
|
9496
|
+
const shape = (() => {
|
|
9497
|
+
if (starts.length === 0 && ends.length === 0) return "none";
|
|
9498
|
+
if (starts.length > 1) return "multiple_starts";
|
|
9499
|
+
if (ends.length > 1) return "multiple_ends";
|
|
9500
|
+
if (starts.length === 0) return "missing_start";
|
|
9501
|
+
if (ends.length === 0) return "missing_end";
|
|
9502
|
+
return text.indexOf(BRAND.hubMarkerStart) < text.indexOf(BRAND.hubMarkerEnd) ? "ok" : "end_before_start";
|
|
9503
|
+
})();
|
|
9504
|
+
return { shape, starts, ends };
|
|
9505
|
+
}
|
|
9506
|
+
function markerRefusalHint(file, f, shape) {
|
|
9507
|
+
const where = (n) => n.length === 1 ? `line ${n[0]}` : `lines ${n.join(", ")}`;
|
|
9508
|
+
const found = (n) => n.length === 0 ? "is not in the file" : `is on ${where(n)}`;
|
|
9509
|
+
const repair = {
|
|
9510
|
+
missing_end: `If you can see where the guide ends, delete the start line (${where(f.starts)}) and the guide text after it up to that point, then run setup to install a fresh guide. Do not add an end line by guessing where the guide ends: the next run would replace everything up to it.`,
|
|
9511
|
+
missing_start: `If you can see where the guide begins, delete the end line (${where(f.ends)}) and the guide text before it back to that point, then run setup to install a fresh guide. Do not add a start line by guessing where the guide begins: the next run would replace everything after it.`,
|
|
9512
|
+
end_before_start: "If you can see exactly where the guide text is, delete that text together with its marker lines.",
|
|
9513
|
+
multiple_starts: "If the extra markers belong to an extra copy of the guide that you can see exactly (an earlier run may have appended one), delete that copy together with its markers, so one start line and one end line remain.",
|
|
9514
|
+
multiple_ends: "If the extra markers belong to an extra copy of the guide that you can see exactly (an earlier run may have appended one), delete that copy together with its markers, so one start line and one end line remain."
|
|
9515
|
+
};
|
|
9516
|
+
const all = [...f.starts, ...f.ends].sort((a, b) => a - b);
|
|
9517
|
+
return `${file} was not changed. Found: the start line ${BRAND.hubMarkerStart} ${found(f.starts)}, the end line ${BRAND.hubMarkerEnd} ${found(f.ends)}; ${MARKER_SHAPE_WORDS[shape]}. Setup cannot tell where the memgineering guide ends and the user's own text begins, so it left the file alone.
|
|
9518
|
+
${repair[shape]}
|
|
9519
|
+
Otherwise, move the user's own notes out of the file, delete the guide block and every marker line (${where(all)}), run \`memgineering setup\`, then put the notes back outside the markers.
|
|
9520
|
+
If the marker text above appears in the user's own notes, for example in a code example, change that mention so it is no longer an exact copy of the marker: markers are matched as plain text, so a mention anywhere in the file counts.
|
|
9521
|
+
Then run \`memgineering setup\` again.`;
|
|
9522
|
+
}
|
|
9523
|
+
function refusalHints(refusals) {
|
|
9524
|
+
return [
|
|
9525
|
+
...refusals.some((r) => r.reason === void 0) ? [REFUSAL_HINT] : [],
|
|
9526
|
+
...refusals.flatMap((r) => r.reason !== void 0 && r.hint !== void 0 ? [r.hint] : [])
|
|
9527
|
+
];
|
|
9528
|
+
}
|
|
9529
|
+
function markerRefusalsJson(refusals) {
|
|
9530
|
+
return refusals.flatMap(
|
|
9531
|
+
(r) => r.reason !== void 0 && r.file !== void 0 && r.hint !== void 0 ? [{ code: MARKER_REFUSAL_CODE, shape: r.reason, file: r.file, hint: r.hint }] : []
|
|
9532
|
+
);
|
|
9533
|
+
}
|
|
9460
9534
|
async function recordedChoices(detected) {
|
|
9461
9535
|
const cfg = await loadConfig();
|
|
9462
9536
|
if (!isSetUp(cfg)) return {};
|
|
@@ -9616,9 +9690,11 @@ ${BRAND.hubMarkerEnd}`;
|
|
|
9616
9690
|
}
|
|
9617
9691
|
return { outcome: "injected", before: null, after: fingerprint(block) };
|
|
9618
9692
|
}
|
|
9619
|
-
const
|
|
9620
|
-
const
|
|
9621
|
-
if (
|
|
9693
|
+
const found = markerFindings(existing);
|
|
9694
|
+
const shape = found.shape;
|
|
9695
|
+
if (shape === "ok") {
|
|
9696
|
+
const start = existing.indexOf(BRAND.hubMarkerStart);
|
|
9697
|
+
const end = existing.indexOf(BRAND.hubMarkerEnd);
|
|
9622
9698
|
const was = existing.slice(start, end + BRAND.hubMarkerEnd.length);
|
|
9623
9699
|
if (was === block) return { outcome: "unchanged", before: was, after: fingerprint(block) };
|
|
9624
9700
|
if (!dryRun) {
|
|
@@ -9629,7 +9705,16 @@ ${BRAND.hubMarkerEnd}`;
|
|
|
9629
9705
|
}
|
|
9630
9706
|
return { outcome: "updated", before: was, after: fingerprint(block) };
|
|
9631
9707
|
}
|
|
9632
|
-
if (
|
|
9708
|
+
if (shape !== "none") {
|
|
9709
|
+
return {
|
|
9710
|
+
outcome: "refused",
|
|
9711
|
+
before: null,
|
|
9712
|
+
after: null,
|
|
9713
|
+
shape,
|
|
9714
|
+
hint: markerRefusalHint(filePath, found, shape)
|
|
9715
|
+
};
|
|
9716
|
+
}
|
|
9717
|
+
if (looksLikeOurGuide(existing)) {
|
|
9633
9718
|
if (weWroteThis) return { outcome: "refused", before: null, after: null };
|
|
9634
9719
|
if (!dryRun) await writeThenRename(filePath, `${existing.trimEnd()}
|
|
9635
9720
|
|
|
@@ -9806,7 +9891,7 @@ async function exists2(path) {
|
|
|
9806
9891
|
return false;
|
|
9807
9892
|
}
|
|
9808
9893
|
}
|
|
9809
|
-
var TOOLS, HOSTED_CONNECTOR_URL, SUPPORTED_LIST, REFUSAL_HINT, DUPLICATE_HINT, HOOK_TIMEOUT_S, DEFAULT_HOOK_TOOLS, HOOK_WHAT, HOOKS, SHIPPED_HOOK_COMMANDS;
|
|
9894
|
+
var TOOLS, HOSTED_CONNECTOR_URL, SUPPORTED_LIST, REFUSAL_HINT, DUPLICATE_HINT, MARKER_REFUSAL_CODE, MARKER_SHAPE_WORDS, HOOK_TIMEOUT_S, DEFAULT_HOOK_TOOLS, HOOK_WHAT, HOOKS, SHIPPED_HOOK_COMMANDS;
|
|
9810
9895
|
var init_setup = __esm({
|
|
9811
9896
|
"src/commands/setup.ts"() {
|
|
9812
9897
|
"use strict";
|
|
@@ -9895,6 +9980,14 @@ var init_setup = __esm({
|
|
|
9895
9980
|
REFUSAL_HINT = `Either a guide setup wrote is still there with its markers removed, or a settings file is not valid JSON. Everything else in this run was applied.
|
|
9896
9981
|
For a guide: put ${BRAND.hubMarkerStart} and ${BRAND.hubMarkerEnd} back around that block, or delete the block, then run setup again.`;
|
|
9897
9982
|
DUPLICATE_HINT = "That file already looked like it held a memgineering guide with no markers around it, so the new one was appended below rather than replacing it.\nIf an older copy is now sitting above it, delete that copy \u2014 two guides means both are in every session. If those lines are your own writing, nothing is wrong.";
|
|
9983
|
+
MARKER_REFUSAL_CODE = "guide_markers_malformed";
|
|
9984
|
+
MARKER_SHAPE_WORDS = {
|
|
9985
|
+
missing_end: "the end line is missing",
|
|
9986
|
+
missing_start: "the start line is missing",
|
|
9987
|
+
end_before_start: "the end line comes before the start line",
|
|
9988
|
+
multiple_starts: "there is more than one start line",
|
|
9989
|
+
multiple_ends: "there is more than one end line"
|
|
9990
|
+
};
|
|
9898
9991
|
HOOK_TIMEOUT_S = Math.ceil(HOOK_DEADLINE_MS / 1e3) + 3;
|
|
9899
9992
|
DEFAULT_HOOK_TOOLS = ["claude", "codex"];
|
|
9900
9993
|
HOOK_WHAT = {
|
package/package.json
CHANGED