fossel 1.0.9 → 1.1.1

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 +125 -45
  2. package/dist/cli.js +2002 -257
  3. package/dist/index.js +1471 -102
  4. package/package.json +3 -2
package/README.md CHANGED
@@ -14,13 +14,13 @@
14
14
 
15
15
  2. **Add the JSON** from the output to **Cursor** (`~/.cursor/mcp.json`) or **Claude Desktop** MCP settings, then restart the app.
16
16
 
17
- 3. **Run the server** (what the IDE launches, or for testing):
17
+ 3. **Run the server** (what the IDE launches; you can also run it manually for testing):
18
18
 
19
19
  ```bash
20
20
  npx -y fossel
21
21
  ```
22
22
 
23
- 4. In chat, use tools like `store_context` and `get_repo_context` with your **repo** name (e.g. `org/repo` or your folder name).
23
+ 4. In chat, just say *"remember this"* and Fossel handles the rest. See [Simple mode](#simple-mode-recommended) below.
24
24
 
25
25
  **Database path:** `~/.fossel/memory.db` (override with `FOSSEL_DB_PATH`).
26
26
 
@@ -31,78 +31,94 @@
31
31
  | You get | Details |
32
32
  |--------|---------|
33
33
  | **Local data** | SQLite + migrations; nothing leaves your disk unless you share it. |
34
- | **Repo-scoped memory** | Same patterns across Cursor, Claude, or any MCP client over stdio. |
34
+ | **Repo-scoped memory** | One canonical key per repo; aliases collapse automatically. |
35
35
  | **Find anything** | FTS5 search across notes; pin what matters; summarize for PRs. |
36
+ | **Ambient capture** | Natural-language `remember`; dedupes near-duplicates on save. |
36
37
  | **Evolving schema** | Startup migrations keep upgrades safe for existing databases. |
37
38
 
38
39
  ---
39
40
 
40
- ## Features
41
+ ## Simple mode (recommended)
41
42
 
42
- - Persistent memory in SQLite (`~/.fossel/memory.db`)
43
- - Full-text search (FTS5)
44
- - Repo-aware context, grouped by memory type
45
- - Pinned memories at the top of `get_repo_context`
46
- - `summarize_repo_context` for markdown briefs (PRs, planning)
47
- - `update_memory`, `pin_memory`, `unpin_memory`
48
- - CLI: `fossel init` for onboarding
49
- - `stdio` MCP server for Cursor, Claude Desktop, and compatible tools
43
+ Two tools cover the 80% case. Neither needs you to specify `type` or `tags`.
50
44
 
51
- ## Memory types
45
+ ### `remember` — save a memory
52
46
 
53
- - `convention`, `bug_fix`, `reviewer_pattern`, `decision`, `issue`, `general`
47
+ Just send a sentence. Fossel infers the memory type, generates tags, resolves the repo, and merges near-duplicates into the existing row.
54
48
 
55
- ## Commands
49
+ > **You:** Remember: JWT lives in localStorage and 401 redirects to /login.
50
+ >
51
+ > **Agent calls** `remember({ note: "JWT lives in localStorage and 401 redirects to /login." })`
52
+ >
53
+ > **Fossel:** Stored as `convention` with tags `jwt, auth, login` for `7vignesh/fossel`.
56
54
 
57
- ```bash
58
- npx -y fossel # MCP server over stdio
59
- npx -y fossel init # onboarding + config snippets + sample memory
60
- ```
55
+ ### `get_context` — pull repo context
56
+
57
+ Pinned first, then recent, then FTS matches if you pass a `query`. Default limit of 8 is tuned for LLM context injection.
58
+
59
+ > **You:** What does Fossel remember about auth here?
60
+ >
61
+ > **Agent calls** `get_context({ query: "auth" })`
62
+ >
63
+ > **Fossel:** returns a markdown block ready to drop into the system prompt.
61
64
 
62
- ## `fossel init`
65
+ That's it for daily use. The repo is detected from your `cwd` automatically.
63
66
 
64
- Detects the current git repo (or folder name), prints **Cursor** and **Claude Desktop** MCP snippets, inserts a starter **convention** memory (`Fossel is active for this repo…`), and shows DB path + memory count.
67
+ ### Zero-prompt usage in Cursor
65
68
 
66
- ## MCP tools
69
+ Fossel exposes a static MCP resource at `fossel://context/current-repo`. Cursor and Claude Desktop list resources on session start, so Fossel's pinned + recent memories show up before you type anything. Clients that don't list resources can still call `get_context` from the agent's first turn — that's all the prompting needed.
70
+
71
+ ---
72
+
73
+ ## Advanced mode
74
+
75
+ Every original tool is still available for power users.
67
76
 
68
77
  | Tool | Purpose |
69
78
  |------|---------|
70
- | `store_context` | Save memory for a repo |
71
- | `get_repo_context` | Recent memories by type (pinned first) |
72
- | `search_memory` | FTS search, optional repo filter |
73
- | `delete_memory` | Delete by legacy string id |
74
- | `update_memory` | Partial update by numeric id |
75
- | `pin_memory` / `unpin_memory` | Pin important items |
76
- | `summarize_repo_context` | Markdown summary for a repo |
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. |
90
+
91
+ ### Memory types
77
92
 
78
- ## Tool examples
93
+ `convention`, `bug_fix`, `reviewer_pattern`, `decision`, `issue`, `general`.
79
94
 
80
- ### `update_memory`
95
+ ### Tool examples
96
+
97
+ `store_context` (explicit form):
81
98
 
82
99
  ```json
83
100
  {
84
- "id": 12,
85
- "content": "Use `pnpm` workspaces for all package scripts.",
86
- "memory_type": "convention"
101
+ "repo": "7vignesh/fossel",
102
+ "type": "convention",
103
+ "note": "Use pnpm workspaces for all package scripts.",
104
+ "tags": ["pnpm", "workspaces"]
87
105
  }
88
106
  ```
89
107
 
90
- ### `pin_memory`
108
+ `pin_memory`:
91
109
 
92
110
  ```json
93
111
  { "id": 12 }
94
112
  ```
95
113
 
96
- ### `summarize_repo_context`
114
+ `summarize_repo_context`:
97
115
 
98
116
  ```json
99
- { "repo": "RocketChat" }
117
+ { "repo": "RocketChat/Rocket.Chat" }
100
118
  ```
101
119
 
102
- Example output shape:
103
-
104
120
  ```md
105
- Fossel Context Summary: RocketChat
121
+ Fossel Context Summary: RocketChat/Rocket.Chat
106
122
 
107
123
  📌 Pinned
108
124
  - (12) Always run test matrix before merge.
@@ -114,6 +130,57 @@ Bug Fixes
114
130
  - (5) Fixed webhook retries by making queue idempotent.
115
131
  ```
116
132
 
133
+ `dedupe_repo` (dry run, then apply):
134
+
135
+ ```json
136
+ { "repo": "7vignesh/fossel", "apply": false }
137
+ { "repo": "7vignesh/fossel", "apply": true, "threshold": 0.85 }
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Repo identity
143
+
144
+ Fossel resolves the canonical key for your workspace in this order:
145
+
146
+ 1. `git remote get-url origin` → normalized to `owner/repo`
147
+ 2. folder basename
148
+ 3. anything you pass explicitly is recorded as an alias of the above
149
+
150
+ Memories saved under any alias are reachable from the canonical key, and `npx fossel init` automatically merges legacy alias rows (e.g. `studentmanager` → `7vignesh/student-manager`).
151
+
152
+ ---
153
+
154
+ ## Commands
155
+
156
+ ```bash
157
+ npx -y fossel # MCP server over stdio
158
+ npx -y fossel init # onboarding + canonical key + safe alias merge
159
+ npx -y fossel doctor # diagnose repo sprawl, duplicates, MCP config
160
+ ```
161
+
162
+ ### `fossel init`
163
+
164
+ Detects the canonical repo key, prints **Cursor** and **Claude Desktop** MCP snippets, merges legacy alias rows into the canonical key, and inserts a starter memory only when the database is empty.
165
+
166
+ ### `fossel doctor`
167
+
168
+ Reports on:
169
+
170
+ - canonical repo key for the workspace
171
+ - sibling keys that look like the same repo (offers a fix)
172
+ - exact-duplicate memory clusters (suggests `fossel doctor --fix` or `dedupe_repo`)
173
+ - memory notes that still mention deprecated repo keys
174
+ - detected MCP config files
175
+
176
+ 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.
177
+
178
+ ### `fossel init`
179
+
180
+ `fossel init` auto-deduplicates exact duplicate memories at the end of the run; pass `--no-dedupe` to opt out.
181
+
182
+ ---
183
+
117
184
  ## Cursor MCP config
118
185
 
119
186
  `~/.cursor/mcp.json`:
@@ -123,7 +190,10 @@ Bug Fixes
123
190
  "mcpServers": {
124
191
  "fossel": {
125
192
  "command": "npx",
126
- "args": ["-y", "fossel"]
193
+ "args": ["-y", "fossel"],
194
+ "env": {
195
+ "FOSSEL_WORKSPACE": "${workspaceFolder}"
196
+ }
127
197
  }
128
198
  }
129
199
  }
@@ -136,20 +206,30 @@ Bug Fixes
136
206
  "mcpServers": {
137
207
  "fossel": {
138
208
  "command": "npx",
139
- "args": ["-y", "fossel"]
209
+ "args": ["-y", "fossel"],
210
+ "env": {
211
+ "FOSSEL_WORKSPACE": "/absolute/path/to/your/project"
212
+ }
140
213
  }
141
214
  }
142
215
  }
143
216
  ```
144
217
 
218
+ `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.
219
+
220
+ ---
221
+
145
222
  ## Development (from source)
146
223
 
147
224
  ```bash
148
225
  npm install
149
226
  npm run dev # MCP server over stdio
227
+ npm run typecheck
228
+ npm test # unit tests (node:test via tsx)
229
+ npm run smoke # end-to-end MCP roundtrip
150
230
  npm run build
151
231
  npm run start # node dist/index.js
152
- npm run ci # typecheck + build + smoke
232
+ npm run ci # typecheck + tests + build + smoke
153
233
  ```
154
234
 
155
235
  ## Notes
@@ -157,8 +237,8 @@ npm run ci # typecheck + build + smoke
157
237
  - **Local-first:** data stays on your machine.
158
238
  - **Search:** FTS5 (no `sqlite-vec` in v1).
159
239
  - **`FOSSEL_DB_PATH`:** optional override for DB location (e.g. tests).
160
- - **Schema:** migrations live in `src/db/migrate.ts`.
240
+ - **Schema:** migrations live in `src/db/migrate.ts`; reference shape in `src/db/schema.sql`.
161
241
 
162
242
  ## Community
163
243
 
164
- 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.
244
+ 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.