pi-hermes-memory 0.4.3 → 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.
- package/package.json +1 -1
- package/src/handlers/learn-memory.ts +141 -66
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-hermes-memory",
|
|
3
|
-
"version": "0.4.
|
|
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",
|
|
@@ -4,76 +4,151 @@
|
|
|
4
4
|
|
|
5
5
|
import type { ExtensionAPI, ExtensionCommandContext } from "@mariozechner/pi-coding-agent";
|
|
6
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/`;
|
|
71
|
-
|
|
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
10
|
handler: async (_args, ctx: ExtensionCommandContext) => {
|
|
76
|
-
|
|
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
|
+
}
|
|
77
152
|
},
|
|
78
153
|
});
|
|
79
154
|
}
|