@aeondave/pi-persona-mind 0.9.6 → 0.9.8

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.
Files changed (55) hide show
  1. package/AGENTS.md +137 -135
  2. package/CHANGELOG.md +287 -270
  3. package/LICENSE +24 -24
  4. package/README.md +84 -171
  5. package/docs/DESIGN.md +605 -573
  6. package/docs/MEMORY-RESEARCH.md +163 -163
  7. package/package.json +15 -6
  8. package/src/core/auto-optimize.ts +323 -249
  9. package/src/core/backlog.ts +228 -228
  10. package/src/core/blocked.ts +38 -38
  11. package/src/core/capture.ts +155 -154
  12. package/src/core/context-budget.ts +74 -74
  13. package/src/core/handoff-store.ts +111 -111
  14. package/src/core/handoff.ts +70 -70
  15. package/src/core/host-compat.ts +16 -16
  16. package/src/core/ids.ts +59 -59
  17. package/src/core/inject.ts +247 -247
  18. package/src/core/knowledge-review.ts +107 -107
  19. package/src/core/memory-read.ts +34 -34
  20. package/src/core/memory.ts +321 -321
  21. package/src/core/migrate.ts +713 -713
  22. package/src/core/mind-settings.ts +54 -54
  23. package/src/core/optimize-history.ts +163 -163
  24. package/src/core/optimize-service.ts +189 -180
  25. package/src/core/optimize.ts +127 -127
  26. package/src/core/retrieval.ts +164 -164
  27. package/src/core/scanner.ts +146 -146
  28. package/src/core/scope.ts +201 -205
  29. package/src/core/service.ts +720 -720
  30. package/src/core/session-memory.ts +71 -71
  31. package/src/core/store.ts +1002 -1002
  32. package/src/extension/activity.ts +79 -79
  33. package/src/extension/auto-optimize-session.ts +143 -143
  34. package/src/extension/auto-optimize.ts +565 -569
  35. package/src/extension/handoff.ts +23 -23
  36. package/src/extension/knowledge-review.ts +229 -229
  37. package/src/extension/memory-inspector.ts +82 -82
  38. package/src/extension/mind-actions.ts +38 -38
  39. package/src/extension/mind-worker.ts +32 -32
  40. package/src/extension/persona-dependency.ts +76 -76
  41. package/src/extension/reference-anchor.ts +48 -0
  42. package/src/extension/review-evidence.ts +222 -222
  43. package/src/extension/worker-memory-anchor.ts +28 -28
  44. package/src/index.ts +1357 -1310
  45. package/src/session-memory.ts +127 -122
  46. package/src/tools/backlog.ts +126 -126
  47. package/src/tools/memory-handoff.ts +30 -30
  48. package/src/tools/memory-history.ts +46 -46
  49. package/src/tools/memory.ts +6 -4
  50. package/src/ui/card-frame.ts +161 -161
  51. package/src/ui/inspector-frame.ts +44 -44
  52. package/src/ui/memory-inspector.ts +464 -464
  53. package/src/ui/mind-result-card.ts +48 -48
  54. package/src/ui/presentation.ts +87 -87
  55. package/src/ui/session-note-card.ts +58 -56
package/LICENSE CHANGED
@@ -1,24 +1,24 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 AeonDave
4
-
5
- Portions of src/core/store.ts adapt the durable atomic-store pattern from
6
- OpenLore (clay-good/openlore), also MIT-licensed.
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in all
16
- copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AeonDave
4
+
5
+ Portions of src/core/store.ts adapt the durable atomic-store pattern from
6
+ OpenLore (clay-good/openlore), also MIT-licensed.
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
package/README.md CHANGED
@@ -1,171 +1,84 @@
1
- <h1 align="center">pi-persona-mind</h1>
2
-
3
- <p align="center">
4
- <img src="https://raw.githubusercontent.com/AeonDave/pi-persona-mind/v0.9.6/assets/banner.png" alt="pi-persona-mind — durable memory for Pi">
5
- </p>
6
-
7
- [![CI](https://github.com/AeonDave/pi-persona-mind/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/AeonDave/pi-persona-mind/actions/workflows/test.yml)
8
- [![npm version](https://img.shields.io/npm/v/@aeondave/pi-persona-mind?logo=npm)](https://www.npmjs.com/package/@aeondave/pi-persona-mind)
9
- [![License](https://img.shields.io/github/license/AeonDave/pi-persona-mind)](LICENSE)
10
-
11
- **Local, scoped memory for Pi.** Keep useful project decisions, persona preferences, session notes
12
- and deferred work without turning every conversation into permanent memory.
13
- Mind complements Pi's native conversation history and compaction; it does not replace them.
14
-
15
- ## Features
16
-
17
- | What you need | What Mind provides |
18
- |---|---|
19
- | Continue a long project | Durable repository decisions, session notes and explicit handoffs for the next session |
20
- | Keep context focused | Bounded retrieval by words, code identifiers, tags and paths, with explicit full-record reads |
21
- | See what the agent remembers | **F10**: saved facts, prepared context and an active-branch timeline |
22
- | Maintain a growing archive | Bounded consolidation, evidence-grounded review, change history and guarded undo |
23
- | Understand a changed decision | Retained before/after records for explicit replacements, kept out of active recall |
24
-
25
- Memory is stored in local files and Pi's native session history. Recall and browsing need no model
26
- call. [Automatic consolidation](#quiet-automatic-maintenance) is on by default; it and explicit
27
- knowledge reviews use the current session model and incur model usage.
28
-
29
- ## Quick start
30
-
31
- Mind 0.9.6 requires **Pi 1.6.1**, **Node.js 22.19.0+**, and
32
- [**pi-persona 1.18.1+**](https://github.com/AeonDave/pi-persona) loaded in the same instance.
33
-
34
- ```bash
35
- pi install npm:@aeondave/pi-persona
36
- pi install npm:@aeondave/pi-persona-mind
37
- ```
38
-
39
- For existing installations, use `pi update npm:@aeondave/pi-persona` and
40
- `pi update npm:@aeondave/pi-persona-mind`. Restart Pi or run **`/reload`** after installing or
41
- updating; `/persona reload` alone does not reload extension code. Keep only one installation source
42
- per extension and remove the old source before switching between npm and Git.
43
-
44
- Mind needs a **compatible, running Persona**, not just an installed package or settings file.
45
- Without that companion and its current session owner, memory operations and background activity stay
46
- inactive. See [host and companion integration](docs/DESIGN.md#scope-and-companion-integration).
47
-
48
- Try asking your agent:
49
-
50
- - “Save this as a durable project decision: schema changes require a migration.”
51
- - “Keep this constraint only for the current session.”
52
- - “Remember this preference across projects for this persona.”
53
- - “Put the blocked migration in the backlog and remind me tomorrow.”
54
- - “Recall the decision about retries and show the complete saved record.”
55
- - “Save a handoff with the goal, completed work, remaining work, next step and references.”
56
-
57
- Press **F10** to inspect what Mind has saved and prepared. Use **`/mind`** for a snapshot,
58
- **`/mind help`** for commands and **`/mind doctor`** for effective settings and storage warnings.
59
-
60
- ## Memory that fits the work
61
-
62
- Choose the lifetime and scope that match your intent:
63
-
64
- | Memory | Where it belongs | Lifetime |
65
- |---|---|---|
66
- | Session notes | The active native session branch | Survive compaction and persisted resume; stay out of new sessions and workers |
67
- | Project working memory | Temporary repository context | 48 hours by default |
68
- | Durable project memory | Repository decisions | Until changed or forgotten |
69
- | Persona memory | One persona across projects | Until changed or forgotten |
70
- | Shared memory | Deliberately shared across personas | Until changed or forgotten |
71
- | Backlog | Deferred project work and reminders | 48 hours by default; later reminders extend expiry |
72
-
73
- The agent chooses scope from your intent; durable saves require an explicit `project`, `persona`
74
- or `shared` destination. Strong direct-user cues may be captured automatically, but
75
- **automatic capture creates provisional session notes only**, even for “remember” or “from now on”.
76
- Broader retention requires a separate deliberate `memory` call with an explicit durable scope.
77
-
78
- Reminders notify you while Pi is open; they do not wake the model. Delegated workers receive a lean
79
- memory selection alongside any skills assigned with `delegate`. Session notes and memory/backlog
80
- write tools stay with the supervisor. Home-directory sessions skip
81
- project injection and reminders. See [lifetimes and scope](docs/DESIGN.md#four-lifetimes) and
82
- [session notes](docs/DESIGN.md#session-notes) for persistence, branch-local forgetting and expiry.
83
-
84
- ## Retrieval and inspection
85
-
86
- Mind selects relevant excerpts each turn within one shared context budget. Exact words and paths
87
- receive more weight than matches across code identifiers (`HTTPResponseParser` → “HTTP response parser”)
88
- and vowel accents (`café` → “cafe”). Unicode text remains searchable. This is lexical retrieval;
89
- it can miss paraphrases or conflicting facts. Use `memory recall`
90
- to search and `memory read` to inspect a complete record. The budget is an estimate, not a billing counter.
91
-
92
- **F10** toggles the read-only inspector in the interactive TUI:
93
-
94
- - **Memories** browses scoped facts, full text, dates, tags and available recording provenance.
95
- - **Context** shows the last block prepared by Mind, including omissions—not the final provider payload.
96
- - **Timeline** shows bounded user/assistant text and session-note events on the active branch.
97
-
98
- Open a record for detail and press **s** for its recording source, when available. Recording provenance
99
- shows how a fact was saved; it does not verify the assertion. Timeline and source lookup cover a
100
- bounded active-branch window.
101
-
102
- In Memories, **a** opens maintenance actions; `/mind browse`, `/mind browse context` and `/mind timeline`
103
- are command alternatives. Browsing alone is read-only and makes no model calls.
104
-
105
- F10 shares Persona's F9 window frame and theme. **PageUp/PageDown** follow visible rows, narrow
106
- windows keep the selection visible, and **?** opens help. See the
107
- [inspector design](docs/DESIGN.md#read-only-memory-inspector) for navigation, sources and coverage.
108
-
109
- ## Maintain knowledge deliberately
110
-
111
- **Decision history** keeps the previous fact when an explicit replacement retires it. Use
112
- `/mind history project-long` to find a receipt and `/mind history show <receiptId> project-long`
113
- to inspect its before/after records. Old facts stay out of active recall and injected context.
114
- History is bounded; ordinary replacements are inspectable, while guarded undo applies to consolidation.
115
- [History and retention →](docs/DESIGN.md#replacement-history)
116
-
117
- **Consolidation** merges compatible saved facts and applies validated changes. `/mind optimize`
118
- reviews one bounded window per allowed project/persona tier; `/mind optimize project-long` selects
119
- durable project memory alone. Inspect changes with `/mind optimize history`; `/mind optimize undo`
120
- restores affected facts only when its conflict checks pass. This reorganizes saved knowledge; it does
121
- not verify it against your repository. [Consolidation and undo details →](docs/DESIGN.md#explicit-consolidation)
122
-
123
- **Knowledge review** runs in the interactive terminal and checks selected facts against repository
124
- files you choose and bounded active-branch user-role text. Repository evidence requires project trust.
125
- The worker proposes corrections, conflicts, insufficient-evidence findings or retirement
126
- recommendations for your review.
127
-
128
- 1. Choose **F10 → Memories → a**, or run `/mind review project-long` (also `project` or `persona`).
129
- 2. Select evidence and confirm the model call. Inspect the proposal with `/mind review show`.
130
- 3. Use `/mind review apply` to separately approve corrections, or `/mind review discard` to discard them.
131
- Application rechecks evidence and memory freshness. Retirement is a recommendation; forgetting a
132
- fact is a separate deliberate action.
133
-
134
- Both workflows use a **visible Persona-hosted Mind worker on the current session model** and incur
135
- model usage. Choose a model with `/model` before starting. New input or model, branch, session and
136
- owner changes invalidate pending review work. Shared memory and session notes are excluded from
137
- these model-driven mutations. Reviews and undo history are bounded; a reviewed window is not a
138
- whole-archive audit or a guarantee of truth.
139
-
140
- ### Quiet automatic maintenance
141
-
142
- Automatic consolidation is on by default. After eligible saves, it waits for the foreground to become
143
- idle and respects usage, cooldown and ownership limits. A real worker is visible in Persona;
144
- successful changes produce one small **mind** notification, while routine no-ops stay quiet.
145
- Failures and important warnings remain visible, and applied changes retain history for guarded undo.
146
-
147
- Use `/mind optimize auto status`, `/mind optimize auto off` or `/mind optimize auto on` for the current
148
- session. `PI_PERSONA_MIND_OPTIMIZE=off` disables automatic optimization at startup. Capture can be set
149
- with `PI_PERSONA_MIND_CAPTURE=auto|prompt|off`, and `PI_PERSONA_MIND_NUDGE=off` disables suggestions.
150
- See [automatic review](docs/DESIGN.md#automatic-semantic-review) for admission and cost details.
151
-
152
- ## Hand off a long task
153
-
154
- Ask the agent to save a handoff before switching sessions. It records the goal, completed work,
155
- pending work, next step and references, together with the originating session and branch.
156
- In a new session with the same project and persona, use **`/mind handoff list`** and
157
- **`/mind handoff show <id>`** to consult it.
158
-
159
- A handoff is an explicit work snapshot, not proof that a task is complete. It is never injected or
160
- executed automatically. Completion requires a resolution; forgetting is explicit. Each persona can hold
161
- up to 32 handoffs in a bounded project file (128 KiB for the whole file), with no automatic expiry or
162
- eviction.
163
- [Commands, ownership and limits →](docs/DESIGN.md#cross-session-handoffs)
164
-
165
- ## Learn more
166
-
167
- - [Design: lifetimes, storage, limits, commands and safeguards](docs/DESIGN.md)
168
- - [Evidence-grounded review and approval](docs/DESIGN.md#evidence-grounded-knowledge-review)
169
- - [Storage recovery and concurrent writes](docs/DESIGN.md#durable-files-and-recovery)
170
- - [Architecture decisions and evaluation boundaries](docs/MEMORY-RESEARCH.md)
171
- - [Release history](CHANGELOG.md) · [MIT license](LICENSE)
1
+ <h1 align="center">pi-persona-mind</h1>
2
+
3
+ **Local memory for Pi and pi-persona.** Save a decision once and recall it the next time you open
4
+ the repository. Keep temporary constraints on the current session branch and carry personal
5
+ preferences across projects with the same persona.
6
+
7
+ <p align="center">
8
+ <img src="https://raw.githubusercontent.com/AeonDave/pi-persona-mind/v0.9.8/assets/banner.png" width="540" alt="pi-persona-mind — durable memory for Pi">
9
+ </p>
10
+
11
+ [![CI](https://github.com/AeonDave/pi-persona-mind/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/AeonDave/pi-persona-mind/actions/workflows/test.yml)
12
+ [![npm version](https://img.shields.io/npm/v/@aeondave/pi-persona-mind?logo=npm)](https://www.npmjs.com/package/@aeondave/pi-persona-mind)
13
+ [![License](https://img.shields.io/github/license/AeonDave/pi-persona-mind)](LICENSE)
14
+
15
+ ## Features
16
+
17
+ | What you can do | How it works |
18
+ |---|---|
19
+ | Choose who remembers | Save a fact for one session branch, one repository, one persona across projects, or explicitly share it across personas. |
20
+ | Recover context after compaction | After Pi compacts a tool loop, Mind refreshes the supervisor’s reference from the active branch and scoped stores. It can include a fact saved moments earlier. |
21
+ | Find and inspect a decision | Search by words, code identifiers, tags or paths. Press **F10** to browse complete records, see the last context Mind prepared, or read the active-branch timeline. |
22
+ | Give workers relevant context | Delegated workers get a short memory selection alongside their assigned skills. The supervisor keeps the session notes and memory-writing tools. |
23
+ | Pick up unfinished work | Save a handoff with the goal, progress, next step and references. Open it in a later session with the same project and persona. |
24
+ | Defer a task | Add it to the project backlog with a reminder. Pi notifies you while it is open without waking the model. |
25
+ | Maintain saved knowledge | Consolidate related facts, inspect the history of a changed decision, or review a fact against evidence you select. |
26
+
27
+ ## Quick start
28
+
29
+ Mind requires **Pi 1.7.0**, **Node.js 22.19.0+** and a compatible **pi-persona 1.18.1+** release
30
+ loaded in the same Pi instance. Install the current companion release for this Pi version.
31
+ [pi-persona releases](https://github.com/AeonDave/pi-persona/releases)
32
+
33
+ ```bash
34
+ pi install npm:@aeondave/pi-persona
35
+ pi install npm:@aeondave/pi-persona-mind
36
+ ```
37
+
38
+ Restart Pi or run **`/reload`**. For an existing installation, run `pi update <source>` for each
39
+ package, using the same `npm:` sources shown above. Mind stores project, persona and shared facts
40
+ in the active Pi profile, selected by `pi --agent-dir <dir>` or `PI_CODING_AGENT_DIR`.
41
+
42
+ Try this in a repository:
43
+
44
+ 1. Ask **“Save this as a durable project decision: every database schema change needs a migration.”**
45
+ 2. Open a fresh Pi session in the same repository and ask **“What did we decide about schema changes?”**
46
+ 3. Press **F10 → Memories** to read the full saved record. **Context** shows which excerpts Mind
47
+ selected for the turn. Use **`/mind doctor`** to inspect the active settings or a storage warning.
48
+
49
+ ## Choose what persists
50
+
51
+ Automatic capture turns strong cues such as “remember this” into provisional **session notes**.
52
+ Repeating the same capture reuses the existing note on that branch. Session notes survive compaction
53
+ and resuming the saved branch. A new session starts with its own notes.
54
+
55
+ For **durable memory**, name the destination when asking the agent to save a fact. **Project** keeps
56
+ a repository decision available across personas. **Persona** carries a preference across projects.
57
+ **Shared** makes a fact available across personas. These facts have no automatic expiry. Mind
58
+ selects relevant excerpts within a context budget and sends them to the session model. Ask for
59
+ the complete record when you need an exact command or the conditions under which a workaround applies.
60
+
61
+ **Working project memory** and **backlog items** expire after 48 hours by default. A reminder set
62
+ for a later date extends the item's expiry. For longer work, ask the agent to save a handoff.
63
+ Use `/mind handoff list` and `/mind handoff show <id>` to consult it when you return.
64
+
65
+ ## Maintenance and model usage
66
+
67
+ Browsing, recall and full-record reads use local data and need no additional model call.
68
+ Automatic consolidation is on by default. After eligible saves and once the foreground settles,
69
+ a visible Persona worker can use the **current session model** to consolidate saved facts.
70
+ Use `/mind optimize auto status` to check or `/mind optimize auto off` to disable it for this session.
71
+ Set `PI_PERSONA_MIND_OPTIMIZE=off` to start with it disabled.
72
+
73
+ Explicit consolidation and evidence-grounded review also use the current model. Use
74
+ `/mind optimize history` to inspect consolidation changes. Guarded undo restores them when conflict
75
+ checks pass. Explicit fact replacements retain a before/after history for inspection. To check
76
+ a fact against trusted repository files or recent user messages, start `/mind review` in the TUI,
77
+ choose the evidence and approve any proposed correction before it is applied.
78
+
79
+ ## Learn more
80
+
81
+ - [Storage, scopes and companion integration](docs/DESIGN.md#scope-and-companion-integration) · [Session notes](docs/DESIGN.md#session-notes) · [Handoffs](docs/DESIGN.md#cross-session-handoffs)
82
+ - [F10 inspector and recording sources](docs/DESIGN.md#read-only-memory-inspector)
83
+ - [Automatic consolidation and usage limits](docs/DESIGN.md#automatic-semantic-review) · [Replacement history](docs/DESIGN.md#replacement-history) · [Knowledge review](docs/DESIGN.md#evidence-grounded-knowledge-review)
84
+ - [Design decisions and evaluation](docs/MEMORY-RESEARCH.md) · [Release history](CHANGELOG.md)