memorix 0.1.0
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/CHANGELOG.md +37 -0
- package/CLAUDE.md +47 -0
- package/LICENSE +21 -0
- package/README.md +224 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +3264 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2857 -0
- package/dist/index.js.map +1 -0
- package/examples/CLAUDE.md +27 -0
- package/examples/claude-desktop-config.json +8 -0
- package/examples/cursor-mcp.json +8 -0
- package/examples/windsurf-mcp.json +8 -0
- package/package.json +81 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-02-14)
|
|
4
|
+
|
|
5
|
+
### Core
|
|
6
|
+
- Knowledge Graph: Entity-Relation-Observation model (MCP Official compatible)
|
|
7
|
+
- 3-Layer Progressive Disclosure: compact search → timeline → detail
|
|
8
|
+
- 9 observation types with icon classification
|
|
9
|
+
- Full-text search via Orama (BM25)
|
|
10
|
+
- Per-project isolation via Git remote detection
|
|
11
|
+
- 14 MCP tools (9 official + 5 Memorix extensions)
|
|
12
|
+
|
|
13
|
+
### Cross-Agent Sync
|
|
14
|
+
- Rules Parser: 4 format adapters (Cursor, Claude Code, Codex, Windsurf)
|
|
15
|
+
- Rules Syncer: scan → deduplicate → conflict detection → cross-format generation
|
|
16
|
+
- Workspace Sync: MCP config migration + workflow sync + apply with backup/rollback
|
|
17
|
+
|
|
18
|
+
### Intelligence (Competitor-Inspired)
|
|
19
|
+
- Access tracking: accessCount + lastAccessedAt (from mcp-memory-service)
|
|
20
|
+
- Token budget: maxTokens search trimming (from MemCP)
|
|
21
|
+
- Memory decay: exponential decay + retention lifecycle + immunity (from mcp-memory-service + MemCP)
|
|
22
|
+
- Entity extraction: regex-based file/module/URL/CamelCase extraction (from MemCP)
|
|
23
|
+
- Auto-enrichment: memorix_store auto-extracts and enriches concepts/files
|
|
24
|
+
- Causal detection: "because/due to/caused by" pattern detection
|
|
25
|
+
- Auto-relations: implicit Knowledge Graph relation creation (causes/fixes/modifies)
|
|
26
|
+
- Retention status: memorix_retention MCP tool
|
|
27
|
+
|
|
28
|
+
### Vector Search
|
|
29
|
+
- Embedding provider abstraction layer (extensible)
|
|
30
|
+
- fastembed integration (optional, local ONNX, 384-dim bge-small)
|
|
31
|
+
- Orama hybrid search mode (BM25 + vector)
|
|
32
|
+
- Graceful degradation: no fastembed → fulltext only
|
|
33
|
+
- Embedding cache (5000 entries LRU)
|
|
34
|
+
|
|
35
|
+
### Agent Instructions
|
|
36
|
+
- CLAUDE.md: Claude Code usage instructions + lifecycle hooks
|
|
37
|
+
- Example configs for Cursor, Windsurf, Codex
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Memorix — Agent Instructions for Claude Code
|
|
2
|
+
|
|
3
|
+
You have access to Memorix, a cross-agent memory system. Use it to persist and recall project knowledge across sessions.
|
|
4
|
+
|
|
5
|
+
## When to SEARCH memory (memorix_search)
|
|
6
|
+
|
|
7
|
+
- **Session start**: Always search for recent context at the beginning of a conversation
|
|
8
|
+
- **Before making decisions**: Search for past decisions on the same topic
|
|
9
|
+
- **When the user asks "remember"/"what did we"/"last time"**: Search for relevant history
|
|
10
|
+
- **Before implementing features**: Check if similar work was done before
|
|
11
|
+
- **When encountering errors**: Search for known gotchas and past solutions
|
|
12
|
+
|
|
13
|
+
## When to STORE memory (memorix_store)
|
|
14
|
+
|
|
15
|
+
- **Architecture decisions**: Why you chose X over Y (type: `decision`)
|
|
16
|
+
- **Bug fixes**: Root cause and solution (type: `problem-solution`)
|
|
17
|
+
- **Gotchas/pitfalls**: Things that tripped you up (type: `gotcha`)
|
|
18
|
+
- **How things work**: Non-obvious system behavior (type: `how-it-works`)
|
|
19
|
+
- **Changes made**: Significant code changes (type: `what-changed`)
|
|
20
|
+
- **Trade-offs**: Compromises and their reasoning (type: `trade-off`)
|
|
21
|
+
- **Session goals**: What the user asked for at session start (type: `session-request`)
|
|
22
|
+
|
|
23
|
+
## When to check RETENTION (memorix_retention)
|
|
24
|
+
|
|
25
|
+
- Periodically check which memories are stale or candidates for archiving
|
|
26
|
+
- Review top-relevant memories to avoid duplicating past work
|
|
27
|
+
|
|
28
|
+
## Best Practices
|
|
29
|
+
|
|
30
|
+
1. **Be specific in titles**: "Fixed Docker timeout from 30s to 60s" not "Fixed bug"
|
|
31
|
+
2. **Include facts**: Structured data like "Default port: 3001", "Retry count: 3"
|
|
32
|
+
3. **Tag files**: Always include filesModified when you edit files
|
|
33
|
+
4. **Use concepts**: Add searchable keywords for future retrieval
|
|
34
|
+
5. **Don't over-store**: Only store knowledge that would be useful in a future session
|
|
35
|
+
6. **Entity naming**: Use kebab-case descriptive names like "auth-module", "docker-config"
|
|
36
|
+
|
|
37
|
+
## Tool Quick Reference
|
|
38
|
+
|
|
39
|
+
| Tool | When | Example |
|
|
40
|
+
|------|------|---------|
|
|
41
|
+
| `memorix_search` | Find past knowledge | `query: "authentication"` |
|
|
42
|
+
| `memorix_store` | Save new knowledge | `type: "decision", title: "Use JWT for auth"` |
|
|
43
|
+
| `memorix_detail` | Get full observation | `ids: [42, 43]` |
|
|
44
|
+
| `memorix_timeline` | See what happened around an event | `anchorId: 42` |
|
|
45
|
+
| `memorix_retention` | Check memory health | `action: "summary"` |
|
|
46
|
+
| `memorix_rules_sync` | Sync agent rules | `action: "status"` |
|
|
47
|
+
| `memorix_workspace_sync` | Migrate workspace configs | `action: "scan"` |
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Memorix Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Memorix — Cross-Agent Memory Bridge
|
|
2
|
+
|
|
3
|
+
> Universal memory layer for AI coding agents via MCP
|
|
4
|
+
|
|
5
|
+
## What is Memorix?
|
|
6
|
+
|
|
7
|
+
Memorix is a lightweight local MCP server that acts as a **universal memory layer** across AI coding agents. Your knowledge from Cursor, Claude Code, Codex, and Windsurf is stored once and shared everywhere.
|
|
8
|
+
|
|
9
|
+
### The Problem
|
|
10
|
+
|
|
11
|
+
- claude-mem only serves Claude Code
|
|
12
|
+
- memU only serves OpenClaw
|
|
13
|
+
- Your architecture decisions in Cursor are invisible to Claude Code
|
|
14
|
+
- Bug fix knowledge in Windsurf doesn't transfer to Codex
|
|
15
|
+
- **No one does cross-agent memory**
|
|
16
|
+
|
|
17
|
+
### The Solution
|
|
18
|
+
|
|
19
|
+
Memorix stores and indexes project knowledge (architecture decisions, bug fixes, code style preferences) and exposes it via MCP — so **any MCP-supporting agent** can access it.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
### P0 — Core (Current)
|
|
24
|
+
|
|
25
|
+
- **Knowledge Graph**: Entity-Relation model (MCP Official Memory Server compatible)
|
|
26
|
+
- **3-Layer Progressive Disclosure**: Token-efficient search (claude-mem pattern)
|
|
27
|
+
- L1: Compact index (~50-100 tokens/result)
|
|
28
|
+
- L2: Timeline context
|
|
29
|
+
- L3: Full details on demand (~500-1000 tokens/result)
|
|
30
|
+
- **9 Observation Types**: 🎯🔴🟡🔵🟢🟣🟠🟤⚖️
|
|
31
|
+
- **Full-text Search**: Powered by Orama
|
|
32
|
+
- **Per-project Isolation**: Auto-detected via Git remote
|
|
33
|
+
- **MCP Compatible**: All 9 official Memory Server tools + 5 Memorix extensions
|
|
34
|
+
|
|
35
|
+
### P1 — Smart Search
|
|
36
|
+
|
|
37
|
+
- **Hybrid Search**: Full-text (BM25) + Vector (semantic) via Orama
|
|
38
|
+
- **Vector Embeddings**: Optional `fastembed` (local ONNX, zero API calls)
|
|
39
|
+
- **Graceful Degradation**: No fastembed? Falls back to BM25 fulltext automatically
|
|
40
|
+
- **Token Budget**: `maxTokens` parameter trims results to fit context windows
|
|
41
|
+
|
|
42
|
+
### P2 — Cross-Agent Sync
|
|
43
|
+
|
|
44
|
+
- **Rules Parser**: 4 format adapters (Cursor `.mdc`, Claude Code `CLAUDE.md`, Codex `SKILL.md`, Windsurf `.windsurfrules`)
|
|
45
|
+
- **Rules Syncer**: Scan → Deduplicate → Conflict detection → Cross-format generation
|
|
46
|
+
- **Workspace Sync**: MCP config migration + workflow sync across agents
|
|
47
|
+
- **Apply with Safety**: Backup → Atomic write → Auto-rollback on failure
|
|
48
|
+
|
|
49
|
+
### P5 — Intelligence (Competitor-Inspired)
|
|
50
|
+
|
|
51
|
+
- **Access Tracking**: `accessCount` + `lastAccessedAt` on every search hit (from mcp-memory-service)
|
|
52
|
+
- **Memory Decay**: Exponential decay scoring `score = importance × e^(-age/retention) × accessBoost` (from mcp-memory-service)
|
|
53
|
+
- **Retention Lifecycle**: Active → Stale → Archive-candidate with immunity rules (from MemCP)
|
|
54
|
+
- **Entity Extraction**: Auto-extract files, modules, URLs, CamelCase identifiers from narratives (from MemCP)
|
|
55
|
+
- **Auto-Enrichment**: `memorix_store` automatically enriches concepts and filesModified
|
|
56
|
+
- **Causal Detection**: Detects "because/due to/caused by" patterns for typed relations
|
|
57
|
+
- **Auto-Relations**: Implicit Knowledge Graph relation creation on store (causes/fixes/modifies)
|
|
58
|
+
- **Typed Relations**: Recommended types: causes, fixes, supports, opposes, contradicts, depends_on
|
|
59
|
+
|
|
60
|
+
## Quick Start
|
|
61
|
+
|
|
62
|
+
### Install
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install memorix
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Configure in your agent
|
|
69
|
+
|
|
70
|
+
**Cursor** (`.cursor/mcp.json`):
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"memorix": {
|
|
75
|
+
"command": "node",
|
|
76
|
+
"args": ["node_modules/memorix/dist/index.js"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Claude Code** (`claude_desktop_config.json`):
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"mcpServers": {
|
|
86
|
+
"memorix": {
|
|
87
|
+
"command": "node",
|
|
88
|
+
"args": ["node_modules/memorix/dist/index.js"]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Windsurf** (`~/.codeium/windsurf/mcp_config.json`):
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"mcpServers": {
|
|
98
|
+
"memorix": {
|
|
99
|
+
"command": "node",
|
|
100
|
+
"args": ["node_modules/memorix/dist/index.js"]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Available MCP Tools
|
|
107
|
+
|
|
108
|
+
#### Memorix Extensions (Progressive Disclosure)
|
|
109
|
+
|
|
110
|
+
| Tool | Layer | Description | Tokens |
|
|
111
|
+
|------|-------|-------------|--------|
|
|
112
|
+
| `memorix_store` | Write | Store observation with auto-enrichment | — |
|
|
113
|
+
| `memorix_search` | L1 | Compact index search (hybrid if fastembed) | ~50-100/result |
|
|
114
|
+
| `memorix_timeline` | L2 | Chronological context | ~200/group |
|
|
115
|
+
| `memorix_detail` | L3 | Full observation details | ~500-1000/result |
|
|
116
|
+
| `memorix_retention` | Analytics | Memory decay & retention status | — |
|
|
117
|
+
| `memorix_rules_sync` | Rules | Scan, dedup, convert rules across agents | — |
|
|
118
|
+
| `memorix_workspace_sync` | Workspace | Scan/migrate MCP configs across agents | — |
|
|
119
|
+
|
|
120
|
+
#### MCP Official Compatible
|
|
121
|
+
|
|
122
|
+
| Tool | Description |
|
|
123
|
+
|------|-------------|
|
|
124
|
+
| `create_entities` | Create knowledge graph entities |
|
|
125
|
+
| `create_relations` | Create relations between entities |
|
|
126
|
+
| `add_observations` | Add observations to entities |
|
|
127
|
+
| `delete_entities` | Delete entities (cascades relations) |
|
|
128
|
+
| `delete_observations` | Delete specific observations |
|
|
129
|
+
| `delete_relations` | Delete relations |
|
|
130
|
+
| `search_nodes` | Search knowledge graph |
|
|
131
|
+
| `open_nodes` | Get entities by name |
|
|
132
|
+
| `read_graph` | Read entire graph |
|
|
133
|
+
|
|
134
|
+
## Architecture
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
┌─────────────────────────────────────────────┐
|
|
138
|
+
│ MCP Clients │
|
|
139
|
+
│ Cursor │ Claude Code │ Codex │ Windsurf │
|
|
140
|
+
└──────────────────┬──────────────────────────┘
|
|
141
|
+
│ stdio
|
|
142
|
+
┌──────────────────▼──────────────────────────┐
|
|
143
|
+
│ Memorix MCP Server │
|
|
144
|
+
│ │
|
|
145
|
+
│ ┌────────────┐ ┌─────────────────────┐ │
|
|
146
|
+
│ │ Knowledge │ │ Compact Engine │ │
|
|
147
|
+
│ │ Graph Mgr │ │ (3-layer search) │ │
|
|
148
|
+
│ └─────┬──────┘ └──────────┬──────────┘ │
|
|
149
|
+
│ │ │ │
|
|
150
|
+
│ ┌─────▼────────────────────▼──────────┐ │
|
|
151
|
+
│ │ Orama Store │ │
|
|
152
|
+
│ │ (full-text + vector search) │ │
|
|
153
|
+
│ └─────────────────┬──────────────────┘ │
|
|
154
|
+
│ │ │
|
|
155
|
+
│ ┌─────────────────▼──────────────────┐ │
|
|
156
|
+
│ │ Persistence Layer │ │
|
|
157
|
+
│ │ (JSONL + JSON per project) │ │
|
|
158
|
+
│ └─────────────────────────────────────┘ │
|
|
159
|
+
│ │
|
|
160
|
+
│ ┌────────────────────────────────────┐ │
|
|
161
|
+
│ │ Rules Syncer │ │
|
|
162
|
+
│ │ Cursor│Claude│Codex│Windsurf │ │
|
|
163
|
+
│ │ scan → dedup → conflict → gen │ │
|
|
164
|
+
│ └────────────────────────────────────┘ │
|
|
165
|
+
└──────────────────────────────────────────────┘
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Tech Stack
|
|
169
|
+
|
|
170
|
+
| Component | Library | Source |
|
|
171
|
+
|-----------|---------|--------|
|
|
172
|
+
| MCP Server | `@modelcontextprotocol/sdk` | Official SDK |
|
|
173
|
+
| Search | `@orama/orama` | Full-text + Vector + Hybrid |
|
|
174
|
+
| Embeddings | `fastembed` (optional) | Local ONNX, zero API calls |
|
|
175
|
+
| Token counting | `gpt-tokenizer` | — |
|
|
176
|
+
| Data model | Entity-Relation-Observation | MCP Official Memory Server |
|
|
177
|
+
| Compact strategy | 3-layer Progressive Disclosure | claude-mem |
|
|
178
|
+
| Memory decay | Exponential decay + retention | mcp-memory-service + MemCP |
|
|
179
|
+
| Entity extraction | Regex patterns | MemCP |
|
|
180
|
+
| Rule parsing | `gray-matter` | — |
|
|
181
|
+
| Build | `tsup` | — |
|
|
182
|
+
| Test | `vitest` | 195 tests |
|
|
183
|
+
|
|
184
|
+
## Optional: Enable Vector Search
|
|
185
|
+
|
|
186
|
+
Install `fastembed` for hybrid (BM25 + semantic) search:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
npm install fastembed
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Without it, Memorix uses BM25 full-text search (already very effective for code memories). With it, queries like "authentication" will also match observations containing "login flow".
|
|
193
|
+
|
|
194
|
+
## Development
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Install dependencies
|
|
198
|
+
npm install
|
|
199
|
+
|
|
200
|
+
# Build
|
|
201
|
+
npm run build
|
|
202
|
+
|
|
203
|
+
# Run tests (195 tests)
|
|
204
|
+
npm test
|
|
205
|
+
|
|
206
|
+
# Type check
|
|
207
|
+
npm run lint
|
|
208
|
+
|
|
209
|
+
# Watch mode
|
|
210
|
+
npm run dev
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Acknowledgements
|
|
214
|
+
|
|
215
|
+
Memorix stands on the shoulders of these excellent projects:
|
|
216
|
+
|
|
217
|
+
- [mcp-memory-service](https://github.com/doobidoo/mcp-memory-service) — Hybrid search, exponential decay, access tracking
|
|
218
|
+
- [MemCP](https://github.com/maydali28/memcp) — MAGMA 4-graph, entity extraction, retention lifecycle, token budget
|
|
219
|
+
- [claude-mem](https://github.com/anthropics/claude-code) — 3-layer Progressive Disclosure, lifecycle hooks
|
|
220
|
+
- [Mem0](https://github.com/mem0ai/mem0) — Memory layer architecture patterns
|
|
221
|
+
|
|
222
|
+
## License
|
|
223
|
+
|
|
224
|
+
MIT
|