counterparts 0.3.12 → 0.3.13
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 +184 -0
- package/docs/module-map.md +1 -1
- package/package.json +1 -1
- package/src/adapters/claude-code/CONTRACT.md +36 -10
- package/src/adapters/claude-code/INTERFACE-GAPS.md +116 -16
- package/src/adapters/claude-code/NOTES.md +131 -0
- package/src/adapters/claude-code/bin/hook.ts +35 -2
- package/src/adapters/claude-code/doctor.ts +155 -21
- package/src/adapters/claude-code/hooks.ts +49 -7
- package/src/adapters/claude-code/index.ts +11 -0
- package/src/adapters/claude-code/night-run.ts +133 -12
- package/src/adapters/claude-code/transcript.ts +268 -1
- package/src/adapters/cli/CONTRACT.md +5 -0
- package/src/adapters/cli/INTERFACE-GAPS.md +8 -4
- package/src/adapters/cli/NOTES.md +111 -0
- package/src/adapters/cli/commands.ts +65 -14
- package/src/adapters/cli/dream-core.ts +57 -42
- package/src/adapters/cli/export.ts +320 -21
- package/src/adapters/cli/index.ts +1 -0
- package/src/adapters/cli/install.ts +39 -7
- package/src/adapters/cli/mechanisms.ts +7 -1
- package/src/adapters/cli/uninstall.ts +13 -5
- package/src/adapters/cli/wire.ts +189 -63
- package/src/adapters/dashboard/INTERFACE-GAPS.md +10 -1
- package/src/adapters/dashboard/NOTES.md +79 -0
- package/src/adapters/dashboard/registries.ts +10 -2
- package/src/adapters/dashboard/web/README.md +19 -14
- package/src/adapters/dashboard/web/actions.ts +23 -1
- package/src/adapters/dashboard/web/flow.ts +4 -1
- package/src/adapters/dashboard/web/lanes.ts +3 -0
- package/src/adapters/dashboard/web/narrate.ts +30 -2
- package/src/adapters/dashboard/web/pages/flow/sections/fired.js +1 -0
- package/src/adapters/dashboard/web/pages/memories/memories.css +17 -4
- package/src/adapters/dashboard/web/pages/memories/row.js +37 -21
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +279 -60
- package/src/adapters/dashboard/web/pages/memories/state.js +2 -1
- package/src/adapters/dashboard/web/server.ts +0 -5
- package/src/adapters/dashboard/web/shared/memory-marks.css +7 -0
- package/src/adapters/dashboard/web/shared/memory-marks.js +33 -0
- package/src/adapters/dashboard/web/shared/memory-modal.js +5 -3
- package/src/adapters/dashboard/web/views/health.ts +1 -1
- package/src/adapters/dashboard/web/views/search.ts +4 -45
- package/src/adapters/dashboard/web/views.ts +2 -2
- package/src/adapters/fired.ts +410 -25
- package/src/adapters/host-wiring.ts +300 -0
- package/src/adapters/lifecycle.ts +14 -0
- package/src/adapters/log/index.ts +2 -0
- package/src/adapters/mcp/CONTRACT.md +33 -3
- package/src/adapters/mcp/INTERFACE-GAPS.md +24 -2
- package/src/adapters/mcp/NOTES.md +136 -0
- package/src/adapters/mcp/bin/serve.ts +30 -0
- package/src/adapters/mcp/facts.ts +13 -1
- package/src/adapters/mcp/meaning.ts +208 -13
- package/src/adapters/mcp/server.ts +87 -15
- package/src/adapters/mcp/stdio.ts +3 -1
- package/src/adapters/mcp/stood-down.ts +51 -0
- package/src/adapters/mcp/tools.ts +27 -7
- package/src/adapters/plugin-run.sh +133 -0
- package/src/adapters/plugin.ts +329 -0
- package/src/core/associate/CONTRACT.md +2 -1
- package/src/core/associate/INTERFACE-GAPS.md +6 -1
- package/src/core/associate/NOTES.md +45 -0
- package/src/core/briefing.ts +12 -3
- package/src/core/contradictions.ts +184 -0
- package/src/core/counterpart.ts +451 -18
- package/src/core/dream/CONTRACT.md +5 -2
- package/src/core/dream/INTERFACE-GAPS.md +29 -6
- package/src/core/dream/NOTES.md +21 -0
- package/src/core/dream/index.ts +33 -1
- package/src/core/dream/reflect.ts +20 -5
- package/src/core/encode/INTERFACE-GAPS.md +3 -1
- package/src/core/fit/INTERFACE-GAPS.md +8 -2
- package/src/core/fit/NOTES.md +5 -2
- package/src/core/fit/index.ts +4 -1
- package/src/core/handoff/CONTRACT.md +37 -2
- package/src/core/handoff/INTERFACE-GAPS.md +10 -0
- package/src/core/handoff/NOTES.md +66 -0
- package/src/core/handoff/index.ts +214 -12
- package/src/core/mint.ts +8 -2
- package/src/core/physics/CONTRACT.md +11 -1
- package/src/core/physics/NOTES.md +30 -0
- package/src/core/physics/index.ts +26 -4
- package/src/core/prospective/CONTRACT.md +45 -6
- package/src/core/prospective/INTERFACE-GAPS.md +4 -0
- package/src/core/prospective/NOTES.md +138 -0
- package/src/core/prospective/derive.ts +33 -5
- package/src/core/prospective/index.ts +90 -5
- package/src/core/prospective/windows.ts +72 -1
- package/src/core/recall/CONTRACT.md +6 -2
- package/src/core/recall/INTERFACE-GAPS.md +28 -4
- package/src/core/recall/NOTES.md +57 -1
- package/src/core/recall/probe.ts +58 -0
- package/src/core/recall/session.ts +27 -3
- package/src/core/recall/time-ask.ts +116 -18
- package/src/core/remember/CONTRACT.md +4 -1
- package/src/core/remember/INTERFACE-GAPS.md +9 -1
- package/src/core/remember/proposals.ts +38 -5
- package/src/core/revision.ts +5 -0
- package/src/core/schemas/CONTRACT.md +13 -1
- package/src/core/schemas/INTERFACE-GAPS.md +20 -2
- package/src/core/schemas/NOTES.md +127 -0
- package/src/core/schemas/types.ts +2 -0
- package/src/core/self/CONTRACT.md +15 -4
- package/src/core/self/INTERFACE-GAPS.md +7 -2
- package/src/core/self/NOTES.md +49 -0
- package/src/core/self/briefing.ts +12 -2
- package/src/core/self/index.ts +82 -8
- package/src/core/self/page.ts +88 -0
- package/src/core/sleep/INTERFACE-GAPS.md +22 -3
- package/src/core/sleep/NOTES.md +11 -0
- package/src/core/sleep/prune.ts +6 -2
- package/src/core/store/NOTES.md +14 -0
- package/src/core/store/index.ts +107 -0
- package/src/core/time.ts +152 -0
- package/tools/install-loop/run.sh +48 -12
- package/src/adapters/dashboard/web/pages/memories/fold.js +0 -53
|
@@ -60,6 +60,8 @@ import type { EmbedderKind } from "../config.js";
|
|
|
60
60
|
import { CONFIG_ENV, CONFIG_FLAG, defaultConfigPath } from "../config-path.js";
|
|
61
61
|
import { parseScriptInvocation, runtimePresent, scriptArgs, shellTokens } from "../runtime.js";
|
|
62
62
|
import type { RuntimeKind } from "../runtime.js";
|
|
63
|
+
import { pluginInstall } from "../host-wiring.js";
|
|
64
|
+
import type { PluginInstallRead } from "../host-wiring.js";
|
|
63
65
|
// `preRowsMarkersIn` reads FILENAMES and opens nothing, which is the only
|
|
64
66
|
// reason a module that promises never to open a parked store may call it —
|
|
65
67
|
// the same clause `start-fresh.ts` states over its own import of it.
|
|
@@ -541,7 +543,9 @@ function modeOf(path: string): { mode?: string } {
|
|
|
541
543
|
* is ours. `~/.claude.json` in particular is the host's own state file, which
|
|
542
544
|
* its documentation describes as one the host writes for itself — so it may
|
|
543
545
|
* move, and the line must then read "I looked here and did not find it", never
|
|
544
|
-
* "you did not install it". `CLAUDE_CONFIG_DIR` relocates both, checked first
|
|
546
|
+
* "you did not install it". `CLAUDE_CONFIG_DIR` relocates both, checked first:
|
|
547
|
+
* the user settings to `$CLAUDE_CONFIG_DIR/settings.json` (`hostSettingsDir`) and
|
|
548
|
+
* the MCP file to `$CLAUDE_CONFIG_DIR/.claude.json` (`hostConfigBase`).
|
|
545
549
|
*
|
|
546
550
|
* Hooks MERGE across the host's settings files, so all four places a block can
|
|
547
551
|
* land are read and the answer is their union: finding the command in a project
|
|
@@ -573,6 +577,9 @@ export interface HostRead {
|
|
|
573
577
|
/** The runtimes our hook commands and our MCP registration name, one row
|
|
574
578
|
* per distinct executable (`adapters/runtime.ts`), and whether each is there. */
|
|
575
579
|
readonly runtimes: readonly HostRuntime[];
|
|
580
|
+
/** The Counterparts Claude Code plugin, when Claude Code records it
|
|
581
|
+
* installed (`host-wiring.ts#pluginInstall`), else null. */
|
|
582
|
+
readonly plugin: PluginInstallRead | null;
|
|
576
583
|
}
|
|
577
584
|
|
|
578
585
|
/** One runtime a host's configuration launches us with. */
|
|
@@ -620,16 +627,39 @@ export function hookTargetPath(command: string): string | null {
|
|
|
620
627
|
return null;
|
|
621
628
|
}
|
|
622
629
|
|
|
623
|
-
/**
|
|
624
|
-
|
|
630
|
+
/**
|
|
631
|
+
* The host's settings files that can carry a user's hooks, in merge order.
|
|
632
|
+
* `userDir` is the host's own directory (`hostSettingsDir`) — `~/.claude`, or
|
|
633
|
+
* `CLAUDE_CONFIG_DIR` itself when that is set — and NOT the base the MCP file
|
|
634
|
+
* hangs off: the project files are `<cwd>/.claude/…` either way.
|
|
635
|
+
*/
|
|
636
|
+
export function hostSettingsFiles(userDir: string, cwd: string): string[] {
|
|
625
637
|
return [
|
|
626
|
-
join(
|
|
627
|
-
join(
|
|
638
|
+
join(userDir, "settings.json"),
|
|
639
|
+
join(userDir, "settings.local.json"),
|
|
628
640
|
join(cwd, ".claude", "settings.json"),
|
|
629
641
|
join(cwd, ".claude", "settings.local.json"),
|
|
630
642
|
];
|
|
631
643
|
}
|
|
632
644
|
|
|
645
|
+
/**
|
|
646
|
+
* THE HOST'S OWN DIRECTORY, where its user settings live (2026-10-09):
|
|
647
|
+
* `CLAUDE_CONFIG_DIR` when set, else `~/.claude`.
|
|
648
|
+
*
|
|
649
|
+
* Until today the user settings file was `hostConfigBase` + `.claude/settings.json`,
|
|
650
|
+
* which is right with no variable and wrong with one: the host's documentation
|
|
651
|
+
* says `CLAUDE_CONFIG_DIR` overrides the configuration directory whose default
|
|
652
|
+
* is `~/.claude`, and that every `~/.claude` path lives under it instead — so
|
|
653
|
+
* the file is `$CLAUDE_CONFIG_DIR/settings.json`, and we were reading (and
|
|
654
|
+
* `connect` was writing) `$CLAUDE_CONFIG_DIR/.claude/settings.json`, a file the
|
|
655
|
+
* host never opens. Two agents found it independently. `~/.claude.json` is
|
|
656
|
+
* not a `~/.claude` path, so the MCP file keeps `hostConfigBase`.
|
|
657
|
+
*/
|
|
658
|
+
export function hostSettingsDir(home: string, env: Record<string, string | undefined>): string {
|
|
659
|
+
const moved = (env["CLAUDE_CONFIG_DIR"] ?? "").trim();
|
|
660
|
+
return moved.length > 0 ? moved : join(home, ".claude");
|
|
661
|
+
}
|
|
662
|
+
|
|
633
663
|
/**
|
|
634
664
|
* Where a `-s user` MCP registration lands. `CLAUDE_CONFIG_DIR` moves it.
|
|
635
665
|
*
|
|
@@ -645,7 +675,8 @@ export function hostMcpFile(base: string): string {
|
|
|
645
675
|
return join(base, ".claude.json");
|
|
646
676
|
}
|
|
647
677
|
|
|
648
|
-
/** The base
|
|
678
|
+
/** The base the MCP file (`.claude.json`) lives under: `CLAUDE_CONFIG_DIR` when
|
|
679
|
+
* set, else the home dir. The user settings file is `hostSettingsDir`'s. */
|
|
649
680
|
export function hostConfigBase(home: string, env: Record<string, string | undefined>): string {
|
|
650
681
|
const moved = (env["CLAUDE_CONFIG_DIR"] ?? "").trim();
|
|
651
682
|
return moved.length > 0 ? moved : home;
|
|
@@ -695,7 +726,7 @@ export function readHost(
|
|
|
695
726
|
row.used.add(used);
|
|
696
727
|
runtimes.set(run.exe, row);
|
|
697
728
|
};
|
|
698
|
-
for (const path of hostSettingsFiles(
|
|
729
|
+
for (const path of hostSettingsFiles(hostSettingsDir(home, env), cwd)) {
|
|
699
730
|
const read = readJsonFile(path);
|
|
700
731
|
if (read.state === "unreadable") settingsUnreadable.push(path);
|
|
701
732
|
if (read.state !== "read") continue;
|
|
@@ -762,6 +793,7 @@ export function readHost(
|
|
|
762
793
|
present: runtimePresent(exe, env),
|
|
763
794
|
used: [...row.used].sort(),
|
|
764
795
|
})),
|
|
796
|
+
plugin: pluginInstall({ home, env, cwd }),
|
|
765
797
|
};
|
|
766
798
|
}
|
|
767
799
|
|
|
@@ -234,15 +234,21 @@ export const MEMORY_MECHANISMS: readonly MemoryMechanism[] = [
|
|
|
234
234
|
const quiet = part(v, "quiet");
|
|
235
235
|
const plain = part(v, "plain");
|
|
236
236
|
const held = `${plural(dated, "dated memory", "dated memories")} held`;
|
|
237
|
+
// A PLAIN REMINDER DUE AND NOT SAID (2026-10-09): the `fired` report's
|
|
238
|
+
// occasion check, so "nothing due this week" is never said of a week
|
|
239
|
+
// when something was due and went unsaid.
|
|
240
|
+
const missed = rows("prospective-plain")?.occasionMissed ?? 0;
|
|
241
|
+
const unsaid = missed > 0 ? `; ${plural(missed, "plain reminder")} due on a day a session ran and not said` : "";
|
|
237
242
|
if (v.fired) {
|
|
238
243
|
const parts: string[] = [];
|
|
239
244
|
if (plain > 0) parts.push(`${String(plain)} said plainly`);
|
|
240
245
|
if (quiet > 0) parts.push(`${String(quiet)} as quiet footnotes`);
|
|
241
246
|
return {
|
|
242
247
|
light: LIGHT.working,
|
|
243
|
-
says: `${plural(quiet + plain, "reminder")} came back (${parts.join(", ")}); ${held}`,
|
|
248
|
+
says: `${plural(quiet + plain, "reminder")} came back (${parts.join(", ")}); ${held}${unsaid}`,
|
|
244
249
|
};
|
|
245
250
|
}
|
|
251
|
+
if (missed > 0) return { light: LIGHT.idle, says: `built, but not firing: ${held}${unsaid}` };
|
|
246
252
|
return dated > 0
|
|
247
253
|
? { light: LIGHT.idle, says: `built, nothing due this week: ${held}` }
|
|
248
254
|
: { light: LIGHT.idle, says: "built, nothing dated yet: a note with a date comes back around that day" };
|
|
@@ -77,7 +77,7 @@ import { SCOPES_FILE_NAME } from "../scopes.js";
|
|
|
77
77
|
import { SNAPSHOTS_DIR_NAME, resolveSnapshotsDir } from "../snapshots.js";
|
|
78
78
|
import type { AdapterConfig } from "../config.js";
|
|
79
79
|
import type { Io } from "./commands.js";
|
|
80
|
-
import { BIN, CONFIG_FILE, LEGACY_CREDENTIALS_FILE, MCP_SERVER_NAME } from "./install.js";
|
|
80
|
+
import { BIN, CONFIG_FILE, LEGACY_CREDENTIALS_FILE, MCP_SERVER_NAME, hostSettingsDir } from "./install.js";
|
|
81
81
|
import {
|
|
82
82
|
PARKED_INFIX,
|
|
83
83
|
pairedSuffix,
|
|
@@ -479,6 +479,9 @@ export interface PlanInput {
|
|
|
479
479
|
readonly home: string;
|
|
480
480
|
/** "park" or "delete", for the refusals' wording. */
|
|
481
481
|
readonly verb: string;
|
|
482
|
+
/** The process environment, for where the host keeps its own directory
|
|
483
|
+
* (`CLAUDE_CONFIG_DIR`, review of #337). Absent: `~/.claude` only. */
|
|
484
|
+
readonly env?: Record<string, string | undefined>;
|
|
482
485
|
}
|
|
483
486
|
|
|
484
487
|
/**
|
|
@@ -515,7 +518,7 @@ export function planUninstall(input: PlanInput): UninstallPlan {
|
|
|
515
518
|
refusal: null,
|
|
516
519
|
};
|
|
517
520
|
|
|
518
|
-
const dirRefusal = configDirRefusal(configDir, configPath, input.home, input.verb);
|
|
521
|
+
const dirRefusal = configDirRefusal(configDir, configPath, input.home, input.verb, input.env);
|
|
519
522
|
if (dirRefusal !== null) return { ...empty, refusal: dirRefusal };
|
|
520
523
|
|
|
521
524
|
if (written !== undefined && written.trim().length > 0 && storeDir === null) {
|
|
@@ -649,13 +652,15 @@ function isDirectory(path: string): boolean {
|
|
|
649
652
|
*
|
|
650
653
|
* `start-fresh`'s ring, plus the four the blocker added: the host's own
|
|
651
654
|
* `~/.claude`, the home directory, any PARENT of the home directory, and
|
|
652
|
-
* anything holding a `.git`.
|
|
655
|
+
* anything holding a `.git`. The host's own directory is also wherever
|
|
656
|
+
* `CLAUDE_CONFIG_DIR` puts it, when `env` says so (review of #337).
|
|
653
657
|
*/
|
|
654
658
|
export function configDirRefusal(
|
|
655
659
|
configDir: string,
|
|
656
660
|
configPath: string,
|
|
657
661
|
home: string,
|
|
658
662
|
verb: string,
|
|
663
|
+
env: Record<string, string | undefined> = {},
|
|
659
664
|
): string | null {
|
|
660
665
|
// THE RAW SPELLING DECIDES THIS ONE. `resolve()` is relative to the process
|
|
661
666
|
// working directory and always hands back an absolute path, so a test on the
|
|
@@ -700,7 +705,10 @@ export function configDirRefusal(
|
|
|
700
705
|
// is a command somebody can type, and the first version of this file renamed
|
|
701
706
|
// Claude Code's settings, project transcripts and todos away under a heading
|
|
702
707
|
// that said "Your memory, parked".
|
|
703
|
-
|
|
708
|
+
// `CLAUDE_CONFIG_DIR` MOVES IT (review of #337): the host keeps the same
|
|
709
|
+
// settings, transcripts and todos there instead, so a configuration inside
|
|
710
|
+
// `~/.claude-work` is the same mistake as one inside `~/.claude`.
|
|
711
|
+
if (real === realpathDeep(join(home, ".claude")) || real === realpathDeep(resolve(hostSettingsDir(home, env)))) {
|
|
704
712
|
return (
|
|
705
713
|
`refused: ${written} is Claude Code's own configuration directory. Whatever this ` +
|
|
706
714
|
"install put there, the settings, the project transcripts and the todos beside it are " +
|
|
@@ -968,7 +976,7 @@ export async function uninstall(input: UninstallInput): Promise<Outcome> {
|
|
|
968
976
|
|
|
969
977
|
let plan: UninstallPlan | null = null;
|
|
970
978
|
if (moving) {
|
|
971
|
-
plan = planUninstall({ configPath: input.configPath, config: input.config, home, verb });
|
|
979
|
+
plan = planUninstall({ configPath: input.configPath, config: input.config, home, verb, env });
|
|
972
980
|
if (plan.refusal !== null) {
|
|
973
981
|
io.err(plan.refusal);
|
|
974
982
|
io.err("Nothing has changed.");
|
package/src/adapters/cli/wire.ts
CHANGED
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
* a Claude Code session that is already open. Measured 2026-09-21 — after
|
|
59
59
|
* `settings.json` changes, an open session's hooks fire on its NEXT TURN, and
|
|
60
60
|
* its MCP tools appear only after Claude Code is restarted. `sessionsNote` says
|
|
61
|
-
* exactly that, and counts the memory servers still running when it cheaply can
|
|
61
|
+
* exactly that, and counts the memory servers still running when it cheaply can
|
|
62
|
+
* — by the build each one's own record names, since 2026-10-09 (`serverCensus`);
|
|
62
63
|
* since 2026-09-22 the CALLER prints it, because `install` ends with its own
|
|
63
64
|
* "restart Claude Code, then run doctor" line and two of them on one screen is
|
|
64
65
|
* the finding this round is about.
|
|
@@ -82,7 +83,11 @@ import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
|
82
83
|
|
|
83
84
|
import { DATA_DIR_ENV, isWithin } from "../../core/store/index.js";
|
|
84
85
|
import { CONFIG_ENV, CONFIG_FLAG } from "../config-path.js";
|
|
86
|
+
import { isOurHookCommand } from "../host-wiring.js";
|
|
87
|
+
import { claudeCodeEnvMarker } from "../hosts.js";
|
|
85
88
|
import { parseScriptInvocation, scriptArgs, shellTokens } from "../runtime.js";
|
|
89
|
+
import { installedBuild, readServerRecords, sameBuild, serverBelieved } from "../sessions.js";
|
|
90
|
+
import type { BuildStamp, ServerRecordRead } from "../sessions.js";
|
|
86
91
|
import type { Io } from "./commands.js";
|
|
87
92
|
import {
|
|
88
93
|
BIN,
|
|
@@ -93,6 +98,7 @@ import {
|
|
|
93
98
|
hookCommand,
|
|
94
99
|
hostConfigBase,
|
|
95
100
|
hostMcpFile,
|
|
101
|
+
hostSettingsDir,
|
|
96
102
|
mcpCommand,
|
|
97
103
|
settingsBlock,
|
|
98
104
|
} from "./install.js";
|
|
@@ -104,9 +110,11 @@ import type { Ui, UiEnv } from "./ui.js";
|
|
|
104
110
|
|
|
105
111
|
/** The user-scope settings file: the ONE this command writes. Project files
|
|
106
112
|
* (`.claude/settings.json` in a working directory) are read by `doctor` and
|
|
107
|
-
* never written here — wiring one project is not what anybody asked for.
|
|
113
|
+
* never written here — wiring one project is not what anybody asked for.
|
|
114
|
+
* `$CLAUDE_CONFIG_DIR/settings.json` when that is set (`hostSettingsDir`,
|
|
115
|
+
* 2026-10-09), never `$CLAUDE_CONFIG_DIR/.claude/settings.json`. */
|
|
108
116
|
export function userSettingsPath(home: string, env: UiEnv): string {
|
|
109
|
-
return join(
|
|
117
|
+
return join(hostSettingsDir(home, env), "settings.json");
|
|
110
118
|
}
|
|
111
119
|
|
|
112
120
|
/** The infix a backup wears. Named, because the test and the output share it. */
|
|
@@ -588,51 +596,13 @@ export interface MergeResult {
|
|
|
588
596
|
}
|
|
589
597
|
|
|
590
598
|
/**
|
|
591
|
-
* IS THIS COMMAND OURS TO REWRITE — which
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
*
|
|
596
|
-
* should — a wrapper that ends in `counterparts-hook` really does run our hook,
|
|
597
|
-
* and a doctor that said otherwise would be wrong.
|
|
598
|
-
*
|
|
599
|
-
* It is the wrong question for a WRITE. The review wrapped our hook two ways —
|
|
600
|
-
* `~/bin/log-start.sh && counterparts-hook`, and `/opt/mytool/bin/wrap --then
|
|
601
|
-
* counterparts-hook` — and `wire` overwrote the first with ours alone while
|
|
602
|
-
* `unwire` deleted the second outright. Both are somebody's own line, and this
|
|
603
|
-
* file's own promise is that nothing belonging to another tool is a candidate.
|
|
604
|
-
*
|
|
605
|
-
* So a command is ours to rewrite only when it IS our invocation and nothing
|
|
606
|
-
* else: our runtime and our hook script, or the installed shim, optionally
|
|
607
|
-
* followed by `--config <path>`. Anything with a shell operator in it is
|
|
608
|
-
* refused outright, whatever else it looks like — a command this cannot parse
|
|
609
|
-
* is a command this does not edit.
|
|
610
|
-
*
|
|
611
|
-
* `test/wire.test.ts` holds the two to each other in the direction that
|
|
612
|
-
* matters: everything `wire` WRITES is matched by both, so a hook we installed
|
|
613
|
-
* can never read as missing on the surface a person checks.
|
|
599
|
+
* IS THIS COMMAND OURS TO REWRITE — `host-wiring.ts#isOurHookCommand`, which
|
|
600
|
+
* is where the rule and its history now live (moved 2026-10-09 so the plugin's
|
|
601
|
+
* hook and MCP server can recognise the npm wiring without importing the
|
|
602
|
+
* console). Re-exported unchanged: this file and `doctor` still ask exactly the
|
|
603
|
+
* same question of exactly the same function.
|
|
614
604
|
*/
|
|
615
|
-
export
|
|
616
|
-
// A shell operator means the line does something besides run our hook.
|
|
617
|
-
if (/&&|\|\||;|\||>|<|`|\$\(/.test(command)) return false;
|
|
618
|
-
const tokens = shellTokens(command);
|
|
619
|
-
if (tokens.length === 0) return false;
|
|
620
|
-
const tail = (from: number): boolean => {
|
|
621
|
-
const rest = tokens.slice(from);
|
|
622
|
-
if (rest.length === 0) return true;
|
|
623
|
-
return rest.length === 2 && rest[0] === CONFIG_FLAG && (rest[1] ?? "").length > 0;
|
|
624
|
-
};
|
|
625
|
-
const first = tokens[0] ?? "";
|
|
626
|
-
// The installed shim, by itself.
|
|
627
|
-
if (/(^|[/\\])counterparts-hook$/.test(first)) return tail(1);
|
|
628
|
-
// `<runtime> run <our hook script>`, or Node's
|
|
629
|
-
// `<runtime> --import <node-hooks.mjs> <our hook script>` (`runtime.ts`).
|
|
630
|
-
const run = parseScriptInvocation(tokens);
|
|
631
|
-
if (run !== null && /claude-code[/\\]bin[/\\]hook\.ts$/.test(run.script)) {
|
|
632
|
-
return tail(tokens.length - run.rest.length);
|
|
633
|
-
}
|
|
634
|
-
return false;
|
|
635
|
-
}
|
|
605
|
+
export { isOurHookCommand };
|
|
636
606
|
|
|
637
607
|
/** Is this inner entry one this command may rewrite or remove? */
|
|
638
608
|
function isOurs(entry: unknown): entry is Record<string, unknown> {
|
|
@@ -1004,6 +974,9 @@ export interface RunningProcess {
|
|
|
1004
974
|
/** In the words the output uses: "an MCP server", "the worker", "a dashboard". */
|
|
1005
975
|
readonly what: string;
|
|
1006
976
|
readonly command: string;
|
|
977
|
+
/** Its parent, when the look saw it. For an MCP server that is the host
|
|
978
|
+
* process that started it — Claude Code, for one of its sessions. */
|
|
979
|
+
readonly ppid?: number;
|
|
1007
980
|
}
|
|
1008
981
|
|
|
1009
982
|
/**
|
|
@@ -1017,6 +990,13 @@ export interface RunningProcess {
|
|
|
1017
990
|
export interface ProcessSighting {
|
|
1018
991
|
readonly looked: boolean;
|
|
1019
992
|
readonly processes: readonly RunningProcess[];
|
|
993
|
+
/**
|
|
994
|
+
* EVERY process's parent (pid → ppid), not only ours — the chain from this
|
|
995
|
+
* process up to the host it runs under is what tells `connect` which
|
|
996
|
+
* running server is the session it was typed into (`serverCensus`).
|
|
997
|
+
* Absent when the look could not say, and from a lister that does not.
|
|
998
|
+
*/
|
|
999
|
+
readonly parents?: ReadonlyMap<number, number>;
|
|
1020
1000
|
}
|
|
1021
1001
|
|
|
1022
1002
|
export type ProcessLister = () => ProcessSighting;
|
|
@@ -1048,7 +1028,13 @@ export function processMark(command: string): string | null {
|
|
|
1048
1028
|
}
|
|
1049
1029
|
|
|
1050
1030
|
/**
|
|
1051
|
-
* `ps -
|
|
1031
|
+
* `ps -axwwo pid=,ppid=,command=`, filtered here rather than by `pgrep -f`. The
|
|
1032
|
+
* parent column (2026-10-09) is kept for every line, ours or not, so a caller
|
|
1033
|
+
* can walk from this process up to its host (`ProcessSighting.parents`).
|
|
1034
|
+
*
|
|
1035
|
+
* `ww` (review of #331): procps on Linux cuts `command` at `$COLUMNS` when that
|
|
1036
|
+
* is set, even into a pipe, and the cut can fall before the path segment
|
|
1037
|
+
* `processMark` needs. Unlimited width on both procps and macOS.
|
|
1052
1038
|
*
|
|
1053
1039
|
* **It never throws and it never fails the caller.** A machine with no `ps`, a
|
|
1054
1040
|
* `ps` that times out, a sandbox that refuses process listing — every one of
|
|
@@ -1058,7 +1044,7 @@ export function processMark(command: string): string | null {
|
|
|
1058
1044
|
export function realProcessLister(env: Record<string, string | undefined>): ProcessLister {
|
|
1059
1045
|
return () => {
|
|
1060
1046
|
try {
|
|
1061
|
-
const res = spawnSync("ps", ["-
|
|
1047
|
+
const res = spawnSync("ps", ["-axwwo", "pid=,ppid=,command="], {
|
|
1062
1048
|
encoding: "utf8",
|
|
1063
1049
|
timeout: 4000,
|
|
1064
1050
|
windowsHide: true,
|
|
@@ -1070,17 +1056,20 @@ export function realProcessLister(env: Record<string, string | undefined>): Proc
|
|
|
1070
1056
|
if (res.error !== undefined && res.error !== null) return NO_LOOK;
|
|
1071
1057
|
if (res.status !== 0) return NO_LOOK;
|
|
1072
1058
|
const out: RunningProcess[] = [];
|
|
1059
|
+
const parents = new Map<number, number>();
|
|
1073
1060
|
for (const line of String(res.stdout ?? "").split("\n")) {
|
|
1074
|
-
const m = /^\s*(\d+)\s+(.*)$/.exec(line);
|
|
1061
|
+
const m = /^\s*(\d+)\s+(\d+)\s+(.*)$/.exec(line);
|
|
1075
1062
|
if (m === null) continue;
|
|
1076
1063
|
const pid = Number(m[1]);
|
|
1077
|
-
const
|
|
1064
|
+
const ppid = Number(m[2]);
|
|
1065
|
+
const command = m[3] ?? "";
|
|
1066
|
+
parents.set(pid, ppid);
|
|
1078
1067
|
if (pid === process.pid) continue;
|
|
1079
1068
|
const what = processMark(command);
|
|
1080
1069
|
if (what === null) continue;
|
|
1081
|
-
out.push({ pid, what, command });
|
|
1070
|
+
out.push({ pid, what, command, ppid });
|
|
1082
1071
|
}
|
|
1083
|
-
return { looked: true, processes: out };
|
|
1072
|
+
return { looked: true, processes: out, parents };
|
|
1084
1073
|
} catch {
|
|
1085
1074
|
return NO_LOOK;
|
|
1086
1075
|
}
|
|
@@ -1100,11 +1089,6 @@ export function look(lister: ProcessLister): ProcessSighting {
|
|
|
1100
1089
|
}
|
|
1101
1090
|
}
|
|
1102
1091
|
|
|
1103
|
-
/** Only the MCP servers, which is what "restart your sessions" is about. This
|
|
1104
|
-
* one FAILS OPEN on purpose: it is a courtesy line, not a guard. */
|
|
1105
|
-
export function runningServers(lister: ProcessLister): readonly RunningProcess[] {
|
|
1106
|
-
return look(lister).processes.filter((p) => p.what === "an MCP server");
|
|
1107
|
-
}
|
|
1108
1092
|
|
|
1109
1093
|
// ── the command ─────────────────────────────────────────────────────────────
|
|
1110
1094
|
|
|
@@ -1461,17 +1445,159 @@ export function wrappedNote(
|
|
|
1461
1445
|
* until Claude Code is restarted (a server keeps the code and the registration
|
|
1462
1446
|
* it was launched with). Both halves are said, because a person who reads only
|
|
1463
1447
|
* the first will wonder why `note` is missing.
|
|
1448
|
+
*
|
|
1449
|
+
* THE COUNT SAYS WHAT IT KNOWS (2026-10-09). It used to be every memory server
|
|
1450
|
+
* in the process table, called "the previous version's" — which nothing had
|
|
1451
|
+
* checked. The 0.3.12 release run printed "11 sessions are running the
|
|
1452
|
+
* previous version's memory server" over the owner's own open sessions, the
|
|
1453
|
+
* one it was typed into among them. Each server now goes where this store's
|
|
1454
|
+
* own records put it (`serverCensus`): another build than this install,
|
|
1455
|
+
* this build, or no record here at all — and the session the command was run
|
|
1456
|
+
* from is named in whichever it is in, when the process table can say which.
|
|
1464
1457
|
*/
|
|
1465
|
-
export function sessionsNote(
|
|
1458
|
+
export function sessionsNote(
|
|
1459
|
+
u: Ui,
|
|
1460
|
+
lister: ProcessLister,
|
|
1461
|
+
opts: {
|
|
1462
|
+
/** The store the connected server is told to open — where servers leave their records. */
|
|
1463
|
+
readonly dataDir: string;
|
|
1464
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
1465
|
+
readonly installed?: BuildStamp;
|
|
1466
|
+
readonly selfPid?: number;
|
|
1467
|
+
readonly now?: number;
|
|
1468
|
+
},
|
|
1469
|
+
): void {
|
|
1466
1470
|
u.hint("Hooks start with your next turn in any open Claude Code session.");
|
|
1467
1471
|
u.hint("The memory tools appear after you restart Claude Code.");
|
|
1468
|
-
|
|
1469
|
-
|
|
1472
|
+
// Only the MCP servers, which is what "restart your sessions" is about. This
|
|
1473
|
+
// FAILS OPEN on purpose: a look that did not happen says nothing, because
|
|
1474
|
+
// this is a courtesy line, not a guard.
|
|
1475
|
+
const sight = look(lister);
|
|
1476
|
+
const running = sight.processes.filter((p) => p.what === "an MCP server");
|
|
1477
|
+
if (running.length === 0) return;
|
|
1478
|
+
const installed = opts.installed ?? installedBuild();
|
|
1479
|
+
const census = serverCensus(running, {
|
|
1480
|
+
dataDir: opts.dataDir,
|
|
1481
|
+
installed,
|
|
1482
|
+
...(sight.parents === undefined ? {} : { parents: sight.parents }),
|
|
1483
|
+
...(opts.selfPid === undefined ? {} : { selfPid: opts.selfPid }),
|
|
1484
|
+
...(opts.now === undefined ? {} : { now: opts.now }),
|
|
1485
|
+
});
|
|
1486
|
+
const here = "the session you ran this from";
|
|
1487
|
+
if (census.other > 0) {
|
|
1488
|
+
const n = census.other;
|
|
1489
|
+
u.hint(
|
|
1490
|
+
`(${String(n)} open session${n === 1 ? "" : "s"} still run${n === 1 ? "s" : ""} memory server ${census.otherVersions.join(" or ")}, ` +
|
|
1491
|
+
`not this install's ${installed.version ?? "build"}${census.mine === "other" ? ` — ${here} ${n === 1 ? "is that one" : "is one of them"}` : ""}: ` +
|
|
1492
|
+
`restart ${n === 1 ? "it, or run /mcp and Reconnect in it" : "them, or run /mcp and Reconnect in each"}.)`,
|
|
1493
|
+
);
|
|
1494
|
+
}
|
|
1495
|
+
if (census.current > 0) {
|
|
1496
|
+
const n = census.current;
|
|
1470
1497
|
u.hint(
|
|
1471
|
-
`(${String(
|
|
1472
|
-
"
|
|
1498
|
+
`(${String(n)} open session${n === 1 ? "" : "s"} already run${n === 1 ? "s" : ""} this version` +
|
|
1499
|
+
`${census.mine === "current" ? `, ${here} included` : ""}.)`,
|
|
1473
1500
|
);
|
|
1474
1501
|
}
|
|
1502
|
+
if (census.unplaced > 0) {
|
|
1503
|
+
const n = census.unplaced;
|
|
1504
|
+
const more = census.other + census.current > 0 ? " more" : "";
|
|
1505
|
+
u.hint(
|
|
1506
|
+
`(${String(n)}${more} memory server${n === 1 ? " is" : "s are"} running that this store holds no current record of — ` +
|
|
1507
|
+
"another store's, one in a directory where memory is off, or a build from before servers recorded themselves — " +
|
|
1508
|
+
`so which version ${n === 1 ? "it runs" : "they run"} is not known here${census.mine === "unplaced" ? `; ${here} is ${n === 1 ? "that one" : "one of them"}` : ""}.)`,
|
|
1509
|
+
);
|
|
1510
|
+
}
|
|
1511
|
+
// HONEST WHEN IT CANNOT TELL. Run from inside Claude Code, that session's
|
|
1512
|
+
// own server is one of the ones counted; without the parent column the
|
|
1513
|
+
// count cannot say which, so it says that rather than guess.
|
|
1514
|
+
if (!census.knowsMine && claudeCodeEnvMarker(opts.env ?? {}) !== null) {
|
|
1515
|
+
u.hint("(This was run from inside a Claude Code session, so that session's own server is counted above; which one it is could not be told from here.)");
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
/** Where the running memory servers stand, by this store's own records. */
|
|
1520
|
+
export interface ServerCensus {
|
|
1521
|
+
/** Servers whose record here names another build than this install's. */
|
|
1522
|
+
readonly other: number;
|
|
1523
|
+
/** Those builds' versions, distinct, in the order first seen. */
|
|
1524
|
+
readonly otherVersions: readonly string[];
|
|
1525
|
+
/** Servers whose record here names this install's build. */
|
|
1526
|
+
readonly current: number;
|
|
1527
|
+
/** Running servers this store holds no believed record of. */
|
|
1528
|
+
readonly unplaced: number;
|
|
1529
|
+
/** Which of the three the server of the session this command runs in is in,
|
|
1530
|
+
* or null when none of them could be named as its. */
|
|
1531
|
+
readonly mine: "other" | "current" | "unplaced" | null;
|
|
1532
|
+
/** Whether the look gave parents, so `mine` is an answer and not a blank. */
|
|
1533
|
+
readonly knowsMine: boolean;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* SORT THE RUNNING MEMORY SERVERS BY WHAT THIS STORE KNOWS OF THEM.
|
|
1538
|
+
*
|
|
1539
|
+
* Every server leaves `sessions/mcp-server@<pid>.json` in the store it opened
|
|
1540
|
+
* (`sessions.ts#recordServerLaunch`): its build, and its parent — the host
|
|
1541
|
+
* process that started it. A record is believed when its pid is one the
|
|
1542
|
+
* process table just listed AND its heartbeat is fresh (`serverBelieved`,
|
|
1543
|
+
* with the table as the liveness answer), so a pid the OS handed on is not
|
|
1544
|
+
* read as the server that left the file.
|
|
1545
|
+
*
|
|
1546
|
+
* THE SESSION THIS COMMAND RUNS IN is the one whose server's parent is one of
|
|
1547
|
+
* this process's own ancestors — run from Claude Code's shell, the chain goes
|
|
1548
|
+
* up through the shell to the very `claude` process that started that server.
|
|
1549
|
+
* Pid 1 is never an ancestor for this: an orphaned server is reparented to it,
|
|
1550
|
+
* and every process descends from it. Pure over its inputs; never throws.
|
|
1551
|
+
*/
|
|
1552
|
+
export function serverCensus(
|
|
1553
|
+
running: readonly RunningProcess[],
|
|
1554
|
+
input: {
|
|
1555
|
+
readonly dataDir: string;
|
|
1556
|
+
readonly installed: BuildStamp;
|
|
1557
|
+
readonly parents?: ReadonlyMap<number, number>;
|
|
1558
|
+
readonly selfPid?: number;
|
|
1559
|
+
readonly now?: number;
|
|
1560
|
+
},
|
|
1561
|
+
): ServerCensus {
|
|
1562
|
+
const listed = new Set(running.map((p) => p.pid));
|
|
1563
|
+
const now = input.now ?? Date.now();
|
|
1564
|
+
const records = new Map<number, ServerRecordRead>();
|
|
1565
|
+
for (const r of readServerRecords(input.dataDir)) {
|
|
1566
|
+
if (serverBelieved(r.pid, r.refreshedAt, now, (pid) => listed.has(pid))) records.set(r.pid, r);
|
|
1567
|
+
}
|
|
1568
|
+
const ancestors = new Set<number>();
|
|
1569
|
+
if (input.parents !== undefined) {
|
|
1570
|
+
let at = input.parents.get(input.selfPid ?? process.pid);
|
|
1571
|
+
while (at !== undefined && at > 1 && !ancestors.has(at)) {
|
|
1572
|
+
ancestors.add(at);
|
|
1573
|
+
at = input.parents.get(at);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
let other = 0;
|
|
1577
|
+
let current = 0;
|
|
1578
|
+
let unplaced = 0;
|
|
1579
|
+
const otherVersions: string[] = [];
|
|
1580
|
+
let mine: ServerCensus["mine"] = null;
|
|
1581
|
+
for (const p of running) {
|
|
1582
|
+
const r = records.get(p.pid);
|
|
1583
|
+
const bucket: NonNullable<ServerCensus["mine"]> =
|
|
1584
|
+
r === undefined ? "unplaced" : sameBuild(r.build, input.installed) ? "current" : "other";
|
|
1585
|
+
if (bucket === "unplaced") unplaced += 1;
|
|
1586
|
+
else if (bucket === "current") current += 1;
|
|
1587
|
+
else {
|
|
1588
|
+
other += 1;
|
|
1589
|
+
const v =
|
|
1590
|
+
r === undefined || r.build.version === null
|
|
1591
|
+
? "of an unknown version"
|
|
1592
|
+
: r.build.version === input.installed.version
|
|
1593
|
+
? `${r.build.version} (another build of it)`
|
|
1594
|
+
: r.build.version;
|
|
1595
|
+
if (!otherVersions.includes(v)) otherVersions.push(v);
|
|
1596
|
+
}
|
|
1597
|
+
const ppid = p.ppid ?? input.parents?.get(p.pid);
|
|
1598
|
+
if (mine === null && ((ppid !== undefined && ancestors.has(ppid)) || (r !== undefined && ancestors.has(r.hostPid)))) mine = bucket;
|
|
1599
|
+
}
|
|
1600
|
+
return { other, otherVersions, current, unplaced, mine, knowsMine: input.parents !== undefined };
|
|
1475
1601
|
}
|
|
1476
1602
|
|
|
1477
1603
|
/**
|
|
@@ -67,6 +67,10 @@ reachable through `eventLog({ sinceDay })`. That is the likely fix and it is a v
|
|
|
67
67
|
decision, not a core one — but events are bounded-retention telemetry and the meta
|
|
68
68
|
records are not, so the two are not interchangeable for an old cycle.
|
|
69
69
|
|
|
70
|
+
*(Noted 2026-10-09: the store has a prefix read now, `Store#metaWithPrefix(prefix)`
|
|
71
|
+
(#95, 2026-09-14). Nothing in the dashboard calls it yet, and `status` still reports
|
|
72
|
+
since birth, so the view's half is open.)*
|
|
73
|
+
|
|
70
74
|
**Owner:** `store/` (the surface), `sleep/` (the records).
|
|
71
75
|
|
|
72
76
|
---
|
|
@@ -155,7 +159,12 @@ small by construction. Negligible today; wrong at a hundred names.
|
|
|
155
159
|
**Owner:** `store/`.
|
|
156
160
|
|
|
157
161
|
|
|
158
|
-
## §6 — Returns are kept by moment, the lights' window by lived day (2026-09-26)
|
|
162
|
+
## §6 — Returns are kept by moment, the lights' window by lived day (2026-09-26) — CLOSED 2026-09-26 (noted 2026-10-09)
|
|
163
|
+
|
|
164
|
+
**Closed in the same PR, #251** (`197e1ca`): `Store#returnCounts` takes
|
|
165
|
+
`{ sinceAt?, sinceDay? }`, and the mechanism lights ask it by lived day
|
|
166
|
+
(`web/views/mechanisms.ts`, `mechanism-panel.ts`, `adapters/mechanism-evidence.ts`). The
|
|
167
|
+
text below is the gap as filed.
|
|
159
168
|
|
|
160
169
|
**Have:** `store.returnCounts(sinceAt)` counts the `returns` table from a UTC
|
|
161
170
|
moment; the mechanism window is seven LIVED days. A light that wants "returns in
|
|
@@ -547,3 +547,82 @@ From Fable's review of Health (2026-09-28) and the open follow-ups of #277:
|
|
|
547
547
|
- **Counts** (329 vs 322 vs 296) were already labelled by 09-28/09-30 work:
|
|
548
548
|
Health's line says it leaves out the people and project cards, and the
|
|
549
549
|
memories grid says its journal chapters aren't scored.
|
|
550
|
+
|
|
551
|
+
## 2026-10-09 — Ask reads the answers 0.3.12 gives
|
|
552
|
+
|
|
553
|
+
0.3.12 gave recall a required mode (#323) and the console's `ask --json` started
|
|
554
|
+
printing a `FactsResult`. The Memories page's Ask kept reading the answer it was
|
|
555
|
+
built for: a confidence `tier` (gone with the tiers), a `from` chapter link (folded
|
|
556
|
+
into the answer by facts mode itself, so `/api/chapters` answered `{}`), a date
|
|
557
|
+
written at the front of the body (facts carries `occurredOn` / `learned`), and
|
|
558
|
+
`journal: false` written in by the page. So the match words, the links and most
|
|
559
|
+
dates vanished without an error, and "by meaning" was answered in facts mode — the
|
|
560
|
+
console had no other. Every test of it passed: they fed the page answers written by
|
|
561
|
+
hand, in the old shape.
|
|
562
|
+
|
|
563
|
+
- **Three ways to find.** The switch is "by word | facts | by meaning". By word is
|
|
564
|
+
unchanged; facts and by meaning ask on Enter with `act("ask", {json, mode, page})`,
|
|
565
|
+
which is `counterparts ask --json --mode meaning` for meaning — a flag the console
|
|
566
|
+
did not have (`--mode`, facts by default, as the MCP tool's `mode`). A third
|
|
567
|
+
position, rather than turning "by meaning" into facts or Enter-in-by-word into an
|
|
568
|
+
ask, because the 09-30 switch was the owner's (M3) and adding to it reverses
|
|
569
|
+
nothing; whether three is right is his to say.
|
|
570
|
+
- **Facts, as the answer says it.** The head counts every match (`matched`), the
|
|
571
|
+
pager pages it (`page`, `pages`, ten a page), and the notes say what it was about,
|
|
572
|
+
the time it named, words only, and what was left out. A row's date is when it
|
|
573
|
+
happened, else when it was learned (the hover says which); under the words, only
|
|
574
|
+
what the answer carries: who said it, its status, when it was learned, which
|
|
575
|
+
chapter, "earlier: …" with a link to the earlier memory, corrected ones counted,
|
|
576
|
+
"disagrees with" as a link. A journal answer's heading is taken off the front of
|
|
577
|
+
its words, display only.
|
|
578
|
+
- **Meaning, as an arc.** The head names the subject and counts its chapters and
|
|
579
|
+
moments; each chapter is a row titled by its day that opens its journal, with its
|
|
580
|
+
line, its marks (start, latest, a turn), whose feelings side by side, and its
|
|
581
|
+
moments as links; a session's moments with no chapter are a row that opens
|
|
582
|
+
nothing. Then faded moments, earlier readings, what is still open, what recurs.
|
|
583
|
+
`--voiced` finally decides something: the dashboard asks in my voice, so "mine"
|
|
584
|
+
in a meaning answer is mine.
|
|
585
|
+
- **Dropped, not invented:** the match-strength word, `fold.js`, and `/api/chapters`
|
|
586
|
+
with `views/search.ts#chapterLinks` — their only reader was the fold.
|
|
587
|
+
- **The drawing is pure and fed real answers.** `factsHead`, `factsRows`,
|
|
588
|
+
`meaningHead`, `meaningRows` and `askPager` in `sections/search.js` take the
|
|
589
|
+
parsed answer; `test/dashboard-ask-answers.test.ts` gets every answer it draws
|
|
590
|
+
through `runAction("ask", …)` on a seeded temp store and reads each field it
|
|
591
|
+
checks off the typed `FactsResult` / `MeaningResult`, so a renamed field breaks
|
|
592
|
+
the build there before it can vanish from the page again.
|
|
593
|
+
- **An id in a memory's words is a link** (`memory-marks.js#idMark`): "(mem_…)"
|
|
594
|
+
shows as "memory ↗" and opens it, "epi_…#2" as "journal chapter 2 ↗", the id on
|
|
595
|
+
hover. Inside something already clickable (a moment's title) it is drawn the same
|
|
596
|
+
but not linked. The memory card's own body still prints ids as written.
|
|
597
|
+
- **Review of #333: in meaning mode the owner's "I" becomes "you", not his name.**
|
|
598
|
+
The voice rewrite turned "what has Ilya been to me" into "… to Rosalind", and
|
|
599
|
+
meaning takes the card with the most memories as its subject: the owner's own
|
|
600
|
+
card, usually the biggest, won, and the person asked about went under "also
|
|
601
|
+
named". The answer tests ran the action with no owner name, as the server never
|
|
602
|
+
does. Facts still gets his name, where words are what match.
|
|
603
|
+
(2026-10-09: meaning now takes the card the question is about, and in my voice
|
|
604
|
+
"you" asked about is the owner's card, so "what have I been like" finds his card
|
|
605
|
+
again with no change here; see mcp NOTES of that day.)
|
|
606
|
+
|
|
607
|
+
## 2026-10-09 — the card's "Written" day is local
|
|
608
|
+
|
|
609
|
+
The memory card's "Written …" line took the UTC date of `createdAt`
|
|
610
|
+
(`shared/memory-modal.js#writtenOn`), so in Denver a memory written in the
|
|
611
|
+
evening said the next day, beside a "recorded" chip that said the right one.
|
|
612
|
+
It now reads `shared/dates.js#localIso`, the browser's calendar, as the Health
|
|
613
|
+
cycle line already did. The "written" row under the card's details still prints
|
|
614
|
+
its UTC minute and says "UTC", so it was left alone.
|
|
615
|
+
|
|
616
|
+
The browser's zone is the dashboard's zone for now (review of #335):
|
|
617
|
+
`Dashboard.open` passes no `timeZone`, so the server views (`mind.ts`,
|
|
618
|
+
`traits.ts`, `activity.ts`) also read the machine's zone, which is the browser's
|
|
619
|
+
on a local dashboard. The hooks do read the config's `timeZone`, so with one set
|
|
620
|
+
that differs from the machine's, `learnedOn` ("recorded") follows the config while
|
|
621
|
+
everything the dashboard dates itself follows the machine. If the dashboard learns
|
|
622
|
+
the config's zone (`cli/commands.ts#zoneBeside`), this day and the Health cycle
|
|
623
|
+
line should come from the server too.
|
|
624
|
+
|
|
625
|
+
How it got through: `test/time.test.ts` scans `src/` for hand-built dates, but
|
|
626
|
+
only `.ts` files, so the browser modules here are not scanned at all. Widening
|
|
627
|
+
the scan to `.js` would also catch `dates.js` and `cycle.js`, which build dates
|
|
628
|
+
on purpose, so it needs its own allow-list decisions; left as a follow-up.
|