a quiet second mind β it watches, connects, and whispers.
A self-contained proactive AI partner that runs locally on your PC. Inspired by the "Machine" from Person of Interest β but honest about what's real vs sci-fi.
It doesn't ping. It doesn't shout. It learns the way your days play out β which tabs you reopen, which threads you keep, the patterns you carry even in sleep.
It never foretells. It only connects the old, half-forgotten your now expects. And when the timing is gentle and true, it leaves you a hunch β that feels like you.
It quietly watches your activity, learns your patterns and how your topics connect, and β when your current focus lines up with something useful from your past β sends you a subtle, well-timed nudge that feels like your own thought.
No cloud. No external memory service. Everything stays in a local SQLite DB on your machine.
WATCH βββΆ STORE βββΆ BASELINE βββΆ GRAPH βββΆ DETECT βββΆ GATE βββΆ BRAIN βββΆ nudge
- Watch β active window/app, browser history, opened files, clipboard, active times. Logs only on change (no spam).
- Baseline β builds a pattern of life: your rhythm, apps, recurring topics & entities.
- Graph β a self-built knowledge graph (entities = nodes, co-occurrence = edges) so it knows what relates to what. Dot-connecting in < 1 s.
- Detect β compares "what you're on right now" vs your baseline + graph β opportunities ("your focus connects to X"), spikes, dormant-project revival, unusual hours.
- Gate β quality filter: score threshold + quiet hours + min gap between nudges. So it never spams you.
- Brain β turns a worthwhile signal into a casual, subtle nudge (via
claude -p) and sends it to your Telegram.
The honest part: it does not predict problems weeks ahead from invisible micro-anomalies. It connects your real signals β which already feels surprisingly prescient.
On the first run after install, Hunch bootstraps itself once β automatically, no command needed. It pulls everything in so it doesn't start blind:
- Your archives (
ingest_sources) β notes, memories, history you point it at. - Every Claude Code session you've ever had β word for word. Hunch reads the local session transcripts (
~/.claude/projects/**/*.jsonl, which Claude Code writes itself) and pulls each message with its real timestamp, role, response time (the gap to the previous turn), answer type, and an emotion proxy.
Then it builds the baseline + graph and comes up to full speed.
The emotion proxy is honest, not magic. There's no real feeling-scanner. It's a transparent heuristic over written tone β ALL-CAPS, exclamation marks, swear/dismissive words (frustration) vs. hype words (excitement), terseness β giving each message a label + polarity + arousal. It reads your conversational rhythm and mood over time, nothing more. Generic & language-light (DE+EN lexica), tunable in
emotion.py.Noise is filtered the right way (generically, not by hardcoding): sub-agent turns (
isSidechain), automated/cron/SDK turns (entrypoint/promptSource), hook injections, tool output, and slash-command bodies are tagged or skipped β so the mood profile reflects you typing, not the machinery.
Session sync is incremental afterwards β only changed transcripts are re-read β and runs read-only. Default source ~/.claude/projects works for any Claude Code user; add more paths via session_sources in config.local.json.
- Deps:
pip install pywin32 psutil(Windows). Needs theclaudeCLI on PATH for nudge phrasing. - Config: copy
config.example.jsonβconfig.local.jsonand fill in:chat_idβ your Telegram chat id (or set envMACHINE_CHAT_ID)bot_tokenβ your Telegram bot token (or envMACHINE_BOT_TOKEN)user_descβ a short description of you (shapes the nudge style)ingest_sourcesβ optional paths to your own notes/archives as cold-start materialquiet_hours,nudge_min_score,nudge_min_gap_minβ tune to taste
- Run:
python -m hunch.run # foreground loop (watcher + scheduler) python -m hunch.run --install-task # autostart at logon (Startup folder, no admin) python -m hunch.run --health # is it alive?
Either the CLI or the /machine slash command (Claude Code plugin):
/hunch status # is it live? what does it see right now?
/hunch scan # current signals
/hunch why <name> # how something connects in the graph
/hunch profile # your pattern of life
/hunch sync [--full] # pull your Claude Code sessions into the store
/hunch mood # your mood over time (emotion proxy across sessions)
/hunch nudge # force a nudge now
Bootstrap/sync directly:
python -m hunch.run --bootstrap # force the one-time cold start (ingest + all sessions + rebuild)
python -m hunch.session_sync --full # (re)sync every session from scratch
Everything is local. The watcher captures a lot (that's the point) β it all lives in data/hunch.db on your machine and is never uploaded. The only outbound traffic is the nudge to your own Telegram. config.local.json, the DB, and .env are gitignored and never leave your repo.
python -m hunch.run --uninstall-task # remove autostart
# then kill the process listed in data/runtime.pid
hunch/
config.py # config (env / config.local.json β no secrets in code)
store.py # SQLite store (+ bulk upserts)
watcher.py # PC signal collector
ingest.py # cold-start import of your archives
session_sync.py # pulls Claude Code session transcripts (word-for-word + metadata)
emotion.py # emotion proxy (tone heuristic, DE+EN)
baseline.py # pattern-of-life profile
graph.py # knowledge graph + dot-connecting
detect.py # anomaly / opportunity detection
brain.py # nudge engine (Gemini CLI / claude / templates) + Telegram
cli.py # status / scan / why / profile / sync / mood / nudge
run.py # runtime launcher + bootstrap + autostart + health
commands/hunch.md # /hunch slash command
MIT.
