@shahmilsaari/memory-core 0.1.3 → 0.1.5
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 +187 -197
- package/dist/cli.js +14 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,75 +1,46 @@
|
|
|
1
|
-
#
|
|
1
|
+
# memory-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Every AI coding agent in your project, following your rules. Automatically.**
|
|
4
|
+
|
|
5
|
+
You decide the architecture. memory-core remembers it. Every AI tool — Copilot, Cursor, Claude Code, Windsurf, and 10 more — reads those rules before writing a single line of code.
|
|
4
6
|
|
|
5
7
|
```bash
|
|
6
8
|
npx @shahmilsaari/memory-core init
|
|
7
9
|
```
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## How it works
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
memory-core init
|
|
15
|
-
│
|
|
16
|
-
├── You pick: Backend / Frontend / Fullstack
|
|
17
|
-
├── You pick: Architecture (Clean, MVC, React, Vue, …)
|
|
18
|
-
│
|
|
19
|
-
▼
|
|
20
|
-
PostgreSQL + pgvector
|
|
21
|
-
192 predefined rules — each with a WHY
|
|
22
|
-
+ your own saved decisions
|
|
23
|
-
│
|
|
24
|
-
▼
|
|
25
|
-
18 AI agent config files generated
|
|
26
|
-
│
|
|
27
|
-
▼
|
|
28
|
-
Every agent reads its file → follows your rules
|
|
29
|
-
|
|
30
|
-
git commit → pre-commit hook → Ollama checks diff
|
|
31
|
-
→ violations blocked with Rule + Why + Fix
|
|
32
|
-
```
|
|
11
|
+
No OpenAI key. No cloud. Fully local.
|
|
33
12
|
|
|
34
13
|
---
|
|
35
14
|
|
|
36
|
-
##
|
|
15
|
+
## What does it actually do?
|
|
37
16
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
42
|
-
| Cursor | `.cursorrules` + `.cursor/rules/memory-core.mdc` |
|
|
43
|
-
| Windsurf | `.windsurfrules` |
|
|
44
|
-
| Cline | `.clinerules` |
|
|
45
|
-
| Roo Code | `.roo/rules/memory-core.md` |
|
|
46
|
-
| Aider | `.aider.conf.yml` |
|
|
47
|
-
| Continue.dev | `.continue/config.json` |
|
|
48
|
-
| Devin | `DEVIN.md` |
|
|
49
|
-
| Amazon Q | `.amazonq/dev/guidelines.md` |
|
|
50
|
-
| Gemini Code Assist | `.gemini/styleguide.md` |
|
|
51
|
-
| Zed AI | `.zed/settings.json` |
|
|
52
|
-
| JetBrains AI | `.idea/ai-instructions.md` |
|
|
53
|
-
| OpenHands / AGENTS | `AGENTS.md` |
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
With memory-core:
|
|
54
20
|
|
|
55
|
-
|
|
21
|
+
1. You run `init` once and answer a few questions about your project
|
|
22
|
+
2. memory-core generates config files for every AI agent you use
|
|
23
|
+
3. Those agents read the files and follow your rules — automatically
|
|
24
|
+
4. When you commit code, a hook catches violations before they land in the repo
|
|
25
|
+
5. Watch mode catches violations as you type, not just at commit time
|
|
56
26
|
|
|
57
27
|
---
|
|
58
28
|
|
|
59
|
-
##
|
|
29
|
+
## Before you start
|
|
60
30
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
|
64
|
-
|
|
65
|
-
|
|
|
66
|
-
|
|
|
31
|
+
You need three things installed:
|
|
32
|
+
|
|
33
|
+
| What | Why | Install |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| PostgreSQL 14+ | Stores your rules and decisions | See below |
|
|
36
|
+
| pgvector | Makes search smart (finds similar rules, not just exact matches) | See below |
|
|
37
|
+
| Ollama | Runs AI locally — no API key needed | See below |
|
|
67
38
|
|
|
68
39
|
---
|
|
69
40
|
|
|
70
|
-
##
|
|
41
|
+
## Install
|
|
71
42
|
|
|
72
|
-
###
|
|
43
|
+
### PostgreSQL
|
|
73
44
|
|
|
74
45
|
**macOS**
|
|
75
46
|
```bash
|
|
@@ -83,13 +54,20 @@ sudo apt install postgresql postgresql-contrib
|
|
|
83
54
|
sudo systemctl start postgresql
|
|
84
55
|
```
|
|
85
56
|
|
|
86
|
-
**Windows** — download from
|
|
57
|
+
**Windows** — [download from postgresql.org](https://www.postgresql.org/download/windows/)
|
|
87
58
|
|
|
88
59
|
---
|
|
89
60
|
|
|
90
|
-
###
|
|
61
|
+
### pgvector
|
|
91
62
|
|
|
92
|
-
|
|
63
|
+
pgvector adds AI-powered search to PostgreSQL.
|
|
64
|
+
|
|
65
|
+
**macOS + PostgreSQL 17+** (easiest)
|
|
66
|
+
```bash
|
|
67
|
+
brew install pgvector
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**macOS + PostgreSQL 16** (brew's pgvector targets 17+, so build from source)
|
|
93
71
|
```bash
|
|
94
72
|
xcode-select --install
|
|
95
73
|
git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git /tmp/pgvector
|
|
@@ -98,24 +76,21 @@ make PG_CONFIG=/opt/homebrew/opt/postgresql@16/bin/pg_config
|
|
|
98
76
|
make install PG_CONFIG=/opt/homebrew/opt/postgresql@16/bin/pg_config
|
|
99
77
|
```
|
|
100
78
|
|
|
101
|
-
**macOS with PostgreSQL@17+**
|
|
102
|
-
```bash
|
|
103
|
-
brew install pgvector
|
|
104
|
-
```
|
|
105
|
-
|
|
106
79
|
**Linux**
|
|
107
80
|
```bash
|
|
108
81
|
sudo apt install postgresql-16-pgvector # replace 16 with your version
|
|
109
82
|
```
|
|
110
83
|
|
|
111
|
-
|
|
84
|
+
Check it worked:
|
|
112
85
|
```bash
|
|
113
86
|
psql -U $(whoami) -c "SELECT * FROM pg_available_extensions WHERE name = 'vector';"
|
|
114
87
|
```
|
|
115
88
|
|
|
116
89
|
---
|
|
117
90
|
|
|
118
|
-
###
|
|
91
|
+
### Ollama
|
|
92
|
+
|
|
93
|
+
Ollama runs AI models on your machine. Two models are needed — one for search, one for code checking.
|
|
119
94
|
|
|
120
95
|
**macOS**
|
|
121
96
|
```bash
|
|
@@ -129,28 +104,24 @@ curl -fsSL https://ollama.com/install.sh | sh
|
|
|
129
104
|
ollama serve &
|
|
130
105
|
```
|
|
131
106
|
|
|
132
|
-
**Windows** — download from
|
|
107
|
+
**Windows** — [download from ollama.com](https://ollama.com/download)
|
|
133
108
|
|
|
134
|
-
|
|
109
|
+
Then pull the two models:
|
|
135
110
|
```bash
|
|
136
|
-
ollama pull nomic-embed-text #
|
|
137
|
-
ollama pull llama3.2 #
|
|
111
|
+
ollama pull nomic-embed-text # used for search
|
|
112
|
+
ollama pull llama3.2 # used to check your code
|
|
138
113
|
```
|
|
139
114
|
|
|
140
115
|
---
|
|
141
116
|
|
|
142
|
-
###
|
|
117
|
+
### Create the database
|
|
143
118
|
|
|
144
119
|
```bash
|
|
145
120
|
createdb memory_core
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Then run the schema (get `setup.sql` from the repo or copy below):
|
|
149
|
-
```bash
|
|
150
121
|
psql -U $(whoami) -d memory_core -f setup.sql
|
|
151
122
|
```
|
|
152
123
|
|
|
153
|
-
`setup.sql
|
|
124
|
+
`setup.sql`:
|
|
154
125
|
```sql
|
|
155
126
|
CREATE EXTENSION IF NOT EXISTS vector;
|
|
156
127
|
|
|
@@ -169,38 +140,31 @@ CREATE TABLE IF NOT EXISTS memories (
|
|
|
169
140
|
);
|
|
170
141
|
|
|
171
142
|
CREATE INDEX IF NOT EXISTS memories_embedding_idx
|
|
172
|
-
ON memories USING ivfflat (embedding vector_cosine_ops)
|
|
173
|
-
WITH (lists = 100);
|
|
174
|
-
|
|
143
|
+
ON memories USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
|
|
175
144
|
CREATE INDEX IF NOT EXISTS memories_architecture_idx ON memories (architecture);
|
|
176
145
|
CREATE INDEX IF NOT EXISTS memories_scope_idx ON memories (scope);
|
|
177
146
|
```
|
|
178
147
|
|
|
179
148
|
---
|
|
180
149
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
Create `.env` in the project where you run memory-core (or `.memory-core.env` per project):
|
|
184
|
-
|
|
185
|
-
```env
|
|
186
|
-
DATABASE_URL=postgresql://YOUR_USERNAME@localhost:5432/memory_core
|
|
187
|
-
OLLAMA_URL=http://localhost:11434
|
|
188
|
-
OLLAMA_MODEL=nomic-embed-text
|
|
189
|
-
OLLAMA_CHAT_MODEL=llama3.2
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
Find your username: `whoami`
|
|
193
|
-
|
|
194
|
-
---
|
|
150
|
+
## Quick start
|
|
195
151
|
|
|
196
|
-
|
|
152
|
+
```bash
|
|
153
|
+
# 1. Go to your project
|
|
154
|
+
cd my-api
|
|
197
155
|
|
|
198
|
-
|
|
156
|
+
# 2. Initialize — answers a few questions, generates all config files
|
|
157
|
+
npx @shahmilsaari/memory-core init
|
|
199
158
|
|
|
200
|
-
|
|
159
|
+
# 3. Load 192 predefined best-practice rules
|
|
201
160
|
npx @shahmilsaari/memory-core seed
|
|
161
|
+
|
|
162
|
+
# 4. Install the pre-commit hook (optional but recommended)
|
|
163
|
+
npx @shahmilsaari/memory-core hook install
|
|
202
164
|
```
|
|
203
165
|
|
|
166
|
+
That's it. Every AI agent in your project now has your rules.
|
|
167
|
+
|
|
204
168
|
---
|
|
205
169
|
|
|
206
170
|
## Commands
|
|
@@ -208,107 +172,108 @@ npx @shahmilsaari/memory-core seed
|
|
|
208
172
|
### `init` — Set up a project
|
|
209
173
|
|
|
210
174
|
```bash
|
|
211
|
-
cd your-project
|
|
212
175
|
npx @shahmilsaari/memory-core init
|
|
213
176
|
```
|
|
214
177
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
Project
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
Language? → TypeScript
|
|
222
|
-
Install caveman? → no
|
|
223
|
-
```
|
|
178
|
+
Asks you:
|
|
179
|
+
- Project name
|
|
180
|
+
- Project type (Backend / Frontend / Fullstack)
|
|
181
|
+
- Architecture (Clean Architecture, MVC, React, Vue, etc.)
|
|
182
|
+
- Language
|
|
183
|
+
- Whether to enable caveman mode (optional token saver)
|
|
224
184
|
|
|
225
|
-
Generates
|
|
226
|
-
|
|
227
|
-
---
|
|
228
|
-
|
|
229
|
-
### `sync` — Regenerate all agent files
|
|
230
|
-
|
|
231
|
-
```bash
|
|
232
|
-
npx @shahmilsaari/memory-core sync
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
Re-pulls memories from the DB and rewrites all 18 files. Run after `remember` or `seed`.
|
|
185
|
+
Generates config files for every supported AI agent and saves your choices to `.memory-core.json`.
|
|
236
186
|
|
|
237
187
|
---
|
|
238
188
|
|
|
239
189
|
### `remember` — Save a decision
|
|
240
190
|
|
|
191
|
+
Made a decision your team should never forget? Save it.
|
|
192
|
+
|
|
241
193
|
```bash
|
|
242
194
|
npx @shahmilsaari/memory-core remember "Controllers must never call the database directly"
|
|
243
195
|
```
|
|
244
196
|
|
|
245
|
-
|
|
197
|
+
It will ask you *why* — that reason gets stored alongside the rule and shown to AI agents and developers when a violation is caught.
|
|
246
198
|
|
|
247
|
-
With flags:
|
|
199
|
+
With flags (skip the prompts):
|
|
248
200
|
```bash
|
|
249
201
|
npx @shahmilsaari/memory-core remember "Use DTOs for all API responses" \
|
|
250
202
|
--type rule \
|
|
251
203
|
--scope global \
|
|
252
|
-
--reason "Raw DB entities
|
|
253
|
-
--tags "api,dto
|
|
204
|
+
--reason "Raw DB entities expose internal schema and sensitive fields" \
|
|
205
|
+
--tags "api,dto"
|
|
254
206
|
```
|
|
255
207
|
|
|
256
|
-
| Flag |
|
|
208
|
+
| Flag | Options | Default |
|
|
257
209
|
|---|---|---|
|
|
258
210
|
| `--type` | `decision` `rule` `pattern` `note` | `decision` |
|
|
259
211
|
| `--scope` | `global` `project` | `project` |
|
|
260
|
-
| `--reason` |
|
|
212
|
+
| `--reason` | any text | asked interactively |
|
|
261
213
|
| `--tags` | comma-separated | none |
|
|
262
214
|
|
|
263
215
|
---
|
|
264
216
|
|
|
265
|
-
### `
|
|
217
|
+
### `sync` — Refresh all agent files
|
|
218
|
+
|
|
219
|
+
After saving new memories, regenerate every agent file to include them.
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
npx @shahmilsaari/memory-core sync
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
### `search` — Find a rule or decision
|
|
266
228
|
|
|
267
229
|
```bash
|
|
268
230
|
npx @shahmilsaari/memory-core search "error handling"
|
|
269
231
|
npx @shahmilsaari/memory-core search "auth strategy" --limit 10
|
|
270
232
|
```
|
|
271
233
|
|
|
234
|
+
Uses AI search — finds related rules even if you don't use the exact words.
|
|
235
|
+
|
|
272
236
|
---
|
|
273
237
|
|
|
274
238
|
### `seed` — Load predefined rules
|
|
275
239
|
|
|
240
|
+
192 best-practice rules across all supported architectures, each with a plain-English reason explaining why the rule exists.
|
|
241
|
+
|
|
276
242
|
```bash
|
|
277
|
-
npx @shahmilsaari/memory-core seed
|
|
278
|
-
npx @shahmilsaari/memory-core seed --arch clean-architecture # one
|
|
279
|
-
npx @shahmilsaari/memory-core seed --force # re-seed existing
|
|
243
|
+
npx @shahmilsaari/memory-core seed # all architectures
|
|
244
|
+
npx @shahmilsaari/memory-core seed --arch clean-architecture # one only
|
|
245
|
+
npx @shahmilsaari/memory-core seed --force # re-seed existing
|
|
280
246
|
```
|
|
281
247
|
|
|
282
|
-
192 rules across all architectures. Every rule includes a `reason` explaining why it exists.
|
|
283
|
-
|
|
284
248
|
---
|
|
285
249
|
|
|
286
|
-
### `hook install` —
|
|
250
|
+
### `hook install` — Block bad commits
|
|
287
251
|
|
|
288
252
|
```bash
|
|
289
253
|
npx @shahmilsaari/memory-core hook install
|
|
290
254
|
```
|
|
291
255
|
|
|
292
|
-
Installs a git pre-commit hook. Every `git commit
|
|
256
|
+
Installs a git pre-commit hook. Every time you run `git commit`, your staged files are checked against your architecture rules before the commit goes through.
|
|
257
|
+
|
|
258
|
+
When a violation is found, the commit is blocked and you see exactly what's wrong and how to fix it:
|
|
293
259
|
|
|
294
260
|
```
|
|
295
261
|
✗ 2 rule violations found — commit blocked
|
|
296
262
|
|
|
297
263
|
[1] src/controllers/user.ts:32
|
|
298
264
|
Rule: Thin controllers — business logic belongs in services
|
|
299
|
-
Why: Logic in controllers cannot be reused from
|
|
300
|
-
|
|
265
|
+
Why: Logic in controllers cannot be reused from other entry points
|
|
266
|
+
— it gets siloed and duplicated across handlers
|
|
301
267
|
Issue: Password validation logic inside route handler
|
|
302
268
|
Fix: Move to UserService.validateCredentials()
|
|
303
269
|
|
|
304
270
|
[2] src/domain/user.entity.ts:5
|
|
305
271
|
Rule: Domain has zero external imports
|
|
306
|
-
Why: Framework imports
|
|
307
|
-
infrastructure — you can't swap the DB or test without spinning up the stack
|
|
272
|
+
Why: Framework imports tie business logic to infrastructure
|
|
308
273
|
Issue: Imports 'typeorm' directly
|
|
309
|
-
Fix: Define IUserRepository interface in domain
|
|
274
|
+
Fix: Define IUserRepository interface in domain/
|
|
310
275
|
|
|
311
|
-
To bypass
|
|
276
|
+
To bypass: git commit --no-verify
|
|
312
277
|
To save as memory: memory-core remember "<lesson>"
|
|
313
278
|
```
|
|
314
279
|
|
|
@@ -318,13 +283,13 @@ npx @shahmilsaari/memory-core hook uninstall # remove the hook
|
|
|
318
283
|
|
|
319
284
|
---
|
|
320
285
|
|
|
321
|
-
### `watch` —
|
|
286
|
+
### `watch` — Catch violations as you type
|
|
322
287
|
|
|
323
288
|
```bash
|
|
324
289
|
npx @shahmilsaari/memory-core watch
|
|
325
290
|
```
|
|
326
291
|
|
|
327
|
-
Runs in
|
|
292
|
+
Runs in the background and checks each file the moment you save it. You see violations immediately — before you even think about committing.
|
|
328
293
|
|
|
329
294
|
```
|
|
330
295
|
archmind watch — real-time rule enforcement
|
|
@@ -340,44 +305,41 @@ Runs in your terminal and checks every source file as you save it. Violations pr
|
|
|
340
305
|
|
|
341
306
|
[1] src/controllers/user.ts:34
|
|
342
307
|
Rule: Thin controllers — business logic belongs in services
|
|
343
|
-
Why: Logic in controllers cannot be reused from
|
|
344
|
-
entry points — it gets siloed and duplicated across handlers
|
|
308
|
+
Why: Logic in controllers cannot be reused from other entry points
|
|
345
309
|
Issue: Password hashing inside the route handler
|
|
346
310
|
Fix: Move to UserService.hashPassword()
|
|
347
|
-
|
|
348
|
-
Fix violations or run: memory-core remember "<lesson>"
|
|
349
311
|
```
|
|
350
312
|
|
|
351
313
|
Options:
|
|
352
314
|
```bash
|
|
353
|
-
npx @shahmilsaari/memory-core watch --path src/
|
|
354
|
-
npx @shahmilsaari/memory-core watch --verbose
|
|
315
|
+
npx @shahmilsaari/memory-core watch --path src/ # watch a specific folder only
|
|
316
|
+
npx @shahmilsaari/memory-core watch --verbose # show extra details
|
|
355
317
|
```
|
|
356
318
|
|
|
357
|
-
|
|
319
|
+
Only checks source files — ignores `node_modules`, `dist`, config files, JSON, etc.
|
|
358
320
|
|
|
359
321
|
---
|
|
360
322
|
|
|
361
|
-
### `check` — Manual
|
|
323
|
+
### `check` — Manual check (for CI)
|
|
362
324
|
|
|
363
325
|
```bash
|
|
364
326
|
npx @shahmilsaari/memory-core check --staged # check staged files
|
|
365
|
-
npx @shahmilsaari/memory-core check --staged --verbose #
|
|
327
|
+
npx @shahmilsaari/memory-core check --staged --verbose # with extra detail
|
|
366
328
|
```
|
|
367
329
|
|
|
368
|
-
Same as the pre-commit hook
|
|
330
|
+
Same as the pre-commit hook. Use this in CI/CD pipelines.
|
|
369
331
|
|
|
370
332
|
---
|
|
371
333
|
|
|
372
|
-
### `global` —
|
|
373
|
-
|
|
374
|
-
Writes your rules to the global config of every installed agent — so they follow your rules in every project without running `init`:
|
|
334
|
+
### `global` — Apply rules to every project
|
|
375
335
|
|
|
376
336
|
```bash
|
|
377
337
|
npx @shahmilsaari/memory-core global
|
|
378
338
|
```
|
|
379
339
|
|
|
380
|
-
|
|
340
|
+
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.
|
|
341
|
+
|
|
342
|
+
| Agent | Where it writes |
|
|
381
343
|
|---|---|
|
|
382
344
|
| Claude Code | `~/.claude/CLAUDE.md` |
|
|
383
345
|
| GitHub Copilot | VS Code `settings.json` |
|
|
@@ -390,63 +352,89 @@ npx @shahmilsaari/memory-core global
|
|
|
390
352
|
|
|
391
353
|
---
|
|
392
354
|
|
|
355
|
+
## Supported agents
|
|
356
|
+
|
|
357
|
+
| Agent | File generated |
|
|
358
|
+
|---|---|
|
|
359
|
+
| Claude Code | `CLAUDE.md` |
|
|
360
|
+
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
361
|
+
| Cursor | `.cursorrules` + `.cursor/rules/memory-core.mdc` |
|
|
362
|
+
| Windsurf | `.windsurfrules` |
|
|
363
|
+
| Cline | `.clinerules` |
|
|
364
|
+
| Roo Code | `.roo/rules/memory-core.md` |
|
|
365
|
+
| Aider | `.aider.conf.yml` |
|
|
366
|
+
| Continue.dev | `.continue/config.json` |
|
|
367
|
+
| Devin | `DEVIN.md` |
|
|
368
|
+
| Amazon Q | `.amazonq/dev/guidelines.md` |
|
|
369
|
+
| Gemini Code Assist | `.gemini/styleguide.md` |
|
|
370
|
+
| Zed AI | `.zed/settings.json` |
|
|
371
|
+
| JetBrains AI | `.idea/ai-instructions.md` |
|
|
372
|
+
| OpenHands | `AGENTS.md` |
|
|
373
|
+
|
|
374
|
+
Plus shared files: `AI_RULES.md`, `ARCHITECTURE.md`, `PROJECT_MEMORY.md`
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
393
378
|
## Architecture profiles
|
|
394
379
|
|
|
395
|
-
|
|
396
|
-
|
|
380
|
+
Pick the one that matches how your project is structured.
|
|
381
|
+
|
|
382
|
+
**Backend**
|
|
383
|
+
| Profile | Use when… |
|
|
397
384
|
|---|---|
|
|
398
|
-
|
|
|
399
|
-
|
|
|
400
|
-
|
|
|
401
|
-
|
|
|
402
|
-
|
|
|
403
|
-
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
| Profile |
|
|
385
|
+
| Clean Architecture | You want strict separation between domain, application, and infrastructure |
|
|
386
|
+
| Modular Monolith | You're building feature modules that might become microservices later |
|
|
387
|
+
| MVC | Standard web app with controllers and services |
|
|
388
|
+
| Hexagonal | You want ports and adapters for maximum testability |
|
|
389
|
+
| Next.js | Next.js 13+ with server components and server actions |
|
|
390
|
+
| Laravel | Laravel with service-repository pattern |
|
|
391
|
+
|
|
392
|
+
**Frontend**
|
|
393
|
+
| Profile | Use when… |
|
|
407
394
|
|---|---|
|
|
408
|
-
|
|
|
409
|
-
|
|
|
410
|
-
|
|
|
411
|
-
|
|
|
412
|
-
|
|
|
413
|
-
|
|
|
395
|
+
| React | Functional components, hooks, React Query, Zustand |
|
|
396
|
+
| Vue 3 | Composition API, Pinia, composables |
|
|
397
|
+
| Angular | Standalone components, signals, OnPush strategy |
|
|
398
|
+
| Svelte | Svelte 5 runes, SvelteKit load functions |
|
|
399
|
+
| Nuxt 3 | Fullstack Vue with SSR |
|
|
400
|
+
| React Native | Mobile apps |
|
|
414
401
|
|
|
415
|
-
Fullstack projects get
|
|
402
|
+
Fullstack projects get both sections in every generated file.
|
|
416
403
|
|
|
417
404
|
---
|
|
418
405
|
|
|
419
|
-
## Caveman
|
|
406
|
+
## Caveman mode (optional)
|
|
420
407
|
|
|
421
|
-
|
|
408
|
+
Cuts AI response length by 65–75% by removing filler words. Opt in during `init`.
|
|
422
409
|
|
|
423
|
-
| Level |
|
|
410
|
+
| Level | What it does |
|
|
424
411
|
|---|---|
|
|
425
|
-
| `lite` | Professional
|
|
426
|
-
| `full` | Caveman
|
|
427
|
-
| `ultra` |
|
|
412
|
+
| `lite` | Professional and concise |
|
|
413
|
+
| `full` | Caveman-style short answers |
|
|
414
|
+
| `ultra` | Absolute minimum words |
|
|
428
415
|
|
|
429
416
|
---
|
|
430
417
|
|
|
431
|
-
##
|
|
418
|
+
## Day-to-day workflow
|
|
432
419
|
|
|
433
420
|
```bash
|
|
434
|
-
#
|
|
421
|
+
# Starting a new project
|
|
435
422
|
cd my-api
|
|
436
423
|
npx @shahmilsaari/memory-core init
|
|
424
|
+
npx @shahmilsaari/memory-core seed
|
|
437
425
|
npx @shahmilsaari/memory-core hook install
|
|
438
426
|
|
|
439
|
-
#
|
|
440
|
-
npx @shahmilsaari/memory-core remember "All auth goes through middleware, never
|
|
427
|
+
# Made an architectural decision? Save it.
|
|
428
|
+
npx @shahmilsaari/memory-core remember "All auth goes through middleware, never in controllers" \
|
|
441
429
|
--type decision --scope global
|
|
442
430
|
|
|
443
|
-
#
|
|
431
|
+
# Refresh agent files after saving new memories
|
|
444
432
|
npx @shahmilsaari/memory-core sync
|
|
445
433
|
|
|
446
|
-
#
|
|
434
|
+
# Not sure how something was decided? Search.
|
|
447
435
|
npx @shahmilsaari/memory-core search "caching strategy"
|
|
448
436
|
|
|
449
|
-
#
|
|
437
|
+
# Commit code → hook checks it automatically
|
|
450
438
|
git commit -m "add user endpoint"
|
|
451
439
|
```
|
|
452
440
|
|
|
@@ -454,49 +442,51 @@ git commit -m "add user endpoint"
|
|
|
454
442
|
|
|
455
443
|
## Environment variables
|
|
456
444
|
|
|
457
|
-
|
|
445
|
+
memory-core creates `.memory-core.env` automatically during `init`. You can also set these manually:
|
|
446
|
+
|
|
447
|
+
| Variable | Required | Default | What it does |
|
|
458
448
|
|---|---|---|---|
|
|
459
449
|
| `DATABASE_URL` | Yes | — | PostgreSQL connection string |
|
|
460
|
-
| `OLLAMA_URL` | No | `http://localhost:11434` | Ollama
|
|
461
|
-
| `OLLAMA_MODEL` | No | `nomic-embed-text` |
|
|
462
|
-
| `OLLAMA_CHAT_MODEL` | No | `llama3.2` |
|
|
450
|
+
| `OLLAMA_URL` | No | `http://localhost:11434` | Where Ollama is running |
|
|
451
|
+
| `OLLAMA_MODEL` | No | `nomic-embed-text` | Model used for search |
|
|
452
|
+
| `OLLAMA_CHAT_MODEL` | No | `llama3.2` | Model used for code checking |
|
|
463
453
|
|
|
464
454
|
---
|
|
465
455
|
|
|
466
456
|
## Troubleshooting
|
|
467
457
|
|
|
468
458
|
**`extension "vector" is not available`**
|
|
469
|
-
pgvector
|
|
459
|
+
pgvector isn't installed for your PostgreSQL version. Follow the [pgvector install steps](#pgvector) above.
|
|
470
460
|
|
|
471
461
|
**`Ollama not running — skipping rule check`**
|
|
472
462
|
Start Ollama: `brew services start ollama` (macOS) or `ollama serve` (Linux).
|
|
473
463
|
|
|
474
464
|
**`Chat model "llama3.2" not found`**
|
|
475
|
-
|
|
465
|
+
Run `ollama pull llama3.2`. Or switch to another model: add `OLLAMA_CHAT_MODEL=mistral` to `.memory-core.env`.
|
|
476
466
|
|
|
477
467
|
**`DATABASE_URL is not set`**
|
|
478
|
-
|
|
468
|
+
Run `npx @shahmilsaari/memory-core init` — it will create the `.memory-core.env` file for you.
|
|
479
469
|
|
|
480
470
|
**`createdb: role does not exist`**
|
|
481
471
|
```bash
|
|
482
472
|
createuser -s $(whoami)
|
|
483
473
|
```
|
|
484
474
|
|
|
485
|
-
**
|
|
486
|
-
|
|
475
|
+
**Hook is flagging JSON or config files**
|
|
476
|
+
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.
|
|
487
477
|
|
|
488
478
|
---
|
|
489
479
|
|
|
490
480
|
## Roadmap
|
|
491
481
|
|
|
492
|
-
|
|
|
482
|
+
| | Feature |
|
|
493
483
|
|---|---|
|
|
494
|
-
|
|
|
495
|
-
|
|
|
496
|
-
| Violation memory
|
|
497
|
-
| Rule analytics
|
|
498
|
-
| Team sync
|
|
499
|
-
| Memory review
|
|
484
|
+
| ✓ | Watch mode — real-time violation alerts on save |
|
|
485
|
+
| | CI/CD — fail PRs that violate your rules |
|
|
486
|
+
| | Violation memory — auto-save what went wrong as a new rule |
|
|
487
|
+
| | Rule analytics — see which rules get broken most |
|
|
488
|
+
| | Team sync — share memory across your whole team |
|
|
489
|
+
| | Memory review — approve rules before they propagate |
|
|
500
490
|
|
|
501
491
|
---
|
|
502
492
|
|
package/dist/cli.js
CHANGED
|
@@ -789,14 +789,6 @@ import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
|
|
|
789
789
|
import { join as join5, relative } from "path";
|
|
790
790
|
import chalk2 from "chalk";
|
|
791
791
|
var SOURCE_EXTENSIONS = /\.(ts|tsx|js|jsx|py|php|rb|go|java|cs|swift|kt|rs|vue|svelte)$/;
|
|
792
|
-
var IGNORE_PATTERNS = [
|
|
793
|
-
/node_modules/,
|
|
794
|
-
/\.git/,
|
|
795
|
-
/dist\//,
|
|
796
|
-
/build\//,
|
|
797
|
-
/coverage\//,
|
|
798
|
-
/\.memory-core/
|
|
799
|
-
];
|
|
800
792
|
var reasonMap2 = new Map(
|
|
801
793
|
seeds.filter((s) => s.reason).map((s) => [s.content, s.reason])
|
|
802
794
|
);
|
|
@@ -966,17 +958,22 @@ function startWatch(options = {}) {
|
|
|
966
958
|
const pending = /* @__PURE__ */ new Map();
|
|
967
959
|
let ollamaWarned = false;
|
|
968
960
|
const watcher = watch(watchPath, {
|
|
969
|
-
ignored:
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
961
|
+
ignored: [
|
|
962
|
+
"**/node_modules/**",
|
|
963
|
+
"**/.git/**",
|
|
964
|
+
"**/dist/**",
|
|
965
|
+
"**/build/**",
|
|
966
|
+
"**/coverage/**",
|
|
967
|
+
"**/.memory-core*"
|
|
968
|
+
],
|
|
975
969
|
ignoreInitial: true,
|
|
976
970
|
persistent: true,
|
|
977
971
|
awaitWriteFinish: { stabilityThreshold: 150, pollInterval: 50 }
|
|
978
972
|
});
|
|
973
|
+
const keepAlive = setInterval(() => {
|
|
974
|
+
}, 1 << 30);
|
|
979
975
|
const handle = (filePath) => {
|
|
976
|
+
if (!SOURCE_EXTENSIONS.test(filePath)) return;
|
|
980
977
|
if (pending.has(filePath)) clearTimeout(pending.get(filePath));
|
|
981
978
|
const timer = setTimeout(async () => {
|
|
982
979
|
pending.delete(filePath);
|
|
@@ -1005,6 +1002,7 @@ function startWatch(options = {}) {
|
|
|
1005
1002
|
});
|
|
1006
1003
|
process.on("SIGINT", () => {
|
|
1007
1004
|
console.log(chalk2.dim("\n\n archmind watch stopped.\n"));
|
|
1005
|
+
clearInterval(keepAlive);
|
|
1008
1006
|
watcher.close();
|
|
1009
1007
|
process.exit(0);
|
|
1010
1008
|
});
|
|
@@ -1039,6 +1037,7 @@ function printBanner(projectName, agentCount) {
|
|
|
1039
1037
|
];
|
|
1040
1038
|
lines.forEach((l) => console.log(l));
|
|
1041
1039
|
}
|
|
1040
|
+
var { version } = JSON.parse(readFileSync5(new URL("../package.json", import.meta.url), "utf-8"));
|
|
1042
1041
|
var CONFIG_FILE = ".memory-core.json";
|
|
1043
1042
|
function readProjectConfig() {
|
|
1044
1043
|
const path = join6(process.cwd(), CONFIG_FILE);
|
|
@@ -1053,7 +1052,7 @@ function writeProjectConfig(config2) {
|
|
|
1053
1052
|
writeFileSync3(join6(process.cwd(), CONFIG_FILE), JSON.stringify(config2, null, 2));
|
|
1054
1053
|
}
|
|
1055
1054
|
var program = new Command();
|
|
1056
|
-
program.name("memory-core").description("Universal AI memory core \u2014 generate AI context files for all coding agents").version(
|
|
1055
|
+
program.name("memory-core").description("Universal AI memory core \u2014 generate AI context files for all coding agents").version(version);
|
|
1057
1056
|
program.command("init").description("Initialize memory-core in the current project").action(async () => {
|
|
1058
1057
|
console.log(chalk3.bold.cyan("\n memory-core init\n"));
|
|
1059
1058
|
const detected = detectProject();
|