@hcflabs/pi-memory 0.0.0-stage → 9.3.0

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Henry Wang
4
+ Copyright (c) 2026 hcflabs
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,143 @@
1
- # Temporary Holding Version
1
+ # `@hcflabs/pi-memory`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Keep durable preferences and cross-project facts across Pi sessions in size-limited Markdown stores.
4
+
5
+ Inspired by [Hermes Agent](https://github.com/NousResearch/hermes-agent) and its bounded `MEMORY.md`/`USER.md` cross-session memory pattern.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pi install npm:@hcflabs/pi-ask-question
11
+ pi install npm:@hcflabs/pi-task-models
12
+ pi install npm:@hcflabs/pi-memory
13
+ ```
14
+
15
+ Configure `balanced` in `/task-models`.
16
+
17
+ ## Works with
18
+
19
+ | Package | Relationship | Purpose |
20
+ | --- | --- | --- |
21
+ | [`@hcflabs/pi-ask-question`](https://github.com/hcflabs/pi-harness/tree/main/extensions/pi-ask-question) | Required | Provides validated conflict prompts. |
22
+ | [`@hcflabs/pi-herdr-tools`](https://github.com/hcflabs/pi-harness/tree/main/extensions/pi-herdr-tools) | Improves | Marks side-thread children to exclude parent-only memory injection and dream advice. |
23
+ | [`@hcflabs/pi-task-models`](https://github.com/hcflabs/pi-harness/tree/main/extensions/pi-task-models) | Required | Provides routes for candidate review, `/remember` preparation, and `/dream` promotion. |
24
+
25
+ ## Use
26
+
27
+ Run `/remember I prefer concise release notes.` Pi proposes and reviews an entry, then saves it to `USER.md` or asks about conflicts. Confirm the entry in `~/.pi/agent/config/pi-memory/memory/USER.md`, or your configured `directory`.
28
+
29
+ | Surface | Type | Purpose |
30
+ | --- | --- | --- |
31
+ | `/remember <instruction>` | command | For humans: request compact durable memory. |
32
+ | `/dream` | command | For humans: promote invariant memory instructions into agent-global `~/.pi/agent/SYSTEM.md`. |
33
+ | `memory` | tool | For agents: add, replace, remove, or batch-edit entries. |
34
+ | `pi-memory/reviewCandidate` | model task | For humans: assign a profile in `/task-models`. The task reviews additions. |
35
+ | `pi-memory/prepareCandidate` | model task | For humans: assign a profile in `/task-models`. The task proposes a `/remember` entry and target, or declines. |
36
+ | `pi-memory/promoteEntries` | model task | For humans: assign a profile in `/task-models`. The task proposes one guarded `/dream` promotion. |
37
+
38
+ ## Flow
39
+
40
+ ### Candidate review
41
+
42
+ `pi-memory/reviewCandidate` independently reviews single adds and batches containing adds. It defaults to `balanced`, tries configured Pi registry primary then fallback routes, and never substitutes the session model. Only verified bounded JSON evidence is accepted.
43
+
44
+ ![/remember prepares a candidate before preflight. The memory tool enters preflight directly. Adds need review; exact duplicates skip it. Replace/remove go directly to locked storage. Session snapshots stay fixed.](./docs/memory-architecture.svg)
45
+
46
+ Review sends live agent-global `SYSTEM.md`, `MEMORY.md`, and `USER.md` snapshots to the configured model. Initially missing `SYSTEM.md` counts as empty. Unreadable, oversized, or over-cap sources block review. Restore a SYSTEM file that disappears after review proved it present.
47
+
48
+ Conflict-free additions save immediately. Exact duplicate single adds and duplicate-only add batches are idempotent and skip review.
49
+
50
+ Conflict prompts offer **Merge with existing entries**, **Discard the new entry, keep current**, **Replace current entry**, and **Something else.** The recommended choice comes first: merge for overlap, replace for contradiction, discard for SYSTEM conflicts. Candidate review never edits SYSTEM.md.
51
+
52
+ An approved merge or replacement requires a single add conflicting with exactly one same-store entry. Review checks it against other sources again; saving requires unchanged sources. Discard writes nothing. Custom answers, cross-target or ambiguous conflicts, conflicting batches, cancellation, and non-interactive UI leave candidates unwritten. SYSTEM.md conflicts cannot be resolved here.
53
+
54
+ ### `/remember` and queued work
55
+
56
+ ![Remember requests and conflicts wait in separate queues; after settlement, conflicts run first, then requests, with live-source checks before review and writes](./docs/remember-queue-flow.svg)
57
+
58
+ `/remember` uses bounded `pi-memory/prepareCandidate` proposals: one exact entry and target, or a decline for unsuitable, project-specific, temporary, or trivial content. It requires the configured `balanced` route, unchanged sources, and candidate review. It never sends open-ended instructions to the session agent.
59
+
60
+ Active responses queue trimmed `/remember` requests and interactive conflict questions separately. Queued conflicts return `queued: true`, `saved: false`; nothing is saved. The agent must finish replying without retrying or asking the user itself.
61
+
62
+ After settlement, conflicts run first, then remember requests: FIFO within each queue, only while idle. Each item re-reads live sources; remaining conflicts use `ask_question`. Idle requests can ask immediately. Deferred results and failures use UI notifications, not new agent turns.
63
+
64
+ Cancellation drops both queues before further preparation, dialogs, or writes, even without a context cancellation signal. Shutdown, reload, or session replacement also clears queues. Dropped requests never return; completed writes remain saved. Issue a new `/remember` if needed.
65
+
66
+ `/remember` rejects writes if another response starts, the session shuts down or changes, or the model changes during review. This applies without an idle cancellation signal; retry in the current session.
67
+
68
+ ### `/dream`
69
+
70
+ Pi recommends `/dream` for non-empty memory with no recorded dream, or one at least 30 days old. It also recommends it when either store reaches 70% and the last dream was at least 7 days ago.
71
+
72
+ `/dream` requires an interactive UI, a configured `balanced` route, and existing, readable, non-symlink `~/.pi/agent/SYSTEM.md`. Create that file deliberately and completely: a partial SYSTEM replaces Pi's default prompt. SYSTEM edits take effect in a new session.
73
+
74
+ `/dream` shows `Dream running…` in Pi's bordered loading widget, as `/rename` does, before it reads files or requests a model proposal. The status clears when the command ends, is cancelled, or the session or model changes.
75
+
76
+ `pi-memory/promoteEntries` proposes one exact SYSTEM edit and the whole memory entries it represents. The approval screen fits the current terminal size. It shows the reason, a colored SYSTEM diff with line numbers, and all entries to remove from each store. Use Page Up and Page Down to scroll; Home and End go to the start and end. The approval controls stay visible. If the terminal is too small, enlarge it or press Esc to reject.
77
+
78
+ Use Up and Down to select a control, then Enter to confirm. `Reject` is selected by default. Select `Approve` to proceed; `Reject` or Esc changes nothing.
79
+
80
+ After approval, pi-memory checks that SYSTEM and both stores remain unchanged. It writes SYSTEM first, then removes entries. A failed SYSTEM write removes nothing. If removal fails, run `/dream` again to reconcile; the timestamp does not advance. Successful runs record time in `~/.pi/agent/config/pi-memory/dream.json`.
81
+
82
+ Commands stop before writes when Pi supplies a cancellation signal that aborts. Idle Pi can supply no signal. After a SYSTEM edit saves, entry removal continues even on cancellation, so a retry can reconcile it.
83
+
84
+ ### Per-turn memory check
85
+
86
+ The current agent decides what qualifies for memory. Each turn's check asks it to save durable user identity, preferences, and corrections to `target=user`. Stable cross-project environment and workflow facts use `target=memory`.
87
+
88
+ Use the tool immediately for qualifying facts. Inferred habits need two independent signals from the conversation or existing profile. Skip repository facts, task-local behavior, progress, and temporary preferences.
89
+
90
+ ## Config
91
+
92
+ Package-owned: `~/.pi/agent/config/pi-memory/config.json`. You write this optional file; pi-memory never creates or rewrites it. It reads config at session start. Missing fields or files use defaults; restart the session after changes.
93
+
94
+ | Name | Description | Values | Default |
95
+ | --- | --- | --- | --- |
96
+ | `directory` | Folder for both stores. | Non-empty absolute path without control characters. | `~/.pi/agent/config/pi-memory/memory` |
97
+ | `memoryCharLimit` | Character cap for `MEMORY.md`. | Safe integer from 1 to 100000. | `8800` |
98
+ | `userCharLimit` | Character cap for `USER.md`. | Safe integer from 1 to 100000. | `5500` |
99
+
100
+ Warnings and errors give the path and each problem:
101
+
102
+ | Problem | Result |
103
+ | --- | --- |
104
+ | Unknown key or invalid limit | Warn; ignore unknown keys and use defaults for invalid limits. |
105
+ | Misspelled key near a missing key | Treat that field as invalid; `memoryCharLimt` uses the default `memoryCharLimit`. |
106
+ | Invalid `directory`, including `directroy` without `directory` | Disable persistent memory; never substitute the default directory. |
107
+ | Malformed JSON, invalid UTF-8, over 64 KiB, unreadable file, non-object root | Disable persistent memory. |
108
+
109
+ Fix invalid config, then start a new session.
110
+
111
+ ## State and storage
112
+
113
+ | Store | Scope |
114
+ | --- | --- |
115
+ | `MEMORY.md` | Cross-project agent notes. Put repository facts in repository docs. |
116
+ | `USER.md` | User profile. |
117
+
118
+ Files hold entries separated by `§`. Each session captures both stores once; later edits change live memory, not the injected session snapshot.
119
+
120
+ pi-memory tracks stores proven present during the session, including invalid UTF-8, oversized, and symlinked files. If one disappears, writes stop until restoration. Unconfirmed paths can be repaired and created normally; new sessions reset presence tracking. Inspect live state at `<directory>/MEMORY.md` and `<directory>/USER.md`.
121
+
122
+ Backups and the lock file stay outside `directory`, under `~/.pi/agent/config/pi-memory/backups/`. Before rewriting an existing store, pi-memory overwrites its matching `MEMORY.md.bak` or `USER.md.bak` with the previous contents. Failed writes can also update backups; first writes to missing stores create none. Backups are not versioned history.
123
+
124
+ You can use iCloud Drive or an Obsidian-synced folder as `directory`. Sync only carries files; pi-memory owns their format and does not merge remote changes.
125
+
126
+ ## Limits and recovery
127
+
128
+ Cloud-synced files can be read outside Pi. Before using shared or synced storage, read [ADR 006: pi-memory global store threat model](https://github.com/hcflabs/pi-harness/blob/main/docs/adr/006-pi-memory-global-store-threat-model.md).
129
+
130
+ Writes over a store cap fail with current usage. Consolidate with one batch that removes or shortens stale entries and adds new content; only final size counts. Batches allow at most 100 operations; complete serialized mutations allow at most 1,000,000 UTF-8 bytes. Both limits apply before source reads or review; violations write nothing.
131
+
132
+ External edits or sync can exceed caps; snapshots omit overflow and warn. Startup lists at most three unexpected regular filenames, stopping on the fourth with `at least four unexpected files`. Only `MEMORY.md` and `USER.md` load. Reconcile or remove unexpected files.
133
+
134
+ ### Restore a backup
135
+
136
+ Never copy backups over live or damaged stores:
137
+
138
+ 1. Stop all Pi sessions and other writers using `directory`. Pause cloud sync. Keep them stopped during restoration.
139
+ 2. Preserve the damaged file in a recovery folder outside `directory` and the backup folder. Verify that copy. Move the damaged file out of `directory`; do not delete it or overwrite the backup.
140
+ 3. Inspect the matching `MEMORY.md.bak` or `USER.md.bak` for wanted entries, valid UTF-8, `§` delimiters, and the configured character cap. Stop if it is missing or damaged; backups provide no older versions.
141
+ 4. Copy the checked backup to the vacant `<directory>/MEMORY.md` or `<directory>/USER.md` as a regular file, not a symlink. Preserve restrictive permissions, especially for `USER.md`.
142
+ 5. Start one new Pi session. Confirm initialization without store warnings. Inspect the restored file and new snapshot before writing; old sessions cannot validate restored state.
143
+ 6. Check for remote changes that could replace the restored file. Only then resume other writers and sync.
@@ -0,0 +1,195 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>How pi-memory writes reviewed memory</title>
7
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">
8
+ <style>
9
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
10
+ :root {
11
+ --paper: #f0eee9;
12
+ --ink: #101828;
13
+ --muted: #4c5665;
14
+ --soft: #6a7282;
15
+ --accent: #1d4ed8;
16
+ --sans: 'Geist', system-ui, sans-serif;
17
+ --serif: 'Instrument Serif', serif;
18
+ --mono: 'Geist Mono', ui-monospace, monospace;
19
+ }
20
+ body {
21
+ min-height: 100vh;
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: center;
25
+ padding: 32px;
26
+ background: var(--paper);
27
+ color: var(--ink);
28
+ font-family: var(--sans);
29
+ }
30
+ .frame { width: min(1280px, 100%); max-width: 100%; min-width: 0; }
31
+ .eyebrow {
32
+ margin-bottom: 8px;
33
+ color: var(--muted);
34
+ font: 500 8px/1 var(--mono);
35
+ letter-spacing: .18em;
36
+ text-transform: uppercase;
37
+ }
38
+ .diagram-container { width: 100%; overflow-x: auto; }
39
+ svg { display: block; width: 100%; height: auto; min-width: 1280px; }
40
+ @media print {
41
+ .diagram-container { overflow-x: visible; }
42
+ svg { min-width: 0; }
43
+ }
44
+ </style>
45
+ </head>
46
+ <body>
47
+ <main class="frame">
48
+ <p class="eyebrow">Architecture · pi-memory</p>
49
+ <div class="diagram-container" tabindex="0" role="region" aria-label="Memory architecture diagram; scroll horizontally on narrow screens">
50
+ <svg width="1280" height="720" viewBox="0 0 1280 720" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="memory-architecture-title memory-architecture-desc">
51
+ <title id="memory-architecture-title">How pi-memory writes reviewed memory</title>
52
+ <desc id="memory-architecture-desc">/remember prepares one candidate or declines before preflight, the memory tool enters preflight directly, adds need review unless they are exact duplicates, replace/remove go directly to locked storage, and session start creates a frozen prompt snapshot.</desc>
53
+ <defs>
54
+ <marker id="memory-arrow" markerWidth="8" markerHeight="8" refX="8" refY="4" orient="auto">
55
+ <polygon points="0 0, 8 4, 0 8" fill="#4c5665"/>
56
+ </marker>
57
+ <marker id="memory-arrow-accent" markerWidth="8" markerHeight="8" refX="8" refY="4" orient="auto">
58
+ <polygon points="0 0, 8 4, 0 8" fill="#1d4ed8"/>
59
+ </marker>
60
+ </defs>
61
+
62
+ <rect width="1280" height="720" fill="#f0eee9"/>
63
+ <text x="40" y="52" fill="#101828" font-size="28" font-family="'Instrument Serif', serif">Reviewed writes, frozen reads</text>
64
+
65
+ <!-- Zones -->
66
+ <rect x="40" y="80" width="396" height="496" rx="8" fill="rgba(16,24,40,0.02)" stroke="rgba(16,24,40,0.14)" stroke-width="0.8"/>
67
+ <rect x="56" y="84" width="128" height="16" rx="2" fill="#f0eee9"/>
68
+ <text x="120" y="96" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.14em">CURRENT SESSION</text>
69
+
70
+ <rect x="456" y="80" width="460" height="496" rx="8" fill="rgba(16,24,40,0.02)" stroke="rgba(16,24,40,0.28)" stroke-width="0.8" stroke-dasharray="4,4"/>
71
+ <rect x="472" y="84" width="128" height="16" rx="2" fill="#f0eee9"/>
72
+ <text x="536" y="96" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.14em">REVIEW BOUNDARY</text>
73
+
74
+ <rect x="936" y="80" width="304" height="496" rx="8" fill="rgba(16,24,40,0.02)" stroke="rgba(16,24,40,0.14)" stroke-width="0.8"/>
75
+ <rect x="952" y="84" width="128" height="16" rx="2" fill="#f0eee9"/>
76
+ <text x="1016" y="96" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.14em">DURABLE STATE</text>
77
+
78
+ <!-- Requests: /remember prepares a candidate; the tool enters preflight directly. -->
79
+ <path d="M216 208 H280" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-arrow)"/>
80
+ <rect x="216" y="188" width="64" height="12" rx="2" fill="#f0eee9"/>
81
+ <text x="248" y="196" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">MEMORY TOOL</text>
82
+ <path d="M140 256 V336" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-arrow)"/>
83
+ <rect x="148" y="288" width="56" height="12" rx="2" fill="#f0eee9"/>
84
+ <text x="176" y="296" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">/remember</text>
85
+ <path d="M216 376 H336 Q344 376 344 368 V256" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-arrow)"/>
86
+
87
+ <!-- Adds, including batches with adds, use live sources for review. -->
88
+ <path d="M412 208 H480" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-arrow)"/>
89
+ <rect x="428" y="188" width="36" height="12" rx="2" fill="#f0eee9"/>
90
+ <text x="446" y="196" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">ADDS</text>
91
+ <path d="M344 160 V136 Q344 128 352 128 H1080 Q1088 128 1088 136 V160" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-arrow)"/>
92
+ <rect x="632" y="108" width="108" height="12" rx="2" fill="#f0eee9"/>
93
+ <text x="686" y="116" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">REPLACE/REMOVE</text>
94
+ <path d="M664 208 H708" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-arrow)"/>
95
+ <path d="M892 208 H960" fill="none" stroke="#1d4ed8" stroke-width="1.2" marker-end="url(#memory-arrow-accent)"/>
96
+
97
+ <!-- Conflict path: approved choices are reviewed again before writing -->
98
+ <path d="M800 256 V376" fill="none" stroke="#4c5665" stroke-width="1" stroke-dasharray="4,4" marker-end="url(#memory-arrow)"/>
99
+ <rect x="808" y="308" width="72" height="12" rx="2" fill="#f0eee9"/>
100
+ <text x="844" y="316" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">CONFLICT</text>
101
+ <path d="M892 424 H920 Q928 424 928 416 V304 Q928 296 936 296 H1016 Q1024 296 1024 288 V256" fill="none" stroke="#4c5665" stroke-width="1" stroke-dasharray="4,4" marker-end="url(#memory-arrow)"/>
102
+ <rect x="948" y="276" width="72" height="12" rx="2" fill="#f0eee9"/>
103
+ <text x="984" y="284" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">APPROVED</text>
104
+
105
+ <!-- Persistence and frozen snapshot: separate write-node attach points -->
106
+ <path d="M1148 256 V400" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-arrow)"/>
107
+ <path d="M1088 520 V576 Q1088 584 1080 584 H332 Q324 584 324 576 V520" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-arrow)"/>
108
+ <rect x="612" y="564" width="128" height="12" rx="2" fill="#f0eee9"/>
109
+ <text x="676" y="572" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">SESSION START</text>
110
+ <path d="M236 468 H60 Q52 468 52 460 V240 Q52 232 60 232 H64" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-arrow)"/>
111
+
112
+ <!-- Nodes: current session -->
113
+ <rect x="64" y="160" width="152" height="96" rx="8" fill="#f0eee9"/>
114
+ <rect x="64" y="160" width="152" height="96" rx="8" fill="rgba(76,86,101,0.10)" stroke="#6a7282" stroke-width="1"/>
115
+ <rect x="76" y="172" width="64" height="16" rx="2" fill="rgba(76,86,101,0.14)"/>
116
+ <text x="108" y="184" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">SESSION</text>
117
+ <text x="140" y="212" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Memory request</text>
118
+ <text x="140" y="236" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">/remember · memory tool</text>
119
+
120
+ <rect x="280" y="160" width="132" height="96" rx="8" fill="#f0eee9"/>
121
+ <rect x="280" y="160" width="132" height="96" rx="8" fill="#ffffff" stroke="#101828" stroke-width="1"/>
122
+ <rect x="292" y="172" width="48" height="16" rx="2" fill="rgba(16,24,40,0.08)"/>
123
+ <text x="316" y="184" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">GATE</text>
124
+ <text x="346" y="212" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Preflight</text>
125
+ <text x="346" y="236" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">shape · size · content</text>
126
+
127
+ <rect x="64" y="336" width="152" height="80" rx="8" fill="#f0eee9"/>
128
+ <rect x="64" y="336" width="152" height="80" rx="8" fill="#ffffff" stroke="#101828" stroke-width="1"/>
129
+ <rect x="76" y="348" width="48" height="16" rx="2" fill="rgba(16,24,40,0.08)"/>
130
+ <text x="100" y="360" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">TASK</text>
131
+ <text x="140" y="384" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Prepare candidate</text>
132
+ <text x="140" y="404" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">entry + target · or decline</text>
133
+
134
+ <rect x="236" y="416" width="176" height="104" rx="8" fill="#f0eee9"/>
135
+ <rect x="236" y="416" width="176" height="104" rx="8" fill="rgba(16,24,40,0.05)" stroke="#4c5665" stroke-width="1"/>
136
+ <rect x="248" y="428" width="72" height="16" rx="2" fill="rgba(16,24,40,0.08)"/>
137
+ <text x="284" y="440" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">SNAPSHOT</text>
138
+ <text x="324" y="468" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Frozen prompt</text>
139
+ <text x="324" y="492" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">unchanged for the session</text>
140
+
141
+ <!-- Nodes: review boundary -->
142
+ <rect x="480" y="160" width="184" height="96" rx="8" fill="#f0eee9"/>
143
+ <rect x="480" y="160" width="184" height="96" rx="8" fill="rgba(16,24,40,0.05)" stroke="#4c5665" stroke-width="1"/>
144
+ <rect x="492" y="172" width="64" height="16" rx="2" fill="rgba(16,24,40,0.08)"/>
145
+ <text x="524" y="184" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">CONTEXT</text>
146
+ <text x="572" y="212" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Live sources</text>
147
+ <text x="572" y="232" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">SYSTEM · MEMORY · USER</text>
148
+ <text x="572" y="244" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">bounded · validated</text>
149
+
150
+ <rect x="708" y="160" width="184" height="96" rx="8" fill="#f0eee9"/>
151
+ <rect x="708" y="160" width="184" height="96" rx="8" fill="rgba(29,78,216,0.08)" stroke="#1d4ed8" stroke-width="1.2"/>
152
+ <rect x="720" y="172" width="48" height="16" rx="2" fill="rgba(29,78,216,0.14)"/>
153
+ <text x="744" y="184" fill="#1d4ed8" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">TASK</text>
154
+ <text x="800" y="212" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Candidate review</text>
155
+ <text x="800" y="236" fill="#1d4ed8" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">adds only · duplicates skip</text>
156
+
157
+ <rect x="708" y="376" width="184" height="96" rx="8" fill="#f0eee9"/>
158
+ <rect x="708" y="376" width="184" height="96" rx="8" fill="rgba(16,24,40,0.02)" stroke="rgba(16,24,40,0.28)" stroke-width="1" stroke-dasharray="4,4"/>
159
+ <rect x="720" y="388" width="32" height="16" rx="2" fill="rgba(16,24,40,0.06)"/>
160
+ <text x="736" y="400" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">UI</text>
161
+ <text x="800" y="428" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Conflict choice</text>
162
+ <text x="800" y="448" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">ask_question</text>
163
+ <text x="800" y="460" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">approved · re-review</text>
164
+ <text x="480" y="536" fill="#4c5665" font-size="12" font-style="italic" font-family="'Instrument Serif', serif">Invalid or changed review sources block adds.</text>
165
+
166
+ <!-- Nodes: durable state -->
167
+ <rect x="960" y="160" width="256" height="96" rx="8" fill="#f0eee9"/>
168
+ <rect x="960" y="160" width="256" height="96" rx="8" fill="#ffffff" stroke="#101828" stroke-width="1"/>
169
+ <rect x="972" y="172" width="48" height="16" rx="2" fill="rgba(16,24,40,0.08)"/>
170
+ <text x="996" y="184" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">WRITE</text>
171
+ <text x="1088" y="212" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Locked mutation</text>
172
+ <text x="1088" y="236" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">recheck · atomic rename</text>
173
+
174
+ <rect x="960" y="400" width="256" height="120" rx="8" fill="#f0eee9"/>
175
+ <rect x="960" y="400" width="256" height="120" rx="8" fill="rgba(16,24,40,0.05)" stroke="#4c5665" stroke-width="1"/>
176
+ <rect x="972" y="412" width="48" height="16" rx="2" fill="rgba(16,24,40,0.08)"/>
177
+ <text x="996" y="424" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">STORE</text>
178
+ <text x="1088" y="456" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Durable entries</text>
179
+ <text x="1088" y="480" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">MEMORY.md · USER.md</text>
180
+ <text x="1088" y="496" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">plain · bounded files</text>
181
+
182
+ <!-- Legend -->
183
+ <line x1="40" y1="620" x2="1240" y2="620" stroke="rgba(16,24,40,0.14)" stroke-width="0.8"/>
184
+ <text x="40" y="660" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.14em">LEGEND</text>
185
+ <line x1="160" y1="656" x2="200" y2="656" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-arrow)"/>
186
+ <text x="212" y="660" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace">AUTOMATIC PATH</text>
187
+ <line x1="400" y1="656" x2="440" y2="656" stroke="#4c5665" stroke-width="1" stroke-dasharray="4,4" marker-end="url(#memory-arrow)"/>
188
+ <text x="452" y="660" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace">CONFLICT ONLY</text>
189
+ <rect x="652" y="648" width="16" height="16" rx="4" fill="rgba(29,78,216,0.08)" stroke="#1d4ed8" stroke-width="1"/>
190
+ <text x="680" y="660" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace">INDEPENDENT REVIEW</text>
191
+ </svg>
192
+ </div>
193
+ </main>
194
+ </body>
195
+ </html>
@@ -0,0 +1,155 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="1280" height="720" viewBox="0 0 1280 720" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="memory-architecture-title memory-architecture-desc" id="memory-architecture-root">
3
+ <title id="memory-architecture-title">How pi-memory writes reviewed memory</title>
4
+ <desc id="memory-architecture-desc">/remember prepares one candidate or declines before preflight, the memory tool enters preflight directly, adds need review unless they are exact duplicates, replace/remove go directly to locked storage, and session start creates a frozen prompt snapshot.</desc>
5
+ <defs>
6
+ <style>@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&amp;family=Geist:wght@400;500;600&amp;family=Geist+Mono:wght@400;500;600&amp;family=Noto+Serif:ital@0;1&amp;family=Noto+Sans+KR:wght@400;500;600&amp;family=Noto+Serif+KR:wght@400&amp;family=Noto+Sans+TC:wght@400;500;600&amp;family=Noto+Serif+TC:wght@400&amp;display=swap');
7
+ #memory-architecture-root { --paper: #f0eee9;
8
+ --ink: #101828;
9
+ --muted: #4c5665;
10
+ --soft: #6a7282;
11
+ --accent: #1d4ed8;
12
+ --sans: 'Geist', system-ui, sans-serif;
13
+ --serif: 'Instrument Serif', serif;
14
+ --mono: 'Geist Mono', ui-monospace, monospace; }
15
+ #memory-architecture-root { color: var(--ink); font-family: var(--sans); }
16
+ #memory-architecture-root .diagram-container { width: 100%; overflow-x: auto; }
17
+ #memory-architecture-root .diagram-container { overflow-x: visible; }</style>
18
+ <marker id="memory-architecture-memory-arrow" markerWidth="8" markerHeight="8" refX="8" refY="4" orient="auto">
19
+ <polygon points="0 0, 8 4, 0 8" fill="#4c5665"/>
20
+ </marker>
21
+ <marker id="memory-architecture-memory-arrow-accent" markerWidth="8" markerHeight="8" refX="8" refY="4" orient="auto">
22
+ <polygon points="0 0, 8 4, 0 8" fill="#1d4ed8"/>
23
+ </marker>
24
+ </defs>
25
+
26
+ <rect width="1280" height="720" fill="#f0eee9"/>
27
+ <text x="40" y="52" fill="#101828" font-size="28" font-family="'Instrument Serif', serif">Reviewed writes, frozen reads</text>
28
+
29
+ <!-- Zones -->
30
+ <rect x="40" y="80" width="396" height="496" rx="8" fill="#101828" stroke="#101828" stroke-width="0.8" fill-opacity="0.02" stroke-opacity="0.14"/>
31
+ <rect x="56" y="84" width="128" height="16" rx="2" fill="#f0eee9"/>
32
+ <text x="120" y="96" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.14em">CURRENT SESSION</text>
33
+
34
+ <rect x="456" y="80" width="460" height="496" rx="8" fill="#101828" stroke="#101828" stroke-width="0.8" stroke-dasharray="4,4" fill-opacity="0.02" stroke-opacity="0.28"/>
35
+ <rect x="472" y="84" width="128" height="16" rx="2" fill="#f0eee9"/>
36
+ <text x="536" y="96" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.14em">REVIEW BOUNDARY</text>
37
+
38
+ <rect x="936" y="80" width="304" height="496" rx="8" fill="#101828" stroke="#101828" stroke-width="0.8" fill-opacity="0.02" stroke-opacity="0.14"/>
39
+ <rect x="952" y="84" width="128" height="16" rx="2" fill="#f0eee9"/>
40
+ <text x="1016" y="96" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.14em">DURABLE STATE</text>
41
+
42
+ <!-- Requests: /remember prepares a candidate; the tool enters preflight directly. -->
43
+ <path d="M216 208 H280" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow)"/>
44
+ <rect x="216" y="188" width="64" height="12" rx="2" fill="#f0eee9"/>
45
+ <text x="248" y="196" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">MEMORY TOOL</text>
46
+ <path d="M140 256 V336" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow)"/>
47
+ <rect x="148" y="288" width="56" height="12" rx="2" fill="#f0eee9"/>
48
+ <text x="176" y="296" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">/remember</text>
49
+ <path d="M216 376 H336 Q344 376 344 368 V256" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow)"/>
50
+
51
+ <!-- Adds, including batches with adds, use live sources for review. -->
52
+ <path d="M412 208 H480" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow)"/>
53
+ <rect x="428" y="188" width="36" height="12" rx="2" fill="#f0eee9"/>
54
+ <text x="446" y="196" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">ADDS</text>
55
+ <path d="M344 160 V136 Q344 128 352 128 H1080 Q1088 128 1088 136 V160" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow)"/>
56
+ <rect x="632" y="108" width="108" height="12" rx="2" fill="#f0eee9"/>
57
+ <text x="686" y="116" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">REPLACE/REMOVE</text>
58
+ <path d="M664 208 H708" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow)"/>
59
+ <path d="M892 208 H960" fill="none" stroke="#1d4ed8" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow-accent)"/>
60
+
61
+ <!-- Conflict path: approved choices are reviewed again before writing -->
62
+ <path d="M800 256 V376" fill="none" stroke="#4c5665" stroke-width="1" stroke-dasharray="4,4" marker-end="url(#memory-architecture-memory-arrow)"/>
63
+ <rect x="808" y="308" width="72" height="12" rx="2" fill="#f0eee9"/>
64
+ <text x="844" y="316" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">CONFLICT</text>
65
+ <path d="M892 424 H920 Q928 424 928 416 V304 Q928 296 936 296 H1016 Q1024 296 1024 288 V256" fill="none" stroke="#4c5665" stroke-width="1" stroke-dasharray="4,4" marker-end="url(#memory-architecture-memory-arrow)"/>
66
+ <rect x="948" y="276" width="72" height="12" rx="2" fill="#f0eee9"/>
67
+ <text x="984" y="284" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">APPROVED</text>
68
+
69
+ <!-- Persistence and frozen snapshot: separate write-node attach points -->
70
+ <path d="M1148 256 V400" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow)"/>
71
+ <path d="M1088 520 V576 Q1088 584 1080 584 H332 Q324 584 324 576 V520" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow)"/>
72
+ <rect x="612" y="564" width="128" height="12" rx="2" fill="#f0eee9"/>
73
+ <text x="676" y="572" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">SESSION START</text>
74
+ <path d="M236 468 H60 Q52 468 52 460 V240 Q52 232 60 232 H64" fill="none" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow)"/>
75
+
76
+ <!-- Nodes: current session -->
77
+ <rect x="64" y="160" width="152" height="96" rx="8" fill="#f0eee9"/>
78
+ <rect x="64" y="160" width="152" height="96" rx="8" fill="#4c5665" stroke="#6a7282" stroke-width="1" fill-opacity="0.10"/>
79
+ <rect x="76" y="172" width="64" height="16" rx="2" fill="#4c5665" fill-opacity="0.14"/>
80
+ <text x="108" y="184" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">SESSION</text>
81
+ <text x="140" y="212" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Memory request</text>
82
+ <text x="140" y="236" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">/remember · memory tool</text>
83
+
84
+ <rect x="280" y="160" width="132" height="96" rx="8" fill="#f0eee9"/>
85
+ <rect x="280" y="160" width="132" height="96" rx="8" fill="#ffffff" stroke="#101828" stroke-width="1"/>
86
+ <rect x="292" y="172" width="48" height="16" rx="2" fill="#101828" fill-opacity="0.08"/>
87
+ <text x="316" y="184" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">GATE</text>
88
+ <text x="346" y="212" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Preflight</text>
89
+ <text x="346" y="236" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">shape · size · content</text>
90
+
91
+ <rect x="64" y="336" width="152" height="80" rx="8" fill="#f0eee9"/>
92
+ <rect x="64" y="336" width="152" height="80" rx="8" fill="#ffffff" stroke="#101828" stroke-width="1"/>
93
+ <rect x="76" y="348" width="48" height="16" rx="2" fill="#101828" fill-opacity="0.08"/>
94
+ <text x="100" y="360" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">TASK</text>
95
+ <text x="140" y="384" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Prepare candidate</text>
96
+ <text x="140" y="404" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">entry + target · or decline</text>
97
+
98
+ <rect x="236" y="416" width="176" height="104" rx="8" fill="#f0eee9"/>
99
+ <rect x="236" y="416" width="176" height="104" rx="8" fill="#101828" stroke="#4c5665" stroke-width="1" fill-opacity="0.05"/>
100
+ <rect x="248" y="428" width="72" height="16" rx="2" fill="#101828" fill-opacity="0.08"/>
101
+ <text x="284" y="440" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">SNAPSHOT</text>
102
+ <text x="324" y="468" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Frozen prompt</text>
103
+ <text x="324" y="492" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">unchanged for the session</text>
104
+
105
+ <!-- Nodes: review boundary -->
106
+ <rect x="480" y="160" width="184" height="96" rx="8" fill="#f0eee9"/>
107
+ <rect x="480" y="160" width="184" height="96" rx="8" fill="#101828" stroke="#4c5665" stroke-width="1" fill-opacity="0.05"/>
108
+ <rect x="492" y="172" width="64" height="16" rx="2" fill="#101828" fill-opacity="0.08"/>
109
+ <text x="524" y="184" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">CONTEXT</text>
110
+ <text x="572" y="212" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Live sources</text>
111
+ <text x="572" y="232" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">SYSTEM · MEMORY · USER</text>
112
+ <text x="572" y="244" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">bounded · validated</text>
113
+
114
+ <rect x="708" y="160" width="184" height="96" rx="8" fill="#f0eee9"/>
115
+ <rect x="708" y="160" width="184" height="96" rx="8" fill="#1d4ed8" stroke="#1d4ed8" stroke-width="1.2" fill-opacity="0.08"/>
116
+ <rect x="720" y="172" width="48" height="16" rx="2" fill="#1d4ed8" fill-opacity="0.14"/>
117
+ <text x="744" y="184" fill="#1d4ed8" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">TASK</text>
118
+ <text x="800" y="212" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Candidate review</text>
119
+ <text x="800" y="236" fill="#1d4ed8" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">adds only · duplicates skip</text>
120
+
121
+ <rect x="708" y="376" width="184" height="96" rx="8" fill="#f0eee9"/>
122
+ <rect x="708" y="376" width="184" height="96" rx="8" fill="#101828" stroke="#101828" stroke-width="1" stroke-dasharray="4,4" fill-opacity="0.02" stroke-opacity="0.28"/>
123
+ <rect x="720" y="388" width="32" height="16" rx="2" fill="#101828" fill-opacity="0.06"/>
124
+ <text x="736" y="400" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">UI</text>
125
+ <text x="800" y="428" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Conflict choice</text>
126
+ <text x="800" y="448" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">ask_question</text>
127
+ <text x="800" y="460" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">approved · re-review</text>
128
+ <text x="480" y="536" fill="#4c5665" font-size="12" font-style="italic" font-family="'Instrument Serif', serif">Invalid or changed review sources block adds.</text>
129
+
130
+ <!-- Nodes: durable state -->
131
+ <rect x="960" y="160" width="256" height="96" rx="8" fill="#f0eee9"/>
132
+ <rect x="960" y="160" width="256" height="96" rx="8" fill="#ffffff" stroke="#101828" stroke-width="1"/>
133
+ <rect x="972" y="172" width="48" height="16" rx="2" fill="#101828" fill-opacity="0.08"/>
134
+ <text x="996" y="184" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">WRITE</text>
135
+ <text x="1088" y="212" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Locked mutation</text>
136
+ <text x="1088" y="236" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">recheck · atomic rename</text>
137
+
138
+ <rect x="960" y="400" width="256" height="120" rx="8" fill="#f0eee9"/>
139
+ <rect x="960" y="400" width="256" height="120" rx="8" fill="#101828" stroke="#4c5665" stroke-width="1" fill-opacity="0.05"/>
140
+ <rect x="972" y="412" width="48" height="16" rx="2" fill="#101828" fill-opacity="0.08"/>
141
+ <text x="996" y="424" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.08em">STORE</text>
142
+ <text x="1088" y="456" fill="#101828" font-size="12" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Durable entries</text>
143
+ <text x="1088" y="480" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">MEMORY.md · USER.md</text>
144
+ <text x="1088" y="496" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">plain · bounded files</text>
145
+
146
+ <!-- Legend -->
147
+ <line x1="40" y1="620" x2="1240" y2="620" stroke="#101828" stroke-width="0.8" stroke-opacity="0.14"/>
148
+ <text x="40" y="660" fill="#6a7282" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.14em">LEGEND</text>
149
+ <line x1="160" y1="656" x2="200" y2="656" stroke="#4c5665" stroke-width="1.2" marker-end="url(#memory-architecture-memory-arrow)"/>
150
+ <text x="212" y="660" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace">AUTOMATIC PATH</text>
151
+ <line x1="400" y1="656" x2="440" y2="656" stroke="#4c5665" stroke-width="1" stroke-dasharray="4,4" marker-end="url(#memory-architecture-memory-arrow)"/>
152
+ <text x="452" y="660" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace">CONFLICT ONLY</text>
153
+ <rect x="652" y="648" width="16" height="16" rx="4" fill="#1d4ed8" stroke="#1d4ed8" stroke-width="1" fill-opacity="0.08"/>
154
+ <text x="680" y="660" fill="#4c5665" font-size="8" font-family="'Geist Mono', monospace">INDEPENDENT REVIEW</text>
155
+ </svg>