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
|
@@ -1948,3 +1948,134 @@ entry — the share that carries each field and all three, and how many subject
|
|
|
1948
1948
|
are. Two aggregates, so it runs in the session-start reading too. Silent on a v11 file
|
|
1949
1949
|
(the observer floor did not move). It is what the revisit a few days after the upgrade
|
|
1950
1950
|
reads before recall starts reading the fields.
|
|
1951
|
+
|
|
1952
|
+
## 2026-10-08 — the wake check waits for the transcript
|
|
1953
|
+
|
|
1954
|
+
Since about 09-25 Claude Code creates a session's transcript only after the first prompt
|
|
1955
|
+
is handled, so the arrival check at that prompt found no file: on the owner's store 42 of
|
|
1956
|
+
43 sessions in a week read `not-found` / `transcript: "absent"`, and their files existed a
|
|
1957
|
+
moment later. The one `delivered` was a session where a local `/model` command had written
|
|
1958
|
+
the file first. Nothing acted on the verdict; doctor's Wake line said "42 not found".
|
|
1959
|
+
|
|
1960
|
+
When a wake was expected and the file is absent, the prompt now writes no row and does not
|
|
1961
|
+
mark the session; the next prompt or the first Stop reads again. The Stop is final: by the
|
|
1962
|
+
end of a turn the host has written the file, so an absent one there writes the row once,
|
|
1963
|
+
`checkedAt: "stop"`, rather than asking every turn. The check still never makes a record;
|
|
1964
|
+
at a Stop the boundary already has (`sealJoinedLate` for a session with none), so such a
|
|
1965
|
+
session says `no-wake-expected` there, as its second prompt used to. Doctor's Wake line
|
|
1966
|
+
counts a `not-found` with no transcript read as "not checked" and leaves it out of "N of M
|
|
1967
|
+
arrived whole" — which is also how the week of rows already in stores now reads.
|
|
1968
|
+
|
|
1969
|
+
After the review of #325: only an `absent` transcript at the first prompt is "not checked".
|
|
1970
|
+
`absent` at the Stop (no transcript by the end of a turn) and `unreadable` (a file that
|
|
1971
|
+
would not open) each have their own clause and stay in the "N of M" — counted, not graded,
|
|
1972
|
+
like `not-found`; amber would hold forever on a host build that never writes the file, with
|
|
1973
|
+
nothing to do by hand. The dashboard's narrator says the same split: the first calm, the
|
|
1974
|
+
other two amber. The prompt's wait is a ring event, `adapter.wake.check.deferred`.
|
|
1975
|
+
|
|
1976
|
+
## 2026-10-09 — the night run reads its own transcript for the host's cut (U14 item 3)
|
|
1977
|
+
|
|
1978
|
+
0.3.12 keeps every result under 40,000 characters, 20% under Claude Code's 50,000-character
|
|
1979
|
+
line, but the host can lower that line by a remote flag and nothing pins it. A result past
|
|
1980
|
+
it reaches the model as a 2 KB preview, and nothing in the store can tell: the server
|
|
1981
|
+
answered whole, the parts were fetched, every line was green. So the night now asks the
|
|
1982
|
+
host's own record. The child gets `--session-id` with a UUID the waiting process chose;
|
|
1983
|
+
when it exits the transcript is found by that name and read for the host's marker on
|
|
1984
|
+
results of ours. One `mcp.result.spilled` row per cut result; `transcript` and `spills` on
|
|
1985
|
+
the run's row; doctor's Tool results line amber; a plain line in the morning hand-back.
|
|
1986
|
+
|
|
1987
|
+
- **The markers were read from the host's code, 2.1.295** (strings in the binary, not a
|
|
1988
|
+
transcript): `<persisted-output>` + "Output too large (51.5KB). Full output saved to: …"
|
|
1989
|
+
+ "Preview (first 2KB):" + `</persisted-output>` is the one the nights of 10-01 to 10-07
|
|
1990
|
+
met. Three more: the same with "Output exceeded the … persist limit" (a result past the
|
|
1991
|
+
file cap), `<truncated-output>` + "It could not be saved" (the save failed), "Error:
|
|
1992
|
+
result (N characters) exceeds maximum allowed tokens. Output has been saved to …" (the MCP
|
|
1993
|
+
token line), and, with no file kept, the result cut and "[OUTPUT TRUNCATED - exceeded N
|
|
1994
|
+
token limit]" + "The tool output was truncated." appended. A host that rewords them
|
|
1995
|
+
makes the check go quiet, not wrong.
|
|
1996
|
+
- **Anchored, never a substring.** The morning's manual check (grep "Output too large" in
|
|
1997
|
+
the night's transcript) found two hits that were memories quoting the check, inside a
|
|
1998
|
+
recall answer. The first three markers are matched at the START of a `tool_result`, the
|
|
1999
|
+
token trailer at its very END with the real line breaks the host writes — a quoted line
|
|
2000
|
+
break inside our JSON is the two characters `\n`. Only `tool_result` blocks answering a
|
|
2001
|
+
`tool_use` named `mcp__counterparts__…`; the model's own text, the person's, and other
|
|
2002
|
+
tools' results are never read. The test carries exactly that recall answer.
|
|
2003
|
+
- **Found by name, not by guessing the host's spelling.** The host turns the directory into
|
|
2004
|
+
a name (every character but a letter or digit to "-"), shortens a long one with a hash of
|
|
2005
|
+
its own, and may start from a git worktree's root. The spelling is tried first, then
|
|
2006
|
+
every project directory is asked for `<id>.jsonl` — a fresh UUID, so only one file can
|
|
2007
|
+
answer. `absent` and `unreadable` go on the row and are said in doctor's green line ("not
|
|
2008
|
+
checked"), never read as clean.
|
|
2009
|
+
- **Amber, not red.** A spill is the same kind of fact as the two ambers already on the
|
|
2010
|
+
line (a result cut by our net, a part never fetched): the night has happened, and nothing
|
|
2011
|
+
can be done by hand. Red would be defensible — the run read through a keyhole — but the
|
|
2012
|
+
standing preference is loose first.
|
|
2013
|
+
- **Not covered:** the morning catch-up's child (its write-up parts are sized by
|
|
2014
|
+
`WRITE_UP_PART_BYTES`, far under any line), and ordinary sessions. A result cut in a
|
|
2015
|
+
session the owner watches is in front of him.
|
|
2016
|
+
- **Unmeasured on a real machine:** that `claude -p` honours `--session-id` (its help lists
|
|
2017
|
+
the flag with no print-mode caveat), and that the transcript lands where it is looked
|
|
2018
|
+
for. If either fails, the row says `absent` and doctor says the night was not checked.
|
|
2019
|
+
- The same change tightened the reflection's instructions when its bundle comes in parts
|
|
2020
|
+
(`dream/NOTES.md`, 2026-10-09).
|
|
2021
|
+
|
|
2022
|
+
## 2026-10-09 — the write-up plan at session start: measured, the skip not built
|
|
2023
|
+
|
|
2024
|
+
The plan behind the write-up pointer (`writeUpPlan`) runs at every start until the day's
|
|
2025
|
+
allowance is spent, and when nothing is owed that never happens. Re-measured on a synthetic
|
|
2026
|
+
400-session store with one plan per process: ~31 ms (it was ~43 ms in #192's review, when it
|
|
2027
|
+
still read the ask rows). The brief was a stamp that skips the scan when nothing has
|
|
2028
|
+
changed. It was not built. The stamp that is safe never fires, because every start writes
|
|
2029
|
+
its own registry record first and every Stop appends to the buffer. The stamp that fires
|
|
2030
|
+
has to restate `coverage/`'s rule (only an end or a new date makes a debt) and be bumped by
|
|
2031
|
+
every end. Even then, the usual flow (end one session, open the next) rescans anyway, and a
|
|
2032
|
+
missed bump hides a debt until the next date. The numbers, the design and the cheaper
|
|
2033
|
+
alternative (the ledger's date formatting and its second read of the span files) are in
|
|
2034
|
+
INTERFACE-GAPS §15.
|
|
2035
|
+
|
|
2036
|
+
## 2026-10-09 — the Fired line: one-time and occasion-driven rows; the Reflection week is local
|
|
2037
|
+
|
|
2038
|
+
- **The false amber.** On the owner's store (2026-10-09) the Fired line was amber on "2
|
|
2039
|
+
have gone quiet": `prospective.plain` (last 09-28, total 2) and
|
|
2040
|
+
`physics.upgrade.census` (total 1). The first fires only when a plain reminder falls
|
|
2041
|
+
due, and none did that week; the second runs once by design. Neither is a wiring
|
|
2042
|
+
fault, and the fix text said one was likely. The registry learned two kinds
|
|
2043
|
+
(`fired.ts#Cadence`): a one-time job that ran is `done`, and an occasion-driven row
|
|
2044
|
+
whose occasion has not come is `waiting`. Neither can be `quiet`, so neither reaches
|
|
2045
|
+
`wentQuiet`. The roll-call now counts both. The never-fired count never fed the
|
|
2046
|
+
colour, only the words; the owner-action and failure rows have moved from it to
|
|
2047
|
+
`waiting`. The classification is listed in `cli/NOTES.md` (same date).
|
|
2048
|
+
- **The one occasion the store can see stays a finding.** For a plain reminder,
|
|
2049
|
+
`fired.ts#plainDueReading` asks whether one fell due this week on a day a session ran
|
|
2050
|
+
(a briefing handed over or a turn decided, after the memory existed; today left out
|
|
2051
|
+
because its sessions may still say it) and was not said. If so, the row keeps
|
|
2052
|
+
`quiet`/`never`, is named in `FiredReport.missedOccasion`, and doctor grades amber on
|
|
2053
|
+
that list as on `wentQuiet` and `wentBlocked`, with a fix that says the occasion came.
|
|
2054
|
+
The beat rule is `Prospective#plainDue`'s restated as a read, because that method
|
|
2055
|
+
refuses an observer: if `prospective/` changes its beats, this copy has to follow.
|
|
2056
|
+
It reads memories, so `firedReport(…, { probes: false })` skips it with the probes and
|
|
2057
|
+
the row reads `waiting` (no caller in `src/` turns the probes off today).
|
|
2058
|
+
- **"A session ran" means one a person could be told something in** (review of #337).
|
|
2059
|
+
The headless nightly run, `claude -p` and Agent SDK sessions write a briefing row and
|
|
2060
|
+
turns too, but are never handed a plain reminder (`isInteractive`, `nightRun`), so
|
|
2061
|
+
counting them read every day the night run came as a day a reminder went unsaid. The
|
|
2062
|
+
briefing row (`adapter.wake.injected`) now carries `interactive`, the same test that
|
|
2063
|
+
decides plain delivery; a row from before the field is asked of the session registry's
|
|
2064
|
+
`entrypoint`, and a session nothing is known about reads as a person's. Desktop's
|
|
2065
|
+
`wake` tool writes no briefing row, so a Desktop-only day is never counted (it can
|
|
2066
|
+
hide a miss there, never invent one).
|
|
2067
|
+
- **What the owner's line says now (by reasoning, not run against his store).** Census
|
|
2068
|
+
`done`, plain `waiting` (nothing plain was due 10-03..10-08), so `wentQuiet` is empty
|
|
2069
|
+
and the line is green. "13 have never fired" drops by however many of those thirteen
|
|
2070
|
+
are now occasion rows (export, removal record, unmerge, snapshot failure, worker
|
|
2071
|
+
trouble, core demotion, declared replacement, dedup, and any of protection, revision,
|
|
2072
|
+
contradictions, result cut, quiet reminder fire); they read as waiting instead.
|
|
2073
|
+
- **The Reflection line's week started at UTC midnight** (`Date.parse(today +
|
|
2074
|
+
"T00:00:00Z") - 6 days`). It now starts at local midnight six days back in the
|
|
2075
|
+
reading's zone (`time.ts#startOfLocalDay`, new). In Denver the old window counted a
|
|
2076
|
+
return from the evening before the week; in Kiritimati it missed the week's first
|
|
2077
|
+
fourteen hours. Both are tested through the config's `timeZone`, so they fail on the
|
|
2078
|
+
old line on any machine. Two other `T00:00:00Z` parses in this file were left: the
|
|
2079
|
+
page writer's `calendarDaysSince` subtracts two such instants, which is date arithmetic
|
|
2080
|
+
and zone-free, and `futureNamesIn` compares snapshot folder names, which are UTC by
|
|
2081
|
+
design (`snapshots.ts`).
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* trivia and may change with the host without touching a core contract (G9).
|
|
14
14
|
*/
|
|
15
15
|
import { readFileSync } from "node:fs";
|
|
16
|
+
import { homedir } from "node:os";
|
|
16
17
|
import { resolve } from "node:path";
|
|
17
18
|
import { fileURLToPath } from "node:url";
|
|
18
19
|
|
|
@@ -57,6 +58,8 @@ import {
|
|
|
57
58
|
import type { SaysSoHook, StandDownFault } from "../standdown.js";
|
|
58
59
|
import { readTranscript } from "../transcript.js";
|
|
59
60
|
import { scriptArgs } from "../../runtime.js";
|
|
61
|
+
import { npmWiring } from "../../host-wiring.js";
|
|
62
|
+
import { ensureFirstRun, hookGate, runningAsPlugin } from "../../plugin.js";
|
|
60
63
|
|
|
61
64
|
/**
|
|
62
65
|
* The host's own spellings of the two events that carry a notice — one
|
|
@@ -555,13 +558,40 @@ async function main(): Promise<void> {
|
|
|
555
558
|
wroteStdout: false,
|
|
556
559
|
didWork: false,
|
|
557
560
|
};
|
|
561
|
+
// THE PLUGIN'S PREAMBLE (`adapters/plugin.ts`), and only when Claude Code
|
|
562
|
+
// launched this process as the Counterparts plugin. Two questions before
|
|
563
|
+
// anything opens: is the npm install's wiring live in this host (then the
|
|
564
|
+
// plugin stands down, and says so once, at session start), and does this
|
|
565
|
+
// machine have an install at all (then the plugin makes one, the way
|
|
566
|
+
// `counterparts install` does). A settings-wired hook never gets here.
|
|
567
|
+
const pluginLines: string[] = [];
|
|
568
|
+
if (runningAsPlugin(process.env)) {
|
|
569
|
+
const home = homedir();
|
|
570
|
+
const projectDir = process.env["CLAUDE_PROJECT_DIR"] ?? eventDirectory(payload);
|
|
571
|
+
const gate = hookGate(npmWiring({ home, env: process.env, cwd: projectDir, read: { mcp: false } }), home);
|
|
572
|
+
if (gate.standDown) {
|
|
573
|
+
process.stderr.write("[counterparts] plugin hook stood down: the npm install's hooks are live in this host\n");
|
|
574
|
+
if (name === "session-start" && gate.line !== null) process.stdout.write(JSON.stringify({ systemMessage: gate.line }));
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
if (gate.line !== null) pluginLines.push(gate.line);
|
|
578
|
+
try {
|
|
579
|
+
const first = ensureFirstRun({ choice, env: process.env, home });
|
|
580
|
+
if (first.detail !== undefined) process.stderr.write(`[counterparts] plugin first run ${first.state}: ${first.detail}\n`);
|
|
581
|
+
if (first.line !== null) pluginLines.push(first.line);
|
|
582
|
+
} catch (err) {
|
|
583
|
+
// A first run that threw is a stand-down further on (no configuration,
|
|
584
|
+
// so the default store's guard decides), never a failed session.
|
|
585
|
+
process.stderr.write(`[counterparts] plugin first run threw: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
558
588
|
// THE FAULT HANDLER, HERE RATHER THAN AT THE ENTRY POINT, because this is
|
|
559
589
|
// where the event's own facts are in scope — which hook, which session, which
|
|
560
590
|
// store — and all three are needed to say a stand-down out loud once. The
|
|
561
591
|
// entry point's handler below stays exactly what it was: the last resort for
|
|
562
592
|
// anything that fails before any of this is known.
|
|
563
593
|
try {
|
|
564
|
-
await runHook(name, payload, choice, said);
|
|
594
|
+
await runHook(name, payload, choice, said, pluginLines);
|
|
565
595
|
} catch (err) {
|
|
566
596
|
// MASTER'S EXIT CODE, RESTORED EXACTLY. On master a throw out of `main`
|
|
567
597
|
// reached the entry point's rejection handler, which always exits 0 — so a
|
|
@@ -588,6 +618,9 @@ async function runHook(
|
|
|
588
618
|
payload: Record<string, unknown>,
|
|
589
619
|
choice: ConfigChoice,
|
|
590
620
|
said: Said,
|
|
621
|
+
/** The plugin's own session-start lines (first run, stale npm entries);
|
|
622
|
+
* empty for every hook the plugin did not launch. */
|
|
623
|
+
pluginLines: readonly string[] = [],
|
|
591
624
|
): Promise<void> {
|
|
592
625
|
// `namedConfigRefusal` covers the flag's own refusals AND the one the first
|
|
593
626
|
// review of this rule found: an absolute path to a file that is not there was
|
|
@@ -787,7 +820,7 @@ async function runHook(
|
|
|
787
820
|
name,
|
|
788
821
|
result,
|
|
789
822
|
payload,
|
|
790
|
-
name === "session-start" ? [adapter.notice(input), trouble] : null,
|
|
823
|
+
name === "session-start" ? [adapter.notice(input), ...pluginLines, trouble] : null,
|
|
791
824
|
adapter,
|
|
792
825
|
input,
|
|
793
826
|
);
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* nobody needed).
|
|
33
33
|
*/
|
|
34
34
|
import { spawnSync } from "node:child_process";
|
|
35
|
-
import { addDays, isDay, localDate, resolveZone } from "../../core/time.js";
|
|
35
|
+
import { addDays, isDay, localDate, resolveZone, startOfLocalDay } from "../../core/time.js";
|
|
36
36
|
import { existsSync, mkdirSync, rmSync, statSync } from "node:fs";
|
|
37
37
|
import { homedir } from "node:os";
|
|
38
38
|
import { dirname, join } from "node:path";
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
GATE_DEPOSIT_EVENT,
|
|
51
51
|
MCP_OVERSIZE_EVENT,
|
|
52
52
|
MCP_PART_EVENT,
|
|
53
|
+
MCP_SPILLED_EVENT,
|
|
53
54
|
RECALL_CREDIT_EVENT,
|
|
54
55
|
RUNNER_FAILED_EVENT,
|
|
55
56
|
SLEEP_CYCLE_EVENT,
|
|
@@ -139,6 +140,7 @@ import {
|
|
|
139
140
|
writeUpPlan,
|
|
140
141
|
} from "../sessions.js";
|
|
141
142
|
import { DESKTOP_HOST } from "../hosts.js";
|
|
143
|
+
import type { PluginInstallRead } from "../host-wiring.js";
|
|
142
144
|
import { localStamp } from "../../core/time.js";
|
|
143
145
|
import { catchUpOf, catchUpWords } from "./night-catch-up.js";
|
|
144
146
|
import type { AdapterConfig } from "../config.js";
|
|
@@ -1895,6 +1897,15 @@ function authorshipFindings(input: DoctorInput, store: Store, owedReading: OwedS
|
|
|
1895
1897
|
* a standing fact about the build, and ambering on it every morning would train
|
|
1896
1898
|
* its reader to ignore the line that matters.
|
|
1897
1899
|
*
|
|
1900
|
+
* NOT EVERY SILENCE IS ONE (2026-10-09). A one-time job that ran is `done` and
|
|
1901
|
+
* an occasion-driven one whose occasion has not come is `waiting`
|
|
1902
|
+
* (`fired.ts#Cadence`); neither can go quiet, so neither turns this line amber —
|
|
1903
|
+
* the owner's store went amber on a plain reminder that had not fallen due and
|
|
1904
|
+
* on the v8 census, which runs once. The `never` count never fed the colour,
|
|
1905
|
+
* only the words, and the owner-action and failure rows have left it for
|
|
1906
|
+
* `waiting`. The one occasion the store can SEE — a plain reminder due on a day
|
|
1907
|
+
* a session ran — is graded instead: due and not said is amber.
|
|
1908
|
+
*
|
|
1898
1909
|
* THE SESSION-START READING DOES NOT TAKE IT. This is the only group here whose
|
|
1899
1910
|
* SQL is not bounded by a lived day — the roll-call is a question about the
|
|
1900
1911
|
* whole log, and the five table probes cost a query per memory on top — and a
|
|
@@ -1933,6 +1944,8 @@ function firedFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
1933
1944
|
`${shown === report.from ? "this week" : "in that time"}${blocked}, ` +
|
|
1934
1945
|
`${String(c.quiet)} ${c.quiet === 1 ? "has" : "have"} gone quiet, ` +
|
|
1935
1946
|
`${String(c.never)} ${c.never === 1 ? "has" : "have"} never fired, ` +
|
|
1947
|
+
`${String(c.waiting)} ${c.waiting === 1 ? "is" : "are"} waiting for an occasion (an owner's action, a failure, a reminder falling due), ` +
|
|
1948
|
+
`${String(c.done)} one-time ${c.done === 1 ? "job is" : "jobs are"} done, ` +
|
|
1936
1949
|
`${String(c.new)} ${c.new === 1 ? "is" : "are"} too new to grade, ` +
|
|
1937
1950
|
`${String(c.blind)} ${c.blind === 1 ? "records" : "record"} nothing durable at all` +
|
|
1938
1951
|
`${c.disabled + c.retired === 0 ? "" : ` (${String(c.disabled)} stood down, ${String(c.retired)} retired)`}` +
|
|
@@ -1946,6 +1959,8 @@ function firedFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
1946
1959
|
quiet: c.quiet,
|
|
1947
1960
|
never: c.never,
|
|
1948
1961
|
new: c.new,
|
|
1962
|
+
waiting: c.waiting,
|
|
1963
|
+
done: c.done,
|
|
1949
1964
|
blind: c.blind,
|
|
1950
1965
|
disabled: c.disabled,
|
|
1951
1966
|
retired: c.retired,
|
|
@@ -1953,6 +1968,7 @@ function firedFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
1953
1968
|
truncated: report.truncated,
|
|
1954
1969
|
wentQuiet: report.wentQuiet.join("; "),
|
|
1955
1970
|
wentBlocked: report.wentBlocked.join("; "),
|
|
1971
|
+
missedOccasion: report.missedOccasion.join("; "),
|
|
1956
1972
|
young: report.young,
|
|
1957
1973
|
livedDay: report.livedDay,
|
|
1958
1974
|
};
|
|
@@ -1980,7 +1996,7 @@ function firedFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
1980
1996
|
// leaves `wentQuiet` — and without `wentBlocked` this finding would have gone
|
|
1981
1997
|
// GREEN for it. A state that says MORE must never make a diagnostic read
|
|
1982
1998
|
// safer than it did before that state existed.
|
|
1983
|
-
if (report.wentQuiet.length === 0 && report.wentBlocked.length === 0) {
|
|
1999
|
+
if (report.wentQuiet.length === 0 && report.wentBlocked.length === 0 && report.missedOccasion.length === 0) {
|
|
1984
2000
|
return [
|
|
1985
2001
|
finding(
|
|
1986
2002
|
"fired",
|
|
@@ -1996,6 +2012,9 @@ function firedFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
1996
2012
|
report.wentBlocked.length === 0
|
|
1997
2013
|
? ""
|
|
1998
2014
|
: `Fired last week and STOPPED this week: ${report.wentBlocked.join("; ")}`,
|
|
2015
|
+
report.missedOccasion.length === 0
|
|
2016
|
+
? ""
|
|
2017
|
+
: `Its occasion came this week and it did not fire: ${report.missedOccasion.join("; ")}`,
|
|
1999
2018
|
report.wentQuiet.length === 0
|
|
2000
2019
|
? ""
|
|
2001
2020
|
: `Fired last week and not once this week: ${report.wentQuiet.join("; ")}`,
|
|
@@ -2008,7 +2027,9 @@ function firedFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
2008
2027
|
`${roll}. ${changed.join(". ")}`,
|
|
2009
2028
|
report.wentBlocked.length > 0
|
|
2010
2029
|
? `Run: counterparts mechanisms --all — ${STATE_MEANING.blocked}, and the reason on the row names what to fix.`
|
|
2011
|
-
:
|
|
2030
|
+
: report.missedOccasion.length > 0
|
|
2031
|
+
? "Run: counterparts mechanisms --all — the row says what was due and not said; its occasion came, so this silence is the mechanism failing, not resting."
|
|
2032
|
+
: `Run: counterparts mechanisms --all — ${STATE_MEANING.quiet}, which is a wiring fault more often than a verdict.`,
|
|
2012
2033
|
data,
|
|
2013
2034
|
),
|
|
2014
2035
|
];
|
|
@@ -2866,7 +2887,11 @@ export function reflectionFindings(input: DoctorInput, store: Store): Finding[]
|
|
|
2866
2887
|
try {
|
|
2867
2888
|
awake = awakeFeelingCounts(store);
|
|
2868
2889
|
last = store.reflections({ limit: 5 }).find((r) => r.state === "reflected");
|
|
2869
|
-
|
|
2890
|
+
// THE PERSON'S WEEK, not the UTC one (2026-10-09): today and the six local
|
|
2891
|
+
// days before it, from local midnight in the reading's zone. It began at
|
|
2892
|
+
// UTC midnight, so in Denver a return from the evening before the week
|
|
2893
|
+
// counted and in Kiritimati the week's first fourteen hours did not.
|
|
2894
|
+
returns = store.returnCounts({ sinceAt: startOfLocalDay(addDays(input.today, -6), readingZone) });
|
|
2870
2895
|
// Newest first with a named ceiling. The default read was the OLDEST 500
|
|
2871
2896
|
// promotions, so the newest were the ones never counted; a read that comes
|
|
2872
2897
|
// back full has not seen them all, and then the two counts are unknown
|
|
@@ -3073,7 +3098,8 @@ const WAKE_WINDOW_DAYS = 7;
|
|
|
3073
3098
|
|
|
3074
3099
|
/**
|
|
3075
3100
|
* DID THE WAKE ARRIVE (2026-10-02, the "nobody saw it" review). At each
|
|
3076
|
-
* session's first prompt
|
|
3101
|
+
* session's first prompt (or, since 2026-10-08, its first Stop when the host
|
|
3102
|
+
* had not yet written the file) the hook reads the transcript for the wake's tail
|
|
3077
3103
|
* mark and writes one `adapter.wake.delivered` row with the outcome
|
|
3078
3104
|
* (`hooks.ts#wakeOutcome`) — and until now no line read it: a wake the host
|
|
3079
3105
|
* cut short, or that arrived as something else, was green everywhere, along
|
|
@@ -3103,12 +3129,33 @@ export function wakeArrivalFindings(store: Store): Finding[] {
|
|
|
3103
3129
|
return [];
|
|
3104
3130
|
}
|
|
3105
3131
|
const counts: Record<string, number> = {};
|
|
3132
|
+
// A `not-found` splits three ways by what the check could read (2026-10-08).
|
|
3133
|
+
// ABSENT AT THE FIRST PROMPT is not a wake that failed to arrive: since about
|
|
3134
|
+
// 09-25 the host writes the file only after that prompt, so the rows written
|
|
3135
|
+
// before the check learned to wait for the Stop say this. Counted apart, and
|
|
3136
|
+
// out of the "N of M" — those wakes were never checked. ABSENT AT THE STOP
|
|
3137
|
+
// (`checkedAt: "stop"`) is different: no transcript by the end of a turn
|
|
3138
|
+
// means the host did not write one where it said. And UNREADABLE is a file
|
|
3139
|
+
// that was there and could not be opened. Both stay in the "N of M", each
|
|
3140
|
+
// with its own clause; counted, not graded, like `not-found` itself.
|
|
3141
|
+
let unread = 0;
|
|
3142
|
+
let noFile = 0;
|
|
3143
|
+
let unreadable = 0;
|
|
3106
3144
|
for (const row of wakes) {
|
|
3107
|
-
const
|
|
3108
|
-
|
|
3145
|
+
const p = payloadOf(row);
|
|
3146
|
+
const o = str(p, "outcome") ?? "unknown";
|
|
3147
|
+
const transcript = str(p, "transcript");
|
|
3148
|
+
if (o === "not-found" && transcript === "absent") {
|
|
3149
|
+
if (str(p, "checkedAt") === "stop") noFile += 1;
|
|
3150
|
+
else unread += 1;
|
|
3151
|
+
} else if (o === "not-found" && transcript === "unreadable") {
|
|
3152
|
+
unreadable += 1;
|
|
3153
|
+
} else {
|
|
3154
|
+
counts[o] = (counts[o] ?? 0) + 1;
|
|
3155
|
+
}
|
|
3109
3156
|
}
|
|
3110
|
-
const expected = wakes.length - (counts["no-wake-expected"] ?? 0);
|
|
3111
|
-
if (expected <= 0 && !room.any) return [];
|
|
3157
|
+
const expected = wakes.length - (counts["no-wake-expected"] ?? 0) - unread;
|
|
3158
|
+
if (expected <= 0 && unread === 0 && !room.any) return [];
|
|
3112
3159
|
const whole = counts["delivered"] ?? 0;
|
|
3113
3160
|
const cut = counts["truncated"] ?? 0;
|
|
3114
3161
|
const mismatched = counts["mismatch"] ?? 0;
|
|
@@ -3120,6 +3167,9 @@ export function wakeArrivalFindings(store: Store): Finding[] {
|
|
|
3120
3167
|
(mismatched > 0 ? `; ${String(mismatched)} carried another wake's mark (a session resumed after its record was let go)` : "") +
|
|
3121
3168
|
(unverified > 0 ? `; ${String(unverified)} printed but not verifiable on this host build` : "") +
|
|
3122
3169
|
(missing > 0 ? `; ${String(missing)} not found in the transcript` : "") +
|
|
3170
|
+
(noFile > 0 ? `; ${String(noFile)} had no transcript even at the end of the first turn` : "") +
|
|
3171
|
+
(unreadable > 0 ? `; ${String(unreadable)} ${unreadable === 1 ? "transcript" : "transcripts"} could not be read` : "") +
|
|
3172
|
+
(unread > 0 ? `; ${String(unread)} not checked (no transcript to read)` : "") +
|
|
3123
3173
|
room.clauses +
|
|
3124
3174
|
(floor ? ". More rows than were read: the counts are a floor" : "");
|
|
3125
3175
|
const data = {
|
|
@@ -3129,6 +3179,9 @@ export function wakeArrivalFindings(store: Store): Finding[] {
|
|
|
3129
3179
|
mismatch: mismatched,
|
|
3130
3180
|
unverified,
|
|
3131
3181
|
notFound: missing,
|
|
3182
|
+
noTranscriptAtStop: noFile,
|
|
3183
|
+
unreadable,
|
|
3184
|
+
notChecked: unread,
|
|
3132
3185
|
overBudget: room.overBudget,
|
|
3133
3186
|
overCap: room.overCap,
|
|
3134
3187
|
noticeDropped: room.noticeDropped,
|
|
@@ -3255,21 +3308,29 @@ const RESULTS_ROWS = 2_000;
|
|
|
3255
3308
|
* it acted on a bundle it had not read. A run still open is not judged;
|
|
3256
3309
|
* a run begun before parts were logged has no part-1 row and is not
|
|
3257
3310
|
* judged either.
|
|
3311
|
+
* - an `mcp.result.spilled` row (2026-10-09, U14 item 3): the nightly run's
|
|
3312
|
+
* own transcript showed a result of ours that Claude Code replaced with a
|
|
3313
|
+
* short preview — its line is lower than the ceiling now (a remote flag
|
|
3314
|
+
* can lower it), and the server could not see it. AMBER, like the two
|
|
3315
|
+
* above: nothing to do by hand, and the night has already happened.
|
|
3258
3316
|
*
|
|
3259
|
-
* Green says how many runs came in parts
|
|
3260
|
-
*
|
|
3317
|
+
* Green says how many runs came in parts, the largest result handed, and
|
|
3318
|
+
* whether the last night's transcript was read for the host's cut. Silent on a
|
|
3319
|
+
* store whose window holds none of the three rows.
|
|
3261
3320
|
*/
|
|
3262
3321
|
export function resultFindings(store: Store): Finding[] {
|
|
3263
3322
|
const since = Math.max(0, store.livedDay() - RESULTS_WINDOW_DAYS);
|
|
3264
3323
|
let oversize: EventRow[];
|
|
3324
|
+
let spilled: EventRow[];
|
|
3265
3325
|
const runs = new Map<string, { mechanism: string; of: number; fetched: Set<number>; date: string | null }>();
|
|
3266
3326
|
let largest = 0;
|
|
3267
3327
|
let floor = false;
|
|
3268
3328
|
const open = new Set<string>();
|
|
3269
3329
|
try {
|
|
3270
3330
|
oversize = store.eventLog({ name: MCP_OVERSIZE_EVENT, sinceDay: since, order: "desc", limit: RESULTS_ROWS });
|
|
3331
|
+
spilled = store.eventLog({ name: MCP_SPILLED_EVENT, sinceDay: since, order: "desc", limit: RESULTS_ROWS });
|
|
3271
3332
|
const parts = store.eventLog({ name: MCP_PART_EVENT, sinceDay: since, order: "asc", limit: RESULTS_ROWS });
|
|
3272
|
-
floor = oversize.length >= RESULTS_ROWS || parts.length >= RESULTS_ROWS;
|
|
3333
|
+
floor = oversize.length >= RESULTS_ROWS || parts.length >= RESULTS_ROWS || spilled.length >= RESULTS_ROWS;
|
|
3273
3334
|
for (const row of parts) {
|
|
3274
3335
|
const p = payloadOf(row);
|
|
3275
3336
|
const ref = str(p, "ref");
|
|
@@ -3286,7 +3347,7 @@ export function resultFindings(store: Store): Finding[] {
|
|
|
3286
3347
|
} catch {
|
|
3287
3348
|
return [];
|
|
3288
3349
|
}
|
|
3289
|
-
if (oversize.length === 0 && runs.size === 0) return [];
|
|
3350
|
+
if (oversize.length === 0 && runs.size === 0 && spilled.length === 0) return [];
|
|
3290
3351
|
const ceiling = TOOL_RESULT_CEILING.CHARS;
|
|
3291
3352
|
const inParts = [...runs.entries()].filter(([, r]) => r.of > 1);
|
|
3292
3353
|
const unread = inParts
|
|
@@ -3310,6 +3371,41 @@ export function resultFindings(store: Store): Finding[] {
|
|
|
3310
3371
|
: unread
|
|
3311
3372
|
.map((r) => `${r.mechanism === "reflection" ? "reflection" : "dream"} ${r.ref}${r.date === null ? "" : ` (${r.date})`} was handed in ${String(r.of)} parts and finished without part${r.missing.length === 1 ? "" : "s"} ${r.missing.join(", ")}`)
|
|
3312
3373
|
.join("; ");
|
|
3374
|
+
const newestSpill = spilled[0];
|
|
3375
|
+
const sp = payloadOf(newestSpill);
|
|
3376
|
+
const spillTool = (str(sp, "tool") ?? "a tool").replace(/^mcp__counterparts__/, "");
|
|
3377
|
+
const spillRuns = new Set(spilled.map((r) => str(payloadOf(r), "run") ?? "")).size;
|
|
3378
|
+
const spillSaid =
|
|
3379
|
+
newestSpill === undefined
|
|
3380
|
+
? ""
|
|
3381
|
+
: `${String(spilled.length)} ${spilled.length === 1 ? "result" : "results"} of the nightly run${spillRuns > 1 ? ` (${String(spillRuns)} runs)` : ""} reached the model only as Claude Code's short preview — the newest, ${spillTool}${str(sp, "phase") === null ? "" : ` ${str(sp, "phase") as string}`} on ${rowDate(newestSpill) ?? "an unknown day"}${str(sp, "said") === null ? "" : `, at ${str(sp, "said") as string}`}`;
|
|
3382
|
+
// WAS THE LAST NIGHT CHECKED AT ALL (2026-10-09)? Said on the line, green or
|
|
3383
|
+
// amber, so a transcript the host stopped writing where it is looked for is
|
|
3384
|
+
// not silence that reads as "nothing cut". A last run whose own cuts the
|
|
3385
|
+
// amber text already names adds nothing here.
|
|
3386
|
+
let checked = "";
|
|
3387
|
+
let lastTranscript: string | null = null;
|
|
3388
|
+
try {
|
|
3389
|
+
const last = nightRunOf(store);
|
|
3390
|
+
lastTranscript = last?.transcript ?? null;
|
|
3391
|
+
if (last !== null && last.transcript !== undefined && !(last.transcript === "read" && (last.spills ?? 0) > 0)) {
|
|
3392
|
+
checked =
|
|
3393
|
+
last.transcript === "read"
|
|
3394
|
+
? `; the ${last.date} run's transcript showed none of our results cut by Claude Code`
|
|
3395
|
+
: `; the ${last.date} run's transcript ${last.transcript === "absent" ? "was not found where Claude Code keeps sessions" : "could not be read"}, so Claude Code's cut was not checked`;
|
|
3396
|
+
}
|
|
3397
|
+
} catch {
|
|
3398
|
+
/* the line stands without it */
|
|
3399
|
+
}
|
|
3400
|
+
// WHY THE HOST CUT, by the newest cut's shape (review of #330): the
|
|
3401
|
+
// character line, the token line the run pins, or the budget for one turn.
|
|
3402
|
+
const spillShape = str(sp, "shape");
|
|
3403
|
+
const spillFix =
|
|
3404
|
+
spillShape === "turn-budget"
|
|
3405
|
+
? "Nothing to do by hand: the run fetched several results in one turn, and together they passed Claude Code's budget for one turn, so it cut the largest to a preview. Worth reporting with this line."
|
|
3406
|
+
: spillShape === "tokens" || spillShape === "token-cut"
|
|
3407
|
+
? `Nothing to do by hand: Claude Code's token limit on one tool result came out lower than the ${String(TOOL_RESULT_CEILING.HOST_TOKENS)} tokens the nightly run sets it to, so the night read through a keyhole. Worth reporting with this line.`
|
|
3408
|
+
: `Nothing to do by hand: Claude Code's limit on one tool result is lower than the ${String(ceiling)} characters Counterparts keeps them under, so the night read through a keyhole. Worth reporting with this line — the ceiling has to come down to meet it.`;
|
|
3313
3409
|
const data = {
|
|
3314
3410
|
ceiling,
|
|
3315
3411
|
oversize: oversize.length,
|
|
@@ -3318,18 +3414,23 @@ export function resultFindings(store: Store): Finding[] {
|
|
|
3318
3414
|
runsInParts: inParts.length,
|
|
3319
3415
|
runsUnread: unread.length,
|
|
3320
3416
|
largestPart: largest,
|
|
3417
|
+
spilled: spilled.length,
|
|
3418
|
+
newestSpillTool: str(sp, "tool"),
|
|
3419
|
+
lastTranscript,
|
|
3321
3420
|
floor,
|
|
3322
3421
|
};
|
|
3323
|
-
if (overSaid.length > 0 || unreadSaid.length > 0) {
|
|
3422
|
+
if (spillSaid.length > 0 || overSaid.length > 0 || unreadSaid.length > 0) {
|
|
3324
3423
|
return [
|
|
3325
3424
|
finding(
|
|
3326
3425
|
"results",
|
|
3327
3426
|
"amber",
|
|
3328
3427
|
"Tool results",
|
|
3329
|
-
`${window} — ${[overSaid, unreadSaid].filter((x) => x.length > 0).join("; ")}${floor ? ". More rows than were read: the counts are a floor" : ""}`,
|
|
3330
|
-
|
|
3331
|
-
?
|
|
3332
|
-
:
|
|
3428
|
+
`${window} — ${[spillSaid, overSaid, unreadSaid].filter((x) => x.length > 0).join("; ")}${checked}${floor ? ". More rows than were read: the counts are a floor" : ""}`,
|
|
3429
|
+
spillSaid.length > 0
|
|
3430
|
+
? spillFix
|
|
3431
|
+
: overSaid.length > 0
|
|
3432
|
+
? "Nothing to do by hand: the model was told the answer was cut. It means a cap upstream lets a result grow past the ceiling — worth reporting with this line."
|
|
3433
|
+
: "Nothing to do by hand: the next night reads its own bundle. If it repeats, the run is skipping parts — worth reporting with this line.",
|
|
3333
3434
|
data,
|
|
3334
3435
|
),
|
|
3335
3436
|
];
|
|
@@ -3339,7 +3440,7 @@ export function resultFindings(store: Store): Finding[] {
|
|
|
3339
3440
|
"results",
|
|
3340
3441
|
"green",
|
|
3341
3442
|
"Tool results",
|
|
3342
|
-
`${window} — every result under ${String(ceiling)} characters; ${inParts.length === 0 ? "no bundle came in parts" : `${String(inParts.length)} ${inParts.length === 1 ? "bundle" : "bundles"} came in parts, every part read`}; the largest part handed was ${String(largest)} characters${floor ? ". More rows than were read: the counts are a floor" : ""}`,
|
|
3443
|
+
`${window} — every result under ${String(ceiling)} characters; ${inParts.length === 0 ? "no bundle came in parts" : `${String(inParts.length)} ${inParts.length === 1 ? "bundle" : "bundles"} came in parts, every part read`}; the largest part handed was ${String(largest)} characters${checked}${floor ? ". More rows than were read: the counts are a floor" : ""}`,
|
|
3343
3444
|
"",
|
|
3344
3445
|
data,
|
|
3345
3446
|
),
|
|
@@ -4155,6 +4256,9 @@ export interface HostReading {
|
|
|
4155
4256
|
}[];
|
|
4156
4257
|
/** The runtime this console is running under (`runtime.ts#runtimeLabel`). */
|
|
4157
4258
|
readonly consoleRuntime?: string;
|
|
4259
|
+
/** The Counterparts Claude Code plugin, when Claude Code records it
|
|
4260
|
+
* installed (`host-wiring.ts#pluginInstall`); absent or null when not. */
|
|
4261
|
+
readonly plugin?: PluginInstallRead | null;
|
|
4158
4262
|
}
|
|
4159
4263
|
|
|
4160
4264
|
/**
|
|
@@ -4318,6 +4422,33 @@ function hostFindings(reading: HostReading): Finding[] {
|
|
|
4318
4422
|
mcp: reading.mcp,
|
|
4319
4423
|
mcpFile: reading.mcpFile,
|
|
4320
4424
|
};
|
|
4425
|
+
// THE PLUGIN (prototype, 2026-10-09). A plugin install wires nothing in
|
|
4426
|
+
// these files — Claude Code loads its hooks and server from the plugin — so
|
|
4427
|
+
// without this the line told a plugin user "no hook of ours is connected,
|
|
4428
|
+
// run counterparts connect", which would wire the host twice. Enabled and
|
|
4429
|
+
// alone: connected. Enabled beside live npm wiring: the plugin stands down
|
|
4430
|
+
// (`adapters/plugin.ts`), which works, and is said, with both ways out.
|
|
4431
|
+
const plugin = reading.plugin !== undefined && reading.plugin !== null && reading.plugin.enabled ? reading.plugin : null;
|
|
4432
|
+
data["plugin"] = plugin === null ? null : plugin.id;
|
|
4433
|
+
const npmAny = reading.events.length > 0 || reading.mcp;
|
|
4434
|
+
if (plugin !== null && !npmAny) {
|
|
4435
|
+
return [
|
|
4436
|
+
finding(
|
|
4437
|
+
"host",
|
|
4438
|
+
"green",
|
|
4439
|
+
"Claude Code",
|
|
4440
|
+
`connected as the Claude Code plugin (${plugin.id}${plugin.version === null ? "" : ` ${plugin.version}`}): its ${String(total)} hooks and the memory tools load from the plugin`,
|
|
4441
|
+
"",
|
|
4442
|
+
data,
|
|
4443
|
+
),
|
|
4444
|
+
];
|
|
4445
|
+
}
|
|
4446
|
+
const twiceClause =
|
|
4447
|
+
plugin === null ? "" : `ALSO installed as the Claude Code plugin (${plugin.id}), which stands down while this wiring is live`;
|
|
4448
|
+
const twiceFix =
|
|
4449
|
+
plugin === null
|
|
4450
|
+
? ""
|
|
4451
|
+
: `Installed twice: to keep only the plugin, run \`counterparts disconnect\` and restart Claude Code; to keep only this install, run \`claude plugin uninstall ${plugin.id}\`. Same memory either way.`;
|
|
4321
4452
|
const mcpClause = reading.mcp
|
|
4322
4453
|
? `the MCP server is registered in ${reading.mcpFile}`
|
|
4323
4454
|
: reading.mcpUnreadable
|
|
@@ -4325,6 +4456,9 @@ function hostFindings(reading: HostReading): Finding[] {
|
|
|
4325
4456
|
: `no MCP server named "${reading.mcpName}" in ${reading.mcpFile}`;
|
|
4326
4457
|
|
|
4327
4458
|
if (missing.length === 0 && stale.length === 0 && reading.mcp) {
|
|
4459
|
+
if (plugin !== null) {
|
|
4460
|
+
return [finding("host", "amber", "Claude Code", `connected: ${String(total)} hooks and the memory tools; ${twiceClause}`, twiceFix, data)];
|
|
4461
|
+
}
|
|
4328
4462
|
// THE ONE LINE THE PERSON CAME FOR: is my assistant joined up to this
|
|
4329
4463
|
// memory? It says `connected` because that is the verb the command has
|
|
4330
4464
|
// (`counterparts connect`), and it names the two halves — the hooks and the
|
|
@@ -4396,11 +4530,11 @@ function hostFindings(reading: HostReading): Finding[] {
|
|
|
4396
4530
|
: missing.length > 0
|
|
4397
4531
|
? `connected on ${reading.events.join(", ")} but NOT on ${missing.join(", ")}`
|
|
4398
4532
|
: `all ${String(total)} hook events are connected`;
|
|
4399
|
-
const detail = [staleClause, connected, `(${where})`, mcpClause]
|
|
4533
|
+
const detail = [staleClause, connected, `(${where})`, mcpClause, twiceClause]
|
|
4400
4534
|
.filter((s) => s.length > 0)
|
|
4401
4535
|
.join("; ")
|
|
4402
4536
|
.replace("; (", " (");
|
|
4403
|
-
return [finding("host", "amber", "Claude Code", detail, fixes.join(" "), data)];
|
|
4537
|
+
return [finding("host", "amber", "Claude Code", detail, [...fixes, ...(twiceFix.length === 0 ? [] : [twiceFix])].join(" "), data)];
|
|
4404
4538
|
}
|
|
4405
4539
|
|
|
4406
4540
|
// ── the reading ─────────────────────────────────────────────────────────────
|