counterparts 0.3.4 → 0.3.5
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 +116 -0
- package/docs/module-map.md +2 -2
- package/package.json +1 -1
- package/src/adapters/claude-code/NOTES.md +13 -0
- package/src/adapters/claude-code/doctor.ts +126 -0
- package/src/adapters/claude-code/hooks.ts +15 -0
- package/src/adapters/claude-code/index.ts +2 -0
- package/src/adapters/cli/NOTES.md +12 -0
- package/src/adapters/cli/commands.ts +34 -5
- package/src/adapters/cli/dream-core.ts +70 -3
- package/src/adapters/cli/export.ts +21 -2
- package/src/adapters/cli/help.ts +8 -5
- package/src/adapters/cli/mechanisms.ts +7 -1
- package/src/adapters/dashboard/source.ts +8 -0
- package/src/adapters/dashboard/web/README.md +105 -28
- package/src/adapters/dashboard/web/actions.ts +45 -3
- package/src/adapters/dashboard/web/ask-voice.ts +364 -0
- package/src/adapters/dashboard/web/lanes.ts +32 -2
- package/src/adapters/dashboard/web/mechanisms/association/index.js +1 -0
- package/src/adapters/dashboard/web/mechanisms/association/panel.js +1 -3
- package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +1 -0
- package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +31 -17
- package/src/adapters/dashboard/web/mechanisms/decay/index.js +1 -0
- package/src/adapters/dashboard/web/mechanisms/decay/panel.js +1 -3
- package/src/adapters/dashboard/web/mechanisms/dreaming/index.js +3 -2
- package/src/adapters/dashboard/web/mechanisms/dreaming/panel.js +20 -0
- package/src/adapters/dashboard/web/mechanisms/emotional/index.js +1 -0
- package/src/adapters/dashboard/web/mechanisms/emotional/panel.js +24 -0
- package/src/adapters/dashboard/web/mechanisms/episodic-semantic/index.js +1 -0
- package/src/adapters/dashboard/web/mechanisms/episodic-semantic/panel.js +11 -0
- package/src/adapters/dashboard/web/mechanisms/index.js +15 -4
- package/src/adapters/dashboard/web/mechanisms/interference/index.js +1 -0
- package/src/adapters/dashboard/web/mechanisms/prospective/index.js +1 -0
- package/src/adapters/dashboard/web/mechanisms/prospective/panel.js +18 -0
- package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +1 -0
- package/src/adapters/dashboard/web/mechanisms/reconsolidation/panel.js +1 -3
- package/src/adapters/dashboard/web/mechanisms/retrieval/index.js +1 -0
- package/src/adapters/dashboard/web/mechanisms/retrieval/panel.js +54 -15
- package/src/adapters/dashboard/web/mechanisms/salience/index.js +1 -0
- package/src/adapters/dashboard/web/mechanisms/salience/panel.js +1 -2
- package/src/adapters/dashboard/web/mechanisms/schema/index.js +1 -0
- package/src/adapters/dashboard/web/narrate.ts +53 -3
- package/src/adapters/dashboard/web/pages/health/health.css +14 -0
- package/src/adapters/dashboard/web/pages/health/index.js +5 -1
- package/src/adapters/dashboard/web/pages/health/sections/cycle.js +8 -5
- package/src/adapters/dashboard/web/pages/health/sections/wake.js +49 -0
- package/src/adapters/dashboard/web/pages/home/home.css +114 -32
- package/src/adapters/dashboard/web/pages/home/index.js +9 -7
- package/src/adapters/dashboard/web/pages/home/sections/explorer.js +118 -42
- package/src/adapters/dashboard/web/pages/home/sections/hero.js +7 -3
- package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +6 -3
- package/src/adapters/dashboard/web/pages/home/sections/tiles.js +4 -11
- package/src/adapters/dashboard/web/pages/home/sections/tonight.js +74 -0
- package/src/adapters/dashboard/web/pages/home/sections/written.js +76 -0
- package/src/adapters/dashboard/web/pages/memories/fold.js +48 -0
- package/src/adapters/dashboard/web/pages/memories/memories.css +5 -0
- package/src/adapters/dashboard/web/pages/memories/row.js +8 -2
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +50 -10
- package/src/adapters/dashboard/web/pages/self/index.js +15 -11
- package/src/adapters/dashboard/web/pages/self/sections/dreams.js +2 -1
- package/src/adapters/dashboard/web/pages/self/sections/journal.js +31 -12
- package/src/adapters/dashboard/web/pages/self/sections/map.js +217 -0
- package/src/adapters/dashboard/web/pages/self/sections/page.js +120 -61
- package/src/adapters/dashboard/web/pages/self/sections/settling.js +31 -41
- package/src/adapters/dashboard/web/pages/self/sections/traits.js +101 -0
- package/src/adapters/dashboard/web/pages/self/sections/wake.js +45 -52
- package/src/adapters/dashboard/web/pages/self/self.css +105 -72
- package/src/adapters/dashboard/web/pages/self/state.js +4 -0
- package/src/adapters/dashboard/web/server.ts +20 -1
- package/src/adapters/dashboard/web/shared/absence.js +1 -3
- package/src/adapters/dashboard/web/shared/memory-card-words.js +96 -0
- package/src/adapters/dashboard/web/shared/memory-modal.js +13 -22
- package/src/adapters/dashboard/web/shared/widgets/feed.js +44 -7
- package/src/adapters/dashboard/web/views/activity.ts +33 -3
- package/src/adapters/dashboard/web/views/core-road.ts +56 -0
- package/src/adapters/dashboard/web/views/health.ts +61 -9
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +375 -86
- package/src/adapters/dashboard/web/views/mechanisms.ts +106 -5
- package/src/adapters/dashboard/web/views/memory.ts +96 -31
- package/src/adapters/dashboard/web/views/mind.ts +582 -52
- package/src/adapters/dashboard/web/views/overview.ts +14 -21
- package/src/adapters/dashboard/web/views/search.ts +45 -2
- package/src/adapters/dashboard/web/views/self-map.ts +124 -0
- package/src/adapters/dashboard/web/views/tonight.ts +158 -0
- package/src/adapters/dashboard/web/views/traits.ts +197 -0
- package/src/adapters/dashboard/web/views/written-returned.ts +93 -0
- package/src/adapters/dashboard/web/views.ts +6 -4
- package/src/adapters/fired.ts +23 -1
- package/src/adapters/mcp/CONTRACT.md +3 -0
- package/src/adapters/mcp/NOTES.md +40 -0
- package/src/adapters/mcp/bin/serve.ts +6 -1
- package/src/adapters/mcp/index.ts +4 -0
- package/src/adapters/mcp/server.ts +256 -5
- package/src/adapters/mcp/tools.ts +196 -1
- package/src/adapters/mechanism-evidence.ts +26 -3
- package/src/core/counterpart.ts +86 -2
- package/src/core/dream/CONTRACT.md +93 -9
- package/src/core/dream/INTERFACE-GAPS.md +25 -0
- package/src/core/dream/NOTES.md +106 -0
- package/src/core/dream/index.ts +143 -13
- package/src/core/dream/mind.ts +110 -0
- package/src/core/dream/reflect.ts +1154 -0
- package/src/core/physics/CONTRACT.md +23 -1
- package/src/core/physics/NOTES.md +48 -0
- package/src/core/physics/index.ts +100 -7
- package/src/core/self/CONTRACT.md +8 -1
- package/src/core/self/INTERFACE-GAPS.md +4 -0
- package/src/core/self/NOTES.md +15 -0
- package/src/core/sleep/CONTRACT.md +2 -1
- package/src/core/sleep/NOTES.md +51 -0
- package/src/core/sleep/consolidate.ts +146 -25
- package/src/core/sleep/index.ts +12 -2
- package/src/core/sleep/types.ts +17 -0
- package/src/core/store/CONTRACT.md +15 -0
- package/src/core/store/NOTES.md +89 -0
- package/src/core/store/errors.ts +12 -0
- package/src/core/store/feelings.ts +16 -0
- package/src/core/store/index.ts +502 -19
- package/src/core/store/operational.ts +351 -7
- package/src/core/store/owner-op-seam.ts +110 -1
- package/src/core/store/traits.ts +161 -0
- package/src/core/types.ts +17 -2
- package/src/adapters/dashboard/web/pages/home/sections/recent-chapters.js +0 -17
- package/src/adapters/dashboard/web/shared/widgets/chapters.js +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,121 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.5 — 2026-09-27
|
|
4
|
+
|
|
5
|
+
Claude reflects after a dream, tells you about it in the morning, and rewrites its self
|
|
6
|
+
page from what it reflected on; what a memory is about now decides the core. **The
|
|
7
|
+
store's format changes (v8 → v9).** The first Claude Code session after installing
|
|
8
|
+
copies the store (as every upgrade since 0.3.1 has) and upgrades it; until then
|
|
9
|
+
`counterparts doctor` says (amber) that the next session will upgrade it, and the
|
|
10
|
+
dashboard asks you to open a session. Close every session before installing, and run
|
|
11
|
+
`/mcp` → Reconnect in any you missed.
|
|
12
|
+
|
|
13
|
+
Reflecting.
|
|
14
|
+
|
|
15
|
+
- **After a dream, Claude reflects on it, awake.** The dream's background agent now
|
|
16
|
+
dreams, writes its journal, then reflects, as three separate steps. The reflection is
|
|
17
|
+
handed the dream (marked as dreamed), the last few days' chapters and memories, what is
|
|
18
|
+
on its mind (dated things in the next two weeks, disagreements still standing, where
|
|
19
|
+
the work stands), the self page and the core, and answers three questions that change
|
|
20
|
+
from night to night. It sees memories and feelings, not the numbers behind the core.
|
|
21
|
+
- **What it writes.** An entry, kept as a memory titled "Reflected: …" when it rests on
|
|
22
|
+
memories it names. An entry that names nothing counts as "nothing much": it is kept on
|
|
23
|
+
the record, and nothing else is written or said. One reflection a lived day.
|
|
24
|
+
- **The self page is rewritten from the reflection.** The page had stopped changing: the
|
|
25
|
+
morning writer needed room in the session start that a full wake no longer left it. Now
|
|
26
|
+
the reflection rewrites the page from the memories it names (at least one from the core
|
|
27
|
+
when there is a core), and that night's morning writer stands down. A dream's own
|
|
28
|
+
pattern is never a source for the page, and its words may not go on it.
|
|
29
|
+
- **The morning share.** The reflection may leave a short note for you (at most 700
|
|
30
|
+
characters, naming what it rests on). Claude tells it once: when the dream hands back,
|
|
31
|
+
or, if that session has already ended, at the start of the next one.
|
|
32
|
+
- **Feelings recorded later.** The reflection may record how a memory it was shown feels
|
|
33
|
+
now, marked as recorded later, on that day. It may feel stronger than anything felt at
|
|
34
|
+
the time.
|
|
35
|
+
- **What a memory is about**: me, us, owner, work or world. Claude can say it when it
|
|
36
|
+
writes (`note` and `session_end` take `about`), and the reflection can set or change it,
|
|
37
|
+
with its reason. Each change is recorded; one that makes a memory about Claude, the two
|
|
38
|
+
of you or you is said in the next morning share.
|
|
39
|
+
- **You are named, not "him".** What the reflection and the dream say about you uses
|
|
40
|
+
your name as the store knows it (`install --name`), or "the owner" when there is none —
|
|
41
|
+
never a pronoun that guesses.
|
|
42
|
+
- `reflect` is a ninth tool for the MCP server; `counterparts dream --show <id>` includes
|
|
43
|
+
the dream's reflection, `--show rfl_…` shows one, and `--list` lists them. Undoing a
|
|
44
|
+
dream leaves its reflection. Removing a memory also redacts any reflection that named
|
|
45
|
+
it, and that reflection's entry. `pageWriter.mode: "off"` stops the reflection's page
|
|
46
|
+
write too.
|
|
47
|
+
|
|
48
|
+
The core.
|
|
49
|
+
|
|
50
|
+
- **What a memory is about decides whether it can become core**, not its kind: about me
|
|
51
|
+
(Claude), about us, or about the owner. A skill never becomes core. A memory marked
|
|
52
|
+
work or world does not either.
|
|
53
|
+
- **Nothing changes overnight.** The upgrade marks memories by the old rule: every
|
|
54
|
+
`self` memory is about me, and every memory about a person that names you is about the
|
|
55
|
+
owner. So the candidates the morning after are the ones from the night before, and
|
|
56
|
+
`doctor`'s Upgrade line says how many were marked each way.
|
|
57
|
+
- **A reflection naming a memory counts as it coming back.** It counts toward the fast
|
|
58
|
+
way in (strongly felt and came back after a gap), and toward the slow way at most once
|
|
59
|
+
a week per memory.
|
|
60
|
+
- **A memory can reach the core on reflection alone, and you can close that.** This is
|
|
61
|
+
on by default: a feeling the reflection records later and a reflection naming the
|
|
62
|
+
memory both count. When one gets there that way, the next morning share says so, and
|
|
63
|
+
`doctor` counts it. `counterparts core --reflected-feeling off` closes it: the fast way
|
|
64
|
+
then needs a feeling felt at the time and an ordinary use after a gap, and a reflection
|
|
65
|
+
may only move what a memory is about toward work or world. `on` opens it again.
|
|
66
|
+
`counterparts core` says which way it stands.
|
|
67
|
+
|
|
68
|
+
Traits.
|
|
69
|
+
|
|
70
|
+
- **A memory can carry a small note on how Claude acted in it**, on seven fixed scales
|
|
71
|
+
(careful–bold, agreeable–candid, guarded–open, focused–curious, following–initiating,
|
|
72
|
+
inward–outward, serious–playful). `note`, `session_end` and the reflection take them;
|
|
73
|
+
most memories carry none. They are for display only: they change nothing about the
|
|
74
|
+
core, fading, the self page or recall. `export --markdown` has a Traits section, and
|
|
75
|
+
`counterparts fired` has a traits row.
|
|
76
|
+
- **The dashboard's Self tab shows them as "How I act"**: one bar per scale, marking
|
|
77
|
+
where Claude has leaned lately and where it was a week ago. Tap a bar to see the
|
|
78
|
+
memories behind it.
|
|
79
|
+
|
|
80
|
+
Seeing it.
|
|
81
|
+
|
|
82
|
+
- `doctor` has a Reflection line: when it last reflected, whether the page was
|
|
83
|
+
rewritten, whether the share was told, the week's returns by where they came from
|
|
84
|
+
(awake, reflection, dream), and how many memories became core on reflection alone.
|
|
85
|
+
- `counterparts mechanisms` counts reflections beside dreams, and a dream's core
|
|
86
|
+
suggestions apart from its changes ("2 dreams this week (60 changes, 3 core
|
|
87
|
+
suggestions)"). The dashboard says the same.
|
|
88
|
+
- The dashboard's core views ask the same question sleep asks, so they never show a
|
|
89
|
+
memory as ready when sleep won't make it core (with `--reflected-feeling off` too).
|
|
90
|
+
Home's Tonight box says whether Claude will ask to dream next session, and why not
|
|
91
|
+
when it won't.
|
|
92
|
+
|
|
93
|
+
**The dashboard's Memories tab, round 3.** A memory's card says when one return would
|
|
94
|
+
make it core, and says "written, day N" until it is first used. Ask lists a chapter and
|
|
95
|
+
the memory it came from once. Version rows say when a dream merged near-copies. Ask now
|
|
96
|
+
reads your question in Claude's voice ("what do you remember about me?" searches "what
|
|
97
|
+
do I remember about" and your name) and shows what it searched, with "search exactly as
|
|
98
|
+
typed" to turn that off.
|
|
99
|
+
|
|
100
|
+
**The dashboard's Home tab, round 3.** Less on the page. The mechanism pills sit on one
|
|
101
|
+
line. Each mechanism shows one number, up to five of the memories behind it, and one line
|
|
102
|
+
on what it does; the rest is under "how it works". New: a strip of what was written and
|
|
103
|
+
what came back each day, a Tonight box (what the next sleep will do, what is close to the
|
|
104
|
+
core, what is near being let go), and how often what came to mind was used. Sleep checks
|
|
105
|
+
that did nothing move to the flow feed, and repeated lines fold into one. The core tile is
|
|
106
|
+
a count, and the chapters column is gone (both live on Self).
|
|
107
|
+
|
|
108
|
+
**The dashboard's Self tab, round 3.** The page's history is one strip, a dot a day: a
|
|
109
|
+
filled dot is a day it was rewritten, a hollow one says why it wasn't, in plain words. A
|
|
110
|
+
line above the page says when it has fallen behind. "Next time I wake, I start with:"
|
|
111
|
+
lists what the next session opens with. A map of the memories about Claude and the two of
|
|
112
|
+
you replaces the "closest to the core" list: the core in the middle, the closest near it.
|
|
113
|
+
The journal's day strip shows dates. The wake's size moved to Health.
|
|
114
|
+
|
|
115
|
+
**Health and empty pages.** Health no longer marks a step amber when it simply wasn't due
|
|
116
|
+
yet (consolidate and fade run every three lived days). Empty panels say "(none yet)" in
|
|
117
|
+
plain words.
|
|
118
|
+
|
|
3
119
|
## 0.3.4 — 2026-09-26
|
|
4
120
|
|
|
5
121
|
Memories stay strong by coming back, the core is for what is about the two of you, and
|
package/docs/module-map.md
CHANGED
|
@@ -23,7 +23,7 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
|
|
|
23
23
|
| `prospective/` | prospective memory | Future intentions, cued by time or context; fire / suppress / reference telemetry. |
|
|
24
24
|
| `handoff/` | working context for a place | The per-directory handoff: where the work here stands, written as a field on the end-of-session ask, shown as a two-line pointer at the next wake in that directory, expiring in lived days. **Never a memory** — out of recall, out of credit, out of consolidation, out of identity. **Added 2026-09-20 (E1, spec §6.4 / §15 item 6).** |
|
|
25
25
|
| `sleep/` | systems consolidation | Pure math on a cycle: decay tick (active-day clock), floor-pruning (real forgetting), the core's two lanes (at most three a night), re-render of the wake briefing. Zero standing model calls. |
|
|
26
|
-
| `dream/` | sleep replay + REM | Dreaming: once a day, if the owner says yes, a background agent (the same model) replays what was lived since the last dream beside what it resembles — merges, links, replays, a pattern, a flagged contradiction, a softened feeling, a core nomination — each recorded for undo, with a dream journal kept apart from lived memory. The module holds the bookkeeping and the rules; the dreamer is the model. **Added 2026-09-26.** |
|
|
26
|
+
| `dream/` | sleep replay + REM | Dreaming: once a day, if the owner says yes, a background agent (the same model) replays what was lived since the last dream beside what it resembles — merges, links, replays, a pattern, a flagged contradiction, a softened feeling, a core nomination — each recorded for undo, with a dream journal kept apart from lived memory. The module holds the bookkeeping and the rules; the dreamer is the model. **Added 2026-09-26.** Since 2026-09-27 it also holds REFLECTION (`reflect.ts`), the waking self: usually right after a dream, lived, with its own record — an entry, the self page rewritten from the core, a morning share, feelings recorded later, and what a memory is about. |
|
|
27
27
|
| *(`time.ts`)* | — (a clock, not a memory) | The one module that converts: a moment (UTC ms from `store.now()`) to a person's local date or clock line, "today" in a zone, and calendar dates as said (day, month, year, range). A file, not a module; a test keeps hand-built dates out of `src/`. **Added 2026-09-25 (`docs/time.md`).** |
|
|
28
28
|
| *(`feelings-wheel.ts`)* | — (a vocabulary) | The feelings wheel as a typed list: six cores, the middle and outer rings, valence, and the key scheme (`<core>.<word>` only for a word printed under two cores). Read by `store/` to validate the `feelings` table. **Added 2026-09-25.** |
|
|
29
29
|
| *(observer)* | — (instrument stance) | **RESOLVED (owner, 2026-08-25): a MODE, not a module** — one predicate threaded through the core API, checked at the store seam. Spec moved to `docs/observer-mode.md`. |
|
|
@@ -37,7 +37,7 @@ input — does `encode` shrink to gates-and-tagging inside `remember`'s pipeline
|
|
|
37
37
|
| adapter | job |
|
|
38
38
|
|---|---|
|
|
39
39
|
| `claude-code/` | Hooks: wake injection at session start, end-of-session remember, crash detection. The launch adapter. |
|
|
40
|
-
| `mcp/` | Deliberate tools: note, recall, status — plus the Stop ask's two return channels, `session_end` (memories) and `chapter` (the episode's own journal, **added 2026-09-04**, because the ask named a door no adapter had built) — and `dream`, the dreamer's phases (**added 2026-09-26**). |
|
|
40
|
+
| `mcp/` | Deliberate tools: note, recall, status — plus the Stop ask's two return channels, `session_end` (memories) and `chapter` (the episode's own journal, **added 2026-09-04**, because the ask named a door no adapter had built) — and `dream`, the dreamer's phases (**added 2026-09-26**), and `reflect`, the waking self's (**added 2026-09-27**). |
|
|
41
41
|
| `cli/` | `counterparts` command: status, install, owner operations (delete, export, backup). |
|
|
42
42
|
| `dashboard/` | The owner's window (constitution line 16): brain-view, revision stories, band/protected lists. Observer-mode by construction; minimal version ships DURING the parallel run. **Added 2026-08-25 (owner elevation).** |
|
|
43
43
|
| `sessions.ts` | Not an adapter — a leaf both may import: the live-session registry a host's hooks write (`<dataDir>/sessions/`) and its tools read, so a tool launched without a session can bind to one that is real, live and in its project. Adapters stay leaves; this is the sibling they share instead of importing each other. **Added 2026-09-04**, because this host's MCP servers are launched from a static config and cannot be told which session they serve. |
|
package/package.json
CHANGED
|
@@ -1621,3 +1621,16 @@ together at a prompt, the update notice waits. Details: `docs/adversarial-review
|
|
|
1621
1621
|
transcript as `isMeta`, origin `peer`, "Another Claude session sent a message:", which
|
|
1622
1622
|
the reader otherwise keeps as `injected`. `test/dream.test.ts` drives that exact shape
|
|
1623
1623
|
through parse, capture and the sweep: zero rows minted from the dream's words.
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
## 2026-09-27 — an untold morning share is carried on the prompt
|
|
1627
|
+
|
|
1628
|
+
`dreamLines` (UserPromptSubmit) now also carries a reflection's share that was never
|
|
1629
|
+
told, once, into a later session's context — only when the session that reflected has
|
|
1630
|
+
ended (its registry record ended, or quiet past `SESSION_TTL_MS`), so both do not tell
|
|
1631
|
+
it. Here and not in the SessionStart wake, whose byte ceiling is what stranded the page
|
|
1632
|
+
writer (self NOTES §27). The SessionStart page writer is left as it was: on a night the
|
|
1633
|
+
reflection rewrote the page it finds the night claimed and stands down.
|
|
1634
|
+
|
|
1635
|
+
- **2026-09-27, owner ruling D3 on #256:** `openAdapter` passes `pageWriter.mode` to
|
|
1636
|
+
`Counterpart.open`, so `off` stops the reflection's page write in the hooks' process too.
|
|
@@ -2450,6 +2450,129 @@ export function upgradeV8Findings(store: Store): Finding[] {
|
|
|
2450
2450
|
];
|
|
2451
2451
|
}
|
|
2452
2452
|
|
|
2453
|
+
/** The meta row the v9 upgrade writes (`store/operational.ts#V9_UPGRADE_KEY`). */
|
|
2454
|
+
const V9_UPGRADE_META = "physics.v9.upgrade";
|
|
2455
|
+
|
|
2456
|
+
/**
|
|
2457
|
+
* WHAT THE v9 UPGRADE CARRIED (2026-09-27, reflection + core by meaning),
|
|
2458
|
+
* informational. The core's first question moved from a kind label to a mark
|
|
2459
|
+
* set by meaning; the upgrade carried the old rule onto the rows it found, so
|
|
2460
|
+
* the candidates did not change overnight — this line says so, and how many
|
|
2461
|
+
* marks have been set by meaning since. Silent on a store born at v9.
|
|
2462
|
+
*/
|
|
2463
|
+
export function upgradeV9Findings(store: Store): Finding[] {
|
|
2464
|
+
const upgrade = metaJson(store, V9_UPGRADE_META);
|
|
2465
|
+
if (upgrade === null) return [];
|
|
2466
|
+
const me = metaNum(upgrade["markedMe"]);
|
|
2467
|
+
const owner = metaNum(upgrade["markedOwner"]);
|
|
2468
|
+
const candidates = metaNum(upgrade["candidates"]);
|
|
2469
|
+
let since = 0;
|
|
2470
|
+
let work = 0;
|
|
2471
|
+
try {
|
|
2472
|
+
for (const e of store.coreEvents({ action: "about", limit: 10_000 })) {
|
|
2473
|
+
since += 1;
|
|
2474
|
+
if ((e.reason ?? "").startsWith("work")) work += 1;
|
|
2475
|
+
}
|
|
2476
|
+
} catch {
|
|
2477
|
+
since = 0;
|
|
2478
|
+
}
|
|
2479
|
+
return [
|
|
2480
|
+
finding(
|
|
2481
|
+
"upgrade-v9",
|
|
2482
|
+
"green",
|
|
2483
|
+
"Upgrade",
|
|
2484
|
+
`Upgrade to v9: what a memory is about is now marked by meaning; the old rule was carried so nothing changed overnight — ${String(me)} self ${me === 1 ? "memory" : "memories"} marked about me, ${String(owner)} about the owner (${String(candidates)} core ${candidates === 1 ? "candidate" : "candidates"}); ${String(since)} ${since === 1 ? "mark" : "marks"} set by the writer or a reflection since${work > 0 ? `, ${String(work)} of them "work" (out of the candidates)` : ""}`,
|
|
2485
|
+
"",
|
|
2486
|
+
{ markedMe: me, markedOwner: owner, candidates, marksSince: since, work },
|
|
2487
|
+
),
|
|
2488
|
+
];
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
/**
|
|
2492
|
+
* REFLECTION, informational (2026-09-27): when the waking self last
|
|
2493
|
+
* reflected, what it did, what became of the morning share; the week's
|
|
2494
|
+
* returns by source; and how many memories became core on reflection alone.
|
|
2495
|
+
* Never amber: a quiet week is not a fault.
|
|
2496
|
+
*/
|
|
2497
|
+
export function reflectionFindings(input: DoctorInput, store: Store): Finding[] {
|
|
2498
|
+
let last: ReturnType<Store["reflections"]>[number] | undefined;
|
|
2499
|
+
let returns: ReturnType<Store["returnCounts"]>;
|
|
2500
|
+
let alone = 0;
|
|
2501
|
+
// RE-LABELS BY A REFLECTION (owner ruling D2 on #256): every mark a
|
|
2502
|
+
// reflection changed, and apart, those that moved a memory INTO me, us or
|
|
2503
|
+
// the owner (a core candidate it was not before).
|
|
2504
|
+
let relabeled = 0;
|
|
2505
|
+
let movedIn = 0;
|
|
2506
|
+
// A promotion the fast lane made only on a feeling a reflection recorded
|
|
2507
|
+
// later — the half of "on reflection" the open door lets through (review
|
|
2508
|
+
// of #256, S4). Counted apart from `alone`; one memory can be both.
|
|
2509
|
+
let later = 0;
|
|
2510
|
+
try {
|
|
2511
|
+
last = store.reflections({ limit: 5 }).find((r) => r.state === "reflected");
|
|
2512
|
+
returns = store.returnCounts({ sinceAt: Date.parse(`${input.today}T00:00:00Z`) - 6 * 86_400_000 });
|
|
2513
|
+
for (const row of store.eventLog({ name: "band.promoted" })) {
|
|
2514
|
+
try {
|
|
2515
|
+
const p = JSON.parse(row.payload ?? "{}") as { reflectionOnly?: unknown; feelingRecordedLater?: unknown };
|
|
2516
|
+
if (p.reflectionOnly === true) alone += 1;
|
|
2517
|
+
if (p.feelingRecordedLater === true) later += 1;
|
|
2518
|
+
} catch {
|
|
2519
|
+
continue;
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
for (const e of store.coreEvents({ action: "about", limit: 10_000 })) {
|
|
2523
|
+
if (e.actor !== "reflection") continue;
|
|
2524
|
+
const m = /^(\w+) \(was (\w+)\)/.exec(e.reason ?? "");
|
|
2525
|
+
if (m === null || m[1] === m[2]) continue;
|
|
2526
|
+
relabeled += 1;
|
|
2527
|
+
const core = (x: string | undefined): boolean => x === "me" || x === "us" || x === "owner";
|
|
2528
|
+
if (core(m[1]) && !core(m[2])) movedIn += 1;
|
|
2529
|
+
}
|
|
2530
|
+
} catch {
|
|
2531
|
+
return [];
|
|
2532
|
+
}
|
|
2533
|
+
const share: Record<string, string> = {
|
|
2534
|
+
none: "no share",
|
|
2535
|
+
offered: "its morning share not told yet",
|
|
2536
|
+
carried: "its morning share carried to a later session",
|
|
2537
|
+
told: "its morning share told",
|
|
2538
|
+
};
|
|
2539
|
+
const what =
|
|
2540
|
+
last === undefined
|
|
2541
|
+
? "has not reflected yet"
|
|
2542
|
+
: `last reflected ${last.date ?? `lived day ${String(last.day)}`} (${last.dream_id === null ? "on its own" : "after a dream"}): ${
|
|
2543
|
+
last.entry_id === null ? "nothing much" : "an entry"
|
|
2544
|
+
}${last.page_version === null ? "" : ", the self page rewritten"}, ${share[last.share_state] ?? last.share_state}`;
|
|
2545
|
+
const byHow = `returns this week — awake ${String(returns.awake)}, reflection ${String(returns.reflection)}, dream ${String(returns.dream)}`;
|
|
2546
|
+
const aloneLine =
|
|
2547
|
+
(alone > 0 ? `; ${String(alone)} ${alone === 1 ? "memory" : "memories"} became core on reflection alone` : "") +
|
|
2548
|
+
(later > 0 ? `; ${String(later)} ${later === 1 ? "memory" : "memories"} became core on a feeling a reflection recorded later` : "") +
|
|
2549
|
+
(relabeled > 0
|
|
2550
|
+
? `; ${String(relabeled)} ${relabeled === 1 ? "mark" : "marks"} changed by a reflection, ${String(movedIn)} of them into me, us or the owner`
|
|
2551
|
+
: "");
|
|
2552
|
+
return [
|
|
2553
|
+
finding(
|
|
2554
|
+
"reflection",
|
|
2555
|
+
"green",
|
|
2556
|
+
"Reflection",
|
|
2557
|
+
`${what}; ${byHow}${aloneLine}`,
|
|
2558
|
+
"",
|
|
2559
|
+
{
|
|
2560
|
+
last: last?.date ?? null,
|
|
2561
|
+
reflection: last?.id ?? null,
|
|
2562
|
+
page: last?.page_version !== null && last?.page_version !== undefined,
|
|
2563
|
+
share: last?.share_state ?? null,
|
|
2564
|
+
returnsAwake: returns.awake,
|
|
2565
|
+
returnsReflection: returns.reflection,
|
|
2566
|
+
returnsDream: returns.dream,
|
|
2567
|
+
promotedOnReflectionAlone: alone,
|
|
2568
|
+
promotedOnFeelingRecordedLater: later,
|
|
2569
|
+
relabeledByReflection: relabeled,
|
|
2570
|
+
relabeledIntoCore: movedIn,
|
|
2571
|
+
},
|
|
2572
|
+
),
|
|
2573
|
+
];
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2453
2576
|
/**
|
|
2454
2577
|
* DREAMING, informational (2026-09-26): when the counterpart last dreamed, and
|
|
2455
2578
|
* whether today's ask went out or was declined. Never amber: not dreaming is
|
|
@@ -3222,6 +3345,9 @@ export function doctorFindings(input: DoctorInput): Finding[] {
|
|
|
3222
3345
|
["upgrade-v8", () => upgradeV8Findings(store)],
|
|
3223
3346
|
// Dreaming (2026-09-26): informational — last dreamed, and today's ask.
|
|
3224
3347
|
["dreaming", () => dreamingFindings(input, store)],
|
|
3348
|
+
// v9 (2026-09-27): what the upgrade carried, and the reflection.
|
|
3349
|
+
["upgrade-v9", () => upgradeV9Findings(store)],
|
|
3350
|
+
["reflection", () => reflectionFindings(input, store)],
|
|
3225
3351
|
// LAST, and deliberately: it is the widest read here — the whole event log,
|
|
3226
3352
|
// plus a pass over the ids for the table probes — so when the console's
|
|
3227
3353
|
// reading is cut short this is the group that goes, and the `Budget` finding
|
|
@@ -73,6 +73,7 @@ import {
|
|
|
73
73
|
ASK_ROW_COUNTING,
|
|
74
74
|
decideUpdateNotice,
|
|
75
75
|
installedBuild,
|
|
76
|
+
isLive,
|
|
76
77
|
markUpdateNoticeShown,
|
|
77
78
|
owedWriteUps,
|
|
78
79
|
progressKey,
|
|
@@ -1317,12 +1318,26 @@ export class ClaudeCodeAdapter {
|
|
|
1317
1318
|
* the host-mode page writer's headless child, never under observer, never
|
|
1318
1319
|
* without a date. Only what could surface here anyway is counted or raised
|
|
1319
1320
|
* (the dream module applies recall's gates). Never throws.
|
|
1321
|
+
*
|
|
1322
|
+
* v9 (2026-09-27): a MORNING SHARE the reflecting session never told is
|
|
1323
|
+
* carried here, ONCE, by the next session — only when the session that
|
|
1324
|
+
* reflected has ended (its registry record is ended or quiet), so the two
|
|
1325
|
+
* do not both tell it. Here, on the prompt, rather than in the SessionStart
|
|
1326
|
+
* wake, whose byte ceiling is what stranded the page writer.
|
|
1320
1327
|
*/
|
|
1321
1328
|
private dreamLines(input: HookInput): string {
|
|
1322
1329
|
if (this.observer || input.at === undefined || input.pageWriter === true || input.sessionId.length === 0) return "";
|
|
1323
1330
|
try {
|
|
1324
1331
|
const dreams = this.counterpart.dreams;
|
|
1325
1332
|
const lines = [...dreams.raiseLines({ session: input.sessionId })];
|
|
1333
|
+
const pending = this.counterpart.reflections.pendingShare({ session: input.sessionId });
|
|
1334
|
+
if (pending !== null) {
|
|
1335
|
+
const record = pending.session === null ? null : readSession(this.counterpart.store.dir, pending.session);
|
|
1336
|
+
if (record === null || !isLive(record, this.nowFn())) {
|
|
1337
|
+
const carried = this.counterpart.reflections.carryLine({ session: input.sessionId, reflection: pending.id });
|
|
1338
|
+
if (carried !== null) lines.push(carried);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1326
1341
|
const ask = dreams.askLine({ at: input.at, session: input.sessionId });
|
|
1327
1342
|
if (ask !== null) lines.push(ask);
|
|
1328
1343
|
if (lines.length > 0) this.emit("adapter.dream.lines", { asked: ask !== null, raised: lines.length - (ask === null ? 0 : 1) });
|
|
@@ -169,6 +169,8 @@ export function openAdapter(
|
|
|
169
169
|
...(config.observer === undefined ? {} : { observer: config.observer }),
|
|
170
170
|
...(config.owner === undefined ? {} : { owner: config.owner }),
|
|
171
171
|
...(config.timeZone === undefined ? {} : { timeZone: config.timeZone }),
|
|
172
|
+
// Owner ruling D3 on #256: `pageWriter.mode: off` stops the reflection's page write too.
|
|
173
|
+
...(config.pageWriter?.mode === undefined ? {} : { pageWriterMode: config.pageWriter.mode }),
|
|
172
174
|
...(config.identity === undefined
|
|
173
175
|
? {}
|
|
174
176
|
: { identity: { name: config.identity.name, aliases: [...(config.identity.aliases ?? [])] } }),
|
|
@@ -1874,3 +1874,15 @@ found a paraphrase only by the words it shared. It now opens its store with the
|
|
|
1874
1874
|
the store's own, at open: a store whose box 3 holds another model's vectors withdraws
|
|
1875
1875
|
the embedder, and the note lands with words only. Missing weights: the note lands with
|
|
1876
1876
|
words only and prints nothing about it — doctor and the backfill name a missing table.
|
|
1877
|
+
|
|
1878
|
+
## 2026-09-27 — trait nudges in the export and `fired` (working defaults)
|
|
1879
|
+
|
|
1880
|
+
- **`export --markdown` carries a memory's nudges** as a `## Traits` list after its
|
|
1881
|
+
`## Feelings` (`1. agreeable-candid → candid · 0.6 — carried by: …`). The row is only
|
|
1882
|
+
there when it is not confidential or the owner passed `--include-confidential`, so the
|
|
1883
|
+
section reads with its words.
|
|
1884
|
+
- **`fired` gained one row, `traits`** ("a memory that showed how I acted was given a
|
|
1885
|
+
trait nudge"), a probe over live memories dated by the newest nudge. It is plumbing in
|
|
1886
|
+
`counterparts mechanisms` (no mechanism line of its own: traits feed nothing), so it
|
|
1887
|
+
shows in the plumbing count and in `mechanisms --all`. No doctor line: nothing there
|
|
1888
|
+
fits without forcing it.
|
|
@@ -198,6 +198,7 @@ import { repairDates } from "./repair-dates.js";
|
|
|
198
198
|
import type { Confidence } from "./repair-dates.js";
|
|
199
199
|
import { NO_PAGE_LINES, bodyFrom, pageLines, versionLines, writeLines } from "./self-page.js";
|
|
200
200
|
import { coreListLines, dreamListLines, dreamShowLines } from "./dream-core.js";
|
|
201
|
+
import { REFLECTED_FEELING_KEY } from "../../core/sleep/index.js";
|
|
201
202
|
// The console's shared manners (2026-09-21): is there a person here, ask them,
|
|
202
203
|
// and say one marked line back.
|
|
203
204
|
import { ask, confirm, isInteractive, isPromptAborted, paint, typed, ui } from "./ui.js";
|
|
@@ -717,7 +718,7 @@ export const COMMAND_FLAGS: Record<Command, readonly string[]> = {
|
|
|
717
718
|
// session does not belong there.
|
|
718
719
|
"self-page": ["write", "file", "stdin", "reason", "versions", "version", "restore", "clear", "if-version"],
|
|
719
720
|
dream: ["list", "show", "undo"],
|
|
720
|
-
core: ["list", "demote", "reason"],
|
|
721
|
+
core: ["list", "demote", "reason", "reflected-feeling"],
|
|
721
722
|
// `--config` because the store it opens is the one the CONFIGURATION names —
|
|
722
723
|
// that is the whole point of the command over `counterparts-dashboard serve`,
|
|
723
724
|
// which refuses until you name a store. `--dir` still parses (it is common)
|
|
@@ -782,9 +783,9 @@ export const COMMAND_BLURB: Record<Command, string> = {
|
|
|
782
783
|
"self-page":
|
|
783
784
|
"The written page the wake opens with. With no flags it prints the page, its date and its size; --write --file <path> or --write --stdin replaces it whole, keeping every earlier version; --versions lists those and --version <seq> prints one. Reading works under observer; writing refuses there.",
|
|
784
785
|
dream:
|
|
785
|
-
"What each dream did, and its undo. With no flags (or --list), the recent dreams: date, state, title and what changed; --show <id> prints one dream's journal
|
|
786
|
+
"What each dream did, and its undo — and what the waking self made of it. With no flags (or --list), the recent dreams: date, state, title and what changed, then the recent reflections; --show <id> prints one dream's journal, every change it made and the reflection after it (--show <rfl_…> prints one reflection: its questions, entry, what it rests on and its morning share); --undo <id> reverses that dream's whole batch (merges come apart, links and gists go, replays and nominations are taken back) and keeps its journal, marked undone — a reflection is lived and stays. Reading works under observer; --undo refuses there.",
|
|
786
787
|
core:
|
|
787
|
-
"The core — the memories about me and about
|
|
788
|
+
"The core — the memories about me, about us and about the owner that do not fade. With no flags (or --list), what it holds and which lane carried each one there, what dreams have nominated, and what you sent back; --demote <id> --reason \"...\" sends one back to ordinary fading from today, records why, and keeps the lanes from promoting it again; --reflected-feeling on|off opens or closes the core to reflection alone. On (the default): a feeling a reflection records later and a reflection citing a memory both count toward the fast lane, and a reflection may re-label what a memory is about either way — each re-label is recorded with its reason, and one into me, us or the owner is told in the next morning share. Off: nothing reaches the core on a reflection alone — the fast lane needs a feeling felt at the time (not one a reflection recorded later) and an ordinary use after a gap (not a reflection citing it), and a reflection may only move what a memory is about toward work or world. Reading works under observer; the two changes refuse there.",
|
|
788
789
|
dashboard:
|
|
789
790
|
"Open the dashboard in your browser: the web view of the store your configuration names, served on 127.0.0.1 and nowhere else. Ctrl-C stops it. Looking is read-only — it strengthens nothing and deposits nothing. What you do there on purpose (write a note, remove a memory, back up, …) runs through these same commands, and a removal asks you to type the id back.",
|
|
790
791
|
version: "The version of Counterparts you have. It opens nothing.",
|
|
@@ -809,7 +810,7 @@ const COMMAND_ARGS: Partial<Record<Command, string>> = {
|
|
|
809
810
|
disconnect: " [claude-code]",
|
|
810
811
|
help: " [advanced | <command>]",
|
|
811
812
|
dream: " [--show <id> | --undo <id>]",
|
|
812
|
-
core: " [--demote <id> --reason \"...\"]",
|
|
813
|
+
core: " [--demote <id> --reason \"...\" | --reflected-feeling on|off]",
|
|
813
814
|
};
|
|
814
815
|
|
|
815
816
|
/**
|
|
@@ -1024,11 +1025,12 @@ const DREAM_FLAG_HELP: Record<string, string> = {
|
|
|
1024
1025
|
undo: "reverse one dream's whole batch, by id (the id follows the flag); its journal is kept, marked undone",
|
|
1025
1026
|
};
|
|
1026
1027
|
|
|
1027
|
-
/** `core`'s own
|
|
1028
|
+
/** `core`'s own four. */
|
|
1028
1029
|
const CORE_FLAG_HELP: Record<string, string> = {
|
|
1029
1030
|
list: "what the core holds, with lanes, nominations and demotions — the default",
|
|
1030
1031
|
demote: "send one core memory back to ordinary fading from today, by id; needs --reason",
|
|
1031
1032
|
reason: "why — recorded with the demotion, and shown by --list",
|
|
1033
|
+
"reflected-feeling": "on or off — can a memory reach the core on reflection alone? On (the default): a feeling a reflection records later and a reflection citing a memory both count toward the fast lane, and a reflection may re-label what a memory is about either way — each re-label is recorded with its reason, and one into me, us or the owner is told in the next morning share. Off: nothing reaches the core on a reflection alone — the fast lane needs a feeling felt at the time (not one a reflection recorded later) and an ordinary use after a gap (not a reflection citing it), and a reflection may only move what a memory is about toward work or world.",
|
|
1032
1034
|
};
|
|
1033
1035
|
|
|
1034
1036
|
const DASHBOARD_FLAG_HELP: Record<string, string> = {
|
|
@@ -1321,6 +1323,9 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1321
1323
|
// --undo` reuses `start-fresh`'s boolean and takes the id positionally.
|
|
1322
1324
|
show: { type: "string" },
|
|
1323
1325
|
demote: { type: "string" },
|
|
1326
|
+
// `core --reflected-feeling on|off` (2026-09-27): a string, so a bare
|
|
1327
|
+
// flag is a refusal rather than a `true` read as a choice.
|
|
1328
|
+
"reflected-feeling": { type: "string" },
|
|
1324
1329
|
observer: { type: "boolean" },
|
|
1325
1330
|
help: { type: "boolean" },
|
|
1326
1331
|
// `scope`'s five. Declared as booleans for the same reason `rebuild` is:
|
|
@@ -2067,6 +2072,30 @@ function coreCommand(dir: string, io: Io, parsed: Parsed, observer: boolean, nam
|
|
|
2067
2072
|
}
|
|
2068
2073
|
const demote = parsed.flags["demote"];
|
|
2069
2074
|
const reason = parsed.flags["reason"];
|
|
2075
|
+
const reflected = parsed.flags["reflected-feeling"];
|
|
2076
|
+
if (reflected !== undefined) {
|
|
2077
|
+
if (reflected !== "on" && reflected !== "off") {
|
|
2078
|
+
io.err("refused: --reflected-feeling takes on or off.");
|
|
2079
|
+
return EXIT.usage;
|
|
2080
|
+
}
|
|
2081
|
+
if (observer) {
|
|
2082
|
+
io.err("refused: this console is an observer; it reads and changes nothing. Nothing was changed.");
|
|
2083
|
+
return EXIT.refused;
|
|
2084
|
+
}
|
|
2085
|
+
const counterpart = openCounterpart(dir, observer);
|
|
2086
|
+
try {
|
|
2087
|
+
counterpart.store.setMeta(REFLECTED_FEELING_KEY, reflected);
|
|
2088
|
+
io.out(
|
|
2089
|
+
reflected === "on"
|
|
2090
|
+
? "On: a feeling a reflection records later and a reflection citing a memory both count toward the fast lane, and a reflection may re-label what a memory is about either way — each re-label is recorded with its reason, and one into me, us or the owner is told in the next morning share."
|
|
2091
|
+
: "Off: nothing reaches the core on a reflection alone — the fast lane needs a feeling felt at the time (not one a reflection recorded later) and an ordinary use after a gap (not a reflection citing it), and a reflection may only move what a memory is about toward work or world.",
|
|
2092
|
+
);
|
|
2093
|
+
io.out(" It takes effect at the next consolidation. Nothing already in the core moves.");
|
|
2094
|
+
return EXIT.ok;
|
|
2095
|
+
} finally {
|
|
2096
|
+
counterpart.close();
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2070
2099
|
if (reason !== undefined && typeof demote !== "string") {
|
|
2071
2100
|
io.err("refused: --reason goes with a --demote. Pass one, or leave it out.");
|
|
2072
2101
|
return EXIT.usage;
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* tests can check the words without a store.
|
|
10
10
|
*/
|
|
11
11
|
import type { Counterpart } from "../../core/counterpart.js";
|
|
12
|
+
import { acceptsReflectedFeeling } from "../../core/sleep/index.js";
|
|
13
|
+
import type { ReflectionRow } from "../../core/store/index.js";
|
|
12
14
|
|
|
13
15
|
/** How a memory id reads in a list: its first line, or why it is not shown. */
|
|
14
16
|
export function memoryWords(counterpart: Counterpart, id: string | null, max = 80): string {
|
|
@@ -45,11 +47,66 @@ export function dreamListLines(counterpart: Counterpart, limit = 20): string[] {
|
|
|
45
47
|
out.push(`${dream.id} ${when} ${dream.state.padEnd(9)} ${title} — ${countsLine(counts)}`);
|
|
46
48
|
}
|
|
47
49
|
out.push("", "Read one: counterparts dream --show <id> Reverse one: counterparts dream --undo <id>");
|
|
50
|
+
const reflections = counterpart.reflections.list(10);
|
|
51
|
+
if (reflections.length > 0) {
|
|
52
|
+
out.push("", `Reflections — the waking self, newest first (${String(reflections.length)} shown)`, "");
|
|
53
|
+
for (const r of reflections) out.push(`${r.id} ${r.date ?? `lived day ${String(r.day)}`} ${reflectionSummary(r)}`);
|
|
54
|
+
out.push("", "Read one: counterparts dream --show <rfl_…>");
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function parseIdList(json: string): string[] {
|
|
60
|
+
try {
|
|
61
|
+
const v: unknown = JSON.parse(json);
|
|
62
|
+
return Array.isArray(v) ? v.filter((x): x is string => typeof x === "string") : [];
|
|
63
|
+
} catch {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** One line: after which dream, what it did, and what became of the share. */
|
|
69
|
+
function reflectionSummary(r: ReflectionRow): string {
|
|
70
|
+
const parts: string[] = [];
|
|
71
|
+
parts.push(r.dream_id === null ? "on its own" : `after ${r.dream_id}`);
|
|
72
|
+
if (r.state !== "reflected") return `${parts.join(", ")} — begun, not finished`;
|
|
73
|
+
if (r.entry_id === null) parts.push("nothing much");
|
|
74
|
+
if (r.page_version !== null) parts.push("rewrote the page");
|
|
75
|
+
const share: Record<string, string> = { none: "no share", offered: "share not told yet", carried: "share carried to a later session", told: "share told" };
|
|
76
|
+
parts.push(share[r.share_state] ?? r.share_state);
|
|
77
|
+
return parts.join(", ");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** `counterparts dream --show <rfl_…>`: one reflection, whole. */
|
|
81
|
+
export function reflectionShowLines(counterpart: Counterpart, id: string): string[] | null {
|
|
82
|
+
const r = counterpart.reflections.show(id);
|
|
83
|
+
if (r === null) return null;
|
|
84
|
+
const out = [
|
|
85
|
+
`Reflection ${r.id} — ${r.date ?? `lived day ${String(r.day)}`}, ${reflectionSummary(r)}`,
|
|
86
|
+
...(r.session === null ? [] : [` for session ${r.session}`]),
|
|
87
|
+
"",
|
|
88
|
+
"Asked:",
|
|
89
|
+
...parseIdList(r.questions).map((q) => ` - ${q}`),
|
|
90
|
+
"",
|
|
91
|
+
r.entry === null ? "Entry: (not written)" : "Entry:",
|
|
92
|
+
];
|
|
93
|
+
if (r.entry !== null) for (const line of r.entry.split("\n")) out.push(` ${line}`);
|
|
94
|
+
if (r.entry_id !== null) out.push(` (kept as memory ${r.entry_id})`);
|
|
95
|
+
const cites = parseIdList(r.cites);
|
|
96
|
+
if (cites.length > 0) {
|
|
97
|
+
out.push("", "It rests on:");
|
|
98
|
+
for (const c of cites) out.push(` ${c} "${memoryWords(counterpart, c)}"`);
|
|
99
|
+
}
|
|
100
|
+
if (r.share !== null) {
|
|
101
|
+
out.push("", "Morning share:", ` ${r.share}`);
|
|
102
|
+
}
|
|
103
|
+
if (r.page_version !== null) out.push("", `It rewrote the self page (version ${String(r.page_version)}): counterparts self-page --versions`);
|
|
48
104
|
return out;
|
|
49
105
|
}
|
|
50
106
|
|
|
51
|
-
/** `counterparts dream --show <id>`: the journal, then every change, undone ones marked. */
|
|
107
|
+
/** `counterparts dream --show <id>`: the journal, then every change, undone ones marked — and the reflection after it. */
|
|
52
108
|
export function dreamShowLines(counterpart: Counterpart, id: string): string[] | null {
|
|
109
|
+
if (id.startsWith("rfl_")) return reflectionShowLines(counterpart, id);
|
|
53
110
|
const shown = counterpart.dreams.show(id);
|
|
54
111
|
if (shown === null) return null;
|
|
55
112
|
const { dream, changes } = shown;
|
|
@@ -90,6 +147,11 @@ export function dreamShowLines(counterpart: Counterpart, id: string): string[] |
|
|
|
90
147
|
}
|
|
91
148
|
}
|
|
92
149
|
if (dream.state !== "undone") out.push("", `Reverse all of it: counterparts dream --undo ${dream.id}`);
|
|
150
|
+
// What the waking self made of it — lived, so an undo of the dream leaves it.
|
|
151
|
+
for (const r of counterpart.store.reflections({ dreamId: dream.id, limit: 3 })) {
|
|
152
|
+
const lines = reflectionShowLines(counterpart, r.id);
|
|
153
|
+
if (lines !== null) out.push("", ...lines);
|
|
154
|
+
}
|
|
93
155
|
return out;
|
|
94
156
|
}
|
|
95
157
|
|
|
@@ -108,8 +170,13 @@ export function coreListLines(counterpart: Counterpart): string[] {
|
|
|
108
170
|
}
|
|
109
171
|
out.push(
|
|
110
172
|
"",
|
|
111
|
-
"Only a memory about me or about
|
|
112
|
-
"
|
|
173
|
+
"Only a memory about me, about us or about the owner becomes core — what it is about is marked by",
|
|
174
|
+
"meaning, by the writer or by a reflection (work and world are not candidates). Then: strongly felt",
|
|
175
|
+
"and back after a gap (fast lane), or back on several separate days over weeks (slow lane). A",
|
|
176
|
+
"reflection that cites a memory counts as it coming back. At most a few a night.",
|
|
177
|
+
acceptsReflectedFeeling(counterpart.store)
|
|
178
|
+
? "Open to reflection alone: a feeling a reflection records later and a reflection citing a memory count toward the fast lane, and a reflection may re-label either way (counterparts core --reflected-feeling off to close it)."
|
|
179
|
+
: "Closed to reflection alone: the fast lane needs a feeling felt at the time and an ordinary use after a gap, and a reflection may only move a memory toward work or world (counterparts core --reflected-feeling on to open it).",
|
|
113
180
|
);
|
|
114
181
|
if (nominated.length > 0) {
|
|
115
182
|
out.push("", "Nominated by a dream (a lane still has to promote it):");
|
|
@@ -260,7 +260,9 @@ function collectMarkdown(store: Store, opts: ExportOptions): { bundle: Bundle; c
|
|
|
260
260
|
// THE MEMORY'S FEELINGS TRAVEL WITH IT (schema v7, review N7): a short
|
|
261
261
|
// section after the body, one line each, so the readable copy says what the
|
|
262
262
|
// database does. The database export carries the table whole.
|
|
263
|
-
|
|
263
|
+
// Its trait nudges too (v9), the same way. The row is here, so it was
|
|
264
|
+
// either not confidential or the owner asked for confidential ones.
|
|
265
|
+
const text = rendered + feelingsSection(store, id) + traitsSection(store, id);
|
|
264
266
|
put(pathFor(store, row, doc), text);
|
|
265
267
|
counts.rows += 1;
|
|
266
268
|
if (row.type === "episode") counts.journal += 1;
|
|
@@ -316,6 +318,22 @@ function feelingsSection(store: Store, id: string): string {
|
|
|
316
318
|
return `\n\n## Feelings\n\n${lines.join("\n")}\n`;
|
|
317
319
|
}
|
|
318
320
|
|
|
321
|
+
/** `\n## Traits\n\n1. agreeable-candid → candid · 0.6 — carried by …`, or "" when none. */
|
|
322
|
+
function traitsSection(store: Store, id: string): string {
|
|
323
|
+
let rows;
|
|
324
|
+
try {
|
|
325
|
+
rows = store.traitsFor(id, { includeConfidential: true });
|
|
326
|
+
} catch {
|
|
327
|
+
return "";
|
|
328
|
+
}
|
|
329
|
+
if (rows.length === 0) return "";
|
|
330
|
+
const lines = rows.map((r, i) => {
|
|
331
|
+
const by = r.carried_by.length === 0 ? "" : ` — carried by: ${r.carried_by.replace(/\r?\n/g, " ")}`;
|
|
332
|
+
return `${String(i + 1)}. ${r.axis} → ${r.toward} · ${String(r.strength)}${by}`;
|
|
333
|
+
});
|
|
334
|
+
return `\n\n## Traits\n\n${lines.join("\n")}\n`;
|
|
335
|
+
}
|
|
336
|
+
|
|
319
337
|
function pathFor(store: Store, row: MemoryRow, doc: ProseDoc): string {
|
|
320
338
|
if (row.type === "episode") return journalRelativePath(doc);
|
|
321
339
|
if (row.type === "schema") {
|
|
@@ -734,7 +752,8 @@ function markdownReadme(census: MarkdownCensus, opts: ExportOptions): string {
|
|
|
734
752
|
"",
|
|
735
753
|
"- `memories/<kind>/<id>.md` — one file per memory, grouped by kind. The file name is",
|
|
736
754
|
" the memory's id; the title, dates and everything else are in the frontmatter, and",
|
|
737
|
-
" any feelings recorded on it are a `## Feelings` list after the words
|
|
755
|
+
" any feelings recorded on it are a `## Feelings` list after the words, and any trait",
|
|
756
|
+
" nudges a `## Traits` list after those.",
|
|
738
757
|
census.archived === 0
|
|
739
758
|
? " None of them is archived: every memory here is a live one."
|
|
740
759
|
: ` ${String(census.archived)} of them ${census.archived === 1 ? "is" : "are"} ARCHIVED — faded, superseded or merged.` +
|