@shahmilsaari/memory-core 1.0.25 → 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 CHANGED
@@ -1,714 +1,130 @@
1
1
  # memory-core
2
2
 
3
- **Your architecture rules, in every AI coding agent. Automatically.**
3
+ > Universal AI memory for developers. Store architecture rules once every AI coding agent reads them before writing code.
4
4
 
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.
8
-
9
- Website: https://memory-core.shahmilsaari.my/
10
-
11
- ```bash
12
- npx @shahmilsaari/memory-core init
13
- ```
14
-
15
- Fully local or cloud AI — your choice.
16
-
17
- ---
18
-
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.
26
-
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
- ---
35
-
36
- ## What's new in this version
37
-
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
5
+ [![npm](https://img.shields.io/npm/v/@shahmilsaari/memory-core)](https://www.npmjs.com/package/@shahmilsaari/memory-core)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
45
7
 
46
8
  ---
47
9
 
48
- ## Before you start
10
+ ## What it does
49
11
 
50
- You need three things:
12
+ AI tools like Copilot, Cursor, and Claude Code start fresh every session. memory-core fixes that:
51
13
 
52
- | What | Why | Install |
53
- |---|---|---|
54
- | PostgreSQL 14+ | Stores your rules and decisions | See below |
55
- | pgvector | Enables AI-powered rule search | See below |
56
- | Ollama | Runs AI locally — no API key needed | See below |
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
57
17
 
58
- Cloud providers (OpenAI, Anthropic, MiniMax) are also supported if you prefer not to run Ollama locally.
59
-
60
- ---
61
-
62
- ## Install
63
-
64
- ### PostgreSQL
65
-
66
- **macOS**
67
18
  ```bash
68
- brew install postgresql@16
69
- brew services start postgresql@16
70
- ```
71
-
72
- **Linux**
73
- ```bash
74
- sudo apt install postgresql postgresql-contrib
75
- sudo systemctl start postgresql
76
- ```
77
-
78
- **Windows** — [download from postgresql.org](https://www.postgresql.org/download/windows/)
79
-
80
- ---
81
-
82
- ### pgvector
83
-
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.
85
-
86
- **macOS + PostgreSQL 17+**
87
- ```bash
88
- brew install pgvector
89
- ```
90
-
91
- **macOS + PostgreSQL 16** (brew targets 17+, so build from source)
92
- ```bash
93
- xcode-select --install
94
- git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git /tmp/pgvector
95
- cd /tmp/pgvector
96
- make PG_CONFIG=/opt/homebrew/opt/postgresql@16/bin/pg_config
97
- make install PG_CONFIG=/opt/homebrew/opt/postgresql@16/bin/pg_config
98
- ```
99
-
100
- **Linux**
101
- ```bash
102
- sudo apt install postgresql-16-pgvector # replace 16 with your version
103
- ```
104
-
105
- Verify:
106
- ```bash
107
- psql -U $(whoami) -c "SELECT * FROM pg_available_extensions WHERE name = 'vector';"
108
- ```
109
-
110
- ---
111
-
112
- ### Ollama
113
-
114
- Ollama runs AI models on your machine. Two models are used: one for search (embeddings) and one for code checking.
115
-
116
- **macOS**
117
- ```bash
118
- brew install ollama
119
- brew services start ollama
120
- ```
121
-
122
- **Linux**
123
- ```bash
124
- curl -fsSL https://ollama.com/install.sh | sh
125
- ollama serve &
126
- ```
127
-
128
- **Windows** — [download from ollama.com](https://ollama.com/download)
129
-
130
- Pull the required models:
131
- ```bash
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
134
- ```
135
-
136
- ---
137
-
138
- ### Create the database
139
-
140
- ```bash
141
- createdb memory_core
142
- psql -U $(whoami) -d memory_core -f setup.sql
143
- ```
144
-
145
- `setup.sql`:
146
- ```sql
147
- CREATE EXTENSION IF NOT EXISTS vector;
148
-
149
- CREATE TABLE IF NOT EXISTS memories (
150
- id BIGSERIAL PRIMARY KEY,
151
- type TEXT NOT NULL,
152
- scope TEXT NOT NULL DEFAULT 'project',
153
- architecture TEXT,
154
- project_name TEXT,
155
- title TEXT,
156
- content TEXT NOT NULL,
157
- reason TEXT,
158
- context JSONB NOT NULL DEFAULT '{}',
159
- tags TEXT[] DEFAULT '{}',
160
- embedding vector(768),
161
- created_at TIMESTAMP DEFAULT now()
162
- );
163
-
164
- CREATE INDEX IF NOT EXISTS memories_embedding_idx
165
- ON memories USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
166
- CREATE INDEX IF NOT EXISTS memories_architecture_idx ON memories (architecture);
167
- CREATE INDEX IF NOT EXISTS memories_scope_idx ON memories (scope);
168
-
169
- CREATE TABLE IF NOT EXISTS graph_snapshots (
170
- id TEXT PRIMARY KEY,
171
- root_path TEXT NOT NULL,
172
- created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
173
- nodes JSONB NOT NULL DEFAULT '[]'::jsonb,
174
- edges JSONB NOT NULL DEFAULT '[]'::jsonb
175
- );
176
-
177
- CREATE INDEX IF NOT EXISTS graph_snapshots_root_path_idx ON graph_snapshots (root_path);
178
- CREATE INDEX IF NOT EXISTS graph_snapshots_created_at_idx ON graph_snapshots (created_at DESC);
179
- ```
180
-
181
- ---
182
-
183
- ## Quick start
184
-
185
- ```bash
186
- # 1. Go to your project
187
- cd my-api
188
-
189
- # 2. Initialize — verifies connections, picks your model, generates config files
190
19
  npx @shahmilsaari/memory-core init
191
-
192
- # 3. Load 281 predefined best-practice rules
193
- npx @shahmilsaari/memory-core seed
194
20
  ```
195
21
 
196
- That's it. Every AI agent in your project now has your rules.
197
-
198
- ---
199
-
200
- ## Day-to-day workflow
201
-
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"
206
-
207
- # Watch mode — catch violations the moment you save a file
208
- npx @shahmilsaari/memory-core watch
209
-
210
- # AI auto-fix — let the AI rewrite violations automatically
211
- npx @shahmilsaari/memory-core watch --auto-fix
212
-
213
- # See the dashboard — live violations, model status, token usage, actions
214
- npx @shahmilsaari/memory-core dashboard
215
-
216
- # Manual check before a commit
217
- npx @shahmilsaari/memory-core check --staged
218
-
219
- # Dry run — see what would be flagged without blocking
220
- npx @shahmilsaari/memory-core check --staged --dry-run
221
-
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
230
- ```
231
-
232
- ---
233
-
234
- ## Commands
235
-
236
- ### `init` — Set up a project
22
+ ## Quick start
237
23
 
238
24
  ```bash
25
+ # 1. Initialize in your project
239
26
  npx @shahmilsaari/memory-core init
240
- ```
241
-
242
- Walks you through:
243
- - PostgreSQL connection URL — **tested live, retries until connected**
244
- - Ollama URL — **tested live, retries until reachable**
245
- - Code-checking provider — **Ollama (local), OpenAI, Anthropic, or MiniMax**
246
- - Code-checking model — picked from a list, verified before continuing
247
- - Project name, type, architecture, language
248
- - Which agents to generate files for — multi-select, all pre-checked
249
- - Hook mode — **advisory** (logs violations, never blocks) or **strict** (blocks commits)
250
- - Whether to enable caveman mode
251
-
252
- Generates config files for every selected agent, installs the pre-commit hook, and auto-syncs by default.
253
-
254
- ---
255
-
256
- ### `sync` — Refresh all agent files
257
-
258
- ```bash
259
- npx @shahmilsaari/memory-core sync
260
- ```
261
-
262
- Regenerates every agent instruction file from your current rules. Reports updated vs already up to date:
263
-
264
- ```
265
- 3 updated, 11 already up to date
266
- ```
267
-
268
- Turn off auto-sync when you want to batch memory edits, then sync once:
269
- ```bash
270
- npx @shahmilsaari/memory-core auto-sync off
271
- npx @shahmilsaari/memory-core auto-sync on
272
- ```
273
-
274
- ---
275
-
276
- ### `remember` — Save a decision
277
-
278
- ```bash
279
- npx @shahmilsaari/memory-core remember "Controllers must never call the database directly"
280
- ```
281
-
282
- It will ask you *why* — the reason gets stored alongside the rule and shown when a violation is caught.
283
-
284
- With flags (skip the prompts):
285
- ```bash
286
- npx @shahmilsaari/memory-core remember "Use DTOs for all API responses" \
287
- --type rule \
288
- --scope global \
289
- --reason "Raw DB entities expose internal schema and sensitive fields" \
290
- --applies-to "controllers,API responses" \
291
- --avoid-when "internal domain transformations" \
292
- --example "return UserResponseDto instead of UserEntity" \
293
- --tags "api,dto"
294
- ```
295
-
296
- | Flag | Options | Default |
297
- |---|---|---|
298
- | `--type` | `decision` `rule` `pattern` `note` | `decision` |
299
- | `--scope` | `global` `project` | `project` |
300
- | `--reason` | any text | asked interactively |
301
- | `--applies-to` | comma-separated use cases | none |
302
- | `--avoid-when` | comma-separated exceptions | none |
303
- | `--example` | comma-separated examples | none |
304
- | `--tags` | comma-separated | none |
305
-
306
- ---
307
-
308
- ### `watch` — Catch violations as you type
309
-
310
- ```bash
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
317
- ```
318
-
319
- Runs in the background and checks each file the moment you save it. Violations appear immediately:
320
-
321
- ```
322
- [10:42:11] saved: src/controllers/user.ts
323
-
324
- ✗ 1 violation in src/controllers/user.ts
325
27
 
326
- [1] src/controllers/user.ts:34
327
- Rule: Thin controllers business logic belongs in services
328
- Why: Logic in controllers cannot be reused from other entry points
329
- Issue: Password hashing inside the route handler
330
- Fix: Move to UserService.hashPassword()
331
- ```
332
-
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
-
339
- ```bash
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
347
- ```
348
-
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).
350
-
351
- ---
352
-
353
- ### `dashboard` — Local command center
354
-
355
- ```bash
356
- npx @shahmilsaari/memory-core dashboard
357
- npx @shahmilsaari/memory-core dashboard --port 5178
358
- npx @shahmilsaari/memory-core dashboard --path /absolute/path/to/project
359
- npx @shahmilsaari/memory-core dashboard --no-watch
360
- ```
361
-
362
- Starts a local Svelte dashboard at `http://localhost:5178`. What you get:
363
-
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
28
+ # 2. Load best-practice rules for your architecture
29
+ memory-core seed --arch clean-architecture
371
30
 
372
- ---
373
-
374
- ### `schema` — TypeScript ↔ Go struct alignment
375
-
376
- Catch field drift between TypeScript interfaces and Go structs automatically.
377
-
378
- ```bash
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
31
+ # 3. Store a project decision
32
+ memory-core remember "No direct DB calls from controllers"
383
33
 
384
- # List tracked pairs
385
- npx @shahmilsaari/memory-core schema list
386
-
387
- # Check all pairs for field drift
388
- npx @shahmilsaari/memory-core schema check
34
+ # 4. Enforce on every diff
35
+ memory-core check --diff HEAD~1
389
36
  ```
390
37
 
391
- When a field is added to one side but not the other, `schema check` reports it as a violation.
392
-
393
- ---
38
+ ## Architecture enforcement
394
39
 
395
- ### `hook install` Install pre-commit and commit-msg hooks
40
+ The `check --diff` command runs a two-tier enforcement pipeline:
396
41
 
397
- ```bash
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
402
42
  ```
403
-
404
- **Advisory mode (default):** violations are logged but the commit always goes through.
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:
409
- ```bash
410
- MEMORY_CORE_SKIP_HOOK=1 git commit -m "..."
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
411
49
  ```
412
50
 
413
- Every bypass is tracked. If you don't provide a reason, memory-core will ask you on the next commit.
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.
414
52
 
415
- ---
416
-
417
- ### `search` — Find a rule
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`.
418
54
 
419
- ```bash
420
- npx @shahmilsaari/memory-core search "error handling"
421
- npx @shahmilsaari/memory-core search "auth strategy" --limit 10
422
- ```
55
+ ## Installation requirements
423
56
 
424
- Uses AI search finds related rules even if you don't use the exact words.
425
-
426
- ---
427
-
428
- ### `seed` — Load predefined rules
429
-
430
- 281 best-practice rules across all supported architectures, each with a plain-English reason.
431
-
432
- ```bash
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
436
- ```
437
-
438
- ---
439
-
440
- ### `list`, `remove`, `edit` — Manage your rules
441
-
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>
449
- npx @shahmilsaari/memory-core edit <id>
450
- ```
451
-
452
- ---
453
-
454
- ### `export` / `import` — Share rules with your team
455
-
456
- ```bash
457
- # Export your rules to a file (commit this alongside your code)
458
- npx @shahmilsaari/memory-core export
459
-
460
- # Import from a file or URL
461
- npx @shahmilsaari/memory-core import
462
- npx @shahmilsaari/memory-core import --file path/to/rules.json
463
- npx @shahmilsaari/memory-core import --url https://example.com/team-rules.json
464
- ```
465
-
466
- Skips duplicates — safe to run multiple times.
467
-
468
- ---
469
-
470
- ### `ignore` / `allow` — Handle exceptions
471
-
472
- ```bash
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>
477
-
478
- # Allow an intentional project pattern
479
- npx @shahmilsaari/memory-core allow "generated by sqlc"
480
- npx @shahmilsaari/memory-core allow --list
481
- ```
482
-
483
- ---
484
-
485
- ### `stats` / `tune` — Manage noisy rules
486
-
487
- ```bash
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
494
- ```
495
-
496
- A rule with a >40% false-positive rate shows up in `--tune`. The `tune` command lets you silence it interactively.
497
-
498
- ---
499
-
500
- ### `commit-rules` — Enforce commit message format
501
-
502
- ```bash
503
- npx @shahmilsaari/memory-core commit-rules "^(feat|fix|chore)" --message "Use conventional commits"
504
- npx @shahmilsaari/memory-core commit-rules "^WIP" --message "Don't commit WIP" --negate
505
- npx @shahmilsaari/memory-core commit-rules --list
506
- npx @shahmilsaari/memory-core commit-rules --remove "^WIP"
507
- ```
508
-
509
- The `commit-msg` git hook validates every commit message against these rules.
510
-
511
- ---
512
-
513
- ### `ci-setup` — GitHub Actions integration
514
-
515
- ```bash
516
- npx @shahmilsaari/memory-core ci-setup
517
- ```
518
-
519
- Generates `.github/workflows/memory-core.yml`. Adds a PR check using `memories.json` — no project database needed in CI.
520
-
521
- ---
522
-
523
- ### `status` — See your current setup
524
-
525
- ```bash
526
- npx @shahmilsaari/memory-core status
527
- ```
528
-
529
- Shows project name, provider/model, agents, hook state, generated files, and health checks for PostgreSQL and Ollama.
530
-
531
- ---
532
-
533
- ### `reset` vs `uninstall` — Cleanup
534
-
535
- | Command | What it does | Database |
57
+ | Dependency | Purpose | Install |
536
58
  |---|---|---|
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) |
542
-
543
- ```bash
544
- npx @shahmilsaari/memory-core reset
545
- npx @shahmilsaari/memory-core reset --soft
546
- npx @shahmilsaari/memory-core uninstall
547
- ```
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` |
548
63
 
549
- ---
64
+ Cloud providers (OpenAI, Anthropic, DeepSeek, any OpenAI-compatible endpoint) can be used for code analysis — embeddings always stay local.
550
65
 
551
66
  ## Supported AI agents
552
67
 
553
- memory-core generates instruction files for:
554
-
555
- | Agent | File |
556
- |---|---|
557
- | Claude Code | `CLAUDE.md` |
558
- | GitHub Copilot | `.github/copilot-instructions.md` |
559
- | Cursor | `.cursorrules` + `.cursor/rules/memory-core.mdc` |
560
- | Windsurf | `.windsurfrules` |
561
- | Cline | `.clinerules` |
562
- | Roo Code | `.roo/rules/memory-core.md` |
563
- | Aider | `.aider.conf.yml` |
564
- | Continue.dev | `.continue/config.json` |
565
- | Devin | `DEVIN.md` |
566
- | Amazon Q | `.amazonq/dev/guidelines.md` |
567
- | Gemini Code Assist | `.gemini/styleguide.md` |
568
- | Zed AI | `.zed/settings.json` |
569
- | JetBrains AI | `.idea/ai-instructions.md` |
570
- | OpenHands | `AGENTS.md` |
571
-
572
- Plus shared files: `AI_RULES.md`, `ARCHITECTURE.md`, `PROJECT_MEMORY.md`
573
-
574
- ---
68
+ Claude Code · GitHub Copilot · Cursor · Windsurf · Cline · Roo Code · Aider · Continue.dev · Devin · Amazon Q · Gemini Code Assist · Zed AI · JetBrains AI · OpenHands
575
69
 
576
- ## Architecture profiles
70
+ ## Key commands
577
71
 
578
- Pick the one that matches your project structure:
579
-
580
- **Backend**
581
- | Profile | Use when… |
582
- |---|---|
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 |
588
- | Laravel | Laravel with service-repository pattern |
589
- | NestJS | Modules, guards, pipes, DTOs, repository pattern |
590
-
591
- **Frontend**
592
- | Profile | Use when… |
72
+ | Command | Description |
593
73
  |---|---|
594
- | React | Functional components, hooks, React Query, Zustand |
595
- | Vue 3 | Composition API, Pinia, composables |
596
- | Angular | Standalone components, signals, OnPush strategy |
597
- | Svelte | Svelte 5 runes, SvelteKit load functions |
598
- | Nuxt 3 | Fullstack Vue with SSR |
599
- | React Native | Mobile apps |
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 |
600
84
 
601
- ---
602
-
603
- ## AI providers
85
+ See [COMMANDS.md](COMMANDS.md) for the full reference.
604
86
 
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 |
87
+ ## Dashboard
611
88
 
612
- Switch without rerunning init:
613
89
  ```bash
614
- npx @shahmilsaari/memory-core provider set openai --model gpt-4o --api-key sk-...
615
- npx @shahmilsaari/memory-core model set qwen2.5-coder --provider ollama
90
+ memory-core dashboard
616
91
  ```
617
92
 
618
- Or switch from the dashboard UI — takes effect immediately, no restart needed.
619
-
620
- ---
621
-
622
- ## Environment variables
623
-
624
- memory-core creates `.memory-core.env` automatically during `init`.
625
-
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 |
634
-
635
- ---
636
-
637
- ## Troubleshooting
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
638
99
 
639
- **`extension "vector" is not available`**
640
- pgvector isn't installed for your PostgreSQL version. Follow the [pgvector steps](#pgvector) above.
100
+ ## Environment
641
101
 
642
- **`Ollama not running — skipping rule check`**
643
- Start Ollama: `brew services start ollama` (macOS) or `ollama serve` (Linux).
102
+ ```env
103
+ # PostgreSQL
104
+ DATABASE_URL=postgres://localhost:5432/memory_core
644
105
 
645
- **`Chat model "llama3.2" not found`**
646
- Run `ollama pull llama3.2`, or switch provider: `npx @shahmilsaari/memory-core provider set openai --model gpt-4o-mini --api-key sk-...`
106
+ # Ollama (local, for embeddings)
107
+ OLLAMA_URL=http://localhost:11434
108
+ OLLAMA_MODEL=nomic-embed-text
647
109
 
648
- **`DATABASE_URL is not set`**
649
- Run `npx @shahmilsaari/memory-core init` — it creates `.memory-core.env` for you.
110
+ # AI provider for code analysis (choose one)
111
+ CHAT_PROVIDER=ollama
112
+ CHAT_MODEL=qwen2.5-coder:7b
650
113
 
651
- **Not sure what memory-core is using**
652
- Run `npx @shahmilsaari/memory-core status` or `npx @shahmilsaari/memory-core model doctor`.
653
-
654
- **`createdb: role does not exist`**
655
- ```bash
656
- createuser -s $(whoami)
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
118
+ CHAT_API_KEY=sk-...
657
119
  ```
658
120
 
659
- **Hook is flagging something intentional**
660
- Save an ignore pattern: `npx @shahmilsaari/memory-core ignore "your exception here"`
661
-
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.
664
-
665
- ---
666
-
667
- ## Caveman mode (optional)
668
-
669
- Cuts AI response length by 65–75% by removing filler words. Opt in during `init`.
670
-
671
- | Level | What it does |
672
- |---|---|
673
- | `lite` | Professional and concise |
674
- | `full` | Caveman-style short answers |
675
- | `ultra` | Absolute minimum words |
676
-
677
- ---
678
-
679
- ## Roadmap
121
+ ## Docs
680
122
 
681
- | | Feature |
682
- |---|---|
683
- | ✓ | Watch mode — real-time violation alerts on save |
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 |
692
- | ✓ | Multi-provider code checking — Ollama, OpenAI, Anthropic, MiniMax |
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 |
707
-
708
- ---
123
+ - [Commands reference](COMMANDS.md)
124
+ - [Dashboard](docs/dashboard.md)
125
+ - [Technical design](TECHNICAL_DESIGN.md)
126
+ - [Website](https://shahmilsaari.github.io/memory-core/)
709
127
 
710
128
  ## License
711
129
 
712
130
  MIT
713
-
714
- *Built by [Shahmil Saari](https://github.com/shahmilsaari)*