@shahmilsaari/memory-core 1.0.22 → 1.0.26
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 +75 -868
- package/dist/approval-queue-YBYRGBHP.js +7 -0
- package/dist/ast-analyzer-JM4CIOFY.js +44 -0
- package/dist/check-cache-6NWRTZJD.js +52 -0
- package/dist/check-logger-5HYSWA3S.js +21 -0
- package/dist/{chunk-UZDALJVQ.js → chunk-3XTHE74V.js} +2488 -1461
- package/dist/chunk-M7NKSXFS.js +301 -0
- package/dist/chunk-PQBWHAZN.js +156 -0
- package/dist/chunk-W6WEAV3S.js +69 -0
- package/dist/chunk-ZZBQEXEO.js +183 -0
- package/dist/classifier-MZ65R7FK.js +60 -0
- package/dist/cli.js +868 -1585
- package/dist/confidence-gate-ZQDAOS6P.js +64 -0
- package/dist/dashboard/assets/index-CE3AMEOD.js +2 -0
- package/dist/dashboard/assets/{index-DXXHB1Ik.css → index-CNc2vvZF.css} +1 -1
- package/dist/dashboard/index.html +2 -2
- package/dist/{dashboard-server-VOT2ZRVN.js → dashboard-server-EEFNE6NX.js} +161 -14
- package/dist/db-PRDHI2CN.js +29 -0
- package/dist/deepseek-critique-MALVIYGF.js +82 -0
- package/dist/deterministic-validator-PP56B46I.js +18 -0
- package/dist/evidence-HVMSONTT.js +65 -0
- package/dist/graph-TFNTB5OK.js +98 -0
- package/dist/incident-capture-RVPZULS7.js +20 -0
- package/dist/ollama-judge-D2LFK5PB.js +137 -0
- package/dist/rate-limiter-SLIPCXRF.js +41 -0
- package/dist/rules-V3QMN3AR.js +95 -0
- package/dist/watch-errors-B3FA26N4.js +99 -0
- package/package.json +1 -1
- package/dist/dashboard/assets/index-BRqvIBnm.js +0 -2
package/README.md
CHANGED
|
@@ -1,923 +1,130 @@
|
|
|
1
1
|
# memory-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Universal AI memory for developers. Store architecture rules once — every AI coding agent reads them before writing code.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Website: https://memory-core.shahmilsaari.my/
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npx @shahmilsaari/memory-core init
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Fully local or cloud — your choice. **v0.2.16**
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## What does it actually do?
|
|
18
|
-
|
|
19
|
-
Without memory-core, every AI agent starts fresh. It doesn't know you're using Clean Architecture. It doesn't know controllers shouldn't call the database. It doesn't know why you made that decision six months ago.
|
|
20
|
-
|
|
21
|
-
With memory-core:
|
|
22
|
-
|
|
23
|
-
1. You run `init` once — it verifies your PostgreSQL and Ollama connections, picks your model, lets you choose which agents to generate files for, and installs a pre-commit hook
|
|
24
|
-
2. Those agents read the files and follow your rules — automatically
|
|
25
|
-
3. Watch mode catches violations as you type, not just at commit time
|
|
26
|
-
4. When you commit, the hook checks your code before the commit goes through (advisory by default — logs violations but never blocks)
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Before you start
|
|
31
|
-
|
|
32
|
-
You need three things installed:
|
|
33
|
-
|
|
34
|
-
| What | Why | Install |
|
|
35
|
-
|---|---|---|
|
|
36
|
-
| PostgreSQL 14+ | Stores your rules and decisions | See below |
|
|
37
|
-
| pgvector | Makes search smart (finds similar rules, not just exact matches) | See below |
|
|
38
|
-
| Ollama | Runs AI locally — no API key needed | See below |
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Install
|
|
43
|
-
|
|
44
|
-
### PostgreSQL
|
|
45
|
-
|
|
46
|
-
**macOS**
|
|
47
|
-
```bash
|
|
48
|
-
brew install postgresql@16
|
|
49
|
-
brew services start postgresql@16
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**Linux**
|
|
53
|
-
```bash
|
|
54
|
-
sudo apt install postgresql postgresql-contrib
|
|
55
|
-
sudo systemctl start postgresql
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**Windows** — [download from postgresql.org](https://www.postgresql.org/download/windows/)
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
### pgvector
|
|
63
|
-
|
|
64
|
-
pgvector adds AI-powered search to PostgreSQL.
|
|
65
|
-
|
|
66
|
-
**macOS + PostgreSQL 17+** (easiest)
|
|
67
|
-
```bash
|
|
68
|
-
brew install pgvector
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**macOS + PostgreSQL 16** (brew's pgvector targets 17+, so build from source)
|
|
72
|
-
```bash
|
|
73
|
-
xcode-select --install
|
|
74
|
-
git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git /tmp/pgvector
|
|
75
|
-
cd /tmp/pgvector
|
|
76
|
-
make PG_CONFIG=/opt/homebrew/opt/postgresql@16/bin/pg_config
|
|
77
|
-
make install PG_CONFIG=/opt/homebrew/opt/postgresql@16/bin/pg_config
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**Linux**
|
|
81
|
-
```bash
|
|
82
|
-
sudo apt install postgresql-16-pgvector # replace 16 with your version
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Check it worked:
|
|
86
|
-
```bash
|
|
87
|
-
psql -U $(whoami) -c "SELECT * FROM pg_available_extensions WHERE name = 'vector';"
|
|
88
|
-
```
|
|
5
|
+
[](https://www.npmjs.com/package/@shahmilsaari/memory-core)
|
|
6
|
+
[](LICENSE)
|
|
89
7
|
|
|
90
8
|
---
|
|
91
9
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Ollama runs AI models on your machine. Two models are needed — one for search, one for code checking.
|
|
95
|
-
|
|
96
|
-
**macOS**
|
|
97
|
-
```bash
|
|
98
|
-
brew install ollama
|
|
99
|
-
brew services start ollama
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
**Linux**
|
|
103
|
-
```bash
|
|
104
|
-
curl -fsSL https://ollama.com/install.sh | sh
|
|
105
|
-
ollama serve &
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
**Windows** — [download from ollama.com](https://ollama.com/download)
|
|
109
|
-
|
|
110
|
-
Pull the embedding model. The code-checking model is chosen during `init`:
|
|
111
|
-
```bash
|
|
112
|
-
ollama pull nomic-embed-text # required for search
|
|
113
|
-
ollama pull llama3.2 # or whichever model you plan to use
|
|
114
|
-
```
|
|
10
|
+
## What it does
|
|
115
11
|
|
|
116
|
-
|
|
12
|
+
AI tools like Copilot, Cursor, and Claude Code start fresh every session. memory-core fixes that:
|
|
117
13
|
|
|
118
|
-
|
|
14
|
+
1. **Remember** — store architecture decisions and rules in PostgreSQL with reasons
|
|
15
|
+
2. **Distribute** — generate instruction files for 14 AI agents from your stored rules
|
|
16
|
+
3. **Enforce** — two-tier pipeline catches violations: deterministic layer graph (instant, confidence 1.0) then AI semantic review
|
|
119
17
|
|
|
120
18
|
```bash
|
|
121
|
-
|
|
122
|
-
psql -U $(whoami) -d memory_core -f setup.sql
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
`setup.sql`:
|
|
126
|
-
```sql
|
|
127
|
-
CREATE EXTENSION IF NOT EXISTS vector;
|
|
128
|
-
|
|
129
|
-
CREATE TABLE IF NOT EXISTS memories (
|
|
130
|
-
id BIGSERIAL PRIMARY KEY,
|
|
131
|
-
type TEXT NOT NULL,
|
|
132
|
-
scope TEXT NOT NULL DEFAULT 'project',
|
|
133
|
-
architecture TEXT,
|
|
134
|
-
project_name TEXT,
|
|
135
|
-
title TEXT,
|
|
136
|
-
content TEXT NOT NULL,
|
|
137
|
-
reason TEXT,
|
|
138
|
-
context JSONB NOT NULL DEFAULT '{}',
|
|
139
|
-
tags TEXT[] DEFAULT '{}',
|
|
140
|
-
embedding vector(768),
|
|
141
|
-
created_at TIMESTAMP DEFAULT now()
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
CREATE INDEX IF NOT EXISTS memories_embedding_idx
|
|
145
|
-
ON memories USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
|
|
146
|
-
CREATE INDEX IF NOT EXISTS memories_architecture_idx ON memories (architecture);
|
|
147
|
-
CREATE INDEX IF NOT EXISTS memories_scope_idx ON memories (scope);
|
|
148
|
-
|
|
149
|
-
CREATE TABLE IF NOT EXISTS graph_snapshots (
|
|
150
|
-
id TEXT PRIMARY KEY,
|
|
151
|
-
root_path TEXT NOT NULL,
|
|
152
|
-
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
153
|
-
nodes JSONB NOT NULL DEFAULT '[]'::jsonb,
|
|
154
|
-
edges JSONB NOT NULL DEFAULT '[]'::jsonb
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
CREATE INDEX IF NOT EXISTS graph_snapshots_root_path_idx ON graph_snapshots (root_path);
|
|
158
|
-
CREATE INDEX IF NOT EXISTS graph_snapshots_created_at_idx ON graph_snapshots (created_at DESC);
|
|
19
|
+
npx @shahmilsaari/memory-core init
|
|
159
20
|
```
|
|
160
21
|
|
|
161
|
-
---
|
|
162
|
-
|
|
163
22
|
## Quick start
|
|
164
23
|
|
|
165
24
|
```bash
|
|
166
|
-
# 1.
|
|
167
|
-
cd my-api
|
|
168
|
-
|
|
169
|
-
# 2. Initialize — verifies connections, picks your model, generates config files
|
|
25
|
+
# 1. Initialize in your project
|
|
170
26
|
npx @shahmilsaari/memory-core init
|
|
171
27
|
|
|
172
|
-
#
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
That's it. Every AI agent in your project now has your rules.
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
## Commands
|
|
181
|
-
|
|
182
|
-
For the full CLI reference, examples, and command behavior notes, see [COMMANDS.md](./COMMANDS.md).
|
|
183
|
-
|
|
184
|
-
New setup-management commands:
|
|
185
|
-
- `memory-core status` — show project name, provider/model, agents, hook state, generated files, and health checks
|
|
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
|
|
195
|
-
|
|
196
|
-
## User Documentation
|
|
197
|
-
|
|
198
|
-
The public docs focus on how to install, use, configure, reset, and uninstall memory-core:
|
|
199
|
-
|
|
200
|
-
- Website: https://memory-core.shahmilsaari.my/
|
|
201
|
-
- Docs: https://memory-core.shahmilsaari.my/docs/
|
|
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`
|
|
208
|
-
|
|
209
|
-
The static homepage remains `index.html` at `/`. Public docs are plain static HTML generated from the markdown files in `website/docs/` and served under `/docs/`.
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
npm run site:start # build and preview the full site at / and /docs/
|
|
213
|
-
npm run site:build # assemble static output in site-build/
|
|
214
|
-
npm run site:serve # serve an existing site-build/ locally
|
|
215
|
-
npm run docs:build # build only the static docs app
|
|
216
|
-
npm run docs:serve # preview the existing site-build/ output
|
|
217
|
-
```
|
|
28
|
+
# 2. Load best-practice rules for your architecture
|
|
29
|
+
memory-core seed --arch clean-architecture
|
|
218
30
|
|
|
219
|
-
|
|
31
|
+
# 3. Store a project decision
|
|
32
|
+
memory-core remember "No direct DB calls from controllers"
|
|
220
33
|
|
|
221
|
-
|
|
222
|
-
|
|
34
|
+
# 4. Enforce on every diff
|
|
35
|
+
memory-core check --diff HEAD~1
|
|
223
36
|
```
|
|
224
37
|
|
|
225
|
-
|
|
226
|
-
- PostgreSQL connection URL — **tested live, retries until connected**
|
|
227
|
-
- Ollama URL — **tested live, retries until reachable** (used for embeddings)
|
|
228
|
-
- Code-checking provider — **Ollama (local), OpenAI, Anthropic, or MiniMax**
|
|
229
|
-
- Code-checking model — picked from a list, verified before continuing
|
|
230
|
-
- Project name, type, architecture, language
|
|
231
|
-
- Which agents to generate files for — **multi-select, all pre-checked, Space to deselect** — saved to `.memory-core.json`
|
|
232
|
-
- Hook mode — **advisory** (logs violations, never blocks) or **strict** (blocks commits)
|
|
233
|
-
- Whether to enable caveman mode (optional token saver)
|
|
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.
|
|
236
|
-
|
|
237
|
-
At the end, the banner shows live ✓/✗ status for PostgreSQL and Ollama so you know everything is working.
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
### `sync` — Refresh all agent files
|
|
242
|
-
|
|
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
|
-
```bash
|
|
246
|
-
npx @shahmilsaari/memory-core sync
|
|
247
|
-
```
|
|
38
|
+
## Architecture enforcement
|
|
248
39
|
|
|
249
|
-
|
|
40
|
+
The `check --diff` command runs a two-tier enforcement pipeline:
|
|
250
41
|
|
|
251
42
|
```
|
|
252
|
-
|
|
43
|
+
git diff → FileClassifier → ASTAnalyzer → GraphBuilder
|
|
44
|
+
→ RuleMatcher → EvidencePacketBuilder
|
|
45
|
+
→ graphEngine (full codebase graph)
|
|
46
|
+
→ DeterministicValidator (confidence 1.0)
|
|
47
|
+
→ AI judge (OllamaJudge / DeepSeek / OpenAI-compatible)
|
|
48
|
+
→ ConfidenceGate → allow | warn | block
|
|
253
49
|
```
|
|
254
50
|
|
|
255
|
-
|
|
51
|
+
Configure your layers in `.archmind/layers.json` and rules in `.archmind/rules.json`. The dashboard shows a live layer graph SVG updated in real time as rules change.
|
|
256
52
|
|
|
257
|
-
|
|
53
|
+
Built-in production hardening: rate limiter prevents concurrent AI calls, content-addressed cache skips redundant checks, auto graph build has a 15s timeout so hooks never hang, and all check results are logged as structured JSON to `.archmind/check.log`.
|
|
258
54
|
|
|
259
|
-
|
|
260
|
-
npx @shahmilsaari/memory-core auto-sync # show current setting
|
|
261
|
-
npx @shahmilsaari/memory-core auto-sync off # save only, sync manually later
|
|
262
|
-
npx @shahmilsaari/memory-core auto-sync on # restore default behavior
|
|
263
|
-
```
|
|
264
|
-
|
|
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
|
-
---
|
|
268
|
-
|
|
269
|
-
### `remember` — Save a decision
|
|
270
|
-
|
|
271
|
-
Made a decision your team should never forget? Save it.
|
|
272
|
-
|
|
273
|
-
```bash
|
|
274
|
-
npx @shahmilsaari/memory-core remember "Controllers must never call the database directly"
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
It will ask you *why* — that reason gets stored alongside the rule and shown to AI agents and developers when a violation is caught.
|
|
55
|
+
## Installation requirements
|
|
278
56
|
|
|
279
|
-
|
|
280
|
-
```bash
|
|
281
|
-
npx @shahmilsaari/memory-core remember "Use DTOs for all API responses" \
|
|
282
|
-
--type rule \
|
|
283
|
-
--scope global \
|
|
284
|
-
--reason "Raw DB entities expose internal schema and sensitive fields" \
|
|
285
|
-
--applies-to "controllers,API responses" \
|
|
286
|
-
--avoid-when "internal domain transformations" \
|
|
287
|
-
--example "return UserResponseDto instead of UserEntity" \
|
|
288
|
-
--tags "api,dto"
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
| Flag | Options | Default |
|
|
57
|
+
| Dependency | Purpose | Install |
|
|
292
58
|
|---|---|---|
|
|
293
|
-
|
|
|
294
|
-
|
|
|
295
|
-
|
|
|
296
|
-
|
|
|
297
|
-
| `--avoid-when` | comma-separated exceptions | none |
|
|
298
|
-
| `--example` | comma-separated examples | none |
|
|
299
|
-
| `--source` | source note, ticket, or review | none |
|
|
300
|
-
| `--tags` | comma-separated | none |
|
|
301
|
-
|
|
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.
|
|
59
|
+
| Node.js 18+ | Runtime | — |
|
|
60
|
+
| PostgreSQL 14+ | Rules storage | `brew install postgresql@16` |
|
|
61
|
+
| pgvector | Semantic search | `brew install pgvector` |
|
|
62
|
+
| Ollama | Local embeddings | `ollama pull nomic-embed-text` |
|
|
314
63
|
|
|
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
|
-
---
|
|
328
|
-
|
|
329
|
-
### `watch` — Catch violations as you type
|
|
330
|
-
|
|
331
|
-
```bash
|
|
332
|
-
npx @shahmilsaari/memory-core watch
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
Runs in the background and checks each file the moment you save it. You see violations immediately — before you even think about committing.
|
|
336
|
-
|
|
337
|
-
```
|
|
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
|
-
[10:42:11] saved: src/controllers/user.ts
|
|
64
|
+
Cloud providers (OpenAI, Anthropic, DeepSeek, any OpenAI-compatible endpoint) can be used for code analysis — embeddings always stay local.
|
|
346
65
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
[1] src/controllers/user.ts:34
|
|
350
|
-
Rule: Thin controllers — business logic belongs in services
|
|
351
|
-
Why: Logic in controllers cannot be reused from other entry points
|
|
352
|
-
Issue: Password hashing inside the route handler
|
|
353
|
-
Fix: Move to UserService.hashPassword()
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
Options:
|
|
357
|
-
```bash
|
|
358
|
-
npx @shahmilsaari/memory-core watch --path src/ # watch a specific folder only
|
|
359
|
-
npx @shahmilsaari/memory-core watch --scan-on-start # snapshot-scan tracked files once, then keep watching
|
|
360
|
-
npx @shahmilsaari/memory-core watch --verbose # show extra details
|
|
361
|
-
npx @shahmilsaari/memory-core watch --debug # show prompt, diff, and raw model output
|
|
362
|
-
```
|
|
66
|
+
## Supported AI agents
|
|
363
67
|
|
|
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.
|
|
68
|
+
Claude Code · GitHub Copilot · Cursor · Windsurf · Cline · Roo Code · Aider · Continue.dev · Devin · Amazon Q · Gemini Code Assist · Zed AI · JetBrains AI · OpenHands
|
|
366
69
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
### `dashboard` — Local command center
|
|
370
|
-
|
|
371
|
-
```bash
|
|
372
|
-
npx @shahmilsaari/memory-core dashboard
|
|
373
|
-
npx @shahmilsaari/memory-core dashboard --port 5178
|
|
374
|
-
npx @shahmilsaari/memory-core dashboard --path /absolute/path/to/project
|
|
375
|
-
npx @shahmilsaari/memory-core dashboard --no-watch
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
Starts a local Svelte dashboard at `http://localhost:5178` by default. The dashboard includes:
|
|
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`
|
|
387
|
-
|
|
388
|
-
The WebSocket endpoint is local: `ws://localhost:5178/ws`. Runtime config changes are reloaded and pushed to the browser without restarting the dashboard after the dashboard process is running.
|
|
389
|
-
When `--path` is provided, it must point to the project root (the directory containing `.memory-core.json`).
|
|
390
|
-
|
|
391
|
-
---
|
|
392
|
-
|
|
393
|
-
### `check` — Manual check (for CI)
|
|
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.
|
|
408
|
-
|
|
409
|
-
---
|
|
410
|
-
|
|
411
|
-
### `hook install` — Install hooks
|
|
412
|
-
|
|
413
|
-
```bash
|
|
414
|
-
npx @shahmilsaari/memory-core hook install # advisory mode (default)
|
|
415
|
-
npx @shahmilsaari/memory-core hook install --advisory # logs violations, never blocks
|
|
416
|
-
npx @shahmilsaari/memory-core hook install --strict # blocks commits on violations
|
|
417
|
-
npx @shahmilsaari/memory-core hook install --fast # deterministic-only hook
|
|
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
|
|
434
|
-
|
|
435
|
-
[2] src/domain/user.entity.ts:5
|
|
436
|
-
Rule: Domain has zero external imports
|
|
437
|
-
Issue: Imports 'typeorm' directly
|
|
438
|
-
Fix: Define IUserRepository interface in domain/
|
|
439
|
-
|
|
440
|
-
To bypass: MEMORY_CORE_SKIP_HOOK=1 git commit
|
|
441
|
-
Manage rules: memory-core commit-rules --list
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
```bash
|
|
445
|
-
npx @shahmilsaari/memory-core hook uninstall # remove both hooks
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
---
|
|
449
|
-
|
|
450
|
-
### `list` — List memories from the database
|
|
451
|
-
|
|
452
|
-
```bash
|
|
453
|
-
npx @shahmilsaari/memory-core list
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
By default, shows memories relevant to the current project context: detected stack, current project name, plus shared/global memories. Use `--all` for the old database-wide view.
|
|
457
|
-
|
|
458
|
-
```bash
|
|
459
|
-
npx @shahmilsaari/memory-core list --all
|
|
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
|
|
465
|
-
```
|
|
70
|
+
## Key commands
|
|
466
71
|
|
|
467
|
-
|
|
|
72
|
+
| Command | Description |
|
|
468
73
|
|---|---|
|
|
469
|
-
|
|
|
470
|
-
|
|
|
471
|
-
|
|
|
472
|
-
|
|
|
473
|
-
|
|
|
474
|
-
|
|
|
475
|
-
|
|
|
74
|
+
| `memory-core init` | Set up memory-core in the current project |
|
|
75
|
+
| `memory-core remember "..."` | Store an architecture decision |
|
|
76
|
+
| `memory-core check --diff <ref>` | Evidence-based arch enforcement against a git ref |
|
|
77
|
+
| `memory-core check --staged` | Check staged diff (pre-commit hook path) |
|
|
78
|
+
| `memory-core watch --auto-fix` | Real-time violation detection with AI auto-fix |
|
|
79
|
+
| `memory-core dashboard` | Live command center at `localhost:5178` |
|
|
80
|
+
| `memory-core graph build` | Snapshot full codebase dependency graph |
|
|
81
|
+
| `memory-core seed` | Load 281 best-practice rules |
|
|
82
|
+
| `memory-core sync` | Regenerate all agent instruction files |
|
|
83
|
+
| `memory-core export` | Export rules to `memories.json` for team sharing |
|
|
476
84
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
### `remove` — Delete a memory
|
|
480
|
-
|
|
481
|
-
```bash
|
|
482
|
-
npx @shahmilsaari/memory-core remove <id>
|
|
483
|
-
npx @shahmilsaari/memory-core remove <id> --no-sync
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
Deletes a memory by its ID. Get the ID from `list` or `search`.
|
|
487
|
-
|
|
488
|
-
---
|
|
489
|
-
|
|
490
|
-
### `forget` — Bulk-delete memories
|
|
491
|
-
|
|
492
|
-
```bash
|
|
493
|
-
npx @shahmilsaari/memory-core forget --tag nextjs --scope global
|
|
494
|
-
npx @shahmilsaari/memory-core forget --type ignore
|
|
495
|
-
npx @shahmilsaari/memory-core forget --arch nuxt
|
|
496
|
-
```
|
|
497
|
-
|
|
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
|
-
---
|
|
509
|
-
|
|
510
|
-
### `edit` — Edit a memory
|
|
511
|
-
|
|
512
|
-
```bash
|
|
513
|
-
npx @shahmilsaari/memory-core edit <id>
|
|
514
|
-
npx @shahmilsaari/memory-core edit <id> --no-sync
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
Opens the memory interactively so you can update its content, reason, structured context, tags, type, or scope.
|
|
518
|
-
|
|
519
|
-
---
|
|
520
|
-
|
|
521
|
-
### `export` — Export memories to a file
|
|
522
|
-
|
|
523
|
-
```bash
|
|
524
|
-
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
|
-
|
|
530
|
-
---
|
|
531
|
-
|
|
532
|
-
### `import` — Import memories from a file
|
|
533
|
-
|
|
534
|
-
```bash
|
|
535
|
-
npx @shahmilsaari/memory-core import
|
|
536
|
-
npx @shahmilsaari/memory-core import --file path/to/my-rules.json
|
|
537
|
-
npx @shahmilsaari/memory-core import --url https://example.com/team-rules.json
|
|
538
|
-
npx @shahmilsaari/memory-core import --no-sync
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
Imports memories into the local database. Skips duplicates by content hash — safe to run more than once.
|
|
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 |
|
|
548
|
-
|
|
549
|
-
---
|
|
550
|
-
|
|
551
|
-
### `ignore` — Mark false positives
|
|
552
|
-
|
|
553
|
-
```bash
|
|
554
|
-
npx @shahmilsaari/memory-core ignore "controllers may import prisma directly in migration scripts"
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
Saves a pattern so the hook and watcher never flag it again. Useful for intentional exceptions to a rule.
|
|
558
|
-
|
|
559
|
-
```bash
|
|
560
|
-
npx @shahmilsaari/memory-core ignore --list # show all saved ignore patterns
|
|
561
|
-
npx @shahmilsaari/memory-core ignore --remove <id> # delete an ignore pattern
|
|
562
|
-
npx @shahmilsaari/memory-core ignore "..." --no-sync # save without regenerating agent files
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
---
|
|
566
|
-
|
|
567
|
-
### `allow` — Allow intentional project patterns
|
|
568
|
-
|
|
569
|
-
```bash
|
|
570
|
-
npx @shahmilsaari/memory-core allow "generated by sqlc"
|
|
571
|
-
npx @shahmilsaari/memory-core allow --list
|
|
572
|
-
npx @shahmilsaari/memory-core allow --remove "generated by sqlc"
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
Stores lightweight per-project allowlist strings in `.memory-core.json`. Hook and watch checks treat these patterns as intentional before surfacing violations.
|
|
576
|
-
|
|
577
|
-
---
|
|
578
|
-
|
|
579
|
-
### `commit-rules` — Enforce commit message format
|
|
580
|
-
|
|
581
|
-
```bash
|
|
582
|
-
npx @shahmilsaari/memory-core commit-rules "^(feat|fix|chore)" --message "Use conventional commits"
|
|
583
|
-
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
|
-
npx @shahmilsaari/memory-core commit-rules --list
|
|
586
|
-
npx @shahmilsaari/memory-core commit-rules --remove "^WIP"
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
Stores regex-based rules in `.memory-core.json` under `commitRules`. The `commit-msg` git hook (installed by `hook install`) validates every commit message against these rules before the commit is accepted.
|
|
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 |
|
|
598
|
-
|
|
599
|
-
---
|
|
600
|
-
|
|
601
|
-
### `ci-setup` — GitHub Actions integration
|
|
602
|
-
|
|
603
|
-
```bash
|
|
604
|
-
npx @shahmilsaari/memory-core ci-setup
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
Generates `.github/workflows/memory-core.yml`. Adds a PR check that runs `npx @shahmilsaari/memory-core check --ci`, using `memories.json` so CI can enforce architecture rules without a project-local database.
|
|
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.
|
|
624
|
-
|
|
625
|
-
---
|
|
626
|
-
|
|
627
|
-
### `tune` — Silence noisy rules
|
|
628
|
-
|
|
629
|
-
```bash
|
|
630
|
-
npx @shahmilsaari/memory-core tune
|
|
631
|
-
npx @shahmilsaari/memory-core tune --threshold 30
|
|
632
|
-
npx @shahmilsaari/memory-core tune --yes
|
|
633
|
-
```
|
|
634
|
-
|
|
635
|
-
Interactively reviews rules with a high false-positive rate and adds them to `allowPatterns` in `.memory-core.json`.
|
|
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 |
|
|
642
|
-
|
|
643
|
-
---
|
|
644
|
-
|
|
645
|
-
### `reset` vs `uninstall` — Cleanup commands
|
|
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.
|
|
85
|
+
See [COMMANDS.md](COMMANDS.md) for the full reference.
|
|
666
86
|
|
|
667
|
-
|
|
87
|
+
## Dashboard
|
|
668
88
|
|
|
669
89
|
```bash
|
|
670
|
-
|
|
671
|
-
npx @shahmilsaari/memory-core uninstall --db # also drop the memories table after confirmation
|
|
90
|
+
memory-core dashboard
|
|
672
91
|
```
|
|
673
92
|
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
```bash
|
|
681
|
-
npx @shahmilsaari/memory-core global
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
Writes your rules to the global config of each AI agent — so they follow your rules in every project on your machine, not just the current one.
|
|
685
|
-
|
|
686
|
-
| Agent | Where it writes |
|
|
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 |
|
|
702
|
-
|---|---|
|
|
703
|
-
| Claude Code | `CLAUDE.md` |
|
|
704
|
-
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
705
|
-
| Cursor | `.cursorrules` + `.cursor/rules/memory-core.mdc` |
|
|
706
|
-
| Windsurf | `.windsurfrules` |
|
|
707
|
-
| Cline | `.clinerules` |
|
|
708
|
-
| Roo Code | `.roo/rules/memory-core.md` |
|
|
709
|
-
| Aider | `.aider.conf.yml` |
|
|
710
|
-
| Continue.dev | `.continue/config.json` |
|
|
711
|
-
| Devin | `DEVIN.md` |
|
|
712
|
-
| Amazon Q | `.amazonq/dev/guidelines.md` |
|
|
713
|
-
| Gemini Code Assist | `.gemini/styleguide.md` |
|
|
714
|
-
| Zed AI | `.zed/settings.json` |
|
|
715
|
-
| JetBrains AI | `.idea/ai-instructions.md` |
|
|
716
|
-
| OpenHands | `AGENTS.md` |
|
|
717
|
-
|
|
718
|
-
Plus shared files: `AI_RULES.md`, `ARCHITECTURE.md`, `PROJECT_MEMORY.md`
|
|
719
|
-
|
|
720
|
-
---
|
|
721
|
-
|
|
722
|
-
## Architecture profiles
|
|
723
|
-
|
|
724
|
-
Pick the one that matches how your project is structured.
|
|
725
|
-
|
|
726
|
-
**Backend**
|
|
727
|
-
| Profile | Use when… |
|
|
728
|
-
|---|---|
|
|
729
|
-
| Clean Architecture | You want strict separation between domain, application, and infrastructure |
|
|
730
|
-
| Modular Monolith | You're building feature modules that might become microservices later |
|
|
731
|
-
| MVC | Standard web app with controllers and services |
|
|
732
|
-
| Hexagonal | You want ports and adapters for maximum testability |
|
|
733
|
-
| Go REST API | Go backend API with idiomatic error handling and clean package structure |
|
|
734
|
-
| Laravel | Laravel with service-repository pattern |
|
|
735
|
-
| NestJS | Modules, guards, pipes, DTOs, repository pattern |
|
|
736
|
-
|
|
737
|
-
**Frontend**
|
|
738
|
-
| Profile | Use when… |
|
|
739
|
-
|---|---|
|
|
740
|
-
| React | Functional components, hooks, React Query, Zustand |
|
|
741
|
-
| Vue 3 | Composition API, Pinia, composables |
|
|
742
|
-
| Angular | Standalone components, signals, OnPush strategy |
|
|
743
|
-
| Svelte | Svelte 5 runes, SvelteKit load functions, snippets |
|
|
744
|
-
| Nuxt 3 | Fullstack Vue with SSR |
|
|
745
|
-
| React Native | Mobile apps |
|
|
746
|
-
|
|
747
|
-
Fullstack projects get both sections in every generated file.
|
|
748
|
-
|
|
749
|
-
---
|
|
750
|
-
|
|
751
|
-
## Caveman mode (optional)
|
|
752
|
-
|
|
753
|
-
Cuts AI response length by 65–75% by removing filler words. Opt in during `init`.
|
|
754
|
-
|
|
755
|
-
| Level | What it does |
|
|
756
|
-
|---|---|
|
|
757
|
-
| `lite` | Professional and concise |
|
|
758
|
-
| `full` | Caveman-style short answers |
|
|
759
|
-
| `ultra` | Absolute minimum words |
|
|
760
|
-
|
|
761
|
-
---
|
|
762
|
-
|
|
763
|
-
## Day-to-day workflow
|
|
764
|
-
|
|
765
|
-
```bash
|
|
766
|
-
# Starting a new project
|
|
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
|
|
93
|
+
Opens at `http://localhost:5178`. Shows:
|
|
94
|
+
- Live violations feed via WebSocket
|
|
95
|
+
- Layer graph — interactive SVG of your architecture topology
|
|
96
|
+
- Model switcher — change provider/model without restart
|
|
97
|
+
- Token usage — Ollama shows "LOCAL (FREE)", paid providers show real counts
|
|
98
|
+
- Actions panel — Sync Agents, Check All without opening a terminal
|
|
770
99
|
|
|
771
|
-
|
|
772
|
-
npx @shahmilsaari/memory-core remember "All auth goes through middleware, never in controllers" \
|
|
773
|
-
--type decision --scope global
|
|
100
|
+
## Environment
|
|
774
101
|
|
|
775
|
-
|
|
776
|
-
|
|
102
|
+
```env
|
|
103
|
+
# PostgreSQL
|
|
104
|
+
DATABASE_URL=postgres://localhost:5432/memory_core
|
|
777
105
|
|
|
778
|
-
#
|
|
779
|
-
|
|
106
|
+
# Ollama (local, for embeddings)
|
|
107
|
+
OLLAMA_URL=http://localhost:11434
|
|
108
|
+
OLLAMA_MODEL=nomic-embed-text
|
|
780
109
|
|
|
781
|
-
#
|
|
782
|
-
|
|
110
|
+
# AI provider for code analysis (choose one)
|
|
111
|
+
CHAT_PROVIDER=ollama
|
|
112
|
+
CHAT_MODEL=qwen2.5-coder:7b
|
|
783
113
|
|
|
784
|
-
#
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
npx @shahmilsaari/memory-core provider set openai --model gpt-4o-mini --api-key $OPENAI_API_KEY
|
|
789
|
-
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
|
-
```
|
|
800
|
-
|
|
801
|
-
---
|
|
802
|
-
|
|
803
|
-
## Environment variables
|
|
804
|
-
|
|
805
|
-
memory-core creates `.memory-core.env` automatically during `init`. You can also set these manually:
|
|
806
|
-
|
|
807
|
-
| Variable | Required | Default | What it does |
|
|
808
|
-
|---|---|---|---|
|
|
809
|
-
| `DATABASE_URL` | Yes | — | PostgreSQL connection string |
|
|
810
|
-
| `OLLAMA_URL` | No | `http://localhost:11434` | Where Ollama is running (used for embeddings) |
|
|
811
|
-
| `OLLAMA_MODEL` | No | `nomic-embed-text` | Model used for search (embeddings) — always Ollama |
|
|
812
|
-
| `CHAT_PROVIDER` | No | `ollama` | Provider for code checking: `ollama`, `openai`, `anthropic`, `minimax` |
|
|
813
|
-
| `CHAT_MODEL` | No | `llama3.2` | Model used for code checking — chosen during `init` |
|
|
814
|
-
| `CHAT_API_KEY` | No | — | API key for OpenAI / Anthropic / MiniMax (not needed for Ollama) |
|
|
815
|
-
| `OLLAMA_CHAT_MODEL` | No | `llama3.2` | Legacy alias for `CHAT_MODEL` when provider is `ollama` |
|
|
816
|
-
|
|
817
|
-
---
|
|
818
|
-
|
|
819
|
-
## Troubleshooting
|
|
820
|
-
|
|
821
|
-
**`extension "vector" is not available`**
|
|
822
|
-
pgvector isn't installed for your PostgreSQL version. Follow the [pgvector install steps](#pgvector) above.
|
|
823
|
-
|
|
824
|
-
**`Ollama not running — skipping rule check`**
|
|
825
|
-
Start Ollama: `brew services start ollama` (macOS) or `ollama serve` (Linux).
|
|
826
|
-
|
|
827
|
-
**`Chat model "llama3.2" not found`**
|
|
828
|
-
Run `ollama pull llama3.2`. Or switch provider/model with `npx @shahmilsaari/memory-core provider set ...` or `npx @shahmilsaari/memory-core model set ...`.
|
|
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
|
|
114
|
+
# OpenAI-compatible (e.g. DeepSeek)
|
|
115
|
+
CHAT_PROVIDER=openai-compatible
|
|
116
|
+
CHAT_BASE_URL=https://api.deepseek.com/v1
|
|
117
|
+
CHAT_MODEL=deepseek-chat
|
|
840
118
|
CHAT_API_KEY=sk-...
|
|
841
119
|
```
|
|
842
|
-
Embeddings always use Ollama (`nomic-embed-text`) regardless of provider.
|
|
843
|
-
|
|
844
|
-
**`DATABASE_URL is not set`**
|
|
845
|
-
Run `npx @shahmilsaari/memory-core init` — it will create the `.memory-core.env` file for you.
|
|
846
120
|
|
|
847
|
-
|
|
848
|
-
Run `npx @shahmilsaari/memory-core status`.
|
|
121
|
+
## Docs
|
|
849
122
|
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
```bash
|
|
855
|
-
createuser -s $(whoami)
|
|
856
|
-
```
|
|
857
|
-
|
|
858
|
-
**Hook is flagging JSON or config files**
|
|
859
|
-
It won't — the hook only checks source code files: `.ts .tsx .js .jsx .py .php .rb .go .java .cs .swift .kt .rs .vue .svelte`. Everything else is skipped automatically.
|
|
860
|
-
|
|
861
|
-
**Hook is flagging something that's intentional**
|
|
862
|
-
Save an ignore pattern: `npx @shahmilsaari/memory-core ignore "your exception here"`. The hook and watcher will never flag it again.
|
|
863
|
-
|
|
864
|
-
---
|
|
865
|
-
|
|
866
|
-
## Release checks
|
|
867
|
-
|
|
868
|
-
Before publishing, run the same checks as CI:
|
|
869
|
-
|
|
870
|
-
```bash
|
|
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
|
-
```
|
|
878
|
-
|
|
879
|
-
`smoke:pack` verifies the npm tarball includes the built CLI plus templates/profiles.
|
|
880
|
-
`smoke:npx` installs that tarball into a fresh temporary project and runs `npx --no-install memory-core init --quick`.
|
|
881
|
-
|
|
882
|
-
---
|
|
883
|
-
|
|
884
|
-
## Roadmap
|
|
885
|
-
|
|
886
|
-
| | Feature |
|
|
887
|
-
|---|---|
|
|
888
|
-
| ✓ | Watch mode — real-time violation alerts on save |
|
|
889
|
-
| ✓ | Model picker — choose your Ollama model during init |
|
|
890
|
-
| ✓ | Connection validation — PostgreSQL and Ollama verified during setup |
|
|
891
|
-
| ✓ | Svelte 5 / SvelteKit profile and 37 rules |
|
|
892
|
-
| ✓ | NestJS profile and 39 rules |
|
|
893
|
-
| ✓ | Hook auto-prompt — hook mode offered during init, no separate step needed |
|
|
894
|
-
| ✓ | CI/CD — `ci-setup` generates GitHub Actions workflow for PR enforcement |
|
|
895
|
-
| ✓ | Agent selection — choose which agents to generate files for during init |
|
|
896
|
-
| ✓ | Auto-sync — memory-changing commands refresh selected agent files by default |
|
|
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` |
|
|
902
|
-
| ✓ | Multi-provider code checking — Ollama, OpenAI, Anthropic, MiniMax |
|
|
903
|
-
| ✓ | Context-aware retrieval — surface the most relevant rules for the file being edited |
|
|
904
|
-
| ✓ | Setup management — `status`, `provider set`, `model set`, `model doctor` |
|
|
905
|
-
| ✓ | `--debug` flag — verbose output for diagnosing hook and watcher issues |
|
|
906
|
-
| ✓ | Local Svelte dashboard — WebSocket live feed, runtime status, stats, and rules browser |
|
|
907
|
-
| ✓ | Rule cache — 5-min TTL cache, invalidated by config or DB version change |
|
|
908
|
-
| ✓ | Batch suppression — same rule ≥3× on same file auto-suppressed with a notice |
|
|
909
|
-
| ✓ | False-positive tracking — `{ count, falsePositives }` stored per rule in stats |
|
|
910
|
-
| ✓ | Violation clustering — violations grouped by rule, compact multi-location display |
|
|
911
|
-
| ✓ | Auto-tuning — `memory-core tune` silences noisy rules interactively |
|
|
912
|
-
| ✓ | Commit message linting — `commit-rules` + `commit-msg` git hook |
|
|
913
|
-
| | Model guidance during init — recommend a model based on machine specs |
|
|
914
|
-
| | Violation → rule pipeline — auto-suggest a new rule when the same violation repeats |
|
|
915
|
-
| | Team sync — shared database so the whole team works from the same rule set |
|
|
916
|
-
|
|
917
|
-
---
|
|
123
|
+
- [Commands reference](COMMANDS.md)
|
|
124
|
+
- [Dashboard](docs/dashboard.md)
|
|
125
|
+
- [Technical design](TECHNICAL_DESIGN.md)
|
|
126
|
+
- [Website](https://shahmilsaari.github.io/memory-core/)
|
|
918
127
|
|
|
919
128
|
## License
|
|
920
129
|
|
|
921
130
|
MIT
|
|
922
|
-
|
|
923
|
-
*Built by [Shahmil Saari](https://github.com/shahmilsaari)*
|