@facthouse/mcp 0.30.0 → 0.31.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 (147) hide show
  1. package/README.md +49 -29
  2. package/dist/cli/eta.d.ts +15 -0
  3. package/dist/cli/eta.d.ts.map +1 -0
  4. package/dist/cli/eta.js +45 -0
  5. package/dist/cli/eta.js.map +1 -0
  6. package/dist/cli/init-backfill.d.ts +27 -5
  7. package/dist/cli/init-backfill.d.ts.map +1 -1
  8. package/dist/cli/init-backfill.js +122 -52
  9. package/dist/cli/init-backfill.js.map +1 -1
  10. package/dist/cli/init-knobs.d.ts +18 -2
  11. package/dist/cli/init-knobs.d.ts.map +1 -1
  12. package/dist/cli/init-knobs.js +50 -10
  13. package/dist/cli/init-knobs.js.map +1 -1
  14. package/dist/cli/init-wizard.d.ts +6 -2
  15. package/dist/cli/init-wizard.d.ts.map +1 -1
  16. package/dist/cli/init-wizard.js +1 -1
  17. package/dist/cli/init-wizard.js.map +1 -1
  18. package/dist/cli/init.d.ts +16 -6
  19. package/dist/cli/init.d.ts.map +1 -1
  20. package/dist/cli/init.js +45 -17
  21. package/dist/cli/init.js.map +1 -1
  22. package/dist/cli/inspect-match.d.ts +17 -0
  23. package/dist/cli/inspect-match.d.ts.map +1 -0
  24. package/dist/cli/inspect-match.js +100 -0
  25. package/dist/cli/inspect-match.js.map +1 -0
  26. package/dist/cli/inspect-payload.d.ts +20 -2
  27. package/dist/cli/inspect-payload.d.ts.map +1 -1
  28. package/dist/cli/inspect-payload.js +90 -38
  29. package/dist/cli/inspect-payload.js.map +1 -1
  30. package/dist/cli/inspect-progress.d.ts +14 -0
  31. package/dist/cli/inspect-progress.d.ts.map +1 -0
  32. package/dist/cli/inspect-progress.js +71 -0
  33. package/dist/cli/inspect-progress.js.map +1 -0
  34. package/dist/cli/inspect.d.ts.map +1 -1
  35. package/dist/cli/inspect.js +83 -67
  36. package/dist/cli/inspect.js.map +1 -1
  37. package/dist/cli/query.d.ts +3 -3
  38. package/dist/cli/query.d.ts.map +1 -1
  39. package/dist/cli/query.js +56 -11
  40. package/dist/cli/query.js.map +1 -1
  41. package/dist/cli/run.d.ts +13 -0
  42. package/dist/cli/run.d.ts.map +1 -1
  43. package/dist/cli/run.js +158 -39
  44. package/dist/cli/run.js.map +1 -1
  45. package/dist/cli/spend-dashboard.d.ts +1 -1
  46. package/dist/cli/spend-dashboard.d.ts.map +1 -1
  47. package/dist/cli/spend-dashboard.js +6 -5
  48. package/dist/cli/spend-dashboard.js.map +1 -1
  49. package/dist/cli/tty-progress.d.ts +19 -0
  50. package/dist/cli/tty-progress.d.ts.map +1 -0
  51. package/dist/cli/tty-progress.js +108 -0
  52. package/dist/cli/tty-progress.js.map +1 -0
  53. package/dist/config.d.ts +2 -0
  54. package/dist/config.d.ts.map +1 -1
  55. package/dist/config.js +4 -0
  56. package/dist/config.js.map +1 -1
  57. package/dist/db/embeddings.d.ts +2 -0
  58. package/dist/db/embeddings.d.ts.map +1 -1
  59. package/dist/db/embeddings.js +12 -0
  60. package/dist/db/embeddings.js.map +1 -1
  61. package/dist/db/extract-watermarks.d.ts +9 -0
  62. package/dist/db/extract-watermarks.d.ts.map +1 -1
  63. package/dist/db/extract-watermarks.js +10 -0
  64. package/dist/db/extract-watermarks.js.map +1 -1
  65. package/dist/db/stats.d.ts +13 -1
  66. package/dist/db/stats.d.ts.map +1 -1
  67. package/dist/db/stats.js +13 -1
  68. package/dist/db/stats.js.map +1 -1
  69. package/dist/embedding/provider.d.ts +13 -0
  70. package/dist/embedding/provider.d.ts.map +1 -1
  71. package/dist/embedding/provider.js +16 -8
  72. package/dist/embedding/provider.js.map +1 -1
  73. package/dist/intelligence/abort.d.ts +10 -0
  74. package/dist/intelligence/abort.d.ts.map +1 -0
  75. package/dist/intelligence/abort.js +18 -0
  76. package/dist/intelligence/abort.js.map +1 -0
  77. package/dist/intelligence/cli.d.ts +4 -0
  78. package/dist/intelligence/cli.d.ts.map +1 -1
  79. package/dist/intelligence/cli.js +46 -2
  80. package/dist/intelligence/cli.js.map +1 -1
  81. package/dist/intelligence/consolidate.d.ts +35 -3
  82. package/dist/intelligence/consolidate.d.ts.map +1 -1
  83. package/dist/intelligence/consolidate.js +167 -51
  84. package/dist/intelligence/consolidate.js.map +1 -1
  85. package/dist/intelligence/extract-prompt.d.ts +7 -0
  86. package/dist/intelligence/extract-prompt.d.ts.map +1 -1
  87. package/dist/intelligence/extract-prompt.js +26 -0
  88. package/dist/intelligence/extract-prompt.js.map +1 -1
  89. package/dist/intelligence/historic-selection.d.ts +20 -0
  90. package/dist/intelligence/historic-selection.d.ts.map +1 -0
  91. package/dist/intelligence/historic-selection.js +44 -0
  92. package/dist/intelligence/historic-selection.js.map +1 -0
  93. package/dist/intelligence/http.d.ts +2 -0
  94. package/dist/intelligence/http.d.ts.map +1 -1
  95. package/dist/intelligence/http.js +15 -1
  96. package/dist/intelligence/http.js.map +1 -1
  97. package/dist/intelligence/line-time.d.ts +15 -0
  98. package/dist/intelligence/line-time.d.ts.map +1 -0
  99. package/dist/intelligence/line-time.js +34 -0
  100. package/dist/intelligence/line-time.js.map +1 -0
  101. package/dist/intelligence/provider.d.ts +1 -0
  102. package/dist/intelligence/provider.d.ts.map +1 -1
  103. package/dist/intelligence/provider.js +1 -0
  104. package/dist/intelligence/provider.js.map +1 -1
  105. package/dist/intelligence/sampling.d.ts.map +1 -1
  106. package/dist/intelligence/sampling.js +4 -1
  107. package/dist/intelligence/sampling.js.map +1 -1
  108. package/dist/intelligence/stage-router.d.ts +1 -0
  109. package/dist/intelligence/stage-router.d.ts.map +1 -1
  110. package/dist/intelligence/stage-router.js +4 -1
  111. package/dist/intelligence/stage-router.js.map +1 -1
  112. package/dist/intelligence/steps.d.ts +14 -2
  113. package/dist/intelligence/steps.d.ts.map +1 -1
  114. package/dist/intelligence/steps.js +65 -2
  115. package/dist/intelligence/steps.js.map +1 -1
  116. package/dist/intelligence/types.d.ts +4 -1
  117. package/dist/intelligence/types.d.ts.map +1 -1
  118. package/dist/ipc/scheduler-ipc.d.ts +7 -3
  119. package/dist/ipc/scheduler-ipc.d.ts.map +1 -1
  120. package/dist/ipc/scheduler-ipc.js +23 -15
  121. package/dist/ipc/scheduler-ipc.js.map +1 -1
  122. package/dist/paths.d.ts +18 -3
  123. package/dist/paths.d.ts.map +1 -1
  124. package/dist/paths.js +38 -3
  125. package/dist/paths.js.map +1 -1
  126. package/dist/scheduler.d.ts +3 -2
  127. package/dist/scheduler.d.ts.map +1 -1
  128. package/dist/scheduler.js +3 -1
  129. package/dist/scheduler.js.map +1 -1
  130. package/dist/server.js +5 -3
  131. package/dist/server.js.map +1 -1
  132. package/dist/sources/cursor.d.ts.map +1 -1
  133. package/dist/sources/cursor.js +10 -2
  134. package/dist/sources/cursor.js.map +1 -1
  135. package/dist/tools/fact-manager.d.ts +7 -0
  136. package/dist/tools/fact-manager.d.ts.map +1 -1
  137. package/dist/tools/fact-manager.js +19 -2
  138. package/dist/tools/fact-manager.js.map +1 -1
  139. package/dist/tools/read-tools.d.ts +4 -1
  140. package/dist/tools/read-tools.d.ts.map +1 -1
  141. package/dist/tools/read-tools.js +14 -7
  142. package/dist/tools/read-tools.js.map +1 -1
  143. package/dist/types/config.d.ts +4 -0
  144. package/dist/types/config.d.ts.map +1 -1
  145. package/dist/types/config.js +4 -0
  146. package/dist/types/config.js.map +1 -1
  147. package/package.json +4 -3
package/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  <img src="brand/mark.png" width="128" align="right" alt="Facthouse">
4
4
 
5
- A local memory engine any AI tool can use.
6
-
7
- Not Mem0's hosted OpenMemory MCP at mcp.mem0.ai.
5
+ Facthouse is a local memory engine for AI tools. Most “memory” products index chat logs. Facthouse takes agent activity - messages, tool use, and other MCP traffic - and applies neuroscience-inspired consolidation so it moves through **Data** (what happened in the session) → **Information** (extracted facts) → **Knowledge** (integrated beliefs on an entity graph). During this process, Facthouse links entities, drops duplicates, reconciles conflicts, and supersedes what is out of date. Vector embeddings add optional semantic search on top of that graph. The store is a SQLite file on your disk.
8
6
 
9
7
  [![npm](https://img.shields.io/npm/v/@facthouse/mcp.svg)](https://www.npmjs.com/package/@facthouse/mcp)
10
8
  [![CI](https://github.com/gordonkjlee/facthouse/actions/workflows/ci.yml/badge.svg)](https://github.com/gordonkjlee/facthouse/actions/workflows/ci.yml)
@@ -18,7 +16,7 @@ Needs Node 22.5 or 24+.
18
16
 
19
17
  <!-- x-release-please-start-version -->
20
18
  ```bash
21
- npm install -g @facthouse/mcp@0.30.0
19
+ npm install -g @facthouse/mcp@0.31.0
22
20
  facthouse init
23
21
  ```
24
22
  <!-- x-release-please-end -->
@@ -27,7 +25,7 @@ If npm install -g fails because a command named mcp already exists, remove that
27
25
 
28
26
  `facthouse init --web` is the same setup as a browser form — it prints a 127.0.0.1 URL and does not open a browser.
29
27
 
30
- 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.
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 as soon as the store is written — add it to the client's MCP config while copy/extract run. Restart the client when init finishes.
31
29
 
32
30
  In the client, state something durable in ordinary conversation — there is no remember command.
33
31
 
@@ -53,7 +51,27 @@ One SQLite database. Three tables in it, not three databases: **Data** (what hap
53
51
 
54
52
  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.
55
53
 
56
- 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.
54
+ Two speeds. **Copy** tails named transcripts into Data. **Extract** turns new transcript lines into self-contained facts (D→I). **Integrate** fits them into what the store already knows: domains, entities, duplicates, contradictions, the graph (I→K). `consolidate` is the umbrella: copy, extract, and integrate together. Extract is capped at 50 lines per run, so a first backfill is never spent on the lot; when extract runs, it takes the oldest 50 lines. Consolidation does not invent a sentence nobody said.
55
+
56
+ A hook cannot call MCP tools — those exist only on the assistant’s connection — and it must not wait for a model pass. So it does not invoke `consolidate`. It runs `facthouse notify …`, which tells the **already-running** server that a moment happened and returns at once. `consolidate` is the pipeline verb (MCP tool or CLI); the caller waits. `notify compaction` is that verb asked of the live server, asynchronously. `notify threshold` is a different policy (extract only, if due).
57
+
58
+ **Automatic**
59
+
60
+ | When | Copy | Extract (D→I) | Integrate (I→K) |
61
+ |------|------|---------------|-----------------|
62
+ | Facthouse MCP server starts | yes | yes (cap 50) | yes |
63
+ | A Facthouse tool or resource is called | yes, if sources named and JSONL grew | no | no |
64
+ | Facthouse MCP process exits | no | no | yes |
65
+
66
+ **Callable**
67
+
68
+ | Call | From | Copy | Extract (D→I) | Integrate (I→K) |
69
+ |------|------|------|---------------|-----------------|
70
+ | `consolidate` | MCP tool or CLI. Caller waits. | yes | yes (cap 50) | yes |
71
+ | `facthouse notify compaction` | Other process (recommended PreCompact; we do not install). Does not wait. | yes | yes (cap 50) | yes |
72
+ | `facthouse notify threshold` | Other process. Does not wait. Not a copy-store hook. | no | yes, if due (cap 50) | no |
73
+
74
+ On a default copy store with no extra hooks, only the automatic table runs: Facthouse starts (all three), copy on each Facthouse tool or resource call if named sources grew, and integrate on a clean process exit. Closing a chat window may skip the exit row; the next start still consolidates. Due on threshold means at least 10 unexamined lines and two minutes since the last gated run. `consolidate --all` lifts the extract cap. Compaction is recommended PreCompact (`notify compaction`): same three steps as `consolidate`, on the running server, without waiting. We do not install the hook. Not a Stop hook. `record` wakes threshold extract on a record store — do not install record hooks on a copy store.
57
75
 
58
76
  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.
59
77
 
@@ -73,9 +91,9 @@ On a copy store, capture_fact is a correction for every MCP client, not only the
73
91
  facthouse init
74
92
  ```
75
93
 
76
- 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.
94
+ Pick copy, set cwd. Init asks whether to copy existing logs, then whether to extract and integrate (Enter = all copied lines; a selection of 500 or more asks you to type the choice again). Decline extract to do that later with `facthouse consolidate` (`--all` takes remaining unexamined lines, not ones skipped as outside a 7-day or 30-day window). After that, the server copies new lines when it handles a Facthouse call. Extract and integrate follow the table in [How it works](#how-it-works).
77
95
 
78
- Compact (optional): `facthouse notify compaction` — not a turn-end Stop hook.
96
+ Compact (recommended): `facthouse notify compaction` — we do not install the hook. Not a turn-end Stop hook.
79
97
 
80
98
  ## MCP
81
99
 
@@ -119,19 +137,19 @@ Both are read-only views over the same database the tools query. Clients that ne
119
137
 
120
138
  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.
121
139
 
122
- 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.
140
+ 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, FACTHOUSE_DATA in the environment that shell inherits, or a .facthouse store in this project. Hooks do not see mcp.json env.
123
141
 
124
142
  <!-- x-release-please-start-version -->
125
143
  ```bash
126
- npm install -g @facthouse/mcp@0.30.0
144
+ npm install -g @facthouse/mcp@0.31.0
127
145
  facthouse init --yes
128
146
  ```
129
147
 
130
148
  ```bash
131
- npx -y -p "@facthouse/mcp@0.30.0" -- facthouse init --yes
132
- npx -y -p "@facthouse/mcp@0.30.0" -- facthouse settings --json
133
- npx -y -p "@facthouse/mcp@0.30.0" -- facthouse stats
134
- npx -y -p "@facthouse/mcp@0.30.0" -- facthouse inspect
149
+ npx -y -p "@facthouse/mcp@0.31.0" -- facthouse init --yes
150
+ npx -y -p "@facthouse/mcp@0.31.0" -- facthouse settings --json
151
+ npx -y -p "@facthouse/mcp@0.31.0" -- facthouse stats
152
+ npx -y -p "@facthouse/mcp@0.31.0" -- facthouse inspect
135
153
  ```
136
154
  <!-- x-release-please-end -->
137
155
 
@@ -192,7 +210,7 @@ facthouse record --role user --event-type message --content "hello world"
192
210
  # --content Event content (or pipe via stdin)
193
211
  # --speaker Named participant when the transcript has one
194
212
  # --session-id Target session (default: most recent)
195
- # --data Data directory (default: ~/.facthouse or FACTHOUSE_DATA)
213
+ # --data Data directory (default: FACTHOUSE_DATA, a .facthouse store in this project, or ~/.facthouse)
196
214
  ```
197
215
 
198
216
  #### `facthouse consolidate`
@@ -213,7 +231,7 @@ facthouse consolidate --limit 200 # extract the oldest 200
213
231
  # Extract is capped at 50 lines per run so a first backfill is never spent on
214
232
  # the lot; the run says how many remain. --all lifts the cap, --limit N sets it.
215
233
  # --json print the result object instead of the summary
216
- # --data Data directory (default: ~/.facthouse or FACTHOUSE_DATA)
234
+ # --data Data directory (default: FACTHOUSE_DATA, a .facthouse store in this project, or ~/.facthouse)
217
235
  ```
218
236
 
219
237
  Honours the configured provider (by default `claude -p`). Empty `sources` makes the copy step a no-op. Set `cwd` on the source unless you intend to copy every project group. Do not also run `record` hooks on a store with named sources.
@@ -223,11 +241,11 @@ Honours the configured provider (by default `claude -p`). Empty `sources` makes
223
241
  Tell the running MCP server that a moment happened. The server decides what to run and does it in the background, so a hook returns at once:
224
242
 
225
243
  ```bash
226
- facthouse notify compaction # the client window is about to collapse: copy, extract, integrate now
244
+ facthouse notify compaction # client about to compact: copy new JSONL, extract, integrate (does not wait)
227
245
  facthouse notify threshold # events arrived: extract if the threshold is due
228
246
 
229
247
  # Options:
230
- # --data Data directory (default: ~/.facthouse or FACTHOUSE_DATA)
248
+ # --data Data directory (default: FACTHOUSE_DATA, a .facthouse store in this project, or ~/.facthouse)
231
249
  ```
232
250
 
233
251
  No server listening is not an error: the command says so and exits 0, and the next session start covers it. This is what the PreCompact hook calls.
@@ -243,7 +261,7 @@ facthouse search "coffee" --json
243
261
  # --domain Prioritise a domain. Biases ranking; does not filter
244
262
  # --limit Maximum results (default: 20)
245
263
  # --json Emit the raw search payload
246
- # --data Data directory (default: ~/.facthouse or FACTHOUSE_DATA)
264
+ # --data Data directory (default: FACTHOUSE_DATA, a .facthouse store in this project, or ~/.facthouse)
247
265
  ```
248
266
 
249
267
  `--domain` **biases ranking rather than filtering.** A hard filter would hide a fact filed under a near-synonym.
@@ -285,12 +303,12 @@ A non-default data directory prints a distinct MCP server name so two stores can
285
303
  "mcpServers": {
286
304
  "facthouse-personal": {
287
305
  "command": "npx",
288
- "args": ["-y", "@facthouse/mcp@0.30.0"],
306
+ "args": ["-y", "@facthouse/mcp@0.31.0"],
289
307
  "env": { "FACTHOUSE_DATA": "C:\\Users\\alex\\.facthouse-personal" }
290
308
  },
291
309
  "facthouse-work": {
292
310
  "command": "npx",
293
- "args": ["-y", "@facthouse/mcp@0.30.0"],
311
+ "args": ["-y", "@facthouse/mcp@0.31.0"],
294
312
  "env": { "FACTHOUSE_DATA": "C:\\Users\\alex\\.facthouse-work" }
295
313
  }
296
314
  }
@@ -316,7 +334,7 @@ Example — placeholders only; do not put a real password in a committed file:
316
334
  "mcpServers": {
317
335
  "facthouse": {
318
336
  "command": "npx",
319
- "args": ["-y", "@facthouse/mcp@0.30.0"],
337
+ "args": ["-y", "@facthouse/mcp@0.31.0"],
320
338
  "env": {
321
339
  "FACTHOUSE_DATA": "C:\\Users\\alex\\.facthouse-work",
322
340
  "FACTHOUSE_STORAGE": "postgres",
@@ -362,14 +380,16 @@ To skip the wizard (record only — no transcript copy), paste this. The server
362
380
  "mcpServers": {
363
381
  "facthouse": {
364
382
  "command": "npx",
365
- "args": ["-y", "@facthouse/mcp@0.30.0"]
383
+ "args": ["-y", "@facthouse/mcp@0.31.0"]
366
384
  }
367
385
  }
368
386
  }
369
387
  ```
370
388
  <!-- x-release-please-end -->
371
389
 
372
- ### Hooks (after the first consolidate)
390
+ ### Hooks
391
+
392
+ PreCompact `notify compaction` is the useful one: when the client is about to compact, a short-lived hook tells the **running** server, and the hook returns at once. The server copies new JSONL lines, then extracts and integrates — compaction does not delete the transcript, and the hook does not photocopy the live window. Init prints this JSON with `--data` filled in. Paste into Claude Code `.claude/settings.json` (user or project). We do not install it. Do not install a Stop hook. Do not install record hooks on this store — both write the same rows.
373
393
 
374
394
  `mcp.json` `env` is **not** visible to hooks. Pass the same `--data` (or set `FACTHOUSE_DATA` in the environment the client itself inherits). The command must invoke the CLI (`facthouse`), never the server binary. `npx -y @facthouse/mcp` with no `-p` / `facthouse` starts the MCP **server** and hangs a hook. Pin the package version, quote it if the hook runs PowerShell, and put `--` before `facthouse` so a globally installed older binary on PATH cannot win.
375
395
 
@@ -385,7 +405,7 @@ To skip the wizard (record only — no transcript copy), paste this. The server
385
405
  "hooks": [
386
406
  {
387
407
  "type": "command",
388
- "command": "npx -y -p @facthouse/mcp@0.30.0 -- facthouse notify compaction --data /absolute/path/to/the-same-store"
408
+ "command": "npx -y -p @facthouse/mcp@0.31.0 -- facthouse notify compaction --data /absolute/path/to/the-same-store"
389
409
  }
390
410
  ]
391
411
  }
@@ -468,7 +488,7 @@ Throwaway store, not the capture path for a real Claude Code or Cursor home. The
468
488
  <!-- x-release-please-start-version -->
469
489
  ```bash
470
490
  export FACTHOUSE_DATA=/tmp/facthouse-demo
471
- om() { npx -y -p "@facthouse/mcp@0.30.0" -- facthouse "$@"; }
491
+ om() { npx -y -p "@facthouse/mcp@0.31.0" -- facthouse "$@"; }
472
492
 
473
493
  om init --yes
474
494
 
@@ -483,7 +503,7 @@ om stats
483
503
 
484
504
  ```powershell
485
505
  $env:FACTHOUSE_DATA = Join-Path $env:TEMP "facthouse-demo"
486
- function om { npx -y -p "@facthouse/mcp@0.30.0" -- facthouse @args }
506
+ function om { npx -y -p "@facthouse/mcp@0.31.0" -- facthouse @args }
487
507
  om init --yes
488
508
  om record --role user --content "I prefer dark mode in every editor, and I never want telemetry enabled."
489
509
  om record --role user --content "I am allergic to shellfish, so avoid seafood restaurants when booking anything."
@@ -526,7 +546,7 @@ Create `.claude/rules/facthouse.md` in your project (or `~/.claude/rules/facthou
526
546
  # Facthouse
527
547
 
528
548
  - Conversations are copied from the named Claude Code source (first backfill: `facthouse consolidate` on the CLI)
529
- - Do not install record hooks on this store
549
+ - Do not install record hooks on this store — both write the same rows.
530
550
  - Identity context loads automatically from the `memory://profile` resource — no tool call needed
531
551
  - Before answering questions this store might already know, call `search_knowledge`
532
552
  - Call `capture_fact` only to correct or add something that is not in the transcript
@@ -555,7 +575,7 @@ When the facthouse MCP server is available:
555
575
  - Before answering questions this store might already know, call search_knowledge
556
576
  - To find out everything known about a particular person, project, or thing, call get_entity
557
577
  - Call capture_fact only to correct or add something copy or extraction missed
558
- - When context is getting long, call consolidate to process pending facts before they are lost
578
+ - When context is getting long, call consolidate
559
579
  ```
560
580
 
561
581
  Cursor and Windsurf consume tools but not resources, so `memory://profile` will not load on its own there. Cursor conversations themselves are copied with `kind: "cursor"` (JSONL under `~/.cursor/projects/`, not the SQLite composer store).
@@ -0,0 +1,15 @@
1
+ /**
2
+ * TTY remaining-time from recent model-chunk samples. Skips do not sample.
3
+ */
4
+ export declare class ChunkEta {
5
+ private readonly durations;
6
+ private readonly lines;
7
+ noteModelChunk(durationMs: number, lineCount: number): void;
8
+ /** Same estimator; units are facts in an embed batch, not extract lines. */
9
+ noteBatch(durationMs: number, factCount: number): void;
10
+ reset(): void;
11
+ /** Remaining milliseconds, or null until MIN_SAMPLES model chunks. */
12
+ etaMs(linesLeft: number): number | null;
13
+ }
14
+ export declare function formatEta(ms: number): string;
15
+ //# sourceMappingURL=eta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eta.d.ts","sourceRoot":"","sources":["../../src/cli/eta.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IAEtC,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAU3D,4EAA4E;IAC5E,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAItD,KAAK,IAAI,IAAI;IAKb,sEAAsE;IACtE,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CASxC;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAK5C"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * TTY remaining-time from recent model-chunk samples. Skips do not sample.
3
+ */
4
+ const WINDOW = 8;
5
+ const MIN_SAMPLES = 3;
6
+ export class ChunkEta {
7
+ durations = [];
8
+ lines = [];
9
+ noteModelChunk(durationMs, lineCount) {
10
+ if (!(durationMs > 0) || !(lineCount > 0))
11
+ return;
12
+ this.durations.push(durationMs);
13
+ this.lines.push(lineCount);
14
+ if (this.durations.length > WINDOW) {
15
+ this.durations.shift();
16
+ this.lines.shift();
17
+ }
18
+ }
19
+ /** Same estimator; units are facts in an embed batch, not extract lines. */
20
+ noteBatch(durationMs, factCount) {
21
+ this.noteModelChunk(durationMs, factCount);
22
+ }
23
+ reset() {
24
+ this.durations.length = 0;
25
+ this.lines.length = 0;
26
+ }
27
+ /** Remaining milliseconds, or null until MIN_SAMPLES model chunks. */
28
+ etaMs(linesLeft) {
29
+ if (this.durations.length < MIN_SAMPLES || linesLeft <= 0)
30
+ return null;
31
+ const meanMs = this.durations.reduce((a, b) => a + b, 0) / this.durations.length;
32
+ const meanLines = this.lines.reduce((a, b) => a + b, 0) / this.lines.length;
33
+ if (!(meanLines > 0))
34
+ return null;
35
+ return Math.round((linesLeft / meanLines) * meanMs);
36
+ }
37
+ }
38
+ export function formatEta(ms) {
39
+ const totalSec = Math.max(1, Math.round(ms / 1000));
40
+ if (totalSec < 60)
41
+ return `${totalSec}s`;
42
+ const min = Math.round(totalSec / 60);
43
+ return `${min}m`;
44
+ }
45
+ //# sourceMappingURL=eta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eta.js","sourceRoot":"","sources":["../../src/cli/eta.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,GAAG,CAAC,CAAC;AACjB,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,OAAO,QAAQ;IACF,SAAS,GAAa,EAAE,CAAC;IACzB,KAAK,GAAa,EAAE,CAAC;IAEtC,cAAc,CAAC,UAAkB,EAAE,SAAiB;QAClD,IAAI,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC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AC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,UAAU,SAAS,CAAC,EAAU;IAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IACpD,IAAI,QAAQ,GAAG,EAAE;QAAE,OAAO,GAAG,QAAQ,GAAG,CAAC;IACzC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;IACtC,OAAO,GAAG,GAAG,GAAG,CAAC;AACnB,CAAC"}
@@ -5,6 +5,7 @@
5
5
  * server. Copy fills D only (no model). Extract and integrate spend model
6
6
  * calls.
7
7
  */
8
+ import type { HistoricSelection } from "../intelligence/historic-selection.js";
8
9
  import { type InitIo } from "./init-wizard.js";
9
10
  export declare function shouldOfferInitBackfill(opts: {
10
11
  ttyWalk: boolean;
@@ -31,22 +32,43 @@ export type HistoricExtractChoice = {
31
32
  kind: "retry";
32
33
  };
33
34
  export declare function parseHistoricExtract(raw: string): HistoricExtractChoice;
35
+ export declare function historicChoiceToken(choice: HistoricExtractChoice): string | null;
34
36
  export interface InitBackfillConsolidateOpts {
35
37
  /** null = every remaining line; a number = oldest n. */
36
38
  extractLimit: number | null;
37
39
  /** When set, older lines are marked examined without a model call. */
38
40
  extractSince?: Date;
41
+ progressTotal?: number;
42
+ abort?: AbortSignal;
43
+ }
44
+ export interface InitBackfillConsolidateResult {
45
+ factsIntegrated: number;
46
+ eventsRemaining: number;
47
+ skipped?: boolean;
48
+ skipReason?: string;
49
+ extractionDegraded?: boolean;
50
+ prefixCommitted?: boolean;
51
+ examinedThrough?: number;
52
+ aborted?: boolean;
53
+ embedding?: {
54
+ error?: string;
55
+ };
56
+ }
57
+ export interface InitBackfillResult {
58
+ aborted: boolean;
39
59
  }
40
60
  export interface InitBackfillDeps {
41
61
  copy: (dataDir: string) => Promise<{
42
62
  events_inserted: number;
43
63
  }>;
44
64
  unextracted: (dataDir: string) => Promise<number>;
45
- consolidate: (dataDir: string, opts: InitBackfillConsolidateOpts) => Promise<{
46
- factsIntegrated: number;
47
- eventsRemaining: number;
48
- } | undefined>;
65
+ selection: (dataDir: string, choice: Exclude<HistoricExtractChoice, {
66
+ kind: "skip" | "retry";
67
+ }>) => Promise<HistoricSelection>;
68
+ consolidate: (dataDir: string, opts: InitBackfillConsolidateOpts) => Promise<InitBackfillConsolidateResult | undefined>;
49
69
  providerIsHeuristic: boolean;
70
+ hasCursor?: boolean;
71
+ abort?: AbortSignal;
50
72
  }
51
- export declare function offerInitBackfill(io: InitIo, dataDir: string, deps: InitBackfillDeps): Promise<void>;
73
+ export declare function offerInitBackfill(io: InitIo, dataDir: string, deps: InitBackfillDeps): Promise<InitBackfillResult>;
52
74
  //# sourceMappingURL=init-backfill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init-backfill.d.ts","sourceRoot":"","sources":["../../src/cli/init-backfill.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAS,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEtD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAIV;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,aAAa,EAAE,OAAO,CAAC;IACvB,GAAG,EAAE,OAAO,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,OAAO,CAEV;AAED,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACf;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5B;IAAE,IAAI,EAAE,MA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ED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,SAAS,EAAE,CACT,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,CAAC,qBAAqB,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,KAC/D,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC,WAAW,EAAE,CACX,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,2BAA2B,KAC9B,OAAO,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;IACxD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAiBD,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAuG7B"}
@@ -6,8 +6,10 @@
6
6
  * calls.
7
7
  */
8
8
  import { storeHasNamedSources } from "../tools/capture-fact-description.js";
9
+ import { HISTORIC_CONFIRM_LINES } from "../intelligence/steps.js";
9
10
  import { INIT_PROMPTS } from "./init-knobs.js";
10
11
  import { yesNo } from "./init-wizard.js";
12
+ import { isConsolidateAbort } from "../intelligence/abort.js";
11
13
  export function shouldOfferInitBackfill(opts) {
12
14
  return (opts.ttyWalk && opts.wroteConfig && storeHasNamedSources(opts.sources));
13
15
  }
@@ -16,69 +18,137 @@ export function stdinCanAskHistoric(opts) {
16
18
  return opts.usedTtyWizard || (opts.web && opts.stdinIsTTY);
17
19
  }
18
20
  export function parseHistoricExtract(raw) {
19
- const t = raw.trim().toLowerCase();
20
- if (t === "" || t === "all")
21
+ const token = raw.trim().toLowerCase();
22
+ if (token === "" || token === "all")
21
23
  return { kind: "all" };
22
- if (t === "n" || t === "no")
24
+ if (token === "n" || token === "no")
23
25
  return { kind: "skip" };
24
- const days = /^([1-9]\d*)d$/.exec(t);
26
+ const days = /^([1-9]\d*)d$/.exec(token);
25
27
  if (days)
26
28
  return { kind: "days", days: Number(days[1]) };
27
- if (/^[1-9]\d*$/.test(t))
28
- return { kind: "limit", n: Number.parseInt(t, 10) };
29
+ if (/^[1-9]\d*$/.test(token))
30
+ return { kind: "limit", n: Number.parseInt(token, 10) };
29
31
  return { kind: "retry" };
30
32
  }
33
+ export function historicChoiceToken(choice) {
34
+ if (choice.kind === "all")
35
+ return "all";
36
+ if (choice.kind === "days")
37
+ return `${choice.days}d`;
38
+ if (choice.kind === "limit")
39
+ return String(choice.n);
40
+ return null;
41
+ }
42
+ function consolidateOpts(extract, chosenCount, abort) {
43
+ const base = { progressTotal: chosenCount, abort };
44
+ if (extract.kind === "all")
45
+ return { ...base, extractLimit: null };
46
+ if (extract.kind === "limit")
47
+ return { ...base, extractLimit: extract.n };
48
+ return {
49
+ ...base,
50
+ extractLimit: null,
51
+ extractSince: new Date(Date.now() - extract.days * 24 * 60 * 60 * 1000),
52
+ };
53
+ }
31
54
  export async function offerInitBackfill(io, dataDir, deps) {
32
- let copyNow = yesNo(await io.question(INIT_PROMPTS.historicCopy), "yes");
33
- while (copyNow === "retry") {
34
- copyNow = yesNo(await io.question(INIT_PROMPTS.historicCopy), "yes");
35
- }
36
- if (copyNow !== "yes")
37
- return;
38
- io.write(INIT_PROMPTS.copyingNow);
39
- let inserted;
40
- try {
41
- inserted = (await deps.copy(dataDir)).events_inserted;
42
- }
43
- catch (err) {
44
- const message = err instanceof Error ? err.message : String(err);
45
- io.write(message);
46
- return;
47
- }
48
- io.write(INIT_PROMPTS.copiedLines(inserted));
49
- if (inserted === 0)
50
- return;
51
- const pending = await deps.unextracted(dataDir);
52
- if (pending <= 0)
53
- return;
54
- if (deps.providerIsHeuristic) {
55
- io.write(INIT_PROMPTS.extractSkippedHeuristic);
56
- return;
57
- }
58
- let extract = parseHistoricExtract(await io.question(INIT_PROMPTS.historicExtract));
59
- while (extract.kind === "retry") {
60
- extract = parseHistoricExtract(await io.question(INIT_PROMPTS.historicExtract));
61
- }
62
- if (extract.kind === "skip")
63
- return;
64
- const opts = extract.kind === "all"
65
- ? { extractLimit: null }
66
- : extract.kind === "limit"
67
- ? { extractLimit: extract.n }
68
- : {
69
- extractLimit: null,
70
- extractSince: new Date(Date.now() - extract.days * 24 * 60 * 60 * 1000),
71
- };
72
- io.write(INIT_PROMPTS.extractingNow(pending));
55
+ const ask = (prompt) => io.question(prompt, { signal: deps.abort });
73
56
  try {
74
- const result = await deps.consolidate(dataDir, opts);
75
- if (result) {
76
- io.write(INIT_PROMPTS.integrated(result.factsIntegrated, result.eventsRemaining));
57
+ let copyNow = yesNo(await ask(INIT_PROMPTS.historicCopy), "yes");
58
+ while (copyNow === "retry") {
59
+ copyNow = yesNo(await ask(INIT_PROMPTS.historicCopy), "yes");
77
60
  }
61
+ if (copyNow !== "yes")
62
+ return { aborted: false };
63
+ io.write(INIT_PROMPTS.copyingNow);
64
+ let inserted;
65
+ try {
66
+ inserted = (await deps.copy(dataDir)).events_inserted;
67
+ }
68
+ catch (err) {
69
+ const message = err instanceof Error ? err.message : String(err);
70
+ io.write(message);
71
+ return { aborted: false };
72
+ }
73
+ io.write(INIT_PROMPTS.copiedLines(inserted));
74
+ if (inserted === 0)
75
+ return { aborted: false };
76
+ const pending = await deps.unextracted(dataDir);
77
+ if (pending <= 0)
78
+ return { aborted: false };
79
+ if (deps.providerIsHeuristic) {
80
+ io.write(INIT_PROMPTS.extractSkippedHeuristic);
81
+ return { aborted: false };
82
+ }
83
+ const prompt = INIT_PROMPTS.historicExtract(pending, {
84
+ hasCursor: deps.hasCursor,
85
+ });
86
+ let extract = parseHistoricExtract(await ask(prompt));
87
+ while (extract.kind === "retry") {
88
+ extract = parseHistoricExtract(await ask(prompt));
89
+ }
90
+ if (extract.kind === "skip")
91
+ return { aborted: false };
92
+ let selection = await deps.selection(dataDir, extract);
93
+ while (selection.chosenCount >= HISTORIC_CONFIRM_LINES) {
94
+ const token = historicChoiceToken(extract);
95
+ const raw = await ask(INIT_PROMPTS.historicExtractConfirm(token, selection.chosenCount, selection.truncatedChars));
96
+ if (raw.trim() === "")
97
+ continue;
98
+ const next = parseHistoricExtract(raw);
99
+ if (next.kind === "retry")
100
+ continue;
101
+ if (next.kind === "skip")
102
+ return { aborted: false };
103
+ const nextToken = historicChoiceToken(next);
104
+ if (nextToken === token)
105
+ break;
106
+ extract = next;
107
+ selection = await deps.selection(dataDir, extract);
108
+ }
109
+ io.write(INIT_PROMPTS.extractingNow(selection.chosenCount));
110
+ try {
111
+ const result = await deps.consolidate(dataDir, consolidateOpts(extract, selection.chosenCount, deps.abort));
112
+ if (result?.aborted) {
113
+ io.write(INIT_PROMPTS.extractInterrupted(result.eventsRemaining));
114
+ return { aborted: true };
115
+ }
116
+ if (result?.skipped && result.skipReason) {
117
+ io.write(result.skipReason);
118
+ return { aborted: false };
119
+ }
120
+ if (result?.extractionDegraded) {
121
+ io.write(result.prefixCommitted
122
+ ? INIT_PROMPTS.extractDegradedKept(result.examinedThrough ?? 0)
123
+ : INIT_PROMPTS.extractDegradedHeld);
124
+ if (!result.prefixCommitted)
125
+ return { aborted: false };
126
+ }
127
+ if (result) {
128
+ io.write(INIT_PROMPTS.integrated(result.factsIntegrated, result.eventsRemaining));
129
+ if (result.embedding?.error) {
130
+ io.write(INIT_PROMPTS.embedFailed(result.embedding.error));
131
+ }
132
+ }
133
+ }
134
+ catch (err) {
135
+ if (isConsolidateAbort(err)) {
136
+ const remaining = await deps.unextracted(dataDir);
137
+ io.write(INIT_PROMPTS.extractInterrupted(remaining));
138
+ return { aborted: true };
139
+ }
140
+ const message = err instanceof Error ? err.message : String(err);
141
+ io.write(message);
142
+ }
143
+ return { aborted: false };
78
144
  }
79
145
  catch (err) {
80
- const message = err instanceof Error ? err.message : String(err);
81
- io.write(message);
146
+ if (isConsolidateAbort(err) || (err instanceof Error && err.name === "AbortError")) {
147
+ const remaining = await deps.unextracted(dataDir).catch(() => 0);
148
+ io.write(INIT_PROMPTS.extractInterrupted(remaining));
149
+ return { aborted: true };
150
+ }
151
+ throw err;
82
152
  }
83
153
  }
84
154
  //# sourceMappingURL=init-backfill.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init-backfill.js","sourceRoot":"","sources":["../../src/cli/init-backfill.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAEtD,MAAM,UAAU,uBAAuB,CAAC,IAIvC;IACC,OAAO,CACL,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,IAAI,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CACvE,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,mBAAmB,CAAC,IAInC;IACC,OAAO,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;AAC7D,CAAC;AASD,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,KAAK;QAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACpD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,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AAE,CAAC;IAC5B,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,IAAI,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE,CAAC;YACnF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;YACjE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;YACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -112,13 +112,25 @@ export declare const INIT_PROMPTS: {
112
112
  readonly projectGroupMissing: (home: string, cwd: string, encoded: string) => string;
113
113
  readonly gitBashCwdHint: (cwd: string, encoded: string) => string;
114
114
  readonly historicCopy: string;
115
- readonly historicExtract: string;
115
+ readonly historicExtract: (n: number, opts?: {
116
+ hasCursor?: boolean;
117
+ }) => string;
118
+ readonly historicExtractConfirm: (choice: string, chosenCount: number, truncatedChars: number) => string;
116
119
  readonly copyingNow: "Copying transcripts…";
117
120
  readonly copiedLines: (n: number) => string;
118
121
  readonly extractingNow: (n: number) => string;
119
- readonly extractProgress: (done: number, total: number) => string;
122
+ readonly extractProgress: (done: number, total: number, etaMs?: number | null) => string;
123
+ readonly extractIdle: "Still working. A quiet gap is idle silence, not the whole job dying.";
124
+ readonly integratingNow: (n: number) => string;
125
+ readonly embeddingNow: "Checking embeddings…";
126
+ readonly embedProgress: (done: number, total: number, etaMs?: number | null) => string;
127
+ readonly semanticBackfill: "Not yet embedded. Run facthouse consolidate --integrate.";
128
+ readonly embedFailed: (err: string) => string;
129
+ readonly extractInterrupted: (remaining: number) => string;
120
130
  readonly extractTimedOut: (idleSeconds: number) => string;
121
131
  readonly extractSkippedHeuristic: "Skipped extract — the heuristic does not read transcripts.";
132
+ readonly extractDegradedKept: (through: number) => string;
133
+ readonly extractDegradedHeld: "Extraction could not run — events were not examined and the watermark was held. A zero factsIntegrated here is not a successful empty extract. Re-run facthouse consolidate when the CLI provider can run.";
122
134
  /** After the init offer ran extract + integrate. Same channel as the prompts. */
123
135
  readonly integrated: (facts: number, remaining: number) => string;
124
136
  readonly captureDeclined: "Capture: copy is off (record). capture_fact is how facts get in; a client hook can pipe into facthouse record.";
@@ -129,8 +141,12 @@ export declare const INIT_PROMPTS: {
129
141
  readonly copyStorewide: "On a copy store, capture_fact is a correction for every MCP client, not only the one that writes JSONL.";
130
142
  readonly webExisting: "config.json already exists — left unchanged; --web does not start a page. Run facthouse settings --web for extra knobs, or --force to reset.";
131
143
  readonly mcpVsCli: string;
144
+ /** Printed as soon as the store exists, before historic copy/extract. */
145
+ readonly mcpPaste: string;
132
146
  /** Quick Start: MCP paste is not a shell install. */
133
147
  readonly mcpPasteNoCli: string;
148
+ readonly mcpRestart: "Restart the client if you already added the snippet.";
149
+ readonly compactionHookLead: "Recommended PreCompact hook — paste into Claude Code `.claude/settings.json` (we do not install it). Notifies the running server when the client is about to compact; returns at once. `--data` is required; hooks do not see mcp.json env:";
134
150
  readonly mcpInstallClash: "If npm install -g fails because a command named mcp already exists, remove that leftover command and retry.";
135
151
  /** Quick Start after `npm install -g` + TTY init. */
136
152
  readonly quickStartNext: string;