@yail259/overnight 0.3.0 → 1.0.0
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 +71 -225
- package/bin/overnight.js +2 -0
- package/dist/cli.js +103919 -24513
- package/package.json +27 -6
- package/.context/notes.md +0 -0
- package/.context/todos.md +0 -0
- package/bun.lock +0 -63
- package/src/cli.ts +0 -821
- package/src/goal-runner.ts +0 -709
- package/src/notify.ts +0 -50
- package/src/planner.ts +0 -238
- package/src/report.ts +0 -115
- package/src/runner.ts +0 -663
- package/src/security.ts +0 -162
- package/src/types.ts +0 -129
- package/tsconfig.json +0 -15
package/README.md
CHANGED
|
@@ -1,274 +1,120 @@
|
|
|
1
1
|
# overnight
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**it learns how you think**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
overnight builds a profile of your coding style from Claude Code sessions, then uses it to predict what you'd type next — and executes it while you sleep. Each prediction sees what the last one did and adapts.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **Retry Logic** - Auto-retries 3x on API/network errors with exponential backoff.
|
|
9
|
-
- **Push Notifications** - `--notify` sends completion summary to ntfy.sh (free, no signup).
|
|
10
|
-
- **Markdown Reports** - `-r report.md` generates a summary with status and next steps.
|
|
11
|
-
- **Verification Loops** - Optionally runs a verification prompt after each task.
|
|
12
|
-
- **Security Sandboxing** - Path sandboxing, deny patterns for sensitive files, max turns limit, audit logging.
|
|
7
|
+
Not a batch queue. Not a task runner. A model of *you*.
|
|
13
8
|
|
|
14
|
-
##
|
|
9
|
+
## How it works
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# bun
|
|
21
|
-
bun install -g overnight
|
|
22
|
-
|
|
23
|
-
# npx (no install)
|
|
24
|
-
npx overnight run tasks.yaml
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Requires Claude Code CLI installed and authenticated.
|
|
28
|
-
|
|
29
|
-
## Quick Start
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# Create a tasks.yaml file
|
|
33
|
-
overnight init
|
|
34
|
-
|
|
35
|
-
# Edit with your tasks, then run
|
|
36
|
-
overnight run tasks.yaml
|
|
37
|
-
|
|
38
|
-
# Run with notifications and report
|
|
39
|
-
overnight run tasks.yaml --notify -r report.md
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Commands
|
|
43
|
-
|
|
44
|
-
| Command | Description |
|
|
45
|
-
|---------|-------------|
|
|
46
|
-
| `overnight run <file>` | Run jobs from YAML file |
|
|
47
|
-
| `overnight resume <file>` | Resume interrupted run from checkpoint |
|
|
48
|
-
| `overnight single "<prompt>"` | Run a single task directly |
|
|
49
|
-
| `overnight init` | Create example tasks.yaml |
|
|
50
|
-
|
|
51
|
-
## tasks.yaml Format
|
|
52
|
-
|
|
53
|
-
```yaml
|
|
54
|
-
defaults:
|
|
55
|
-
timeout_seconds: 300 # Per-task timeout (default: 300)
|
|
56
|
-
stall_timeout_seconds: 120 # No-activity timeout (default: 120)
|
|
57
|
-
verify: true # Run verification pass (default: true)
|
|
58
|
-
allowed_tools: # Whitelist tools (default: Read,Edit,Write,Glob,Grep)
|
|
59
|
-
- Read
|
|
60
|
-
- Edit
|
|
61
|
-
- Glob
|
|
62
|
-
- Grep
|
|
63
|
-
|
|
64
|
-
tasks:
|
|
65
|
-
# Simple format
|
|
66
|
-
- "Fix the bug in auth.py"
|
|
67
|
-
|
|
68
|
-
# Detailed format
|
|
69
|
-
- prompt: "Add input validation"
|
|
70
|
-
timeout_seconds: 600
|
|
71
|
-
verify: false
|
|
72
|
-
allowed_tools: [Read, Edit, Bash, Glob, Grep]
|
|
73
|
-
```
|
|
11
|
+
1. **You work normally** — overnight reads your `~/.claude/projects/` session files passively
|
|
12
|
+
2. **Before bed** — run `overnight` to launch the interactive TUI, which suggests plans from your recent activity
|
|
13
|
+
3. **While you sleep** — overnight predicts a message, executes via `claude -p`, observes the output, then predicts the next one
|
|
14
|
+
4. **Morning** — `overnight log` shows what happened. Review the branch, merge what you like
|
|
74
15
|
|
|
75
|
-
##
|
|
16
|
+
## The profile
|
|
76
17
|
|
|
77
|
-
|
|
18
|
+
This is what makes overnight different. It analyses your conversations and extracts:
|
|
78
19
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
| `-s, --state-file <file>` | Custom checkpoint file |
|
|
84
|
-
| `--notify` | Send push notification via ntfy.sh |
|
|
85
|
-
| `--notify-topic <topic>` | ntfy.sh topic (default: overnight) |
|
|
86
|
-
| `-q, --quiet` | Minimal output |
|
|
87
|
-
| `--sandbox <dir>` | Restrict file access to directory |
|
|
88
|
-
| `--max-turns <n>` | Max agent iterations (default: 100) |
|
|
89
|
-
| `--audit-log <file>` | Log all file operations |
|
|
90
|
-
| `--no-security` | Disable default deny patterns |
|
|
20
|
+
- **Communication style** — tone, message length, patterns (e.g. "terse, imperative, starts with verbs")
|
|
21
|
+
- **Coding patterns** — languages, frameworks, preferences, things you avoid
|
|
22
|
+
- **Values** — what you care about (e.g. "ship fast", "minimal abstractions")
|
|
23
|
+
- **Current focus** — what you've been working on recently
|
|
91
24
|
|
|
92
|
-
|
|
25
|
+
The predictor never sees raw conversations. It sees **WHO** (your profile), **WHERE** (your direction), and **WHAT** (your workspace). Three inputs, one output: the message you'd type next.
|
|
93
26
|
|
|
94
|
-
|
|
95
|
-
|--------|-------------|
|
|
96
|
-
| `-t, --timeout <secs>` | Timeout in seconds (default: 300) |
|
|
97
|
-
| `--verify/--no-verify` | Run verification pass (default: true) |
|
|
98
|
-
| `-T, --tools <tool...>` | Allowed tools (can specify multiple) |
|
|
99
|
-
| `--sandbox <dir>` | Restrict file access to directory |
|
|
100
|
-
| `--max-turns <n>` | Max agent iterations (default: 100) |
|
|
101
|
-
| `--no-security` | Disable default deny patterns |
|
|
27
|
+
## Adaptive prediction
|
|
102
28
|
|
|
103
|
-
## Example Workflows
|
|
104
|
-
|
|
105
|
-
### Development: Run overnight, check in morning
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
nohup overnight run tasks.yaml --notify -r report.md -o results.json > overnight.log 2>&1 &
|
|
109
29
|
```
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
overnight run tasks.yaml -q
|
|
30
|
+
predict message → execute via claude -p → observe output/diff/tests
|
|
31
|
+
↑ ↓
|
|
32
|
+
└───────── feed results back ───────────────┘
|
|
115
33
|
```
|
|
116
34
|
|
|
117
|
-
|
|
35
|
+
Each prediction sees what actually happened — build errors, test failures, code changes — and adapts. The model decides what's next based on real results, not a stale plan.
|
|
118
36
|
|
|
119
|
-
|
|
120
|
-
overnight single "Run tests and fix failures" -T Read -T Edit -T Bash -T Glob
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### Resume after crash/interrupt
|
|
37
|
+
## Install
|
|
124
38
|
|
|
125
39
|
```bash
|
|
126
|
-
|
|
40
|
+
npm install -g @yail259/overnight
|
|
127
41
|
```
|
|
128
42
|
|
|
129
|
-
##
|
|
130
|
-
|
|
131
|
-
overnight uses [ntfy.sh](https://ntfy.sh) for push notifications - free, no signup required.
|
|
43
|
+
## Commands
|
|
132
44
|
|
|
133
45
|
```bash
|
|
134
|
-
#
|
|
135
|
-
overnight
|
|
46
|
+
# Interactive mode — TUI with plan suggestions and streaming output
|
|
47
|
+
overnight
|
|
48
|
+
overnight --all # show suggestions across all projects
|
|
49
|
+
overnight --resume # resume the last interrupted run
|
|
136
50
|
|
|
137
|
-
#
|
|
138
|
-
overnight
|
|
139
|
-
|
|
51
|
+
# Headless — predict + execute with a specific intent
|
|
52
|
+
overnight start "finish the auth flow and add tests"
|
|
53
|
+
overnight start "refactor executor" --mode dont-stop --dry-run
|
|
140
54
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
3. Run with `--notify`
|
|
55
|
+
# Review results
|
|
56
|
+
overnight log # latest run
|
|
57
|
+
overnight log --all # all runs
|
|
145
58
|
|
|
146
|
-
|
|
59
|
+
# Session history — see recent Claude Code messages
|
|
60
|
+
overnight history
|
|
61
|
+
overnight history --limit 50 --cwd /path/to/project
|
|
147
62
|
|
|
148
|
-
|
|
63
|
+
# Profile — view/update your extracted coding profile
|
|
64
|
+
overnight profile
|
|
65
|
+
overnight profile --update
|
|
149
66
|
|
|
150
|
-
|
|
67
|
+
# Stop a running session
|
|
68
|
+
overnight stop
|
|
151
69
|
|
|
152
|
-
|
|
153
|
-
#
|
|
154
|
-
overnight
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
overnight resume tasks.yaml --state-file my-state.json
|
|
70
|
+
# Configuration
|
|
71
|
+
overnight config # show current config
|
|
72
|
+
overnight config --set apiKey=sk-... # set API key
|
|
73
|
+
overnight config --set model=claude-opus-4-6 # change prediction model
|
|
74
|
+
overnight config --set baseUrl=https://... # custom API endpoint
|
|
158
75
|
```
|
|
159
76
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
## Security
|
|
77
|
+
## Run modes
|
|
163
78
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
By default, only safe file operations are allowed (no Bash):
|
|
169
|
-
- `Read`, `Edit`, `Write`, `Glob`, `Grep`
|
|
170
|
-
|
|
171
|
-
### Deny Patterns (Enabled by Default)
|
|
172
|
-
|
|
173
|
-
Sensitive files are automatically blocked:
|
|
174
|
-
- `.env`, `.env.*` - Environment secrets
|
|
175
|
-
- `.git/config` - Git credentials
|
|
176
|
-
- `*.key`, `*.pem`, `*.p12` - Private keys
|
|
177
|
-
- `id_rsa*`, `id_ed25519*` - SSH keys
|
|
178
|
-
- `.ssh/*`, `.aws/*` - Cloud credentials
|
|
179
|
-
- `.npmrc`, `.netrc` - Auth tokens
|
|
180
|
-
|
|
181
|
-
### Path Sandboxing
|
|
182
|
-
|
|
183
|
-
Restrict agent to a specific directory:
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
overnight run tasks.yaml --sandbox ./src
|
|
187
|
-
```
|
|
79
|
+
| Mode | What it does |
|
|
80
|
+
|------|-------------|
|
|
81
|
+
| **Stick to plan** | One sprint. Accomplish the stated goals, then stop. |
|
|
82
|
+
| **Don't stop** | Continuous sprints. After primary goals, move to docs, tests, cleanup. Runs until the model says "nothing left" or you Ctrl+C. |
|
|
188
83
|
|
|
189
|
-
|
|
190
|
-
```yaml
|
|
191
|
-
defaults:
|
|
192
|
-
security:
|
|
193
|
-
sandbox_dir: "./src"
|
|
194
|
-
```
|
|
84
|
+
## Ambition levels
|
|
195
85
|
|
|
196
|
-
|
|
86
|
+
- **safe** — low-risk continuations: tests, docs, cleanup, finishing near-done work
|
|
87
|
+
- **normal** — natural next steps, pick up where you left off
|
|
88
|
+
- **yolo** — bold features, refactors, ambitious improvements
|
|
197
89
|
|
|
198
|
-
|
|
90
|
+
## Config
|
|
199
91
|
|
|
200
|
-
|
|
201
|
-
overnight run tasks.yaml --max-turns 50
|
|
202
|
-
```
|
|
92
|
+
Stored in `~/.overnight/config.json`. Runs stored in `~/.overnight/runs/`.
|
|
203
93
|
|
|
204
|
-
|
|
94
|
+
Works with Anthropic and any compatible API (GLM, Minimax, Kimi, etc.).
|
|
205
95
|
|
|
206
|
-
|
|
96
|
+
## Architecture
|
|
207
97
|
|
|
208
|
-
```bash
|
|
209
|
-
overnight run tasks.yaml --audit-log overnight-audit.log
|
|
210
98
|
```
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
deny_patterns:
|
|
221
|
-
- "**/.env*"
|
|
222
|
-
- "**/*.key"
|
|
223
|
-
- "**/secrets.*"
|
|
99
|
+
src/
|
|
100
|
+
cli.ts — CLI entry (start, stop, log, history, profile, config)
|
|
101
|
+
types.ts — Core types and constants
|
|
102
|
+
history.ts — Extract messages from Claude Code session JSONL files
|
|
103
|
+
predictor.ts — Profile + workspace + results → predicted messages (Anthropic API)
|
|
104
|
+
executor.ts — Adaptive execution loop, single branch per run
|
|
105
|
+
interactive.ts — Interactive TUI orchestration (Anthropic SDK streaming + React Ink)
|
|
106
|
+
profile.ts — User profile extraction from conversation history
|
|
107
|
+
ui/ — React Ink TUI components
|
|
224
108
|
```
|
|
225
109
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
To run without deny patterns (not recommended):
|
|
229
|
-
|
|
230
|
-
```bash
|
|
231
|
-
overnight run tasks.yaml --no-security
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
## Exit Codes
|
|
235
|
-
|
|
236
|
-
| Code | Meaning |
|
|
237
|
-
|------|---------|
|
|
238
|
-
| 0 | All tasks succeeded |
|
|
239
|
-
| 1 | One or more tasks failed |
|
|
240
|
-
|
|
241
|
-
## Files Created
|
|
242
|
-
|
|
243
|
-
| File | Description |
|
|
244
|
-
|------|-------------|
|
|
245
|
-
| `.overnight-state.json` | Checkpoint file (deleted on success) |
|
|
246
|
-
| `report.md` | Summary report (if `-r` used) |
|
|
247
|
-
| `results.json` | Full results (if `-o` used) |
|
|
248
|
-
|
|
249
|
-
## Job Statuses
|
|
250
|
-
|
|
251
|
-
| Status | Description |
|
|
252
|
-
|--------|-------------|
|
|
253
|
-
| `success` | Task completed successfully |
|
|
254
|
-
| `failed` | Task encountered an error |
|
|
255
|
-
| `timeout` | Task exceeded timeout |
|
|
256
|
-
| `stalled` | Task had no activity for too long |
|
|
257
|
-
| `verification_failed` | Verification found issues |
|
|
258
|
-
|
|
259
|
-
## Requirements
|
|
260
|
-
|
|
261
|
-
- Node.js 18+ or Bun
|
|
262
|
-
- Claude Code CLI installed and authenticated
|
|
263
|
-
- `@anthropic-ai/claude-agent-sdk` (installed automatically)
|
|
264
|
-
|
|
265
|
-
## Building from Source
|
|
110
|
+
## Building from source
|
|
266
111
|
|
|
267
112
|
```bash
|
|
268
113
|
git clone https://github.com/yail259/overnight.git
|
|
269
114
|
cd overnight
|
|
270
115
|
bun install
|
|
271
|
-
bun run
|
|
116
|
+
bun run build # Build to dist/
|
|
117
|
+
bun run compile # Create standalone binary
|
|
272
118
|
```
|
|
273
119
|
|
|
274
120
|
## License
|
package/bin/overnight.js
ADDED