@pyxmate/memory 0.20.5 → 0.21.2
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/LICENSE +1 -1
- package/README.md +63 -34
- package/dist/chunk-7P6ASYW6.mjs +9 -0
- package/dist/cli/pyx-mem.mjs +15744 -0
- package/dist/dashboard.mjs +1 -0
- package/dist/index.mjs +1 -0
- package/dist/react.mjs +1 -0
- package/package.json +7 -4
- package/bin/init.mjs +0 -672
- package/skills/pyx-memory/SKILL.md +0 -128
- package/skills/pyx-memory/examples/disabled-memory.ts +0 -53
- package/skills/pyx-memory/examples/minimal-embedded.ts +0 -37
- package/skills/pyx-memory/examples/minimal-sidecar.ts +0 -14
- package/skills/pyx-memory/patterns/access-control.md +0 -586
- package/skills/pyx-memory/patterns/consumer.md +0 -129
- package/skills/pyx-memory/patterns/embedded.md +0 -249
- package/skills/pyx-memory/patterns/file-uploads.md +0 -78
- package/skills/pyx-memory/reference/advanced.md +0 -274
- package/skills/pyx-memory/reference/http-api.md +0 -526
- package/skills/pyx-memory/reference/parity.md +0 -74
- package/skills/pyx-memory/reference/sdk-guide.md +0 -233
- package/skills/pyx-memory/reference/types.md +0 -344
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pyx-memory
|
|
3
|
-
description: >
|
|
4
|
-
Persistent memory system for AI agents — store and retrieve knowledge across
|
|
5
|
-
conversations via pyx-memory. Use this skill whenever you need to remember
|
|
6
|
-
something for later, recall what was discussed or decided in a prior session,
|
|
7
|
-
search stored memory before assuming, store a decision or bug-fix root cause,
|
|
8
|
-
or ingest files, documents, or images into long-term memory. Also use it for
|
|
9
|
-
the lifecycle and wiki primitives: building a per-entity profile or "wiki
|
|
10
|
-
page" (summarizeEntity / getEntitySynthesis — an amortized "tell me about
|
|
11
|
-
X / give me a profile of this customer" synthesis that is computed once and
|
|
12
|
-
reused); browsing a chronological feed of what was added and when (memory
|
|
13
|
-
log — "what has the agent learned", "what's new since last week"); linting
|
|
14
|
-
memory health (orphaned graph nodes, stale syntheses, dedup candidates); and
|
|
15
|
-
consolidation, decay, or session summarization. Use it for any integration
|
|
16
|
-
work with the pyx-memory SDK, MemoryClient, or HTTP API — including
|
|
17
|
-
multi-tenant isolation, fine-grained ReBAC (namespaces, principals, authz
|
|
18
|
-
tuples, AuthzPlan), sensitivity classification, encryption at rest, and
|
|
19
|
-
confidence/abstention scoring. Trigger this skill even when the user does
|
|
20
|
-
not say "pyx-memory" by name: phrases like "remember this", "what did we
|
|
21
|
-
decide", "recall earlier context", "store this decision", "search memory",
|
|
22
|
-
"give me a profile of <person/customer>", "summarize everything we know
|
|
23
|
-
about X", "what has the agent learned", or "set up per-agent / per-tenant
|
|
24
|
-
memory isolation" all indicate this skill should be used. When in doubt
|
|
25
|
-
about whether a request involves agent memory, prefer using this skill.
|
|
26
|
-
allowed-tools: Read, Grep, Glob, Edit, Write, Bash(curl *)
|
|
27
|
-
argument-hint: "[store|search|ingest] <content or query>"
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
# pyx-memory — Agent Memory System
|
|
31
|
-
|
|
32
|
-
Persistent memory across conversations. Store what you learn, search before you assume.
|
|
33
|
-
|
|
34
|
-
## Configuration
|
|
35
|
-
|
|
36
|
-
Your endpoint and API key are in the project's CLAUDE.md or agent config. Look for a `## Persistent Memory` or `## Memory System` section.
|
|
37
|
-
|
|
38
|
-
If no credentials are configured, skip to [SDK Integration](#sdk-integration) below.
|
|
39
|
-
|
|
40
|
-
Operations below use the `pyxmate-memory` CLI (ships with `@pyxmate/memory`).
|
|
41
|
-
Set `PYXMATE_API_KEY` and `PYXMATE_ENDPOINT` once; for multi-tenant servers add `--tenant-id <id>`.
|
|
42
|
-
|
|
43
|
-
## Store: after important events
|
|
44
|
-
|
|
45
|
-
Immediately after any of these events, store a memory before continuing:
|
|
46
|
-
|
|
47
|
-
- **User corrects you** ("no, do it this way", "don't use X") → store the correction and why
|
|
48
|
-
- **A bug is fixed** → store the root cause and solution
|
|
49
|
-
- **An architecture or design decision is made** → store the decision and reasoning
|
|
50
|
-
- **An integration detail is discovered** (API format, auth flow, endpoint) → store it
|
|
51
|
-
- **A gotcha or pitfall is encountered** → store what went wrong and the fix
|
|
52
|
-
- **The user states a preference** about workflow or tools → store it
|
|
53
|
-
- **The user explicitly says "remember this"** → store immediately
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pyxmate-memory store \
|
|
57
|
-
--content "WHAT_HAPPENED" --topic TOPIC --project PROJECT_NAME --source agent
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
When the memory mentions named people, tools, or organizations, pass `--entities '<json>'` and `--relationships '<json>'` (or `@path.json` / `-` for stdin) to populate the knowledge graph. See [reference/http-api.md](reference/http-api.md) for entity and relationship types.
|
|
61
|
-
|
|
62
|
-
## Search: before making assumptions
|
|
63
|
-
|
|
64
|
-
Search for relevant context in these situations:
|
|
65
|
-
|
|
66
|
-
- **Starting a new conversation or task** → search for the project name and task topic
|
|
67
|
-
- **Before suggesting an approach** → check if a prior decision contradicts it
|
|
68
|
-
- **User references prior work** ("like we did before", "remember when") → search for it
|
|
69
|
-
- **Investigating a bug** → search if it was seen before
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
pyxmate-memory search --query "QUERY" --limit 5
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Ingest files & images: when a file is worth remembering
|
|
76
|
-
|
|
77
|
-
Upload files directly when the content is worth persisting — diagrams, screenshots, documents, data files.
|
|
78
|
-
|
|
79
|
-
- **User shares a document or image** and says "remember this" or "store this" → ingest it
|
|
80
|
-
- **A screenshot captures important context** (error screen, architecture diagram, UI state) → ingest with a description
|
|
81
|
-
- **A document contains reference material** (spec, config, report) → ingest it
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
pyxmate-memory ingest-file path/to/file --description "What this file contains or shows"
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Supported formats: txt, md, csv, tsv, log, pdf, docx, xlsx, pptx, json, jsonl, html, htm, png, jpg, jpeg, webp, gif, bmp, tiff, svg (100MB limit).
|
|
88
|
-
|
|
89
|
-
Ingestion memory profile, by format:
|
|
90
|
-
|
|
91
|
-
- **Plain-text + structured-text** (`csv`, `tsv`, `txt`, `log`, `json`, `jsonl`, `html`, `htm`, `md`): truly streaming — peak memory ≈ a few MB regardless of file size, up to the 100 MB file cap.
|
|
92
|
-
- **`pdf`**: streaming via the poppler `pdftotext` first-class path — peak memory ≈ a few MB. The `pdf-parse` fallback (when poppler is absent) loads the whole buffer; install poppler-utils for streaming.
|
|
93
|
-
- **`xlsx`**: row-by-row streaming via `ExcelJS.stream.xlsx.WorkbookReader`, but **shared strings are cached for the whole workbook** (`sharedStrings: 'cache'`). Peak memory grows with shared-string count, not just file size — workbooks with dense, repeated cell strings can use significantly more memory than the file cap suggests.
|
|
94
|
-
- **`pptx`**: the full ZIP is decompressed in memory (same shape as docx); only one slide's XML is decoded at a time. For a typical 30 MB presentation, peak memory is ~90 MB. Capped at 100 MB file / 200 MB decompressed.
|
|
95
|
-
- **`docx`**: hard-capped at 10 MB. The underlying library (mammoth) has no streaming API and loads the whole document into memory; above 10 MB the server returns a `MemoryError` asking you to pre-extract the text upstream and re-upload as `.txt` or `.md`.
|
|
96
|
-
- **Images** (`png`, `jpg`, `jpeg`, `webp`, `gif`, `bmp`, `tiff`, `svg`): the file is held in memory once for embedding/storage; size scales with the file, not with content complexity.
|
|
97
|
-
|
|
98
|
-
If you need deterministic memory or timing for production UX (e.g. RAG over large user-supplied workbooks), prefer pre-extracting `.pptx` and large `.xlsx` upstream and uploading the text as `.txt`. See `patterns/file-uploads.md` for the consumer-side pattern.
|
|
99
|
-
|
|
100
|
-
**Images require a `description`** — this is how the content gets embedded and becomes searchable. Without it, the image is stored but not findable. Use your vision capabilities to generate the description when the user doesn't provide one.
|
|
101
|
-
|
|
102
|
-
**Documents don't need a `description`** — text content is extracted and chunked automatically.
|
|
103
|
-
|
|
104
|
-
## Rules
|
|
105
|
-
|
|
106
|
-
- Always include `topic` and `project` in metadata
|
|
107
|
-
- Keep content factual and concise — decisions, not deliberation
|
|
108
|
-
- Do NOT store ephemeral info (file contents, current state, in-progress work)
|
|
109
|
-
- One memory per concept — don't bundle unrelated things
|
|
110
|
-
- Extract entities when content mentions specific people, tools, technologies, organizations, locations, or events by name
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
## SDK Integration
|
|
115
|
-
|
|
116
|
-
For integrating pyx-memory into TypeScript/Bun projects, see the reference docs:
|
|
117
|
-
|
|
118
|
-
| What you need | Where to look |
|
|
119
|
-
|---|---|
|
|
120
|
-
| Wire pyx-memory into a consumer project | [patterns/consumer.md](patterns/consumer.md) |
|
|
121
|
-
| Set up embedded memory (full features) | [patterns/embedded.md](patterns/embedded.md) |
|
|
122
|
-
| Multi-tenant, ReBAC (namespaces + tuples), sensitivity, encryption | [patterns/access-control.md](patterns/access-control.md) |
|
|
123
|
-
| SDK quick start, package map, DO/DON'T | [reference/sdk-guide.md](reference/sdk-guide.md) |
|
|
124
|
-
| HTTP API endpoints | [reference/http-api.md](reference/http-api.md) |
|
|
125
|
-
| Type signatures and interfaces | [reference/types.md](reference/types.md) |
|
|
126
|
-
| RAG strategies, bi-temporal, consolidation | [reference/advanced.md](reference/advanced.md) |
|
|
127
|
-
| Feature parity: embedded vs sidecar | [reference/parity.md](reference/parity.md) |
|
|
128
|
-
| Minimal code examples | [examples/](examples/) |
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { MemoryInterface, MemoryListResult } from '@pyx-memory/client';
|
|
2
|
-
import type { MemoryEntry, MemorySearchResult, MemoryStats } from '@pyx-memory/shared';
|
|
3
|
-
|
|
4
|
-
export class DisabledMemory implements MemoryInterface {
|
|
5
|
-
async initialize(): Promise<void> {
|
|
6
|
-
console.warn('Memory service not configured — running without memory');
|
|
7
|
-
}
|
|
8
|
-
async store(
|
|
9
|
-
entry: Omit<MemoryEntry, 'id' | 'createdAt'> & { id?: string; createdAt?: string },
|
|
10
|
-
): Promise<MemoryEntry> {
|
|
11
|
-
return {
|
|
12
|
-
id: '',
|
|
13
|
-
content: entry.content,
|
|
14
|
-
type: entry.type,
|
|
15
|
-
metadata: {},
|
|
16
|
-
createdAt: new Date().toISOString(),
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
async search(): Promise<MemorySearchResult> {
|
|
20
|
-
return { entries: [], totalCount: 0, strategy: 'naive' };
|
|
21
|
-
}
|
|
22
|
-
async list(): Promise<MemoryListResult> {
|
|
23
|
-
return { entries: [], totalCount: 0, page: 1, limit: 20 };
|
|
24
|
-
}
|
|
25
|
-
async get(): Promise<MemoryEntry | null> {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
async delete(): Promise<boolean> {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
async clearSession(): Promise<number> {
|
|
32
|
-
return 0;
|
|
33
|
-
}
|
|
34
|
-
async stats(): Promise<MemoryStats> {
|
|
35
|
-
return {
|
|
36
|
-
totalEntries: 0,
|
|
37
|
-
storageUsedBytes: 0,
|
|
38
|
-
vectorCount: 0,
|
|
39
|
-
recentAccessCount: 0,
|
|
40
|
-
connected: false,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
async shutdown(): Promise<void> {}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Usage: pick the right implementation based on config
|
|
47
|
-
import { MemoryClient } from '@pyx-memory/client';
|
|
48
|
-
|
|
49
|
-
const memory: MemoryInterface = process.env.MEMORY_URL
|
|
50
|
-
? new MemoryClient(process.env.MEMORY_URL, process.env.MEMORY_API_KEY)
|
|
51
|
-
: new DisabledMemory();
|
|
52
|
-
|
|
53
|
-
await memory.initialize();
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Memory } from '@pyx-memory/core';
|
|
2
|
-
|
|
3
|
-
const memory = new Memory({ dataDir: './data' });
|
|
4
|
-
await memory.initialize(); // REQUIRED — throws if you skip this
|
|
5
|
-
|
|
6
|
-
// Store (default targets: sqlite + vector)
|
|
7
|
-
await memory.store({
|
|
8
|
-
content: 'User prefers dark mode',
|
|
9
|
-
type: 'long-term',
|
|
10
|
-
metadata: { source: 'settings' },
|
|
11
|
-
});
|
|
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
|
-
|
|
25
|
-
// Store with explicit targets (e.g., sqlite only)
|
|
26
|
-
await memory.store({
|
|
27
|
-
content: 'Temporary working note',
|
|
28
|
-
type: 'working',
|
|
29
|
-
metadata: {},
|
|
30
|
-
targets: ['sqlite'],
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// Search
|
|
34
|
-
const _results = await memory.search({ query: 'user preferences', limit: 5 });
|
|
35
|
-
|
|
36
|
-
// Cleanup
|
|
37
|
-
await memory.shutdown(); // REQUIRED — releases SQLite + LanceDB resources
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MemoryClient } from '@pyx-memory/client';
|
|
2
|
-
|
|
3
|
-
// Without auth (local dev)
|
|
4
|
-
const memory = new MemoryClient('http://localhost:7822');
|
|
5
|
-
|
|
6
|
-
// With auth (production — pass API key as second argument)
|
|
7
|
-
// const memory = new MemoryClient('http://localhost:7822', process.env.MEMORY_API_KEY);
|
|
8
|
-
|
|
9
|
-
await memory.initialize(); // verifies server connectivity via /health
|
|
10
|
-
|
|
11
|
-
await memory.store({ content: 'Important fact', type: 'long-term', metadata: {} });
|
|
12
|
-
const _results = await memory.search({ query: 'fact', limit: 5 });
|
|
13
|
-
|
|
14
|
-
// Start the server: bun packages/server/src/index.ts
|