hunch-sdk 0.3.0__tar.gz

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.
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ .venv/
5
+ venv/
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+ .DS_Store
10
+ .pytest_cache/
11
+ *.backup
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,283 @@
1
+ Metadata-Version: 2.4
2
+ Name: hunch-sdk
3
+ Version: 0.3.0
4
+ Summary: Drive your Mac focus-free over MCP: OS APIs, AppleScript, CDP, and Accessibility.
5
+ Project-URL: Homepage, https://github.com/prithviseran/hunch-mcp
6
+ Project-URL: Issues, https://github.com/prithviseran/hunch-mcp/issues
7
+ Author-email: Prithvi Seran <prithviseran0@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: accessibility,agent,automation,computer-use,macos,mcp
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: MacOS X
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: mcp>=1.2
21
+ Requires-Dist: pyobjc-framework-applicationservices>=10.0
22
+ Requires-Dist: pyobjc-framework-cocoa>=10.0
23
+ Requires-Dist: pyobjc-framework-quartz>=10.0
24
+ Requires-Dist: websocket-client>=1.6
25
+ Provides-Extra: agent
26
+ Requires-Dist: anthropic>=0.80; extra == 'agent'
27
+ Description-Content-Type: text/markdown
28
+
29
+ <p align="center">
30
+ <img src="src/hunch/assets/hunch.png" alt="Hunch" width="128">
31
+ </p>
32
+
33
+ # Hunch
34
+
35
+ **Drive your Mac with any LLM: focus-free, in the background, over [MCP](https://modelcontextprotocol.io).**
36
+
37
+ Hunch is an MCP server that gives an LLM agent hands on *your* Mac: your installed apps, your
38
+ logged-in sessions, your files, without taking over your screen. While you keep working in the
39
+ foreground, an agent can read a background app's UI, click its buttons, drive Mail or Music by
40
+ AppleScript, fill a web form, or move files. It works on real native apps, not just a browser.
41
+
42
+ > **Works best with modern LLMs.** Hunch ships a detailed playbook as MCP server instructions;
43
+ > capable tool-using models (Claude Sonnet/Opus-class and up) follow it well. Smaller models may
44
+ > pick clumsier paths (screenshots and keystrokes instead of tree reads and clicks).
45
+
46
+ ## The four layers
47
+
48
+ Hunch always prefers the most direct layer. It's faster, more reliable, and (except the last)
49
+ never touches your screen:
50
+
51
+ | Layer | Tools | What it's for |
52
+ |---|---|---|
53
+ | **OS-API** | `trash` `file_op` `open_file` `clipboard_*` `launch_app` … | files, clipboard, app lifecycle, via direct API calls |
54
+ | **AppleScript** | `applescript` | scriptable apps: Mail, Messages, Notes, Calendar, Music, Finder, Safari … |
55
+ | **Web / CDP** | `web_open` `web_snapshot` `web_act` `web_login` … | any browser page or Electron app, driven in the background |
56
+ | **Accessibility** | `snapshot` `act` | any native app's UI: read the tree, click/select/type by reference |
57
+
58
+ A gated last resort (`screenshot` + coordinate clicks/keystrokes) exists for apps whose
59
+ accessibility tree is truly empty. It steals focus, so it asks you first.
60
+
61
+ ## How it works (no server, no cloud)
62
+
63
+ "MCP server" undersells how local this is. `hunch serve` is a plain Python process that your
64
+ MCP host (Claude Desktop, Cursor, …) spawns as a **child process** and talks to over
65
+ **JSON-RPC on stdin/stdout** (MCP's stdio transport). There is no HTTP endpoint, no port
66
+ Hunch listens on, no daemon, and no telemetry. When your host quits, Hunch is gone.
67
+
68
+ The tools are direct macOS API calls in-process: the Accessibility framework via pyobjc,
69
+ `osascript` for AppleScript, OS APIs for files/clipboard, and, for the web layer, a local
70
+ WebSocket to Chrome's DevTools port on `127.0.0.1`. The only thing that ever touches the
71
+ network is Chrome itself, doing ordinary browsing. What the model sees is whatever the tools
72
+ return through your host; nothing else leaves the machine.
73
+
74
+ ## Install
75
+
76
+ macOS 13+. Via Homebrew (installs Python and all dependencies in an isolated env):
77
+
78
+ ```
79
+ brew install prithviseran/hunch/hunch
80
+ ```
81
+
82
+ (PyPI/pipx publication is planned; today Homebrew is the supported path.)
83
+
84
+ Then, one time:
85
+
86
+ ```
87
+ hunch setup # walk the macOS permission grants + create the browser profile
88
+ hunch doctor # verify every layer; fix anything it flags
89
+ hunch connect claude-desktop # or: claude-code, cursor
90
+ ```
91
+
92
+ Restart your MCP host and ask it to *"use hunch to …"*.
93
+
94
+ ### The permissions, honestly
95
+
96
+ macOS trust attaches to the **app that runs the server**, meaning your MCP host (Claude Desktop,
97
+ Cursor, your terminal), not "hunch" itself. `hunch setup` walks you through it:
98
+
99
+ - **Accessibility** (required): lets Hunch read app UIs and click focus-free. Grant it to your MCP
100
+ host app in System Settings → Privacy & Security → Accessibility.
101
+ - **Automation** (per-app, automatic): the first time Hunch scripts an app, macOS shows a one-time
102
+ "allow control" prompt.
103
+ - **Screen Recording** (optional): only for the screenshot/vision fallback.
104
+
105
+ `hunch doctor` reports what's granted. Note: its Accessibility line reflects the *terminal* you ran
106
+ it from; the server inherits the *host's* grant.
107
+
108
+ ## Python SDK (library use)
109
+
110
+ Hunch is also an importable library — the same focus-free primitives as the MCP tools, driven
111
+ deterministically from your own Python (a cron job, a test harness, your own agent loop), no LLM
112
+ required. The distribution is `hunch-sdk`; the import is `hunch`:
113
+
114
+ ```python
115
+ from hunch import Hunch
116
+
117
+ mac = Hunch() # your machine, your logged-in apps
118
+ print(mac.snapshot("Mail")) # accessibility tree, focus-free
119
+ mac.act([{"action": "click", "ref": "e12"}])
120
+ mac.web.open(url="https://github.com") # real persistent Chrome profile over CDP
121
+ print(mac.web.snapshot())
122
+ mac.files.trash(["~/Downloads/old.zip"]) # reversible delete, no Finder
123
+ mac.applescript('tell application "Music" to play')
124
+ ```
125
+
126
+ Constructor knobs: `app` (initial snapshot target), `confirm="dialog"|"off"` (see below),
127
+ `check_permissions` (Accessibility check up front), `simultaneous` (never touch the
128
+ foreground/cursor/keyboard), `cdp_port`.
129
+
130
+ - **Permissions**: for library use it's *whatever runs your script* — your terminal or IDE — that
131
+ needs Accessibility (the MCP server instead uses the host app's grant). The constructor checks
132
+ and raises `AccessibilityNotGranted` with instructions. `screenshot()` additionally needs
133
+ Screen Recording.
134
+ - **Safety gates default ON**: the same one-click "Go ahead" dialogs and `~/.hunch/config.json`
135
+ gates as the MCP server. `Hunch(confirm="off")` auto-approves for that instance only — for
136
+ unattended scripts, with the same caveats as `auto_approve_all`.
137
+ - **Errors**: methods return status strings (check for `REFUSED`); the SDK raises only
138
+ `ApprovalDenied` (user declined a dialog), `AccessibilityNotGranted`, `WebNotOpen`
139
+ (`.web` before `.web.open()`), `StaleRef` (re-snapshot), and `HunchError` when a CDP
140
+ browser can't be opened (`web.restart()` recovers a stale instance).
141
+ - **Credentials**: `mac.web.fill_login(service)` / `fill_secret(service, ref)` type Keychain
142
+ values straight into the page and never return them; domain binding is enforced.
143
+ - **Coexistence**: the SDK and the MCP server share the CDP port (9337) and the persistent Hunch
144
+ browser profile — whichever opened it first is reused, but `web.restart()`/`web.login()` kill
145
+ whatever holds the port.
146
+
147
+ Runnable scripts live in [`examples/`](examples/).
148
+
149
+ ## Agent loop (`mac.agent`)
150
+
151
+ The instance SDK gives you deterministic primitives. The **agent loop** puts an LLM in the driver's seat:
152
+ you hand it a task in plain English and Claude drives the Mac through those same primitives —
153
+ Scrapybara's `act()`, but on *your* machine with *your* logged-in apps. It's an optional extra
154
+ (keeps the base install free of the model SDK):
155
+
156
+ ```bash
157
+ pip install 'hunch-sdk[agent]'
158
+ export ANTHROPIC_API_KEY=sk-ant-... # or: ant auth login
159
+ ```
160
+
161
+ ```python
162
+ from hunch import Hunch
163
+
164
+ mac = Hunch()
165
+ result = mac.agent.run("reply to Sarah's latest email, but don't send it")
166
+ print(result.text) # Claude's final summary
167
+ print(result.turns, result.usage)
168
+ ```
169
+
170
+ - **Watch it work** with an `on_event(kind, data)` callback — `kind` is one of `text` (Claude's
171
+ reasoning), `tool` (`{name, input}`), `tool_result` (preview), `done` (final text), `error`.
172
+ - **Continuation**: follow-up `act()` calls keep the conversation (Claude still knows which email
173
+ is Sarah's); `mac.agent.reset()` starts a fresh task.
174
+ - **Mix layers freely**: call `mac.snapshot(...)` / `mac.clipboard.get()` deterministically around
175
+ `mac.agent.run(...)` — the thing a cloud sandbox can't do on your real machine.
176
+ - **Knobs**: `run(task, model="claude-opus-4-8", max_turns=40, effort=None, on_event=None,
177
+ system_suffix="")`. `AgentResult` has `text`, `turns`, `stop_reason`, `usage`, `aborted`.
178
+ - **Safety**: the instance's gate config governs the loop. The default `confirm="dialog"` pops a
179
+ real "Go ahead?" dialog before any focus-stealing or risky step — good when you're at the
180
+ machine, but a gated action can stall an unattended run for the dialog's timeout. For cron jobs
181
+ use `Hunch(confirm="off")` and accept the risk; Claude still asks *you* (via `notify_user`)
182
+ before irreversible or outward actions like sending a message. A declined gate comes back to the
183
+ model as a `REFUSED` result, so the loop adapts instead of crashing.
184
+ - **Cost**: each turn resends the tree-heavy history; prompt caching is on by default, so cached
185
+ input is ~10× cheaper — but long autonomous runs still add up. `max_turns` caps it.
186
+
187
+ Other models: the agent loop is Claude-only, but the instance-SDK primitives are provider-agnostic —
188
+ wire `mac.snapshot()` / `mac.act()` into your own OpenAI/Gemini/etc. agent loop as tools.
189
+
190
+ ## Credentials: agents use them, never see them
191
+
192
+ ```
193
+ hunch creds add github --domain github.com
194
+ hunch creds list
195
+ ```
196
+
197
+ Values go straight into the **macOS Keychain**. An agent signs in by calling
198
+ `web_fill_login("github")` with only the service *name*; Hunch reads the secret from the Keychain
199
+ and types it into the page over CDP. The value never enters the model's context, its logs, or its
200
+ provider's servers.
201
+
202
+ **Domain binding**: a credential added with `--domain github.com` will only ever be typed into
203
+ `github.com` (and its subdomains). If a confused or prompt-injected agent lands on a look-alike
204
+ page, the fill is refused. Bind every credential; blank (any-site) exists only for compatibility.
205
+
206
+ No stored credential? Agents fall back to `web_login`, which opens a tagged browser window where
207
+ *you* sign in yourself; the session then persists in Hunch's dedicated browser profile.
208
+
209
+ ## Confirmation gates
210
+
211
+ Your MCP host's tool approvals are the primary permission layer. Hunch adds a content-aware second
212
+ gate, a one-click macOS dialog, for the catastrophic cases:
213
+
214
+ | Gate | Fires on |
215
+ |---|---|
216
+ | `gates.focus_steal` | actions that take over your keyboard/cursor (`key`, `click_xy`, ref-less typing) |
217
+ | `gates.app_to_front` | an app being brought to the front (a focus switch, even mid-fullscreen) |
218
+ | `gates.shell` | AppleScript containing `do shell script` |
219
+ | `gates.destructive_applescript` | delete / send / empty trash / shut down / … |
220
+
221
+ One approval covers its follow-through: clicking "Go ahead" (on `request_focus`, a gated `act`,
222
+ or the app-to-front dialog) authorizes the switch it announced for ~15 s: no second dialog, and
223
+ the focus-switch notification is suppressed. A switch is either *asked about* or *announced*,
224
+ never both, and never silent (turn `gates.app_to_front` off and switches fall back to the
225
+ notification).
226
+
227
+ All on by default. `hunch config show` / `hunch config set gates.shell off` to adjust;
228
+ changes apply immediately, even to a running server. `auto_approve_all` disables everything and
229
+ makes you confirm you understand the [risk](SECURITY.md).
230
+
231
+ Hunch also refuses to let the agent edit anything under `~/.hunch/` (its own policy and credential
232
+ metadata) via its file tools; permission changes are for humans in a terminal.
233
+
234
+ ## Env vars
235
+
236
+ | Var | Effect |
237
+ |---|---|
238
+ | `HUNCH_NO_INTERNAL_GATE=1` | suppress all internal dialogs (for host apps that run their own approval UX) |
239
+ | `HUNCH_FORCE_SANDBOX=1` | web layer uses a throwaway, logged-out browser profile |
240
+ | `HUNCH_NOTIFY_FOCUS=0` | silence the "Hunch is switching apps" notifications (they fire only for switches no dialog asked about) |
241
+
242
+ ## FAQ
243
+
244
+ **Every tree read returns "(no window for …)" and AppleScript fails with "-25211 not allowed
245
+ assistive access".** One cause: the app hosting Hunch is missing the **Accessibility** grant.
246
+ Without it the AX API silently returns nothing, so apps look windowless even when they're open.
247
+ Grant it to the *host* (see next question), and if it's already listed, toggle it off and on:
248
+ macOS silently invalidates grants when an app updates. Restart the host afterwards.
249
+
250
+ **Which app do I grant permissions to?** The one that *launches* `hunch serve`: Claude Desktop,
251
+ Cursor, or your terminal app (for Claude Code). Grants attach to that app's identity, never to
252
+ "hunch" itself. This is also why `hunch doctor` can be misleading: it reports the grants of the
253
+ terminal you ran it in, which may differ from your MCP host's.
254
+
255
+ **Only `screenshot` fails; everything else works.** That's the **Screen Recording** permission,
256
+ which only the screenshot/vision fallback needs. Grant it to the host in System Settings →
257
+ Privacy & Security → Screen Recording, or just let agents use `snapshot`, which doesn't need it.
258
+
259
+ **It worked yesterday and broke today.** An update to your host app (or macOS) likely reset its
260
+ permission grants. Toggle the host off and on under Accessibility (and Screen Recording, if you
261
+ use it), then restart the host.
262
+
263
+ **An app's tree reads empty or shows only a sidebar.** Two different situations. Electron/CEF
264
+ apps (Discord, Slack, Spotify, VS Code) need an accessibility flag; `snapshot` relaunches them
265
+ once, in the background, to set it. Master-detail and Catalyst apps (WhatsApp, Mail) expose only
266
+ the pane you're in: the agent should click into an item by ref and re-snapshot; the detail pane
267
+ then appears. Also check the app actually has a window open.
268
+
269
+ **The web layer won't connect.** Chrome 136+ blocks CDP on your default profile by design. Hunch
270
+ uses its own profile at `~/.hunch/chrome-cdp`; run `hunch setup` to create it and sign into your
271
+ sites there.
272
+
273
+ **My host shows the server instructions truncated.** Cosmetic: some host UIs shorten the playbook
274
+ in their server-info display; the model receives it in full.
275
+
276
+ ## Security
277
+
278
+ Read [SECURITY.md](SECURITY.md): threat model (prompt injection, mainly), what the gates do and
279
+ don't cover, and how to report vulnerabilities.
280
+
281
+ ## License
282
+
283
+ Apache-2.0; see [LICENSE](LICENSE).