@shahmilsaari/memory-core 0.1.0 → 0.1.1
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 +234 -307
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,19 +1,34 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @shahmilsaari/memory-core
|
|
2
2
|
|
|
3
|
-
Universal AI memory
|
|
3
|
+
Universal AI memory for any project. Install once, and every AI coding agent — Copilot, Cursor, Claude Code, Windsurf, Cline, and 13 more — automatically follows your architecture rules, past decisions, and best practices. Backed by PostgreSQL + pgvector and fully local AI via Ollama. No OpenAI key required.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx @shahmilsaari/memory-core init
|
|
7
|
+
```
|
|
4
8
|
|
|
5
9
|
---
|
|
6
10
|
|
|
7
11
|
## How it works
|
|
8
12
|
|
|
9
13
|
```
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
17
32
|
```
|
|
18
33
|
|
|
19
34
|
---
|
|
@@ -21,10 +36,10 @@ Your central PostgreSQL database (memories + rules)
|
|
|
21
36
|
## Supported agents
|
|
22
37
|
|
|
23
38
|
| Agent | File generated |
|
|
24
|
-
|
|
39
|
+
|---|---|
|
|
40
|
+
| Claude Code | `CLAUDE.md` |
|
|
25
41
|
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
26
42
|
| Cursor | `.cursorrules` + `.cursor/rules/memory-core.mdc` |
|
|
27
|
-
| Claude Code | `CLAUDE.md` |
|
|
28
43
|
| Windsurf | `.windsurfrules` |
|
|
29
44
|
| Cline | `.clinerules` |
|
|
30
45
|
| Roo Code | `.roo/rules/memory-core.md` |
|
|
@@ -35,195 +50,155 @@ Your central PostgreSQL database (memories + rules)
|
|
|
35
50
|
| Gemini Code Assist | `.gemini/styleguide.md` |
|
|
36
51
|
| Zed AI | `.zed/settings.json` |
|
|
37
52
|
| JetBrains AI | `.idea/ai-instructions.md` |
|
|
53
|
+
| OpenHands / AGENTS | `AGENTS.md` |
|
|
38
54
|
|
|
39
|
-
Plus: `
|
|
55
|
+
Plus: `AI_RULES.md`, `ARCHITECTURE.md`, `PROJECT_MEMORY.md`
|
|
40
56
|
|
|
41
57
|
---
|
|
42
58
|
|
|
43
59
|
## Prerequisites
|
|
44
60
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
| Requirement | Purpose |
|
|
62
|
+
|---|---|
|
|
63
|
+
| PostgreSQL 14+ | Memory storage |
|
|
64
|
+
| pgvector | Semantic similarity search |
|
|
65
|
+
| Ollama + `nomic-embed-text` | Free local embeddings (no API key) |
|
|
66
|
+
| Ollama + `llama3.2` | Pre-commit rule checking |
|
|
50
67
|
|
|
51
68
|
---
|
|
52
69
|
|
|
53
|
-
##
|
|
70
|
+
## Setup
|
|
54
71
|
|
|
55
|
-
###
|
|
72
|
+
### 1. PostgreSQL
|
|
56
73
|
|
|
74
|
+
**macOS**
|
|
57
75
|
```bash
|
|
58
76
|
brew install postgresql@16
|
|
59
77
|
brew services start postgresql@16
|
|
60
78
|
```
|
|
61
79
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
psql -U $(whoami) -l
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Linux (Ubuntu/Debian)
|
|
69
|
-
|
|
80
|
+
**Linux**
|
|
70
81
|
```bash
|
|
71
82
|
sudo apt install postgresql postgresql-contrib
|
|
72
83
|
sudo systemctl start postgresql
|
|
73
84
|
```
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Download and install from [postgresql.org](https://www.postgresql.org/download/windows/).
|
|
86
|
+
**Windows** — download from [postgresql.org](https://www.postgresql.org/download/windows/)
|
|
78
87
|
|
|
79
88
|
---
|
|
80
89
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
pgvector adds vector similarity search to PostgreSQL. It must be built for your exact PostgreSQL version.
|
|
84
|
-
|
|
85
|
-
### macOS with PostgreSQL@16 (Homebrew)
|
|
86
|
-
|
|
87
|
-
The brew pgvector package targets pg17+, so build from source:
|
|
90
|
+
### 2. pgvector
|
|
88
91
|
|
|
92
|
+
**macOS with PostgreSQL@16** (brew pgvector only targets pg17+, build from source):
|
|
89
93
|
```bash
|
|
90
|
-
# Install build tools if needed
|
|
91
94
|
xcode-select --install
|
|
92
|
-
|
|
93
|
-
# Clone and build for PostgreSQL@16
|
|
94
95
|
git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git /tmp/pgvector
|
|
95
96
|
cd /tmp/pgvector
|
|
96
97
|
make PG_CONFIG=/opt/homebrew/opt/postgresql@16/bin/pg_config
|
|
97
98
|
make install PG_CONFIG=/opt/homebrew/opt/postgresql@16/bin/pg_config
|
|
98
99
|
```
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
**macOS with PostgreSQL@17+**
|
|
102
102
|
```bash
|
|
103
103
|
brew install pgvector
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
**Linux**
|
|
108
107
|
```bash
|
|
109
|
-
sudo apt install postgresql-16-pgvector
|
|
110
|
-
# Replace 16 with your PostgreSQL version
|
|
108
|
+
sudo apt install postgresql-16-pgvector # replace 16 with your version
|
|
111
109
|
```
|
|
112
110
|
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
Verify:
|
|
115
112
|
```bash
|
|
116
113
|
psql -U $(whoami) -c "SELECT * FROM pg_available_extensions WHERE name = 'vector';"
|
|
117
114
|
```
|
|
118
115
|
|
|
119
|
-
You should see a row with `name = vector`.
|
|
120
|
-
|
|
121
116
|
---
|
|
122
117
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Ollama runs the embedding model locally. No API key or internet connection required after setup.
|
|
126
|
-
|
|
127
|
-
### macOS
|
|
118
|
+
### 3. Ollama
|
|
128
119
|
|
|
120
|
+
**macOS**
|
|
129
121
|
```bash
|
|
130
122
|
brew install ollama
|
|
131
123
|
brew services start ollama
|
|
132
124
|
```
|
|
133
125
|
|
|
134
|
-
|
|
135
|
-
|
|
126
|
+
**Linux**
|
|
136
127
|
```bash
|
|
137
128
|
curl -fsSL https://ollama.com/install.sh | sh
|
|
138
129
|
ollama serve &
|
|
139
130
|
```
|
|
140
131
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Download from [ollama.com](https://ollama.com/download).
|
|
144
|
-
|
|
145
|
-
### Pull the embedding model
|
|
132
|
+
**Windows** — download from [ollama.com](https://ollama.com/download)
|
|
146
133
|
|
|
134
|
+
Pull the required models:
|
|
147
135
|
```bash
|
|
148
|
-
ollama pull nomic-embed-text
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
Verify Ollama is running:
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
curl http://localhost:11434
|
|
155
|
-
# Expected: "Ollama is running"
|
|
136
|
+
ollama pull nomic-embed-text # embeddings — used by remember/search/sync
|
|
137
|
+
ollama pull llama3.2 # code analysis — used by pre-commit hook
|
|
156
138
|
```
|
|
157
139
|
|
|
158
140
|
---
|
|
159
141
|
|
|
160
|
-
|
|
142
|
+
### 4. Create the database
|
|
161
143
|
|
|
162
144
|
```bash
|
|
163
145
|
createdb memory_core
|
|
164
146
|
```
|
|
165
147
|
|
|
166
|
-
Then run the
|
|
167
|
-
|
|
148
|
+
Then run the schema (get `setup.sql` from the repo or copy below):
|
|
168
149
|
```bash
|
|
169
150
|
psql -U $(whoami) -d memory_core -f setup.sql
|
|
170
151
|
```
|
|
171
152
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
CREATE EXTENSION
|
|
176
|
-
CREATE TABLE
|
|
177
|
-
CREATE INDEX
|
|
178
|
-
CREATE INDEX
|
|
179
|
-
CREATE INDEX
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## 5. Install the package
|
|
185
|
-
|
|
186
|
-
### Use without installing (recommended)
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
npx @archmind/memory-core init
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### Or install globally
|
|
153
|
+
`setup.sql` contents:
|
|
154
|
+
```sql
|
|
155
|
+
CREATE EXTENSION IF NOT EXISTS vector;
|
|
193
156
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
157
|
+
CREATE TABLE IF NOT EXISTS memories (
|
|
158
|
+
id BIGSERIAL PRIMARY KEY,
|
|
159
|
+
type TEXT NOT NULL,
|
|
160
|
+
scope TEXT NOT NULL DEFAULT 'project',
|
|
161
|
+
architecture TEXT,
|
|
162
|
+
project_name TEXT,
|
|
163
|
+
title TEXT,
|
|
164
|
+
content TEXT NOT NULL,
|
|
165
|
+
reason TEXT,
|
|
166
|
+
tags TEXT[] DEFAULT '{}',
|
|
167
|
+
embedding vector(768),
|
|
168
|
+
created_at TIMESTAMP DEFAULT now()
|
|
169
|
+
);
|
|
198
170
|
|
|
199
|
-
|
|
171
|
+
CREATE INDEX IF NOT EXISTS memories_embedding_idx
|
|
172
|
+
ON memories USING ivfflat (embedding vector_cosine_ops)
|
|
173
|
+
WITH (lists = 100);
|
|
200
174
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
cd memory-core
|
|
204
|
-
npm install
|
|
205
|
-
npm run build
|
|
206
|
-
node dist/cli.js init
|
|
175
|
+
CREATE INDEX IF NOT EXISTS memories_architecture_idx ON memories (architecture);
|
|
176
|
+
CREATE INDEX IF NOT EXISTS memories_scope_idx ON memories (scope);
|
|
207
177
|
```
|
|
208
178
|
|
|
209
179
|
---
|
|
210
180
|
|
|
211
|
-
|
|
181
|
+
### 5. Configure environment
|
|
212
182
|
|
|
213
|
-
Create
|
|
183
|
+
Create `.env` in the project where you run memory-core (or `.memory-core.env` per project):
|
|
214
184
|
|
|
215
185
|
```env
|
|
216
186
|
DATABASE_URL=postgresql://YOUR_USERNAME@localhost:5432/memory_core
|
|
217
187
|
OLLAMA_URL=http://localhost:11434
|
|
218
188
|
OLLAMA_MODEL=nomic-embed-text
|
|
189
|
+
OLLAMA_CHAT_MODEL=llama3.2
|
|
219
190
|
```
|
|
220
191
|
|
|
221
|
-
|
|
192
|
+
Find your username: `whoami`
|
|
193
|
+
|
|
194
|
+
---
|
|
222
195
|
|
|
223
|
-
|
|
196
|
+
### 6. Seed the database
|
|
197
|
+
|
|
198
|
+
Load 192 predefined best-practice rules (each with a reason explaining why it exists):
|
|
224
199
|
|
|
225
200
|
```bash
|
|
226
|
-
|
|
201
|
+
npx @shahmilsaari/memory-core seed
|
|
227
202
|
```
|
|
228
203
|
|
|
229
204
|
---
|
|
@@ -232,304 +207,256 @@ whoami
|
|
|
232
207
|
|
|
233
208
|
### `init` — Set up a project
|
|
234
209
|
|
|
235
|
-
Run once inside any Git project:
|
|
236
|
-
|
|
237
210
|
```bash
|
|
238
|
-
cd
|
|
239
|
-
npx @
|
|
211
|
+
cd your-project
|
|
212
|
+
npx @shahmilsaari/memory-core init
|
|
240
213
|
```
|
|
241
214
|
|
|
242
|
-
|
|
243
|
-
|
|
215
|
+
Interactive prompts:
|
|
244
216
|
```
|
|
245
|
-
Project name?
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
217
|
+
Project name? → my-api
|
|
218
|
+
Project type? → Backend / Frontend / Fullstack
|
|
219
|
+
Backend architecture? → Clean Architecture
|
|
220
|
+
Frontend framework? → (skipped for backend-only)
|
|
221
|
+
Language? → TypeScript
|
|
222
|
+
Install caveman? → no
|
|
251
223
|
```
|
|
252
224
|
|
|
253
|
-
|
|
225
|
+
Generates all 18 agent config files and saves `.memory-core.json`.
|
|
254
226
|
|
|
255
227
|
---
|
|
256
228
|
|
|
257
|
-
### `sync` —
|
|
258
|
-
|
|
259
|
-
After adding new memories, regenerate all agent files:
|
|
229
|
+
### `sync` — Regenerate all agent files
|
|
260
230
|
|
|
261
231
|
```bash
|
|
262
|
-
npx @
|
|
232
|
+
npx @shahmilsaari/memory-core sync
|
|
263
233
|
```
|
|
264
234
|
|
|
265
|
-
|
|
235
|
+
Re-pulls memories from the DB and rewrites all 18 files. Run after `remember` or `seed`.
|
|
266
236
|
|
|
267
237
|
---
|
|
268
238
|
|
|
269
239
|
### `remember` — Save a decision
|
|
270
240
|
|
|
271
241
|
```bash
|
|
272
|
-
npx @
|
|
242
|
+
npx @shahmilsaari/memory-core remember "Controllers must never call the database directly"
|
|
273
243
|
```
|
|
274
244
|
|
|
275
|
-
|
|
245
|
+
Prompts: _"Why does this rule exist?"_ — the reason is stored and shown to agents and developers when a violation is caught.
|
|
276
246
|
|
|
247
|
+
With flags:
|
|
277
248
|
```bash
|
|
278
|
-
npx @
|
|
249
|
+
npx @shahmilsaari/memory-core remember "Use DTOs for all API responses" \
|
|
279
250
|
--type rule \
|
|
280
251
|
--scope global \
|
|
252
|
+
--reason "Raw DB entities leak internal schema and expose sensitive fields to clients" \
|
|
281
253
|
--tags "api,dto,response"
|
|
282
254
|
```
|
|
283
255
|
|
|
284
|
-
|
|
|
285
|
-
|
|
286
|
-
| `--type` | `decision
|
|
287
|
-
| `--scope` | `global
|
|
256
|
+
| Flag | Values | Default |
|
|
257
|
+
|---|---|---|
|
|
258
|
+
| `--type` | `decision` `rule` `pattern` `note` | `decision` |
|
|
259
|
+
| `--scope` | `global` `project` | `project` |
|
|
260
|
+
| `--reason` | free text | prompted interactively |
|
|
288
261
|
| `--tags` | comma-separated | none |
|
|
289
262
|
|
|
290
263
|
---
|
|
291
264
|
|
|
292
|
-
### `
|
|
293
|
-
|
|
294
|
-
Injects your memories into the global config of **every AI agent** — so all of them follow your rules in every project, without running `init`.
|
|
265
|
+
### `search` — Semantic search
|
|
295
266
|
|
|
296
267
|
```bash
|
|
297
|
-
npx @
|
|
268
|
+
npx @shahmilsaari/memory-core search "error handling"
|
|
269
|
+
npx @shahmilsaari/memory-core search "auth strategy" --limit 10
|
|
298
270
|
```
|
|
299
271
|
|
|
300
|
-
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
### `seed` — Load predefined rules
|
|
301
275
|
|
|
302
276
|
```bash
|
|
303
|
-
npx @
|
|
277
|
+
npx @shahmilsaari/memory-core seed
|
|
278
|
+
npx @shahmilsaari/memory-core seed --arch clean-architecture # one architecture only
|
|
279
|
+
npx @shahmilsaari/memory-core seed --force # re-seed existing entries
|
|
304
280
|
```
|
|
305
281
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
| Agent | Global file written |
|
|
309
|
-
|-------|-------------------|
|
|
310
|
-
| Claude Code | `~/.claude/CLAUDE.md` |
|
|
311
|
-
| GitHub Copilot | VS Code `settings.json` → `github.copilot.chat.codeGeneration.instructions` |
|
|
312
|
-
| Cursor | `~/.cursor/rules/memory-core.mdc` |
|
|
313
|
-
| Cline | VS Code `settings.json` → `cline.customInstructions` |
|
|
314
|
-
| Continue.dev | `~/.continue/config.json` → `systemMessage` |
|
|
315
|
-
| Aider | `~/.aider.conf.yml` |
|
|
316
|
-
| Zed AI | `~/.config/zed/settings.json` → `assistant.system_prompt` |
|
|
317
|
-
| Windsurf | `~/.windsurf/rules/memory-core.md` |
|
|
318
|
-
|
|
319
|
-
Run this again after `memory-core remember` to keep all agents in sync.
|
|
282
|
+
192 rules across all architectures. Every rule includes a `reason` explaining why it exists.
|
|
320
283
|
|
|
321
284
|
---
|
|
322
285
|
|
|
323
|
-
### `
|
|
286
|
+
### `hook install` — Pre-commit enforcement
|
|
324
287
|
|
|
325
288
|
```bash
|
|
326
|
-
npx @
|
|
289
|
+
npx @shahmilsaari/memory-core hook install
|
|
327
290
|
```
|
|
328
291
|
|
|
329
|
-
|
|
292
|
+
Installs a git pre-commit hook. Every `git commit` automatically checks staged source files against your architecture rules using Ollama (llama3.2). Violations are blocked with full context:
|
|
330
293
|
|
|
331
|
-
```bash
|
|
332
|
-
npx @archmind/memory-core search "database access" --limit 10
|
|
333
294
|
```
|
|
295
|
+
✗ 2 rule violations found — commit blocked
|
|
334
296
|
|
|
335
|
-
|
|
297
|
+
[1] src/controllers/user.ts:32
|
|
298
|
+
Rule: Thin controllers — business logic belongs in services
|
|
299
|
+
Why: Logic in controllers cannot be reused from CLI, queues, or other
|
|
300
|
+
entry points — it gets siloed and duplicated across handlers
|
|
301
|
+
Issue: Password validation logic inside route handler
|
|
302
|
+
Fix: Move to UserService.validateCredentials()
|
|
336
303
|
|
|
337
|
-
|
|
304
|
+
[2] src/domain/user.entity.ts:5
|
|
305
|
+
Rule: Domain has zero external imports
|
|
306
|
+
Why: Framework imports in the domain layer tie business logic to
|
|
307
|
+
infrastructure — you can't swap the DB or test without spinning up the stack
|
|
308
|
+
Issue: Imports 'typeorm' directly
|
|
309
|
+
Fix: Define IUserRepository interface in domain, implement in infrastructure/
|
|
338
310
|
|
|
339
|
-
|
|
311
|
+
To bypass (not recommended): git commit --no-verify
|
|
312
|
+
To save as memory: memory-core remember "<lesson>"
|
|
313
|
+
```
|
|
340
314
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
| **Modular Monolith** | Feature-based modules that could become microservices |
|
|
345
|
-
| **MVC** | Standard web apps with controllers, models, services |
|
|
346
|
-
| **Hexagonal Architecture** | Port/adapter isolation, highly testable cores |
|
|
347
|
-
| **Next.js App Router** | Next.js 13+ with server components and server actions |
|
|
348
|
-
| **Laravel Service Repository** | Laravel APIs with service and repository pattern |
|
|
315
|
+
```bash
|
|
316
|
+
npx @shahmilsaari/memory-core hook uninstall # remove the hook
|
|
317
|
+
```
|
|
349
318
|
|
|
350
319
|
---
|
|
351
320
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
During `init` you can enable [caveman](https://github.com/juliusbrussee/caveman), which compresses AI responses by 65–75% while keeping them accurate.
|
|
355
|
-
|
|
356
|
-
Choose intensity:
|
|
321
|
+
### `check` — Manual rule check
|
|
357
322
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
| `ultra` | Telegraphic, minimum words |
|
|
323
|
+
```bash
|
|
324
|
+
npx @shahmilsaari/memory-core check --staged # check staged files
|
|
325
|
+
npx @shahmilsaari/memory-core check --staged --verbose # show model + diff details
|
|
326
|
+
```
|
|
363
327
|
|
|
364
|
-
|
|
328
|
+
Same as the pre-commit hook — useful in CI/CD pipelines.
|
|
365
329
|
|
|
366
330
|
---
|
|
367
331
|
|
|
368
|
-
|
|
332
|
+
### `global` — Sync to all agents globally
|
|
369
333
|
|
|
370
|
-
|
|
334
|
+
Writes your rules to the global config of every installed agent — so they follow your rules in every project without running `init`:
|
|
371
335
|
|
|
372
336
|
```bash
|
|
373
|
-
|
|
374
|
-
cd new-api
|
|
375
|
-
npx @archmind/memory-core init
|
|
337
|
+
npx @shahmilsaari/memory-core global
|
|
376
338
|
```
|
|
377
339
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
340
|
+
| Agent | Global file |
|
|
341
|
+
|---|---|
|
|
342
|
+
| Claude Code | `~/.claude/CLAUDE.md` |
|
|
343
|
+
| GitHub Copilot | VS Code `settings.json` |
|
|
344
|
+
| Cursor | `~/.cursor/rules/memory-core.mdc` |
|
|
345
|
+
| Cline | VS Code `settings.json` |
|
|
346
|
+
| Continue.dev | `~/.continue/config.json` |
|
|
347
|
+
| Aider | `~/.aider.conf.yml` |
|
|
348
|
+
| Zed AI | `~/.config/zed/settings.json` |
|
|
349
|
+
| Windsurf | `~/.windsurf/rules/memory-core.md` |
|
|
388
350
|
|
|
389
|
-
|
|
351
|
+
---
|
|
390
352
|
|
|
391
|
-
|
|
392
|
-
npx @archmind/memory-core sync
|
|
393
|
-
```
|
|
353
|
+
## Architecture profiles
|
|
394
354
|
|
|
395
|
-
###
|
|
355
|
+
### Backend
|
|
356
|
+
| Profile | Best for |
|
|
357
|
+
|---|---|
|
|
358
|
+
| **Clean Architecture** | Domain-driven APIs, strict layer separation |
|
|
359
|
+
| **Modular Monolith** | Feature modules that could become microservices |
|
|
360
|
+
| **MVC** | Standard web apps, controllers + services |
|
|
361
|
+
| **Hexagonal** | Port/adapter isolation, highly testable cores |
|
|
362
|
+
| **Next.js** | Next.js 13+ fullstack (server components + actions) |
|
|
363
|
+
| **Laravel** | Laravel APIs with service-repository pattern |
|
|
364
|
+
|
|
365
|
+
### Frontend
|
|
366
|
+
| Profile | Best for |
|
|
367
|
+
|---|---|
|
|
368
|
+
| **React** | Functional components, hooks, React Query, Zustand |
|
|
369
|
+
| **Vue 3** | Composition API, Pinia, composables |
|
|
370
|
+
| **Angular** | Standalone components, signals, OnPush |
|
|
371
|
+
| **Svelte** | Svelte 5 runes, SvelteKit load functions |
|
|
372
|
+
| **Nuxt 3** | Fullstack Vue with SSR, server routes |
|
|
373
|
+
| **React Native** | Mobile apps, FlatList, secure storage |
|
|
396
374
|
|
|
397
|
-
|
|
398
|
-
npx @archmind/memory-core search "error handling strategy"
|
|
399
|
-
```
|
|
375
|
+
Fullstack projects get dual sections — one for backend, one for frontend — in every generated agent file.
|
|
400
376
|
|
|
401
377
|
---
|
|
402
378
|
|
|
403
|
-
##
|
|
404
|
-
|
|
405
|
-
```
|
|
406
|
-
memory-core/
|
|
407
|
-
src/
|
|
408
|
-
cli.ts ← CLI entry point (init, sync, remember, search)
|
|
409
|
-
config.ts ← Environment config loader
|
|
410
|
-
db.ts ← PostgreSQL connection + memory CRUD
|
|
411
|
-
embedding.ts ← Ollama embedding calls
|
|
412
|
-
retriever.ts ← Semantic search via pgvector
|
|
413
|
-
generator.ts ← Profile loader + Handlebars renderer + file writer
|
|
414
|
-
project-detector.ts ← Auto-detect language/framework from project files
|
|
415
|
-
|
|
416
|
-
profiles/ ← Architecture profile YAML files
|
|
417
|
-
clean-architecture.yml
|
|
418
|
-
modular-monolith.yml
|
|
419
|
-
mvc.yml
|
|
420
|
-
hexagonal.yml
|
|
421
|
-
nextjs.yml
|
|
422
|
-
laravel-service-repository.yml
|
|
423
|
-
|
|
424
|
-
templates/ ← Handlebars templates for each AI agent
|
|
425
|
-
CLAUDE.md.hbs
|
|
426
|
-
copilot-instructions.md.hbs
|
|
427
|
-
cursorrules.hbs
|
|
428
|
-
cursor-rule.mdc.hbs
|
|
429
|
-
windsurfrules.hbs
|
|
430
|
-
clinerules.hbs
|
|
431
|
-
roo-rule.md.hbs
|
|
432
|
-
aider.conf.yml.hbs
|
|
433
|
-
continue-config.json.hbs
|
|
434
|
-
DEVIN.md.hbs
|
|
435
|
-
amazonq-guidelines.md.hbs
|
|
436
|
-
gemini-styleguide.md.hbs
|
|
437
|
-
zed-settings.json.hbs
|
|
438
|
-
jetbrains-ai.md.hbs
|
|
439
|
-
AGENTS.md.hbs
|
|
440
|
-
AI_RULES.md.hbs
|
|
441
|
-
ARCHITECTURE.md.hbs
|
|
442
|
-
PROJECT_MEMORY.md.hbs
|
|
443
|
-
|
|
444
|
-
setup.sql ← PostgreSQL schema (run once)
|
|
445
|
-
.env.example ← Environment variable template
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
---
|
|
379
|
+
## Caveman token saver (optional)
|
|
449
380
|
|
|
450
|
-
|
|
381
|
+
Compresses AI responses 65–75% by stripping filler words. Enabled optionally during `init`. Injected into every agent file automatically.
|
|
451
382
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
architecture TEXT, -- clean-architecture | mvc | etc.
|
|
458
|
-
project_name TEXT,
|
|
459
|
-
title TEXT,
|
|
460
|
-
content TEXT NOT NULL,
|
|
461
|
-
tags TEXT[],
|
|
462
|
-
embedding vector(768), -- nomic-embed-text output
|
|
463
|
-
created_at TIMESTAMP DEFAULT now()
|
|
464
|
-
);
|
|
465
|
-
```
|
|
383
|
+
| Level | Style |
|
|
384
|
+
|---|---|
|
|
385
|
+
| `lite` | Professional terseness |
|
|
386
|
+
| `full` | Caveman mode |
|
|
387
|
+
| `ultra` | Telegraphic, minimum words |
|
|
466
388
|
|
|
467
389
|
---
|
|
468
390
|
|
|
469
|
-
##
|
|
391
|
+
## Typical workflow
|
|
470
392
|
|
|
471
|
-
|
|
393
|
+
```bash
|
|
394
|
+
# New project
|
|
395
|
+
cd my-api
|
|
396
|
+
npx @shahmilsaari/memory-core init
|
|
397
|
+
npx @shahmilsaari/memory-core hook install
|
|
472
398
|
|
|
473
|
-
|
|
399
|
+
# Save a decision mid-project
|
|
400
|
+
npx @shahmilsaari/memory-core remember "All auth goes through middleware, never duplicated in controllers" \
|
|
401
|
+
--type decision --scope global
|
|
474
402
|
|
|
475
|
-
|
|
403
|
+
# Sync agent files after new decisions
|
|
404
|
+
npx @shahmilsaari/memory-core sync
|
|
476
405
|
|
|
477
|
-
|
|
406
|
+
# Search before making an architectural decision
|
|
407
|
+
npx @shahmilsaari/memory-core search "caching strategy"
|
|
478
408
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
ollama serve # Linux / manual
|
|
409
|
+
# Try to commit code that breaks rules → hook blocks it with explanation
|
|
410
|
+
git commit -m "add user endpoint"
|
|
482
411
|
```
|
|
483
412
|
|
|
484
|
-
|
|
413
|
+
---
|
|
485
414
|
|
|
486
|
-
|
|
415
|
+
## Environment variables
|
|
487
416
|
|
|
488
|
-
|
|
417
|
+
| Variable | Required | Default | Description |
|
|
418
|
+
|---|---|---|---|
|
|
419
|
+
| `DATABASE_URL` | Yes | — | PostgreSQL connection string |
|
|
420
|
+
| `OLLAMA_URL` | No | `http://localhost:11434` | Ollama server URL |
|
|
421
|
+
| `OLLAMA_MODEL` | No | `nomic-embed-text` | Embedding model |
|
|
422
|
+
| `OLLAMA_CHAT_MODEL` | No | `llama3.2` | Chat model for pre-commit checks |
|
|
489
423
|
|
|
490
|
-
|
|
424
|
+
---
|
|
491
425
|
|
|
492
|
-
|
|
493
|
-
createuser -s $(whoami)
|
|
494
|
-
```
|
|
426
|
+
## Troubleshooting
|
|
495
427
|
|
|
496
|
-
|
|
428
|
+
**`extension "vector" is not available`**
|
|
429
|
+
pgvector not installed for your PostgreSQL version. See [pgvector setup](#2-pgvector-setup).
|
|
497
430
|
|
|
498
|
-
|
|
431
|
+
**`Ollama not running — skipping rule check`**
|
|
432
|
+
Start Ollama: `brew services start ollama` (macOS) or `ollama serve` (Linux).
|
|
499
433
|
|
|
500
|
-
|
|
434
|
+
**`Chat model "llama3.2" not found`**
|
|
435
|
+
Pull the model: `ollama pull llama3.2`. Or set `OLLAMA_CHAT_MODEL=mistral` in `.env`.
|
|
501
436
|
|
|
502
|
-
|
|
437
|
+
**`DATABASE_URL is not set`**
|
|
438
|
+
Create `.env` in your project root. See [Configure environment](#5-configure-environment).
|
|
503
439
|
|
|
440
|
+
**`createdb: role does not exist`**
|
|
504
441
|
```bash
|
|
505
|
-
|
|
506
|
-
cd memory-core
|
|
507
|
-
npm install
|
|
508
|
-
npm run build # compile TypeScript → dist/
|
|
509
|
-
npm run dev # run with tsx (no build needed)
|
|
442
|
+
createuser -s $(whoami)
|
|
510
443
|
```
|
|
511
444
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
```bash
|
|
515
|
-
node dist/cli.js remember "my decision"
|
|
516
|
-
node dist/cli.js search "query"
|
|
517
|
-
```
|
|
445
|
+
**Pre-commit hook flagging config/JSON files**
|
|
446
|
+
The hook only checks source files (`.ts .tsx .js .jsx .py .php .rb .go .java .cs .swift .kt .rs .vue .svelte`). Config and env files are automatically skipped.
|
|
518
447
|
|
|
519
448
|
---
|
|
520
449
|
|
|
521
|
-
##
|
|
522
|
-
|
|
523
|
-
```bash
|
|
524
|
-
npm login --scope=@archmind
|
|
525
|
-
npm publish --access public
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
After publishing, anyone can use:
|
|
450
|
+
## Roadmap
|
|
529
451
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
452
|
+
| Feature | Description |
|
|
453
|
+
|---|---|
|
|
454
|
+
| CI/CD check | GitHub Actions workflow — fails PRs that violate rules |
|
|
455
|
+
| Watch mode | `memory-core watch` — checks files on save in real-time |
|
|
456
|
+
| Violation memory | Auto-save caught violations as "never do X, do Y" memories |
|
|
457
|
+
| Rule analytics | Track which rules break most, which files are worst offenders |
|
|
458
|
+
| Team sync | `memory-core push/pull` — shared memory pool across the whole team |
|
|
459
|
+
| Memory review | `memory-core approve` — team sign-off before rules propagate |
|
|
533
460
|
|
|
534
461
|
---
|
|
535
462
|
|