mor 0.0.2 → 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/README.md +160 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +587 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +56 -0
- package/dist/config.js.map +1 -0
- package/dist/db.d.ts +37 -0
- package/dist/db.js +134 -0
- package/dist/db.js.map +1 -0
- package/dist/embeddings/none.d.ts +6 -0
- package/dist/embeddings/none.js +8 -0
- package/dist/embeddings/none.js.map +1 -0
- package/dist/embeddings/ollama.d.ts +9 -0
- package/dist/embeddings/ollama.js +28 -0
- package/dist/embeddings/ollama.js.map +1 -0
- package/dist/embeddings/openai.d.ts +10 -0
- package/dist/embeddings/openai.js +33 -0
- package/dist/embeddings/openai.js.map +1 -0
- package/dist/embeddings/provider.d.ts +7 -0
- package/dist/embeddings/provider.js +15 -0
- package/dist/embeddings/provider.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +160 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +188 -0
- package/dist/mcp.js.map +1 -0
- package/dist/memory.d.ts +20 -0
- package/dist/memory.js +124 -0
- package/dist/memory.js.map +1 -0
- package/dist/operations.d.ts +61 -0
- package/dist/operations.js +122 -0
- package/dist/operations.js.map +1 -0
- package/dist/query.d.ts +3 -0
- package/dist/query.js +44 -0
- package/dist/query.js.map +1 -0
- package/dist/remote.d.ts +35 -0
- package/dist/remote.js +77 -0
- package/dist/remote.js.map +1 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +241 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +35 -17
- package/.dir-locals.el +0 -6
- package/.editorconfig +0 -15
- package/.eslintrc +0 -26
- package/.npmignore +0 -32
- package/LICENSE +0 -21
- package/alg/dfs.js +0 -36
- package/alg/revDfs.js +0 -36
- package/cli.js +0 -106
- package/mor-core.js +0 -60
- package/mor-link.js +0 -23
- package/mor-outdated.js +0 -26
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# mor
|
|
2
|
+
|
|
3
|
+
A user-controlled memory bank for AI assistants. Stores knowledge as human-readable markdown files with YAML frontmatter, indexed by SQLite for fast full-text and semantic search.
|
|
4
|
+
|
|
5
|
+
Works as a **CLI tool**, an **MCP server** (for Claude Code / Claude Desktop), and an **HTTP server** for accessing memories across machines on a Tailscale network.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -g mor
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires Node.js 20+.
|
|
14
|
+
|
|
15
|
+
## Quick start
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
# Add a memory
|
|
19
|
+
echo "Always use snake_case in Python" | mor add --title "Python naming"
|
|
20
|
+
|
|
21
|
+
# Add from a file
|
|
22
|
+
mor add notes.md --title "Meeting notes" --tags "meeting,project-x"
|
|
23
|
+
|
|
24
|
+
# Search
|
|
25
|
+
mor find "python naming"
|
|
26
|
+
|
|
27
|
+
# Read
|
|
28
|
+
mor cat "python naming"
|
|
29
|
+
|
|
30
|
+
# Edit in $EDITOR
|
|
31
|
+
mor edit "python naming"
|
|
32
|
+
|
|
33
|
+
# List all
|
|
34
|
+
mor list
|
|
35
|
+
|
|
36
|
+
# Remove
|
|
37
|
+
mor rm "python naming"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## CLI commands
|
|
41
|
+
|
|
42
|
+
| Command | Description |
|
|
43
|
+
|---------|-------------|
|
|
44
|
+
| `find <query>` | Search memories (supports `-l, --limit`) |
|
|
45
|
+
| `add [file]` | Add memory from file or stdin (`-t, --title`, `--tags`, `--type`) |
|
|
46
|
+
| `rm <query>` | Remove a memory |
|
|
47
|
+
| `cat <query>` | Print memory content |
|
|
48
|
+
| `cp <query> <dest>` | Copy memory to a file |
|
|
49
|
+
| `edit <query>` | Open in `$EDITOR` |
|
|
50
|
+
| `list` | List all memories |
|
|
51
|
+
| `reindex` | Rebuild search index |
|
|
52
|
+
| `import <dir>` | Import markdown files from a directory |
|
|
53
|
+
| `mcp` | Start MCP server over stdio |
|
|
54
|
+
| `serve` | Start HTTP server (`-p, --port`, `-H, --host`, `--token`) |
|
|
55
|
+
|
|
56
|
+
Queries accept a UUID, UUID prefix (4+ chars), filename, or search text.
|
|
57
|
+
|
|
58
|
+
## MCP server
|
|
59
|
+
|
|
60
|
+
Add to your Claude Code or Claude Desktop config:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"memory": {
|
|
66
|
+
"command": "mor",
|
|
67
|
+
"args": ["mcp"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Exposes tools: `memory_search`, `memory_read`, `memory_add`, `memory_update`, `memory_remove`, `memory_list`.
|
|
74
|
+
|
|
75
|
+
## Remote access (Tailscale / HTTP)
|
|
76
|
+
|
|
77
|
+
Run a central memory server on one machine and access it from any other.
|
|
78
|
+
|
|
79
|
+
**Server machine** — start the HTTP server:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
mor serve --port 7677
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Or configure in `~/.config/mor/config.json`:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"serve": { "port": 7677, "host": "0.0.0.0", "token": "optional-secret" }
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Client machine** — point CLI and MCP at the server:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"server": { "url": "http://mybox.tail1234.ts.net:7677", "token": "optional-secret" }
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
All CLI commands and MCP tools transparently work over HTTP when `server` is configured. The `reindex` and `import` commands are local-only.
|
|
102
|
+
|
|
103
|
+
### API endpoints
|
|
104
|
+
|
|
105
|
+
| Method | Path | Description |
|
|
106
|
+
|--------|------|-------------|
|
|
107
|
+
| GET | `/health` | Health check |
|
|
108
|
+
| GET | `/memories` | List all memories |
|
|
109
|
+
| GET | `/memories/search?q=...&limit=N` | Search |
|
|
110
|
+
| GET | `/memories/:query` | Read by UUID, prefix, filename, or search |
|
|
111
|
+
| POST | `/memories` | Create `{title, content, tags?, type?}` |
|
|
112
|
+
| PUT | `/memories/:query` | Update `{title?, content?, tags?, type?}` |
|
|
113
|
+
| DELETE | `/memories/:query` | Remove |
|
|
114
|
+
|
|
115
|
+
Optional bearer token auth via `Authorization: Bearer <token>` header.
|
|
116
|
+
|
|
117
|
+
## Embeddings (optional)
|
|
118
|
+
|
|
119
|
+
Enable semantic search by configuring an embedding provider in `~/.config/mor/config.json`:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"embedding": {
|
|
124
|
+
"provider": "openai",
|
|
125
|
+
"model": "text-embedding-3-small",
|
|
126
|
+
"baseUrl": "https://api.openai.com/v1",
|
|
127
|
+
"dimensions": 1536
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Supports `openai` (or any compatible API) and `ollama`. Set `OPENAI_API_KEY` for OpenAI. After configuring, run `mor reindex`.
|
|
133
|
+
|
|
134
|
+
## Storage
|
|
135
|
+
|
|
136
|
+
Memories live as `.md` files in `~/.config/mor/memories/` with a SQLite index at `~/.config/mor/index.db`. Override the base directory with `MOR_HOME`.
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
~/.config/mor/
|
|
140
|
+
config.json
|
|
141
|
+
index.db
|
|
142
|
+
memories/
|
|
143
|
+
python-naming-a1b2.md
|
|
144
|
+
meeting-notes-c3d4.md
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Each file has YAML frontmatter (id, title, tags, type, created, updated) and markdown content. Files are git-friendly and human-editable.
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
npm install
|
|
153
|
+
npm run build # compile TypeScript
|
|
154
|
+
npm test # run tests
|
|
155
|
+
npm run dev -- find "query" # run without building
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
package/dist/cli.d.ts
ADDED