# hunch [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/davesheffer/hunch  
**GitHub Stars:** 18  
**npm Downloads (last month):** 6203  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/hunch-2

## Description
Engineering memory for AI-assisted codebases: decisions, bug lineage and invariants, over MCP.

## Tools
Capabilities this server exposes over MCP:

- **hunch_query** — Full-text + graph search across the engineering memory (decisions, bugs, constraints, components, symbols). Returns ranked records with provenance. Use this to ask 'why' questions about the codebase. Not for orienting on a known file or symbol (hunch_context / hunch_why give the curated slice with its blast radius) or for finding where code lives (hunch_structure).
- **hunch_task** — Start once per user task, unless the host's prompt hook already opened one — then reuse its task_id. Pass task_id to hunch_context. Finish before your final response and show the returned contribution card without asking; skip finish only when the hook said the host closes the task and the task used no Hunch (no hunch_* call, verified check, or hook context you acted on). A task you started must always be finished. Finishing never implies verification. Not for storing decisions or claiming tests passed; use the CLI task verify wrapper for command results.
- **hunch_report** — Read task reports: exact delivered memory, agent-reported applications, observed command results and explicit unknowns, as a bounded summary (identities and verdicts, not envelope text; full report is `hunch report <id> --json`). Supply lesson for exact revision history across tasks. With neither task_id nor lesson, lists recent tasks without guessing which is yours. html writes a local private evidence view. Not a causal impact score, public export, or authority to execute verification commands.
- **hunch_runbook** — Look up the proven 'how-to' (ordered steps + files) for a recurring task — runbook-SCOPED retrieval (searches within runbooks, not the whole graph). Use at the START of a task to reuse a known procedure instead of re-deriving it. Advisory. Not for design rationale (hunch_why) or free-text memory search (hunch_query).
- **hunch_why** — Return the decisions, bugs, and constraints that explain a file path or symbol, or one record by id (dec_/con_/bug_/fnd_/cmp_) — the 'why' and the 'what must not break', with evidence. Pass `as_of` (a commit/tag/branch) to time-travel: see what was believed at that point in history. Use when you need the full rationale for ONE target. Not for a budgeted task brief (hunch_context), keyword search (hunch_query), or where-is-it questions (hunch_structure).
- **hunch_bug_lineage** — Given a symptom description or a symbol, return matching bugs with their lineage (introduced → fixed → recurrence) so the agent doesn't re-discover past root causes.
- **hunch_check_constraints** — Return constraints whose scope matches a glob/path, sorted by severity. Call this BEFORE editing code to avoid breaking intentional invariants. Returns each constraint's id, severity, enforcement, statement, and rationale. Not for who-depends-on-this (hunch_get_dependents) or invariants reachable only through dependents (hunch_blast_radius).
- **hunch_get_dependents** — Return everything that transitively depends on a symbol/component (callers + dependent components) so a change's blast radius is known before editing. Returns dependents nearest first with depth and edge kind. Not for the invariants those dependents carry (hunch_blast_radius) or constraints on the target itself (hunch_check_constraints).
- **hunch_blast_radius** — Given a file you're about to change, return its dependency blast radius (files whose code depends on it) AND any invariants reached THROUGH that radius — 'near-violations' you could break indirectly without touching their own scope. Call before editing a widely-depended-on file. Mirrors `hunch check --blast`. Not for a bare dependent list (hunch_get_dependents) or constraints scoped to the target alone (hunch_check_constraints).
- **hunch_context** — Given a file, symbol, or task phrase you're about to work on, return the MINIMAL relevant memory — invariants, decisions, bug history, blast radius — as a compact brief. Call FIRST when starting work. A task phrase with no file/symbol match falls back to the closest graph matches. Returns a budgeted brief plus a delivery receipt. Not for exhaustive rationale on one file (hunch_why) or keyword search (hunch_query).
- **hunch_now** — What just happened and what is next, straight from the graph: the last N decisions, the ROADMAP, and any inline human question such as an imported ADR awaiting explicit approve/decline. Call at session start to orient, or before planning. Same data as the wiki's now.md. Public store only — except that a queued commit-repair's liveness is checked against the full store, so a private-overlay decision's answerable repair does not go silently unanswerable; only its id and commit shas ever surface, never its title.
- **hunch_workspaces** — Worktrees per machine and every local branch with a deterministic verdict — merged (ancestry / squash / rebase), never pushed, upstream gone, dirty — plus a recommended action. Use INSTEAD of git branch / git worktree list to see what is open, stale, or deletable. This machine is read live; others from memory (stale ones marked unverified). Read-only. Not for design rationale (hunch_why) or code structure (hunch_structure).
- **hunch_escalations** — Decisions only the human can make, so you ASK THE USER before acting: topic conflicts (>1 live decision per topic), premise-stale decisions (the recorded reason no longer holds; authority is unchanged until the human re-attests, supersedes, or retires), one imported ADR at a time awaiting approve/decline, a queued commit-provenance repair (`hunch repair-provenance --apply`, never applied unattended), and Constitution policies awaiting review or activation. Normally empty. Never decide an entry for the user — silence is never approval. Reads the public or shared-mode store, never private-mode records — except a queued repair, whose liveness is checked against the full store and which surfaces only its id and commit shas.
- **hunch_hld** — Bring a high-level design (Markdown with Mermaid, a .mmd file, or a draw.io diagram) into Hunch and close its gaps with the human. action:"import" parses it deterministically and returns the questions protocol plus the first question; "next" returns the next open question; "answer" records the HUMAN's answer to one question (never your own guess; skip:true only when the human says to skip); "status" lists drafts or shows one. Ask ONE question at a time. Approval is human-only, in a terminal: hunch hld-approve <file> --reviewed-by <name>, which locks the design.
- **hunch_review_imported_adr** — Use ONLY after the human explicitly answers the currently surfaced imported-ADR question with approve or decline, in this conversation. Never infer approval from silence, continued work, an earlier generic sign-off, or the ADR file's own status. The source and review hashes bind the answer to the exact bytes and mapped meaning shown. Approve grants human-confirmed authority; decline records review but keeps the ADR advisory.
- **hunch_timeline** — Time-travel: the decisions touching a file/symbol over time — what was believed, its valid-time window, and what superseded it. Use to understand how (and why) the design changed, and to avoid re-introducing a deliberately-retired approach.
- **hunch_capture_decision** — Start a decision-capture interview ('/capture', 'grill me'): returns the protocol — ONE question at a time until resolved — and a capture-session token; writes nothing. Then commit via hunch_record_decision with the token + confirmed topic. The token is NOT a human signature: human-confirmed authority needs the human's own confirmation (client prompt, or `hunch review --confirm <id>`). Not for corrections (hunch_record_correction) or observations (hunch_record_finding).
- **hunch_current_decision** — Decision-grounding: return the single CURRENT (accepted, non-superseded) decision anchored to a topic — the authoritative answer a doc or diff is checked against, plus what it rejected. A shared-store miss is confirmed against fresh team memory before Hunch says the topic has no current decision. If freshness is unavailable, or a topic has an unresolved collision (>1 live), it injects nothing (fail-safe).
- **hunch_record_decision** — Persist a Decision (ADR) with provenance when the human makes or confirms one in conversation; routine choices are captured from commits. private:true keeps it in the HUNCH_PRIVATE_DIR overlay, never committed here. Returns id, home, status. Not for an agent-obeyed rule (hunch_record_correction) or an observation (hunch_record_finding). Errors: 'Refused:' a gate held (don't retry); 'Invalid:' fix arguments; 'Failed to' internal.
- **hunch_record_correction** — When a human corrects the agent ('never call X here'), persist it as a SCOPED Constraint with provenance, so the pre-edit hook and CI Constraint Guard hold every assistant to it. severity:'blocking' only when the human said never/must; applies_to_all:true only for a genuinely repo-wide rule (else scoped to scope_hint_file). supersedes:[con_*] challenges a rule this one reverses (a person replaces it with `hunch replace`). Returns the constraint id, scope, and other active rules on that scope. Not for a design choice (hunch_record_decision) or an observed gap with no rule yet (hunch_record_finding).
- **hunch_challenge** — Any agent may challenge a rule it believes is wrong or blocking legitimate work. The rule stays enforced until a person clears the challenge; the challenge and your reason are recorded for review. Returns the rule id and state. Errors: 'Refused:' unknown or retired rule; 'Invalid:' empty reason.
- **hunch_record_finding** — Persist an OBSERVATION with no code change — an audit gap, a measured number, a platform fact, an incident — anchored to a date + evidence, not a commit. Advisory: grounds future edits to the affected files (pre-edit hook, hunch_context) and is listed by hunch_findings; never blocks. Re-record the SAME title to update triage (e.g. triage:'resolved' + resolved_commit). If it violates an unrecorded rule, record the rule first (hunch_record_correction) and link it via violates_constraint. Not for a rule to enforce (hunch_record_correction) or a choice between alternatives (hunch_record_decision).
- **hunch_findings** — List LIVE findings (observed gaps/debt with no fix yet — triage open/accepted-risk/scheduled) for a file, glob, or symbol; omit scope for the whole ledger. Call before planning work in an area to inherit past audits instead of re-discovering them. Lists each finding's first sentence; pass id for one finding's full observation. Advisory; resolved/stale findings are excluded unless all:true. Not for invariants (hunch_check_constraints) or bug history (hunch_bug_lineage): findings are observations, never rules.
- **hunch_merge_verdict** — Before opening or merging a PR, replay a diff against memory and return ONE verdict — BLOCK / WARN / PASS — citing the decision and bug behind each invariant in scope, plus advisory blast-radius invariants, re-introduced retired code, and symbols already defined elsewhere. Deterministic, no LLM. Default: staged changes; working:true for all local changes, base (e.g. origin/main) for a PR range, commit for one commit. Not for an advisory impact map (hunch_pr_impact), or intent erosion with no diff (hunch_conformance).
- **hunch_structure** — Orient WITHOUT grep/glob rounds: the graph already holds the repo's structure. No target → repo map (components + directories by symbol weight). A directory → its files with their symbols. A file → its outline (symbols, fan-in/out, callers). An exact symbol name → its definition site(s) with one-hop neighbors. Call this FIRST when exploring unfamiliar code — it tells you exactly which file to read, instead of searching for it. Returns shape only (files, symbols, one-hop neighbors), never why. Not for rationale (hunch_why) or memory search (hunch_query).
- **hunch_pr_impact** — IMPACT SURFACE of a change (default staged; or working:true, base, or commit): files that transitively depend on it, invariants in scope and via blast radius, and decisions on the touched files. Read-only, advisory. Not for a verdict (hunch_merge_verdict).
- **hunch_path** — How does A reach B? Returns the shortest chain of call/import/dependency/contains edges connecting two symbols, files, or components — walked in either direction. Use to understand coupling before a refactor, to verify the actual route behind a must-reach invariant, or to explain why editing A shows up in B's blast radius. Deterministic, read-only.
- **hunch_compare** — Given several candidate branches/commits (e.g. N solutions to one task), replay each against engineering memory and RANK them best-fit first — the candidate that trips the fewest in-force invariants, reverses no decisions, and adds the least sprawl wins. Deterministic (the same merge-verdict per candidate, no LLM). Use to choose among multiple solutions before committing to one.
- **hunch_conformance** — Intent-conformance (the inversion of a normal guard): for every in-force decision carrying a conformance predicate, deterministically verify the CODE still satisfies its intent over the dependency graph — e.g. 'pay still reaches verifySession'. Returns the violations: intent the code has silently drifted away from, with NO diff required. Run before a refactor or merge to catch intent erosion a diff-only check can't see. Returns the violation list. Not for a diff-scoped verdict (hunch_merge_verdict) or an impact map (hunch_pr_impact).

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "hunch": {
    "command": "npx",
    "args": ["-y","@davesheffer/hunch","mcp"]
  }
}
```

## Documentation

## What hunch does

hunch maintains engineering memory for an AI-assisted codebase and makes relevant records available to agents over MCP. Its memory can cover architectural decisions, rejected alternatives, constraints, bug histories, findings, components, symbols, commitments, and task evidence. Repository memory is kept in Git, with an optional dedicated private memory repository for shared use.

The server connects recorded knowledge to indexed files, symbols, and dependencies. That lets an agent ask why a piece of code exists, identify rules before editing, inspect a change’s dependency surface, or retrieve a compact task brief instead of searching the repository repeatedly. Memory is advisory by default; blocking behavior requires a trusted rule and strict enforcement.

## How it works

Install the CLI in a Git repository and run `hunch init`. Initialization indexes the code, adds Hunch instructions, and configures supported assistant integrations while preserving existing settings. Optional backfilling can draft memory from recent Git history.

The MCP tools divide work by purpose. `hunch_structure` maps files and symbols, `hunch_context` assembles a focused task brief, and `hunch_why` retrieves rationale for one target. `hunch_query` searches the broader engineering graph, while `hunch_runbook` retrieves established procedures. Before edits, agents can inspect constraints, dependents, blast radius, findings, and bug lineage. Diff and architecture checks are available through tools such as `hunch_merge_verdict`, `hunch_pr_impact`, and `hunch_conformance`.

Task lifecycle tools record what memory was delivered, what an agent reported using, and which command results were observed. Reports distinguish those evidence types rather than treating a claimed test result as verification. Human decisions remain human-controlled: HLD questions, imported ADR review, escalations, and decision confirmation include explicit approval steps.

## Setup and configuration

Hunch requires Node.js 22.13 or newer and a Git repository. Install the package globally with `npm i -g @davesheffer/hunch`, change to the repository, and run `hunch init`. If the global executable is unavailable, initialization can be run with `npx -y @davesheffer/hunch@latest init`.

After setup, reload or reconnect the assistant. Codex users should review and trust commands in `/hooks` before starting a new session. `hunch integrations check` inspects configuration, while harness-specific checks can probe MCP startup or require observed context delivery.

Use `hunch firmness strict` followed by a strict check command only after reviewing and trusting the relevant constraints. `hunch update` installs the latest release and repairs configured integration pins without overwriting unrelated settings. `hunch uninstall` removes installed integration files while retaining `.hunch/`; `--purge` also removes the Hunch memory and related derived data.

## Tools and capabilities

- Search engineering memory with ranked results and provenance using `hunch_query`.
- Build focused briefs, inspect structure, and retrieve rationale with `hunch_context`, `hunch_structure`, and `hunch_why`.
- Check constraints, dependent symbols, blast radius, findings, and historical bug lineage before changes.
- Compare branches, assess pull-request impact, issue merge verdicts, and test architectural conformance deterministically.
- Capture decisions, corrections, findings, task reports, runbooks, HLD discussions, and imported ADR reviews with explicit provenance.
- Inspect current decisions, timelines, escalations, workspaces, and recent project activity.
- Share repository memory through Git and optionally connect a dedicated private memory repository.

_Full upstream README: https://allmcps.com/mcp/hunch-2/readme_

