mor 0.0.2 → 0.2.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.
Files changed (64) hide show
  1. package/LICENSE +22 -21
  2. package/README.md +163 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +609 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/config.d.ts +3 -0
  7. package/dist/config.js +50 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/db.d.ts +38 -0
  10. package/dist/db.js +134 -0
  11. package/dist/db.js.map +1 -0
  12. package/dist/embeddings/azure-openai.d.ts +12 -0
  13. package/dist/embeddings/azure-openai.js +41 -0
  14. package/dist/embeddings/azure-openai.js.map +1 -0
  15. package/dist/embeddings/none.d.ts +6 -0
  16. package/dist/embeddings/none.js +8 -0
  17. package/dist/embeddings/none.js.map +1 -0
  18. package/dist/embeddings/ollama.d.ts +9 -0
  19. package/dist/embeddings/ollama.js +28 -0
  20. package/dist/embeddings/ollama.js.map +1 -0
  21. package/dist/embeddings/openai.d.ts +10 -0
  22. package/dist/embeddings/openai.js +33 -0
  23. package/dist/embeddings/openai.js.map +1 -0
  24. package/dist/embeddings/provider.d.ts +7 -0
  25. package/dist/embeddings/provider.js +18 -0
  26. package/dist/embeddings/provider.js.map +1 -0
  27. package/dist/filter.d.ts +11 -0
  28. package/dist/filter.js +47 -0
  29. package/dist/filter.js.map +1 -0
  30. package/dist/index.d.ts +10 -0
  31. package/dist/index.js +165 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/mcp.d.ts +4 -0
  34. package/dist/mcp.js +269 -0
  35. package/dist/mcp.js.map +1 -0
  36. package/dist/memory.d.ts +22 -0
  37. package/dist/memory.js +129 -0
  38. package/dist/memory.js.map +1 -0
  39. package/dist/operations.d.ts +65 -0
  40. package/dist/operations.js +127 -0
  41. package/dist/operations.js.map +1 -0
  42. package/dist/query.d.ts +3 -0
  43. package/dist/query.js +44 -0
  44. package/dist/query.js.map +1 -0
  45. package/dist/remote.d.ts +37 -0
  46. package/dist/remote.js +77 -0
  47. package/dist/remote.js.map +1 -0
  48. package/dist/server.d.ts +8 -0
  49. package/dist/server.js +341 -0
  50. package/dist/server.js.map +1 -0
  51. package/dist/types.d.ts +55 -0
  52. package/dist/types.js +10 -0
  53. package/dist/types.js.map +1 -0
  54. package/package.json +54 -18
  55. package/.dir-locals.el +0 -6
  56. package/.editorconfig +0 -15
  57. package/.eslintrc +0 -26
  58. package/.npmignore +0 -32
  59. package/alg/dfs.js +0 -36
  60. package/alg/revDfs.js +0 -36
  61. package/cli.js +0 -106
  62. package/mor-core.js +0 -60
  63. package/mor-link.js +0 -23
  64. package/mor-outdated.js +0 -26
package/LICENSE CHANGED
@@ -1,21 +1,22 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Sigurd Fosseng <sigurd@fosseng.net>
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
13
- all 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
21
- THE SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sigurd Fosseng
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.
22
+
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # mor
2
+
3
+ A shared memory store for humans and AI. Plain markdown files with SQLite full-text search.
4
+
5
+ Use it as a **CLI**, an **MCP server** (Claude Code, Claude Desktop, Cursor, etc.), or an **HTTP server** for accessing memories across machines.
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 memories
19
+ echo "Always use snake_case for Python variables" | mor add -t "Python naming"
20
+ mor add notes.md -t "Meeting notes" --tags "meeting,project-x"
21
+ mor add https://raw.githubusercontent.com/owner/repo/main/config.ts
22
+
23
+ # Search (FTS5 — tokenized, stemmed)
24
+ mor find "python naming"
25
+
26
+ # Grep (literal substring — exact matches)
27
+ mor grep "snake_case"
28
+ mor grep -i "todo"
29
+
30
+ # Read, edit, copy, remove
31
+ mor cat "python naming"
32
+ mor edit "python naming"
33
+ mor cp "python naming" ./out.md
34
+ mor rm "python naming"
35
+
36
+ # List
37
+ mor ls
38
+ mor ls -l
39
+ ```
40
+
41
+ ## Commands
42
+
43
+ | Command | Description |
44
+ |---------|-------------|
45
+ | `find <query>` | Full-text search (`-n` limit, `-l` long) |
46
+ | `grep <pattern>` | Literal substring search (`-n` limit, `-i` case-insensitive, `-l` long) |
47
+ | `add [file\|url]` | Add from file, URL, stdin, or `$EDITOR` (`-t` title, `-d` description, `--tags`, `--type`) |
48
+ | `cat <query>` | Print content (`--raw` for frontmatter) |
49
+ | `cp <query> <dest>` | Copy content to file |
50
+ | `edit <query>` | Open in `$EDITOR` (`--raw` to edit frontmatter) |
51
+ | `update <query>` | Update metadata or content (`-t` title, `-d` description, `--tags`, `--type`, stdin for content) |
52
+ | `rm <query>` | Remove a memory |
53
+ | `ls` | List all (`-n` limit, `-l` long) |
54
+ | `push` | Git commit and push the memory folder |
55
+ | `reindex` | Rebuild search index |
56
+ | `import <dir>` | Import `.md` files from a directory |
57
+ | `mcp` | Start MCP server (stdio) |
58
+ | `serve` | Start HTTP server (`-p` port, `-H` host, `--token`, `--mcp`) |
59
+
60
+ Queries resolve in order: full UUID, UUID prefix (4+ chars), filename, FTS search.
61
+
62
+ `find`, `grep`, and `ls` support shared filters: `--type`, `--tag`, `--repo`, `--ext` (all support glob patterns).
63
+
64
+ ## MCP server
65
+
66
+ Add to your Claude Code or Claude Desktop config:
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "memory": {
72
+ "command": "mor",
73
+ "args": ["mcp"]
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ Tools: `memory_search`, `memory_read`, `memory_add`, `memory_update`, `memory_remove`, `memory_list`.
80
+
81
+ To make sure Claude Code checks mor first when you ask it to recall something, add this to `~/.claude/CLAUDE.md`:
82
+
83
+ ```markdown
84
+ ## Memory
85
+
86
+ When the user asks to recall, find, check, or reuse something they previously saved
87
+ or remembered — use the `mor` MCP server tools (`memory_search`, `memory_read`,
88
+ `memory_list`). This is the user's primary memory store containing code snippets,
89
+ files, and reference notes. Always check mor before saying something wasn't found.
90
+ ```
91
+
92
+ ## Remote access
93
+
94
+ Run the server on one machine, access from anywhere:
95
+
96
+ ```sh
97
+ # Server
98
+ mor serve --port 7677
99
+ ```
100
+
101
+ ```jsonc
102
+ // Client — ~/.config/mor/config.json
103
+ {
104
+ "server": {
105
+ "url": "http://mybox.tail1234.ts.net:7677",
106
+ "token": "optional-secret"
107
+ }
108
+ }
109
+ ```
110
+
111
+ All CLI commands and MCP tools transparently proxy over HTTP when `server` is configured.
112
+
113
+ ### HTTP API
114
+
115
+ | Method | Path | Description |
116
+ |--------|------|-------------|
117
+ | `GET` | `/health` | Health check |
118
+ | `GET` | `/memories` | List all |
119
+ | `GET` | `/memories/search?q=...&limit=N` | FTS search |
120
+ | `GET` | `/memories/grep?q=...&limit=N&ignoreCase=1` | Literal substring search |
121
+ | `GET` | `/memories/:query` | Read one |
122
+ | `POST` | `/memories` | Create (`{title, content, tags?, type?}`) |
123
+ | `PUT` | `/memories/:query` | Update (`{title?, content?, tags?, type?}`) |
124
+ | `DELETE` | `/memories/:query` | Remove |
125
+
126
+ Auth: `Authorization: Bearer <token>` header when token is configured.
127
+
128
+ ## Embeddings (experimental)
129
+
130
+ Optionally augment FTS search with vector similarity. Configure in `~/.config/mor/config.json`:
131
+
132
+ ```json
133
+ {
134
+ "embedding": {
135
+ "provider": "openai",
136
+ "model": "text-embedding-3-small",
137
+ "dimensions": 1536
138
+ }
139
+ }
140
+ ```
141
+
142
+ Providers: `openai` (or compatible API via `baseUrl`), `azure-openai`, `ollama`. Run `mor reindex` after configuring.
143
+
144
+ Azure OpenAI uses `AZURE_OPENAI_API_KEY` (or `apiKey` in config) and requires a `deployment` name (defaults to model name).
145
+
146
+ ## Storage
147
+
148
+ Memories are markdown files with YAML frontmatter, stored in `~/.config/mor/memories/` with a SQLite index at `~/.config/mor/index.db`. Override with `MOR_HOME`.
149
+
150
+ ```
151
+ ~/.config/mor/
152
+ config.json
153
+ index.db
154
+ memories/
155
+ python-naming-a1b2.md
156
+ meeting-notes-c3d4.md
157
+ ```
158
+
159
+ Files are human-readable and git-friendly. Use `mor push` to commit and push if the memory folder is a git repo.
160
+
161
+ ## License
162
+
163
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};