@shahmilsaari/memory-core 1.0.20 → 1.0.25
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 +249 -458
- package/dist/{chunk-UZDALJVQ.js → chunk-35ZWQFTO.js} +2594 -976
- package/dist/cli.js +471 -1582
- package/dist/dashboard/assets/index-B7gd4JQc.js +2 -0
- package/dist/dashboard/assets/{index-DXXHB1Ik.css → index-CHgjllWU.css} +1 -1
- package/dist/dashboard/index.html +2 -2
- package/dist/{dashboard-server-VOT2ZRVN.js → dashboard-server-SSYZLQKB.js} +68 -5
- package/package.json +1 -1
- package/dist/dashboard/assets/index-BRqvIBnm.js +0 -2
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# memory-core
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Your architecture rules, in every AI coding agent. Automatically.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
AI agents like Copilot, Cursor, Claude Code, and Windsurf are powerful — but they start fresh every session. They don't know you're using Clean Architecture. They don't know controllers shouldn't call the database. They don't remember why you made that decision six months ago.
|
|
6
|
+
|
|
7
|
+
memory-core fixes that. You save your architecture rules once. Every AI tool reads them before writing code. Violations get caught before they reach your repo.
|
|
6
8
|
|
|
7
9
|
Website: https://memory-core.shahmilsaari.my/
|
|
8
10
|
|
|
@@ -10,33 +12,51 @@ Website: https://memory-core.shahmilsaari.my/
|
|
|
10
12
|
npx @shahmilsaari/memory-core init
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
Fully local or cloud — your choice.
|
|
15
|
+
Fully local or cloud AI — your choice.
|
|
14
16
|
|
|
15
17
|
---
|
|
16
18
|
|
|
17
|
-
##
|
|
19
|
+
## How it works
|
|
20
|
+
|
|
21
|
+
memory-core has three jobs:
|
|
22
|
+
|
|
23
|
+
**1. Remember** — Store your architecture decisions, rules, and patterns in a local PostgreSQL database with AI-powered search. When you decide "no direct DB calls from controllers", you save that rule with a reason. It's stored forever.
|
|
24
|
+
|
|
25
|
+
**2. Distribute** — Generate instruction files for 14 AI agents (Cursor, Claude Code, Copilot, Windsurf, etc.) from your stored rules. Every agent reads your rules before it writes code.
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
**3. Enforce** — Three-layer rule checking catches violations automatically:
|
|
28
|
+
- **Deterministic** — string matching against known bad patterns (instant, no AI needed)
|
|
29
|
+
- **Structural** — import graph analysis to catch architectural boundary violations
|
|
30
|
+
- **AI semantic** — LLM reads the actual code diff against your rules
|
|
31
|
+
|
|
32
|
+
You can run enforcement in watch mode (checks as you type), as a pre-commit hook (checks before each commit), or in CI (checks on every PR).
|
|
33
|
+
|
|
34
|
+
---
|
|
20
35
|
|
|
21
|
-
|
|
36
|
+
## What's new in this version
|
|
22
37
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
38
|
+
- **AI auto-fix** — When watch mode detects a violation, it can rewrite the file automatically and save the fix as a new rule
|
|
39
|
+
- **Dry-run mode** — Run the full check pipeline without blocking commits: `check --dry-run`
|
|
40
|
+
- **Schema alignment rules** — Define TypeScript↔Go struct pairs; catch field drift automatically: `schema add --ts --go`
|
|
41
|
+
- **Bypass tracking** — Every `MEMORY_CORE_SKIP_HOOK=1` bypass is counted; re-prompted if no reason given
|
|
42
|
+
- **Model switcher in dashboard** — Change provider and model from the UI without restarting
|
|
43
|
+
- **Token usage display** — See AI call counts and token usage; Ollama shows "LOCAL (FREE)"
|
|
44
|
+
- **Actions panel** — Trigger Sync Agents, Check All, and Tune Rules directly from the dashboard
|
|
27
45
|
|
|
28
46
|
---
|
|
29
47
|
|
|
30
48
|
## Before you start
|
|
31
49
|
|
|
32
|
-
You need three things
|
|
50
|
+
You need three things:
|
|
33
51
|
|
|
34
52
|
| What | Why | Install |
|
|
35
53
|
|---|---|---|
|
|
36
54
|
| PostgreSQL 14+ | Stores your rules and decisions | See below |
|
|
37
|
-
| pgvector |
|
|
55
|
+
| pgvector | Enables AI-powered rule search | See below |
|
|
38
56
|
| Ollama | Runs AI locally — no API key needed | See below |
|
|
39
57
|
|
|
58
|
+
Cloud providers (OpenAI, Anthropic, MiniMax) are also supported if you prefer not to run Ollama locally.
|
|
59
|
+
|
|
40
60
|
---
|
|
41
61
|
|
|
42
62
|
## Install
|
|
@@ -61,14 +81,14 @@ sudo systemctl start postgresql
|
|
|
61
81
|
|
|
62
82
|
### pgvector
|
|
63
83
|
|
|
64
|
-
pgvector adds AI-powered search to PostgreSQL.
|
|
84
|
+
pgvector adds AI-powered similarity search to PostgreSQL, so memory-core can find rules related to your query even when you don't use the exact words.
|
|
65
85
|
|
|
66
|
-
**macOS + PostgreSQL 17+**
|
|
86
|
+
**macOS + PostgreSQL 17+**
|
|
67
87
|
```bash
|
|
68
88
|
brew install pgvector
|
|
69
89
|
```
|
|
70
90
|
|
|
71
|
-
**macOS + PostgreSQL 16** (brew
|
|
91
|
+
**macOS + PostgreSQL 16** (brew targets 17+, so build from source)
|
|
72
92
|
```bash
|
|
73
93
|
xcode-select --install
|
|
74
94
|
git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git /tmp/pgvector
|
|
@@ -82,7 +102,7 @@ make install PG_CONFIG=/opt/homebrew/opt/postgresql@16/bin/pg_config
|
|
|
82
102
|
sudo apt install postgresql-16-pgvector # replace 16 with your version
|
|
83
103
|
```
|
|
84
104
|
|
|
85
|
-
|
|
105
|
+
Verify:
|
|
86
106
|
```bash
|
|
87
107
|
psql -U $(whoami) -c "SELECT * FROM pg_available_extensions WHERE name = 'vector';"
|
|
88
108
|
```
|
|
@@ -91,7 +111,7 @@ psql -U $(whoami) -c "SELECT * FROM pg_available_extensions WHERE name = 'vector
|
|
|
91
111
|
|
|
92
112
|
### Ollama
|
|
93
113
|
|
|
94
|
-
Ollama runs AI models on your machine. Two models are
|
|
114
|
+
Ollama runs AI models on your machine. Two models are used: one for search (embeddings) and one for code checking.
|
|
95
115
|
|
|
96
116
|
**macOS**
|
|
97
117
|
```bash
|
|
@@ -107,10 +127,10 @@ ollama serve &
|
|
|
107
127
|
|
|
108
128
|
**Windows** — [download from ollama.com](https://ollama.com/download)
|
|
109
129
|
|
|
110
|
-
Pull the
|
|
130
|
+
Pull the required models:
|
|
111
131
|
```bash
|
|
112
|
-
ollama pull nomic-embed-text # required for search
|
|
113
|
-
ollama pull llama3.2 # or whichever model you plan to use
|
|
132
|
+
ollama pull nomic-embed-text # required for search (always Ollama)
|
|
133
|
+
ollama pull llama3.2 # or whichever model you plan to use for code checking
|
|
114
134
|
```
|
|
115
135
|
|
|
116
136
|
---
|
|
@@ -177,45 +197,42 @@ That's it. Every AI agent in your project now has your rules.
|
|
|
177
197
|
|
|
178
198
|
---
|
|
179
199
|
|
|
180
|
-
##
|
|
200
|
+
## Day-to-day workflow
|
|
181
201
|
|
|
182
|
-
|
|
202
|
+
```bash
|
|
203
|
+
# Made an architectural decision? Save it.
|
|
204
|
+
npx @shahmilsaari/memory-core remember "Controllers must never call the database directly" \
|
|
205
|
+
--type rule --reason "Keeps HTTP concerns out of application logic"
|
|
183
206
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
- `memory-core auto-sync` — show or change automatic agent file regeneration (`on`, `off`, or `status`)
|
|
187
|
-
- `memory-core uninstall` — remove memory-core from the current project; use `reset` when you only need to regenerate files
|
|
188
|
-
- `memory-core provider set <provider>` — switch code-checking provider without rerunning `init`
|
|
189
|
-
- `memory-core model set <model>` — update chat or embedding model from the CLI
|
|
190
|
-
- `memory-core model doctor` — verify database, Ollama, model installation, and cloud API key presence
|
|
191
|
-
- `memory-core graph build|list|show|diff` — build, inspect, and compare dependency graph snapshots
|
|
192
|
-
- `memory-core graph migrate` — create/update graph snapshot schema in PostgreSQL
|
|
193
|
-
- `memory-core graph doctor` — verify graph backend health (PostgreSQL + file fallback)
|
|
194
|
-
- `memory-core dashboard` — open the local Svelte command center with live WebSocket updates
|
|
207
|
+
# Watch mode — catch violations the moment you save a file
|
|
208
|
+
npx @shahmilsaari/memory-core watch
|
|
195
209
|
|
|
196
|
-
|
|
210
|
+
# AI auto-fix — let the AI rewrite violations automatically
|
|
211
|
+
npx @shahmilsaari/memory-core watch --auto-fix
|
|
197
212
|
|
|
198
|
-
|
|
213
|
+
# See the dashboard — live violations, model status, token usage, actions
|
|
214
|
+
npx @shahmilsaari/memory-core dashboard
|
|
199
215
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
- Quick start and installation: `website/docs/intro.md`, `website/docs/installation.md`
|
|
203
|
-
- Daily usage: `website/docs/workflow.md`
|
|
204
|
-
- CLI reference: `website/docs/commands.md`
|
|
205
|
-
- Dashboard and model setup: `website/docs/dashboard.md`, `website/docs/models.md`
|
|
206
|
-
- Reset and uninstall behavior: `website/docs/cleanup.md`
|
|
207
|
-
- Architecture migration notes: `docs/migration-phase6-cutover.md`
|
|
216
|
+
# Manual check before a commit
|
|
217
|
+
npx @shahmilsaari/memory-core check --staged
|
|
208
218
|
|
|
209
|
-
|
|
219
|
+
# Dry run — see what would be flagged without blocking
|
|
220
|
+
npx @shahmilsaari/memory-core check --staged --dry-run
|
|
210
221
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
222
|
+
# Not sure how something was decided? Search.
|
|
223
|
+
npx @shahmilsaari/memory-core search "caching strategy"
|
|
224
|
+
|
|
225
|
+
# See what's saved
|
|
226
|
+
npx @shahmilsaari/memory-core list --type rule
|
|
227
|
+
|
|
228
|
+
# Export rules for version control and team sharing
|
|
229
|
+
npx @shahmilsaari/memory-core export
|
|
217
230
|
```
|
|
218
231
|
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Commands
|
|
235
|
+
|
|
219
236
|
### `init` — Set up a project
|
|
220
237
|
|
|
221
238
|
```bash
|
|
@@ -224,57 +241,45 @@ npx @shahmilsaari/memory-core init
|
|
|
224
241
|
|
|
225
242
|
Walks you through:
|
|
226
243
|
- PostgreSQL connection URL — **tested live, retries until connected**
|
|
227
|
-
- Ollama URL — **tested live, retries until reachable**
|
|
244
|
+
- Ollama URL — **tested live, retries until reachable**
|
|
228
245
|
- Code-checking provider — **Ollama (local), OpenAI, Anthropic, or MiniMax**
|
|
229
246
|
- Code-checking model — picked from a list, verified before continuing
|
|
230
247
|
- Project name, type, architecture, language
|
|
231
|
-
- Which agents to generate files for —
|
|
248
|
+
- Which agents to generate files for — multi-select, all pre-checked
|
|
232
249
|
- Hook mode — **advisory** (logs violations, never blocks) or **strict** (blocks commits)
|
|
233
|
-
- Whether to enable caveman mode
|
|
234
|
-
|
|
235
|
-
Generates config files for every selected AI agent, saves your choices to `.memory-core.json`, enables auto-sync by default, and automatically adds all generated files to `.gitignore` under a `# memory-core generated files` block.
|
|
250
|
+
- Whether to enable caveman mode
|
|
236
251
|
|
|
237
|
-
|
|
252
|
+
Generates config files for every selected agent, installs the pre-commit hook, and auto-syncs by default.
|
|
238
253
|
|
|
239
254
|
---
|
|
240
255
|
|
|
241
256
|
### `sync` — Refresh all agent files
|
|
242
257
|
|
|
243
|
-
Regenerate every agent file on demand. This still exists even though `remember`, `import`, `edit`, `remove`, `forget`, and `ignore` auto-sync by default after changing memories.
|
|
244
|
-
|
|
245
258
|
```bash
|
|
246
259
|
npx @shahmilsaari/memory-core sync
|
|
247
260
|
```
|
|
248
261
|
|
|
249
|
-
|
|
262
|
+
Regenerates every agent instruction file from your current rules. Reports updated vs already up to date:
|
|
250
263
|
|
|
251
264
|
```
|
|
252
265
|
3 updated, 11 already up to date
|
|
253
266
|
```
|
|
254
267
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
Manage the default:
|
|
258
|
-
|
|
268
|
+
Turn off auto-sync when you want to batch memory edits, then sync once:
|
|
259
269
|
```bash
|
|
260
|
-
npx @shahmilsaari/memory-core auto-sync
|
|
261
|
-
npx @shahmilsaari/memory-core auto-sync
|
|
262
|
-
npx @shahmilsaari/memory-core auto-sync on # restore default behavior
|
|
270
|
+
npx @shahmilsaari/memory-core auto-sync off
|
|
271
|
+
npx @shahmilsaari/memory-core auto-sync on
|
|
263
272
|
```
|
|
264
273
|
|
|
265
|
-
Auto-sync failures are non-fatal. If regeneration cannot run, memory-core prints the reason and tells you to run `memory-core sync` manually.
|
|
266
|
-
|
|
267
274
|
---
|
|
268
275
|
|
|
269
276
|
### `remember` — Save a decision
|
|
270
277
|
|
|
271
|
-
Made a decision your team should never forget? Save it.
|
|
272
|
-
|
|
273
278
|
```bash
|
|
274
279
|
npx @shahmilsaari/memory-core remember "Controllers must never call the database directly"
|
|
275
280
|
```
|
|
276
281
|
|
|
277
|
-
It will ask you *why* —
|
|
282
|
+
It will ask you *why* — the reason gets stored alongside the rule and shown when a violation is caught.
|
|
278
283
|
|
|
279
284
|
With flags (skip the prompts):
|
|
280
285
|
```bash
|
|
@@ -292,56 +297,28 @@ npx @shahmilsaari/memory-core remember "Use DTOs for all API responses" \
|
|
|
292
297
|
|---|---|---|
|
|
293
298
|
| `--type` | `decision` `rule` `pattern` `note` | `decision` |
|
|
294
299
|
| `--scope` | `global` `project` | `project` |
|
|
295
|
-
| `--reason` | any text | asked interactively
|
|
300
|
+
| `--reason` | any text | asked interactively |
|
|
296
301
|
| `--applies-to` | comma-separated use cases | none |
|
|
297
302
|
| `--avoid-when` | comma-separated exceptions | none |
|
|
298
303
|
| `--example` | comma-separated examples | none |
|
|
299
|
-
| `--source` | source note, ticket, or review | none |
|
|
300
304
|
| `--tags` | comma-separated | none |
|
|
301
305
|
|
|
302
|
-
Structured context is stored in the database as JSON and rendered into generated agent files as `Why`, `Use when`, `Avoid when`, and `Examples`, which gives AI agents clearer guidance than a flat rule sentence.
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
|
|
306
|
-
### `search` — Find a rule or decision
|
|
307
|
-
|
|
308
|
-
```bash
|
|
309
|
-
npx @shahmilsaari/memory-core search "error handling"
|
|
310
|
-
npx @shahmilsaari/memory-core search "auth strategy" --limit 10
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
Uses AI search — finds related rules even if you don't use the exact words.
|
|
314
|
-
|
|
315
|
-
---
|
|
316
|
-
|
|
317
|
-
### `seed` — Load predefined rules
|
|
318
|
-
|
|
319
|
-
281 best-practice rules across all supported architectures, each with a plain-English reason explaining why the rule exists.
|
|
320
|
-
|
|
321
|
-
```bash
|
|
322
|
-
npx @shahmilsaari/memory-core seed # all architectures
|
|
323
|
-
npx @shahmilsaari/memory-core seed --arch clean-architecture # one only
|
|
324
|
-
npx @shahmilsaari/memory-core seed --force # re-seed existing
|
|
325
|
-
```
|
|
326
|
-
|
|
327
306
|
---
|
|
328
307
|
|
|
329
308
|
### `watch` — Catch violations as you type
|
|
330
309
|
|
|
331
310
|
```bash
|
|
332
311
|
npx @shahmilsaari/memory-core watch
|
|
312
|
+
npx @shahmilsaari/memory-core watch --auto-fix # let AI rewrite violations automatically
|
|
313
|
+
npx @shahmilsaari/memory-core watch --path src/ # watch a specific folder only
|
|
314
|
+
npx @shahmilsaari/memory-core watch --scan-on-start # scan all tracked files once, then watch
|
|
315
|
+
npx @shahmilsaari/memory-core watch --verbose
|
|
316
|
+
npx @shahmilsaari/memory-core watch --debug
|
|
333
317
|
```
|
|
334
318
|
|
|
335
|
-
Runs in the background and checks each file the moment you save it.
|
|
319
|
+
Runs in the background and checks each file the moment you save it. Violations appear immediately:
|
|
336
320
|
|
|
337
321
|
```
|
|
338
|
-
archmind watch — real-time rule enforcement
|
|
339
|
-
|
|
340
|
-
watching: /your/project
|
|
341
|
-
model: llama3.2
|
|
342
|
-
rules: 24
|
|
343
|
-
ctrl+c to stop
|
|
344
|
-
|
|
345
322
|
[10:42:11] saved: src/controllers/user.ts
|
|
346
323
|
|
|
347
324
|
✗ 1 violation in src/controllers/user.ts
|
|
@@ -353,16 +330,23 @@ Runs in the background and checks each file the moment you save it. You see viol
|
|
|
353
330
|
Fix: Move to UserService.hashPassword()
|
|
354
331
|
```
|
|
355
332
|
|
|
356
|
-
|
|
333
|
+
With `--auto-fix`, when a violation is detected the AI rewrites the file and saves the fix as a new rule so the same mistake doesn't repeat.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
### `check` — Manual check
|
|
338
|
+
|
|
357
339
|
```bash
|
|
358
|
-
npx @shahmilsaari/memory-core
|
|
359
|
-
npx @shahmilsaari/memory-core
|
|
360
|
-
npx @shahmilsaari/memory-core
|
|
361
|
-
npx @shahmilsaari/memory-core
|
|
340
|
+
npx @shahmilsaari/memory-core check --staged # check staged files (same as hook)
|
|
341
|
+
npx @shahmilsaari/memory-core check --staged --dry-run # show results without blocking
|
|
342
|
+
npx @shahmilsaari/memory-core check --staged --fast # deterministic-only, no AI
|
|
343
|
+
npx @shahmilsaari/memory-core check --file src/user.ts # check a single file
|
|
344
|
+
npx @shahmilsaari/memory-core check --all # scan all tracked source files
|
|
345
|
+
npx @shahmilsaari/memory-core check --commit-msg # check .git/COMMIT_EDITMSG
|
|
346
|
+
npx @shahmilsaari/memory-core check --ci # CI mode using memories.json
|
|
362
347
|
```
|
|
363
348
|
|
|
364
|
-
|
|
365
|
-
`--scan-on-start` is useful after a big refactor because it refreshes current live stats automatically before normal save-based watch mode begins.
|
|
349
|
+
`--dry-run` runs the full check pipeline but exits 0, so CI or pre-commit can report violations without blocking. `--fast` skips AI for a low-latency check. `--file` checks a single file retroactively (treats entire file content as the diff).
|
|
366
350
|
|
|
367
351
|
---
|
|
368
352
|
|
|
@@ -375,204 +359,141 @@ npx @shahmilsaari/memory-core dashboard --path /absolute/path/to/project
|
|
|
375
359
|
npx @shahmilsaari/memory-core dashboard --no-watch
|
|
376
360
|
```
|
|
377
361
|
|
|
378
|
-
Starts a local Svelte dashboard at `http://localhost:5178
|
|
379
|
-
|
|
380
|
-
- WebSocket live feed for `watch` events
|
|
381
|
-
- terminal-style violation details with file, line, rule, reason, issue, fix, and code context
|
|
382
|
-
- PostgreSQL connection status, database name, host, and redacted URL
|
|
383
|
-
- code-checking model status, resolved Ollama model, embedding model, and provider
|
|
384
|
-
- architecture-aware rule browser filtered to the project initialized during `init`
|
|
385
|
-
- stats for most violated rules and files
|
|
386
|
-
- live reload for `.env`, `.memory-core.env`, `.memory-core.json`, and `.memory-core-stats.json`
|
|
362
|
+
Starts a local Svelte dashboard at `http://localhost:5178`. What you get:
|
|
387
363
|
|
|
388
|
-
|
|
389
|
-
|
|
364
|
+
- **Live violations feed** — WebSocket push, no polling
|
|
365
|
+
- **Model switcher** — change provider and model from the UI; takes effect immediately
|
|
366
|
+
- **Token usage** — AI call count and tokens used; Ollama shows "LOCAL (FREE)"
|
|
367
|
+
- **Actions panel** — Sync Agents, Check All, Tune Rules without touching the terminal
|
|
368
|
+
- **PostgreSQL health** — connection status, database name, host
|
|
369
|
+
- **Rule browser** — filtered to your project's architecture profile
|
|
370
|
+
- **Stats** — most violated rules and files
|
|
390
371
|
|
|
391
372
|
---
|
|
392
373
|
|
|
393
|
-
### `
|
|
394
|
-
|
|
395
|
-
```bash
|
|
396
|
-
npx @shahmilsaari/memory-core check --staged # check staged files
|
|
397
|
-
npx @shahmilsaari/memory-core check --staged --fast # deterministic-only staged check
|
|
398
|
-
npx @shahmilsaari/memory-core check --staged --verbose # with extra detail
|
|
399
|
-
npx @shahmilsaari/memory-core check --staged --debug # show prompt, diff, and raw model output
|
|
400
|
-
npx @shahmilsaari/memory-core check --commit-msg # check .git/COMMIT_EDITMSG
|
|
401
|
-
npx @shahmilsaari/memory-core check --commit-msg <file> # check a specific message file
|
|
402
|
-
npx @shahmilsaari/memory-core check --ci # CI mode using memories.json
|
|
403
|
-
npx @shahmilsaari/memory-core check --all # scan all tracked source files
|
|
404
|
-
npx @shahmilsaari/memory-core check --all --path src/ # scan only tracked files under src/
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
`--staged` is the same path used by the pre-commit hook. Add `--fast` to skip AI and memory retrieval for a low-latency deterministic check. `--commit-msg` validates a commit message file against `commitRules` — this is called automatically by the `commit-msg` hook. `--ci` reads `memories.json` with no database or Ollama required. `--all` and `--ci` are mutually exclusive.
|
|
374
|
+
### `schema` — TypeScript ↔ Go struct alignment
|
|
408
375
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
### `hook install` — Install hooks
|
|
376
|
+
Catch field drift between TypeScript interfaces and Go structs automatically.
|
|
412
377
|
|
|
413
378
|
```bash
|
|
414
|
-
|
|
415
|
-
npx @shahmilsaari/memory-core
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
Installs **two** git hooks:
|
|
421
|
-
- `.git/hooks/pre-commit` — checks staged code against architecture rules.
|
|
422
|
-
- `.git/hooks/commit-msg` — checks commit messages against `commitRules` (see `commit-rules` command).
|
|
423
|
-
|
|
424
|
-
**Advisory mode (default):** violations are logged but the commit always goes through.
|
|
425
|
-
|
|
426
|
-
**Strict mode:** violations block the commit. You see exactly what's wrong:
|
|
427
|
-
|
|
428
|
-
```
|
|
429
|
-
✗ 2 rule violations found — commit blocked
|
|
430
|
-
|
|
431
|
-
[1] Thin controllers ×2
|
|
432
|
-
src/controllers/user.ts:32 Password validation in route handler
|
|
433
|
-
src/controllers/auth.ts:18 DB query inside controller
|
|
379
|
+
# Define a pair to track
|
|
380
|
+
npx @shahmilsaari/memory-core schema add \
|
|
381
|
+
--ts src/types/user.ts \
|
|
382
|
+
--go internal/models/user.go
|
|
434
383
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
Issue: Imports 'typeorm' directly
|
|
438
|
-
Fix: Define IUserRepository interface in domain/
|
|
384
|
+
# List tracked pairs
|
|
385
|
+
npx @shahmilsaari/memory-core schema list
|
|
439
386
|
|
|
440
|
-
|
|
441
|
-
|
|
387
|
+
# Check all pairs for field drift
|
|
388
|
+
npx @shahmilsaari/memory-core schema check
|
|
442
389
|
```
|
|
443
390
|
|
|
444
|
-
|
|
445
|
-
npx @shahmilsaari/memory-core hook uninstall # remove both hooks
|
|
446
|
-
```
|
|
391
|
+
When a field is added to one side but not the other, `schema check` reports it as a violation.
|
|
447
392
|
|
|
448
393
|
---
|
|
449
394
|
|
|
450
|
-
### `
|
|
395
|
+
### `hook install` — Install pre-commit and commit-msg hooks
|
|
451
396
|
|
|
452
397
|
```bash
|
|
453
|
-
npx @shahmilsaari/memory-core
|
|
398
|
+
npx @shahmilsaari/memory-core hook install # advisory mode (default)
|
|
399
|
+
npx @shahmilsaari/memory-core hook install --strict # block commits on violations
|
|
400
|
+
npx @shahmilsaari/memory-core hook install --fast # deterministic-only check
|
|
401
|
+
npx @shahmilsaari/memory-core hook uninstall
|
|
454
402
|
```
|
|
455
403
|
|
|
456
|
-
|
|
404
|
+
**Advisory mode (default):** violations are logged but the commit always goes through.
|
|
457
405
|
|
|
406
|
+
**Strict mode:** violations block the commit. You see exactly what's wrong and how to fix it.
|
|
407
|
+
|
|
408
|
+
To bypass strict mode in an emergency:
|
|
458
409
|
```bash
|
|
459
|
-
|
|
460
|
-
npx @shahmilsaari/memory-core list --type rule
|
|
461
|
-
npx @shahmilsaari/memory-core list --scope global
|
|
462
|
-
npx @shahmilsaari/memory-core list --arch clean-architecture
|
|
463
|
-
npx @shahmilsaari/memory-core list --project my-api
|
|
464
|
-
npx @shahmilsaari/memory-core list --limit 50
|
|
410
|
+
MEMORY_CORE_SKIP_HOOK=1 git commit -m "..."
|
|
465
411
|
```
|
|
466
412
|
|
|
467
|
-
|
|
468
|
-
|---|---|
|
|
469
|
-
| `--type <type>` | Filter by type: `decision` `rule` `pattern` `note` |
|
|
470
|
-
| `--scope <scope>` | Filter by scope: `global` `project` |
|
|
471
|
-
| `--arch <architecture>` | Filter by architecture profile |
|
|
472
|
-
| `--project <name>` | Filter by project name |
|
|
473
|
-
| `--all` | Show the full shared database |
|
|
474
|
-
| `--current` | Explicitly use the current project context |
|
|
475
|
-
| `--limit <n>` | Max results (default 200) |
|
|
413
|
+
Every bypass is tracked. If you don't provide a reason, memory-core will ask you on the next commit.
|
|
476
414
|
|
|
477
415
|
---
|
|
478
416
|
|
|
479
|
-
### `
|
|
417
|
+
### `search` — Find a rule
|
|
480
418
|
|
|
481
419
|
```bash
|
|
482
|
-
npx @shahmilsaari/memory-core
|
|
483
|
-
npx @shahmilsaari/memory-core
|
|
420
|
+
npx @shahmilsaari/memory-core search "error handling"
|
|
421
|
+
npx @shahmilsaari/memory-core search "auth strategy" --limit 10
|
|
484
422
|
```
|
|
485
423
|
|
|
486
|
-
|
|
424
|
+
Uses AI search — finds related rules even if you don't use the exact words.
|
|
487
425
|
|
|
488
426
|
---
|
|
489
427
|
|
|
490
|
-
### `
|
|
428
|
+
### `seed` — Load predefined rules
|
|
429
|
+
|
|
430
|
+
281 best-practice rules across all supported architectures, each with a plain-English reason.
|
|
491
431
|
|
|
492
432
|
```bash
|
|
493
|
-
npx @shahmilsaari/memory-core
|
|
494
|
-
npx @shahmilsaari/memory-core
|
|
495
|
-
npx @shahmilsaari/memory-core
|
|
433
|
+
npx @shahmilsaari/memory-core seed # all architectures
|
|
434
|
+
npx @shahmilsaari/memory-core seed --arch clean-architecture # one only
|
|
435
|
+
npx @shahmilsaari/memory-core seed --force # re-seed existing
|
|
496
436
|
```
|
|
497
437
|
|
|
498
|
-
Deletes memories by filter. At least one filter is required, so an empty `forget` command cannot wipe the database by accident.
|
|
499
|
-
|
|
500
|
-
| Flag | What it does |
|
|
501
|
-
|---|---|
|
|
502
|
-
| `--tag <tag>` | Delete memories with a tag |
|
|
503
|
-
| `--scope <scope>` | Filter by scope: `global` `project` |
|
|
504
|
-
| `--type <type>` | Filter by type |
|
|
505
|
-
| `--arch <architecture>` | Filter by architecture profile |
|
|
506
|
-
| `--no-sync` | Skip automatic agent file regeneration |
|
|
507
|
-
|
|
508
438
|
---
|
|
509
439
|
|
|
510
|
-
### `edit` —
|
|
440
|
+
### `list`, `remove`, `edit` — Manage your rules
|
|
511
441
|
|
|
512
442
|
```bash
|
|
443
|
+
npx @shahmilsaari/memory-core list
|
|
444
|
+
npx @shahmilsaari/memory-core list --type rule
|
|
445
|
+
npx @shahmilsaari/memory-core list --scope global
|
|
446
|
+
npx @shahmilsaari/memory-core list --arch clean-architecture
|
|
447
|
+
|
|
448
|
+
npx @shahmilsaari/memory-core remove <id>
|
|
513
449
|
npx @shahmilsaari/memory-core edit <id>
|
|
514
|
-
npx @shahmilsaari/memory-core edit <id> --no-sync
|
|
515
450
|
```
|
|
516
451
|
|
|
517
|
-
Opens the memory interactively so you can update its content, reason, structured context, tags, type, or scope.
|
|
518
|
-
|
|
519
452
|
---
|
|
520
453
|
|
|
521
|
-
### `export` —
|
|
454
|
+
### `export` / `import` — Share rules with your team
|
|
522
455
|
|
|
523
456
|
```bash
|
|
457
|
+
# Export your rules to a file (commit this alongside your code)
|
|
524
458
|
npx @shahmilsaari/memory-core export
|
|
525
|
-
npx @shahmilsaari/memory-core export --output path/to/my-rules.json
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
Exports all memories from the database to `memories.json` in the project root (or the path you specify). Makes your rules portable and version-controllable — commit the file alongside your code.
|
|
529
459
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
### `import` — Import memories from a file
|
|
533
|
-
|
|
534
|
-
```bash
|
|
460
|
+
# Import from a file or URL
|
|
535
461
|
npx @shahmilsaari/memory-core import
|
|
536
|
-
npx @shahmilsaari/memory-core import --file path/to/
|
|
462
|
+
npx @shahmilsaari/memory-core import --file path/to/rules.json
|
|
537
463
|
npx @shahmilsaari/memory-core import --url https://example.com/team-rules.json
|
|
538
|
-
npx @shahmilsaari/memory-core import --no-sync
|
|
539
464
|
```
|
|
540
465
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
| Flag | What it does |
|
|
544
|
-
|---|---|
|
|
545
|
-
| `--file <path>` | Import from a custom local file path |
|
|
546
|
-
| `--url <url>` | Import from a remote URL |
|
|
547
|
-
| `--no-sync` | Skip automatic agent file regeneration |
|
|
466
|
+
Skips duplicates — safe to run multiple times.
|
|
548
467
|
|
|
549
468
|
---
|
|
550
469
|
|
|
551
|
-
### `ignore` —
|
|
470
|
+
### `ignore` / `allow` — Handle exceptions
|
|
552
471
|
|
|
553
472
|
```bash
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
473
|
+
# Save a false-positive pattern — never flagged again
|
|
474
|
+
npx @shahmilsaari/memory-core ignore "controllers may import prisma in migration scripts"
|
|
475
|
+
npx @shahmilsaari/memory-core ignore --list
|
|
476
|
+
npx @shahmilsaari/memory-core ignore --remove <id>
|
|
558
477
|
|
|
559
|
-
|
|
560
|
-
npx @shahmilsaari/memory-core
|
|
561
|
-
npx @shahmilsaari/memory-core
|
|
562
|
-
npx @shahmilsaari/memory-core ignore "..." --no-sync # save without regenerating agent files
|
|
478
|
+
# Allow an intentional project pattern
|
|
479
|
+
npx @shahmilsaari/memory-core allow "generated by sqlc"
|
|
480
|
+
npx @shahmilsaari/memory-core allow --list
|
|
563
481
|
```
|
|
564
482
|
|
|
565
483
|
---
|
|
566
484
|
|
|
567
|
-
### `
|
|
485
|
+
### `stats` / `tune` — Manage noisy rules
|
|
568
486
|
|
|
569
487
|
```bash
|
|
570
|
-
npx @shahmilsaari/memory-core
|
|
571
|
-
npx @shahmilsaari/memory-core
|
|
572
|
-
npx @shahmilsaari/memory-core
|
|
488
|
+
npx @shahmilsaari/memory-core stats # show violation counts and false-positive rates
|
|
489
|
+
npx @shahmilsaari/memory-core stats --tune # show only noisy rules with their disable commands
|
|
490
|
+
npx @shahmilsaari/memory-core stats --reset # clear all counters
|
|
491
|
+
|
|
492
|
+
npx @shahmilsaari/memory-core tune # interactively silence noisy rules
|
|
493
|
+
npx @shahmilsaari/memory-core tune --yes # silence all qualifying rules automatically
|
|
573
494
|
```
|
|
574
495
|
|
|
575
|
-
|
|
496
|
+
A rule with a >40% false-positive rate shows up in `--tune`. The `tune` command lets you silence it interactively.
|
|
576
497
|
|
|
577
498
|
---
|
|
578
499
|
|
|
@@ -581,20 +502,11 @@ Stores lightweight per-project allowlist strings in `.memory-core.json`. Hook an
|
|
|
581
502
|
```bash
|
|
582
503
|
npx @shahmilsaari/memory-core commit-rules "^(feat|fix|chore)" --message "Use conventional commits"
|
|
583
504
|
npx @shahmilsaari/memory-core commit-rules "^WIP" --message "Don't commit WIP" --negate
|
|
584
|
-
npx @shahmilsaari/memory-core commit-rules "PROJ-\d+" --message "Reference a JIRA ticket" --advisory
|
|
585
505
|
npx @shahmilsaari/memory-core commit-rules --list
|
|
586
506
|
npx @shahmilsaari/memory-core commit-rules --remove "^WIP"
|
|
587
507
|
```
|
|
588
508
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
| Flag | What it does |
|
|
592
|
-
|---|---|
|
|
593
|
-
| `--message <msg>` | Required. Error message shown on violation. |
|
|
594
|
-
| `--negate` | Pattern must NOT match (default: must match) |
|
|
595
|
-
| `--advisory` | Warn only — do not block the commit |
|
|
596
|
-
| `--list` | Show all saved commit rules |
|
|
597
|
-
| `--remove <pattern>` | Remove a rule by pattern |
|
|
509
|
+
The `commit-msg` git hook validates every commit message against these rules.
|
|
598
510
|
|
|
599
511
|
---
|
|
600
512
|
|
|
@@ -604,101 +516,43 @@ Stores regex-based rules in `.memory-core.json` under `commitRules`. The `commit
|
|
|
604
516
|
npx @shahmilsaari/memory-core ci-setup
|
|
605
517
|
```
|
|
606
518
|
|
|
607
|
-
Generates `.github/workflows/memory-core.yml`. Adds a PR check
|
|
608
|
-
|
|
609
|
-
---
|
|
610
|
-
|
|
611
|
-
### `stats` — Violation counters
|
|
612
|
-
|
|
613
|
-
```bash
|
|
614
|
-
npx @shahmilsaari/memory-core stats
|
|
615
|
-
npx @shahmilsaari/memory-core stats --tune
|
|
616
|
-
npx @shahmilsaari/memory-core stats --reset
|
|
617
|
-
```
|
|
618
|
-
|
|
619
|
-
Shows which rules fire most often and which files have the most violations. Each rule shows hit count and false-positive rate where available.
|
|
620
|
-
|
|
621
|
-
- `--tune` shows only noisy rules (>40% false-positive rate) with their exact disable commands.
|
|
622
|
-
- `--reset` clears all counters and recent violation history.
|
|
623
|
-
- Live watch-state counters are shown when available.
|
|
519
|
+
Generates `.github/workflows/memory-core.yml`. Adds a PR check using `memories.json` — no project database needed in CI.
|
|
624
520
|
|
|
625
521
|
---
|
|
626
522
|
|
|
627
|
-
### `
|
|
523
|
+
### `status` — See your current setup
|
|
628
524
|
|
|
629
525
|
```bash
|
|
630
|
-
npx @shahmilsaari/memory-core
|
|
631
|
-
npx @shahmilsaari/memory-core tune --threshold 30
|
|
632
|
-
npx @shahmilsaari/memory-core tune --yes
|
|
526
|
+
npx @shahmilsaari/memory-core status
|
|
633
527
|
```
|
|
634
528
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
| Flag | What it does |
|
|
638
|
-
|---|---|
|
|
639
|
-
| `--threshold <n>` | False-positive % cutoff (default `40`) |
|
|
640
|
-
| `--min-count <n>` | Minimum hits required (default `5`) |
|
|
641
|
-
| `--yes` | Silence all qualifying rules without prompting |
|
|
529
|
+
Shows project name, provider/model, agents, hook state, generated files, and health checks for PostgreSQL and Ollama.
|
|
642
530
|
|
|
643
531
|
---
|
|
644
532
|
|
|
645
|
-
### `reset` vs `uninstall` — Cleanup
|
|
646
|
-
|
|
647
|
-
Use `reset` when you want to keep using memory-core but need to regenerate or reinitialize project files. Use `uninstall` when you want memory-core removed from the current project.
|
|
648
|
-
|
|
649
|
-
| Command | User intent | What it removes | Database |
|
|
650
|
-
|---|---|---|---|
|
|
651
|
-
| `reset --soft` | Regenerate agent files from a clean slate | Generated agent files only | Kept |
|
|
652
|
-
| `reset` | Reinitialize memory-core in this project | Generated agent files, `.memory-core.json`, hook | Kept |
|
|
653
|
-
| `reset --db` | Reinitialize and clear stored memories | Same as `reset` | Drops `memories` after confirmation |
|
|
654
|
-
| `uninstall` | Remove memory-core from this project | Generated files, config/env/state, CI workflow, hook, `.gitignore` block | Kept |
|
|
655
|
-
| `uninstall --db` | Remove project footprint and stored memory table | Same as `uninstall` | Drops `memories` after confirmation |
|
|
656
|
-
|
|
657
|
-
### `reset` — Reinitialize generated files
|
|
658
|
-
|
|
659
|
-
```bash
|
|
660
|
-
npx @shahmilsaari/memory-core reset # remove generated files + .memory-core.json + hook
|
|
661
|
-
npx @shahmilsaari/memory-core reset --soft # keep config and DB, remove only generated files
|
|
662
|
-
npx @shahmilsaari/memory-core reset --db # also drop the memories table from the database
|
|
663
|
-
```
|
|
664
|
-
|
|
665
|
-
Use this when memory-core should stay part of the project, but generated files need to be rebuilt or the project config should be recreated. Use `--soft` for the safest regeneration path.
|
|
533
|
+
### `reset` vs `uninstall` — Cleanup
|
|
666
534
|
|
|
667
|
-
|
|
535
|
+
| Command | What it does | Database |
|
|
536
|
+
|---|---|---|
|
|
537
|
+
| `reset --soft` | Remove generated agent files only | Kept |
|
|
538
|
+
| `reset` | Remove generated files + config + hook | Kept |
|
|
539
|
+
| `reset --db` | Same as reset + drop memories table | Dropped (with confirmation) |
|
|
540
|
+
| `uninstall` | Remove everything: files, config, hook, gitignore block | Kept |
|
|
541
|
+
| `uninstall --db` | Same as uninstall + drop memories table | Dropped (with confirmation) |
|
|
668
542
|
|
|
669
543
|
```bash
|
|
670
|
-
npx @shahmilsaari/memory-core
|
|
671
|
-
npx @shahmilsaari/memory-core
|
|
544
|
+
npx @shahmilsaari/memory-core reset
|
|
545
|
+
npx @shahmilsaari/memory-core reset --soft
|
|
546
|
+
npx @shahmilsaari/memory-core uninstall
|
|
672
547
|
```
|
|
673
548
|
|
|
674
|
-
Use this when you want the project back to a pre-memory-core state. Database deletion is opt-in and only happens with `--db`.
|
|
675
|
-
|
|
676
549
|
---
|
|
677
550
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
```bash
|
|
681
|
-
npx @shahmilsaari/memory-core global
|
|
682
|
-
```
|
|
551
|
+
## Supported AI agents
|
|
683
552
|
|
|
684
|
-
|
|
553
|
+
memory-core generates instruction files for:
|
|
685
554
|
|
|
686
|
-
| Agent |
|
|
687
|
-
|---|---|
|
|
688
|
-
| Claude Code | `~/.claude/CLAUDE.md` |
|
|
689
|
-
| GitHub Copilot | VS Code `settings.json` |
|
|
690
|
-
| Cursor | `~/.cursor/rules/memory-core.mdc` |
|
|
691
|
-
| Cline | VS Code `settings.json` |
|
|
692
|
-
| Continue.dev | `~/.continue/config.json` |
|
|
693
|
-
| Aider | `~/.aider.conf.yml` |
|
|
694
|
-
| Zed AI | `~/.config/zed/settings.json` |
|
|
695
|
-
| Windsurf | `~/.windsurf/rules/memory-core.md` |
|
|
696
|
-
|
|
697
|
-
---
|
|
698
|
-
|
|
699
|
-
## Supported agents
|
|
700
|
-
|
|
701
|
-
| Agent | File generated |
|
|
555
|
+
| Agent | File |
|
|
702
556
|
|---|---|
|
|
703
557
|
| Claude Code | `CLAUDE.md` |
|
|
704
558
|
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
@@ -721,16 +575,16 @@ Plus shared files: `AI_RULES.md`, `ARCHITECTURE.md`, `PROJECT_MEMORY.md`
|
|
|
721
575
|
|
|
722
576
|
## Architecture profiles
|
|
723
577
|
|
|
724
|
-
Pick the one that matches
|
|
578
|
+
Pick the one that matches your project structure:
|
|
725
579
|
|
|
726
580
|
**Backend**
|
|
727
581
|
| Profile | Use when… |
|
|
728
582
|
|---|---|
|
|
729
|
-
| Clean Architecture |
|
|
730
|
-
| Modular Monolith |
|
|
731
|
-
| MVC | Standard
|
|
732
|
-
| Hexagonal |
|
|
733
|
-
| Go REST API | Go backend
|
|
583
|
+
| Clean Architecture | Strict separation between domain, application, and infrastructure |
|
|
584
|
+
| Modular Monolith | Feature modules that might become microservices later |
|
|
585
|
+
| MVC | Standard controllers + services |
|
|
586
|
+
| Hexagonal | Ports and adapters for maximum testability |
|
|
587
|
+
| Go REST API | Go backend with idiomatic error handling |
|
|
734
588
|
| Laravel | Laravel with service-repository pattern |
|
|
735
589
|
| NestJS | Modules, guards, pipes, DTOs, repository pattern |
|
|
736
590
|
|
|
@@ -740,144 +594,85 @@ Pick the one that matches how your project is structured.
|
|
|
740
594
|
| React | Functional components, hooks, React Query, Zustand |
|
|
741
595
|
| Vue 3 | Composition API, Pinia, composables |
|
|
742
596
|
| Angular | Standalone components, signals, OnPush strategy |
|
|
743
|
-
| Svelte | Svelte 5 runes, SvelteKit load functions
|
|
597
|
+
| Svelte | Svelte 5 runes, SvelteKit load functions |
|
|
744
598
|
| Nuxt 3 | Fullstack Vue with SSR |
|
|
745
599
|
| React Native | Mobile apps |
|
|
746
600
|
|
|
747
|
-
Fullstack projects get both sections in every generated file.
|
|
748
|
-
|
|
749
601
|
---
|
|
750
602
|
|
|
751
|
-
##
|
|
752
|
-
|
|
753
|
-
Cuts AI response length by 65–75% by removing filler words. Opt in during `init`.
|
|
603
|
+
## AI providers
|
|
754
604
|
|
|
755
|
-
|
|
|
756
|
-
|
|
757
|
-
|
|
|
758
|
-
| `
|
|
759
|
-
| `
|
|
760
|
-
|
|
761
|
-
---
|
|
762
|
-
|
|
763
|
-
## Day-to-day workflow
|
|
605
|
+
| Provider | Setup | Use when |
|
|
606
|
+
|---|---|---|
|
|
607
|
+
| Ollama (default) | Local, no API key | You want free, private, offline AI |
|
|
608
|
+
| OpenAI | `CHAT_API_KEY=sk-...` | You want GPT-4o / GPT-4o-mini quality |
|
|
609
|
+
| Anthropic | `CHAT_API_KEY=sk-ant-...` | You want Claude quality |
|
|
610
|
+
| MiniMax | `CHAT_API_KEY=...` | Cost-effective cloud option |
|
|
764
611
|
|
|
612
|
+
Switch without rerunning init:
|
|
765
613
|
```bash
|
|
766
|
-
|
|
767
|
-
cd my-api
|
|
768
|
-
npx @shahmilsaari/memory-core init # verifies connections, picks model, selects agents, installs hook
|
|
769
|
-
npx @shahmilsaari/memory-core seed # load 281 best-practice rules
|
|
770
|
-
|
|
771
|
-
# Made an architectural decision? Save it.
|
|
772
|
-
npx @shahmilsaari/memory-core remember "All auth goes through middleware, never in controllers" \
|
|
773
|
-
--type decision --scope global
|
|
774
|
-
|
|
775
|
-
# Optional: refresh agent files manually anytime
|
|
776
|
-
npx @shahmilsaari/memory-core sync
|
|
777
|
-
|
|
778
|
-
# Not sure how something was decided? Search.
|
|
779
|
-
npx @shahmilsaari/memory-core search "caching strategy"
|
|
780
|
-
|
|
781
|
-
# Inspect current setup, provider, model, and health checks
|
|
782
|
-
npx @shahmilsaari/memory-core status
|
|
783
|
-
|
|
784
|
-
# Open the local command center with live watch/config updates
|
|
785
|
-
npx @shahmilsaari/memory-core dashboard
|
|
786
|
-
|
|
787
|
-
# Switch code-checking provider or model without rerunning init
|
|
788
|
-
npx @shahmilsaari/memory-core provider set openai --model gpt-4o-mini --api-key $OPENAI_API_KEY
|
|
614
|
+
npx @shahmilsaari/memory-core provider set openai --model gpt-4o --api-key sk-...
|
|
789
615
|
npx @shahmilsaari/memory-core model set qwen2.5-coder --provider ollama
|
|
790
|
-
|
|
791
|
-
# See what rules are saved
|
|
792
|
-
npx @shahmilsaari/memory-core list --type rule
|
|
793
|
-
|
|
794
|
-
# Export rules to version control
|
|
795
|
-
npx @shahmilsaari/memory-core export
|
|
796
|
-
|
|
797
|
-
# Commit code → hook checks it automatically before committing
|
|
798
|
-
git commit -m "add user endpoint"
|
|
799
616
|
```
|
|
800
617
|
|
|
618
|
+
Or switch from the dashboard UI — takes effect immediately, no restart needed.
|
|
619
|
+
|
|
801
620
|
---
|
|
802
621
|
|
|
803
622
|
## Environment variables
|
|
804
623
|
|
|
805
|
-
memory-core creates `.memory-core.env` automatically during `init`.
|
|
624
|
+
memory-core creates `.memory-core.env` automatically during `init`.
|
|
806
625
|
|
|
807
|
-
| Variable |
|
|
808
|
-
|
|
809
|
-
| `DATABASE_URL` |
|
|
810
|
-
| `OLLAMA_URL` |
|
|
811
|
-
| `OLLAMA_MODEL` |
|
|
812
|
-
| `CHAT_PROVIDER` |
|
|
813
|
-
| `CHAT_MODEL` |
|
|
814
|
-
| `CHAT_API_KEY` |
|
|
815
|
-
| `OLLAMA_CHAT_MODEL` | No | `llama3.2` | Legacy alias for `CHAT_MODEL` when provider is `ollama` |
|
|
626
|
+
| Variable | Default | What it does |
|
|
627
|
+
|---|---|---|
|
|
628
|
+
| `DATABASE_URL` | — | PostgreSQL connection string (required) |
|
|
629
|
+
| `OLLAMA_URL` | `http://localhost:11434` | Ollama server URL (used for embeddings) |
|
|
630
|
+
| `OLLAMA_MODEL` | `nomic-embed-text` | Embedding model (always Ollama) |
|
|
631
|
+
| `CHAT_PROVIDER` | `ollama` | Code-checking provider: `ollama`, `openai`, `anthropic`, `minimax` |
|
|
632
|
+
| `CHAT_MODEL` | `llama3.2` | Code-checking model |
|
|
633
|
+
| `CHAT_API_KEY` | — | API key for cloud providers |
|
|
816
634
|
|
|
817
635
|
---
|
|
818
636
|
|
|
819
637
|
## Troubleshooting
|
|
820
638
|
|
|
821
639
|
**`extension "vector" is not available`**
|
|
822
|
-
pgvector isn't installed for your PostgreSQL version. Follow the [pgvector
|
|
640
|
+
pgvector isn't installed for your PostgreSQL version. Follow the [pgvector steps](#pgvector) above.
|
|
823
641
|
|
|
824
642
|
**`Ollama not running — skipping rule check`**
|
|
825
643
|
Start Ollama: `brew services start ollama` (macOS) or `ollama serve` (Linux).
|
|
826
644
|
|
|
827
645
|
**`Chat model "llama3.2" not found`**
|
|
828
|
-
Run `ollama pull llama3.2
|
|
829
|
-
|
|
830
|
-
**Using an API key instead of Ollama for code checking**
|
|
831
|
-
During `init` choose OpenAI, Anthropic, or MiniMax when prompted for the check provider. Or switch later:
|
|
832
|
-
```bash
|
|
833
|
-
npx @shahmilsaari/memory-core provider set openai --model gpt-4o --api-key sk-...
|
|
834
|
-
```
|
|
835
|
-
|
|
836
|
-
Equivalent manual `.memory-core.env` settings:
|
|
837
|
-
```
|
|
838
|
-
CHAT_PROVIDER=openai
|
|
839
|
-
CHAT_MODEL=gpt-4o
|
|
840
|
-
CHAT_API_KEY=sk-...
|
|
841
|
-
```
|
|
842
|
-
Embeddings always use Ollama (`nomic-embed-text`) regardless of provider.
|
|
646
|
+
Run `ollama pull llama3.2`, or switch provider: `npx @shahmilsaari/memory-core provider set openai --model gpt-4o-mini --api-key sk-...`
|
|
843
647
|
|
|
844
648
|
**`DATABASE_URL is not set`**
|
|
845
|
-
Run `npx @shahmilsaari/memory-core init` — it
|
|
649
|
+
Run `npx @shahmilsaari/memory-core init` — it creates `.memory-core.env` for you.
|
|
846
650
|
|
|
847
|
-
**Not sure what memory-core is
|
|
848
|
-
Run `npx @shahmilsaari/memory-core status`.
|
|
849
|
-
|
|
850
|
-
**Need to verify the model/database setup**
|
|
851
|
-
Run `npx @shahmilsaari/memory-core model doctor`.
|
|
651
|
+
**Not sure what memory-core is using**
|
|
652
|
+
Run `npx @shahmilsaari/memory-core status` or `npx @shahmilsaari/memory-core model doctor`.
|
|
852
653
|
|
|
853
654
|
**`createdb: role does not exist`**
|
|
854
655
|
```bash
|
|
855
656
|
createuser -s $(whoami)
|
|
856
657
|
```
|
|
857
658
|
|
|
858
|
-
**Hook is flagging
|
|
859
|
-
|
|
659
|
+
**Hook is flagging something intentional**
|
|
660
|
+
Save an ignore pattern: `npx @shahmilsaari/memory-core ignore "your exception here"`
|
|
860
661
|
|
|
861
|
-
**
|
|
862
|
-
|
|
662
|
+
**I bypassed the hook by accident and now it keeps asking**
|
|
663
|
+
That's bypass tracking. Run `MEMORY_CORE_SKIP_HOOK=1 git commit` with a reason the next time, or run `npx @shahmilsaari/memory-core stats` to see your bypass history.
|
|
863
664
|
|
|
864
665
|
---
|
|
865
666
|
|
|
866
|
-
##
|
|
867
|
-
|
|
868
|
-
Before publishing, run the same checks as CI:
|
|
667
|
+
## Caveman mode (optional)
|
|
869
668
|
|
|
870
|
-
|
|
871
|
-
npm run lint
|
|
872
|
-
npm run typecheck
|
|
873
|
-
npm test
|
|
874
|
-
npm run build
|
|
875
|
-
npm run smoke:pack
|
|
876
|
-
npm run smoke:npx
|
|
877
|
-
```
|
|
669
|
+
Cuts AI response length by 65–75% by removing filler words. Opt in during `init`.
|
|
878
670
|
|
|
879
|
-
|
|
880
|
-
|
|
671
|
+
| Level | What it does |
|
|
672
|
+
|---|---|
|
|
673
|
+
| `lite` | Professional and concise |
|
|
674
|
+
| `full` | Caveman-style short answers |
|
|
675
|
+
| `ultra` | Absolute minimum words |
|
|
881
676
|
|
|
882
677
|
---
|
|
883
678
|
|
|
@@ -886,33 +681,29 @@ npm run smoke:npx
|
|
|
886
681
|
| | Feature |
|
|
887
682
|
|---|---|
|
|
888
683
|
| ✓ | Watch mode — real-time violation alerts on save |
|
|
889
|
-
| ✓ |
|
|
890
|
-
| ✓ |
|
|
891
|
-
| ✓ |
|
|
892
|
-
| ✓ |
|
|
893
|
-
| ✓ |
|
|
894
|
-
| ✓ |
|
|
895
|
-
| ✓ |
|
|
896
|
-
| ✓ |
|
|
897
|
-
| ✓ | Export / import — portable memories.json for version control and team sharing |
|
|
898
|
-
| ✓ | List / remove / edit — full CRUD for stored memories |
|
|
899
|
-
| ✓ | False positive tagging — `ignore` and `allow` save exceptions for hook and watcher |
|
|
900
|
-
| ✓ | Cleanup commands — `reset` regenerates/reinitializes files; `uninstall` removes memory-core |
|
|
901
|
-
| ✓ | Test suite — 94 tests using Node.js built-in `node:test` |
|
|
684
|
+
| ✓ | AI auto-fix — violations detected → AI rewrites the file |
|
|
685
|
+
| ✓ | Dry-run mode — full check pipeline, exits 0 |
|
|
686
|
+
| ✓ | Schema alignment rules — TypeScript↔Go struct field drift detection |
|
|
687
|
+
| ✓ | Bypass tracking — every hook bypass is counted and visible |
|
|
688
|
+
| ✓ | Token usage tracking — AI call counts across all providers |
|
|
689
|
+
| ✓ | Dashboard model switcher — change provider/model from the UI |
|
|
690
|
+
| ✓ | Dashboard actions panel — Sync, Check All, Tune from UI |
|
|
691
|
+
| ✓ | WebSocket-only stats — live push, no polling |
|
|
902
692
|
| ✓ | Multi-provider code checking — Ollama, OpenAI, Anthropic, MiniMax |
|
|
903
|
-
| ✓ |
|
|
904
|
-
| ✓ |
|
|
905
|
-
| ✓ |
|
|
906
|
-
| ✓ |
|
|
907
|
-
| ✓ |
|
|
908
|
-
| ✓ |
|
|
909
|
-
| ✓ |
|
|
910
|
-
| ✓ |
|
|
911
|
-
| ✓ |
|
|
912
|
-
| ✓ |
|
|
913
|
-
| |
|
|
914
|
-
| |
|
|
915
|
-
| | Team sync — shared database
|
|
693
|
+
| ✓ | Pre-commit hook (advisory + strict modes) |
|
|
694
|
+
| ✓ | Commit message linting — `commit-rules` + `commit-msg` hook |
|
|
695
|
+
| ✓ | CI/CD — GitHub Actions workflow generation |
|
|
696
|
+
| ✓ | 14 agent file generators + 3 shared files |
|
|
697
|
+
| ✓ | 281 seeded best-practice rules across 13 architecture profiles |
|
|
698
|
+
| ✓ | AI-powered rule search |
|
|
699
|
+
| ✓ | Export / import — portable `memories.json` |
|
|
700
|
+
| ✓ | Auto-tuning — silence noisy rules interactively |
|
|
701
|
+
| ✓ | False-positive tracking per rule |
|
|
702
|
+
| ✓ | Import graph analysis — structural boundary checking |
|
|
703
|
+
| ✓ | Local Svelte dashboard with WebSocket live feed |
|
|
704
|
+
| | Model guidance during init — recommend model based on machine specs |
|
|
705
|
+
| | Team sync — shared database for the whole team |
|
|
706
|
+
| | Violation → rule pipeline — auto-suggest rules when violations repeat |
|
|
916
707
|
|
|
917
708
|
---
|
|
918
709
|
|