pi-hermes-memory 0.4.2 → 0.4.4

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.
@@ -0,0 +1,341 @@
1
+ # Your AI Agent Just Got a Brain Upgrade: Pi Hermes Memory v0.4
2
+
3
+ **TL;DR**: Your coding agent can now remember every conversation you've ever had with it. Search through weeks of context in milliseconds. Never lose an insight again.
4
+
5
+ ---
6
+
7
+ ## The Problem
8
+
9
+ Every time you start a new session with an AI coding agent, it forgets everything. That debugging session from last Tuesday? Gone. The architecture decision you discussed for 2 hours? Vanished. The user preferences you explained 5 times? You'll explain them a 6th.
10
+
11
+ You're not just losing context — you're losing **hours of accumulated knowledge**.
12
+
13
+ ## The Solution: Persistent Memory + Session Search
14
+
15
+ Pi Hermes Memory v0.4 introduces **SQLite-powered session history** with full-text search. Your agent now has:
16
+
17
+ - 🧠 **Persistent memory** that survives across sessions (MEMORY.md + USER.md)
18
+ - 🔍 **Full-text search** across every conversation you've ever had
19
+ - 📦 **Unlimited extended memory** via SQLite — no more "memory is full" errors
20
+ - 🔎 **Two search tools** — `session_search` for conversations, `memory_search` for facts
21
+ - 📊 **5,000 character limits** (up from 2,200) — more room for context
22
+
23
+ ## What Changed: Before vs After
24
+
25
+ ### Before v0.4
26
+ ```
27
+ You: "What did we discuss about the auth flow last week?"
28
+ Agent: "I don't have access to previous sessions."
29
+ You: *sighs, re-explains everything*
30
+ ```
31
+
32
+ ### After v0.4
33
+ ```
34
+ You: "What did we discuss about the auth flow last week?"
35
+ Agent: *searches session history*
36
+ "Last Tuesday we discussed implementing JWT with refresh tokens.
37
+ You preferred httpOnly cookies over localStorage. We also decided
38
+ to use the auth0 SDK. Want me to continue from there?"
39
+ You: *continues where you left off*
40
+ ```
41
+
42
+ ## New Capabilities Deep Dive
43
+
44
+ ### 1. Session History Search
45
+
46
+ Every conversation is automatically indexed into SQLite with FTS5 (full-text search 5). When you ask about something from the past, your agent searches across all sessions instantly.
47
+
48
+ **How it works:**
49
+ - Sessions are indexed on shutdown (automatic)
50
+ - Full-text search via FTS5 — fast, keyword-based
51
+ - Filter by project, role (user/assistant), or date
52
+
53
+ **Try it:**
54
+ ```
55
+ "What was that error we fixed with the database connection?"
56
+ "Find the PR where we added the secret scanning feature"
57
+ "What testing approach did we use for the memory store?"
58
+ ```
59
+
60
+ ### 2. Extended Memory Store
61
+
62
+ The old memory had a 2,200 character limit. Now it's 5,000 — but more importantly, there's an **unlimited extended store** in SQLite. When core memory fills up, entries are preserved in the extended store and remain searchable.
63
+
64
+ **What this means:**
65
+ - Core memory (MEMORY.md): 5,000 chars — always in context
66
+ - Extended memory (SQLite): Unlimited — searchable on demand
67
+ - No more losing memories to consolidation
68
+
69
+ ### 3. Two-Tier Search Architecture
70
+
71
+ | Tool | What It Searches | When to Use |
72
+ |---|---|---|
73
+ | `session_search` | Past conversations | "What did we discuss about X?" |
74
+ | `memory_search` | Extended memory store | "What do I know about X?" |
75
+
76
+ The agent decides which tool to use based on your question. But you can also invoke them directly.
77
+
78
+ ### 4. Hybrid Memory Design
79
+
80
+ ```
81
+ Always in Context (5,000 chars each)
82
+ ┌─────────────────────────────────────┐
83
+ │ MEMORY.md — Facts, conventions │
84
+ │ USER.md — Who you are │
85
+ │ Project memory — When cwd matches │
86
+ └─────────────────────────────────────┘
87
+
88
+ Searchable on Demand (Unlimited)
89
+ ┌─────────────────────────────────────┐
90
+ │ session_search("auth flow") │
91
+ │ memory_search("testing patterns") │
92
+ └─────────────────────────────────────┘
93
+ ```
94
+
95
+ Your agent always knows who you are and what you prefer (core memory). When it needs deeper context, it searches.
96
+
97
+ ## How to Test Your Memory
98
+
99
+ ### Step 1: Index Your Past Sessions
100
+
101
+ ```bash
102
+ /memory-index-sessions
103
+ ```
104
+
105
+ This imports all your existing Pi sessions into the search database. You'll see:
106
+
107
+ ```
108
+ 🔍 Scanning session directories...
109
+ 📁 Found 36 session files across 5 projects
110
+ ⏳ Indexing...
111
+
112
+ ✅ Session indexing complete!
113
+
114
+ 📊 Results:
115
+ ├─ Sessions processed: 36
116
+ ├─ Sessions indexed: 36
117
+ ├─ Messages indexed: 1,247
118
+
119
+ 📁 Projects indexed:
120
+ ├─ pi-hermes-memory: 12 sessions, 856 messages
121
+ ├─ my-other-project: 8 sessions, 234 messages
122
+ └─ ...
123
+ ```
124
+
125
+ ### Step 2: Explore Your Memory
126
+
127
+ ```bash
128
+ /memory-insights
129
+ ```
130
+
131
+ Shows everything stored in your memory — facts, user profile, and project-specific memories.
132
+
133
+ ### Step 3: Search Your History
134
+
135
+ Ask your agent to search:
136
+
137
+ ```
138
+ "Search my sessions for discussions about TypeScript configuration"
139
+ "What do I know about the user's testing preferences?"
140
+ "Find conversations about database migrations"
141
+ ```
142
+
143
+ ### Step 4: Query the Database Directly
144
+
145
+ For the curious, your data lives in `~/.pi/agent/memory/sessions.db`:
146
+
147
+ ```bash
148
+ # Sessions overview
149
+ sqlite3 -header -column ~/.pi/agent/memory/sessions.db \
150
+ "SELECT project, COUNT(*) as sessions, SUM(message_count) as messages
151
+ FROM sessions GROUP BY project;"
152
+
153
+ # Full-text search
154
+ sqlite3 -header -column ~/.pi/agent/memory/sessions.db \
155
+ "SELECT s.project, substr(m.content, 1, 100) as snippet
156
+ FROM messages m JOIN sessions s ON s.id = m.session_id
157
+ WHERE m.rowid IN (SELECT rowid FROM message_fts WHERE message_fts MATCH 'SQLite')
158
+ LIMIT 5;"
159
+
160
+ # Messages by role
161
+ sqlite3 ~/.pi/agent/memory/sessions.db \
162
+ "SELECT role, COUNT(*) FROM messages GROUP BY role;"
163
+ ```
164
+
165
+ ## Real-World Impact
166
+
167
+ ### For Individual Developers
168
+ - **Context continuity**: Pick up where you left off, even days later
169
+ - **No more re-explaining**: Your preferences and setup are remembered
170
+ - **Institutional memory**: Your debugging insights persist
171
+
172
+ ### For Teams
173
+ - **Shared knowledge**: Project conventions are stored and searchable
174
+ - **Onboarding**: New team members can search past discussions
175
+ - **Decision history**: Architecture decisions are preserved
176
+
177
+ ### For Power Users
178
+ - **Pattern recognition**: Search for similar problems across projects
179
+ - **Learning retention**: Your coding learnings accumulate over time
180
+ - **Workflow optimization**: Discover what approaches worked before
181
+
182
+ ## The Architecture (For the Technical)
183
+
184
+ ```
185
+ ┌─────────────────────────────────────────────────────────┐
186
+ │ Pi Extension │
187
+ ├─────────────────────────────────────────────────────────┤
188
+ │ Tools: │
189
+ │ ├── memory (add/replace/remove) │
190
+ │ ├── skill (create/view/patch/edit/delete) │
191
+ │ ├── session_search (FTS5 across messages) │
192
+ │ └── memory_search (FTS5 across extended memories) │
193
+ ├─────────────────────────────────────────────────────────┤
194
+ │ Storage: │
195
+ │ ├── MEMORY.md / USER.md (core, always injected) │
196
+ │ ├── skills/*.md (procedural, on-demand) │
197
+ │ └── sessions.db (SQLite + FTS5, searchable) │
198
+ ├─────────────────────────────────────────────────────────┤
199
+ │ Events: │
200
+ │ ├── session_start → Load core memory │
201
+ │ ├── context → Inject memory into system prompt │
202
+ │ ├── session_shutdown → Auto-index session │
203
+ │ └── turn_count ≥ 10 → Background review │
204
+ └─────────────────────────────────────────────────────────┘
205
+ ```
206
+
207
+ **Key technical decisions:**
208
+ - **better-sqlite3**: Native C++ addon, synchronous API, built-in FTS5
209
+ - **WAL mode**: Write-ahead logging for concurrent reads
210
+ - **Lazy initialization**: DB only opened when first needed
211
+ - **Single file**: `sessions.db` — easy to backup, easy to delete
212
+
213
+ ## What's Next (v0.5+)
214
+
215
+ - **Semantic search**: Embedding-based search using local models (potion-base-4M)
216
+ - **Cross-project insights**: Find patterns across all your projects
217
+ - **Memory visualization**: Timeline view of your knowledge accumulation
218
+ - **Collaborative memory**: Share project memories with team members
219
+
220
+ ## Get Started
221
+
222
+ ```bash
223
+ # Install or update
224
+ pi install chandra447/pi-hermes-memory
225
+
226
+ # Index your past sessions
227
+ /memory-index-sessions
228
+
229
+ # Learn how to use it
230
+ /learn-memory-tool
231
+
232
+ # Check what's stored
233
+ /memory-insights
234
+ ```
235
+
236
+ ## Links
237
+
238
+ - **npm**: [pi-hermes-memory](https://www.npmjs.com/package/pi-hermes-memory)
239
+ - **GitHub**: [chandra447/pi-hermes-memory](https://github.com/chandra447/pi-hermes-memory)
240
+ - **Pi**: [pi.dev](https://pi.dev)
241
+
242
+ ---
243
+
244
+ *Your AI agent should remember as much as you do. Now it does.*
245
+
246
+ ---
247
+
248
+ ## Social Media Posts
249
+
250
+ ### X/Twitter (Thread)
251
+
252
+ **Post 1:**
253
+ 🚀 Just shipped v0.4 of Pi Hermes Memory — your AI coding agent can now search through every conversation you've ever had with it.
254
+
255
+ No more re-explaining context. No more lost debugging sessions.
256
+
257
+ Thread 🧵👇
258
+
259
+ **Post 2:**
260
+ The problem: Every AI session starts from zero. That 2-hour debugging session from Tuesday? Gone. The architecture decision you discussed? Vanished.
261
+
262
+ You're not just losing context — you're losing hours of accumulated knowledge.
263
+
264
+ **Post 3:**
265
+ The solution: SQLite-powered session history with full-text search.
266
+
267
+ Your agent now has:
268
+ • Persistent memory (survives across sessions)
269
+ • Full-text search across all conversations
270
+ • Unlimited extended memory
271
+ • 5,000 char limits (up from 2,200)
272
+
273
+ **Post 4:**
274
+ How it works:
275
+
276
+ 1. Sessions auto-indexed on shutdown
277
+ 2. FTS5 search finds relevant context in milliseconds
278
+ 3. Agent decides when to search based on your question
279
+ 4. Core memory always in context, extended memory searchable on demand
280
+
281
+ **Post 5:**
282
+ Try it yourself:
283
+
284
+ ```
285
+ /memory-index-sessions # Import past sessions
286
+ /memory-insights # See what's stored
287
+ "Search my sessions for discussions about auth" # Test it
288
+ ```
289
+
290
+ **Post 6:**
291
+ Technical details:
292
+ • better-sqlite3 (native C++ addon)
293
+ • WAL mode for concurrent reads
294
+ • Single sessions.db file (easy backup)
295
+ • Lazy initialization (no startup cost)
296
+
297
+ **Post 7:**
298
+ Your AI agent should remember as much as you do. Now it does.
299
+
300
+ npm: npmjs.com/package/pi-hermes-memory
301
+ GitHub: github.com/chandra447/pi-hermes-memory
302
+
303
+ #AI #DevTools #CodingAgent #Pi #OpenSource
304
+
305
+ ---
306
+
307
+ ### LinkedIn Post
308
+
309
+ **Your AI Agent Just Got a Brain Upgrade**
310
+
311
+ Every time you start a new session with an AI coding agent, it forgets everything. That debugging session from last week? Gone. The architecture decision you discussed? Vanished.
312
+
313
+ Pi Hermes Memory v0.4 changes this.
314
+
315
+ Your agent now has:
316
+ ✅ Persistent memory that survives across sessions
317
+ ✅ Full-text search across every conversation
318
+ ✅ Unlimited extended memory via SQLite
319
+ ✅ Automatic session indexing
320
+
321
+ The result? Context continuity. No more re-explaining your preferences. No more lost debugging insights. Your accumulated knowledge persists.
322
+
323
+ I built this because I was tired of re-explaining context every session. Now my agent remembers what we discussed last week, last month, last year.
324
+
325
+ Key technical decisions:
326
+ • SQLite with FTS5 for fast full-text search
327
+ • Hybrid memory: core (always in context) + extended (searchable on demand)
328
+ • 5,000 character limits (up from 2,200)
329
+ • Auto-indexing on session shutdown
330
+
331
+ Try it:
332
+ ```
333
+ pi install chandra447/pi-hermes-memory
334
+ /memory-index-sessions
335
+ ```
336
+
337
+ Your AI agent should remember as much as you do. Now it does.
338
+
339
+ Open source: github.com/chandra447/pi-hermes-memory
340
+
341
+ #AI #DevTools #SoftwareEngineering #OpenSource #CodingAgent #DeveloperProductivity #MachineLearning #ArtificialIntelligence
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-hermes-memory",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Your Pi agent remembers everything across sessions — your preferences, your stack, your corrections, and even how it solved problems. Zero-config install, works immediately. Persistent memory + procedural skills + auto-correction detection + security-first content scanning.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -5,7 +5,7 @@
5
5
  import path from 'node:path';
6
6
  import fs from 'node:fs';
7
7
  import os from 'node:os';
8
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
8
+ import type { ExtensionAPI, ExtensionCommandContext } from "@mariozechner/pi-coding-agent";
9
9
  import { DatabaseManager } from '../store/db.js';
10
10
  import { indexAllSessions, getSessionStats } from '../store/session-indexer.js';
11
11
 
@@ -14,15 +14,9 @@ const SESSIONS_DIR = path.join(os.homedir(), '.pi', 'agent', 'sessions');
14
14
  export function registerIndexSessionsCommand(pi: ExtensionAPI): void {
15
15
  pi.registerCommand("memory-index-sessions", {
16
16
  description: "Import past Pi sessions into the search database",
17
- handler: async (_args, ctx) => {
18
- const sendUserMessage = (msg: string) => {
19
- if (ctx && typeof ctx === 'object' && 'sendUserMessage' in ctx) {
20
- (ctx as { sendUserMessage: (msg: string) => void }).sendUserMessage(msg);
21
- }
22
- };
23
-
17
+ handler: async (_args, ctx: ExtensionCommandContext) => {
24
18
  // Show initial progress
25
- sendUserMessage('🔍 Scanning session directories...');
19
+ ctx.ui.notify('🔍 Scanning session directories...', 'info');
26
20
 
27
21
  try {
28
22
  // Count sessions first for progress display
@@ -38,7 +32,7 @@ export function registerIndexSessionsCommand(pi: ExtensionAPI): void {
38
32
  }
39
33
  }
40
34
 
41
- sendUserMessage(`📁 Found ${totalFiles} session files across ${projectDirs.length} projects\n⏳ Indexing...`);
35
+ ctx.ui.notify(`📁 Found ${totalFiles} session files across ${projectDirs.length} projects\n⏳ Indexing...`, 'info');
42
36
 
43
37
  const memoryDir = path.join(os.homedir(), '.pi', 'agent', 'memory');
44
38
  const dbManager = new DatabaseManager(memoryDir);
@@ -79,12 +73,12 @@ export function registerIndexSessionsCommand(pi: ExtensionAPI): void {
79
73
 
80
74
  output += `\n💡 Use the session_search tool to search across indexed sessions.`;
81
75
 
82
- sendUserMessage(output);
76
+ ctx.ui.notify(output, 'info');
83
77
  } finally {
84
78
  dbManager.close();
85
79
  }
86
80
  } catch (err) {
87
- sendUserMessage(`❌ Session indexing failed: ${err instanceof Error ? err.message : String(err)}`);
81
+ ctx.ui.notify(`❌ Session indexing failed: ${err instanceof Error ? err.message : String(err)}`, 'error');
88
82
  }
89
83
  },
90
84
  });
@@ -2,84 +2,153 @@
2
2
  * Learn memory tool command — /learn-memory-tool teaches users about the memory system.
3
3
  */
4
4
 
5
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
6
-
7
- const LEARN_MEMORY_CONTENT = `# Pi Hermes Memory — Quick Guide
8
-
9
- ## What Gets Saved
10
-
11
- | Type | File | What Goes Here | Limit |
12
- |---|---|---|---|
13
- | **Memory** | MEMORY.md | Facts — env details, project conventions, tool quirks | 5,000 chars |
14
- | **User Profile** | USER.md | Who you are — name, preferences, communication style | 5,000 chars |
15
- | **Skills** | skills/*.md | Procedures — how to debug, deploy, test | Unlimited |
16
- | **Extended Memory** | sessions.db | Searchable memories beyond the core limit | Unlimited |
17
-
18
- ## Tools Available
19
-
20
- | Tool | What It Does |
21
- |---|---|
22
- | memory (add/replace/remove) | Save, update, or delete memories |
23
- | skill (create/view/patch/edit/delete) | Save reusable procedures |
24
- | session_search | Search past conversations across all sessions |
25
- | memory_search | Search extended memory store (unlimited) |
26
-
27
- ## Commands
28
-
29
- | Command | What It Does |
30
- |---|---|
31
- | /memory-insights | Shows everything stored in memory |
32
- | /memory-skills | Lists all saved skills |
33
- | /memory-consolidate | Manually trigger memory cleanup |
34
- | /memory-interview | Answer questions to pre-fill your profile |
35
- | /memory-switch-project | List all project memories |
36
- | /memory-index-sessions | Import past sessions for search |
37
-
38
- ## Best Practices
39
-
40
- **DO save:**
41
- - User preferences ("prefers pnpm", "uses vim", "likes concise answers")
42
- - Environment facts ("macOS M1", "Node 20", "project uses Prisma")
43
- - Corrections ("don't use npm — use pnpm", "always run tests first")
44
- - Project conventions ("monorepo with turborepo", "conventional commits")
45
-
46
- **DON'T save:**
47
- - Task progress ("finished implementing auth") — temporary
48
- - Session outcomes ("PR #42 was merged") — belongs in git history
49
- - Temporary state ("currently debugging X") — will be irrelevant soon
50
-
51
- ## How Memory Flows
52
-
53
- 1. Session starts → Core memory injected into system prompt
54
- 2. During conversation → Agent saves via memory tool
55
- 3. Every 10 turns → Background review saves noteworthy items
56
- 4. On correction → Immediate save
57
- 5. When full → Auto-consolidation merges entries
58
- 6. Session ends → Final flush
59
-
60
- ## Two-Tier Architecture
61
-
62
- - Global (always injected): ~/.pi/agent/memory/ — your name, preferences, tools
63
- - Project (when cwd matches): ~/.pi/agent/<project>/ — project-specific facts
64
-
65
- ## Troubleshooting
66
-
67
- - "Memory is full" → /memory-consolidate to merge entries
68
- - "Can't find something" → memory_search to search extended store
69
- - "Agent forgot something" → Check /memory-insights, tell agent "remember that X"
70
- - "Want to edit manually" → Files are plain markdown at ~/.pi/agent/memory/`;
5
+ import type { ExtensionAPI, ExtensionCommandContext } from "@mariozechner/pi-coding-agent";
71
6
 
72
7
  export function registerLearnMemoryCommand(pi: ExtensionAPI): void {
73
8
  pi.registerCommand("learn-memory-tool", {
74
9
  description: "Learn how to use the pi-hermes-memory extension effectively",
75
- handler: async (_args, ctx) => {
76
- const sendUserMessage = (msg: string) => {
77
- if (ctx && typeof ctx === 'object' && 'sendUserMessage' in ctx) {
78
- (ctx as { sendUserMessage: (msg: string) => void }).sendUserMessage(msg);
79
- }
80
- };
81
-
82
- sendUserMessage(LEARN_MEMORY_CONTENT);
10
+ handler: async (_args, ctx: ExtensionCommandContext) => {
11
+ // Show main menu first
12
+ const section = await ctx.ui.select("Pi Hermes Memory Guide", [
13
+ "📦 What Gets Saved",
14
+ "🔧 Tools Available",
15
+ "📋 Commands",
16
+ "✅ Best Practices",
17
+ "🔄 How Memory Flows",
18
+ "🏗️ Architecture",
19
+ "❓ Troubleshooting",
20
+ ], {});
21
+
22
+ if (!section) return;
23
+
24
+ const lines: string[] = [];
25
+
26
+ if (section.startsWith("📦")) {
27
+ lines.push("");
28
+ lines.push(" ╔══════════════════════════════════════════════╗");
29
+ lines.push(" ║ 📦 What Gets Saved ║");
30
+ lines.push(" ╚══════════════════════════════════════════════╝");
31
+ lines.push("");
32
+ lines.push(" Type │ File │ Limit");
33
+ lines.push(" ────────────────┼──────────────┼────────────");
34
+ lines.push(" 🧠 Memory │ MEMORY.md │ 5,000 chars");
35
+ lines.push(" 👤 User Profile │ USER.md │ 5,000 chars");
36
+ lines.push(" 📚 Skills │ skills/*.md │ Unlimited");
37
+ lines.push(" 💾 Extended │ sessions.db │ Unlimited");
38
+ lines.push("");
39
+ lines.push(" Memory: Facts — env details, project conventions, tool quirks");
40
+ lines.push(" User: Who you are — name, preferences, communication style");
41
+ lines.push(" Skills: Procedures — how to debug, deploy, test");
42
+ lines.push(" Extended: Searchable memories beyond the core limit");
43
+ }
44
+
45
+ if (section.startsWith("🔧")) {
46
+ lines.push("");
47
+ lines.push(" ╔══════════════════════════════════════════════╗");
48
+ lines.push(" ║ 🔧 Tools Available ║");
49
+ lines.push(" ╚══════════════════════════════════════════════╝");
50
+ lines.push("");
51
+ lines.push(" memory (add/replace/remove)");
52
+ lines.push(" Save, update, or delete memories");
53
+ lines.push("");
54
+ lines.push(" skill (create/view/patch/edit/delete)");
55
+ lines.push(" Save reusable procedures");
56
+ lines.push("");
57
+ lines.push(" session_search");
58
+ lines.push(" Search past conversations across all sessions");
59
+ lines.push("");
60
+ lines.push(" memory_search");
61
+ lines.push(" Search extended memory store (unlimited)");
62
+ }
63
+
64
+ if (section.startsWith("📋")) {
65
+ lines.push("");
66
+ lines.push(" ╔══════════════════════════════════════════════╗");
67
+ lines.push(" ║ 📋 Commands ║");
68
+ lines.push(" ╚══════════════════════════════════════════════╝");
69
+ lines.push("");
70
+ lines.push(" /memory-insights Show everything stored in memory");
71
+ lines.push(" /memory-skills List all saved skills");
72
+ lines.push(" /memory-consolidate Manually trigger memory cleanup");
73
+ lines.push(" /memory-interview Answer questions to pre-fill profile");
74
+ lines.push(" /memory-switch-project List all project memories");
75
+ lines.push(" /memory-index-sessions Import past sessions for search");
76
+ }
77
+
78
+ if (section.startsWith("✅")) {
79
+ lines.push("");
80
+ lines.push(" ╔══════════════════════════════════════════════╗");
81
+ lines.push(" ║ ✅ Best Practices ║");
82
+ lines.push(" ╚══════════════════════════════════════════════╝");
83
+ lines.push("");
84
+ lines.push(" ✅ DO save:");
85
+ lines.push(" • User preferences (\"prefers pnpm\", \"uses vim\")");
86
+ lines.push(" • Environment facts (\"macOS M1\", \"Node 20\")");
87
+ lines.push(" • Corrections (\"don't use npm — use pnpm\")");
88
+ lines.push(" • Project conventions (\"monorepo with turborepo\")");
89
+ lines.push("");
90
+ lines.push(" ❌ DON'T save:");
91
+ lines.push(" • Task progress (\"finished implementing auth\")");
92
+ lines.push(" • Session outcomes (\"PR #42 was merged\")");
93
+ lines.push(" • Temporary state (\"currently debugging X\")");
94
+ }
95
+
96
+ if (section.startsWith("🔄")) {
97
+ lines.push("");
98
+ lines.push(" ╔══════════════════════════════════════════════╗");
99
+ lines.push(" ║ 🔄 How Memory Flows ║");
100
+ lines.push(" ╚══════════════════════════════════════════════╝");
101
+ lines.push("");
102
+ lines.push(" 1. Session starts → Core memory injected");
103
+ lines.push(" 2. During conversation → Agent saves via memory tool");
104
+ lines.push(" 3. Every 10 turns → Background review saves items");
105
+ lines.push(" 4. On correction → Immediate save");
106
+ lines.push(" 5. When full → Auto-consolidation merges");
107
+ lines.push(" 6. Session ends → Final flush");
108
+ }
109
+
110
+ if (section.startsWith("🏗️")) {
111
+ lines.push("");
112
+ lines.push(" ╔══════════════════════════════════════════════╗");
113
+ lines.push(" ║ 🏗️ Two-Tier Architecture ║");
114
+ lines.push(" ╚══════════════════════════════════════════════╝");
115
+ lines.push("");
116
+ lines.push(" Always in Context (5,000 chars each)");
117
+ lines.push(" ┌─────────────────────────────────────┐");
118
+ lines.push(" │ MEMORY.md — Facts, conventions │");
119
+ lines.push(" │ USER.md — Who you are │");
120
+ lines.push(" │ Project memory — When cwd matches │");
121
+ lines.push(" └─────────────────────────────────────┘");
122
+ lines.push("");
123
+ lines.push(" Searchable on Demand (Unlimited)");
124
+ lines.push(" ┌─────────────────────────────────────┐");
125
+ lines.push(" │ session_search(\"auth flow\") │");
126
+ lines.push(" │ memory_search(\"testing patterns\") │");
127
+ lines.push(" └─────────────────────────────────────┘");
128
+ }
129
+
130
+ if (section.startsWith("❓")) {
131
+ lines.push("");
132
+ lines.push(" ╔══════════════════════════════════════════════╗");
133
+ lines.push(" ║ ❓ Troubleshooting ║");
134
+ lines.push(" ╚══════════════════════════════════════════════╝");
135
+ lines.push("");
136
+ lines.push(" \"Memory is full\"");
137
+ lines.push(" → /memory-consolidate to merge entries");
138
+ lines.push("");
139
+ lines.push(" \"Can't find something\"");
140
+ lines.push(" → memory_search to search extended store");
141
+ lines.push("");
142
+ lines.push(" \"Agent forgot something\"");
143
+ lines.push(" → Check /memory-insights, tell agent \"remember X\"");
144
+ lines.push("");
145
+ lines.push(" \"Want to edit manually\"");
146
+ lines.push(" → Files at ~/.pi/agent/memory/ (plain markdown)");
147
+ }
148
+
149
+ if (lines.length > 0) {
150
+ ctx.ui.notify(lines.join("\n"), "info");
151
+ }
83
152
  },
84
153
  });
85
154
  }