counterparts 0.3.30 → 0.3.32
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 +148 -0
- package/docs/module-map.md +2 -1
- package/package.json +1 -1
- package/src/adapters/claude-code/bin/runner.ts +12 -5
- package/src/adapters/claude-code/doctor-host.ts +22 -0
- package/src/adapters/claude-code/doctor-self-page.ts +41 -1
- package/src/adapters/claude-code/doctor-upgrades.ts +37 -2
- package/src/adapters/claude-code/doctor.ts +75 -3
- package/src/adapters/claude-code/hooks.ts +68 -3
- package/src/adapters/claude-code/night-run.ts +53 -3
- package/src/adapters/cli/CONTRACT.md +12 -0
- package/src/adapters/cli/commands-project.ts +118 -0
- package/src/adapters/cli/commands.ts +12 -1
- package/src/adapters/cli/help.ts +2 -0
- package/src/adapters/cli/install.ts +4 -1
- package/src/adapters/config.ts +17 -0
- package/src/adapters/dashboard/NOTES.md +34 -0
- package/src/adapters/dashboard/activity.ts +3 -0
- package/src/adapters/dashboard/registries.ts +3 -0
- package/src/adapters/dashboard/web/README.md +2 -2
- package/src/adapters/dashboard/web/app.html +2 -0
- package/src/adapters/dashboard/web/flow.ts +1 -0
- package/src/adapters/dashboard/web/lanes.ts +3 -0
- package/src/adapters/dashboard/web/narrate.ts +27 -2
- package/src/adapters/dashboard/web/pages/self/index.js +1 -0
- package/src/adapters/dashboard/web/pages/self/self.css +3 -0
- package/src/adapters/dashboard/web/pages/subjects/index.js +295 -0
- package/src/adapters/dashboard/web/pages/subjects/subjects.css +67 -0
- package/src/adapters/dashboard/web/server.ts +17 -0
- package/src/adapters/dashboard/web/shared/memory-modal.js +12 -0
- package/src/adapters/dashboard/web/shared/modal.css +4 -0
- package/src/adapters/dashboard/web/shell/pages.js +2 -1
- package/src/adapters/dashboard/web/views/memory.ts +37 -0
- package/src/adapters/dashboard/web/views/subjects.ts +614 -0
- package/src/adapters/dashboard/web/views.ts +2 -0
- package/src/adapters/fired.ts +3 -0
- package/src/adapters/host-wiring.ts +109 -10
- package/src/adapters/lifecycle.ts +4 -0
- package/src/adapters/mcp/CONTRACT.md +23 -0
- package/src/adapters/mcp/INTERFACE-GAPS.md +2 -2
- package/src/adapters/mcp/NOTES.md +34 -0
- package/src/adapters/mcp/facts.ts +3 -2
- package/src/adapters/mcp/server-args.ts +51 -1
- package/src/adapters/mcp/server-self-tools.ts +75 -4
- package/src/adapters/mcp/server-session-end.ts +11 -1
- package/src/adapters/mcp/server-words.ts +1 -1
- package/src/adapters/mcp/server.ts +47 -1
- package/src/adapters/mcp/tools.ts +116 -11
- package/src/adapters/plugin.ts +17 -3
- package/src/core/counterpart-boundary.ts +65 -6
- package/src/core/counterpart-deposit.ts +49 -2
- package/src/core/counterpart-events.ts +35 -1
- package/src/core/counterpart-projects.ts +198 -0
- package/src/core/counterpart-sweep.ts +4 -1
- package/src/core/counterpart-types.ts +24 -0
- package/src/core/counterpart.ts +305 -14
- package/src/core/dream/CONTRACT.md +58 -1
- package/src/core/dream/NOTES.md +139 -0
- package/src/core/dream/index.ts +38 -3
- package/src/core/dream/project-ask.ts +242 -0
- package/src/core/dream/reflect.ts +900 -30
- package/src/core/dream/tags.ts +346 -0
- package/src/core/dream/tunables.ts +42 -0
- package/src/core/dream/unmarked.ts +3 -2
- package/src/core/handoff/last-here.ts +4 -2
- package/src/core/mint.ts +2 -0
- package/src/core/onboarding.ts +6 -5
- package/src/core/physics/CONTRACT.md +84 -0
- package/src/core/physics/NOTES.md +50 -0
- package/src/core/physics/index.ts +282 -6
- package/src/core/recall/CONTRACT.md +60 -0
- package/src/core/recall/NOTES.md +77 -0
- package/src/core/recall/activate.ts +43 -1
- package/src/core/recall/gate.ts +70 -6
- package/src/core/recall/index.ts +179 -11
- package/src/core/recall/prime.ts +64 -22
- package/src/core/recall/probe.ts +5 -2
- package/src/core/recall/rated.ts +25 -10
- package/src/core/recall/render.ts +79 -11
- package/src/core/recall/session.ts +20 -1
- package/src/core/recall/tunables.ts +84 -0
- package/src/core/reconsolidation.ts +40 -6
- package/src/core/remember/proposals.ts +9 -0
- package/src/core/retrieval.ts +19 -1
- package/src/core/revision.ts +41 -2
- package/src/core/schemas/CONTRACT.md +57 -4
- package/src/core/schemas/INTERFACE-GAPS.md +5 -0
- package/src/core/schemas/NOTES.md +173 -0
- package/src/core/schemas/index.ts +727 -30
- package/src/core/schemas/tags.ts +418 -0
- package/src/core/schemas/tunables.ts +94 -0
- package/src/core/schemas/types.ts +109 -0
- package/src/core/seat.ts +4 -2
- package/src/core/self/CONTRACT.md +22 -1
- package/src/core/self/INTERFACE-GAPS.md +2 -1
- package/src/core/self/NOTES.md +265 -0
- package/src/core/self/identity.ts +103 -10
- package/src/core/self/index.ts +13 -2
- package/src/core/self/measures.ts +161 -0
- package/src/core/self/tunables.ts +114 -0
- package/src/core/self/work.ts +276 -33
- package/src/core/self/writer.ts +8 -1
- package/src/core/sleep/CONTRACT.md +6 -1
- package/src/core/sleep/INTERFACE-GAPS.md +6 -0
- package/src/core/sleep/NOTES.md +101 -0
- package/src/core/sleep/births.ts +7 -1
- package/src/core/sleep/consolidate.ts +14 -2
- package/src/core/sleep/cycle.ts +140 -9
- package/src/core/sleep/index.ts +4 -0
- package/src/core/sleep/lease.ts +187 -0
- package/src/core/sleep/tags.ts +62 -0
- package/src/core/sleep/tunables.ts +20 -0
- package/src/core/sleep/types.ts +47 -0
- package/src/core/store/CONTRACT.md +23 -6
- package/src/core/store/NOTES.md +141 -0
- package/src/core/store/errors.ts +6 -0
- package/src/core/store/index.ts +571 -20
- package/src/core/store/marks.ts +6 -2
- package/src/core/store/operational.ts +474 -8
- package/src/core/store/owner-op-seam.ts +50 -1
- package/src/core/store/reads-marks.ts +7 -0
- package/src/core/store/reads-memories.ts +152 -1
- package/src/core/store/shapes.ts +16 -1
- package/src/core/store/tag-reads.ts +226 -0
- package/src/core/store/wave2.ts +380 -0
- package/src/core/tag-screen.ts +51 -0
- package/src/core/types.ts +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,153 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.32 — 2026-10-22
|
|
4
|
+
|
|
5
|
+
The sidebar is now a plugin of its own, `counterparts-sidebar`, and `counterparts` is the memory alone. If you use the plugin, the update (`/plugin marketplace update counterparts`) removes the sidebar; `/plugin install counterparts-sidebar@counterparts` brings it back, starting from the default view, theme and avatar. With the npm install beside both plugins, doctor's Claude Code line is green: the plugin stays installed for the sidebar and stands down. Open threads change meaning: an item is open only when someone owes an answer (a question to you, a check with a date, a promise), and one nobody has touched in 21 lived days, with no date and not a question you were asked, stops being carried in the wake and offered to the reflection; it is not closed, and using or revising it carries it again. **The first morning after upgrading counts the whole untouched backlog at once**, so that morning's share may say a large number left; it says the number once, never the list. Beliefs now show: the strongest two or three about a person, project or topic a message names come up beside the footnotes, and a project's folder may open with a short line of them. Doctor gains a Builds line. The core from beliefs is built and off (`self.CORE_FROM_BELIEFS`). No store-format change (store v14, cache v7), no wiring change: `counterparts connect` is not needed after upgrading. Restart the dashboard and every Claude Code session afterwards so the long-running memory server and dashboard load the new version.
|
|
6
|
+
|
|
7
|
+
- **The sidebar is a plugin of its own: `counterparts-sidebar`.** `counterparts` is now the
|
|
8
|
+
memory alone (hooks, memory server, commands); the pane beside the chat comes with
|
|
9
|
+
`/plugin install counterparts-sidebar@counterparts`, which installs `counterparts` too
|
|
10
|
+
if it isn't there. If you already have the plugin, `claude plugin update
|
|
11
|
+
counterparts@counterparts` moves you to memory alone and the sidebar goes until you
|
|
12
|
+
install it; installing the sidebar before that update stops and tells you to run it, so
|
|
13
|
+
you never get two panes. The sidebar starts with the default view, theme and avatar.
|
|
14
|
+
With the npm install, adding the sidebar plugin gives one pane and every memory tool
|
|
15
|
+
once, as before.
|
|
16
|
+
- **Doctor beside the sidebar plugin.** With the npm install, the `counterparts` plugin and
|
|
17
|
+
the `counterparts-sidebar` plugin (the way to get the sidebar with the npm install), doctor's
|
|
18
|
+
Claude Code line is green now: it says the plugin is installed for the sidebar, which needs
|
|
19
|
+
it, and stands down. It is amber only when both installs really run (a plugin build that
|
|
20
|
+
doesn't stand down), and then it says to update the plugin, never to uninstall it. The
|
|
21
|
+
plugin's one session-start line there says the same: nothing needs to change.
|
|
22
|
+
- **The first meeting's close** names `/counterparts` only where a sidebar answers it: with
|
|
23
|
+
the sidebar plugin (installed, on, and with a `counterparts` it accepts), or a
|
|
24
|
+
`counterparts` plugin from before the split. That now includes the npm install beside
|
|
25
|
+
the sidebar plugin.
|
|
26
|
+
- **"Open" now means someone owes an answer.** A memory is marked open only for a question to
|
|
27
|
+
you, a check with a date, or a promise; a bug note, a design note or a fact is kept without
|
|
28
|
+
the open flag. The end-of-session ask says so too.
|
|
29
|
+
- **The end-of-session ask names that session's own open items**, by title, up to five, so
|
|
30
|
+
closing one is a glance at a line rather than a search. A session with nothing open sees the
|
|
31
|
+
ask as before.
|
|
32
|
+
- **Open items nobody has touched in three weeks stop being carried** (an experiment). One with
|
|
33
|
+
no date and not a question you were asked, untouched for 21 lived days, leaves the wake's
|
|
34
|
+
"Still open" and its count, and the nightly reflection stops being offered it. It is not
|
|
35
|
+
closed: recall still finds it, and using it (rating it, drawing on it) or revising it carries
|
|
36
|
+
it again; only seeing it again in a footnote does not. The morning share says how many left,
|
|
37
|
+
once, never the list.
|
|
38
|
+
- **What I believe about something comes up when you mention it.** When a message names a person,
|
|
39
|
+
project or topic I hold beliefs about, the strongest two or three appear in their own short
|
|
40
|
+
block beside the usual footnotes, each with how sure I am and how many memories back it. Rating
|
|
41
|
+
one counts as using it, never as evidence for it.
|
|
42
|
+
- **A project's folder opens with what I hold about the project** (an experiment): a short line of
|
|
43
|
+
its strongest beliefs at the foot of the wake, only when there is room left.
|
|
44
|
+
- **Tags help warm up related memories.** Memories sharing a tag with what a session is using get
|
|
45
|
+
a small head start in recall, beside the links that already do.
|
|
46
|
+
- **Doctor names the builds this store has run.** Each new version, the first time it
|
|
47
|
+
opens the store, notes the day it arrived, and what it writes (memories, the night's
|
|
48
|
+
rows, the log) carries its version, so a later look can say which build did what.
|
|
49
|
+
Doctor's new green Builds line lists the last three. Nothing else changes; a `"build"`
|
|
50
|
+
key now shows wherever a row is printed raw (`--json`, exports, the dashboard's raw rows).
|
|
51
|
+
- **The core from beliefs, built and off.** With `self.CORE_FROM_BELIEFS` on, the night's
|
|
52
|
+
reflection would state as settled in the core only what a well-backed belief about me or
|
|
53
|
+
us says. It is off (a code tunable, not a setting), so nothing about the core changes in
|
|
54
|
+
this release.
|
|
55
|
+
- **For code that embeds Counterparts:** new exports, nothing removed. `counterparts`
|
|
56
|
+
adds `beliefCoreCandidates`, `coreBeliefFloors`, `coreBeliefMiss`, `coreFromBeliefs` and
|
|
57
|
+
`livedSupportDays`; `counterparts/store` adds `BUILD_LOG_PREFIX`, `BUILD_UNKNOWN`,
|
|
58
|
+
`buildLogKeys`, `parseBuildLog`, `readBuildFrom`, `runningBuild`, `setRunningBuild`,
|
|
59
|
+
`setSettingsInForce`, `settingsInForce` and `withBuild`.
|
|
60
|
+
|
|
61
|
+
## 0.3.31 — 2026-10-22
|
|
62
|
+
|
|
63
|
+
This release changes the store's format (v13 to v14), so **after installing, quit the dashboard and every open Claude Code session, then start them again**: one left running from before the update keeps the old code against the upgraded store and stops working on it (the dashboard answers with errors) until it is restarted; an older version that opens the store afresh refuses it plainly. The first open saves a copy of your store before upgrading it, and doctor gains one green line saying what the upgrade did. Going back to 0.3.30 is `counterparts rollback` (it puts that copy back; anything written since is set aside, not deleted), then 0.3.30's install and `counterparts connect` as it prints. What you will see: the dashboard has a subjects tab, a page for every person, project, place and topic your memories name, under a tag cloud. Memories can carry a few tags, and each night tidies them and, in a short separate step on a small model, tags memories that have none and sorts cards into person, project, place or topic. The night's reflection and dream start forming beliefs from real memories; nothing shows them in sessions, the wake or the core yet. Related folders can be one project (`counterparts project join`, or a yes when the morning share asks), and craft learned in one folder takes turns in every folder's "Work here"; work from another project needs a slightly stronger match to come up while you talk. Two fixes: one nightly cycle at a time per store, and a name no longer gets two cards (cards already doubled stay doubled for now). The night's tag work and the beliefs are each one switch in the tunables (`schemas.TAGS_NIGHT`, `schemas.BELIEFS_BIRTH`), both on. Store v14, cache v7 unchanged; no wiring change, so `counterparts connect` is not needed after upgrading.
|
|
64
|
+
|
|
65
|
+
- **The store moves to schema v14, room for what comes next.** The first open after the
|
|
66
|
+
upgrade saves a copy of your store first, as every upgrade does, then adds empty places
|
|
67
|
+
for tags, beliefs and what supports them, which project a folder belongs to, and what
|
|
68
|
+
each recall showed; nothing uses them yet. People and places among your cards are marked
|
|
69
|
+
as such, and so are new ones as they are made. The old confidential column is removed,
|
|
70
|
+
after the memories still marked are counted (the count `counterparts doctor` already
|
|
71
|
+
shows). Doctor has one green line saying what the upgrade did.
|
|
72
|
+
- **Restart what was left running across this update.** An older version refuses the
|
|
73
|
+
upgraded store when it opens it, but one that already had it open does not: a dashboard
|
|
74
|
+
or a Claude Code session started before the update stops working on it (the dashboard
|
|
75
|
+
answers with errors) until it is restarted. The way back to the older version is the
|
|
76
|
+
saved copy (`counterparts rollback`).
|
|
77
|
+
- **Memories can carry a few tags.** `remember` and each `session_end` entry take an
|
|
78
|
+
optional `tags` list — a few words for what the memory is about (a topic, a person, a
|
|
79
|
+
project). They are stored with the memory; a revision keeps its memory's tags unless it
|
|
80
|
+
sends its own. Nothing about recall changes yet: the tags are the start of topics that
|
|
81
|
+
grow into subjects.
|
|
82
|
+
- **A subjects tab on the dashboard.** Every person, project, place and topic your memories
|
|
83
|
+
name has a page: its kind, name and other names, what I believe about it (each belief with
|
|
84
|
+
how strongly it is held, how many memories hold it up and those memories, one tap away),
|
|
85
|
+
what it often comes up with, and the newest memories that mention it. `#subjects/me` is the
|
|
86
|
+
page of what I believe about myself and about us, linked from the self tab. Above them, an
|
|
87
|
+
old-school tag cloud: subjects in bright type (tap to open the page), tags beside them (tap
|
|
88
|
+
to see their memories), each sized by the memories behind it; point at a word to light up
|
|
89
|
+
the words it comes up with. Until memories carry tags, the cloud is the subjects alone. A
|
|
90
|
+
memory card for a subject, or a belief about one, links to the page. Nothing here writes.
|
|
91
|
+
- **Beliefs can be earned.** A belief now starts weak, whoever writes it, and grows only
|
|
92
|
+
as lived memories back it: your own words about it, my real choices, use at work, and
|
|
93
|
+
older memories a reflection connects (a little less, until life echoes them). Each memory
|
|
94
|
+
counts once per belief, and memories from the same day, conversation or folder count less.
|
|
95
|
+
A memory that goes against a belief presses on it the way a correction always has. Nothing
|
|
96
|
+
writes beliefs yet, and none are shown anywhere: not in recall, not in the wake, not in
|
|
97
|
+
the core.
|
|
98
|
+
- **Folders can be one project, and craft follows you.** `counterparts project join <folder>
|
|
99
|
+
<project>` puts related folders (say a product and its website) in one project, and each
|
|
100
|
+
one's wake then shows the work of all of them under "Work here" — the folder you are in
|
|
101
|
+
keeps at least half the lines; a folder set off or paused shares nothing. A skill written
|
|
102
|
+
from now on with no mark (or marked world) is craft: a couple of places in every folder's
|
|
103
|
+
"Work here" take turns showing craft learned elsewhere, saying where, from folders whose
|
|
104
|
+
setting is on. Skills written before keep their folder. `counterparts project list` and `leave` read
|
|
105
|
+
and undo it. Off: `PROJECTS_TRAVEL` in the self tunables.
|
|
106
|
+
- **The night tidies tags and grows topics from them.** Each night, memories linked to a
|
|
107
|
+
person's or project's card carry its name as a tag; tags that are the same word in another
|
|
108
|
+
form are merged; and a short separate step on a small model tags memories that have none,
|
|
109
|
+
asks whether two look-alike tags are one topic, and sorts cards into person, project,
|
|
110
|
+
place or topic. A tag that keeps coming up — on several days, in several sessions, more
|
|
111
|
+
so when it was used or felt — becomes a topic of its own. Recall and the wake don't use
|
|
112
|
+
tags or topics yet.
|
|
113
|
+
- **Another project's work comes to mind a little less readily.** While you talk, a memory
|
|
114
|
+
that is work from a folder outside this folder's project needs a slightly stronger match
|
|
115
|
+
to come up (`CROSS_PROJECT_BAR_LIFT`, 1.25; 1 turns it off). Personal things and craft
|
|
116
|
+
are not affected, and a folder joined to this one's project counts as here. The recall
|
|
117
|
+
record counts what the higher bar held back, for a review after a week. A stricter
|
|
118
|
+
switch that leaves such work out entirely (`RECALL_BY_PROJECT`) is built and off.
|
|
119
|
+
- **The night may ask whether two folders are one project.** When two folders were worked
|
|
120
|
+
in on the same days and their memories name the same things, the morning share asks once
|
|
121
|
+
whether to treat them as one project; a yes joins them (as `counterparts project join`
|
|
122
|
+
would), a no is left alone for a week. Off: `PROJECT_JOIN_ASK` in the dream tunables.
|
|
123
|
+
- **The night's reflection starts forming beliefs.** After a dream, the reflection is shown
|
|
124
|
+
what I hold about the people and things in play, and about me and us, and may back a
|
|
125
|
+
belief with a memory that fits, note a memory that goes against one, or write a few new
|
|
126
|
+
ones, each resting on real memories and starting weak. A belief that met more against
|
|
127
|
+
it than for it can be let go. Beliefs are still not shown in sessions, the wake or the
|
|
128
|
+
core. Off: `BELIEFS_BIRTH` in the schemas tunables (a code tunable, not a setting).
|
|
129
|
+
- **Beliefs from the dream, from the moment, and the owner's word.** The dream may now
|
|
130
|
+
suggest a belief it sees across several memories; it never makes one, and the morning's
|
|
131
|
+
reflection keeps it or lets it go. A session can write one in the moment, rarely, from
|
|
132
|
+
the owner's own words, a real choice, or a strongly felt moment. And when the owner says
|
|
133
|
+
a belief is wrong, it is let go at once, its history kept. Beliefs are still not shown in
|
|
134
|
+
sessions, the wake or the core.
|
|
135
|
+
- **One nightly cycle at a time.** When a session closed, its two end-of-session workers
|
|
136
|
+
could both run the night's cycle at once: the card births ran twice (the doubled cards)
|
|
137
|
+
and the wake was rendered twice. The cycle now holds the memory while it runs, and a
|
|
138
|
+
second worker that arrives meanwhile still saves its associations, then leaves the cycle
|
|
139
|
+
to the first, at once, and says so in the log. A worker that died mid-cycle gives way
|
|
140
|
+
after ten minutes, and the next cycle finishes its work.
|
|
141
|
+
- **A name no longer gets two cards.** When a session closed, its two end-of-session
|
|
142
|
+
workers could both run the night's card births at once, and each gave the same names a
|
|
143
|
+
card of its own: Google and Google, Bash and Bash, all with the same birth day. A card is
|
|
144
|
+
now born only after checking, with the store locked, that no other process has just made
|
|
145
|
+
it. Cards already doubled stay doubled for now; merging them comes separately.
|
|
146
|
+
- **For code that embeds Counterparts:** new exports, nothing removed. `counterparts`
|
|
147
|
+
adds `SLEEP_CYCLE_HELD_EVENT`; `counterparts/store` adds `BIRTH_ROUTES`,
|
|
148
|
+
`CRAFT_BORN_META`, `SUBJECT_KINDS`, `V14_UPGRADE_KEY`, `backfillSubjectKinds`,
|
|
149
|
+
`normalizeTag` and `retireConfidentialColumn`.
|
|
150
|
+
|
|
3
151
|
## 0.3.30 — 2026-10-21
|
|
4
152
|
|
|
5
153
|
Nothing is held back from your sessions any more. Confidential memories are gone: nothing in Counterparts could set that mark, so on most stores nothing changes on screen; a memory marked that way through the store directly now reads like any other everywhere, and doctor shows one amber line with how many remain only if your store had any. The split between your sessions and guest ones is gone too: any session, a Claude Desktop chat and the nightly run included, can close a thread or a reminder by its id from any folder (a protected memory still never closes), and every session gets its folder's "Last said here"; observer stays read-only. The nightly run no longer leaves a Claude Code transcript under `~/.claude/projects/`; transcripts from earlier nights are left to Claude Code's own cleanup, or you can delete the folder named after your memory store. The `owner` line in your configuration is now ignored and doctor names it under "Old settings" (you may delete it); `export --include-confidential`, the memory server's `--owner` and `COUNTERPARTS_OWNER` are accepted and ignored for this release. Code that embeds Counterparts loses the confidential fields and options listed below. No store-format change (store v13, cache v7) and no wiring change: nothing to run after upgrading from 0.3.29, and `counterparts connect` is not needed.
|
package/docs/module-map.md
CHANGED
|
@@ -67,7 +67,8 @@ boundary, the sweep fallback and the deposit in `counterpart-boundary.ts`,
|
|
|
67
67
|
`counterpart-sweep.ts` and `counterpart-deposit.ts`. `core/store/index.ts` keeps the class
|
|
68
68
|
and every write; `marks.ts`, `shapes.ts` and `index-text.ts` hold its marks, shapes and
|
|
69
69
|
index text, and `reads-memories.ts`, `reads-marks.ts` and `reads-history.ts` the bodies of
|
|
70
|
-
its public reads
|
|
70
|
+
its public reads; `wave2.ts` holds the bodies of the v14 tables' reads and writes (each write
|
|
71
|
+
entered through the class's `mutate`). `mcp/server.ts` keeps the class; `server-words.ts`, `server-options.ts`
|
|
71
72
|
and `server-args.ts` hold its words, options and argument readers, and
|
|
72
73
|
`server-session-end.ts` and `server-self-tools.ts` the bodies of five of its tools.
|
|
73
74
|
`cli/commands.ts` keeps the dispatcher, the help, and the repair that reads through the
|
package/package.json
CHANGED
|
@@ -463,11 +463,18 @@ export async function runOnce(input: {
|
|
|
463
463
|
} catch {
|
|
464
464
|
/* the held page stays on its refusal row for the next boundary */
|
|
465
465
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
466
|
+
// NOT WHEN THE CYCLE STOOD ASIDE (`sleep/lease.ts`, review of #581): the
|
|
467
|
+
// cycle holding the store renders the wake, and this worker's refresh
|
|
468
|
+
// would render it a second time beside it.
|
|
469
|
+
if (report.cycle.held === undefined) {
|
|
470
|
+
try {
|
|
471
|
+
const wake = counterpart.refreshWake({ at: today });
|
|
472
|
+
if (wake.reason !== "current") emit("runner.wake", { reason: wake.reason, triggers: wake.triggers.join(","), bytes: wake.bytes });
|
|
473
|
+
} catch (err) {
|
|
474
|
+
noteFailure(counterpart, emit, err instanceof Error ? err.name : "UNKNOWN", "wake", today);
|
|
475
|
+
}
|
|
476
|
+
} else {
|
|
477
|
+
emit("runner.wake", { reason: "held-elsewhere", triggers: "", bytes: 0 });
|
|
471
478
|
}
|
|
472
479
|
result = {
|
|
473
480
|
ran: true,
|
|
@@ -83,6 +83,9 @@ export interface HostReading {
|
|
|
83
83
|
/** The Counterparts Claude Code plugin, when Claude Code records it
|
|
84
84
|
* installed (`host-wiring.ts#pluginInstall`); absent or null when not. */
|
|
85
85
|
readonly plugin?: PluginInstallRead | null;
|
|
86
|
+
/** Claude Code records a `counterparts-sidebar@…` install, which needs the
|
|
87
|
+
* plugin (`host-wiring.ts#sidebarPluginRecorded`); absent when not read. */
|
|
88
|
+
readonly sidebarPlugin?: boolean;
|
|
86
89
|
/** The npm install's marker (`npm-live.ts`) as a directory-flavor plugin
|
|
87
90
|
* would read it: which halves it would stand down for. Null when there is
|
|
88
91
|
* none it would believe; absent when not read. */
|
|
@@ -340,10 +343,26 @@ export function hostFindings(reading: HostReading): Finding[] {
|
|
|
340
343
|
: `ALSO installed as the Claude Code plugin (${plugin.id}), which stands down while this wiring is live`;
|
|
341
344
|
// KEEP ONE (2026-10-15, as the plugin's own session-start line says it,
|
|
342
345
|
// `plugin.ts#keepOne`): both ways out, the same memory either way.
|
|
346
|
+
// Beside the counterparts-sidebar plugin (2026-10-20), which needs this one,
|
|
347
|
+
// the plugin is no second install to remove: it is how the sidebar comes
|
|
348
|
+
// (docs/plugin.md "Two plugins"). Standing down, that is the setup we
|
|
349
|
+
// recommend to an npm user who wants the sidebar, so the line is green and
|
|
350
|
+
// asks nothing (2026-10-22, a coordinator call for Mike to review). Only when
|
|
351
|
+
// both really run is it amber, and then the fix never says to uninstall it.
|
|
352
|
+
const forSidebar = plugin !== null && reading.sidebarPlugin === true;
|
|
343
353
|
const twiceFix =
|
|
344
354
|
plugin === null
|
|
345
355
|
? ""
|
|
356
|
+
: forSidebar
|
|
357
|
+
? bothRun
|
|
358
|
+
? readsMarker
|
|
359
|
+
? `Both run until this install's hooks have run in a session; then the plugin (${plugin.id}) stands down on its own and stays installed for the counterparts-sidebar plugin, which needs it. To keep only the plugin instead, run \`counterparts disconnect\` and restart Claude Code.`
|
|
360
|
+
: `Both run: this build of the plugin (${plugin.id}) does not check for the other install. Keep it installed (the counterparts-sidebar plugin needs it) and update it, \`claude plugin update ${plugin.id}\`, to a build that stands down beside this one; or keep only the plugin: run \`counterparts disconnect\` and restart Claude Code.`
|
|
361
|
+
: ""
|
|
346
362
|
: `Installed twice; keeping one is simpler, and nothing is lost either way: to keep only the plugin, run \`counterparts disconnect\` and restart Claude Code; to keep only this install, run \`claude plugin uninstall ${plugin.id}\` (or \`/plugin uninstall ${plugin.id}\` inside Claude Code).`;
|
|
363
|
+
// Standing down for the sidebar: nothing to fix, said as it is.
|
|
364
|
+
const sidebarClause =
|
|
365
|
+
plugin === null ? "" : `the Claude Code plugin (${plugin.id}) is installed for the counterparts-sidebar plugin, which needs it, and stands down while this wiring is live`;
|
|
347
366
|
const mcpClause = reading.mcpRead === false
|
|
348
367
|
? ""
|
|
349
368
|
: reading.mcp
|
|
@@ -354,6 +373,9 @@ export function hostFindings(reading: HostReading): Finding[] {
|
|
|
354
373
|
|
|
355
374
|
if (missing.length === 0 && stale.length === 0 && reading.mcp) {
|
|
356
375
|
if (plugin !== null) {
|
|
376
|
+
if (forSidebar && !bothRun) {
|
|
377
|
+
return [finding("host", "green", "Claude Code", `connected: ${String(total)} hooks and the memory tools; ${sidebarClause}`, "", data)];
|
|
378
|
+
}
|
|
357
379
|
return [finding("host", "amber", "Claude Code", `connected: ${String(total)} hooks and the memory tools; ${twiceClause}`, twiceFix, data)];
|
|
358
380
|
}
|
|
359
381
|
// THE ONE LINE THE PERSON CAME FOR: is my assistant joined up to this
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import type { DreamingSetting } from "../../core/dream/index.js";
|
|
17
17
|
// The page's own reader, so this line cannot drift from what the wake prints.
|
|
18
18
|
import { clearedMarker, findPageRow, readSelfPage } from "../../core/self/page.js";
|
|
19
|
-
import { coreSupport, pageTrace } from "../../core/self/measures.js";
|
|
19
|
+
import { coreBeliefFloors, coreFromBeliefs, coreSupport, pageTrace } from "../../core/self/measures.js";
|
|
20
20
|
import type { CoreSupportRow } from "../../core/self/measures.js";
|
|
21
21
|
import {
|
|
22
22
|
dayBefore,
|
|
@@ -311,6 +311,46 @@ export function selfPageTraceFindings(store: Store): Finding[] {
|
|
|
311
311
|
* session-start reading.
|
|
312
312
|
*/
|
|
313
313
|
export function coreSupportFindings(store: Store): Finding[] {
|
|
314
|
+
return [...coreLaneFindings(store), ...coreBeliefFindings(store)];
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* THE CORE FROM BELIEFS (wave 2 lane F, 2026-10-22; `self.CORE_FROM_BELIEFS`):
|
|
319
|
+
* with the switch on, the beliefs about me and us the core reads, what stands
|
|
320
|
+
* behind each (memories, lived days), and what the floors held back. A
|
|
321
|
+
* reading, always green. Off: nothing, so doctor reads as before.
|
|
322
|
+
*/
|
|
323
|
+
function coreBeliefFindings(store: Store): Finding[] {
|
|
324
|
+
if (!SELF_TUNABLES.CORE_FROM_BELIEFS) return [];
|
|
325
|
+
const f = coreBeliefFloors();
|
|
326
|
+
const r = coreFromBeliefs(store, store.livedDay(), f);
|
|
327
|
+
const els = r.elements;
|
|
328
|
+
const floors = `strength ${String(f.strength)}+, ${String(f.memories)}+ memories, ${String(f.days)}+ lived days`;
|
|
329
|
+
const held = Object.entries(r.held)
|
|
330
|
+
.filter(([, n]) => n > 0)
|
|
331
|
+
.map(([k, n]) => `${String(n)} by ${k}`)
|
|
332
|
+
.join(", ");
|
|
333
|
+
const range = (pick: (e: (typeof els)[number]) => number): string => {
|
|
334
|
+
const v = els.map(pick);
|
|
335
|
+
const lo = Math.min(...v);
|
|
336
|
+
const hi = Math.max(...v);
|
|
337
|
+
return lo === hi ? String(lo) : `${String(lo)}–${String(hi)}`;
|
|
338
|
+
};
|
|
339
|
+
const what =
|
|
340
|
+
els.length === 0
|
|
341
|
+
? `none of ${String(r.considered)} ${r.considered === 1 ? "belief" : "beliefs"} about me and us has earned it yet`
|
|
342
|
+
: `${String(els.length)} of ${String(r.considered)} ${r.considered === 1 ? "belief" : "beliefs"} about me and us; memories ${range((e) => e.memories)}, lived days ${range((e) => e.days)}`;
|
|
343
|
+
return [
|
|
344
|
+
finding("core-beliefs", "green", "Core from beliefs", `${what} (floors: ${floors})${held.length > 0 ? `; held back: ${held}` : ""}`, "", {
|
|
345
|
+
elements: els.length,
|
|
346
|
+
considered: r.considered,
|
|
347
|
+
...r.held,
|
|
348
|
+
rows: els.map((e) => `${e.id}:${String(e.memories)}m/${String(e.days)}d/${e.strength.toFixed(2)}`).join(" "),
|
|
349
|
+
}),
|
|
350
|
+
];
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function coreLaneFindings(store: Store): Finding[] {
|
|
314
354
|
const s = coreSupport(store);
|
|
315
355
|
const els = s.elements;
|
|
316
356
|
if (els.length === 0) return [finding("core-support", "green", "Core", "no elements yet", "", { elements: 0 })];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** `doctor`'s findings on the store upgrades v8 to v11, read from what each upgrade recorded (moved out of `doctor.ts`, 2026-10-11). */
|
|
2
|
-
import { CONFIDENTIAL_RETIRED_KEY, Store, rowTombstoned } from "../../core/store/index.js";
|
|
1
|
+
/** `doctor`'s findings on the store upgrades v8 to v11 and v14, read from what each upgrade recorded (moved out of `doctor.ts`, 2026-10-11). */
|
|
2
|
+
import { CONFIDENTIAL_RETIRED_KEY, Store, V14_UPGRADE_KEY, rowTombstoned } from "../../core/store/index.js";
|
|
3
3
|
import { finding } from "./doctor-finding.js";
|
|
4
4
|
import type { Finding } from "./doctor-finding.js";
|
|
5
5
|
|
|
@@ -234,6 +234,41 @@ export function upgradeV11Findings(store: Store): Finding[] {
|
|
|
234
234
|
];
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
/**
|
|
238
|
+
* WHAT THE v14 UPGRADE DID (2026-10-21, wave 2's one bump), informational:
|
|
239
|
+
* the retired confidential column was dropped (after its count, when no
|
|
240
|
+
* open had taken it), the new tables for tags, belief support, projects and
|
|
241
|
+
* recall turns are there and empty, and the cards whose kind of subject is
|
|
242
|
+
* not a judgement have theirs. Silent on a store born at v14.
|
|
243
|
+
*/
|
|
244
|
+
export function upgradeV14Findings(store: Store): Finding[] {
|
|
245
|
+
const upgrade = metaJson(store, V14_UPGRADE_KEY);
|
|
246
|
+
if (upgrade === null) return [];
|
|
247
|
+
const dropped = upgrade["confidentialDropped"] === true;
|
|
248
|
+
const counted = typeof upgrade["confidentialCounted"] === "number" ? upgrade["confidentialCounted"] : null;
|
|
249
|
+
const raw = upgrade["subjects"];
|
|
250
|
+
const subjects: Record<string, number> = {};
|
|
251
|
+
if (raw !== null && typeof raw === "object" && !Array.isArray(raw)) {
|
|
252
|
+
for (const [k, v] of Object.entries(raw as Record<string, unknown>)) subjects[k] = metaNum(v);
|
|
253
|
+
}
|
|
254
|
+
const people = subjects["person"] ?? 0;
|
|
255
|
+
const places = subjects["place"] ?? 0;
|
|
256
|
+
const given = `${String(people)} ${people === 1 ? "card" : "cards"} marked a person, ${String(places)} a place; the rest wait for the night`;
|
|
257
|
+
const column = dropped
|
|
258
|
+
? `the retired confidential column dropped${counted === null ? "" : ` (${String(counted)} marked ${counted === 1 ? "memory" : "memories"} counted first)`}`
|
|
259
|
+
: "no confidential column to drop";
|
|
260
|
+
return [
|
|
261
|
+
finding(
|
|
262
|
+
"upgrade-v14",
|
|
263
|
+
"green",
|
|
264
|
+
"Upgrade",
|
|
265
|
+
`Upgrade to v14: room for tags, beliefs and their support, projects and what recall showed (empty until they are used) — ${column}; ${given}`,
|
|
266
|
+
"",
|
|
267
|
+
{ confidentialDropped: dropped, confidentialCounted: counted ?? -1, people, places },
|
|
268
|
+
),
|
|
269
|
+
];
|
|
270
|
+
}
|
|
271
|
+
|
|
237
272
|
/**
|
|
238
273
|
* THE CONFIDENTIAL MARK, RETIRED (2026-10-21): the memories that carried it
|
|
239
274
|
* when this build first opened the store (`CONFIDENTIAL_RETIRED_KEY`, counted
|
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
RUNNER_FAILED_EVENT,
|
|
57
57
|
SELF_BRIEFING_EVENT,
|
|
58
58
|
SLEEP_CYCLE_EVENT,
|
|
59
|
+
SLEEP_CYCLE_HELD_EVENT,
|
|
59
60
|
SNAPSHOT_FAILED_EVENT,
|
|
60
61
|
SNAPSHOT_TAKEN_EVENT,
|
|
61
62
|
SPAWN_FAILED_EVENT,
|
|
@@ -74,7 +75,7 @@ import {
|
|
|
74
75
|
} from "../../core/store/index.js";
|
|
75
76
|
import { heldCorrections } from "../../core/reconsolidation.js";
|
|
76
77
|
import { bundledModelDir } from "../runtime.js";
|
|
77
|
-
import { TUNABLES as SLEEP_TUNABLES, acceptsReflectedFeeling, laterFeelingWasAwake, laterFeelingWasReflections, selfRelevantFeeling } from "../../core/sleep/index.js";
|
|
78
|
+
import { CYCLE_LEASE_KEY, leaseStale, readLease, TUNABLES as SLEEP_TUNABLES, acceptsReflectedFeeling, laterFeelingWasAwake, laterFeelingWasReflections, selfRelevantFeeling } from "../../core/sleep/index.js";
|
|
78
79
|
import { TUNABLES as ASSOCIATE_TUNABLES, isDead, pairKey } from "../../core/associate/index.js";
|
|
79
80
|
import type { EventRow } from "../../core/store/index.js";
|
|
80
81
|
// The ask allowance the amber hint names, read rather than retyped: a number in
|
|
@@ -104,7 +105,7 @@ import {
|
|
|
104
105
|
import { TUNABLES, resolveEmbedder, retentionClocks, withEmbedderDefault } from "../config.js";
|
|
105
106
|
import type { EmbedderSource } from "../config.js";
|
|
106
107
|
import { MODEL_FILE, STATIC_WEIGHTS_ENV, STATIC_WEIGHTS_PACKAGE, resolveStaticWeights } from "../../core/embed/static.js";
|
|
107
|
-
import { DATABASE_FILE, heldExits, readRollbackHold, rollbackHeld } from "../../core/store/index.js";
|
|
108
|
+
import { DATABASE_FILE, heldExits, readRollbackHold, rollbackHeld, runningBuild } from "../../core/store/index.js";
|
|
108
109
|
// Retention's own reading and its own week, so the Raw transcripts line cannot
|
|
109
110
|
// promise a different number from the job that does the deleting. READ-ONLY:
|
|
110
111
|
// `remember/index.ts` re-exports the plan and the readers, never the deleter.
|
|
@@ -131,6 +132,7 @@ import {
|
|
|
131
132
|
upgradeV9Findings,
|
|
132
133
|
upgradeV10Findings,
|
|
133
134
|
upgradeV11Findings,
|
|
135
|
+
upgradeV14Findings,
|
|
134
136
|
confidentialRetiredFindings,
|
|
135
137
|
} from "./doctor-upgrades.js";
|
|
136
138
|
import {
|
|
@@ -166,6 +168,7 @@ export {
|
|
|
166
168
|
upgradeV9Findings,
|
|
167
169
|
upgradeV10Findings,
|
|
168
170
|
upgradeV11Findings,
|
|
171
|
+
upgradeV14Findings,
|
|
169
172
|
confidentialRetiredFindings,
|
|
170
173
|
} from "./doctor-upgrades.js";
|
|
171
174
|
export {
|
|
@@ -1004,6 +1007,22 @@ function boundaryAge(store: Store, today: string): "never" | "today" | "earlier"
|
|
|
1004
1007
|
: "today";
|
|
1005
1008
|
}
|
|
1006
1009
|
|
|
1010
|
+
/**
|
|
1011
|
+
* A CYCLE LEASE THAT IS STUCK (review of #581, `sleep/lease.ts`): a boundary
|
|
1012
|
+
* stood aside after the newest cycle row (its `sleep.cycle.held` row is newer),
|
|
1013
|
+
* and the lease it stood aside for no longer holds — run out, its holder's pid
|
|
1014
|
+
* gone, or taken "in the future" / further ahead than a lease lasts (a clock that
|
|
1015
|
+
* jumped). The next cycle takes such a lease over by itself; this says that one
|
|
1016
|
+
* is due. Null: nothing stuck, or nothing to tell.
|
|
1017
|
+
*/
|
|
1018
|
+
function stuckLease(store: Store, livedDay: number, cycle: EventRow): string | null {
|
|
1019
|
+
const held = newestRows(store, SLEEP_CYCLE_HELD_EVENT, 1, livedDay).rows[0];
|
|
1020
|
+
if (held === undefined || held.seq < cycle.seq) return null;
|
|
1021
|
+
const lease = readLease(store.getMeta(CYCLE_LEASE_KEY));
|
|
1022
|
+
if (lease === null) return null;
|
|
1023
|
+
return leaseStale(lease, store.now());
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1007
1026
|
/** The newest row of each family the background half leaves behind. */
|
|
1008
1027
|
function rowFindings(input: DoctorInput, store: Store): Finding[] {
|
|
1009
1028
|
const livedDay = store.livedDay();
|
|
@@ -1097,12 +1116,22 @@ function rowFindings(input: DoctorInput, store: Store): Finding[] {
|
|
|
1097
1116
|
// `reason` is "ran" | "clock-failed" | "threw" (`counterpart.ts#recordSleepCycle`),
|
|
1098
1117
|
// so anything but "ran" is a night that did not happen, not a cadence.
|
|
1099
1118
|
const data = { reason, failed, date: rowDate(cycle), budgetTruncated: truncated.length };
|
|
1119
|
+
const stuck = reason === "ran" && failed === 0 ? stuckLease(store, livedDay, cycle) : null;
|
|
1100
1120
|
out.push(
|
|
1101
1121
|
reason !== "ran"
|
|
1102
1122
|
? finding("sleep", "red", "Sleep", detail, "The nightly cycle is not completing — decay, prune, dedup and consolidate are not running.", data)
|
|
1103
1123
|
: failed > 0
|
|
1104
1124
|
? finding("sleep", "amber", "Sleep", detail, "A phase failed; the row names it.", data)
|
|
1105
|
-
:
|
|
1125
|
+
: stuck !== null
|
|
1126
|
+
? finding(
|
|
1127
|
+
"sleep",
|
|
1128
|
+
"amber",
|
|
1129
|
+
"Sleep",
|
|
1130
|
+
`${detail}; since then a cycle stood aside for a lease that no longer holds (${stuck})`,
|
|
1131
|
+
"The next cycle takes a stale lease over by itself; if this stays, the store's sleep.lease row is what is stuck.",
|
|
1132
|
+
{ ...data, lease: stuck },
|
|
1133
|
+
)
|
|
1134
|
+
: finding("sleep", "green", "Sleep", detail, "", data),
|
|
1106
1135
|
);
|
|
1107
1136
|
}
|
|
1108
1137
|
|
|
@@ -1993,6 +2022,45 @@ export function writeFieldFindings(store: Store): Finding[] {
|
|
|
1993
2022
|
];
|
|
1994
2023
|
}
|
|
1995
2024
|
|
|
2025
|
+
/**
|
|
2026
|
+
* THE BUILD LOG, informational, never amber or red (2026-10-22, provenance):
|
|
2027
|
+
* the last three builds that opened this store for writing, newest first,
|
|
2028
|
+
* each with the lived day it arrived and any settings it ran with
|
|
2029
|
+
* (`Store#buildLog`). A read after a release splits its rows by these.
|
|
2030
|
+
* Silent on a store no build has logged yet.
|
|
2031
|
+
*
|
|
2032
|
+
* The line leads with the build RUNNING now (`runningBuild`), not the newest
|
|
2033
|
+
* in the log: the log keeps one row per version, so a downgrade to a build it
|
|
2034
|
+
* already holds adds nothing (review of #591: 0.3.30 → 0.3.31 → 0.3.30 left
|
|
2035
|
+
* 0.3.31 newest while new rows were stamped 0.3.30). When the two differ the
|
|
2036
|
+
* line says so.
|
|
2037
|
+
*/
|
|
2038
|
+
export function buildLogFindings(store: Store, running: string = runningBuild()): Finding[] {
|
|
2039
|
+
let log: ReturnType<Store["buildLog"]>;
|
|
2040
|
+
try {
|
|
2041
|
+
log = store.buildLog();
|
|
2042
|
+
} catch {
|
|
2043
|
+
return [];
|
|
2044
|
+
}
|
|
2045
|
+
const newest = log.slice(-3).reverse();
|
|
2046
|
+
const head = newest[0];
|
|
2047
|
+
if (head === undefined) return [];
|
|
2048
|
+
const words = newest.map((l) => {
|
|
2049
|
+
const set = l.settings === null || l.settings.length === 0 ? "" : ` (${l.settings.map((s) => `${s.module}.${s.key}=${String(s.value)}`).join(", ")})`;
|
|
2050
|
+
return `${l.build} since lived day ${l.since === null ? "?" : String(l.since)}${set}`;
|
|
2051
|
+
});
|
|
2052
|
+
const earlier = log.length - newest.length;
|
|
2053
|
+
const lead = running === head.build ? `running ${running}` : `running ${running}, newest logged ${head.build}`;
|
|
2054
|
+
return [
|
|
2055
|
+
finding("build-log", "green", "Builds", `${lead}: ${words.join("; ")}${earlier > 0 ? `; ${String(earlier)} earlier` : ""}`, "", {
|
|
2056
|
+
builds: log.length,
|
|
2057
|
+
running,
|
|
2058
|
+
newest: head.build,
|
|
2059
|
+
since: head.since,
|
|
2060
|
+
}),
|
|
2061
|
+
];
|
|
2062
|
+
}
|
|
2063
|
+
|
|
1996
2064
|
/**
|
|
1997
2065
|
* THE OLD-CLAIMS ERA, informational, never amber or red (2026-10-10; decided
|
|
1998
2066
|
* by Mike, 2026-10-10, loosely held): whether the curve reads old claims at
|
|
@@ -3384,12 +3452,16 @@ export function doctorFindings(input: DoctorInput): Finding[] {
|
|
|
3384
3452
|
// v10 (2026-09-29): what the upgrade carried, and the week's contradictions.
|
|
3385
3453
|
["upgrade-v10", () => upgradeV10Findings(store)],
|
|
3386
3454
|
["upgrade-v11", () => upgradeV11Findings(store)],
|
|
3455
|
+
// v14 (2026-10-21): the drop, the new tables, the cards' subject kinds.
|
|
3456
|
+
["upgrade-v14", () => upgradeV14Findings(store)],
|
|
3387
3457
|
// 2026-10-21: memories that carried the retired confidential mark, counted once. Silent at 0.
|
|
3388
3458
|
["confidential-retired", () => confidentialRetiredFindings(store)],
|
|
3389
3459
|
// v12 (2026-10-03): the writer's three fields, and the subject links. Two aggregates.
|
|
3390
3460
|
["write-fields", () => writeFieldFindings(store)],
|
|
3391
3461
|
// 2026-10-10: the old-claims era — on or off, and how many it reads at today's default (lower, higher).
|
|
3392
3462
|
["claims-era", () => claimsEraFindings(store)],
|
|
3463
|
+
// 2026-10-22: which builds wrote this store, and since which lived day. One prefix read.
|
|
3464
|
+
["build-log", () => buildLogFindings(store)],
|
|
3393
3465
|
["recognition-lane", () => recognitionLaneFindings(store)],
|
|
3394
3466
|
["contradictions", () => contradictionFindings(store)],
|
|
3395
3467
|
// Build B (2026-09-28): does anyone read what an index offers in part?
|
|
@@ -74,6 +74,7 @@ import { Lifecycle, codeOf, plainContextLine, plainLine } from "../lifecycle.js"
|
|
|
74
74
|
import type { LifecycleOptions, PlainLines, SessionInput } from "../lifecycle.js";
|
|
75
75
|
|
|
76
76
|
import { localDate } from "../../core/time.js";
|
|
77
|
+
import { openThread } from "../../core/self/identity.js";
|
|
77
78
|
import { TUNABLES } from "../config.js";
|
|
78
79
|
import { TUNABLES as RECALL_TUNABLES } from "../../core/recall/tunables.js";
|
|
79
80
|
import { SESSION_NOTICE_BUDGET_MS, checkoutIsGraded, doctorFindings, noticeMessage, readCheckout } from "./doctor.js";
|
|
@@ -521,10 +522,52 @@ export const PAGE_WRITER_TOOL = "counterparts self_page";
|
|
|
521
522
|
*/
|
|
522
523
|
export const RATE_CLAUSE = "`rated` 0–3 each footnote shown since you last wrote, and each `drewOn` id";
|
|
523
524
|
|
|
524
|
-
|
|
525
|
+
/**
|
|
526
|
+
* WHAT OPEN MEANS, IN THE ASK (2026-10-22, the open-threads brief): the same
|
|
527
|
+
* narrowing as the `unresolved` field's own text (`mcp/tools.ts#UNRESOLVED_PROPERTY`).
|
|
528
|
+
*/
|
|
529
|
+
export const OPEN_MEANS = "`unresolved` only when someone owes an answer (a question to them, a check with a date, a promise)";
|
|
530
|
+
|
|
531
|
+
/** How long one open item's title may run in the ask's last line (2026-10-22). */
|
|
532
|
+
const OPEN_TITLE_CHARS = 60;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* The most the ask's open line may run, whole (the review of #592, F5): a
|
|
536
|
+
* title is clipped at `OPEN_TITLE_CHARS` and an id is 16 characters, so five
|
|
537
|
+
* items fit; an item past it is left out, never cut. With the two lines'
|
|
538
|
+
* own pin (720) the whole ask stays under ~1,250 characters.
|
|
539
|
+
*/
|
|
540
|
+
export const OPEN_LINE_MAX_CHARS = 520;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* THE ASK NAMES THIS SESSION'S OWN OPEN ITEMS (2026-10-22, the open-threads
|
|
544
|
+
* brief): the open memories it wrote or touched (`Store#openThreadsOfSession`),
|
|
545
|
+
* at most `TUNABLES.STOP_OPEN_MAX`, by title and id — so closing one is an
|
|
546
|
+
* `updates` on a line it can see, not a search. A third line, unnumbered, and
|
|
547
|
+
* only when there is one: with none the ask is its two lines, as before.
|
|
548
|
+
*/
|
|
549
|
+
export function openHereLine(open: readonly { readonly id: string; readonly title: string }[]): string | null {
|
|
550
|
+
if (open.length === 0) return null;
|
|
551
|
+
const clip = (t: string): string => {
|
|
552
|
+
const one = t.replace(/\s+/g, " ").trim();
|
|
553
|
+
return one.length <= OPEN_TITLE_CHARS ? one : `${one.slice(0, OPEN_TITLE_CHARS - 1).trimEnd()}…`;
|
|
554
|
+
};
|
|
555
|
+
const head = "Still open from this session — close any now answered with `updates` and `unresolved: false`: ";
|
|
556
|
+
const items: string[] = [];
|
|
557
|
+
for (const o of open) {
|
|
558
|
+
const item = `"${clip(o.title)}" (${o.id})`;
|
|
559
|
+
if (items.length > 0 && head.length + [...items, item].join("; ").length + 1 > OPEN_LINE_MAX_CHARS) break;
|
|
560
|
+
items.push(item);
|
|
561
|
+
}
|
|
562
|
+
return `${head}${items.join("; ")}.`;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export function stopAsk(sessionId: string, chapter: number, open: readonly { readonly id: string; readonly title: string }[] = []): string {
|
|
566
|
+
const here = openHereLine(open);
|
|
525
567
|
return [
|
|
526
|
-
`${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}`,
|
|
568
|
+
`${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; ${OPEN_MEANS}; ${RATE_CLAUSE}. ${PRONOUN_RULE}`,
|
|
527
569
|
`2) Write chapter ${String(chapter)} with the counterparts chapter tool, session: ${sessionId}.`,
|
|
570
|
+
...(here === null ? [] : [here]),
|
|
528
571
|
].join("\n");
|
|
529
572
|
}
|
|
530
573
|
|
|
@@ -1612,7 +1655,29 @@ export class ClaudeCodeAdapter extends Lifecycle {
|
|
|
1612
1655
|
// server binds itself with, so an ask that omitted it would be an
|
|
1613
1656
|
// invitation the model has no way to accept on this host — and the
|
|
1614
1657
|
// chapter number is the STORE's, one past what was written.
|
|
1615
|
-
return chapter === null ? null : stopAsk(input.sessionId, chapter);
|
|
1658
|
+
return chapter === null ? null : stopAsk(input.sessionId, chapter, this.openHere(input.sessionId));
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* This session's own open items, for the ask's last line (2026-10-22,
|
|
1663
|
+
* `openHereLine`): what the store says it wrote or touched, the flag
|
|
1664
|
+
* confirmed on the prose. Never fails the Stop: none on any error.
|
|
1665
|
+
*/
|
|
1666
|
+
private openHere(sessionId: string): { id: string; title: string }[] {
|
|
1667
|
+
const max = TUNABLES.STOP_OPEN_MAX;
|
|
1668
|
+
if (!(max > 0)) return [];
|
|
1669
|
+
try {
|
|
1670
|
+
const store = this.counterpart.store;
|
|
1671
|
+
// What a thread is, the carry's own test (`openThread`: not dreamed, not
|
|
1672
|
+
// settled over, the flag on the prose — the review of #592, F2), asked
|
|
1673
|
+
// of a few more than the cap so one left out does not shorten the list.
|
|
1674
|
+
return store
|
|
1675
|
+
.openThreadsOfSession(sessionId, max * 4)
|
|
1676
|
+
.filter((o) => openThread(store, o.id))
|
|
1677
|
+
.slice(0, max);
|
|
1678
|
+
} catch {
|
|
1679
|
+
return [];
|
|
1680
|
+
}
|
|
1616
1681
|
}
|
|
1617
1682
|
|
|
1618
1683
|
/**
|