@memnexus-ai/mx-agent-cli 0.1.277 → 0.1.279

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.
@@ -17,7 +17,8 @@
17
17
  * Because `mx memories create --name` UPSERTS SILENTLY, we positively verify the
18
18
  * archive name is free (get returns no JSON body) and pick the next free N.
19
19
  */
20
- import { writeFileSync } from 'fs';
20
+ import { spawnSync } from 'child_process';
21
+ import { existsSync, writeFileSync } from 'fs';
21
22
  import { join } from 'path';
22
23
  import chalk from 'chalk';
23
24
  import { isMxAvailable, readNamedMemoryJson, } from '../lib/memory.js';
@@ -135,13 +136,258 @@ export function nextArchiveN(name, probe, maxProbe = 100) {
135
136
  throw new Error(`Could not find a free archive name after ${maxProbe} probes for "${name}-archive-*". ` +
136
137
  `Check the existing archives manually.`);
137
138
  }
138
- /** Build the trimmed live-head draft: kept content plus an archive pointer. */
139
- export function buildHeadDraft(name, head, archiveName, date) {
139
+ // ── Safety checks (advisory; the operator decides) ───────────────────────────
140
+ //
141
+ // Two teams have now had to run these by hand, both on 2026-08-05/06:
142
+ //
143
+ // * platform: the default split would have moved 38 issue slugs into the
144
+ // archive with NO index line left in the live head, breaking an invariant
145
+ // the document states in its own header. All 38 were OPEN.
146
+ // * customer-portal: their two named docs use OPPOSITE ordering conventions
147
+ // (known-issues newest-at-top, iteration-log newest-at-BOTTOM). Accepting
148
+ // the tool's default on the second would have archived their NEWEST
149
+ // entries. They also found 76 of 77 moved entries carried no resolution
150
+ // marker, and that several said "fixed" about a SUB-PART of a still-open
151
+ // item — so a naive grep for resolution language reads as "checked" while
152
+ // answering wrong in the unsafe direction.
153
+ //
154
+ // Everything below is OUTPUT ONLY. No check changes the split, and none of
155
+ // them changes the exit status: this is an advisory tool and must not start
156
+ // failing builds.
157
+ //
158
+ // None of them states a CONCLUSION either. Two security reviews found real
159
+ // document shapes that fooled the ordering classifier and the status classifier
160
+ // into a confident wrong answer, and each fix drew a new shape. The checks now
161
+ // report extracted facts — date ranges per draft, the identifier set difference
162
+ // — and leave every judgement to the operator, who has the document open.
163
+ /** ISO date, the dominant format in these docs. Also matches `[2026-08-05]`. */
164
+ const ISO_DATE_RE = /\d{4}-\d{2}-\d{2}/;
165
+ /**
166
+ * A STRUCTURAL entry anchor: a markdown heading, a list bullet, or a table cell
167
+ * whose FIRST content is a date. Used to prefer entry dates over prose dates
168
+ * ("we first saw this on 2026-01-01") when reporting ranges.
169
+ *
170
+ * This selects which dates are reported FIRST, not which dates are reported.
171
+ * Requiring the date to be the line's leading content excludes a heading like
172
+ * `## Iteration 12 — 2026-08-05`, and dropping those dates SILENTLY was a path
173
+ * to a wrong ordering conclusion: the report showed a clean, confident-looking
174
+ * pair of ranges computed from a filtered sample. Every date the filter removes
175
+ * is now reported too — see `allHead` / `allArchive`.
176
+ */
177
+ const ANCHOR_LINE_RE = /^\s{0,3}(#{1,6}\s*|[-*+]\s*|\|\s*)?\[?\d{4}-\d{2}-\d{2}/;
178
+ /** Below this many structural anchor dates we report every first-per-line date only. */
179
+ export const MIN_ANCHOR_DATES = 4;
180
+ /** First ISO date on each line, with its line index. */
181
+ function datedLines(lines) {
182
+ const out = [];
183
+ for (let i = 0; i < lines.length; i++) {
184
+ const m = ISO_DATE_RE.exec(lines[i]);
185
+ if (m)
186
+ out.push({ line: i, date: m[0] });
187
+ }
188
+ return out;
189
+ }
190
+ /** ISO dates sort correctly as strings, so min/max need no parsing. */
191
+ function rangeOf(dates) {
192
+ if (dates.length === 0)
193
+ return { count: 0 };
194
+ const sorted = [...dates].sort();
195
+ return { count: dates.length, earliest: sorted[0], latest: sorted[sorted.length - 1] };
196
+ }
197
+ /** Pure arithmetic on two ranges. Names no winner and reads no convention. */
198
+ export function relateDrafts(head, archive) {
199
+ if (!head.earliest || !archive.earliest)
200
+ return 'insufficient';
201
+ if (archive.latest < head.earliest)
202
+ return 'archive-older';
203
+ if (head.latest < archive.earliest)
204
+ return 'head-older';
205
+ return 'overlapping';
206
+ }
207
+ /**
208
+ * CHECK 1 — extract the dates in each draft so the OPERATOR can answer the
209
+ * ordering question. This function states no direction.
210
+ *
211
+ * The earlier version inferred newest-at-top vs newest-at-bottom from the
212
+ * direction consecutive dates moved, and printed a verdict ("THE SPLIT IS
213
+ * PROBABLY INVERTED … Swap the two drafts"). Two independent document shapes
214
+ * from real fleet documents — category headings with ascending dated
215
+ * sub-bullets, and dated sub-bullets inside descending entries — drove that
216
+ * verdict to the wrong answer, and obeying a wrong verdict archives the newest
217
+ * entries. Comparing the two drafts' date ranges answers the same question by
218
+ * arithmetic on extracted dates, so there is no inference left to be wrong.
219
+ *
220
+ * BOTH populations are reported. Reporting only the anchor dates was a second,
221
+ * quieter path to the same wrong conclusion: on a document whose entry dates sit
222
+ * in headings that do not START with the date, while recent status-refresh
223
+ * bullets and old first-observed bullets do, the anchor ranges say the archive
224
+ * is cleanly older and the unfiltered ranges say they overlap. The disagreement
225
+ * IS the finding — it means the document carries dates at two levels meaning two
226
+ * different things — so it is surfaced and left unresolved.
227
+ *
228
+ * `boundary` is the line index where the archive portion begins (from
229
+ * splitForArchive), so every range describes one of the two drafts themselves.
230
+ */
231
+ export function collectDateEvidence(content, boundary) {
232
+ const lines = content.split('\n');
233
+ const all = datedLines(lines);
234
+ const anchors = all.filter((d) => ANCHOR_LINE_RE.test(lines[d.line]));
235
+ const useAnchors = anchors.length >= MIN_ANCHOR_DATES;
236
+ const picked = useAnchors ? anchors : all;
237
+ const inHead = (ds) => ds.filter((d) => d.line < boundary).map((d) => d.date);
238
+ const inArchive = (ds) => ds.filter((d) => d.line >= boundary).map((d) => d.date);
239
+ const head = rangeOf(inHead(picked));
240
+ const archive = rangeOf(inArchive(picked));
241
+ const allHead = rangeOf(inHead(all));
242
+ const allArchive = rangeOf(inArchive(all));
243
+ const primary = relateDrafts(head, archive);
244
+ const unfiltered = relateDrafts(allHead, allArchive);
245
+ return {
246
+ population: useAnchors ? 'section-anchor' : 'all-lines',
247
+ dates: picked.map((d) => d.date),
248
+ firstDate: picked[0]?.date,
249
+ lastDate: picked[picked.length - 1]?.date,
250
+ head,
251
+ archive,
252
+ allDateCount: all.length,
253
+ allHead,
254
+ allArchive,
255
+ readingsConflict: all.length > picked.length &&
256
+ primary !== 'insufficient' &&
257
+ unfiltered !== 'insufficient' &&
258
+ primary !== unfiltered,
259
+ };
260
+ }
261
+ /**
262
+ * Identifiers we track across the split. `KI-...` slugs and `#NNNN` issue refs
263
+ * are how every fleet document cross-references an entry, so an identifier that
264
+ * exists only in the archive is exactly an entry that became unfindable from
265
+ * the live head.
266
+ */
267
+ /*
268
+ * Families counted in the live platform known-issues document: `#NNNN` (~60),
269
+ * `KI-*` (~25), `SF-1..SF-16` plus `SF-29a` (12 distinct), `NEW-1..NEW-20` (13
270
+ * distinct), and `PRE-SF-1`. Only the first two were matched before, so twelve
271
+ * `SF-N` entries — each carrying an explicit `OPEN` status and a `Full text:
272
+ * archive-3` pointer — were invisible to the orphan check: had the split landed
273
+ * above them, they would have moved to the archive and the orphan list would
274
+ * have reported zero. Silent, with no artifact to review afterwards.
275
+ *
276
+ * `[a-z]?` is for the `SF-29a` sub-part convention. `#\d{2,}` rather than
277
+ * `#\d{3,}`: two-digit issue numbers exist in this repo's history, and missing
278
+ * an identifier is the unsafe direction — a false positive only adds a line to
279
+ * an advisory list.
280
+ */
281
+ export const IDENTIFIER_RE_G = /\b(?:KI|SF|NEW|RT|FL|COE|ADR|PRE-SF)-[A-Z0-9]+(?:-[A-Z0-9]+)*[a-z]?\b|#\d{2,}/g;
282
+ /**
283
+ * Anything SHAPED like an identifier: an all-caps prefix, a hyphen, then an
284
+ * alphanumeric body. Used only to report tokens the strict regex did NOT
285
+ * capture, so the next unrecognised family is loud rather than silent.
286
+ */
287
+ export const LOOSE_IDENTIFIER_RE_G = /\b[A-Z][A-Z0-9]{1,5}-[A-Z0-9][A-Z0-9-]*[a-z]?\b/g;
288
+ /** Unique identifiers in first-appearance order. */
289
+ export function extractIdentifiers(text) {
290
+ const seen = new Set();
291
+ const out = [];
292
+ for (const m of text.matchAll(IDENTIFIER_RE_G)) {
293
+ if (!seen.has(m[0])) {
294
+ seen.add(m[0]);
295
+ out.push(m[0]);
296
+ }
297
+ }
298
+ return out;
299
+ }
300
+ /**
301
+ * Identifier-SHAPED tokens that the strict regex did not capture, excluding any
302
+ * token overlapping a strict match. These are reported for a human to eyeball:
303
+ * an unrecognised family here is exactly the MF-3 failure (a whole class of
304
+ * open entries invisible to the orphan check) caught before it is silent.
305
+ */
306
+ export function findUnrecognisedIdentifierTokens(text) {
307
+ const strictSpans = [];
308
+ for (const m of text.matchAll(IDENTIFIER_RE_G)) {
309
+ strictSpans.push([m.index, m.index + m[0].length]);
310
+ }
311
+ const seen = new Set();
312
+ const out = [];
313
+ for (const m of text.matchAll(LOOSE_IDENTIFIER_RE_G)) {
314
+ const s = m.index;
315
+ const e = s + m[0].length;
316
+ if (strictSpans.some(([a, b]) => s < b && a < e))
317
+ continue;
318
+ if (!seen.has(m[0])) {
319
+ seen.add(m[0]);
320
+ out.push(m[0]);
321
+ }
322
+ }
323
+ return out;
324
+ }
325
+ /**
326
+ * CHECK 2 — the highest-value check. Every identifier present in the archive
327
+ * portion but absent from the head portion becomes unfindable from the live
328
+ * document once the split is committed.
329
+ */
330
+ export function findOrphanedIdentifiers(head, archive) {
331
+ const archiveIdentifiers = extractIdentifiers(archive);
332
+ const headIdentifiers = extractIdentifiers(head);
333
+ const inHead = new Set(headIdentifiers);
334
+ return {
335
+ archiveIdentifiers,
336
+ headIdentifiers,
337
+ orphaned: archiveIdentifiers.filter((id) => !inHead.has(id)),
338
+ retained: archiveIdentifiers.filter((id) => inHead.has(id)),
339
+ unrecognised: findUnrecognisedIdentifierTokens(archive),
340
+ };
341
+ }
342
+ // ── CHECK 3 — index stubs ────────────────────────────────────────────────────
343
+ //
344
+ // EVERY orphaned identifier needs an index stub. There is no resolved bucket,
345
+ // no status classification, and no annotation about status either.
346
+ //
347
+ // Why the resolved bucket went: it existed to spare the operator from writing a
348
+ // stub for an already-closed entry, and it carried every fail-open path in this
349
+ // tool — a misread status is an open entry silently orphaned. Measured across
350
+ // the three real documents rotated this week, orphaned entries carrying an
351
+ // explicit resolution marker were 1 of 132 (platform known-issues 0/38,
352
+ // customer-portal 1/77, platform codex doc 0/17).
353
+ //
354
+ // Why the annotation went too: a later revision kept a display-only note —
355
+ // resolution-shaped words quoted from the line an identifier sits on, which
356
+ // could not change the stub count. Executed against two real corpus lines it
357
+ // fired 12 times and was right once; on one live line it was wrong six times out
358
+ // of six, because the CLOSED on that line belonged to a different subject than
359
+ // the six deferred Should Fix items listed beside it. Narrowing the mechanism to
360
+ // a single line did not make it more accurate — it removed the attribution
361
+ // logic, which was the only part that had ever been trying to be. It also fired
362
+ // densest on round-up lines, which is exactly where the operator most needs to
363
+ // write stubs, and at that error rate it trains the reader to distrust the whole
364
+ // report rather than to check by hand.
365
+ /**
366
+ * Remove C0/C1 control characters (ESC included) but keep tab. Memory content is
367
+ * authored by other teams and is untrusted input to this report: a raw ANSI
368
+ * escape sequence surviving into the operator's terminal can erase preceding
369
+ * lines and repaint a false `ORPHANED: 0` over a real finding.
370
+ */
371
+ export function stripControlChars(s) {
372
+ // eslint-disable-next-line no-control-regex
373
+ return s.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F]/g, '');
374
+ }
375
+ /**
376
+ * Build the trimmed live-head draft: kept content, an archive pointer, and a
377
+ * provenance stamp.
378
+ *
379
+ * The stamp matters because this file is where the operator hand-adds the index
380
+ * stub for every non-resolved orphan — so it becomes the ONLY copy of that work.
381
+ * A stamp naming the generation time and the source size makes a stale draft
382
+ * self-identifying instead of indistinguishable from a fresh one.
383
+ */
384
+ export function buildHeadDraft(name, head, archiveName, date, sourceLen = head.length, generatedAt = new Date().toISOString()) {
140
385
  return (`${head}\n\n` +
141
386
  `---\n\n` +
142
387
  `_Archive pointer: older entries were moved to named memory ` +
143
388
  `\`${archiveName}\` on ${date} (archive-prep bridge). ` +
144
- `Fetch that memory for full history._\n`);
389
+ `Fetch that memory for full history._\n\n` +
390
+ `_Generated ${generatedAt} by archive-prep from a ${sourceLen}-char head_\n`);
145
391
  }
146
392
  /** Build the archive draft: a header noting provenance, then the older entries. */
147
393
  export function buildArchiveDraft(name, archive, n, date) {
@@ -153,6 +399,20 @@ export function buildArchiveDraft(name, archive, n, date) {
153
399
  `${archive}\n`);
154
400
  }
155
401
  // ── Command runner (I/O) ─────────────────────────────────────────────────────
402
+ /**
403
+ * True when git reports `path` as ignored. Exit 0 = ignored, 1 = not ignored,
404
+ * 128 = not a repo. Anything other than a clean 0 is reported as NOT ignored:
405
+ * the reassurance is the claim that can mislead, so it must be earned.
406
+ */
407
+ export function isGitIgnored(path) {
408
+ try {
409
+ const r = spawnSync('git', ['check-ignore', '-q', '--', path], { stdio: 'ignore' });
410
+ return r.status === 0;
411
+ }
412
+ catch {
413
+ return false;
414
+ }
415
+ }
156
416
  export async function runArchivePrep(options) {
157
417
  const { name } = options;
158
418
  const cwd = options.cwd ?? process.cwd();
@@ -227,10 +487,26 @@ export async function runArchivePrep(options) {
227
487
  // ── 3. Split and build drafts ─────────────────────────────────────────────
228
488
  const split = splitForArchive(content);
229
489
  const date = new Date().toISOString().slice(0, 10);
230
- const headDraft = buildHeadDraft(name, split.head, archiveName, date);
490
+ const headDraft = buildHeadDraft(name, split.head, archiveName, date, len);
231
491
  const archiveDraft = buildArchiveDraft(name, split.archive, n, date);
232
492
  const headPath = join(cwd, `${name}.head.draft.md`);
233
493
  const archivePath = join(cwd, `${name}.archive-${n}.draft.md`);
494
+ // Refuse to clobber. `nextArchiveN` gives a fresh N on a re-run so the ARCHIVE
495
+ // draft lands on a new path, but the HEAD path is a fixed function of `name`
496
+ // and would be silently overwritten — destroying the hand-added index stubs
497
+ // that step 2 below tells the operator to write into it.
498
+ if (!options.force) {
499
+ for (const p of [headPath, archivePath]) {
500
+ if (existsSync(p)) {
501
+ console.error(chalk.red(`Error: ${p} already exists.`));
502
+ console.error(chalk.dim(' A previous run left a draft here and it may carry hand-added index stubs.'));
503
+ console.error(chalk.dim(' Move or delete it, or re-run with --force to overwrite.'));
504
+ // Exit 1 = ran, precondition failed (contrast the exit 2 above, which
505
+ // means we could not run at all).
506
+ process.exit(1);
507
+ }
508
+ }
509
+ }
234
510
  writeFileSync(headPath, headDraft, 'utf-8');
235
511
  writeFileSync(archivePath, archiveDraft, 'utf-8');
236
512
  console.log(chalk.green(' Drafts written:'));
@@ -238,7 +514,11 @@ export async function runArchivePrep(options) {
238
514
  console.log(` ${chalk.bold('Archive (older):')} ${archivePath} (${archiveDraft.length} chars)`);
239
515
  console.log(chalk.dim(` Split strategy: ${split.strategy} boundary at line ${split.boundary}.`));
240
516
  console.log();
241
- // ── 4. Warn about ordering + next steps (human-reviewed commit) ───────────
517
+ // ── 4. Safety checks (advisory output; nothing here decides anything) ─────
518
+ const dates = collectDateEvidence(content, split.boundary);
519
+ const orphans = findOrphanedIdentifiers(split.head, split.archive);
520
+ printSafetyChecks(dates, orphans);
521
+ // ── 5. Warn about ordering + next steps (human-reviewed commit) ───────────
242
522
  console.log(chalk.yellow(' Verify before committing:'));
243
523
  console.log(chalk.dim(` This tool split at ~50% and treated the BOTTOM portion as the older\n` +
244
524
  ` entries. It cannot know your memory's ordering convention (newest-at-top\n` +
@@ -247,16 +527,124 @@ export async function runArchivePrep(options) {
247
527
  console.log();
248
528
  console.log(chalk.bold(' Next steps (do them in this order):'));
249
529
  console.log(chalk.dim(' 1. Review both drafts above; edit the split if needed.'));
250
- console.log(` 2. Create the archive FIRST:`);
530
+ console.log(` 2. Add an index stub to the head draft for EVERY orphaned identifier`);
531
+ console.log(` (all ${orphans.orphaned.length} above). One line each, in the head draft:`);
532
+ console.log(chalk.cyan(` - **SLUG (Pn, OPEN, #NNNN)** — <one clause>. Full text: archive-${n}.`));
533
+ console.log(chalk.dim(` Without a stub the entry is unfindable from the live document.`));
534
+ console.log(` 3. Create the archive FIRST:`);
251
535
  console.log(chalk.cyan(` mx memories create --name "${archiveName}" --conversation-id NEW --content "$(cat '${archivePath}')"`));
252
- console.log(` 3. Verify the archive landed:`);
536
+ console.log(` 4. Verify the archive landed:`);
253
537
  console.log(chalk.cyan(` mx memories get --name "${archiveName}"`));
254
- console.log(` 4. Only then update the live head:`);
538
+ console.log(` 5. Only then update the live head:`);
255
539
  console.log(chalk.cyan(` mx memories update --name "${name}" --content "$(cat '${headPath}')"`));
256
540
  console.log(chalk.dim(` (The head shrinks, so the write-guard hook may prompt — use MX_SHRINK_OK=1 inline once you have confirmed the archive exists.)`));
257
- console.log(` 5. Clean up the drafts once the MemNexus writes are verified:`);
258
- console.log(chalk.dim(` These are local scratch files (gitignored via *.draft.md — they never commit). Delete them:`));
541
+ console.log(` 6. Clean up the drafts once the MemNexus writes are verified:`);
542
+ // Drafts land in process.cwd(), which need NOT be inside this repo (or any
543
+ // repo). Verify the claim rather than asserting it.
544
+ if (isGitIgnored(headPath) && isGitIgnored(archivePath)) {
545
+ console.log(chalk.dim(` These are local scratch files (verified gitignored here — they never commit). Delete them:`));
546
+ }
547
+ else {
548
+ console.log(chalk.yellow(` NOT gitignored at this location — do not commit these. Delete them:`));
549
+ }
259
550
  console.log(chalk.cyan(` rm '${headPath}' '${archivePath}'`));
260
551
  console.log();
261
552
  }
553
+ /** Cap on how many identifiers we list inline before summarising. */
554
+ const MAX_LISTED = 40;
555
+ function listIds(ids, indent) {
556
+ const shown = ids.slice(0, MAX_LISTED);
557
+ for (const id of shown)
558
+ console.log(`${indent}${id}`);
559
+ if (ids.length > shown.length) {
560
+ console.log(chalk.dim(`${indent}… and ${ids.length - shown.length} more (see the archive draft).`));
561
+ }
562
+ }
563
+ /**
564
+ * Render the three advisory checks in the report's existing style. Output only:
565
+ * this function never changes the split and never changes the exit status.
566
+ *
567
+ * It also states no CONCLUSION. Check 1 reports date ranges and asks the
568
+ * operator for the ordering answer; check 3 reports the stub list. The removed
569
+ * verdicts ("Match: NO — THE SPLIT IS PROBABLY INVERTED", "0 identifiers need a
570
+ * stub") were each found wrong on real fleet documents, and a wrong verdict here
571
+ * is acted on: the operator swaps the drafts, or skips a stub.
572
+ */
573
+ export function printSafetyChecks(dates, orphans) {
574
+ console.log(chalk.bold(' Safety checks (advisory — the tool decides nothing):'));
575
+ console.log();
576
+ // ── Check 1: ordering — evidence, no direction ───────────────────────────
577
+ console.log(chalk.bold(' 1. Ordering — YOU must determine this; the tool cannot.'));
578
+ const popLabel = dates.population === 'section-anchor'
579
+ ? 'structural entry-anchor dates (heading / bullet / table cell whose first content is a date)'
580
+ : 'every first-per-line date (too few structural anchor dates to use)';
581
+ if (dates.dates.length === 0) {
582
+ console.log(chalk.yellow(' No dates found in this document at all.'));
583
+ console.log(chalk.yellow(' Check the ordering by hand before committing.'));
584
+ }
585
+ else {
586
+ console.log(` Dates read: ${dates.dates.length} — ${popLabel}`);
587
+ console.log(` Dates in the KEPT HEAD draft: ${describeRange(dates.head)}`);
588
+ console.log(` Dates in the ARCHIVE draft: ${describeRange(dates.archive)}`);
589
+ console.log(` First date in the file: ${dates.firstDate} Last date in the file: ${dates.lastDate}`);
590
+ if (dates.dates.length < MIN_ANCHOR_DATES) {
591
+ console.log(chalk.yellow(` Only ${dates.dates.length} date(s) — too few to characterise either draft.\n` +
592
+ ` Check the ordering by hand before committing.`));
593
+ }
594
+ // Never let the anchor filter drop dates silently: a clean-looking pair of
595
+ // ranges computed from a filtered sample reads exactly like a clean
596
+ // document, and the operator cannot tell which they are looking at.
597
+ const dropped = dates.allDateCount - dates.dates.length;
598
+ if (dropped > 0) {
599
+ console.log();
600
+ console.log(chalk.yellow(` Note: ${dropped} further date(s) on non-anchor lines were not counted above.`));
601
+ console.log(` Counting EVERY date instead:`);
602
+ console.log(` KEPT HEAD draft: ${describeRange(dates.allHead)}`);
603
+ console.log(` ARCHIVE draft: ${describeRange(dates.allArchive)}`);
604
+ if (dates.readingsConflict) {
605
+ console.log(chalk.red.bold(` These two readings DISAGREE about which draft holds the older entries.`));
606
+ console.log(chalk.red(` That disagreement is the finding: this document carries dates at two\n` +
607
+ ` levels that mean two different things (entry dates and, for example,\n` +
608
+ ` status-refresh or first-observed dates). Neither reading is\n` +
609
+ ` authoritative and this tool is not choosing between them — open both\n` +
610
+ ` drafts and read the entries.`));
611
+ }
612
+ }
613
+ }
614
+ console.log();
615
+ console.log(chalk.yellow(` This tool splits by POSITION and treats the BOTTOM portion as older.\n` +
616
+ ` If the archive draft's dates are NOT older than the head's, the split is\n` +
617
+ ` inverted for this document and committing it would archive your newest\n` +
618
+ ` entries. Ordering is per-document — do not carry over an answer from a\n` +
619
+ ` document you rotated before.`));
620
+ console.log();
621
+ // ── Check 2: orphaned identifiers ────────────────────────────────────────
622
+ console.log(chalk.bold(' 2. Orphaned identifiers (archive-only — unfindable from the live head)'));
623
+ console.log(` Identifiers in archive portion: ${orphans.archiveIdentifiers.length}`);
624
+ console.log(` Also referenced in the kept head: ${orphans.retained.length}`);
625
+ const orphanColor = orphans.orphaned.length > 0 ? chalk.red.bold : chalk.green.bold;
626
+ console.log(orphanColor(` ORPHANED: ${orphans.orphaned.length}`));
627
+ if (orphans.orphaned.length > 0) {
628
+ listIds(orphans.orphaned.map(stripControlChars), ' ');
629
+ console.log(chalk.dim(' Each of these loses its last reference in the live document.'));
630
+ }
631
+ if (orphans.unrecognised.length > 0) {
632
+ console.log(chalk.yellow(` Unrecognised identifier-shaped tokens — verify by hand: ${orphans.unrecognised.length}`));
633
+ listIds(orphans.unrecognised.map(stripControlChars), ' ');
634
+ console.log(chalk.dim(' These match an identifier SHAPE this tool does not track, so they were\n' +
635
+ ' not diffed across the split. A whole family going untracked is how twelve\n' +
636
+ ' open entries once moved to an archive with the orphan count reading zero.'));
637
+ }
638
+ console.log();
639
+ // ── Check 3: index stubs — one per orphan, no exceptions ─────────────────
640
+ console.log(chalk.bold(' 3. Index stubs'));
641
+ console.log(chalk.bold(` ${orphans.orphaned.length} identifier(s) would become unfindable — each needs an index stub in the head draft.`));
642
+ console.log();
643
+ }
644
+ /** "earliest 2026-07-30, latest 2026-08-05 (8 dates)", or "none". */
645
+ function describeRange(r) {
646
+ if (r.count === 0)
647
+ return 'none';
648
+ return `earliest ${r.earliest}, latest ${r.latest} (${r.count} date${r.count === 1 ? '' : 's'})`;
649
+ }
262
650
  //# sourceMappingURL=memory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/commands/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,mBAAmB,GAEpB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAExD,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAmBD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;IAE7B,8EAA8E;IAC9E,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClB,GAAG,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC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AAC,KAAK,CAAC,GAAG,CACnB,iFAAiF;YACjF,oFAAoF;YACpF,kFAAkF,CACnF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC;IAEd,4EAA4E;IAC5E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CACpB,UAAU,OAAO,CAAC,QAAQ,CAAC,MAAM,sFAAsF,CACxH,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC;AAED,qEAAqE;AACrE,SAAS,aAAa,CAAC,CAAY;IACjC,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IACjC,OAAO,YAAY,CAAC,CAAC,QAAQ,YAAY,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AACnG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuCpC,QAAA,MAAM,OAAO,SAAgB,CAAC;AA+4B9B,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuCpC,QAAA,MAAM,OAAO,SAAgB,CAAC;AAg5B9B,OAAO,EAAE,OAAO,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -690,8 +690,9 @@ memoryCmd
690
690
  .command('archive-prep')
691
691
  .description('Prepare drafts to split an over-large named memory before it hits the 50k cap (fetch-and-prepare only; never writes to MemNexus)')
692
692
  .requiredOption('--name <named-memory>', 'The named memory to archive-prep')
693
+ .option('--force', 'Overwrite existing draft files (they may carry hand-added index stubs)')
693
694
  .action((opts) => {
694
- runArchivePrep({ name: opts.name }).catch((err) => {
695
+ runArchivePrep({ name: opts.name, force: opts.force }).catch((err) => {
695
696
  console.error(err instanceof Error ? err.message : String(err));
696
697
  process.exit(1);
697
698
  });