hadley 0.5.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,22 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ strategy:
11
+ matrix:
12
+ os: [ubuntu-latest, macos-latest]
13
+ python: ["3.10", "3.13"]
14
+ runs-on: ${{ matrix.os }}
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: astral-sh/setup-uv@v5
18
+ with:
19
+ python-version: ${{ matrix.python }}
20
+ - run: uv venv --clear && uv pip install -e '.[dev]'
21
+ - run: .venv/bin/ruff check src tests
22
+ - run: .venv/bin/pytest -q
@@ -0,0 +1,24 @@
1
+ name: Publish to PyPI
2
+
3
+ # Push a tag like v0.5.0 to build Hadley and upload it to PyPI.
4
+ # Uses PyPI trusted publishing: no passwords or tokens are stored anywhere.
5
+ on:
6
+ push:
7
+ tags: ["v*"]
8
+
9
+ jobs:
10
+ publish:
11
+ runs-on: ubuntu-latest
12
+ environment: pypi
13
+ permissions:
14
+ id-token: write # lets PyPI verify this workflow
15
+ contents: read
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v5
19
+ - name: Check the tag matches the version
20
+ run: |
21
+ version=$(grep -oP '__version__ = "\K[^"]+' src/hadley/__init__.py)
22
+ [ "v$version" = "$GITHUB_REF_NAME" ] || { echo "tag $GITHUB_REF_NAME != version $version"; exit 1; }
23
+ - run: uv build
24
+ - run: uv publish --trusted-publishing always
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ # A Hadley project created while trying Hadley inside its own repo
10
+ # (examples/*/.hadley/ stay tracked)
11
+ /.hadley/
hadley-0.5.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hadley contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
hadley-0.5.0/PKG-INFO ADDED
@@ -0,0 +1,457 @@
1
+ Metadata-Version: 2.5
2
+ Name: hadley
3
+ Version: 0.5.0
4
+ Summary: Run a tree of AI coding agents (Mother + specialists) from one portable YAML file. Survives reboots and usage-limit windows.
5
+ Project-URL: Homepage, https://github.com/josefjadrny/hadley
6
+ Project-URL: Issues, https://github.com/josefjadrny/hadley/issues
7
+ Author: Hadley contributors
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: agents,claude,claude-code,llm,multi-agent,orchestrator
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Software Development
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: mcp>=2.3
20
+ Requires-Dist: pydantic>=2.6
21
+ Requires-Dist: pyyaml>=6.0
22
+ Requires-Dist: textual>=0.60
23
+ Requires-Dist: typer>=0.12
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
26
+ Requires-Dist: pytest>=8; extra == 'dev'
27
+ Requires-Dist: ruff>=0.5; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ <div align="center">
31
+
32
+ <img src="https://raw.githubusercontent.com/josefjadrny/hadley/main/docs/assets/hadley-banner.svg" width="100%" alt="Hadley: agent colony control, a multi-agent orchestrator for Claude Code">
33
+
34
+ # Hadley
35
+
36
+ ### Hand a big task to a crew of AI agents. Then go to sleep.
37
+
38
+ *Mother plans. The androids hunt the bugs 👾. Nobody needs to watch.*
39
+
40
+ [![CI](https://github.com/josefjadrny/hadley/actions/workflows/ci.yml/badge.svg)](https://github.com/josefjadrny/hadley/actions/workflows/ci.yml)
41
+ ![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)
42
+ ![License: MIT](https://img.shields.io/badge/license-MIT-green)
43
+ ![Status: alpha](https://img.shields.io/badge/status-alpha-orange)
44
+ ![Linux | macOS](https://img.shields.io/badge/platform-linux%20%7C%20macOS-lightgrey)
45
+
46
+ [What it solves](#what-problem-does-it-solve) · [Install](#install) · [Quick start](#quick-start) ·
47
+ [Core ideas](#core-ideas) · [Commands](#commands) · [Project file](#the-project-file) ·
48
+ [How it works](#how-it-works) · [Safety](#accounts-terms-and-safety)
49
+
50
+ </div>
51
+
52
+ ```text
53
+ ▌ HADLEY ─ STATUS REPORT ─────────────────────────────────────────────────────
54
+ ▌ MOTHER ........... online. Holds the plan, gives the orders.
55
+ ▌ CREW ............. Ash · Bishop · Call · David · Walter · Andy · Rook
56
+ ▌ USAGE LIMIT ...... crew hibernates, wakes when the window reopens.
57
+ ▌ REBOOT ........... state restored from the log. Mission continues.
58
+ ▌ AIRLOCK .......... each agent gets only its own tools and skills.
59
+ ▌ MANIFEST ......... one .hadley/ folder. Commit it, and anyone gets the same crew.
60
+ ▌─────────────────────────────────────────────────────────────────────────────
61
+ ```
62
+
63
+ **Hadley is a multi-agent orchestrator for [Claude Code](https://code.claude.com).** It runs a
64
+ lead agent, **Mother**, and the specialist agents she delegates to, unattended. They keep working
65
+ for hours, through usage limits and reboots, and the whole crew is defined in one YAML file you
66
+ can share. Named after Hadley's Hope, the colony in *Aliens*. Agents get android names
67
+ from the films unless you give them your own.
68
+
69
+ #### Mission log
70
+
71
+ ```text
72
+ $ hadley run # (output trimmed)
73
+ run 3 created for project 'crm' (workdir ~/crm)
74
+ Mother plan plan updated (6 steps)
75
+ Mother delegate → Ash (architect) #2: Write DESIGN.md for a FastAPI + SQLite CRM…
76
+ Ash done Ash finished
77
+ Mother delegate → Bishop (coder) #3: Implement contacts with search, following DESIGN.md…
78
+ Bishop delegate → Call (tester) #4: Run the test suite for the contacts router…
79
+ Call done Call finished
80
+ Bishop limit paused (usage limit) until 2026-12-02 03:00 ← you are asleep
81
+ info usage window reopened, resuming
82
+ Bishop done Bishop finished
83
+ Mother delegate → David (reviewer) #5: Review the contacts feature…
84
+ David done David finished
85
+ Mother done Mother finished
86
+
87
+ run 3 (crm): done
88
+ ```
89
+
90
+ ---
91
+
92
+ ## What problem does it solve?
93
+
94
+ | Without Hadley | With Hadley |
95
+ |---|---|
96
+ | A big task doesn't fit in one chat. You keep re-prompting and copying context around. | You write the task once. Mother plans it, splits it up and hands the parts to her team. |
97
+ | One model does everything, from planning to typing code to checking its own work. | Each job goes to the agent built for it: a strong model plans and reviews, a cheaper one writes code and tests. |
98
+ | You hit your usage limit at 2 a.m. and nothing happens until you're back. | The run pauses and resumes in the same conversations when the window reopens. |
99
+ | A reboot or a closed terminal loses the session. | All state is saved. The background service picks the run back up after a restart. |
100
+ | Agents either have no tools, or all of your tools, including your mail. | Each agent gets only the MCP servers it needs: a browser for the tester, nothing extra for the coder. |
101
+ | You can't tell what the agents are doing or what's left. | Mother keeps a plan (a checklist) that you can read any time, and approve before work starts if you like. |
102
+ | Your multi-agent setup is a pile of scripts nobody else can reproduce. | The team lives in one `.hadley/` folder. Commit it, share it, and others get the same setup. |
103
+
104
+ ## Who is it for?
105
+
106
+ - **Developers** who want to hand off whole pieces of work, like a small app, a refactor or a
107
+ test suite, and come back to a result rather than a half-finished chat.
108
+ - **Researchers, analysts and writers.** Mother on her own can investigate a topic, compare
109
+ options or draft a report. Agents are not just for code.
110
+ - **People designing agent teams**, who want to try "planner + coder + reviewer" setups and
111
+ share them as a file.
112
+
113
+ You need a [Claude Code](https://code.claude.com) setup: a Claude subscription or an API key.
114
+ Hadley runs locally on Linux or macOS, for you, with your own account.
115
+
116
+ **Not a fit (yet):** hosting agents for other people, running on Windows, or many agents
117
+ working at the same moment (agents take turns for now; see the [roadmap](#roadmap)).
118
+
119
+ ---
120
+
121
+ ## Install
122
+
123
+ Requirements: Python 3.10+ and [Claude Code](https://code.claude.com), signed in (run `claude`
124
+ once and log in).
125
+
126
+ ```bash
127
+ uv tool install git+https://github.com/josefjadrny/hadley # or: pipx install git+https://github.com/josefjadrny/hadley
128
+ hadley doctor # checks that everything is in place
129
+ ```
130
+
131
+ <details>
132
+ <summary>Installing from a local checkout, and updating</summary>
133
+
134
+ ```bash
135
+ git clone https://github.com/josefjadrny/hadley && cd hadley
136
+ uv tool install --editable . # follows the checkout: `git pull` is all you need to update
137
+ ```
138
+
139
+ - A non-editable install (`uv tool install .`) copies the code. Update it with
140
+ `uv tool install --force .`.
141
+ - When installed from git, update with `uv tool upgrade hadley`.
142
+ - `hadley version` prints the installed version.
143
+
144
+ </details>
145
+
146
+ ## Quick start
147
+
148
+ Run Hadley inside the folder you want the agents to work on: an existing repo or a new folder.
149
+
150
+ ```bash
151
+ cd my-project
152
+ hadley init # creates .hadley/hadley.yaml with just Mother
153
+ $EDITOR .hadley/hadley.yaml # write your task under `goal:`
154
+ hadley validate # checks the file and prints the agent tree
155
+ hadley run # starts working and streams what the agents do
156
+ ```
157
+
158
+ - **Want a ready-made software team** (Mother + coder, reviewer, tester)? Use `hadley init -t coding`.
159
+ - **Want an agent to use a browser or another tool?** Add an MCP server under `mcp_servers` and
160
+ list it in that agent's `mcp`. See [the project file](#the-project-file).
161
+ - **Want to check the plan before work starts?** Set `plan_approval: true`. Mother writes her plan
162
+ and the run pauses. Read it with `hadley plan`, edit `.hadley/plan.md` if you like, and approve
163
+ with `hadley resume`.
164
+ - **Want to stop?** Press **Ctrl-C** at any time. Everything is saved, and `hadley resume`
165
+ continues where the agents stopped.
166
+ - **Want it to run unattended**, in the background and after reboots? Install the service once,
167
+ then start runs with `-d`:
168
+
169
+ ```bash
170
+ hadley service install # Linux: systemd user service · macOS: launchd agent
171
+ hadley run -d # hand the run to the service and get your terminal back
172
+ hadley tui # live dashboard: p = pause, r = resume, a = approve plan, q = quit
173
+ ```
174
+
175
+ > **Linux:** the user service starts when you log in. To start it at boot without logging in,
176
+ > run `sudo loginctl enable-linger $USER` once.
177
+
178
+ ### Everything lives in `.hadley/`
179
+
180
+ ```text
181
+ my-project/ ← your project; the agents work here
182
+ ├── .hadley/ ← everything Hadley keeps in your project
183
+ │ ├── hadley.yaml ← the team and the task
184
+ │ ├── skills/ ← skills for your agents (optional)
185
+ │ ├── plan.md ← Mother's plan for the current run
186
+ │ ├── runs/<id>/ ← archive: plan.md and report.md of each finished run
187
+ │ └── .gitignore ← ignores runs/
188
+ ├── src/ ...
189
+ ```
190
+
191
+ - **Keep Hadley private:** add `.hadley/` to your project's `.gitignore`.
192
+ - **Share the team and the plan:** commit `.hadley/`. The run archive stays ignored.
193
+ - Commands find the project the way git does, from the project folder or any subfolder.
194
+ - Running `hadley init` again lists what's in `.hadley/` and asks before replacing it.
195
+ - Run state (runs, logs, the service's work queue) is kept outside your project, in Hadley's
196
+ state folder (see [Configuration](#configuration)).
197
+
198
+ ---
199
+
200
+ ## Core ideas
201
+
202
+ | Concept | Meaning |
203
+ |---|---|
204
+ | **Project** | A folder with a `.hadley/` inside. You can have as many as you like, and different projects can run at the same time. |
205
+ | **Mother** | The root agent. She receives the task (`goal`), works on it herself or delegates, and writes the final report. |
206
+ | **Team** | The other agents, each with a purpose, model, effort, skills, MCP servers and permissions. |
207
+ | **Plan** | Mother's checklist of steps and who does them, kept in `.hadley/plan.md`. Only Mother can change it (other agents get no plan tools), and you can read or edit it. |
208
+ | **`can_call`** | Who may delegate to whom. Hadley enforces it: an agent cannot reach anyone outside its list. |
209
+ | **Run** | One execution of a project's task. It can be paused, resumed, retried or cancelled. One project runs one task at a time, because runs share the project's `workdir`. |
210
+ | **Job** | One agent working on one task inside a run. Delegation creates child jobs, so a run is a tree of jobs. |
211
+
212
+ **Agent names.** Every agent has an id (its key in the file) and a display name, `alias`.
213
+ Without an alias, the root is **Mother** and the others are named, in file order, after the
214
+ androids of the *Alien* films in release order: **Ash, Bishop, Call, David, Walter, Andy, Rook**
215
+ (then Ash-2, …). Names come from the file, so everyone who opens a shared project sees the same
216
+ names. Agents can delegate by id or by name.
217
+
218
+ ---
219
+
220
+ ## Commands
221
+
222
+ Inside a project folder, commands act on that project. Elsewhere they act on all projects. You
223
+ can always pass a run number explicitly.
224
+
225
+ | Command | What it does |
226
+ |---|---|
227
+ | `hadley init [dir] [-t minimal\|coding] [--name N] [--force]` | Create `.hadley/hadley.yaml` (Mother only by default); asks before replacing an existing one |
228
+ | `hadley validate [dir]` | Check the project file, show the agent tree, and check Claude Code and MCP variables |
229
+ | `hadley run [dir] [-g TASK] [-d] [--from-plan]` | Start a run. `-g` overrides `goal:`, `-d` hands it to the service, `--from-plan` continues from the existing plan |
230
+ | `hadley plan [run]` | Show Mother's plan |
231
+ | `hadley status [run] [-a]` | List runs (`-a`: all projects), or show one run's job tree and cost |
232
+ | `hadley logs [run] [-f] [-n N]` | Show the last N events; `-f` keeps following |
233
+ | `hadley pause [run]` | Pause a run (agents stop; nothing is lost) |
234
+ | `hadley resume [run] [-d]` | Resume a paused or interrupted run; approves a plan that's waiting; retries a failed run |
235
+ | `hadley cancel RUN` | Cancel a run for good |
236
+ | `hadley tui [run]` | Live terminal dashboard |
237
+ | `hadley service install\|uninstall\|status` | Manage the background service |
238
+ | `hadley daemon` | Run the service's engine in the foreground (for debugging) |
239
+ | `hadley doctor` | Check the setup |
240
+ | `hadley version` | Print the version |
241
+
242
+ ---
243
+
244
+ ## The project file
245
+
246
+ The project file is `.hadley/hadley.yaml`. Here is an example with every option. Only `name`,
247
+ `agents` and each agent's `purpose` are required; everything else has a sensible default.
248
+
249
+ ```yaml
250
+ version: 1
251
+ name: crm
252
+ description: A small self-hosted CRM.
253
+ goal: | # the task you hand to Mother
254
+ Build a CRM web app with contacts, a deals pipeline and a dashboard.
255
+ workdir: . # where agents work, relative to the project folder
256
+ root: mother # which agent is Mother
257
+ plan_approval: false # true: pause after Mother writes her plan until you approve
258
+
259
+ defaults: # applied to every agent unless the agent overrides it
260
+ provider: claude-code
261
+ permission_mode: bypassPermissions
262
+
263
+ mcp_servers: # MCP servers agents may use (each agent picks its own below)
264
+ playwright:
265
+ command: npx
266
+ args: ["@playwright/mcp@latest"]
267
+ tracker:
268
+ type: http # stdio (default), http or sse
269
+ url: https://tracker.example.com/mcp
270
+ headers: {Authorization: "Bearer ${TRACKER_TOKEN}"} # ${VAR}: from your environment
271
+
272
+ limits:
273
+ max_depth: 4 # how deep delegation may go below Mother
274
+ max_jobs: 100 # agent jobs per run
275
+ retries: 2 # retries when an agent fails
276
+ max_report_chars: 6000 # longer reports are cut before they reach the caller
277
+ on_usage_limit: pause # pause until the window reopens, or: fail
278
+ limit_retry_minutes: 15 # wait time when a limit carries no reset time
279
+
280
+ agents:
281
+ mother:
282
+ purpose: Plan, delegate, verify, report.
283
+ instructions: Do not write code yourself.
284
+ model: opus
285
+ effort: high
286
+ can_call: [coder, reviewer]
287
+ coder:
288
+ alias: Rosie # optional display name (default: Ash, Bishop, ...)
289
+ purpose: Implement one scoped task.
290
+ model: sonnet
291
+ effort: medium
292
+ context_window: 200000
293
+ skills:
294
+ - path: ./skills/python-style
295
+ purpose: House style for Python code.
296
+ allowed_tools: ["Bash(npm *)"]
297
+ disallowed_tools: ["WebFetch"]
298
+ can_call: [tester]
299
+ reviewer:
300
+ purpose: Review changes; approve or list required fixes.
301
+ tester:
302
+ purpose: Test the app in a real browser and report failures.
303
+ mcp: [playwright] # only the tester gets a browser
304
+ ```
305
+
306
+ A full working example is in [`examples/crm/.hadley`](examples/crm/.hadley). Try it with
307
+ `cp -r examples/crm ~/crm && cd ~/crm && hadley run`. Its tester uses Playwright, which needs
308
+ Node.js (`npx`).
309
+
310
+ <details>
311
+ <summary><b>Agent options reference</b></summary>
312
+
313
+ | Field | Default | Meaning |
314
+ |---|---|---|
315
+ | `purpose` | *(required)* | What the agent is for. Shown to the agent and to everyone who can call it. |
316
+ | `alias` | Mother / Ash, Bishop, … | Display name, unique within the project. |
317
+ | `instructions` | – | Extra text added to the agent's system prompt. |
318
+ | `provider` | `claude-code` | Which backend runs the agent. |
319
+ | `model` | your Claude Code default | Alias (`opus`, `sonnet`, `haiku`, `fable`) or a full model id. |
320
+ | `effort` | your Claude Code default | `low`, `medium`, `high`, `xhigh` or `max`. |
321
+ | `context_window` | Claude Code default | `auto` or a token count of 100000 or more. Sets when the agent compacts (summarises) its context. |
322
+ | `skills` | – | Skill folders (each with a `SKILL.md`), as a path or `{path, purpose}`. Paths are relative to `.hadley/`. |
323
+ | `can_call` | – | Agents this one may delegate to. A shared callee is fine; cycles are allowed and are limited by `max_depth`. |
324
+ | `mcp` | – | MCP servers from `mcp_servers` this agent gets. |
325
+ | `inherit_mcp` | `false` | Also load your own Claude Code MCP servers and claude.ai connectors (Gmail, Drive, …). |
326
+ | `permission_mode` | Claude Code default | `acceptEdits`, `auto`, `bypassPermissions`, `manual`, `dontAsk` or `plan`. |
327
+ | `allowed_tools` / `disallowed_tools` | – | Tool rules passed to Claude Code, e.g. `"Bash(git *)"`. |
328
+
329
+ Notes:
330
+
331
+ - `defaults` is merged into every agent, and an agent's own value wins.
332
+ - **MCP servers are isolated per agent.** An agent gets only the servers in its `mcp` list, plus
333
+ Hadley's own tools. Your personal MCP servers and claude.ai connectors are left out unless the
334
+ agent sets `inherit_mcp: true`. So a shared project brings its servers along, and no agent can
335
+ reach your mail unless you allow it.
336
+ - `${VAR}` in MCP server settings is read from the environment. The background service doesn't see
337
+ your shell's variables, so put them in Hadley's `env` file (see [Configuration](#configuration)).
338
+ `hadley validate` and `hadley run` report missing variables.
339
+ - Agents also load your normal Claude Code setup: user-level settings, skills, plugins, and any
340
+ `CLAUDE.md` in the workdir or its parent folders. Hadley adds each agent's own skills on top.
341
+ Skills are copied for each agent, so an agent sees only its own.
342
+ - `hadley run` refuses to start while `goal` is still the placeholder text from `hadley init`.
343
+
344
+ </details>
345
+
346
+ ---
347
+
348
+ ## How it works
349
+
350
+ ```text
351
+ hadley run / hadley service
352
+ │
353
+ ┌─────▼─────┐ SQLite: runs, jobs, events
354
+ │ engine │◄───────────────────────────────────┐
355
+ └─────┬─────┘ │
356
+ starts the official `claude` CLI for each job (headless) │
357
+ │ │
358
+ Mother ── delegate(agent, task) ──► Hadley's tools (MCP) ───┘
359
+ ▲ records a child job, waits
360
+ └────────── the child's report ◄── for it, returns its report
361
+ ```
362
+
363
+ 1. **Each job is a Claude Code session.** Hadley starts the unmodified `claude` CLI with the
364
+ agent's model, effort, system prompt, skills, MCP servers and permissions, and reads its
365
+ output stream.
366
+ 2. **Delegation is a tool.** Agents with a `can_call` list get one extra tool, `delegate`. It
367
+ checks the rules, creates a child job and returns that agent's final report. The child sees
368
+ only the task text, so agents are told to write self-contained tasks.
369
+ 3. **Everything is saved.** Runs, jobs, session ids and a log of events live in a local SQLite
370
+ database. Each agent's conversation is saved by Claude Code itself.
371
+ 4. **Mother keeps the plan.** She gets two more tools, `plan_read` and `plan_write`, which store
372
+ the plan in `.hadley/plan.md`. No other agent gets them.
373
+ 5. **Each agent gets only its own tools.** It sees the MCP servers in its `mcp` list and its own
374
+ skills, and nothing from `.hadley/`.
375
+ 6. **Agents take turns.** Within a run, one agent works at a time; its callers wait for its
376
+ report.
377
+
378
+ ### What happens when…
379
+
380
+ | Situation | What Hadley does |
381
+ |---|---|
382
+ | **You hit your usage limit** | Claude Code reports when the window reopens. The run pauses until then, and each agent resumes **in the same conversation**. |
383
+ | **The machine restarts or crashes** | With the service installed, the run continues after the restart. Without it, `hadley status` flags the run and `hadley resume` continues it. |
384
+ | **An agent was mid-step** | That one step is lost; finished work and files are kept. The agent is told it was interrupted and checks the workdir. |
385
+ | **A restart hit while a parent waited on a child** | The child continues first. Then the parent is resumed and given the child's report, so the delegation is not repeated. |
386
+ | **An agent fails** | It is retried (`limits.retries`) in the same session. After that the job fails, and the parent receives the error and decides what to do. |
387
+ | **An agent runs out of context** | Long conversations are summarised automatically (`context_window` sets when). If one still outgrows the model, Hadley starts that agent in a **new session** with its original task and a note to continue from the files already in the workdir. Mother re-reads her plan first. |
388
+ | **A report is very long** | Agents are asked to keep reports short and put details in files. Anything over `limits.max_report_chars` is cut off, so one report can't fill Mother's context. |
389
+ | **You press Ctrl-C or `hadley pause`** | Agents stop and nothing is lost. `hadley resume` continues. |
390
+ | **`plan_approval` is on** | Mother writes the plan and the run pauses; nothing is delegated before you approve. `hadley resume` (or `a` in the TUI) approves, and Mother re-reads the plan, including your edits. |
391
+ | **A run finishes or is cancelled** | Its plan and final report are copied to `.hadley/runs/<id>/`. The next run starts a fresh plan, unless you use `--from-plan`. |
392
+
393
+ ---
394
+
395
+ ## Accounts, terms and safety
396
+
397
+ Hadley is a local tool. You run it on your own machine, with your own account.
398
+
399
+ - **It never touches your credentials.** Hadley runs the unmodified `claude` binary, which signs
400
+ in through Anthropic's own flow (your Claude subscription or `ANTHROPIC_API_KEY`). Hadley does
401
+ not read, store or forward tokens, and there is no hosted version.
402
+ - **Your provider's terms apply.** Anthropic's
403
+ [Claude Code legal and compliance](https://code.claude.com/docs/en/legal-and-compliance) page
404
+ says subscription usage limits "assume ordinary, individual usage". For heavy or continuous
405
+ automation, use an API key instead of a subscription. Don't share accounts or run Hadley for
406
+ other people on your subscription.
407
+ - **It respects usage limits.** When a limit is hit, Hadley waits for the window to reopen. It
408
+ never works around a limit.
409
+ - **`.hadley/` is kept away from agents.** Agents are told not to touch it, and Claude Code
410
+ permission rules block the file tools (Read, Edit, Write) there. That prevents accidents, but a
411
+ shell command could still reach the folder. Only a sandbox gives hard isolation.
412
+ - **Agents only get the MCP servers you give them.** Your own servers and connected accounts
413
+ (mail, drive, calendar) stay out of reach unless an agent sets `inherit_mcp: true`.
414
+ - **⚠ Agents act as your user.** Unattended agents can't answer permission prompts, so the
415
+ starter file uses `permission_mode: bypassPermissions`, which lets agents run any command your
416
+ user can. Run Hadley in a VM, a container or a dedicated user account, or narrow it down with
417
+ `permission_mode`, `allowed_tools` and `disallowed_tools`.
418
+
419
+ Hadley is an independent open-source project, not affiliated with or endorsed by Anthropic.
420
+
421
+ ## Configuration
422
+
423
+ | Environment variable | Default | Meaning |
424
+ |---|---|---|
425
+ | `HADLEY_HOME` | `~/.local/share/hadley` (Linux) · `~/Library/Application Support/hadley` (macOS) | Where state lives: database, logs, per-run files |
426
+ | `HADLEY_CLAUDE_BIN` | `claude` | Path to the Claude Code binary |
427
+
428
+ **`$HADLEY_HOME/env`** (optional): `KEY=VALUE` lines with variables for `${VAR}` in MCP server
429
+ settings, for the background service in particular. Variables set in your environment take
430
+ precedence. The file is outside your projects, so secrets never end up in `.hadley/`.
431
+
432
+ ## Development
433
+
434
+ ```bash
435
+ git clone https://github.com/josefjadrny/hadley && cd hadley
436
+ uv venv && uv pip install -e '.[dev]'
437
+ .venv/bin/pytest # uses a fake `claude`, so no usage is spent
438
+ .venv/bin/ruff check src tests
439
+ ```
440
+
441
+ **Adding a provider** (OpenAI, Gemini, another CLI, …): implement the `Provider` protocol in
442
+ [`src/hadley/providers/base.py`](src/hadley/providers/base.py), a `run` coroutine that returns
443
+ an `Outcome` (`done`, `limit` with a reset time, or `error`), and register it in
444
+ [`providers/__init__.py`](src/hadley/providers/__init__.py).
445
+
446
+ ## Roadmap
447
+
448
+ - [ ] Agents working in parallel, each in its own git worktree
449
+ - [ ] More providers: Anthropic API, OpenAI, Gemini; other CLIs such as Codex and Gemini CLI
450
+ - [ ] Web UI on top of the same state
451
+ - [ ] Budgets per run and per agent; approval gates for risky actions
452
+ - [ ] Moving a run to another machine (export / import)
453
+ - [ ] Optional database backends (e.g. Postgres)
454
+
455
+ ## License
456
+
457
+ [MIT](LICENSE)