@shahmilsaari/memory-core 0.2.12 → 0.2.14
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 +33 -6
- package/dist/{chunk-73SRPNAL.js → chunk-25Y2KI7M.js} +55 -6
- package/dist/cli.js +786 -190
- package/dist/{db-KU4EEG4Y.js → db-5X5LTUCB.js} +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ You decide the architecture. memory-core remembers it. Every AI tool — Copilot
|
|
|
8
8
|
npx @shahmilsaari/memory-core init
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Fully local or cloud — your choice. **v0.2.
|
|
11
|
+
Fully local or cloud — your choice. **v0.2.13**
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -165,6 +165,14 @@ That's it. Every AI agent in your project now has your rules.
|
|
|
165
165
|
|
|
166
166
|
## Commands
|
|
167
167
|
|
|
168
|
+
For the full CLI reference, examples, and command behavior notes, see [COMMANDS.md](./COMMANDS.md).
|
|
169
|
+
|
|
170
|
+
New setup-management commands:
|
|
171
|
+
- `memory-core status` — show project name, provider/model, agents, hook state, generated files, and health checks
|
|
172
|
+
- `memory-core provider set <provider>` — switch code-checking provider without rerunning `init`
|
|
173
|
+
- `memory-core model set <model>` — update chat or embedding model from the CLI
|
|
174
|
+
- `memory-core model doctor` — verify database, Ollama, model installation, and cloud API key presence
|
|
175
|
+
|
|
168
176
|
### `init` — Set up a project
|
|
169
177
|
|
|
170
178
|
```bash
|
|
@@ -566,6 +574,13 @@ npx @shahmilsaari/memory-core sync
|
|
|
566
574
|
# Not sure how something was decided? Search.
|
|
567
575
|
npx @shahmilsaari/memory-core search "caching strategy"
|
|
568
576
|
|
|
577
|
+
# Inspect current setup, provider, model, and health checks
|
|
578
|
+
npx @shahmilsaari/memory-core status
|
|
579
|
+
|
|
580
|
+
# Switch code-checking provider or model without rerunning init
|
|
581
|
+
npx @shahmilsaari/memory-core provider set openai --model gpt-4o-mini --api-key $OPENAI_API_KEY
|
|
582
|
+
npx @shahmilsaari/memory-core model set qwen2.5-coder --provider ollama
|
|
583
|
+
|
|
569
584
|
# See what rules are saved
|
|
570
585
|
npx @shahmilsaari/memory-core list --type rule
|
|
571
586
|
|
|
@@ -603,10 +618,15 @@ pgvector isn't installed for your PostgreSQL version. Follow the [pgvector insta
|
|
|
603
618
|
Start Ollama: `brew services start ollama` (macOS) or `ollama serve` (Linux).
|
|
604
619
|
|
|
605
620
|
**`Chat model "llama3.2" not found`**
|
|
606
|
-
Run `ollama pull llama3.2`. Or switch provider/model
|
|
621
|
+
Run `ollama pull llama3.2`. Or switch provider/model with `npx @shahmilsaari/memory-core provider set ...` or `npx @shahmilsaari/memory-core model set ...`.
|
|
607
622
|
|
|
608
623
|
**Using an API key instead of Ollama for code checking**
|
|
609
|
-
During `init` choose OpenAI, Anthropic, or MiniMax when prompted for the check provider. Or
|
|
624
|
+
During `init` choose OpenAI, Anthropic, or MiniMax when prompted for the check provider. Or switch later:
|
|
625
|
+
```bash
|
|
626
|
+
npx @shahmilsaari/memory-core provider set openai --model gpt-4o --api-key sk-...
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
Equivalent manual `.memory-core.env` settings:
|
|
610
630
|
```
|
|
611
631
|
CHAT_PROVIDER=openai
|
|
612
632
|
CHAT_MODEL=gpt-4o
|
|
@@ -617,6 +637,12 @@ Embeddings always use Ollama (`nomic-embed-text`) regardless of provider.
|
|
|
617
637
|
**`DATABASE_URL is not set`**
|
|
618
638
|
Run `npx @shahmilsaari/memory-core init` — it will create the `.memory-core.env` file for you.
|
|
619
639
|
|
|
640
|
+
**Not sure what memory-core is configured to use**
|
|
641
|
+
Run `npx @shahmilsaari/memory-core status`.
|
|
642
|
+
|
|
643
|
+
**Need to verify the model/database setup**
|
|
644
|
+
Run `npx @shahmilsaari/memory-core model doctor`.
|
|
645
|
+
|
|
620
646
|
**`createdb: role does not exist`**
|
|
621
647
|
```bash
|
|
622
648
|
createuser -s $(whoami)
|
|
@@ -647,11 +673,12 @@ Save an ignore pattern: `npx @shahmilsaari/memory-core ignore "your exception he
|
|
|
647
673
|
| ✓ | List / remove / edit — full CRUD for stored memories |
|
|
648
674
|
| ✓ | False positive tagging — `ignore` command saves exceptions for hook and watcher |
|
|
649
675
|
| ✓ | Reset command — clean up generated files and optionally drop the DB table |
|
|
650
|
-
| ✓ | Test suite —
|
|
676
|
+
| ✓ | Test suite — smoke tests for all core commands and providers |
|
|
651
677
|
| ✓ | Multi-provider code checking — Ollama, OpenAI, Anthropic, MiniMax |
|
|
652
|
-
| | Context-aware retrieval — surface the most relevant rules for the file being edited |
|
|
678
|
+
| ✓ | Context-aware retrieval — surface the most relevant rules for the file being edited |
|
|
679
|
+
| ✓ | Setup management — `status`, `provider set`, `model set`, `model doctor` |
|
|
680
|
+
| ✓ | `--debug` flag — verbose output for diagnosing hook and watcher issues |
|
|
653
681
|
| | Model guidance during init — recommend a model based on machine specs |
|
|
654
|
-
| | `--debug` flag — verbose output for diagnosing hook and watcher issues |
|
|
655
682
|
| | Violation → rule pipeline — auto-suggest a new rule when the same violation repeats |
|
|
656
683
|
| | Rule analytics dashboard — visual breakdown of rule coverage and violations |
|
|
657
684
|
| | Team sync — shared database so the whole team works from the same rule set |
|
|
@@ -82,8 +82,17 @@ async function listMemories(filters = {}) {
|
|
|
82
82
|
where.push(`scope = $${params.length}`);
|
|
83
83
|
}
|
|
84
84
|
if (filters.architecture) {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
if (Array.isArray(filters.architecture)) {
|
|
86
|
+
params.push(filters.architecture);
|
|
87
|
+
where.push(`architecture = ANY($${params.length})`);
|
|
88
|
+
} else {
|
|
89
|
+
params.push(filters.architecture);
|
|
90
|
+
where.push(`architecture = $${params.length}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (filters.tags?.length) {
|
|
94
|
+
params.push(filters.tags);
|
|
95
|
+
where.push(`tags && $${params.length}::text[]`);
|
|
87
96
|
}
|
|
88
97
|
const limit = filters.limit ?? 200;
|
|
89
98
|
params.push(limit);
|
|
@@ -112,6 +121,40 @@ async function deleteMemory(id) {
|
|
|
112
121
|
const result = await getPool().query(`DELETE FROM memories WHERE id = $1`, [id]);
|
|
113
122
|
return (result.rowCount ?? 0) > 0;
|
|
114
123
|
}
|
|
124
|
+
async function deleteMemories(filters) {
|
|
125
|
+
await runMigrations();
|
|
126
|
+
const where = [];
|
|
127
|
+
const params = [];
|
|
128
|
+
if (filters.type) {
|
|
129
|
+
params.push(filters.type);
|
|
130
|
+
where.push(`type = $${params.length}`);
|
|
131
|
+
}
|
|
132
|
+
if (filters.scope) {
|
|
133
|
+
params.push(filters.scope);
|
|
134
|
+
where.push(`scope = $${params.length}`);
|
|
135
|
+
}
|
|
136
|
+
if (filters.architecture) {
|
|
137
|
+
if (Array.isArray(filters.architecture)) {
|
|
138
|
+
params.push(filters.architecture);
|
|
139
|
+
where.push(`architecture = ANY($${params.length})`);
|
|
140
|
+
} else {
|
|
141
|
+
params.push(filters.architecture);
|
|
142
|
+
where.push(`architecture = $${params.length}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (filters.tag) {
|
|
146
|
+
params.push(filters.tag);
|
|
147
|
+
where.push(`$${params.length} = ANY(tags)`);
|
|
148
|
+
}
|
|
149
|
+
if (where.length === 0) {
|
|
150
|
+
throw new Error("Refusing to bulk-delete without filters");
|
|
151
|
+
}
|
|
152
|
+
const result = await getPool().query(
|
|
153
|
+
`DELETE FROM memories WHERE ${where.join(" AND ")}`,
|
|
154
|
+
params
|
|
155
|
+
);
|
|
156
|
+
return result.rowCount ?? 0;
|
|
157
|
+
}
|
|
115
158
|
async function updateMemory(id, patch) {
|
|
116
159
|
await runMigrations();
|
|
117
160
|
const current = await getMemory(id);
|
|
@@ -145,14 +188,19 @@ async function updateMemory(id, patch) {
|
|
|
145
188
|
);
|
|
146
189
|
return result.rows[0] ?? null;
|
|
147
190
|
}
|
|
148
|
-
async function searchMemories(embedding,
|
|
191
|
+
async function searchMemories(embedding, architectures, limit = 10) {
|
|
149
192
|
await runMigrations();
|
|
150
193
|
const vector = `[${embedding.join(",")}]`;
|
|
151
194
|
const params = [vector];
|
|
152
195
|
let whereClause = "";
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
196
|
+
const selectedArchitectures = architectures ? (Array.isArray(architectures) ? architectures : [architectures]).filter(Boolean) : [];
|
|
197
|
+
if (selectedArchitectures.length > 0) {
|
|
198
|
+
whereClause = `WHERE (
|
|
199
|
+
architecture = ANY($2)
|
|
200
|
+
OR architecture IS NULL
|
|
201
|
+
OR architecture = 'global'
|
|
202
|
+
)`;
|
|
203
|
+
params.push(selectedArchitectures);
|
|
156
204
|
}
|
|
157
205
|
const client = await getPool().connect();
|
|
158
206
|
try {
|
|
@@ -190,6 +238,7 @@ export {
|
|
|
190
238
|
listMemories,
|
|
191
239
|
getMemory,
|
|
192
240
|
deleteMemory,
|
|
241
|
+
deleteMemories,
|
|
193
242
|
updateMemory,
|
|
194
243
|
searchMemories,
|
|
195
244
|
closePool
|