cc-hindsight 1.4.0 → 1.6.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.
package/README.md CHANGED
@@ -1,260 +1,22 @@
1
- # cc-hindsight
1
+ # cc-hindsight has moved to Human Hindsight
2
2
 
3
- > **The prompt you'd write if you knew then what you know now.**
4
-
5
- [![npm](https://img.shields.io/npm/v/cc-hindsight?color=cb3837&logo=npm)](https://www.npmjs.com/package/cc-hindsight)
6
- [![CI](https://github.com/adityaarunsinghal/cc-hindsight/actions/workflows/ci.yml/badge.svg)](https://github.com/adityaarunsinghal/cc-hindsight/actions/workflows/ci.yml)
7
- [![node](https://img.shields.io/node/v/cc-hindsight?logo=node.js&color=339933)](https://nodejs.org)
8
- [![license](https://img.shields.io/github/license/adityaarunsinghal/cc-hindsight?color=blue)](LICENSE)
9
- [![local-first](https://img.shields.io/badge/data-local--only-brightgreen)](#privacy--trust)
10
-
11
- <p align="center">
12
- <img src="https://raw.githubusercontent.com/adityaarunsinghal/cc-hindsight/main/.github/assets/demo.gif" alt="cc-hindsight building a oneshot prompt library from coding-agent session history" width="800">
13
- </p>
14
-
15
- ```bash
16
- npx cc-hindsight
17
- ```
18
-
19
- cc-hindsight mines your coding-agent session history (Claude Code, kiro-cli)
20
- into two things you can use tomorrow morning:
21
-
22
- 1. **A oneshot prompt library.** For each real task you've done, the realistic
23
- ideal *first* prompt: everything you knew and wanted at t=0 but didn't say,
24
- written in your own voice.
25
- 2. **A distilled preference set.** The things you keep re-telling your agent
26
- ("diagnose before acting", "pin the versions", "be terse"), surfaced as a
27
- paste-ready `CLAUDE.md` block so every future session starts aligned.
28
-
29
- ## The t=0 problem
30
-
31
- You get better results the more context you front-load into your first prompt,
32
- yet we underspecify at t=0 and spend the session steering: correcting course,
33
- restating preferences, answering questions the agent shouldn't have had to ask.
34
-
35
- And the cost repeats every session. Your working preferences are stable facts
36
- about how you like to work, yet you re-derive and re-type them project after
37
- project instead of stating them once, upfront, where every future session reads
38
- them from the first message.
39
-
40
- All the evidence of what you *should* have said is already on disk. Claude Code
41
- saves every session as JSONL under `~/.claude/projects/`; kiro-cli keeps its
42
- own store under `~/.kiro/sessions` (both the flat `cli/<uuid>.jsonl` layout and
43
- the newer per-session `<hash>/sess_<uuid>/messages.jsonl` layout). Plenty of
44
- tools read that data for
45
- dashboards and transcripts. **Nobody closes the loop from history back to
46
- better prompting.**
47
-
48
- **Before** (what you actually typed at t=0):
49
-
50
- > help me script blocking a device on my home router
51
-
52
- **After** (what cc-hindsight distilled from how that session actually went):
53
-
54
- > I want to automate my home router, starting with blocking a device. Get API
55
- > access working first, and store any credentials securely instead of asking me
56
- > to paste them in the clear. Anything that changes the network should be safe
57
- > by default: show me what it'll do and let me confirm before it runs. Then
58
- > prove it end-to-end on a real device. Research how others have done this
59
- > first, and keep the setup written down so I can reproduce it.
60
-
61
- The second prompt was knowable at t=0. You just hadn't written it yet.
62
-
63
- ## Quickstart
64
-
65
- One command builds the whole library and shows it to you when it's done:
66
-
67
- ```bash
68
- npx cc-hindsight distill # offers to export first, then digest → cluster →
69
- # author (asks before any claude call), then shows
70
- # you the finished library
71
- ```
72
-
73
- Prefer to drive each stage yourself? The pipeline is just three verbs:
3
+ Install or run the renamed app:
74
4
 
75
5
  ```bash
76
- npx cc-hindsight # 1. scan: inventory your projects (read-only)
77
- npx cc-hindsight export # 2. export: human-only markdown per session
78
- npx cc-hindsight distill # 3. distill: digest → cluster → author (asks first)
6
+ npx human-hindsight@latest gui
7
+ npm install -g human-hindsight
79
8
  ```
80
9
 
81
- Then browse and curate the results:
82
-
83
- ```bash
84
- npx cc-hindsight list # your library (✎ edited / ▲▼ rating badges)
85
- npx cc-hindsight show <slug> # read a oneshot
86
- npx cc-hindsight copy <slug> # → clipboard, paste into a fresh session
87
- npx cc-hindsight edit <slug> # open in $EDITOR; your edits are protected
88
- npx cc-hindsight rate <slug> up # record a verdict (up|down)
89
- npx cc-hindsight prune # remove orphaned entries (asks first)
90
- npx cc-hindsight preferences # → CLAUDE.md block
91
- npx cc-hindsight status # pipeline funnel + orphan/skip flags
92
- ```
93
-
94
- Requires Node ≥ 22 on macOS or Linux (Windows is untested and currently
95
- unsupported). `scan` and `export` are fully deterministic: no LLM, no
96
- network. `distill` uses the `claude` CLI you already have, and never without
97
- asking.
98
-
99
- ### Multiple backends (Claude Code + kiro-cli)
100
-
101
- cc-hindsight also mines [kiro-cli](https://docs.hub.amazon.dev/) session
102
- history the same way. Every command takes `--source claude|kiro|auto` (default
103
- `auto`: read whichever stores exist) and `--kiro-dir` / `KIRO_CONFIG_DIR`
104
- (default `~/.kiro`, parallel to `--claude-dir`). A machine with both stores
105
- merges them into one library; the manifest tags each session's `origin` and the
106
- export summary breaks the count down (`9 claude + 3 kiro`). The kiro backend
107
- reads both on-disk store layouts (the flat v2 store and the newer v3 per-session
108
- store), preferring the v3 copy when a session was migrated into both.
109
-
110
- `distill --runner claude|kiro|auto` chooses which CLI does the distilling —
111
- orthogonal to `--source`, so you can mine kiro history and distill with claude
112
- or vice-versa (`auto` prefers the CLI matching your source, else whichever is
113
- installed). `preferences --target claude|kiro|agents` emits a `CLAUDE.md`
114
- block, a `~/.kiro/steering/` file, or a portable `AGENTS.md` section.
115
-
116
- ## Privacy & trust
117
-
118
- For a tool that reads your entire conversation history, auditability is the
119
- product:
120
-
121
- - **Local-only.** Everything is read from your disk and written to your disk
122
- (`~/.cc-hindsight`). No server, no accounts, no telemetry. The only network
123
- call is your own `claude` CLI doing what it already does.
124
- - **Three runtime dependencies.** [`citty`](https://github.com/unjs/citty)
125
- (zero-dependency CLI framework), [`zod`](https://zod.dev) (schema
126
- validation), and [`@clack/prompts`](https://github.com/bombshell-dev/clack)
127
- (progress spinners, five micro-packages under the hood). All three are
128
- exact-pinned, and the entire transitive tree ships locked via
129
- `npm-shrinkwrap.json`. The whole data path is small enough to audit in one
130
- sitting.
131
- - **Consent-gated LLM use.** `distill` states the exact invocation count and
132
- waits for `[y/N]` before anything runs on your subscription/credits.
133
- `--dry-run` shows the full plan for free. If you decline, it exits without
134
- invoking anything (exit code 2).
135
- - **Plain statement:** exports contain your raw prompts, including anything
136
- sensitive you ever pasted into a session (keys, internal names, that one
137
- angry message). They live in your home directory with your permissions, and
138
- nothing ships them anywhere. A `--redact` option is on the roadmap.
139
-
140
- ## How it works
141
-
142
- ```mermaid
143
- flowchart TD
144
- A["~/.claude/projects/**/*.jsonl"] -->|"scan (read-only)"| B["inventory"]
145
- A -->|"export (deterministic)"| C["exports/*.md + manifest.json"]
146
- A -->|"anaphora + outcome evidence"| D["anaphora.json + outcomes.json"]
147
- C --> E
148
- D --> E
149
- subgraph distill ["distill: opt-in, consent-gated, resumable"]
150
- E["digest: 1 claude call / session"] --> F["cluster: 1 call"]
151
- F --> G["author: 1 call / task"]
152
- end
153
- G --> H["library/&lt;slug&gt;/ oneshot + provenance"]
154
- H --> I["list / show / copy / status"]
155
- H --> J["preferences → CLAUDE.md block"]
156
- ```
157
-
158
- The extraction layer is a fidelity contract: eleven audited rules decide what
159
- counts as human input (attachments typed while the agent was busy, recovered
160
- slash commands, `[decision]` lines from option picks, `[image pasted]`
161
- markers), with a regression fixture per rule. Fork/resume duplicates are
162
- deduped globally. Short replies like "yes" and "option 2" get their antecedent
163
- attached so the author stage knows what you approved. Sessions carry an
164
- outcome classification, so a task where nothing ever succeeded gets skipped
165
- instead of becoming a confident prompt that reproduces a failure path.
166
-
167
- Authored oneshots pass a **"knowable at t=0" test**: they front-load intent,
168
- constraints, preferences, and quality bars, while leaving out facts you only
169
- discovered mid-session (paths, root causes, error messages). And they respect
170
- an **effort budget**, staying around the length a motivated human would
171
- actually type rather than ballooning into a 700-word spec.
172
-
173
- Every distill stage checkpoints to disk after each unit of work: Ctrl-C loses
174
- nothing, re-running resumes, `--fresh` resets deliberately, and `status` flags
175
- library entries orphaned by re-clustering.
176
-
177
- ## How it compares
178
-
179
- | Tool | Reads `~/.claude` | Output | Direction |
180
- |---|---|---|---|
181
- | ccusage | ✓ | usage/cost tables | backward (metrics) |
182
- | sniffly | ✓ | analytics dashboard | backward (behavior) |
183
- | claude-code-transcripts | ✓ | shareable HTML transcripts | backward (record) |
184
- | cctrace / exporters | ✓ | markdown/XML exports | backward (archive) |
185
- | **cc-hindsight** | ✓ | **oneshot prompt library + CLAUDE.md preferences** | **forward (better next session)** |
186
-
187
- Closest kin is Simon Willison's `claude-code-transcripts`: same local-first
188
- values, same belief that transcripts are undervalued artifacts. The difference
189
- is the direction of gaze: it renders your sessions (backward, for others);
190
- cc-hindsight distills them (forward, for you).
191
-
192
- ## FAQ
193
-
194
- **Does my data leave my machine?**
195
- No. The deterministic commands never touch the network. `distill` pipes
196
- content to your locally installed `claude` CLI, the same thing that happens
197
- when you use Claude Code, and nothing else.
198
-
199
- **What does distill cost?**
200
- Whatever your `claude` CLI costs you: it runs on your existing subscription or
201
- API credits. The consent prompt states the exact invocation count up front
202
- (one call per session digested, one to cluster, one per task authored), and
203
- `--dry-run` prints the same plan without running anything. Checkpoints mean an
204
- interrupted run isn't wasted money. Sessions too large for the input budget
205
- (default 400k chars, `--input-budget`) are **refused before anything is
206
- spent**. Re-run with `--truncate=extreme` to cut them (recorded in
207
- provenance) or narrow the scope. Digest and author calls run 3 at a time by
208
- default (`--concurrency`; `1` = sequential).
209
-
210
- **Subscription or API?**
211
- Either. cc-hindsight shells out to `claude -p`; however your CLI is
212
- authenticated is how the calls are billed. `--model` passes through.
213
-
214
- **Why is a session missing from my exports?**
215
- Sessions with zero human messages are skipped naturally, `--min-messages`
216
- filters thin ones, and fork/resume copies are deduped into their original
217
- session. Note that dedupe is global across all projects: with `--project`, a
218
- message duplicated by fork/resume is attributed to its earliest session even
219
- when that session is outside the filter. Run `export --verbose` to see every
220
- dropped piece with a reason. If genuine human input was dropped, that's a
221
- bug: file an extraction-fidelity report.
222
-
223
- **Can I regenerate everything from scratch?**
224
- `cc-hindsight distill --fresh` clears the checkpoints (after confirming) and
225
- re-runs. Old library entries from previous generations are flagged as orphans
226
- in `status`.
227
-
228
- ## Roadmap
229
-
230
- - Claude Code **plugin packaging** for existing marketplaces (for
231
- distribution, without standing up a separate marketplace)
232
- - An in-session **skill variant** ("distill this session as we go")
233
- - **Agent SDK** orchestration exploration
234
- - **parentUuid-aware anaphora** (branch-correct antecedents on forked
235
- conversations)
236
- - **`--redact` patterns** for exports
237
- - An opt-in **community oneshot showcase**
238
-
239
- ## Development
240
-
241
- ```bash
242
- npm install
243
- npm test # vitest: fixtures only, never reads your ~/.claude
244
- npm run lint # biome
245
- npm run typecheck # tsc --noEmit
246
- npm run build # tsdown → dist/
247
- ```
248
-
249
- See [CONTRIBUTING.md](CONTRIBUTING.md), especially the guide to adding a
250
- fixture when you hit an unhandled transcript shape.
251
-
252
- ## License
10
+ This deprecated package keeps the `cc-hindsight` command working by forwarding
11
+ to the matching version of `human-hindsight`. It contains no separate copy of
12
+ the application, and all arguments and exit codes pass through unchanged.
253
13
 
254
- [MIT](LICENSE)
14
+ Existing `~/.cc-hindsight` libraries and `CC_HINDSIGHT_HOME` remain supported.
15
+ The new command uses `~/.human-hindsight` for fresh installations and also
16
+ accepts `HUMAN_HINDSIGHT_HOME`. You do not need to move or re-distill your data.
255
17
 
256
- ## Author
18
+ Both packages can be installed together: `human-hindsight` owns the new command
19
+ and this package owns the old one.
257
20
 
258
- Built by [Aditya Singhal](https://adityasinghal.com). If cc-hindsight surfaces
259
- a pattern you didn't know you had, [I'd love to hear about
260
- it](https://github.com/adityaarunsinghal/cc-hindsight/issues).
21
+ Source, documentation, and releases:
22
+ [Human Hindsight](https://github.com/adityaarunsinghal/human-hindsight).
package/cli.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Same process, arguments, stdin, exit status, and signals as the new command.
4
+ import "human-hindsight/cli";
package/package.json CHANGED
@@ -1,60 +1,32 @@
1
1
  {
2
2
  "name": "cc-hindsight",
3
- "version": "1.4.0",
4
- "description": "Mine your coding-agent session history (Claude Code, kiro-cli) into a oneshot prompt library and CLAUDE.md/AGENTS.md preferences. The prompt you'd write if you knew then what you know now.",
3
+ "version": "1.6.0",
4
+ "description": "Compatibility command for Human Hindsight. Install human-hindsight for the renamed application.",
5
+ "deprecated": "Renamed to human-hindsight. Use npx human-hindsight or npm install -g human-hindsight. This package forwards the legacy cc-hindsight command.",
5
6
  "type": "module",
6
7
  "author": "Aditya Singhal (https://adityasinghal.com)",
7
8
  "license": "MIT",
8
- "keywords": [
9
- "claude",
10
- "claude-code",
11
- "kiro",
12
- "kiro-cli",
13
- "agents",
14
- "prompt",
15
- "prompt-library",
16
- "prompt-engineering",
17
- "cli",
18
- "transcripts",
19
- "local-first"
20
- ],
21
9
  "repository": {
22
10
  "type": "git",
23
- "url": "git+https://github.com/adityaarunsinghal/cc-hindsight.git"
11
+ "url": "git+https://github.com/adityaarunsinghal/human-hindsight.git",
12
+ "directory": "compat/cc-hindsight"
24
13
  },
25
- "homepage": "https://github.com/adityaarunsinghal/cc-hindsight#readme",
14
+ "homepage": "https://github.com/adityaarunsinghal/human-hindsight#readme",
26
15
  "bugs": {
27
- "url": "https://github.com/adityaarunsinghal/cc-hindsight/issues"
16
+ "url": "https://github.com/adityaarunsinghal/human-hindsight/issues"
28
17
  },
29
18
  "bin": {
30
- "cc-hindsight": "./dist/cli.js"
19
+ "cc-hindsight": "./cli.js"
31
20
  },
32
21
  "files": [
33
- "dist",
34
- "npm-shrinkwrap.json"
22
+ "cli.js",
23
+ "README.md",
24
+ "LICENSE"
35
25
  ],
36
26
  "engines": {
37
27
  "node": ">=22"
38
28
  },
39
- "scripts": {
40
- "build": "tsdown",
41
- "prepare": "npm run build --silent 1>&2",
42
- "test": "vitest run",
43
- "lint": "biome check .",
44
- "format": "biome format --write .",
45
- "typecheck": "tsc --noEmit",
46
- "prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build && npm pack --dry-run --json --ignore-scripts > pack.json && node scripts/check-pack.mjs pack.json && rm pack.json"
47
- },
48
29
  "dependencies": {
49
- "@clack/prompts": "1.7.0",
50
- "citty": "0.2.2",
51
- "zod": "4.4.3"
52
- },
53
- "devDependencies": {
54
- "@biomejs/biome": "^2.5.3",
55
- "@types/node": "^22.20.1",
56
- "tsdown": "^0.22.7",
57
- "typescript": "^5.9.3",
58
- "vitest": "^4.1.10"
30
+ "human-hindsight": "1.6.0"
59
31
  }
60
32
  }
package/dist/cli.d.ts DELETED
@@ -1 +0,0 @@
1
- export { };