hunch

A set of rules for consulting Hunch, an engineering-memory system containing decisions, bug history, constraints, components, and policies, before editing code.

In plain words
What is it for?
For orienting at the start of a task, finding relevant structure and runbooks, checking escalations, and viewing recent engineering decisions.
Why use it?
It gives the agent relevant project context and established procedures instead of relying on memory or repeated searches. It also surfaces decisions that require the human's answer.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/davesheffer/hunch/hunch
Clone the repo
git clone --depth 1 https://github.com/davesheffer/hunch

Made for: Cursor.

Per session 1,529 This file is loaded in full into every session.
When invoked 1,529 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01529 $0.01529
Opus 5 $0.00764 $0.00764
Sonnet 5 $0.00306 $0.00306
Haiku 4.5 $0.00153 $0.00153

Measured yesterday against content hash c53f1fbfdb64, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

hunch scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/hunch.mdc · 58 lines

How it starts

The opening of the file, as written. The whole thing — 58 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🧠 Hunch (Engineering Memory)

This repo has Hunch — a curated graph of why the code is the way it is (decisions, bug history, invariants). It currently holds 193 decisions, 2 bugs, 10 constraints, 19 components, 3 policies, 1 open findings.

Consult Hunch via the hunch_* MCP tools — pick by MOMENT, not from memory:

Orient (session/task start):

  • hunch_context(target) — the minimal relevant slice for what you're about to do; a task phrase falls back to the closest graph matches. Call FIRST.
  • hunch_structure(target?) — the indexed shape of the repo/dir/file/symbol — orient from the graph, not grep rounds.
  • hunch_runbook(task) — the proven steps for a recurring task, before re-deriving them.
  • hunch_escalations() — the decisions only the HUMAN can make (including one exact imported ADR at a time, topic conflicts, and policy calls). Normally empty; when it isn't, ASK the user inline — an entry is a question, silence is never approval. Apply an ADR answer only through hunch_review_imported_adr with its printed source and review hashes.
  • hunch now (CLI) — recent decisions + the live roadmap; hunch log — the memory-move timeline (every capture/adopt/supersede/prune/repair, each revertable).

Before designing / choosing an approach:

  • hunch_why(target) — why a file/symbol is shaped this way (decisions, bugs, constraints) — including what was already REJECTED.
  • hunch_current_decision(topic) — the one live answer for a topic (history + rejected included).
  • hunch_bug_lineage(symptom_or_symbol) — has this failed before? what was the root cause?
  • hunch_compare(candidates) — rank candidate branches/commits by fewest invariant hits.
  • hunch_query(query) — free-text search when nothing above fits.

Before editing:

  • hunch_check_constraints(scope) and hunch_get_dependents(symbol) / hunch_blast_radius(target) — invariants in scope + who you'd break. (The pre-edit hook injects this per file automatically; call these for PLANNING breadth.)
  • hunch_findings(scope?) — known-but-unfixed gaps in the area (past audits, measurements, incidents) so you inherit them instead of re-discovering them.

Before committing / merging:

  • hunch_conformance() — does the code still SATISFY recorded intent? Run before and after a refactor.
  • hunch_policy_evaluate(policy_id?, active_only?) / hunch_policy_plan(policy_id) / hunch_policy_card(policy_id) / hunch_policy_proof(policy_id) — evaluate canonical policy, inspect the planned corpus, review the evidence/uncertainty card, and inspect raw replay receipts; only an explicit human activation grants authority.
  • hunch_pr_impact(base?) / hunch_merge_verdict(...) — a change's memory surface; would it re-open a closed bug?

Build the Constitution review queue:

  • hunch constitution bootstrap --since 90d --max-candidates 3 (CLI) — normalize recent structured human evidence into at most three non-active policy candidates; add --history for exact, human-identifier-grounded fix/revert deltas or explicit dependency retirements. Coincidence/ambiguity stays uncompilable; neither path grants authority.
  • hunch constitution ingest --since 90d [--instructions] [--from export.json] (CLI) — normalize corrections/failures plus bounded committed instructions/ADRs and strict local review/conversation/PR exports into Git-native evidence; raw prose is hash-only, unsupported intent remains uncompilable, and no policy is minted.

After deciding / when corrected:

  • hunch_capture_decision(topic?)hunch_record_decision(...) — interview first, then write; status proposed = roadmap intent (shows in hunch now).
  • hunch_record_correction(...) — a human correction becomes an ENFORCED rule (Never Twice), not a one-session memory.
  • hunch_record_finding(...) — an OBSERVATION with no code change (an audit that found a gap, a measured number, an incident) becomes durable memory anchored to a date + evidence; /audit runs the ritual.
  • hunch_timeline(target) — decision history when investigating how something evolved.

Read the full file on GitHub · 58 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 58 lines · 1,529 tokens per session scan A c53f1fbfdb64

Subscribe to this mod's changes

hunch is a cursor rule published in the GitHub repository davesheffer/hunch (6 stars, last pushed yesterday), licensed Apache-2.0. It adds 1,529 tokens to every session, about $0.0076 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.