@facthouse/mcp 0.27.1 → 0.28.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 (62) hide show
  1. package/README.md +38 -27
  2. package/dist/cli/index.d.ts +5 -26
  3. package/dist/cli/index.d.ts.map +1 -1
  4. package/dist/cli/index.js +6 -781
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/cli/init-backfill.d.ts +23 -4
  7. package/dist/cli/init-backfill.d.ts.map +1 -1
  8. package/dist/cli/init-backfill.js +33 -12
  9. package/dist/cli/init-backfill.js.map +1 -1
  10. package/dist/cli/init-knobs.d.ts +22 -11
  11. package/dist/cli/init-knobs.d.ts.map +1 -1
  12. package/dist/cli/init-knobs.js +69 -33
  13. package/dist/cli/init-knobs.js.map +1 -1
  14. package/dist/cli/init-wizard.d.ts +2 -0
  15. package/dist/cli/init-wizard.d.ts.map +1 -1
  16. package/dist/cli/init-wizard.js +7 -5
  17. package/dist/cli/init-wizard.js.map +1 -1
  18. package/dist/cli/init.d.ts +6 -1
  19. package/dist/cli/init.d.ts.map +1 -1
  20. package/dist/cli/init.js +31 -8
  21. package/dist/cli/init.js.map +1 -1
  22. package/dist/cli/query.js +4 -4
  23. package/dist/cli/run.d.ts +31 -0
  24. package/dist/cli/run.d.ts.map +1 -0
  25. package/dist/cli/run.js +787 -0
  26. package/dist/cli/run.js.map +1 -0
  27. package/dist/cli/settings.d.ts.map +1 -1
  28. package/dist/cli/settings.js +3 -3
  29. package/dist/cli/settings.js.map +1 -1
  30. package/dist/cli/web.d.ts.map +1 -1
  31. package/dist/cli/web.js +3 -8
  32. package/dist/cli/web.js.map +1 -1
  33. package/dist/identity.d.ts +7 -0
  34. package/dist/identity.d.ts.map +1 -1
  35. package/dist/identity.js +13 -0
  36. package/dist/identity.js.map +1 -1
  37. package/dist/index.d.ts +3 -5
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +4 -271
  40. package/dist/index.js.map +1 -1
  41. package/dist/intelligence/consolidate.d.ts +7 -1
  42. package/dist/intelligence/consolidate.d.ts.map +1 -1
  43. package/dist/intelligence/consolidate.js +19 -5
  44. package/dist/intelligence/consolidate.js.map +1 -1
  45. package/dist/server.d.ts +8 -0
  46. package/dist/server.d.ts.map +1 -0
  47. package/dist/server.js +274 -0
  48. package/dist/server.js.map +1 -0
  49. package/dist/suppress-sqlite-warning.d.ts +2 -0
  50. package/dist/suppress-sqlite-warning.d.ts.map +1 -0
  51. package/dist/suppress-sqlite-warning.js +29 -0
  52. package/dist/suppress-sqlite-warning.js.map +1 -0
  53. package/dist/tools/fact-manager.d.ts.map +1 -1
  54. package/dist/tools/fact-manager.js +6 -8
  55. package/dist/tools/fact-manager.js.map +1 -1
  56. package/dist/tools/resources.js +3 -3
  57. package/dist/tools/resources.js.map +1 -1
  58. package/dist/types/config.d.ts +5 -3
  59. package/dist/types/config.d.ts.map +1 -1
  60. package/dist/types/config.js +7 -1
  61. package/dist/types/config.js.map +1 -1
  62. package/package.json +1 -1
package/README.md CHANGED
@@ -16,7 +16,18 @@ It records, stores, and retrieves structured knowledge. Domain routing, entity e
16
16
 
17
17
  Needs Node 22.5 or 24+.
18
18
 
19
- Paste this. Restart the client. The server creates `~/.facthouse` on first boot.
19
+ <!-- x-release-please-start-version -->
20
+ ```bash
21
+ npm install -g @facthouse/mcp@0.28.1
22
+ facthouse init
23
+ ```
24
+ <!-- x-release-please-end -->
25
+
26
+ If npm install -g fails because a command named mcp already exists, remove that leftover command and retry.
27
+
28
+ Press Enter to accept each default (copy = Claude Code or Cursor session logs on disk; type record if the assistant should save facts). If you picked copy, init asks whether to copy existing logs, then whether to extract and integrate. Init prints an MCP snippet — paste it into the client and restart.
29
+
30
+ To skip the wizard (record only — no transcript copy), paste this. The server creates `~/.facthouse` on first boot; you are not asked those questions.
20
31
 
21
32
  <!-- x-release-please-start-version -->
22
33
  ```json
@@ -24,7 +35,7 @@ Paste this. Restart the client. The server creates `~/.facthouse` on first boot.
24
35
  "mcpServers": {
25
36
  "facthouse": {
26
37
  "command": "npx",
27
- "args": ["-y", "@facthouse/mcp@0.27.1"]
38
+ "args": ["-y", "@facthouse/mcp@0.28.1"]
28
39
  }
29
40
  }
30
41
  }
@@ -41,9 +52,9 @@ Two ways. Pick one per store.
41
52
 
42
53
  | | Copy from transcripts | The assistant records |
43
54
  |---|---|---|
44
- | Who | Claude Code or Cursor, when that client writes a JSONL file here | Any MCP client (Grok Build, Desktop, …) |
45
- | How | Name a source; Facthouse copies new lines into your file | Empty `sources`; the assistant calls `capture_fact` |
46
- | First run | TTY walk-through, pick **copy**, set cwd, then `facthouse consolidate` | The paste above (already record) |
55
+ | Who | Claude Code or Cursor (session logs on disk, under the client home) | Any MCP client (Grok, Desktop, …) |
56
+ | How | Name a source; Facthouse copies new lines from those logs into the store | Empty `sources`; the assistant calls `capture_fact` |
57
+ | First run | TTY walk-through, pick **copy**, set cwd; init asks whether to copy existing logs, then whether to extract and integrate | The paste above (already record) |
47
58
 
48
59
  On a copy store, capture_fact is a correction for every MCP client, not only the one that writes JSONL. Grok has no transcript adapter — do not put Claude Code on copy and Grok on the same store expecting Grok to record.
49
60
 
@@ -51,7 +62,7 @@ On a copy store, capture_fact is a correction for every MCP client, not only the
51
62
  facthouse init
52
63
  ```
53
64
 
54
- Pick copy, set cwd, then `facthouse consolidate` once. It copies your transcripts, extracts facts from the oldest 50 events, and integrates them; `--all` takes the whole backlog. After that, the server copies new lines when it handles a call.
65
+ Pick copy, set cwd. Init asks whether to copy existing logs, then whether to extract and integrate (Enter = all copied lines). Decline extract to do that later with `facthouse consolidate` (`--all` takes the whole backlog). After that, the server copies new lines when it handles a call.
55
66
 
56
67
  Compact (optional): `facthouse notify compaction` — not a turn-end Stop hook.
57
68
 
@@ -75,13 +86,13 @@ One SQLite database. Three tables in it, not three databases:
75
86
 
76
87
  FTS5 (words) and optional embeddings (meaning) are indexes of **K**. They are not a second store. Semantic search is off unless you turn it on: `search "shellfish"` finds a shellfish fact, `search "food"` does not, until you choose an embedding model — a model is an opinion about what “similar” means.
77
88
 
78
- Two speeds. **Extract** turns new transcript lines into self-contained facts. **Integrate** fits them into what the store already knows: domains, entities, duplicates, contradictions, the graph. `consolidate` runs copy, extract, and integrate together — in the server at session start and at compaction, or by hand from the CLI. Extract is capped at 50 events per run, so a first backfill is never spent on the lot. The MCP server copies the raw log on a call; it does not extract then. Consolidation does not invent a sentence nobody said.
89
+ Two speeds. **Extract** turns new transcript lines into self-contained facts. **Integrate** fits them into what the store already knows: domains, entities, duplicates, contradictions, the graph. `consolidate` runs copy, extract, and integrate together — in the server at session start and at compaction, or by hand from the CLI. Extract is capped at 50 lines per run, so a first backfill is never spent on the lot; each automatic run extracts facts from the oldest 50 lines. The MCP server copies the raw log on a call; it does not extract then. Consolidation does not invent a sentence nobody said.
79
90
 
80
91
  Storage needs Node. Intelligence needs a language model. By default that is the [Claude Code CLI](https://github.com/anthropics/claude-code) on your existing subscription. Without it, consolidation falls back to a built-in heuristic that **does not extract facts from transcripts**. `capture_fact` still stores facts, with no entities and no domain routing.
81
92
 
82
93
  ## MCP
83
94
 
84
- Works with Claude Code, Claude Desktop, and any MCP-compatible tool. Data is stored at `~/.facthouse` by default. That one directory is the whole install. To use a different path, add `"env": { "FACTHOUSE_DATA": "/absolute/path" }` to the MCP snippet. JSON accepts forward slashes on Windows.
95
+ Works with Claude Code, Claude Desktop, and any MCP-compatible tool. Data is stored at `~/.facthouse` by default. That one directory is the whole install. To use a different path, add `"env": { "FACTHOUSE_DATA": "/absolute/path" }` to the MCP snippet. JSON accepts forward slashes on Windows. FACTHOUSE_DATA on an MCP snippet applies only to that server process. A terminal facthouse command needs --data, or FACTHOUSE_DATA in the environment that shell inherits. Hooks do not see mcp.json env.
85
96
 
86
97
  Cursor consumes tools but not resources until a later adapter exists — `search_knowledge` and `get_entity` still work there; call `get_session_context` at session start.
87
98
 
@@ -119,21 +130,21 @@ Both are read-only views over the same database the tools query. Clients that ne
119
130
 
120
131
  ## CLI
121
132
 
122
- The MCP JSON starts the server via npx and does not need a global install. npm install -g puts facthouse on PATH for init, settings, stats, and inspect. The same CLI without PATH is npx -y -p "@facthouse/mcp" -- facthouse — pin the version; quote the package so PowerShell does not splat. -p and -- stop an older global binary winning. npx -y @facthouse/mcp with no -p / facthouse is the server; do not run it as a shell command for init, settings, or stats.
133
+ The MCP JSON starts the server via npx and does not need a global install. npm install -g puts facthouse on PATH for init, settings, stats, and inspect. The same CLI without PATH is npx -y -p "@facthouse/mcp" -- facthouse — pin the version; quote the package so PowerShell does not splat. -p and -- stop an older global binary winning. npx -y @facthouse/mcp with no -p / facthouse is the server; do not run it as a shell command for init, settings, or stats. The MCP paste starts the server. It does not put facthouse on PATH. To inspect the file from a terminal, see CLI below.
123
134
 
124
- These CLI commands work in bash, zsh, and PowerShell. Quote @facthouse/mcp in PowerShell. Git Bash /c/... paths are not PowerShell; use C:/... and pass --data instead of cd or export. ~/ is expanded on every platform. WSL uses /mnt/c/....
135
+ These CLI commands work in bash, zsh, and PowerShell. Quote @facthouse/mcp in PowerShell. Git Bash /c/... paths are not PowerShell; use C:/... and pass --data instead of cd or export. In Git Bash, quote a backslash path or write C:/... — unquoted \ is an escape. ~/ is expanded on every platform. WSL uses /mnt/c/.... FACTHOUSE_DATA on an MCP snippet applies only to that server process. A terminal facthouse command needs --data, or FACTHOUSE_DATA in the environment that shell inherits. Hooks do not see mcp.json env.
125
136
 
126
137
  <!-- x-release-please-start-version -->
127
138
  ```bash
128
- npm install -g @facthouse/mcp@0.27.1
139
+ npm install -g @facthouse/mcp@0.28.1
129
140
  facthouse init --yes
130
141
  ```
131
142
 
132
143
  ```bash
133
- npx -y -p "@facthouse/mcp@0.27.1" -- facthouse init --yes
134
- npx -y -p "@facthouse/mcp@0.27.1" -- facthouse settings --json
135
- npx -y -p "@facthouse/mcp@0.27.1" -- facthouse stats
136
- npx -y -p "@facthouse/mcp@0.27.1" -- facthouse inspect
144
+ npx -y -p "@facthouse/mcp@0.28.1" -- facthouse init --yes
145
+ npx -y -p "@facthouse/mcp@0.28.1" -- facthouse settings --json
146
+ npx -y -p "@facthouse/mcp@0.28.1" -- facthouse stats
147
+ npx -y -p "@facthouse/mcp@0.28.1" -- facthouse inspect
137
148
  ```
138
149
  <!-- x-release-please-end -->
139
150
 
@@ -209,10 +220,10 @@ facthouse consolidate --all # extract the whole backlog now
209
220
  facthouse consolidate --limit 200 # extract the oldest 200
210
221
 
211
222
  # Steps — named steps run, in order; none named means all three:
212
- # -c, --copy copy new transcript lines into events
213
- # -e, --extract turn new events into candidate facts (the model call)
223
+ # -c, --copy copy new transcript lines into the store
224
+ # -e, --extract turn new lines into candidate facts (the model call)
214
225
  # -i, --integrate classify, link, dedupe, supersede, embed
215
- # Extract is capped at 50 events per run so a first backfill is never spent on
226
+ # Extract is capped at 50 lines per run so a first backfill is never spent on
216
227
  # the lot; the run says how many remain. --all lifts the cap, --limit N sets it.
217
228
  # --json print the result object instead of the summary
218
229
  # --data Data directory (default: ~/.facthouse or FACTHOUSE_DATA)
@@ -277,7 +288,7 @@ facthouse inspect --entity Helios --limit 20 --output ~/inspect.html
277
288
 
278
289
  ### Another store
279
290
 
280
- You do not need two installs. The default is one directory and one MCP server named `facthouse`. A second store is a second directory — not a filter on which client wrote the row. Work and personal is one reason to split, not a required setup.
291
+ The store is this directory. Clients share it by using the same path. A second store is a second directory, not a second install. The default MCP server name is `facthouse`. Splitting is not a filter on which client wrote the row. Work and personal is one reason to split, not a required setup.
281
292
 
282
293
  A non-default data directory prints a distinct MCP server name so two stores can share one `mcp.json`. Init against each extra directory prints that snippet. Example:
283
294
 
@@ -287,12 +298,12 @@ A non-default data directory prints a distinct MCP server name so two stores can
287
298
  "mcpServers": {
288
299
  "facthouse-personal": {
289
300
  "command": "npx",
290
- "args": ["-y", "@facthouse/mcp@0.27.1"],
301
+ "args": ["-y", "@facthouse/mcp@0.28.1"],
291
302
  "env": { "FACTHOUSE_DATA": "C:\\Users\\alex\\.facthouse-personal" }
292
303
  },
293
304
  "facthouse-work": {
294
305
  "command": "npx",
295
- "args": ["-y", "@facthouse/mcp@0.27.1"],
306
+ "args": ["-y", "@facthouse/mcp@0.28.1"],
296
307
  "env": { "FACTHOUSE_DATA": "C:\\Users\\alex\\.facthouse-work" }
297
308
  }
298
309
  }
@@ -300,7 +311,7 @@ A non-default data directory prints a distinct MCP server name so two stores can
300
311
  ```
301
312
  <!-- x-release-please-end -->
302
313
 
303
- Point each store's `sources.cwd` (or hook `--data`) at that store only. Two directories do not isolate anything if both copy the same home.
314
+ Point each store's `sources.cwd` (or hook `--data`) at that store only. Two directories do not isolate anything if both copy the same home. FACTHOUSE_DATA on an MCP snippet applies only to that server process. A terminal facthouse command needs --data, or FACTHOUSE_DATA in the environment that shell inherits. Hooks do not see mcp.json env.
304
315
 
305
316
  ### Postgres (optional)
306
317
 
@@ -318,7 +329,7 @@ Example — placeholders only; do not put a real password in a committed file:
318
329
  "mcpServers": {
319
330
  "facthouse": {
320
331
  "command": "npx",
321
- "args": ["-y", "@facthouse/mcp@0.27.1"],
332
+ "args": ["-y", "@facthouse/mcp@0.28.1"],
322
333
  "env": {
323
334
  "FACTHOUSE_DATA": "C:\\Users\\alex\\.facthouse-work",
324
335
  "FACTHOUSE_STORAGE": "postgres",
@@ -348,7 +359,7 @@ Choose one mechanism per store.
348
359
  }
349
360
  ```
350
361
 
351
- `home` is the client config dir (`~/.claude` or `~/.cursor` — path examples, not extra discovery). Cursor is `"kind": "cursor"` and `home/projects/*/agent-transcripts/**/*.jsonl` only — not Composer SQLite. Cursor encodes `C:\\dev\\app` as `c-dev-app` (Claude Code uses `C--dev-app`). A first backfill of more than 50 events takes several runs, or one `facthouse consolidate --all`.
362
+ `home` is the client config dir (`~/.claude` or `~/.cursor` — path examples, not extra discovery). Cursor is `"kind": "cursor"` and `home/projects/*/agent-transcripts/**/*.jsonl` only — not Composer SQLite. Cursor encodes `C:\\dev\\app` as `c-dev-app` (Claude Code uses `C--dev-app`). A first backfill of more than 50 lines takes several runs, or one `facthouse consolidate --all`.
352
363
 
353
364
  **Alternative — record, no sources.** Leave `sources` empty. Pipe a client hook payload into `facthouse record` if you have one. MCP `log_event` / `capture_fact` keep working.
354
365
 
@@ -370,7 +381,7 @@ Do not install record hooks on this store — both write the same rows. Facthous
370
381
  "hooks": [
371
382
  {
372
383
  "type": "command",
373
- "command": "npx -y -p @facthouse/mcp@0.27.1 -- facthouse notify compaction --data /absolute/path/to/the-same-store"
384
+ "command": "npx -y -p @facthouse/mcp@0.28.1 -- facthouse notify compaction --data /absolute/path/to/the-same-store"
374
385
  }
375
386
  ]
376
387
  }
@@ -453,7 +464,7 @@ Throwaway store, not the capture path for a real Claude Code or Cursor home. The
453
464
  <!-- x-release-please-start-version -->
454
465
  ```bash
455
466
  export FACTHOUSE_DATA=/tmp/facthouse-demo
456
- om() { npx -y -p "@facthouse/mcp@0.27.1" -- facthouse "$@"; }
467
+ om() { npx -y -p "@facthouse/mcp@0.28.1" -- facthouse "$@"; }
457
468
 
458
469
  om init --yes
459
470
 
@@ -468,7 +479,7 @@ om stats
468
479
 
469
480
  ```powershell
470
481
  $env:FACTHOUSE_DATA = Join-Path $env:TEMP "facthouse-demo"
471
- function om { npx -y -p "@facthouse/mcp@0.27.1" -- facthouse @args }
482
+ function om { npx -y -p "@facthouse/mcp@0.28.1" -- facthouse @args }
472
483
  om init --yes
473
484
  om record --role user --content "I prefer dark mode in every editor, and I never want telemetry enabled."
474
485
  om record --role user --content "I am allergic to shellfish, so avoid seafood restaurants when booking anything."
@@ -1,30 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Facthouse CLI entry point.
4
- *
5
- * Public verbs: init, settings, record, notify, consolidate, search, stats,
6
- * inspect, prune. The 0.25 verbs `pull`, `signal`, and `log-event` are gone;
7
- * they print usage and exit 1. The vocabulary (copy, extract, integrate;
8
- * consolidate; moments) is defined once in src/intelligence/steps.ts.
3
+ * Thin loader so `suppress-sqlite-warning` evaluates before `node:sqlite` is
4
+ * even translated. A static import of sqlite in this file (via the rest of
5
+ * the CLI graph) emits ExperimentalWarning during graph load, before any
6
+ * wrap of process.emitWarning can run.
9
7
  */
10
- import { type ConsolidationResult } from "../intelligence/consolidate.js";
11
- import { type ConsolidateSteps } from "../intelligence/steps.js";
12
- import type { IntelligenceProvider } from "../intelligence/types.js";
13
- import type { EmbeddingProvider } from "../embedding/types.js";
14
- import { type ServerConfig } from "../types/config.js";
15
- interface ConsolidateStoreOpts {
16
- /** undefined: default cap; null: no cap; number: that many oldest events. */
17
- extractLimit?: number | null;
18
- /** Print the result object instead of the human summary. */
19
- json?: boolean;
20
- /** Print nothing on success (the init offer prints its own lines). */
21
- print?: boolean;
22
- }
23
- /**
24
- * Open the DB at dataDir, run consolidate() with the given provider and steps,
25
- * report, then close. The copy step reads `config.sources` through the same
26
- * copySources the server's heartbeat uses — one copy path.
27
- */
28
- export declare function consolidateInProcess(dataDir: string, provider: IntelligenceProvider, config?: Partial<ServerConfig>, embedding?: EmbeddingProvider | null, steps?: ConsolidateSteps, opts?: ConsolidateStoreOpts): Promise<ConsolidationResult | undefined>;
29
- export {};
8
+ import "../suppress-sqlite-warning.js";
30
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG;AAuDH,OAAO,EAAe,KAAK,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,EAKL,KAAK,gBAAgB,EAEtB,MAAM,0BAA0B,CAAC;AAMlC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgpBvE,UAAU,oBAAoB;IAC5B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,4DAA4D;IAC5D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAmDD;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,GAAE,OAAO,CAAC,YAAY,CAAkB,EAC9C,SAAS,GAAE,iBAAiB,GAAG,IAAW,EAC1C,KAAK,GAAE,gBAA4B,EACnC,IAAI,GAAE,oBAAyB,GAC9B,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CA+C1C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AACH,OAAO,+BAA+B,CAAC"}