counterparts 0.3.23 → 0.3.24
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 +67 -0
- package/package.json +1 -1
- package/src/adapters/claude-code/hooks.ts +8 -1
- package/src/adapters/cli/CONTRACT.md +4 -1
- package/src/adapters/cli/NOTES.md +8 -0
- package/src/adapters/cli/commands-readings.ts +11 -2
- package/src/adapters/cli/help.ts +3 -0
- package/src/adapters/cli/mechanisms.ts +9 -2
- package/src/adapters/cli/uninstall.ts +66 -5
- package/src/adapters/cli/wire.ts +205 -17
- package/src/adapters/dashboard/registries.ts +4 -0
- package/src/adapters/dashboard/web/flow.ts +2 -0
- package/src/adapters/dashboard/web/lanes.ts +1 -0
- package/src/adapters/dashboard/web/mechanisms/emotional/index.js +8 -5
- package/src/adapters/dashboard/web/narrate.ts +72 -13
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +2 -2
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +39 -5
- package/src/adapters/dashboard/web/views/mechanisms.ts +6 -1
- package/src/adapters/dashboard/web/views/memories.ts +14 -5
- package/src/adapters/dashboard/web/views/memory-words.ts +8 -3
- package/src/adapters/dashboard/web/views/memory.ts +12 -5
- package/src/adapters/fired.ts +9 -0
- package/src/adapters/host-wiring.ts +19 -4
- package/src/adapters/mcp/CONTRACT.md +7 -3
- package/src/adapters/mcp/facts.ts +2 -2
- package/src/adapters/mcp/server-args.ts +13 -1
- package/src/adapters/mcp/server-session-end.ts +69 -6
- package/src/adapters/mcp/server-words.ts +20 -2
- package/src/adapters/mcp/server.ts +70 -4
- package/src/adapters/mcp/tools.ts +39 -4
- package/src/adapters/mechanism-evidence.ts +136 -8
- package/src/adapters/runtime.ts +5 -3
- package/src/adapters/sidebar-status.ts +22 -4
- package/src/core/counterpart-deposit.ts +134 -3
- package/src/core/counterpart-events.ts +15 -0
- package/src/core/counterpart-types.ts +24 -0
- package/src/core/counterpart.ts +131 -1
- package/src/core/physics/CONTRACT.md +33 -5
- package/src/core/physics/NOTES.md +49 -0
- package/src/core/physics/index.ts +93 -19
- package/src/core/prospective/NOTES.md +19 -0
- package/src/core/recall/CONTRACT.md +12 -1
- package/src/core/recall/NOTES.md +29 -0
- package/src/core/recall/index.ts +21 -3
- package/src/core/recall/probe.ts +284 -0
- package/src/core/recall/rated.ts +196 -0
- package/src/core/remember/NOTES.md +10 -0
- package/src/core/sleep/CONTRACT.md +2 -1
- package/src/core/sleep/decay.ts +54 -3
- package/src/core/sleep/index.ts +1 -1
- package/src/core/sleep/prune.ts +6 -0
- package/src/core/sleep/upgrade.ts +3 -2
- package/src/core/store/operational.ts +27 -7
- package/src/core/types.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,72 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.24 — 2026-10-14
|
|
4
|
+
|
|
5
|
+
Forgetting now waits: a memory is put away only after 14 lived days under the floor, not 14 days after it was last used, and a release that changes how strength is read starts that wait fresh for everything it lowered. So nothing is archived for the first 14 lived days after you upgrade to this release; archived memories keep their words and stay readable by id. Old claims the claims era lowers now read at today's default all the way down. At the end-of-session ask Claude now also rates the memories it was shown, 0 to 3; the ratings are only recorded and change nothing yet. The `salience` field tells Claude to leave routine work at the default, a faded match is labelled "faded: weak, below reach", closing a reminder closes every memory it moved through, a revision with no title keeps the old one's, and `recall` takes `query` as another name for `question`. With both the plugin and the npm install, uninstalling the plugin and keeping the memories leaves the npm install's memory server and hooks working. The sidebar counts feelings under Emotion. If `/plugin update counterparts@counterparts` does nothing, run `/plugin marketplace update counterparts`, then `/plugin uninstall counterparts@counterparts` and `/plugin install counterparts@counterparts`. These are Claude Code's own plugin commands, not `/counterparts:uninstall`, and your memories in `~/.counterparts` are untouched. No store-format change (store v13, cache v6) and no wiring change: nothing to run after upgrading from 0.3.23, and `counterparts connect` is not needed. Going back to 0.3.23 gives up the wait: it counts 14 days from last use again.
|
|
6
|
+
|
|
7
|
+
- **A memory leaves only after 14 lived days under the floor.** The floor prune used to count
|
|
8
|
+
its 14 days from a memory's last use, so a memory unused for weeks was archived the first
|
|
9
|
+
night it faded under the floor. Now it waits 14 lived days under the floor first, and a
|
|
10
|
+
build that changes how strength is read never archives anything the night it arrives: the
|
|
11
|
+
wait for everything it lowered starts that night, so a store archives nothing for its
|
|
12
|
+
first 14 lived days on this release, whichever release it upgraded from. Archived memories
|
|
13
|
+
still keep their words and stay readable by id.
|
|
14
|
+
- **Old claims now read at today's default all the way down.** A memory written before the
|
|
15
|
+
claims era whose claim the era lowers now reads at that default as a whole, instead of being
|
|
16
|
+
held up by the relevance and predictive scores written alongside the old claim; a quarter
|
|
17
|
+
of the lowered memories were not lowered at all before. Memories the era raises, and the
|
|
18
|
+
ones it leaves alone (the core, the owner's own, protected, a pending or repeating date),
|
|
19
|
+
read as before. No store-format change.
|
|
20
|
+
- **Claude now scores the memories it was shown.** At the end-of-session ask, Claude rates
|
|
21
|
+
each footnote it was shown since it last wrote, and every memory it says it drew on, from
|
|
22
|
+
0 (noise) to 3 (changed what it did or said). The scores are only recorded: they change
|
|
23
|
+
nothing about any memory yet. `counterparts probe-oq4` prints them by day and by kind of
|
|
24
|
+
showing, beside what the replies actually used.
|
|
25
|
+
- **Routine work is left at the default salience.** The `salience` field on `remember` and
|
|
26
|
+
`session_end` now tells Claude to leave it unset for a routine work event or an ordinary
|
|
27
|
+
work fact unless it changed something, and to claim 0.4 or more only for what struck it
|
|
28
|
+
or changed how it will work, so weak work memories fade on their own. The owner's
|
|
29
|
+
rulings and corrections still stay high.
|
|
30
|
+
- **A faded match is labelled "faded: weak, below reach".** Asking for facts used to label
|
|
31
|
+
it "not used for a long while", which was false for a memory two days old that simply
|
|
32
|
+
started weak. The dashboard's search says the same. Ranking is unchanged.
|
|
33
|
+
- **Closing a reminder closes all of it.** When a memory says a dated thing is done (its
|
|
34
|
+
date dropped, or `status: done`), every earlier or later memory the same reminder moved
|
|
35
|
+
through loses its date too, so one "done" stops it coming back. Other memories nearby
|
|
36
|
+
that still hold a date are listed in the reply, by id and title, so Claude can close
|
|
37
|
+
them in the same step if they are the same thing; they are never closed for it.
|
|
38
|
+
- **A revision keeps its title.** A memory that revises another (`updates`) and has no title
|
|
39
|
+
of its own now takes the old one's, as it already took what it was about, who said it,
|
|
40
|
+
its status and its date. When it closes something (a dated thing done, or any
|
|
41
|
+
`status: done`), the old title would read as still open, so none is carried and the
|
|
42
|
+
reply asks for a title. A confidential memory's title is never carried.
|
|
43
|
+
- **`recall` takes `query` as another name for `question`.** A recall sent with `query`
|
|
44
|
+
used to be refused for having no question; it is now answered as one. A mode is still
|
|
45
|
+
required.
|
|
46
|
+
- **Uninstalling the plugin no longer takes the npm install's memory server with it.** With
|
|
47
|
+
both installed, the plugin's uninstall (keeping the memories) ran `claude mcp remove
|
|
48
|
+
counterparts -s user`, which removed the server the npm install registered. The plugin
|
|
49
|
+
never registers one there, so it now leaves it alone and says so; `counterparts
|
|
50
|
+
uninstall` still removes its own.
|
|
51
|
+
- **Uninstalling the plugin leaves a working npm install's hooks alone too, and cleans up
|
|
52
|
+
after one that is gone.** With both installed, the plugin's uninstall (keeping the
|
|
53
|
+
memories) took the npm install's wake and recall hooks out of `~/.claude/settings.json`.
|
|
54
|
+
It now removes a Counterparts hook or memory server only when the program it runs is no
|
|
55
|
+
longer there, which is what an npm install removed without `counterparts uninstall`
|
|
56
|
+
leaves behind. Run at a terminal, the plugin's uninstall now asks whether to delete the
|
|
57
|
+
memories before it removes anything of the npm install's, so answering no leaves that
|
|
58
|
+
install working. A hook line written as `~/…counterparts-hook`
|
|
59
|
+
or `$HOME/…` now reads as live, here and in doctor and the plugin's stand-down, as the
|
|
60
|
+
shell that runs it would read it.
|
|
61
|
+
- **The sidebar counts feelings under Emotion.** "Mechanisms today" showed Emotion at 0
|
|
62
|
+
every day, because its only proof was a mood match, and mood matching is off. It now
|
|
63
|
+
counts a memory saved with a feeling and a memory carrying a feeling that came to mind,
|
|
64
|
+
and opening Emotion lists those memories with their feeling words. The dashboard's
|
|
65
|
+
Emotion light reads the same proofs. `sidebar.json` gains a `felt` detail on those rows
|
|
66
|
+
(its version stays 1).
|
|
67
|
+
- The sidebar's footer says "Dash · /counterparts:dashboard", which fits the docked pane
|
|
68
|
+
on one line.
|
|
69
|
+
|
|
3
70
|
## 0.3.23 — 2026-10-14
|
|
4
71
|
|
|
5
72
|
The plugin's sidebar now shows your memory and does nothing else: it has no buttons and no links, runs no command, calls no tool and makes no network request. Its footer says how to do the rest yourself (`/counterparts:meet`, `/counterparts:dashboard`, say "pause memory here", `/counterparts quiet`). What it shows comes from a small file Counterparts writes for it, `~/.counterparts/sidebar.json`, only while the plugin is installed, so the dashboard no longer has to be running for the sidebar to show anything. The sidebar's brain is gone and the fox stays. The plugin directory's build of the plugin no longer reads Claude Code's user configuration file and leaves out the dashboard's 3D brain; beside an npm install it does not stand down, so keep one or the other. No store-format change (store v13, cache v6) and no wiring change: nothing to run after upgrading from 0.3.22, and `counterparts connect` is not needed.
|
package/package.json
CHANGED
|
@@ -511,10 +511,17 @@ export const PAGE_WRITER_TOOL = "counterparts self_page";
|
|
|
511
511
|
* capture (`ritual`, CONTRACT §5 G11) whichever emission shape carried it —
|
|
512
512
|
* today's `additionalContext`, or the stderr and `reason` shapes older
|
|
513
513
|
* transcripts hold.
|
|
514
|
+
*
|
|
515
|
+
* RATINGS (2026-10-14; Mike's call, tracking only): one clause asks the
|
|
516
|
+
* session to score the footnotes shown since it last wrote, and every `drewOn`
|
|
517
|
+
* id — `session_end`'s `rated` field says the anchors and the rest. The ids
|
|
518
|
+
* are not listed here: every Stop's injection is noise someone pays for.
|
|
514
519
|
*/
|
|
520
|
+
export const RATE_CLAUSE = "`rated` 0–3 each footnote shown since you last wrote, and each `drewOn` id";
|
|
521
|
+
|
|
515
522
|
export function stopAsk(sessionId: string, chapter: number): string {
|
|
516
523
|
return [
|
|
517
|
-
`${STOP_ASK_OPENER} 1) hand back what caught your attention since you last wrote, one idea each — what you read, what they said, what happened — with the counterparts session_end tool, session: ${sessionId}. \`handoff\` only if work here is unfinished; \`retireHandoff\` any now done; \`updates\` anything dated or open now done. ${PRONOUN_RULE}`,
|
|
524
|
+
`${STOP_ASK_OPENER} 1) hand back what caught your attention since you last wrote, one idea each — what you read, what they said, what happened — with the counterparts session_end tool, session: ${sessionId}. \`handoff\` only if work here is unfinished; \`retireHandoff\` any now done; \`updates\` anything dated or open now done; ${RATE_CLAUSE}. ${PRONOUN_RULE}`,
|
|
518
525
|
`2) Write chapter ${String(chapter)} with the counterparts chapter tool, session: ${sessionId}.`,
|
|
519
526
|
].join("\n");
|
|
520
527
|
}
|
|
@@ -351,7 +351,10 @@ The standalone verb does not ask either: typing it is the yes.*
|
|
|
351
351
|
through `claude mcp add` / `claude mcp remove` as an argument vector, never a shell
|
|
352
352
|
string. That file is READ to decide whether to call them, and a read that sees nothing
|
|
353
353
|
does not stop the removal being attempted — the host owns that file and may move it,
|
|
354
|
-
so our read is evidence, not authority
|
|
354
|
+
so our read is evidence, not authority (except on the plugin's uninstall that keeps
|
|
355
|
+
the memory, which removes a hook or the registration only when what it runs is gone:
|
|
356
|
+
a blind removal there could take a running npm install's server, 2026-10-14).
|
|
357
|
+
`claude` missing is a printed line and exit 0,
|
|
355
358
|
never a failed install. *`unwire` is also the one of the three that runs with NO
|
|
356
359
|
configuration at all: it needs nothing out of the file, and the person most likely to
|
|
357
360
|
be running it is somebody who deleted `~/.counterparts` by hand and now has five hooks
|
|
@@ -1207,6 +1207,14 @@ disk and can hold anything a shell would interpret). One consequence found by th
|
|
|
1207
1207
|
loop: `unwire` must attempt `claude mcp remove` **even when our read saw no
|
|
1208
1208
|
registration**, because that file may move and our read is evidence rather than authority.
|
|
1209
1209
|
"Tolerate not found" is cheaper than a server left pointed at a store nobody is wiring.
|
|
1210
|
+
The plugin's uninstall on the arms that keep the memory is the exception (`onlyDead`,
|
|
1211
|
+
2026-10-14): it removes a hook or the registration only when what it runs is gone, so it
|
|
1212
|
+
runs `claude mcp remove` only for a registration read as dead — or, in the directory flavor
|
|
1213
|
+
that never reads the file, when no npm install's `counterparts` is on PATH and no hook of ours there still runs. A blind removal
|
|
1214
|
+
there could take a running npm install's server, which the plugin never registered. A hook or
|
|
1215
|
+
registration that runs the plugin's own files (its root, its data directory, Claude Code's
|
|
1216
|
+
plugins directory: the plugin's console can run `connect`) counts as gone on that route,
|
|
1217
|
+
since it is dead once the plugin is (review of #491).
|
|
1210
1218
|
|
|
1211
1219
|
**`--delete-memories` counts before it warns, and the fallback matters more than the
|
|
1212
1220
|
count.** A store that will not open on this build — the old-floor `STORE_PRE_ROWS` case,
|
|
@@ -3,8 +3,8 @@ import { existsSync, statSync } from "node:fs";
|
|
|
3
3
|
import { isDay, localDate, localTime, resolveZone, todayIn } from "../../core/time.js";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { delimiter, join } from "node:path";
|
|
6
|
-
import { BOUNDARY_EVENT, RECALL_CREDIT_EVENT, RECALL_DECISION_EVENT } from "../../core/counterpart.js";
|
|
7
|
-
import { PROBE_ROW_CEILING, probeOQ4, renderProbe } from "../../core/recall/probe.js";
|
|
6
|
+
import { BOUNDARY_EVENT, MCP_RECALL_EVENT, RECALL_CREDIT_EVENT, RECALL_DECISION_EVENT, RECALL_RATED_EVENT } from "../../core/counterpart.js";
|
|
7
|
+
import { PROBE_ROW_CEILING, probeOQ4, probeRatings, renderProbe, renderRatings } from "../../core/recall/probe.js";
|
|
8
8
|
// `band` is imported rather than mirrored: the dashboard computes the live
|
|
9
9
|
// band with this exact function, and two implementations of "which band is this
|
|
10
10
|
// row in today" is how the two surfaces disagreed in the first place.
|
|
@@ -117,9 +117,18 @@ export function probeCommand(dir: string, io: Io, namedDir: boolean): number {
|
|
|
117
117
|
const credits = store.eventLog({ name: RECALL_CREDIT_EVENT, order: "desc", limit: PROBE_ROW_CEILING }).reverse();
|
|
118
118
|
const rows = [...decisions, ...credits].map((r) => ({ name: r.name, day: r.day, payload: r.payload }));
|
|
119
119
|
for (const line of renderProbe(probeOQ4(rows))) io.out(line);
|
|
120
|
+
// THE RATINGS (2026-10-14; Mike's call, tracking only): what sessions
|
|
121
|
+
// scored of what they were shown, beside the hit rate above.
|
|
122
|
+
const ratings = store.eventLog({ name: RECALL_RATED_EVENT, order: "desc", limit: PROBE_ROW_CEILING }).reverse();
|
|
123
|
+
const lookups = store.eventLog({ name: MCP_RECALL_EVENT, order: "desc", limit: PROBE_ROW_CEILING }).reverse();
|
|
124
|
+
io.out("");
|
|
125
|
+
const rated = [...rows, ...[...ratings, ...lookups].map((r) => ({ name: r.name, day: r.day, payload: r.payload }))];
|
|
126
|
+
for (const line of renderRatings(probeRatings(rated))) io.out(line);
|
|
120
127
|
for (const [name, got] of [
|
|
121
128
|
[RECALL_DECISION_EVENT, decisions.length],
|
|
122
129
|
[RECALL_CREDIT_EVENT, credits.length],
|
|
130
|
+
[RECALL_RATED_EVENT, ratings.length],
|
|
131
|
+
[MCP_RECALL_EVENT, lookups.length],
|
|
123
132
|
] as const) {
|
|
124
133
|
if (got >= PROBE_ROW_CEILING) {
|
|
125
134
|
io.err(`warning: ${name} hit the ${PROBE_ROW_CEILING}-row ceiling; the oldest rows are missing from this table`);
|
package/src/adapters/cli/help.ts
CHANGED
|
@@ -377,6 +377,9 @@ export const COMMAND_DETAIL: Record<string, readonly string[]> = {
|
|
|
377
377
|
"probe-oq4": [
|
|
378
378
|
"recall CONTRACT §7. The footnote header is the one string the probe varies",
|
|
379
379
|
"(recall/render.ts).",
|
|
380
|
+
"",
|
|
381
|
+
"Then the ratings: what sessions scored, 0 to 3, of what they were shown, by",
|
|
382
|
+
"date and lane, beside drewOn and the hit rate. Tracking only.",
|
|
380
383
|
],
|
|
381
384
|
mechanisms: [
|
|
382
385
|
"One line per memory mechanism: ● working this week, ◐ built but not firing,",
|
|
@@ -120,16 +120,23 @@ export const MEMORY_MECHANISMS: readonly MemoryMechanism[] = [
|
|
|
120
120
|
id: "emotional",
|
|
121
121
|
evidence: ["feelings", "emotion-weight", "mood-match"],
|
|
122
122
|
// Emotion part A (2026-09-26): a memory's strongest feeling lifts it and
|
|
123
|
-
// slows its fading
|
|
123
|
+
// slows its fading. Since 2026-10-14 it fires when a memory is saved with
|
|
124
|
+
// a feeling or one carrying a feeling comes to mind; the mood match (off
|
|
125
|
+
// by decision since 2026-10-10) is said only when it counted.
|
|
124
126
|
read: (v, rows) => {
|
|
125
127
|
const weighted = rows("emotion-weight")?.total ?? 0;
|
|
126
128
|
const withFeelings = rows("feelings")?.total ?? 0;
|
|
129
|
+
const felt = part(v, "felt");
|
|
130
|
+
const feltRecalled = part(v, "feltRecalled");
|
|
127
131
|
const newWeighted = part(v, "weighted");
|
|
128
132
|
const matched = part(v, "moodMatched");
|
|
129
133
|
const held = `${plural(weighted, "memory", "memories")} held higher and fading slower (${String(withFeelings)} with recorded feelings)`;
|
|
130
134
|
if (v.fired) {
|
|
131
135
|
const parts: string[] = [];
|
|
132
|
-
|
|
136
|
+
// Saved with a feeling and new memories carrying one overlap: the first is said when it counted.
|
|
137
|
+
if (felt > 0) parts.push(`${plural(felt, "memory", "memories")} saved with a feeling`);
|
|
138
|
+
else if (newWeighted > 0) parts.push(`${plural(newWeighted, "new memory", "new memories")} carrying feeling`);
|
|
139
|
+
if (feltRecalled > 0) parts.push(`${plural(feltRecalled, "turn", "turns")} brought one carrying a feeling to mind`);
|
|
133
140
|
if (matched > 0) parts.push(`${plural(matched, "memory", "memories")} a matching mood brought closer`);
|
|
134
141
|
return { light: LIGHT.working, says: `${parts.join("; ")}; ${held}` };
|
|
135
142
|
}
|
|
@@ -113,7 +113,7 @@ import { readHolders } from "./rollback.js";
|
|
|
113
113
|
import type { Holder } from "./rollback.js";
|
|
114
114
|
import { confirm, typed, ui } from "./ui.js";
|
|
115
115
|
import type { Ui } from "./ui.js";
|
|
116
|
-
import type { Outcome, ProcessLister, Spawner, WireInput } from "./wire.js";
|
|
116
|
+
import type { Outcome, ProcessLister, Spawner, WireInput, WireResult } from "./wire.js";
|
|
117
117
|
import { look, readMcp, tilde, unwire } from "./wire.js";
|
|
118
118
|
|
|
119
119
|
/** The phrase `--delete-memories` asks for, exactly. Case-sensitive, and
|
|
@@ -1152,13 +1152,18 @@ export interface UninstallInput {
|
|
|
1152
1152
|
readonly exe: string;
|
|
1153
1153
|
readonly spawner: Spawner;
|
|
1154
1154
|
readonly lister: ProcessLister;
|
|
1155
|
+
/** Whether the unwire may read `~/.claude.json` (`WireInput.readsUserConfig`):
|
|
1156
|
+
* `runtime.ts#readsHostUserConfig` by default; a test's seam. */
|
|
1157
|
+
readonly readsUserConfig?: boolean;
|
|
1155
1158
|
/** Filled in as the command goes, for `--json`'s result. */
|
|
1156
1159
|
readonly record?: UninstallRecord;
|
|
1157
1160
|
}
|
|
1158
1161
|
|
|
1159
1162
|
/** What happened, for the one JSON line `uninstallJson` prints. */
|
|
1160
1163
|
export interface UninstallRecord {
|
|
1161
|
-
/** True once the hooks and the registration are out
|
|
1164
|
+
/** True once the hooks and the registration are out — on the plugin's
|
|
1165
|
+
* keep arm, the ones whose program is gone (a live one is the npm
|
|
1166
|
+
* install's, and stays). */
|
|
1162
1167
|
unwired: boolean;
|
|
1163
1168
|
}
|
|
1164
1169
|
|
|
@@ -1167,6 +1172,8 @@ export async function uninstall(input: UninstallInput): Promise<Outcome> {
|
|
|
1167
1172
|
const u = ui(io, env);
|
|
1168
1173
|
const configDir = resolve(join(input.configPath, ".."));
|
|
1169
1174
|
const moving = input.park || input.deleteMemories;
|
|
1175
|
+
// The plugin's route, on an arm that keeps the memory (or asks first).
|
|
1176
|
+
const viaPlugin = installRoute(env) === "plugin" && !moving;
|
|
1170
1177
|
const verb = input.park ? "park" : "delete";
|
|
1171
1178
|
|
|
1172
1179
|
// THE COMMAND THAT IS RUNNING, flag and all: three arms of this command do
|
|
@@ -1363,6 +1370,17 @@ export async function uninstall(input: UninstallInput): Promise<Outcome> {
|
|
|
1363
1370
|
spawner: input.spawner,
|
|
1364
1371
|
lister: input.lister,
|
|
1365
1372
|
heading: true,
|
|
1373
|
+
...(input.readsUserConfig === undefined ? {} : { readsUserConfig: input.readsUserConfig }),
|
|
1374
|
+
// THE PLUGIN REMOVES A HOOK OR THE REGISTRATION ONLY WHEN WHAT IT RUNS IS
|
|
1375
|
+
// GONE (owner, 2026-10-14). It writes neither — its hooks are hooks.json's
|
|
1376
|
+
// and its server plugin.json's — so a live one in `settings.json` or
|
|
1377
|
+
// `-s user` is a running npm install's, and removing it took the memory
|
|
1378
|
+
// from somebody who uninstalled only the plugin; a dead one is what an
|
|
1379
|
+
// `npm rm` without `counterparts uninstall` left, and goes. An arm that
|
|
1380
|
+
// moves the store still takes everything: the store they open is going,
|
|
1381
|
+
// and M2 wants the registration confirmed gone. The plain arm's offer
|
|
1382
|
+
// takes the rest only after a yes (`offerDelete`).
|
|
1383
|
+
onlyDead: viaPlugin,
|
|
1366
1384
|
};
|
|
1367
1385
|
u.blank();
|
|
1368
1386
|
const removed = await unwire(wireInput);
|
|
@@ -1405,7 +1423,7 @@ export async function uninstall(input: UninstallInput): Promise<Outcome> {
|
|
|
1405
1423
|
? `${memories(kept.memories)} ${kept.memories === 1 ? "is" : "are"} still at ${where}.`
|
|
1406
1424
|
: `everything is still at ${tilde(configDir, home)} (${humanBytes(kept.bytes)}).`,
|
|
1407
1425
|
);
|
|
1408
|
-
if (offers(input)) return offerDelete(input, u, removed
|
|
1426
|
+
if (offers(input)) return offerDelete(input, u, removed, viaPlugin ? wireInput : null);
|
|
1409
1427
|
keptHints(input, u);
|
|
1410
1428
|
return "ok";
|
|
1411
1429
|
}
|
|
@@ -1482,7 +1500,16 @@ async function phraseGate(input: UninstallInput, u: Ui, plan: UninstallPlan): Pr
|
|
|
1482
1500
|
* be put. Everything is looked at AGAIN after the phrase — somebody may have
|
|
1483
1501
|
* opened a session while reading — and anything changed is a refusal.
|
|
1484
1502
|
*/
|
|
1485
|
-
async function offerDelete(
|
|
1503
|
+
async function offerDelete(
|
|
1504
|
+
input: UninstallInput,
|
|
1505
|
+
u: Ui,
|
|
1506
|
+
/** What the first unwire did. */
|
|
1507
|
+
removed: WireResult,
|
|
1508
|
+
/** The plugin's route: what the first unwire left (live hooks, the npm
|
|
1509
|
+
* install's registration) comes out only after the yes and the phrase,
|
|
1510
|
+
* with this input, and the delete waits on it (M2). */
|
|
1511
|
+
deferred: WireInput | null,
|
|
1512
|
+
): Promise<Outcome> {
|
|
1486
1513
|
const { io, home, env } = input;
|
|
1487
1514
|
const withheld = (why: readonly string[]): Outcome => {
|
|
1488
1515
|
u.blank();
|
|
@@ -1492,12 +1519,25 @@ async function offerDelete(input: UninstallInput, u: Ui, mcpConfirmed: boolean):
|
|
|
1492
1519
|
keptHints(input, u);
|
|
1493
1520
|
return "ok";
|
|
1494
1521
|
};
|
|
1495
|
-
|
|
1522
|
+
// LEFT FOR LATER (the plugin's route) or ATTEMPTED NOW. One that was
|
|
1523
|
+
// attempted and is not confirmed gone is withheld, as on the npm route. One
|
|
1524
|
+
// that was left comes out after the yes, and that needs `claude` unless a
|
|
1525
|
+
// read showed none: without it the yes is bound to be refused, so the
|
|
1526
|
+
// question is not put.
|
|
1527
|
+
const left = deferred !== null && removed.mcp === "skipped";
|
|
1528
|
+
if (!left && !removed.mcpConfirmed) {
|
|
1496
1529
|
return withheld([
|
|
1497
1530
|
"the memory server is still registered (above), and a server pointed at a store that is " +
|
|
1498
1531
|
"gone fails at every session start. Remove it, then run uninstall again.",
|
|
1499
1532
|
]);
|
|
1500
1533
|
}
|
|
1534
|
+
if (left && removed.mcpLeft !== "absent" && input.spawner(["--version"]).missing) {
|
|
1535
|
+
return withheld([
|
|
1536
|
+
"`claude` is not on this PATH, so the memory server registered in Claude Code (the npm " +
|
|
1537
|
+
"install's) could not be removed first, and a server pointed at a store that is gone " +
|
|
1538
|
+
"fails at every session start. Run uninstall again where `claude` is on PATH.",
|
|
1539
|
+
]);
|
|
1540
|
+
}
|
|
1501
1541
|
const planInput: PlanInput = { configPath: input.configPath, config: input.config, home, verb: "delete", env };
|
|
1502
1542
|
let plan = planUninstall(planInput);
|
|
1503
1543
|
if (plan.refusal !== null) return withheld([plan.refusal]);
|
|
@@ -1538,6 +1578,27 @@ async function offerDelete(input: UninstallInput, u: Ui, mcpConfirmed: boolean):
|
|
|
1538
1578
|
io.err("Nothing was deleted. Run uninstall again to see the plan as it stands now.");
|
|
1539
1579
|
return "refused";
|
|
1540
1580
|
}
|
|
1581
|
+
// THE PLUGIN'S ROUTE TAKES THE REST NOW, AND ONLY NOW: a no above left the
|
|
1582
|
+
// npm install's hooks and registration where they were. The store they open
|
|
1583
|
+
// is going, so they go, and the registration is confirmed gone first (M2).
|
|
1584
|
+
if (deferred !== null) {
|
|
1585
|
+
u.blank();
|
|
1586
|
+
const rest = await unwire({ ...deferred, onlyDead: false, heading: false });
|
|
1587
|
+
if (rest.outcome !== "ok" || !rest.mcpConfirmed) {
|
|
1588
|
+
io.err("");
|
|
1589
|
+
io.err(
|
|
1590
|
+
rest.outcome !== "ok"
|
|
1591
|
+
? "The wiring could not be removed, so NOTHING WAS DELETED. Fix the above and run this again."
|
|
1592
|
+
: "refused: the MCP registration is still there and this could not remove it, so NOTHING " +
|
|
1593
|
+
"WAS DELETED. A server pointed at a store that is gone fails at every session start " +
|
|
1594
|
+
"with nothing on screen. Run the line above, then run this again.",
|
|
1595
|
+
);
|
|
1596
|
+
if (rest.outcome === "ok" && rest.hooks === "removed") {
|
|
1597
|
+
io.err(`The npm install's hooks are out too; its \`${BIN.cli} connect\` puts them back.`);
|
|
1598
|
+
}
|
|
1599
|
+
return rest.outcome !== "ok" ? rest.outcome : "refused";
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1541
1602
|
u.blank();
|
|
1542
1603
|
return deletePlan(input, u, { ...again, census: plan.census });
|
|
1543
1604
|
}
|