claude-overnight 0.1.2 → 0.3.1

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.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # claude-overnight
2
2
 
3
- Set a task budget, describe an objective, walk away. Come back to shipped work.
3
+ Fire off Claude agents, come back to shipped work.
4
4
 
5
- Tell it what to build. Set a budget — 10 tasks, 100, 1000, whatever the job needs. A planner agent analyzes your codebase and breaks the objective into that many independent tasks. Then they all run: parallel autonomous Claude Code agents, each in its own git worktree, each with full tooling (Read, Edit, Bash, grep, tests — everything). Rate limits hit? It waits. Windows reset? It resumes. It doesn't stop until every task is done or you tell it to.
5
+ Describe what to build. Set a budget — 10 agents, 100, 1000. A planner agent analyzes your codebase, breaks the objective into that many independent tasks, and launches them all. Each agent runs in its own git worktree with full tooling (Read, Edit, Bash, Grep — everything). Rate limits? It waits. Windows reset? It resumes. It doesn't stop until every task is done.
6
6
 
7
7
  ## Install
8
8
 
@@ -10,17 +10,17 @@ Tell it what to build. Set a budget — 10 tasks, 100, 1000, whatever the job ne
10
10
  npm install -g claude-overnight
11
11
  ```
12
12
 
13
- Requires Node.js >= 20 and a valid Claude authentication (OAuth via `claude` CLI login, or `ANTHROPIC_API_KEY` env var).
13
+ Requires Node.js >= 20 and Claude authentication (OAuth via `claude` CLI, or `ANTHROPIC_API_KEY`).
14
14
 
15
- ## Quick start
15
+ ## Usage
16
16
 
17
- ### Interactive (planner mode)
17
+ ### Interactive
18
18
 
19
19
  ```bash
20
20
  claude-overnight
21
21
  ```
22
22
 
23
- Describe your objective, set a task budget, pick a model. The planner generates the task breakdown you can review, edit, chat about it, then run.
23
+ Describe your objective, set a budget, pick a worker model, set a usage limit. The planner generates tasks — review, edit, or chat about them, then run.
24
24
 
25
25
  ### Task file
26
26
 
@@ -28,13 +28,53 @@ Describe your objective, set a task budget, pick a model. The planner generates
28
28
  claude-overnight tasks.json
29
29
  ```
30
30
 
31
- ### Inline tasks
31
+ ### Inline
32
32
 
33
33
  ```bash
34
34
  claude-overnight "fix auth bug in src/auth.ts" "add tests for user model"
35
35
  ```
36
36
 
37
- Each quoted argument becomes one parallel task.
37
+ ## How the planner works
38
+
39
+ The planner always runs on the best available model (Opus) regardless of which model you pick for workers. This ensures high-quality task decomposition even when workers use a cheaper model.
40
+
41
+ ### Model-aware task design
42
+
43
+ The planner calibrates task ambition based on your worker model:
44
+
45
+ **Opus workers**: Each session is a powerhouse — it can own entire epics, do deep codebase research, make architectural decisions, implement complex multi-file systems, and use browser tools for analysis. The planner gives these agents full ownership and autonomy.
46
+
47
+ **Sonnet workers**: Capable of substantial implementation, refactoring, and testing. The planner gives meaningful missions with room for decision-making.
48
+
49
+ **Haiku workers**: Fast and efficient, best for focused tasks. The planner gives specific, well-scoped instructions with clear file paths and expected changes.
50
+
51
+ ### Budget scaling
52
+
53
+ The budget also shapes task granularity:
54
+
55
+ **Small budget (1-15)**: Specific, file-level tasks. "In `src/auth.ts`, refactor `validateToken()` to use JWT."
56
+
57
+ **Medium budget (16-50)**: Autonomous missions. "Design and implement the complete favorites system: DB schema, API routes, client hooks, error handling."
58
+
59
+ **Large budget (50+)**: Full workstream decomposition. Architecture, features, testing, security, UX polish, performance — everything a team would cover. Each task is a substantial work session.
60
+
61
+ A budget of 200 is not 200 micro-edits. It's 200 senior-engineer work sessions running in parallel.
62
+
63
+ ## Usage limits
64
+
65
+ Control how much of your plan capacity the run consumes. In interactive mode, you'll be asked:
66
+
67
+ ```
68
+ Usage limit:
69
+ → Unlimited — use full capacity, wait through rate limits
70
+ 90% — leave 10% for other work
71
+ 75% — conservative, plenty of headroom
72
+ 50% — use half, keep the rest
73
+ ```
74
+
75
+ When utilization hits your cap, the swarm stops dispatching new tasks and lets active agents finish gracefully. This way you can run a big overnight job and still have capacity left for manual Claude usage.
76
+
77
+ Use `--usage-cap=90` on the command line, or `"usageCap": 90` in task files.
38
78
 
39
79
  ## Task file format
40
80
 
@@ -46,48 +86,76 @@ Each quoted argument becomes one parallel task.
46
86
  ],
47
87
  "model": "claude-sonnet-4-6",
48
88
  "concurrency": 4,
49
- "worktrees": true
89
+ "worktrees": true,
90
+ "usageCap": 90
91
+ }
92
+ ```
93
+
94
+ A plain array also works: `["task one", "task two"]`.
95
+
96
+ For multi-wave runs from a task file, add `objective` and `flexiblePlan`:
97
+
98
+ ```json
99
+ {
100
+ "objective": "Modernize the auth system and add comprehensive tests",
101
+ "flexiblePlan": true,
102
+ "tasks": ["Refactor auth middleware", "Add JWT validation"],
103
+ "usageCap": 90
50
104
  }
51
105
  ```
52
106
 
53
- A plain JSON array of strings also works: `["task one", "task two"]`.
107
+ The initial tasks run first. After each wave, a steering agent reads the codebase and plans the next wave until the objective is met or the budget runs out.
54
108
 
55
109
  | Field | Type | Default | Description |
56
110
  |---|---|---|---|
57
- | `tasks` | `(string \| {prompt, cwd?, model?})[]` | required | Tasks to run in parallel |
58
- | `model` | `string` | prompted | Model for all agents (per-task overridable) |
59
- | `concurrency` | `number` | `5` | Max agents running simultaneously |
111
+ | `tasks` | `(string \| {prompt, cwd?, model?})[]` | required | Tasks to run |
112
+ | `objective` | `string` | | High-level goal for multi-wave steering (required when `flexiblePlan` is true) |
113
+ | `flexiblePlan` | `boolean` | `false` | Enable adaptive multi-wave planning from task files |
114
+ | `model` | `string` | prompted | Worker model (per-task overridable) |
115
+ | `concurrency` | `number` | `5` | Max parallel agents |
60
116
  | `worktrees` | `boolean` | auto (git repo) | Isolate each agent in a git worktree |
61
117
  | `permissionMode` | `"auto" \| "bypassPermissions" \| "default"` | `"auto"` | How agents handle dangerous operations |
62
- | `cwd` | `string` | `process.cwd()` | Working directory for all agents |
63
- | `allowedTools` | `string[]` | all | Restrict which tools agents can use |
64
- | `mergeStrategy` | `"yolo" \| "branch"` | `"yolo"` | Merge into HEAD or into a new branch |
118
+ | `cwd` | `string` | `process.cwd()` | Working directory |
119
+ | `allowedTools` | `string[]` | all | Restrict agent tools |
120
+ | `mergeStrategy` | `"yolo" \| "branch"` | `"yolo"` | Merge into HEAD or a new branch |
121
+ | `usageCap` | `number (0-100)` | unlimited | Stop at N% utilization (e.g. 90) |
65
122
 
66
123
  ## CLI flags
67
124
 
68
125
  | Flag | Default | Description |
69
126
  |---|---|---|
70
- | `--budget=N` | `10` | How many tasks the planner generates — the total size of the run |
71
- | `--concurrency=N` | `5` | How many agents run at the same time (budget = total, concurrency = pace) |
72
- | `--model=NAME` | | Model override for all agents |
73
- | `--timeout=SECONDS` | `300` | Agent inactivity timeout (kills only silent agents) |
74
- | `--dry-run` | | Show planned tasks without executing them |
75
- | `-h, --help` | — | Show help |
76
- | `-v, --version` | — | Print version |
127
+ | `--budget=N` | `10` | Total agent sessions the planner targets |
128
+ | `--concurrency=N` | `5` | How many agents run simultaneously |
129
+ | `--model=NAME` | prompted | Worker model (planner always uses best available) |
130
+ | `--usage-cap=N` | unlimited | Stop at N% utilization |
131
+ | `--timeout=SECONDS` | `300` | Inactivity timeout (kills only silent agents) |
132
+ | `--no-flex` | — | Disable adaptive multi-wave planning (run all tasks in one shot) |
133
+ | `--dry-run` | — | Show planned tasks without running |
134
+ | `-h, --help` | — | Help |
135
+ | `-v, --version` | — | Version |
136
+
137
+ Budget = total work. Concurrency = pace. A budget of 100 with concurrency 5 means 100 tasks, 5 at a time.
77
138
 
78
139
  ## Rate limits and long runs
79
140
 
80
- claude-overnight is built to run unattended for hours, days, weeks, or months. It handles API rate limits without supervision:
141
+ Built for unattended runs lasting hours, days, or weeks.
81
142
 
82
- - **Hard block**: when the API rejects a request and returns a reset timestamp, the swarm pauses and resumes exactly when the window opens.
83
- - **Soft throttle**: at >75% utilization, dispatch slows proactively to avoid hitting the limit.
143
+ - **Usage bar**: the live UI shows current utilization with a visual bar, percentage, and countdown to reset when rate-limited.
144
+ - **Hard block**: API returns a reset timestamp swarm pauses and resumes exactly when the window opens.
145
+ - **Soft throttle**: at >75% utilization, dispatch slows to avoid hitting the limit.
84
146
  - **Retry with backoff**: transient errors (429, overloaded, connection reset) retry with exponential backoff.
147
+ - **Usage cap**: set a ceiling and the swarm stops dispatching when it's reached — active agents finish, no new ones start.
85
148
 
86
- No tasks are dropped. Set a budget of 1000, go to sleep, and it will work through every rate limit window until the run is complete.
149
+ No tasks are dropped. Set a budget of 1000 and go to sleep.
87
150
 
88
151
  ## Worktrees and merging
89
152
 
90
- Each agent runs in an isolated git worktree on a `swarm/task-N` branch. Changes are auto-committed when the agent finishes. After all agents complete, branches merge back sequentially. The default `"yolo"` strategy merges directly into your current branch; `"branch"` creates a new `swarm/run-{timestamp}` branch instead. Merge conflicts retry with `-X theirs`; if that still fails, the branch is preserved for manual resolution. Stale worktrees and orphaned `swarm/*` branches from previous runs are cleaned up automatically on startup.
153
+ Each agent gets an isolated git worktree on a `swarm/task-N` branch. Changes auto-commit when the agent finishes. After all agents complete, branches merge back sequentially.
154
+
155
+ - `"yolo"` (default): merges directly into your current branch
156
+ - `"branch"`: creates a `swarm/run-{timestamp}` branch (main untouched)
157
+
158
+ Merge conflicts retry with `-X theirs`. If that fails, the branch is preserved for manual resolution. Stale worktrees and `swarm/*` branches from previous runs are cleaned up on startup.
91
159
 
92
160
  ## Exit codes
93
161
 
@@ -95,4 +163,4 @@ Each agent runs in an isolated git worktree on a `swarm/task-N` branch. Changes
95
163
  |---|---|
96
164
  | `0` | All tasks succeeded |
97
165
  | `1` | Some tasks failed |
98
- | `2` | All tasks failed or no tasks completed |
166
+ | `2` | All failed or none completed |