pi-agent-memory 0.1.1 → 0.2.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/README.md CHANGED
@@ -1,8 +1,35 @@
1
1
  # pi-agent-memory
2
2
 
3
- Persistent memory extension for [pi-agents](https://github.com/badlogic/pi-mono) powered by [claude-mem](https://github.com/thedotmack/claude-mem).
4
-
5
- Gives pi-coding-agent and any pi-mono-based runtime cross-session, cross-engine memory by connecting to claude-mem's worker service.
3
+ <p align="center">
4
+ <img src="https://raw.githubusercontent.com/ArtemisAI/pi-mem/main/pi-agent/banner.png" alt="Pi-agent-memory banner" width="600">
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/thedotmack/claude-mem">
9
+ <img src="https://img.shields.io/github/stars/thedotmack/claude-mem?style=social&label=claude-mem" alt="GitHub Stars">
10
+ </a>
11
+ <a href="https://github.com/thedotmack/claude-mem/network/members">
12
+ <img src="https://img.shields.io/github/forks/thedotmack/claude-mem?style=social" alt="GitHub Forks">
13
+ </a>
14
+ <a href="https://www.npmjs.com/package/pi-agent-memory">
15
+ <img src="https://img.shields.io/npm/v/pi-agent-memory.svg" alt="npm version">
16
+ </a>
17
+ <a href="https://github.com/thedotmack/claude-mem/blob/main/LICENSE">
18
+ <img src="https://img.shields.io/badge/License-AGPL%203.0-blue.svg" alt="License">
19
+ </a>
20
+ </p>
21
+
22
+ > **Fork & adaptation of [claude-mem](https://github.com/thedotmack/claude-mem)** (55k+ stars, 4.4k+ forks) — the most popular persistent memory system for AI coding agents — now available as a native pi-mono extension.
23
+
24
+ Gives pi-coding-agent and any pi-mono-based runtime cross-session, cross-engine memory by connecting to claude-mem's battle-tested worker service. Same compressed memory, same hybrid search (FTS5 + Chroma vector embeddings), same cross-engine sharing — built for pi-agents.
25
+
26
+ ## Why pi-agent-memory?
27
+
28
+ - **Backed by claude-mem** — the #1 memory system for AI coding agents, trusted by 55k+ developers
29
+ - **Cross-engine memory** — your pi-agent shares memory with Claude Code, Cursor, Codex, and OpenClaw sessions
30
+ - **Hybrid search** — FTS5 full-text + Chroma vector embeddings for precise memory recall
31
+ - **Zero config** — installs with one command, auto-connects to the claude-mem worker
32
+ - **Battle-tested** — built on the same worker API powering thousands of daily sessions
6
33
 
7
34
  ## Installation
8
35
 
@@ -101,7 +128,7 @@ All engines write to the same `~/.claude-mem/claude-mem.db`, tagged by `platform
101
128
  | Cursor | `cursor` |
102
129
  | Codex | `codex` |
103
130
 
104
- Context injection returns observations from all engines for the same project by default.
131
+ Context injection returns observations from all engines for the same project by default. Pass `platformSource` to filter by engine.
105
132
 
106
133
  ## Related Packages
107
134
 
@@ -129,6 +156,10 @@ pi -e ./extensions/pi-mem.ts
129
156
  pi install ./pi-agent
130
157
  ```
131
158
 
159
+ ## Credits
160
+
161
+ This package is a fork and adaptation of [**claude-mem**](https://github.com/thedotmack/claude-mem) by [@thedotmack](https://github.com/thedotmack) — the leading persistent memory system for AI coding agents. All core memory infrastructure (worker service, SQLite + FTS5 database, Chroma vector embeddings, AI-powered compression) is provided by claude-mem.
162
+
132
163
  ## License
133
164
 
134
165
  AGPL-3.0 — same as [claude-mem](https://github.com/thedotmack/claude-mem/blob/main/LICENSE).
package/banner.png ADDED
Binary file
@@ -23,7 +23,9 @@ import { basename } from "node:path";
23
23
  // Configuration
24
24
  // =============================================================================
25
25
 
26
- const WORKER_PORT = parseInt(process.env.CLAUDE_MEM_PORT || "37777", 10);
26
+ const DEFAULT_WORKER_PORT = 37777;
27
+ const parsedPort = process.env.CLAUDE_MEM_PORT ? parseInt(process.env.CLAUDE_MEM_PORT, 10) : DEFAULT_WORKER_PORT;
28
+ const WORKER_PORT = Number.isFinite(parsedPort) ? parsedPort : DEFAULT_WORKER_PORT;
27
29
  const WORKER_HOST = process.env.CLAUDE_MEM_HOST || "127.0.0.1";
28
30
  const PLATFORM_SOURCE = "pi-agent";
29
31
  const MAX_TOOL_RESPONSE_LENGTH = 1000;
@@ -174,7 +176,7 @@ export default function piMemExtension(pi: ExtensionAPI) {
174
176
  contentSessionId,
175
177
  project: projectName,
176
178
  prompt: event.prompt || "pi-agent session",
177
- platform_source: PLATFORM_SOURCE,
179
+ platformSource: PLATFORM_SOURCE,
178
180
  });
179
181
 
180
182
  return undefined;
@@ -203,7 +205,7 @@ export default function piMemExtension(pi: ExtensionAPI) {
203
205
 
204
206
  if (!contextText || contextText.trim().length === 0) return;
205
207
 
206
- // Inject as a system message in the conversation
208
+ // Inject as a user message with XML tags to delineate memory context
207
209
  return {
208
210
  messages: [
209
211
  ...event.messages,
@@ -258,6 +260,7 @@ export default function piMemExtension(pi: ExtensionAPI) {
258
260
  tool_input: event.input || {},
259
261
  tool_response: toolResponseText,
260
262
  cwd: sessionCwd,
263
+ platformSource: PLATFORM_SOURCE,
261
264
  });
262
265
 
263
266
  return undefined;
@@ -299,6 +302,7 @@ export default function piMemExtension(pi: ExtensionAPI) {
299
302
  await workerPost("/api/sessions/summarize", {
300
303
  contentSessionId,
301
304
  last_assistant_message: lastAssistantMessage,
305
+ platformSource: PLATFORM_SOURCE,
302
306
  });
303
307
 
304
308
  // Delay completion to let in-flight observations arrive
@@ -306,6 +310,7 @@ export default function piMemExtension(pi: ExtensionAPI) {
306
310
  setTimeout(() => {
307
311
  workerPostFireAndForget("/api/sessions/complete", {
308
312
  contentSessionId: sid,
313
+ platformSource: PLATFORM_SOURCE,
309
314
  });
310
315
  }, SESSION_COMPLETE_DELAY_MS);
311
316
  });
@@ -358,7 +363,7 @@ export default function piMemExtension(pi: ExtensionAPI) {
358
363
  const limit = Math.max(1, Math.min(typeof params.limit === "number" ? Math.floor(params.limit) : 5, MAX_SEARCH_LIMIT));
359
364
  const project = encodeURIComponent(projectName);
360
365
 
361
- const result = await workerGetText(`/api/search?q=${query}&limit=${limit}&project=${project}`);
366
+ const result = await workerGetText(`/api/search?query=${query}&limit=${limit}&project=${project}`);
362
367
 
363
368
  const text = result || "No matching memories found.";
364
369
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-agent-memory",
3
- "version": "0.1.1",
4
- "description": "Claude-mem persistent memory extension for pi-agents. Cross-session, cross-engine memory via claude-mem's worker API.",
3
+ "version": "0.2.0",
4
+ "description": "Persistent memory for pi-agents, powered by claude-mem (55k+ stars). Cross-session, cross-engine memory with hybrid search.",
5
5
  "keywords": [
6
6
  "pi-package",
7
7
  "claude-mem",
@@ -38,6 +38,7 @@
38
38
  "files": [
39
39
  "extensions",
40
40
  "skills",
41
+ "banner.png",
41
42
  "README.md",
42
43
  "LICENSE"
43
44
  ]