human-hindsight 1.7.0 → 1.8.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.
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  </p>
14
14
 
15
15
  ```bash
16
- npx human-hindsight
16
+ npx human-hindsight@latest
17
17
  ```
18
18
 
19
19
  Human Hindsight mines your coding-agent session history (Claude Code, Codex, Kiro, OpenCode)
@@ -87,35 +87,51 @@ The second prompt was knowable at t=0. You just hadn't written it yet.
87
87
 
88
88
  ## Quickstart
89
89
 
90
- One command builds the whole library and shows it to you when it's done:
90
+ Start the guided terminal workflow:
91
91
 
92
92
  ```bash
93
- npx human-hindsight distill # offers to export first, then digest → cluster →
93
+ npx human-hindsight@latest
94
+ ```
95
+
96
+ After scanning, the CLI suggests **export** and asks whether to run it.
97
+ Type `y` to continue. Export offers **distill**, and a successful distillation
98
+ offers the browser library. Your library directory, source, project filter,
99
+ runner, and model stay selected through the handoffs.
100
+
101
+ Distillation still shows its model-call plan and asks for spending consent.
102
+ Follow-up offers default to No and appear only in an interactive terminal.
103
+ Use `--no-follow-up` for one command at a time; pipes, dry runs, and scripted
104
+ `--yes` invocations never start these follow-up commands automatically.
105
+
106
+ You can also start directly with distillation:
107
+
108
+ ```bash
109
+ npx human-hindsight@latest distill # offers to export first, then digest → cluster →
94
110
  # author (asks before any runner call), then shows
95
- # you the finished library
111
+ # offers the finished library in your browser
96
112
  ```
97
113
 
98
114
  Prefer to drive each stage yourself? The pipeline is just three verbs:
99
115
 
100
116
  ```bash
101
- npx human-hindsight # 1. scan: inventory your projects (read-only)
102
- npx human-hindsight export # 2. export: human-only markdown per session
103
- npx human-hindsight distill # 3. distill: digest → cluster → author (asks first)
117
+ npx human-hindsight@latest # 1. scan: inventory your projects (read-only)
118
+ npx human-hindsight@latest export # 2. export: human-only markdown per session
119
+ npx human-hindsight@latest distill # 3. distill: digest → cluster → author (asks first)
104
120
  ```
105
121
 
106
122
  Then browse and curate the results:
107
123
 
108
124
  ```bash
109
- npx human-hindsight list # your library (✎ edited / ▲▼ rating badges)
110
- npx human-hindsight gui # browse, search, and copy in your browser
111
- npx human-hindsight show <slug> # read a oneshot
112
- npx human-hindsight copy <slug> # → clipboard, paste into a fresh session
113
- npx human-hindsight edit <slug> # open in $EDITOR; your edits are protected
114
- npx human-hindsight rate <slug> up # record a verdict (up|down)
115
- npx human-hindsight prune # remove orphaned entries (asks first)
116
- npx human-hindsight preferences # → CLAUDE.md block
117
- npx human-hindsight status # pipeline funnel + orphan/skip flags
118
- npx human-hindsight retention # optional: preview longer local retention
125
+ npx human-hindsight@latest list # your library (✎ edited / ▲▼ rating badges)
126
+ npx human-hindsight@latest gui # browse, search, and copy in your browser
127
+ npx human-hindsight@latest show <slug> # read a oneshot
128
+ npx human-hindsight@latest copy <slug> # → clipboard, paste into a fresh session
129
+ npx human-hindsight@latest edit <slug> # open in $EDITOR; your edits are protected
130
+ npx human-hindsight@latest rate <slug> up # record a verdict (up|down)
131
+ npx human-hindsight@latest prune # remove orphaned entries (asks first)
132
+ npx human-hindsight@latest preferences # → CLAUDE.md block
133
+ npx human-hindsight@latest status # pipeline funnel + orphan/skip flags
134
+ npx human-hindsight@latest retention # optional: preview longer local retention
119
135
  ```
120
136
 
121
137
  Requires Node 22.13+ on Node 22, or Node 23.4+ on newer releases, on macOS or Linux (Windows is untested and currently
@@ -126,20 +142,55 @@ with a consent prompt (or your explicit `--yes`).
126
142
  ### A small local library viewer
127
143
 
128
144
  ```bash
129
- npx human-hindsight gui # start locally and open your browser
130
- npx human-hindsight gui --no-open # print the address without opening it
131
- npx human-hindsight gui --port 3210 # choose a port (default: any available port)
132
- npx human-hindsight gui --home /path/to/library-home
145
+ npx human-hindsight@latest gui # start locally and open your browser
146
+ npx human-hindsight@latest gui --no-open # print the address without opening it
147
+ npx human-hindsight@latest gui --port 3210 # choose a port (default: any available port)
148
+ npx human-hindsight@latest gui --home /path/to/library-home
133
149
  ```
134
150
 
135
- Search prompt titles and text, filter by domain, sort, and copy the prompt
136
- body with one click. The viewer shows your existing library, including local
137
- edits, ratings, and session counts. Use **Refresh** after changing files.
138
- Light and dark appearance follow your system setting, and the layout works
139
- on narrow screens. Press `/` to focus search.
151
+ Switch between **Prompts** and **Preferences** to search, filter by domain,
152
+ sort, and copy items with one click. Preferences are deduplicated across tasks
153
+ and can be sorted by frequency, recency, or text. Search also matches their
154
+ evidence and source prompt titles.
155
+ Domain filters start with broad categories and reveal optional subdomains,
156
+ up to five levels deep. Selecting a parent includes all its descendants.
157
+ Existing flat labels are grouped locally without changing the library or
158
+ making a model call; newly distilled sessions use hierarchical domain paths.
159
+ **Preview** renders Markdown headings, lists, tables, links, blockquotes, task
160
+ lists, and code blocks. **Markdown** shows the original source. Copy always
161
+ uses that original Markdown, including when the preview is selected.
162
+
163
+ Each prompt links to its observed preferences; each preference shows its
164
+ evidence and links back to the source prompts. You can bookmark either view
165
+ and use your browser's Back and Forward buttons. **View all preferences**
166
+ opens a combined Markdown block ready to copy into `CLAUDE.md` or `AGENTS.md`.
167
+
168
+ The tips bar starts with an open-source and privacy reminder, then rotates
169
+ through quick tips with copyable `npx human-hindsight@latest` commands.
170
+ Pause it, hide it, or restore it with **Show tips**. Hidden tips stay hidden
171
+ when you reload the same local address.
172
+
173
+ Export and distill show an open-source/privacy reminder near the start.
174
+ Interactive terminals get a colorful elapsed-time progress indicator during
175
+ scanning, export, and model work; redirected output stays free of animation.
176
+
177
+ Consolidation is optional: `npx human-hindsight@latest preferences --consolidate`
178
+ uses one call through your own coding harness and its configured provider,
179
+ with consent and the subscription/credit cost explained first. Successful
180
+ results are saved, with their Markdown and input metadata, in
181
+ `<home>/library/preferences.consolidated.json`. Refresh the GUI to open
182
+ **Saved consolidation**. It flags results whose observed preferences have
183
+ changed. Failed or declined calls leave the last saved result intact.
184
+
185
+ The viewer uses a minimal black-and-white palette and system monospace fonts.
186
+ Light and dark appearance follow your system setting. Local edits, ratings,
187
+ and session counts remain visible. Use **Refresh** after changing files and
188
+ press `/` to focus search.
140
189
 
141
190
  The GUI uses Node's built-in HTTP server and bundled HTML/CSS/JavaScript:
142
- no additional dependencies, frontend framework, database, or external assets.
191
+ no frontend framework, database, font download, or external assets.
192
+ Markdown parsing and sanitization ship inside the bundle. Raw HTML stays
193
+ inert and remote images are represented by their alt text, without fetching them.
143
194
  It listens only on `127.0.0.1`, serves a read-only library API, and stops with
144
195
  Ctrl+C. The GUI doesn't invoke an agent or modify your library.
145
196
 
@@ -179,14 +230,14 @@ then falls back in the order Claude → Codex → Kiro → OpenCode. Models are
179
230
  with `--model`; without it, the chosen CLI uses its configured default.
180
231
 
181
232
  ```bash
182
- npx human-hindsight export --source codex
183
- npx human-hindsight distill --source codex --runner codex
184
- npx human-hindsight distill --source claude --runner codex
185
- npx human-hindsight preferences --target codex # AGENTS.md; alias of --target agents
186
- npx human-hindsight export --source opencode
187
- npx human-hindsight distill --source opencode --runner opencode
188
- npx human-hindsight distill --source claude --runner opencode --model provider/model
189
- npx human-hindsight preferences --target opencode # AGENTS.md
233
+ npx human-hindsight@latest export --source codex
234
+ npx human-hindsight@latest distill --source codex --runner codex
235
+ npx human-hindsight@latest distill --source claude --runner codex
236
+ npx human-hindsight@latest preferences --target codex # AGENTS.md; alias of --target agents
237
+ npx human-hindsight@latest export --source opencode
238
+ npx human-hindsight@latest distill --source opencode --runner opencode
239
+ npx human-hindsight@latest distill --source claude --runner opencode --model provider/model
240
+ npx human-hindsight@latest preferences --target opencode # AGENTS.md
190
241
  ```
191
242
 
192
243
  `preferences --target claude|codex|kiro|opencode|agents` emits a `CLAUDE.md` block,
@@ -236,10 +287,10 @@ OpenCode preferences can go into the project's `AGENTS.md`, or the global
236
287
  ### Optional: keep more local history
237
288
 
238
289
  ```bash
239
- npx human-hindsight retention # read-only preview
240
- npx human-hindsight retention --apply # preview, then confirm
241
- npx human-hindsight retention --apply --yes # explicit opt-in for scripting
242
- npx human-hindsight retention --source codex --apply
290
+ npx human-hindsight@latest retention # read-only preview
291
+ npx human-hindsight@latest retention --apply # preview, then confirm
292
+ npx human-hindsight@latest retention --apply --yes # explicit opt-in for scripting
293
+ npx human-hindsight@latest retention --source codex --apply
243
294
  ```
244
295
 
245
296
  The default reviews existing tool directories. An explicit `--source` can
@@ -294,17 +345,13 @@ product:
294
345
  (`~/.human-hindsight`). No hosted service, accounts, or telemetry. The only network
295
346
  traffic is through your chosen agent CLI during consented distillation or
296
347
  preference consolidation.
297
- - **Five runtime dependencies.** [`citty`](https://github.com/unjs/citty)
298
- (zero-dependency CLI framework), [`zod`](https://zod.dev) (schema
299
- validation), and [`@clack/prompts`](https://github.com/bombshell-dev/clack)
300
- (progress spinners), plus [`smol-toml`](https://github.com/squirrelchat/smol-toml)
301
- for safely preserving Codex configuration values during optional retention
302
- edits, and [`jsonc-parser`](https://github.com/microsoft/node-jsonc-parser)
303
- for reading OpenCode provider configuration without executing it. SQLite
304
- comes from Node itself; no database addon or native compilation is required. All five are
305
- exact-pinned, and the entire transitive tree ships locked via
306
- `npm-shrinkwrap.json`. The whole data path is small enough to audit in one
307
- sitting.
348
+ - **One self-contained npm package.** JavaScript libraries are bundled into
349
+ the CLI; the published package has no npm dependencies or installation
350
+ scripts. SQLite comes from Node. Starting the app does not install compilers,
351
+ platform bindings, or build tools. The development dependency tree is pinned
352
+ in the repository's `package-lock.json`, which is not published. Bundled
353
+ libraries include citty, Zod, Clack, smol-toml, jsonc-parser, Marked, and
354
+ DOMPurify; their license texts ship in `dist/THIRD_PARTY_NOTICES.txt`.
308
355
  - **Consent-gated LLM use.** `distill` states the exact invocation count and
309
356
  waits for `[y/N]` before anything runs on your subscription/credits.
310
357
  `--dry-run` shows the full plan for free. If you decline, it exits without