fossel 1.1.0 → 1.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 (4) hide show
  1. package/README.md +91 -17
  2. package/dist/cli.js +739 -174
  3. package/dist/index.js +426 -73
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -20,7 +20,31 @@
20
20
  npx -y fossel
21
21
  ```
22
22
 
23
- 4. In chat, just say *"remember this"* and Fossel handles the rest. See [Simple mode](#simple-mode-recommended) below.
23
+ 4. In chat, say:
24
+
25
+ ```
26
+ remember: [anything about this repo]
27
+ ```
28
+
29
+ Then ask:
30
+
31
+ ```
32
+ what does Fossel remember about [topic]?
33
+ ```
34
+
35
+ 5. **Verify it works** — paste this in your AI chat:
36
+
37
+ ```
38
+ remember: Fossel is working in this repo
39
+ ```
40
+
41
+ Then immediately ask:
42
+
43
+ ```
44
+ what does Fossel remember?
45
+ ```
46
+
47
+ You should see your memory returned.
24
48
 
25
49
  **Database path:** `~/.fossel/memory.db` (override with `FOSSEL_DB_PATH`).
26
50
 
@@ -76,17 +100,14 @@ Every original tool is still available for power users.
76
100
 
77
101
  | Tool | Purpose |
78
102
  |------|---------|
79
- | `remember` | Natural-language save with auto-type/tags/dedupe (preferred). |
80
- | `get_context` | Unified pinned + recent + FTS retrieval. |
81
- | `resolve_repo` | Show canonical key, aliases, detected git remote. |
82
- | `dedupe_repo` | Find or merge near-duplicate memories. |
83
- | `store_context` | Explicit save with `type` and `tags`. |
84
- | `get_repo_context` | Recent memories grouped by type (pinned first). |
85
- | `search_memory` | FTS search, optional repo filter. |
86
- | `summarize_repo_context` | Markdown brief for a repo. |
87
- | `pin_memory` / `unpin_memory` | Pin important items. |
88
- | `update_memory` | Partial update by numeric id. |
89
- | `delete_memory` | Delete by legacy string id. |
103
+ | `remember` | Save a memory in natural language auto-infers type, tags, and repo |
104
+ | `get_context` | Retrieve relevant memories, pinned first then recent |
105
+ | `search_memory` | FTS search across notes, optional repo filter |
106
+ | `pin_memory` / `unpin_memory` | Pin important memories to always appear first |
107
+ | `delete_memory` | Delete by id |
108
+ | `update_memory` | Edit an existing memory by id |
109
+ | `dedupe_repo` | Merge near-duplicate memories |
110
+ | `summarize_repo_context` | Markdown summary — useful for PR descriptions |
90
111
 
91
112
  ### Memory types
92
113
 
@@ -169,10 +190,11 @@ Reports on:
169
190
 
170
191
  - canonical repo key for the workspace
171
192
  - sibling keys that look like the same repo (offers a fix)
172
- - exact-duplicate memory clusters (suggest `dedupe_repo`)
193
+ - exact-duplicate memory clusters (suggests `fossel doctor --fix` or `dedupe_repo`)
194
+ - memory notes that still mention deprecated repo keys
173
195
  - detected MCP config files
174
196
 
175
- Exits non-zero when issues are found so it can run in CI.
197
+ Pass `--fix` to apply safe automated cleanup in one go: merge sibling repo keys, rewrite stale alias mentions, and remove exact-text duplicates. Without `--fix` it's read-only and exits non-zero on issues so it can run in CI.
176
198
 
177
199
  ---
178
200
 
@@ -185,7 +207,10 @@ Exits non-zero when issues are found so it can run in CI.
185
207
  "mcpServers": {
186
208
  "fossel": {
187
209
  "command": "npx",
188
- "args": ["-y", "fossel"]
210
+ "args": ["-y", "fossel"],
211
+ "env": {
212
+ "FOSSEL_WORKSPACE": "${workspaceFolder}"
213
+ }
189
214
  }
190
215
  }
191
216
  }
@@ -198,12 +223,17 @@ Exits non-zero when issues are found so it can run in CI.
198
223
  "mcpServers": {
199
224
  "fossel": {
200
225
  "command": "npx",
201
- "args": ["-y", "fossel"]
226
+ "args": ["-y", "fossel"],
227
+ "env": {
228
+ "FOSSEL_WORKSPACE": "/path/to/your/project"
229
+ }
202
230
  }
203
231
  }
204
232
  }
205
233
  ```
206
234
 
235
+ `FOSSEL_WORKSPACE` pins Fossel to your project root. Without it, the server falls back to `process.cwd()`, which is occasionally wrong — Cursor and Claude Desktop sometimes spawn MCP servers from your home directory, which would silently route memories to the wrong repo. Cursor expands `${workspaceFolder}` automatically; Claude Desktop needs an absolute path.
236
+
207
237
  ---
208
238
 
209
239
  ## Development (from source)
@@ -222,10 +252,54 @@ npm run ci # typecheck + tests + build + smoke
222
252
  ## Notes
223
253
 
224
254
  - **Local-first:** data stays on your machine.
225
- - **Search:** FTS5 (no `sqlite-vec` in v1).
255
+ - **Search:** FTS5 keyword search by default. Optional **hybrid semantic search**
256
+ via `FOSSEL_EMBEDDINGS=1` (see below).
226
257
  - **`FOSSEL_DB_PATH`:** optional override for DB location (e.g. tests).
227
258
  - **Schema:** migrations live in `src/db/migrate.ts`; reference shape in `src/db/schema.sql`.
228
259
 
260
+ ## Hybrid semantic search (optional)
261
+
262
+ By default Fossel retrieves memories with FTS5 keyword search. Keyword search
263
+ misses paraphrases — a query like "how does authentication work?" won't match a
264
+ note that says "JWT lives in localStorage" because they share no words.
265
+
266
+ Set `FOSSEL_EMBEDDINGS=1` to enable **hybrid retrieval**: a local, dependency-free
267
+ embedding is computed for every memory and fused with the keyword results
268
+ (Reciprocal Rank Fusion). This adds semantic recall while keeping FTS5's exact-
269
+ match precision for identifiers, file paths, and ticket numbers.
270
+
271
+ ```json
272
+ {
273
+ "mcpServers": {
274
+ "fossel": {
275
+ "command": "npx",
276
+ "args": ["-y", "fossel"],
277
+ "env": {
278
+ "FOSSEL_WORKSPACE": "${workspaceFolder}",
279
+ "FOSSEL_EMBEDDINGS": "1"
280
+ }
281
+ }
282
+ }
283
+ }
284
+ ```
285
+
286
+ Properties:
287
+
288
+ - **Zero install weight / fully offline.** The embedding is a deterministic
289
+ feature-hashing of token unigrams and bigrams — no model download, no native
290
+ dependency, no network. It runs instantly and keeps the local-first promise.
291
+ - **Opt-in.** With the flag unset, Fossel behaves exactly as before: no vectors
292
+ are written and retrieval is FTS-only.
293
+ - **Self-healing index.** Memories created before enabling the flag are embedded
294
+ on demand the first time the repo is searched.
295
+ - **Pluggable.** `embedText` in `src/lib/embeddings.ts` is the single entry
296
+ point, so a stronger embedder (transformers.js, ONNX, or a remote model) can
297
+ be swapped in later without touching callers. Bump `EMBEDDING_VERSION` to
298
+ trigger automatic re-indexing of stale vectors.
299
+
300
+ Vectors are stored in a `memory_embeddings` side table keyed by memory rowid and
301
+ cleaned up via trigger when a memory is deleted.
302
+
229
303
  ## Community
230
304
 
231
305
  If Fossel saves you time, **[star the repo](https://github.com/7vignesh/fossel)** and **[open an issue](https://github.com/7vignesh/fossel/issues)** for bugs or ideas — that helps others discover it too.