@pyxmate/memory 0.2.6-beta → 0.2.10-beta

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
@@ -18,7 +18,7 @@ If you use [Claude Code](https://docs.anthropic.com/en/docs/claude-code), run th
18
18
  npx @pyxmate/memory init
19
19
  ```
20
20
 
21
- This copies skill files into `.claude/skills/pyx-memory-integration/` so Claude Code auto-discovers pyx-memory patterns, types, and API reference when working in your project.
21
+ This copies skill files into `.claude/skills/pyx-memory/` so Claude Code auto-discovers pyx-memory patterns, types, and API reference when working in your project.
22
22
 
23
23
  ## Usage
24
24
 
package/bin/init.mjs CHANGED
@@ -16,8 +16,8 @@ Commands:
16
16
  process.exit(command ? 1 : 0);
17
17
  }
18
18
 
19
- const source = resolve(__dirname, '..', 'skills', 'pyx-memory-integration');
20
- const target = resolve(process.cwd(), '.claude', 'skills', 'pyx-memory-integration');
19
+ const source = resolve(__dirname, '..', 'skills', 'pyx-memory');
20
+ const target = resolve(process.cwd(), '.claude', 'skills', 'pyx-memory');
21
21
 
22
22
  if (!existsSync(source)) {
23
23
  console.error('Error: Skills directory not found in package. Please reinstall @pyxmate/memory.');
@@ -58,6 +58,6 @@ function listFiles(dir, prefix = '') {
58
58
  const fileCount = countFiles(target);
59
59
  const fileList = listFiles(target);
60
60
 
61
- console.log(`Copied ${fileCount} skill files to .claude/skills/pyx-memory-integration/\n`);
61
+ console.log(`Copied ${fileCount} skill files to .claude/skills/pyx-memory/\n`);
62
62
  console.log(fileList.join('\n'));
63
63
  console.log('\nClaude Code will now auto-discover pyx-memory integration patterns.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyxmate/memory",
3
- "version": "0.2.6-beta",
3
+ "version": "0.2.10-beta",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",
@@ -44,8 +44,7 @@
44
44
  "LICENSE"
45
45
  ],
46
46
  "scripts": {
47
- "copy-skills": "rm -rf skills/pyx-memory-integration && mkdir -p skills && cp -r ../../.claude/skills/pyx-memory-integration skills/pyx-memory-integration && rm -rf skills/pyx-memory-integration/scripts",
48
- "build": "bun run copy-skills && tsup",
47
+ "build": "tsup",
49
48
  "typecheck": "tsc --noEmit",
50
49
  "clean": "rm -rf dist skills node_modules .turbo"
51
50
  },
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: pyx-memory
3
+ description: >
4
+ Persistent memory system for AI agents. Use this skill to store and retrieve
5
+ knowledge across conversations via pyx-memory. Triggers whenever you need to
6
+ remember something, recall prior context, store a decision or bug fix, or
7
+ search for what was discussed before. Also use when integrating the pyx-memory
8
+ SDK into code, working with MemoryClient, or using the HTTP API.
9
+ Triggers on: 'remember', 'recall', 'store memory', 'search memory',
10
+ 'what did we decide', 'pyx-memory', 'memory', 'MemoryClient',
11
+ 'integrate memory', 'memory consolidation'.
12
+ ---
13
+
14
+ # pyx-memory — Agent Memory System
15
+
16
+ Persistent memory across conversations. Store what you learn, search before you assume.
17
+
18
+ ## Configuration
19
+
20
+ Your endpoint and API key are in the project's CLAUDE.md or agent config. Look for a `## Persistent Memory` or `## Memory System` section.
21
+
22
+ If no credentials are configured, skip to [SDK Integration](#sdk-integration) below.
23
+
24
+ ## Store: after important events
25
+
26
+ Immediately after any of these events, store a memory before continuing:
27
+
28
+ - **User corrects you** ("no, do it this way", "don't use X") → store the correction and why
29
+ - **A bug is fixed** → store the root cause and solution
30
+ - **An architecture or design decision is made** → store the decision and reasoning
31
+ - **An integration detail is discovered** (API format, auth flow, endpoint) → store it
32
+ - **A gotcha or pitfall is encountered** → store what went wrong and the fix
33
+ - **The user states a preference** about workflow or tools → store it
34
+ - **The user explicitly says "remember this"** → store immediately
35
+
36
+ ```bash
37
+ curl -s -X POST {{ENDPOINT}}/api/memory/ingest \
38
+ -H "Authorization: Bearer {{API_KEY}}" \
39
+ -H "Content-Type: application/json" \
40
+ -d '{"content":"WHAT_HAPPENED","type":"long-term","metadata":{"source":"agent","topic":"TOPIC","project":"PROJECT_NAME"}}'
41
+ ```
42
+
43
+ When the memory mentions specific people, tools, organizations, or other named subjects, also include `entities` and `relationships` to populate the knowledge graph. See [reference/http-api.md](reference/http-api.md) for entity types, relationship types, and examples.
44
+
45
+ ## Search: before making assumptions
46
+
47
+ Search for relevant context in these situations:
48
+
49
+ - **Starting a new conversation or task** → search for the project name and task topic
50
+ - **Before suggesting an approach** → check if a prior decision contradicts it
51
+ - **User references prior work** ("like we did before", "remember when") → search for it
52
+ - **Investigating a bug** → search if it was seen before
53
+
54
+ ```bash
55
+ curl -s "{{ENDPOINT}}/api/memory/search?q=QUERY&limit=5" \
56
+ -H "Authorization: Bearer {{API_KEY}}"
57
+ ```
58
+
59
+ ## Rules
60
+
61
+ - Always include `topic` and `project` in metadata
62
+ - Keep content factual and concise — decisions, not deliberation
63
+ - Do NOT store ephemeral info (file contents, current state, in-progress work)
64
+ - One memory per concept — don't bundle unrelated things
65
+ - Extract entities when content mentions specific people, tools, technologies, organizations, locations, or events by name
66
+
67
+ ---
68
+
69
+ ## SDK Integration
70
+
71
+ For integrating pyx-memory into TypeScript/Bun projects, see the reference docs:
72
+
73
+ | What you need | Where to look |
74
+ |---|---|
75
+ | Wire pyx-memory into a consumer project | [patterns/consumer.md](patterns/consumer.md) |
76
+ | Set up embedded memory (full features) | [patterns/embedded.md](patterns/embedded.md) |
77
+ | SDK quick start, package map, DO/DON'T | [reference/sdk-guide.md](reference/sdk-guide.md) |
78
+ | HTTP API endpoints | [reference/http-api.md](reference/http-api.md) |
79
+ | Type signatures and interfaces | [reference/types.md](reference/types.md) |
80
+ | RAG strategies, bi-temporal, consolidation | [reference/advanced.md](reference/advanced.md) |
81
+ | Feature parity: embedded vs sidecar | [reference/parity.md](reference/parity.md) |
82
+ | Minimal code examples | [examples/](examples/) |
@@ -10,6 +10,18 @@ await memory.store({
10
10
  metadata: { source: 'settings' },
11
11
  });
12
12
 
13
+ // Store with entities — populates the knowledge graph
14
+ await memory.store({
15
+ content: 'Alice switched the project to TypeScript for type safety',
16
+ type: 'long-term',
17
+ metadata: { source: 'decisions' },
18
+ entities: [
19
+ { name: 'Alice', type: 'PERSON' },
20
+ { name: 'TypeScript', type: 'TOOL' },
21
+ ],
22
+ relationships: [{ source: 'Alice', target: 'TypeScript', type: 'USES' }],
23
+ });
24
+
13
25
  // Store with explicit targets (e.g., sqlite only)
14
26
  await memory.store({
15
27
  content: 'Temporary working note',
@@ -54,6 +54,47 @@ const client = new MemoryClient('http://localhost:7822', process.env.MEMORY_API_
54
54
  | GET | `/api/memory/query-as-of?asOf=...` | Bi-temporal point-in-time query (asOf, type, agentId, source, limit) |
55
55
  | GET | `/api/memory/query-by-event-time?startTime=...&endTime=...` | Bi-temporal event time range query (startTime, endTime, type, agentId, source, limit) |
56
56
 
57
+ ## Entity Extraction (Knowledge Graph)
58
+
59
+ When storing memories that mention named subjects, include `entities` and `relationships` in the ingest request to populate the knowledge graph. This enables graph-based RAG and dashboard visualization.
60
+
61
+ ### Entity types
62
+
63
+ `PERSON`, `ORGANIZATION`, `CONCEPT`, `TOOL`, `LOCATION`, `EVENT`
64
+
65
+ ### Relationship types
66
+
67
+ `USES`, `OWNS`, `DEPENDS_ON`, `RELATED_TO`, `CREATED_BY`, `PART_OF`, `IS_A`, `WORKS_AT`, `LOCATED_IN`
68
+
69
+ ### Example: store with entities
70
+
71
+ ```bash
72
+ curl -s -X POST {{ENDPOINT}}/api/memory/ingest \
73
+ -H "Authorization: Bearer {{API_KEY}}" \
74
+ -H "Content-Type: application/json" \
75
+ -d '{
76
+ "content":"Alice switched the frontend from JavaScript to TypeScript for type safety",
77
+ "type":"long-term",
78
+ "metadata":{"source":"agent","topic":"tech-stack","project":"my-project"},
79
+ "entities":[
80
+ {"name":"Alice","type":"PERSON"},
81
+ {"name":"TypeScript","type":"TOOL"},
82
+ {"name":"JavaScript","type":"TOOL"}
83
+ ],
84
+ "relationships":[
85
+ {"from":"Alice","to":"TypeScript","type":"USES"},
86
+ {"from":"TypeScript","to":"JavaScript","type":"RELATED_TO"}
87
+ ]
88
+ }'
89
+ ```
90
+
91
+ **When to extract**: Always extract when content mentions specific people, tools, technologies, organizations, locations, or events by name. Skip only for abstract observations with no named subjects (e.g., "prefer tabs over spaces").
92
+
93
+ **Entity fields**: `name` (required), `type` (required), `metadata` (optional properties object)
94
+ **Relationship fields**: `from` (source entity name), `to` (target entity name), `type` (required)
95
+
96
+ ---
97
+
57
98
  ## Response Format
58
99
 
59
100
  All responses follow: `{ success: boolean, data?: T, error?: string }`
@@ -1,58 +1,7 @@
1
- ---
2
- name: pyx-memory-integration
3
- description: >
4
- Integration guide for the pyx-memory universal memory system (TypeScript/Bun).
5
- Use when integrating pyx-memory into a project, migrating to pyx-memory,
6
- setting up embedded or sidecar memory, asking about pyx-memory API or types,
7
- configuring RAG strategies, file ingestion, or lifecycle management.
8
- Triggers on: 'integrate pyx-memory', 'add memory system', 'setup pyx-memory',
9
- 'memory store search', 'MemoryInterface', 'EmbeddingProvider', 'createMemory',
10
- 'pyx-memory configuration', 'memory consolidation', 'graph RAG'.
11
- ---
12
-
13
- # pyx-memory — AI Agent Integration Guide
14
-
15
- Reference for AI agents integrating pyx-memory into TypeScript/Bun projects.
16
- Runtime requirement: **Bun v1.2+** (not Node.js). Uses `bun:sqlite` natively.
17
-
18
- > After integration work, run the diagnostic tool to verify correctness:
19
- > ```bash
20
- > bun .claude/skills/pyx-memory-integration/scripts/diagnose-integration.ts --json
21
- > ```
22
- > Parse the `verdict` field: `"healthy"` = done, otherwise fix each `criticalIssues` entry and re-run.
23
-
24
- ---
25
-
26
- ## What are you trying to do?
27
-
28
- **Integrate pyx-memory into a consumer project?**
29
- → See [patterns/consumer.md](patterns/consumer.md)
30
-
31
- **Set up embedded memory with full features?**
32
- → See [patterns/embedded.md](patterns/embedded.md)
33
-
34
- **Understand type signatures and interfaces?**
35
- → See [reference/types.md](reference/types.md)
36
-
37
- **Check sidecar limitations before choosing a mode?**
38
- → See [reference/parity.md](reference/parity.md)
1
+ # pyx-memory SDK Integration Guide
39
2
 
40
- **Use the HTTP API directly?**
41
- See [reference/http-api.md](reference/http-api.md)
42
-
43
- **Configure RAG, bi-temporal queries, or consolidation?**
44
- → See [reference/advanced.md](reference/advanced.md)
45
-
46
- **Validate your integration setup?**
47
- → Run: `bun .claude/skills/pyx-memory-integration/scripts/diagnose-integration.ts`
48
-
49
- **Check server connectivity?**
50
- → Run: `bun .claude/skills/pyx-memory-integration/scripts/diagnose-integration.ts --phase=runtime`
51
-
52
- **Get machine-readable diagnostic report?**
53
- → Run: `bun .claude/skills/pyx-memory-integration/scripts/diagnose-integration.ts --json`
54
-
55
- ---
3
+ Reference for integrating pyx-memory into TypeScript/Bun projects.
4
+ Runtime requirement: **Bun v1.2+** (not Node.js). Uses `bun:sqlite` natively.
56
5
 
57
6
  ## Quick Decision Tree
58
7
 
@@ -60,7 +9,7 @@ Runtime requirement: **Bun v1.2+** (not Node.js). Uses `bun:sqlite` natively.
60
9
  Building pyx-memory itself or its server?
61
10
  → Embedded mode: import { Memory } from '@pyx-memory/core'
62
11
 
63
- Consuming pyx-memory from another project (e.g., agent-forge)?
12
+ Consuming pyx-memory from another project?
64
13
  → Sidecar mode: import { MemoryClient } from '@pyx-memory/client'
65
14
  → ONLY depend on @pyx-memory/client + @pyx-memory/shared
66
15
  → Do NOT import @pyx-memory/core — that's pyx-memory's internal implementation
@@ -87,20 +36,14 @@ Need dashboard features (consolidation log, graph visualization)?
87
36
  → Extends MemoryClient with additional methods
88
37
  ```
89
38
 
90
- ---
91
-
92
39
  ## Minimal Working Example (Embedded)
93
40
 
94
41
  ```typescript
95
42
  import { Memory } from '@pyx-memory/core';
96
43
 
97
- // Embedding is internal — pyx-memory uses BGE-M3 (1024d) automatically
98
44
  const memory = new Memory({ dataDir: './data' });
99
45
  await memory.initialize(); // REQUIRED — throws if you skip this
100
46
 
101
- // Store (default targets: sqlite + vector; or sqlite + vector + graph when graphStore configured)
102
- // When graphStore is configured, graph is auto-included in defaults.
103
- // If no entities provided, graph is silently skipped.
104
47
  await memory.store({
105
48
  content: 'User prefers dark mode',
106
49
  type: 'long-term',
@@ -119,10 +62,8 @@ await memory.store({
119
62
  relationships: [{ source: 'Alice', target: 'Acme Corp', type: 'WORKS_AT' }],
120
63
  });
121
64
 
122
- // Search
123
65
  const results = await memory.search({ query: 'user preferences', limit: 5 });
124
66
 
125
- // Cleanup
126
67
  await memory.shutdown(); // REQUIRED — releases SQLite + LanceDB resources
127
68
  ```
128
69
 
@@ -131,10 +72,9 @@ await memory.shutdown(); // REQUIRED — releases SQLite + LanceDB resources
131
72
  ```typescript
132
73
  import { MemoryClient } from '@pyx-memory/client';
133
74
 
134
- // Without auth (local dev)
135
75
  const memory = new MemoryClient('http://localhost:7822');
136
76
 
137
- // With auth (production — pass API key as second argument)
77
+ // With auth (production)
138
78
  const authedMemory = new MemoryClient('http://localhost:7822', process.env.MEMORY_API_KEY);
139
79
 
140
80
  await memory.initialize(); // verifies server connectivity via /health
@@ -145,8 +85,6 @@ const results = await memory.search({ query: 'fact', limit: 5 });
145
85
 
146
86
  Start the server: `bun packages/server/src/index.ts`
147
87
 
148
- ---
149
-
150
88
  ## Package Map
151
89
 
152
90
  ```
@@ -172,66 +110,41 @@ Start the server: `bun packages/server/src/index.ts`
172
110
  - **Types only**: Import from `@pyx-memory/shared`
173
111
  - **Consumer projects**: ONLY use `@pyx-memory/client` + `@pyx-memory/shared` — never `@pyx-memory/core`
174
112
 
175
- For full type definitions and interfaces, see [reference/types.md](reference/types.md).
176
-
177
- For HTTP API endpoint reference, see [reference/http-api.md](reference/http-api.md).
178
-
179
- For feature parity between embedded and sidecar modes, see [reference/parity.md](reference/parity.md).
180
-
181
- For RAG strategies, bi-temporal model, consolidation, and community detection, see [reference/advanced.md](reference/advanced.md).
182
-
183
- ---
184
-
185
113
  ## DO / DON'T
186
114
 
187
115
  ### DO
188
116
 
189
117
  - **DO** call `await memory.initialize()` before any operation
190
118
  - **DO** call `await memory.shutdown()` when done (releases SQLite + LanceDB)
191
- - **DO** provide `entities` to populate the graph — graph is auto-included in defaults when graphStore is configured, but silently skipped if no entities are provided
119
+ - **DO** provide `entities` to populate the graph
192
120
  - **DO** initialize GraphStore BEFORE constructing Memory
193
121
  - **DO** use `new Memory()` when you need lifecycle methods (ExtendedMemoryInterface)
194
122
  - **DO** use `':memory:'` dataDir for tests
195
123
  - **DO** handle `MemoryServerError` in sidecar mode (has `.status` and `.isNotFound`)
196
- - **DO** use `MemoryClient` (not `MemoryInterface`) when you need graph or file ingestion — these are concrete methods
197
- - **DO** use `DashboardClient` when you need consolidation logs, graph relationships, or enriched health data
198
- - **DO** implement `DisabledMemory` (no-op) in consumer projects for graceful degradation when memory is unavailable
124
+ - **DO** implement `DisabledMemory` (no-op) for graceful degradation when memory is unavailable
199
125
 
200
126
  ### DON'T
201
127
 
202
128
  - **DON'T** assume `createMemory()` returns `ExtendedMemoryInterface` — it returns `MemoryInterface`
203
- - **DON'T** use `targets: ['graph']` without a configured `graphStore` — throws MemoryError (but graph without entities is fine — silently skipped)
204
- - **DON'T** use `strategy: 'graph'` without passing `graphStore` — throws "RAG strategy not registered"
129
+ - **DON'T** use `targets: ['graph']` without a configured `graphStore` — throws MemoryError
130
+ - **DON'T** use `strategy: 'graph'` without passing `graphStore`
205
131
  - **DON'T** use `strategy: 'agentic'` without passing `reasoningProvider`
206
132
  - **DON'T** construct multiple Memory instances with the same `dataDir` — LanceDB singleton causes conflicts
207
133
  - **DON'T** use `':memory:'` in production — LanceDB still writes to `/tmp/autonomy-vectors`
208
- - **DON'T** expose the server without configuring `API_KEY` for network deployments — use an API gateway for internet-facing deployments
209
- - **DON'T** import `@pyx-memory/core` in consumer projects — use `@pyx-memory/client` for clean separation
210
- - **DON'T** expect `filters`, `enableHyDE`, or `enableRerank` to work in sidecar mode — the HTTP API doesn't forward them
211
-
212
- ---
134
+ - **DON'T** expose the server without configuring `API_KEY` for network deployments
135
+ - **DON'T** import `@pyx-memory/core` in consumer projects — use `@pyx-memory/client`
136
+ - **DON'T** expect `filters`, `enableHyDE`, or `enableRerank` to work in sidecar mode
213
137
 
214
- ## AI Agent Post-Integration Checklist
215
-
216
- After integrating pyx-memory, run the diagnostic tool to verify everything is wired correctly:
138
+ ## Post-Integration Checklist
217
139
 
218
140
  ```bash
219
- bun .claude/skills/pyx-memory-integration/scripts/diagnose-integration.ts --json
141
+ bun .claude/skills/pyx-memory/scripts/diagnose-integration.ts --json
220
142
  ```
221
143
 
222
- **Interpret the result:**
223
- 1. Parse the JSON `verdict` field:
224
- - `"healthy"` → Integration is complete and working
225
- - `"misconfigured"` → Environment or config issues — fix each item in `criticalIssues`
226
- - `"broken"` → Server is down or unreachable — start the server first
227
- - `"degraded"` → Working but with warnings (e.g., stub embeddings)
228
- 2. For each entry in `criticalIssues`, apply the `fix` instruction
229
- 3. Re-run until `verdict === "healthy"`
144
+ Interpret `verdict`: `"healthy"` = done, otherwise fix each `criticalIssues` entry and re-run.
230
145
 
231
146
  **Common failure: DisabledMemory (no-op)**
232
- If `MEMORY_URL` is not set, the client will silently fall back to a DisabledMemory no-op implementation. Everything appears to work (store returns success, health reports "ok") but nothing is actually persisted. The diagnostic tool detects this via checks S5 (missing URL) and I1 (empty store ID).
233
-
234
- ---
147
+ If `MEMORY_URL` is not set, the client silently falls back to a no-op implementation. The diagnostic tool detects this via checks S5 and I1.
235
148
 
236
149
  ## Error Types
237
150
 
@@ -251,16 +164,3 @@ MemoryServerError — HTTP client errors (has .status, .isNotFound)
251
164
  ```
252
165
 
253
166
  All from `@pyx-memory/core` except `MemoryServerError` from `@pyx-memory/client`.
254
-
255
- ---
256
-
257
- ## Copy-Paste Examples
258
-
259
- - [examples/minimal-embedded.ts](examples/minimal-embedded.ts) — Embedded setup with store/search/shutdown
260
- - [examples/minimal-sidecar.ts](examples/minimal-sidecar.ts) — Sidecar HTTP client setup
261
- - [examples/disabled-memory.ts](examples/disabled-memory.ts) — No-op DisabledMemory class for graceful degradation
262
-
263
- ## Further Reading
264
-
265
- - `docs/ARCHITECTURE.md` — Deep architecture reference, research sources, cost analysis, competitive positioning
266
- - `README.md` — Project overview, HTTP API examples, deployment guides, Docker setup