memorix 1.0.7 → 1.0.8

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.
@@ -0,0 +1,317 @@
1
+ # Development Guide
2
+
3
+ This guide is for contributors working on Memorix itself.
4
+
5
+ Memorix is a TypeScript project built around:
6
+
7
+ - MCP server runtime
8
+ - CLI workflows
9
+ - SQLite canonical persistence with compatibility/fallback layers
10
+ - Orama search
11
+ - dashboard and HTTP control plane
12
+
13
+ ## Current Release Baseline
14
+
15
+ The current published release line is **1.0.8**.
16
+
17
+ Contributors should assume the following are already part of the supported product surface:
18
+
19
+ - provenance-aware memory fields and layered retrieval semantics
20
+ - evidence-aware detail and timeline outputs
21
+ - verification-aware and citation-lite compact output
22
+ - task-line scoping, secret-safety, and attribution auditing
23
+ - calibrated retention plus cleanup/remediation loop ergonomics
24
+ - OpenCode `post_compact` support and structured continuation compaction prompt
25
+
26
+ ---
27
+
28
+ ## 1. Prerequisites
29
+
30
+ - Node.js `>=20`
31
+ - npm
32
+ - Git
33
+
34
+ Clone and install:
35
+
36
+ ```bash
37
+ git clone https://github.com/AVIDS2/memorix.git
38
+ cd memorix
39
+ npm install
40
+ ```
41
+
42
+ Optional local dependencies:
43
+
44
+ - `fastembed` for local embedding experiments
45
+ - `@huggingface/transformers` for transformer embedding mode
46
+
47
+ Memorix still works without them.
48
+
49
+ ---
50
+
51
+ ## 2. Core Commands
52
+
53
+ ### Build
54
+
55
+ ```bash
56
+ npm run build
57
+ ```
58
+
59
+ ### Watch mode
60
+
61
+ ```bash
62
+ npm run dev
63
+ ```
64
+
65
+ ### Typecheck
66
+
67
+ ```bash
68
+ npm run lint
69
+ ```
70
+
71
+ `lint` currently runs `tsc --noEmit`.
72
+
73
+ ### Full test suite
74
+
75
+ ```bash
76
+ npm test
77
+ ```
78
+
79
+ ### Vitest watch mode
80
+
81
+ ```bash
82
+ npm run test:watch
83
+ ```
84
+
85
+ ### Local runtime checks
86
+
87
+ ```bash
88
+ memorix serve
89
+ memorix background start
90
+ memorix status
91
+ ```
92
+
93
+ ---
94
+
95
+ ## 3. Recommended Development Loop
96
+
97
+ For most feature work:
98
+
99
+ 1. write or update a focused test
100
+ 2. implement the change
101
+ 3. run the targeted test file
102
+ 4. run `npm run lint`
103
+ 5. run `npm run build`
104
+ 6. run `npm test`
105
+ 7. validate the real MCP or CLI path if the feature affects runtime behavior
106
+
107
+ Examples:
108
+
109
+ ```bash
110
+ npx vitest run tests/git/noise-filter.test.ts
111
+ npm run lint
112
+ npm run build
113
+ npm test
114
+ ```
115
+
116
+ If the feature touches the dashboard, HTTP transport, or MCP wiring, do a live verification after the test suite.
117
+
118
+ ---
119
+
120
+ ## 4. Repository Structure
121
+
122
+ High-level layout:
123
+
124
+ ```text
125
+ src/
126
+ cli/ interactive menu and subcommands
127
+ compact/ compact formatting and token budgeting
128
+ config/ YAML, dotenv, and configuration loading
129
+ dashboard/ dashboard server and static frontend
130
+ embedding/ embedding providers
131
+ git/ Git Memory extractor, hook path, noise filter
132
+ hooks/ IDE hook normalization and capture
133
+ llm/ optional LLM quality helpers
134
+ memory/ observations, sessions, retention, graph, formation
135
+ project/ Git-based project detection and aliases
136
+ rules/ rules sync across agents
137
+ search/ intent-aware retrieval helpers
138
+ skills/ memory-driven skills generation
139
+ store/ Orama index and persistence
140
+ team/ autonomous Agent Team registry, tasks, locks, messages
141
+ workspace/ MCP and workflow sync across agents
142
+
143
+ tests/
144
+ ...mirrors runtime modules with focused unit and integration tests
145
+ ```
146
+
147
+ Docs layout:
148
+
149
+ - `README.md`: landing page and quick start
150
+ - `docs/SETUP.md`: client setup and troubleshooting
151
+ - `docs/CONFIGURATION.md`: `memorix.yml + .env`
152
+ - `docs/GIT_MEMORY.md`: Git Memory workflows
153
+ - `docs/ARCHITECTURE.md`: system design
154
+ - `docs/API_REFERENCE.md`: MCP tool surface
155
+
156
+ ---
157
+
158
+ ## 5. Runtime Modes to Validate
159
+
160
+ ### stdio MCP
161
+
162
+ ```bash
163
+ memorix serve
164
+ ```
165
+
166
+ Use this to validate:
167
+
168
+ - tool registration
169
+ - stdio MCP behavior
170
+ - IDE integration compatibility
171
+
172
+ ### HTTP MCP + dashboard
173
+
174
+ ```bash
175
+ memorix background start
176
+ ```
177
+
178
+ Use this to validate:
179
+
180
+ - HTTP MCP endpoint
181
+ - Team tools
182
+ - dashboard API parity
183
+ - dashboard UX
184
+
185
+ Use `memorix serve-http --port 3211` when you want the same stack in the foreground for debugging, manual supervision, or custom ports.
186
+
187
+ ### Dashboard-only mode
188
+
189
+ ```bash
190
+ memorix dashboard
191
+ ```
192
+
193
+ Useful for local UI checks, but the main product dashboard is the one embedded in the HTTP control plane.
194
+
195
+ ---
196
+
197
+ ## 6. Feature Areas Worth Testing Live
198
+
199
+ Some features deserve real runtime verification, not just tests:
200
+
201
+ - project identity detection
202
+ - config provenance
203
+ - Git hook installation and post-commit ingest
204
+ - cross-project search and detail refs
205
+ - HTTP transport and Team tools
206
+ - dashboard graph stability and page layout
207
+
208
+ When validating these, prefer:
209
+
210
+ - real MCP calls
211
+ - real CLI commands
212
+ - real temporary Git repositories
213
+
214
+ over only unit tests.
215
+
216
+ ---
217
+
218
+ ## 7. Git Memory Development Notes
219
+
220
+ Git Memory is one of Memorix's most important product differentiators.
221
+
222
+ When working in this area, validate:
223
+
224
+ - `memorix git-hook --force`
225
+ - `memorix git-hook-uninstall`
226
+ - `memorix ingest commit`
227
+ - `memorix ingest commit --force`
228
+ - `memorix ingest log --count N`
229
+
230
+ Also validate behavior in:
231
+
232
+ - normal repositories
233
+ - worktrees
234
+ - noisy commit streams
235
+
236
+ See [GIT_MEMORY.md](GIT_MEMORY.md) for user-facing behavior.
237
+
238
+ ---
239
+
240
+ ## 8. Configuration Development Notes
241
+
242
+ Memorix is converging on:
243
+
244
+ - `memorix.yml` for behavior
245
+ - `.env` for secrets
246
+
247
+ When touching config code, always validate:
248
+
249
+ - project `memorix.yml`
250
+ - user `~/.memorix/memorix.yml`
251
+ - project `.env`
252
+ - user `~/.memorix/.env`
253
+ - legacy `~/.memorix/config.json`
254
+ - env var overrides
255
+
256
+ And always check:
257
+
258
+ ```bash
259
+ memorix status
260
+ ```
261
+
262
+ to make sure provenance diagnostics match runtime behavior.
263
+
264
+ ---
265
+
266
+ ## 9. Release Workflow
267
+
268
+ Recommended release flow:
269
+
270
+ 1. update docs and version metadata
271
+ 2. run:
272
+
273
+ ```bash
274
+ npm run lint
275
+ npm run build
276
+ npm test
277
+ ```
278
+
279
+ 3. validate key live flows:
280
+
281
+ - MCP store/search/detail
282
+ - dashboard
283
+ - Git Memory
284
+ - config diagnostics
285
+
286
+ 4. commit and push
287
+ 5. publish manually when ready
288
+
289
+ Notes:
290
+
291
+ - `prepublishOnly` already runs build + test
292
+ - npm publish is usually manual, especially when 2FA is enabled
293
+ - GitHub release automation should not be treated as a substitute for manual runtime validation
294
+
295
+ ---
296
+
297
+ ## 10. Contribution Standards
298
+
299
+ When contributing to Memorix:
300
+
301
+ - keep public docs aligned with runtime behavior
302
+ - prefer explicit, project-safe behavior over clever fallback
303
+ - avoid adding features without a clear product story
304
+ - validate MCP behavior with real calls when changing server logic
305
+ - keep Git Memory, reasoning memory, and retrieval semantics coherent
306
+
307
+ Memorix is strongest when its engineering truth layer, reasoning layer, and local control plane all stay in sync.
308
+
309
+ ---
310
+
311
+ ## 11. Related Docs
312
+
313
+ - [Setup Guide](SETUP.md)
314
+ - [Configuration Guide](CONFIGURATION.md)
315
+ - [Git Memory Guide](GIT_MEMORY.md)
316
+ - [Architecture](ARCHITECTURE.md)
317
+ - [API Reference](API_REFERENCE.md)
package/docs/DOCKER.md ADDED
@@ -0,0 +1,138 @@
1
+ # Docker Deployment
2
+
3
+ Memorix supports Docker as an **HTTP control-plane deployment path**.
4
+
5
+ This Docker flow is for:
6
+
7
+ - a long-lived `serve-http` control plane
8
+ - the dashboard on port `3211`
9
+ - IDEs and agents that connect over `http://host:3211/mcp`
10
+
11
+ It is **not** a containerized form of `memorix serve` (stdio MCP).
12
+
13
+ ---
14
+
15
+ ## Quick Start
16
+
17
+ From the repository root:
18
+
19
+ ```bash
20
+ docker compose up --build -d
21
+ ```
22
+
23
+ Then open:
24
+
25
+ - dashboard: `http://localhost:3211`
26
+ - MCP endpoint: `http://localhost:3211/mcp`
27
+ - health: `http://localhost:3211/health`
28
+
29
+ Stop it with:
30
+
31
+ ```bash
32
+ docker compose down
33
+ ```
34
+
35
+ The provided compose file:
36
+
37
+ - persists Memorix state in a named volume
38
+ - mounts the current repository at `/workspace`
39
+ - sets `MEMORIX_PROJECT_ROOT=/workspace`
40
+ - sets `MEMORIX_SESSION_TIMEOUT_MS=86400000` so long IDE HTTP sessions can remain idle for up to 24 hours
41
+
42
+ ---
43
+
44
+ ## One-Off docker run
45
+
46
+ If you prefer `docker run`:
47
+
48
+ ```bash
49
+ docker build -t memorix:local .
50
+ docker run --rm -p 3211:3211 -v memorix-data:/data memorix:local
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Host Binding
56
+
57
+ `memorix serve-http` accepts a `--host` flag:
58
+
59
+ - **Local** (default): binds to `127.0.0.1` — only accessible from the host machine
60
+ - **Docker**: the Dockerfile sets `--host 0.0.0.0` — accessible from outside the container, which is required for port mapping (`-p 3211:3211`) to work
61
+
62
+ If you run `serve-http` manually inside a container, make sure to pass `--host 0.0.0.0` or the port will not be reachable from the host.
63
+
64
+ ---
65
+
66
+ ## What Docker Support Means
67
+
68
+ The official Docker artifacts in this repo provide:
69
+
70
+ - a multi-stage production image
71
+ - an example `compose.yaml`
72
+ - a healthchecked HTTP deployment
73
+
74
+ Docker support is for the **HTTP control plane**:
75
+
76
+ - `memorix serve-http`
77
+ - dashboard access
78
+ - HTTP MCP clients pointing at `http://localhost:3211/mcp`
79
+
80
+ It is not a promise that stdio MCP magically becomes container-friendly.
81
+
82
+ ---
83
+
84
+ ## Important Path Truth
85
+
86
+ Docker works best when Memorix can **see the repositories it is asked to bind**.
87
+
88
+ Project-scoped features such as:
89
+
90
+ - Git-root detection
91
+ - project binding
92
+ - project `memorix.yml`
93
+ - project `.env`
94
+ - Git Memory inspection
95
+
96
+ depend on the control plane being able to access the repository path.
97
+
98
+ ### Good fit
99
+
100
+ - Docker Desktop on the same machine as your IDE
101
+ - a compose setup that mounts the repo you are working on into the container
102
+ - `memorix_session_start(projectRoot=...)` using a path visible **inside** the container
103
+
104
+ ### Caveat
105
+
106
+ If an IDE on machine A sends `projectRoot=/Users/alice/code/app`, but the Docker container running on machine B cannot see that path, Memorix cannot perform project-scoped detection there.
107
+
108
+ In that case:
109
+
110
+ - HTTP connectivity still works
111
+ - global/shared memory still works
112
+ - but project-scoped Git/config semantics will not be fully available until the repo is mounted into the container at a visible path
113
+
114
+ This is a real runtime limitation, not just a documentation preference.
115
+
116
+ ---
117
+
118
+ ## Operations
119
+
120
+ Useful checks:
121
+
122
+ ```bash
123
+ curl http://localhost:3211/health
124
+ curl http://localhost:3211/api/stats
125
+ docker compose logs -f memorix
126
+ docker compose ps
127
+ ```
128
+
129
+ ### HTTP session idle timeout
130
+
131
+ The HTTP MCP transport defaults to a 30-minute idle timeout. The example `compose.yaml` raises this to 24 hours for IDEs that keep one HTTP MCP session open while the user reads diffs, runs tests, or switches focus.
132
+
133
+ To change it:
134
+
135
+ ```yaml
136
+ environment:
137
+ MEMORIX_SESSION_TIMEOUT_MS: 86400000
138
+ ```
@@ -0,0 +1,221 @@
1
+ # Git Memory Guide
2
+
3
+ Git Memory is one of Memorix's core differentiators.
4
+
5
+ Instead of relying only on agent-written notes, Memorix can turn Git history into searchable engineering memory with source provenance.
6
+
7
+ ---
8
+
9
+ ## What Git Memory Stores
10
+
11
+ Each ingested commit becomes a memory with:
12
+
13
+ - `source='git'`
14
+ - `commitHash`
15
+ - title and narrative derived from commit metadata
16
+ - changed files
17
+ - inferred observation type
18
+ - extracted concepts and entities
19
+
20
+ This creates an engineering truth layer that complements reasoning memory and manual observations.
21
+
22
+ ---
23
+
24
+ ## Main Workflows
25
+
26
+ ### Install automatic post-commit capture
27
+
28
+ ```bash
29
+ memorix git-hook --force
30
+ ```
31
+
32
+ This installs a `post-commit` hook that runs:
33
+
34
+ ```bash
35
+ memorix ingest commit --auto
36
+ ```
37
+
38
+ After that, new commits are automatically evaluated and stored as Git memories.
39
+
40
+ ### Remove the hook
41
+
42
+ ```bash
43
+ memorix git-hook-uninstall
44
+ ```
45
+
46
+ ### Ingest a single commit manually
47
+
48
+ ```bash
49
+ memorix ingest commit
50
+ ```
51
+
52
+ You can also target a specific ref:
53
+
54
+ ```bash
55
+ memorix ingest commit --ref HEAD~3
56
+ ```
57
+
58
+ ### Batch ingest recent history
59
+
60
+ ```bash
61
+ memorix ingest log --count 20
62
+ ```
63
+
64
+ Use this when enabling Git Memory on an existing project and you want recent history backfilled.
65
+
66
+ ---
67
+
68
+ ## Noise Filtering
69
+
70
+ Not every commit deserves to become long-lived memory.
71
+
72
+ Memorix applies a Git noise filter before ingesting commits. Depending on commit content and your config, it may skip:
73
+
74
+ - merge commits
75
+ - trivial typo or formatting commits
76
+ - lockfile-only changes
77
+ - generated-only changes
78
+ - custom excluded patterns
79
+ - commit subjects matching configured noise keywords
80
+
81
+ If a commit is skipped in interactive mode, Memorix tells you why.
82
+
83
+ ### Override the filter
84
+
85
+ If you really want to ingest a filtered commit:
86
+
87
+ ```bash
88
+ memorix ingest commit --force
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Configuration
94
+
95
+ Configure Git Memory in `memorix.yml`:
96
+
97
+ ```yml
98
+ git:
99
+ autoHook: true
100
+ ingestOnCommit: true
101
+ maxDiffSize: 500
102
+ skipMergeCommits: true
103
+ excludePatterns:
104
+ - "*.lock"
105
+ - "dist/**"
106
+ noiseKeywords:
107
+ - "^BOT:"
108
+ - "auto-deploy"
109
+ ```
110
+
111
+ Key settings:
112
+
113
+ - `autoHook`: install the post-commit hook automatically on startup
114
+ - `ingestOnCommit`: ingest `HEAD` during post-commit execution
115
+ - `maxDiffSize`: cap how much diff content is included
116
+ - `skipMergeCommits`: skip merge commits by default
117
+ - `excludePatterns`: skip commits touching only matching files
118
+ - `noiseKeywords`: skip commits whose subjects match configured patterns
119
+
120
+ See [CONFIGURATION.md](CONFIGURATION.md) for the full configuration model.
121
+
122
+ ---
123
+
124
+ ## Retrieval Model
125
+
126
+ Git memories are especially useful for questions like:
127
+
128
+ - What changed recently?
129
+ - Which commit introduced this behavior?
130
+ - Which files were touched by this feature?
131
+ - When did we ship this fix?
132
+
133
+ Memorix retrieval is source-aware:
134
+
135
+ - “what changed” style questions boost Git memories
136
+ - “why did we do this” style questions boost reasoning memories
137
+ - “how did we fix this” style questions can use both
138
+
139
+ Git memory is not meant to replace reasoning memory. The strongest setup is:
140
+
141
+ - **Git Memory** for engineering truth
142
+ - **Reasoning Memory** for trade-offs, decisions, and intent
143
+
144
+ ---
145
+
146
+ ## Cross-Linking
147
+
148
+ Memorix can connect Git memories and reasoning memories through:
149
+
150
+ - shared entities
151
+ - explicit `relatedCommits`
152
+ - cross-references in detail views
153
+
154
+ This gives you a layered understanding:
155
+
156
+ - Git says what changed
157
+ - reasoning says why it changed
158
+
159
+ ---
160
+
161
+ ## Recommended Rollout
162
+
163
+ For a new project:
164
+
165
+ 1. create `memorix.yml`
166
+ 2. enable Git Memory config
167
+ 3. install the git hook
168
+ 4. optionally ingest recent history
169
+ 5. start using reasoning memory alongside Git Memory
170
+
171
+ Suggested first run:
172
+
173
+ ```bash
174
+ memorix init
175
+ memorix git-hook --force
176
+ memorix ingest log --count 20
177
+ ```
178
+
179
+ ---
180
+
181
+ ## Troubleshooting
182
+
183
+ ### The hook installed, but no memories appear
184
+
185
+ Check:
186
+
187
+ - you are inside a Git repository
188
+ - the hook file exists
189
+ - the commit was not filtered as noise
190
+ - the project identity is correct
191
+
192
+ Run:
193
+
194
+ ```bash
195
+ memorix status
196
+ ```
197
+
198
+ ### A commit was skipped unexpectedly
199
+
200
+ Try:
201
+
202
+ ```bash
203
+ memorix ingest commit --force
204
+ ```
205
+
206
+ If that works, your noise filter settings are likely too aggressive.
207
+
208
+ ### Worktree repositories
209
+
210
+ Memorix resolves the Git hooks directory in a worktree-safe way, so `.git` can be either:
211
+
212
+ - a directory
213
+ - or a `gitdir:` indirection file
214
+
215
+ ---
216
+
217
+ ## Related Docs
218
+
219
+ - [Configuration Guide](CONFIGURATION.md)
220
+ - [Setup Guide](SETUP.md)
221
+ - [Architecture](ARCHITECTURE.md)