@davesheffer/hunch 0.34.0 → 0.34.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 (2) hide show
  1. package/README.md +31 -70
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -53,11 +53,11 @@ came before. Local-first, no documentation toil, no SaaS.
53
53
  └───────────────────────┘ └──────────────────────────┘ └──────────────┘
54
54
  ```
55
55
 
56
- - **Index** (no LLM): tree-sitter parses your repo into a symbol/dependency graph
57
- functions, call edges, imports, components plus churn and fan-in metrics.
56
+ - **Index** (no LLM): Hunch maps your repo how functions, files, and components
57
+ connect so it can see the ripple effect of any change.
58
58
  - **Learn**: each commit becomes a structured **Decision** (an ADR); a failing test
59
- becomes a **Bug** with a ranked suspect list; recurring or severe bugs are promoted
60
- into **Constraints** (do-not-break invariants) and raise a component's *fragility*.
59
+ becomes a **Bug** with its likely cause; recurring or severe bugs are promoted
60
+ into **Constraints** (do-not-break rules) and flag the riskiest parts of the code.
61
61
  - **Ground**: any MCP assistant reads it through an **MCP server**, an auto-maintained
62
62
  **`CLAUDE.md`**, and **slash commands** — every answer cites `provenance`
63
63
  (source + confidence + evidence), so nothing is a blind assertion.
@@ -78,7 +78,7 @@ combination is the moat:
78
78
  | **Lifetime** | the session; often auto-expiring | the **lifetime of the codebase** — non-destructive supersede/veto keeps the *why-it-changed* trail |
79
79
  | **Clients** | one vendor's agent | **client-agnostic** — one `.hunch/` graph serves Claude Code, Cursor, Copilot & Windsurf via MCP |
80
80
  | **What's stored** | opaque extracted "facts" | **structured ADRs** — decisions with rejected-alternatives, bug lineage, and invariants |
81
- | **Enforcement** | advisory / just-in-time hints | **fail-closed deterministic guards** — no model in the block path; a commit fails on a human-vouched, set-intersection match |
81
+ | **Enforcement** | advisory / just-in-time hints | **fail-closed guards** — no model in the block path; a commit fails only on a rule you've vouched for |
82
82
  | **Trust** | take it on faith | **provenance on every record** (source + confidence + evidence) and a measurable retrieval signal (`hunch eval`) |
83
83
 
84
84
  The short version: **git tracks *what* changed; Hunch tracks *why*** — locally, durably, and under
@@ -94,7 +94,7 @@ hunch backfill --since 90d # cold start: seed decisions from recent git
94
94
  hunch why src/auth/session.ts # …then ask your assistant: "why is X built this way?"
95
95
  ```
96
96
 
97
- `hunch init` scaffolds `.hunch/`, indexes the repo, installs the git hooks + merge driver,
97
+ `hunch init` scaffolds `.hunch/`, indexes the repo, installs the git hooks,
98
98
  writes `.mcp.json` + slash commands + an auto-maintained `CLAUDE.md`, and wires up **every
99
99
  detected assistant** (Claude Code, Cursor, VS Code/Copilot, Windsurf, Codex, Google Antigravity) to the same
100
100
  graph — merging idempotently into existing files. **Reload your assistant in the repo**
@@ -105,14 +105,11 @@ afterward to pick up the `hunch_*` tools. Each teammate runs `hunch init` once;
105
105
  > **never** a pay-per-token API key — and falls back to a deterministic heuristic if no CLI
106
106
  > is present. Details: [Synthesis & billing](https://hunch-pi.vercel.app/docs#synthesis).
107
107
  >
108
- > **Deep Synthesis** (`backfill --deep` / `sync --deep`): reconcile multiple independent drafts
109
- > into one fan out across every signed-in CLI, or, with a single CLI, sample it N times for
110
- > **self-consistency** (`--samples`, default 2). Confidence is **agreement-weighted** (capped
111
- > below the enforcement threshold, so it stays advisory). Add `--verify` (auto under `--deep`)
112
- > for a **Critic pass** that audits each draft against its commit pruning unsupported
113
- > rejected-alternatives before they become tripwires and down-weighting weak grounding; it only
114
- > ever *lowers* confidence, never arming enforcement. Subscription-only, never on the guard path;
115
- > degrades to the single-provider draft when no CLI is available.
108
+ > **Deep Synthesis** (`backfill --deep` / `sync --deep`): gathers several independent takes on a
109
+ > change and reconciles them into one more-trustworthy note trusting it more when they agree.
110
+ > Add `--verify` to fact-check the note against the commit and drop anything it doesn't support.
111
+ > It always stays *advisory* until you confirm it. Subscription-only; falls back to a single
112
+ > draft when only one assistant is available.
116
113
  > On Windows, prefer `hunch init` over a global `claude mcp add`; if tools don't appear,
117
114
  > `hunch doctor` heals it ([why](https://hunch-pi.vercel.app/docs#windows)).
118
115
 
@@ -120,7 +117,7 @@ afterward to pick up the `hunch_*` tools. Each teammate runs `hunch init` once;
120
117
  [MCP & assistants](https://hunch-pi.vercel.app/docs#mcp) ·
121
118
  [MCP tools](https://hunch-pi.vercel.app/docs#mcp-tools) ·
122
119
  [slash commands](https://hunch-pi.vercel.app/docs#slash) ·
123
- [the 22-command CLI](https://hunch-pi.vercel.app/docs#cli)
120
+ [the full CLI reference](https://hunch-pi.vercel.app/docs#cli)
124
121
 
125
122
  ## Enforcement: memory that holds the line
126
123
 
@@ -152,14 +149,14 @@ VERDICT: ⛔ BLOCK — this change breaks a recorded invariant or re-opens a kno
152
149
  🐞 guards against: Double-charge on unverified session (bug_…)
153
150
  ```
154
151
 
155
- Deterministic (no LLM), and safe as a merge gate — it blocks only on a direct,
156
- high-confidence, non-stale blocking invariant. → [docs](https://hunch-pi.vercel.app/docs#merge-verdict)
152
+ No model in the loop, so it's safe as a merge gate — it blocks only on a high-confidence rule
153
+ you've confirmed, and warns on everything softer. → [docs](https://hunch-pi.vercel.app/docs#merge-verdict)
157
154
 
158
155
  ### Decision Guard (Veto) — re-introducing a *rejected* approach is blocked
159
156
 
160
157
  The most expensive reversal is re-adding an approach a decision **rejected** (latency, a
161
158
  forbidden dependency) — code that never existed, so a diff reviewer is blind to it. A
162
- decision carries machine-checkable **tripwires**; re-introduce one and Hunch blocks it with
159
+ decision remembers what it rejected; re-introduce that approach and Hunch blocks it with
163
160
  the receipt of what you rejected and why. → [docs](https://hunch-pi.vercel.app/docs#veto)
164
161
 
165
162
  ### Redundancy Guard — "this already exists"
@@ -168,9 +165,8 @@ An agent works from a *local* context window, so it re-implements a helper that
168
165
  lives three modules over, or re-adds a dependency the codebase already has — sprawl a
169
166
  diff-only reviewer can't see, but Hunch's symbol graph can. Add a function or class already
170
167
  defined elsewhere and `hunch check` / the CI guard / `hunch_merge_verdict` flag it with the
171
- existing location. Deterministic and **advisory** — it never blocks; tuned to stay quiet
172
- (stopword + length filters, scoped to the change's own project root, move-aware so a
173
- refactor isn't mistaken for a duplicate). → [docs](https://hunch-pi.vercel.app/docs#redundancy)
168
+ existing location. **Advisory** — it never blocks, and it's tuned to stay quiet so a refactor
169
+ that just moves code isn't mistaken for a duplicate. [docs](https://hunch-pi.vercel.app/docs#redundancy)
174
170
 
175
171
  Plus the **Regression Guard** (re-adding deliberately-retired code) and the
176
172
  **[CI Constraint Guard](https://hunch-pi.vercel.app/docs#ci)** (`hunch ci` — a PR gate that
@@ -179,20 +175,17 @@ comments the affected `con_`/`dec_` ids and fails on a blocking one).
179
175
  ## Working as a team
180
176
 
181
177
  The `.hunch/` JSON is the **source of truth** — diffable, reviewable in PRs, synced for free
182
- over `git push` / `pull`. `hunch init` registers a git **merge driver** so concurrent edits
183
- merge **by record id** (human-confirmed beats auto, then confidence, then recency). The graph
184
- is **OS-agnostic**: paths are stored in POSIX form and an installed Hunch registers its MCP
185
- server by package name, so Windows / macOS / Linux teammates share one memory without
186
- per-machine fixups. → [docs](https://hunch-pi.vercel.app/docs#team)
178
+ over `git push` / `pull`. `hunch init` sets things up so concurrent edits from different
179
+ teammates merge cleanly instead of throwing conflict markers, and it's **OS-agnostic**
180
+ Windows / macOS / Linux teammates share one memory with no per-machine fixups.
181
+ [docs](https://hunch-pi.vercel.app/docs#team)
187
182
 
188
183
  ### Branches & worktrees
189
184
 
190
- Memory follows you across every branch and **git worktree**, with no per-worktree setup. The
191
- private overlay is registered once at the repo's **git common dir** (shared by all worktrees), so
192
- a fresh `git worktree add` on any branch sees the same decisions, bugs, and invariants. Create one
185
+ Memory follows you across every branch and **git worktree**, with no per-worktree setup — a
186
+ fresh `git worktree add` on any branch sees the same decisions, bugs, and invariants. Create one
193
187
  already wired in with **`hunch worktree <path> [-b <branch>]`**, or just run `hunch init` / `hunch
194
- private` once and every worktree picks it up. Auto-captured decisions are tagged with their branch,
195
- and concurrent overlay writes are serialized — so parallel worktrees never corrupt or lose memory.
188
+ private` once and every worktree picks it up. Parallel worktrees never corrupt or lose memory, and
196
189
  `hunch doctor` confirms a worktree is sharing.
197
190
 
198
191
  ## Private memory (public repo, private context)
@@ -233,7 +226,7 @@ Drop `npx hunch test` into CI, and `hunch ci` to scaffold the PR merge gate.
233
226
 
234
227
  `hunch query` uses fast keyword search out of the box. For recall on paraphrases, opt into
235
228
  **local embeddings** (`npm i -g @huggingface/transformers && hunch embed`) — local, free, and
236
- opt-in. Vectors live in the derived SQLite index and never drift from the JSON source of truth.
229
+ opt-in, and it never drifts from your committed memory.
237
230
 
238
231
  ## VS Code
239
232
 
@@ -246,44 +239,12 @@ counter. It reads the committed `.hunch/` JSON directly; writes delegate to the
246
239
 
247
240
  ## Architecture
248
241
 
249
- ```
250
- src/
251
- ├─ core/ types (Zod schema), ids, paths, glob, schema migration, atomic file I/O
252
- ├─ store/ JSON source of truth ←→ SQLite/FTS5 derived index; merge driver; compaction
253
- ├─ extractors/ tree-sitter parse, git introspection, the indexer
254
- ├─ synthesis/ write path: subscription CLI (Claude/Codex/Cursor) or deterministic fallback
255
- ├─ mcp/ MCP stdio server (the hunch_* tools)
256
- ├─ integrations/ post-commit hook, CLAUDE.md writer, .mcp.json + slash commands, merge driver
257
- └─ cli/ commander entrypoint
258
- ```
259
-
260
- Everything lives under `.hunch/` as git-tracked JSON (the source of truth); SQLite is a
261
- throwaway derived index. → [storage layout](https://hunch-pi.vercel.app/docs#storage) ·
262
- [the docs](https://hunch-pi.vercel.app/docs) for the full conceptual model.
263
-
264
- ## Notable engineering decisions
265
-
266
- - **Subscription-billed synthesis, never the API.** The write path drives your Claude
267
- subscription via the `claude` CLI; `ANTHROPIC_API_KEY` / `ANTHROPIC_AUTH_TOKEN` are
268
- stripped from the child env to force subscription auth. A deterministic, no-LLM fallback
269
- means the loop never hard-requires credentials.
270
- - **Native `tree-sitter` (0.21.1)**, not web-tree-sitter — the prebuilt WASM grammars have an
271
- incompatible ABI; the native bindings ship Node-20 prebuilds and a simpler synchronous API.
272
- - **`better-sqlite3` pinned to `12.9.0`** — 12.10.x ships no Node-20 prebuild.
273
- - **Atomic, durable writes.** All `.hunch/` writes go through temp-file + rename; an
274
- interrupted write can't truncate the index, and `put`/`delete` refuse to rewrite a corrupt one.
275
- - **OS-agnostic by construction.** Paths are canonicalized to POSIX before comparison, and
276
- committed configs reference Hunch by package name, never a machine-local path.
242
+ Everything lives under `.hunch/` as plain git-tracked JSON — the source of truth; a fast local
243
+ index is built from it and is throwaway. Subscription-billed synthesis (never a pay-per-token
244
+ API key) with a no-LLM fallback, and atomic writes so an interrupted write can't corrupt your
245
+ memory. [the docs](https://hunch-pi.vercel.app/docs) for the conceptual model.
277
246
 
278
247
  ## Develop
279
248
 
280
- ```bash
281
- npm run dev -- <args> # run the CLI from source via tsx (no build step)
282
- npm run typecheck # strict tsc — the gate
283
- npm test # node:test suite
284
- npm run build # compile to dist/ (the published artifact)
285
- ```
286
-
287
- Hunch is pure TypeScript ESM, Node ≥ 20, licensed **Apache-2.0**. See
288
- [CONTRIBUTING.md](CONTRIBUTING.md) and the full
289
- [developer docs](https://hunch-pi.vercel.app/docs#develop).
249
+ Hunch is open source — pure TypeScript ESM, Node ≥ 20, licensed **Apache-2.0**. Contributions
250
+ welcome see [CONTRIBUTING.md](CONTRIBUTING.md) and the [repo](https://github.com/davesheffer/hunch).
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@davesheffer/hunch",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Dave Sheffer <dave.sheffer1@gmail.com>",
6
- "description": "Hunch — an Engineering Memory OS: a persistent, git-native reasoning graph over a codebase, exposed to Claude Code via MCP.",
6
+ "description": "Hunch — an Engineering Memory OS: a persistent, git-native graph of the decisions, bugs, and rules behind your code, served to any MCP coding assistant (Claude Code, Cursor, Copilot, Windsurf, Codex).",
7
7
  "homepage": "https://hunch-pi.vercel.app",
8
8
  "repository": {
9
9
  "type": "git",