pi-hermes-memory 0.4.2 → 0.4.3

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.3",
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,7 +2,7 @@
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";
5
+ import type { ExtensionAPI, ExtensionCommandContext } from "@mariozechner/pi-coding-agent";
6
6
 
7
7
  const LEARN_MEMORY_CONTENT = `# Pi Hermes Memory — Quick Guide
8
8
 
@@ -72,14 +72,8 @@ const LEARN_MEMORY_CONTENT = `# Pi Hermes Memory — Quick Guide
72
72
  export function registerLearnMemoryCommand(pi: ExtensionAPI): void {
73
73
  pi.registerCommand("learn-memory-tool", {
74
74
  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);
75
+ handler: async (_args, ctx: ExtensionCommandContext) => {
76
+ ctx.ui.notify(LEARN_MEMORY_CONTENT, 'info');
83
77
  },
84
78
  });
85
79
  }