Skip to content

Commit 5cd92ed

Browse files
committed
Merge origin/main into main
2 parents 57035be + fcd92ec commit 5cd92ed

114 files changed

Lines changed: 2974 additions & 508 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
## Unreleased
4+
5+
### Breaking
6+
7+
`-c` now means `--continue` (as in Claude Code). Use `--auto-commit` for auto-commit.

‎README.md‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ autohand -p "add a dark mode toggle to the settings page"
144144
autohand -p "fix the TypeScript errors" -y
145145

146146
# Auto-commit changes after task completion
147-
autohand -p "refactor the auth module" -c
147+
autohand -p "refactor the auth module" --auto-commit
148148
```
149149

150150
## Editor Extensions
@@ -240,7 +240,9 @@ events and writes exactly one final `result` or `error` object to stdout.
240240
| `--output-format stream-json` | | Stream command lifecycle events as JSON Lines |
241241
| `--json <stream\|local>` | | Stream JSON Lines or write only the final JSON result (`--json` defaults to stream) |
242242
| `--yes` | `-y` | Auto-confirm risky actions |
243-
| `--auto-commit` | `-c` | Auto-commit changes after completing tasks |
243+
| `--continue` | `-c` | Resume the latest session in this folder (also with `-p`) |
244+
| `--resume [id]` | `-r` | Resume a saved session or open the folder picker |
245+
| `--auto-commit` | | Auto-commit changes after completing tasks |
244246
| `--dry-run` | | Preview actions without applying mutations |
245247
| `--debug` | `-d` | Enable debug output (verbose logging) |
246248
| `--model <model>` | | Override the configured LLM model |
@@ -347,8 +349,18 @@ Skills are discovered from:
347349

348350
See [Agent Skills Documentation](docs/agent-skills.md) for creating custom skills.
349351

352+
## Automatic commits
353+
354+
`--auto-commit` snapshots the repository before the agent starts editing. It commits only session changes and lists pre-existing edits and untracked files as `left uncommitted (yours)`. An initially dirty file stays uncommitted even if the agent edits it again. Your existing staging is preserved. Automatic commits are disabled if a safe baseline cannot be captured.
355+
356+
## Proxy settings
357+
358+
Node installs use `HTTPS_PROXY`, `HTTP_PROXY` and `NO_PROXY` for requests, including provider SDK calls. Lowercase variables take precedence; Bun binaries use Bun's native proxy support. Corporate certificate bundles can be supplied with `NODE_EXTRA_CA_CERTS`.
359+
350360
## Slash Commands
351361

362+
`/undo` restores every recorded agent file change from the last turn, newest first. It stops on the first unsafe restore and keeps the turn. Shell commands are not undone; restored sessions without a file journal are kept. `/export` redacts credentials and saves bare filenames under `~/.autohand/exports/` (or `$AUTOHAND_HOME/exports/`). Use an absolute or `./`-prefixed path to choose another location.
363+
352364
| Command | Description |
353365
| ------------------ | -------------------------------------------------------------------------------- |
354366
| `/help` | Display available commands |
@@ -358,7 +370,7 @@ See [Agent Skills Documentation](docs/agent-skills.md) for creating custom skill
358370
| `/model` | Switch LLM models |
359371
| `/new` | Start fresh conversation |
360372
| `/clear` | Compact context, retaining requests, learnings, changes and final answer |
361-
| `/undo` | Revert the last recorded agent file mutation and conversation turn |
373+
| `/undo` | Restore agent file changes from the last turn and remove it |
362374
| `/session` | Show current session details |
363375
| `/sessions` | List past sessions |
364376
| `/resume` | Resume a previous session |
@@ -379,7 +391,7 @@ See [Agent Skills Documentation](docs/agent-skills.md) for creating custom skill
379391
| `/formatters` | List code formatters |
380392
| `/lint` | List code linters |
381393
| `/completion` | Generate shell completion scripts |
382-
| `/export` | Export session to markdown/JSON/HTML |
394+
| `/export` | Export a redacted session to Markdown/JSON/HTML |
383395
| `/status` | Show workspace status |
384396
| `/usage` | Show token activity by day, week, or month |
385397
| `/login` | Authenticate with Autohand Code API |
@@ -614,7 +626,9 @@ autohand resume --path /path/to/project
614626
/resume
615627
```
616628

617-
The picker supports arrow keys, Enter, and page navigation for older sessions. Escape or Ctrl+C cancels without starting a session. `--last` uses the last activity time, falling back to creation time for older session metadata. Without a terminal, provide `--last` or an explicit reference. References cannot be combined with `--last` or `--all`; `-c` remains auto-commit.
629+
The picker supports arrow keys, Enter, and page navigation for older sessions. Escape or Ctrl+C cancels without starting a session. `--last` uses the last activity time, falling back to creation time for older session metadata. Without a terminal, provide `--last` or an explicit reference. References cannot be combined with `--last` or `--all`.
630+
631+
`autohand -c` continues the most recently active session in this folder. If none exists, it starts a new one. Use `autohand -c -p "Continue the fix"` for a headless continuation, or `autohand -r <id>` to select a session directly. `autohand -r` opens the folder picker. `--ephemeral` cannot be combined with `--continue`, `--resume`, or `--fork`.
618632

619633
## Entire Integration
620634

‎bun.lock‎

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/automode.md‎

Lines changed: 37 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,12 @@ autohand --auto-mode "Build a REST API for todos"
2323

2424
## How It Works
2525

26-
```
27-
┌─────────────────────────────────────────────────────────────┐
28-
│ AUTO-MODE LOOP │
29-
├─────────────────────────────────────────────────────────────┤
30-
│ │
31-
│ 1. User starts: autohand --auto-mode "Build REST API" │
32-
│ │ │
33-
│ 2. Create worktree ────┼──▶ autohand-automode-<timestamp> │
34-
│ │ │
35-
│ 3. Initialize state ───┼──▶ .autohand/automode.local.md │
36-
│ │ │
37-
│ ┌──────────────────────▼──────────────────────────┐ │
38-
│ │ ITERATION LOOP │ │
39-
│ │ ┌─────────────────────────────────────────┐ │ │
40-
│ │ │ 4. Feed prompt to LLM │ │ │
41-
│ │ │ 5. Execute actions (read/write/run) │ │ │
42-
│ │ │ 6. Agent tries to exit │ │ │
43-
│ │ │ 7. Stop hook intercepts │───┐│ │
44-
│ │ │ 8. Check completion conditions │ ││ │
45-
│ │ │ - Completion marker detected? │ ││ │
46-
│ │ │ - Max iterations reached? │ ││ │
47-
│ │ │ - Cancel signal received? │ ││ │
48-
│ │ │ 9. If not complete: feed prompt again │◀──┘│ │
49-
│ │ └─────────────────────────────────────────┘ │ │
50-
│ └─────────────────────────────────────────────────┘ │
51-
│ │ │
52-
│ 10. On completion ─────┼──▶ Merge worktree to main │
53-
│ │ │
54-
│ 11. Generate report ───┼──▶ AUTOMODE_CHANGELOG.md │
55-
│ │
56-
└─────────────────────────────────────────────────────────────┘
57-
```
26+
1. Creates an isolated Git worktree by default.
27+
2. Stores private state for this run outside the project.
28+
3. Repeats the task until it prints the completion marker, hits a configured limit, or stops making progress.
29+
4. Keeps the branch and worktree for review and prints merge and cleanup commands.
30+
5. Writes `AUTOMODE_CHANGELOG.md` inside the worktree.
31+
5832

5933
## CLI Usage
6034

@@ -71,7 +45,6 @@ autohand --auto-mode "<prompt>" [options]
7145
| `--no-worktree` | Disable git worktree isolation | - |
7246
| `--checkpoint-interval <n>` | Git commit every N iterations | 5 |
7347
| `--max-runtime <m>` | Maximum runtime in minutes | 120 |
74-
| `--max-cost <d>` | Maximum API cost in dollars | 10 |
7548
| `--interactive-on-complete` | Hand off directly to interactive mode when loop ends (TTY only) | Off |
7649
| `--dry-run` | Preview actions without executing | - |
7750

@@ -85,7 +58,6 @@ autohand --auto-mode "Build a CLI tool for file backup"
8558
autohand --auto-mode "Refactor auth system" \
8659
--max-iterations 30 \
8760
--max-runtime 60 \
88-
--max-cost 5 \
8961
--completion-promise "REFACTOR_COMPLETE"
9062

9163
# Without worktree (use current branch)
@@ -171,11 +143,12 @@ Multiple ways to stop an auto-mode loop:
171143

172144
### Resource Limits
173145

146+
CLI runs reject `--max-cost` and `automode.maxCost` because they cannot enforce a dollar spend limit. Use iteration and runtime limits instead.
147+
174148
| Limit | Default | Purpose |
175149
|-------|---------|---------|
176150
| Max Iterations | 50 | Prevents infinite loops |
177151
| Max Runtime | 120 min | Limits total time |
178-
| Max Cost | $10 | Caps API spending |
179152
| Checkpoint Interval | 5 | Creates git checkpoints |
180153

181154
### Git Worktree Isolation
@@ -184,38 +157,37 @@ By default, auto-mode creates an isolated git worktree to protect your main bran
184157

185158
```
186159
┌─────────────────────────────────────────────────────────────────┐
187-
│ WORKTREE LIFECYCLE │
160+
│ WORKTREE LIFECYCLE │
188161
├─────────────────────────────────────────────────────────────────┤
189-
│ │
190-
│ START │
191-
│ ├─ Create branch: autohand-automode-<timestamp> │
192-
│ ├─ Create worktree: /tmp/autohand-worktree-<hash> │
193-
│ └─ ALL file operations now happen in the worktree │
194-
│ │
195-
│ DURING LOOP │
196-
│ ├─ Agent reads/writes files in worktree │
197-
│ ├─ Every N iterations: checkpoint commit to automode branch │
198-
│ └─ Main branch remains untouched │
199-
│ │
200-
│ ON SUCCESS │
201-
│ ├─ git checkout <original-branch> │
202-
│ ├─ git merge autohand-automode-xxx │
203-
│ ├─ git worktree remove /tmp/autohand-worktree-xxx │
204-
│ └─ git branch -d autohand-automode-xxx │
205-
│ │
206-
│ ON CANCEL/ERROR │
207-
│ └─ Worktree PRESERVED for manual inspection │
208-
│ You can: cd /tmp/autohand-worktree-xxx │
209-
│ git log, git diff, cherry-pick, etc. │
210-
│ │
162+
│ │
163+
│ START │
164+
│ ├─ Create branch: autohand-automode-<timestamp>-<id> │
165+
│ ├─ Create worktree: <temp dir>/autohand-worktree-<hash> │
166+
│ └─ ALL file operations now happen in the worktree │
167+
│ │
168+
│ DURING LOOP │
169+
│ ├─ Agent reads/writes files in worktree │
170+
│ ├─ Every N iterations: checkpoint commit to automode branch │
171+
│ └─ Main branch remains untouched │
172+
│ │
173+
│ ON SUCCESS │
174+
│ ├─ Commit a final checkpoint in the isolated branch │
175+
│ ├─ Print branch, worktree, review and recovery commands │
176+
│ └─ Preserve the branch and worktree for manual review │
177+
│ │
178+
│ ON CANCEL, LIMIT OR ERROR │
179+
│ └─ Worktree PRESERVED for manual inspection │
180+
│ You can: cd <worktree path from the summary> │
181+
│ git log, git diff, cherry-pick, etc. │
182+
│ │
211183
└─────────────────────────────────────────────────────────────────┘
212184
```
213185

214186
**Key Points:**
215187
- **One worktree per session** (not per iteration)
216188
- **All agent operations** (file reads, writes, commands) happen in the worktree
217189
- **Checkpoints** create commits in the automode branch at regular intervals
218-
- **Merge happens once** at the end on successful completion
190+
- **Merge is manual**: completed runs keep their branch and worktree for review. The summary prints the merge and safe cleanup commands.
219191
- **Preserved on failure** so you can inspect, recover, or cherry-pick changes
220192

221193
**Benefits:**
@@ -237,16 +209,16 @@ This prevents getting stuck in unproductive loops.
237209

238210
## State File
239211

240-
Auto-mode maintains state in `.autohand/automode.local.md`:
212+
Each run stores its state in `$AUTOHAND_HOME/automode/<workspace-id>/<run-id>/automode.local.md` (`~/.autohand` is the default home). State stays outside the project and is private to the current user. Legacy `.autohand/automode.local.md` files are ignored and do not activate a later interactive session:
241213

242214
```markdown
243215
# Auto-Mode State
244216

245217
## Session
246218
- **Started:** 2026-01-06T14:30:00Z
247219
- **Prompt:** Build a REST API for todos with CRUD operations
248-
- **Branch:** autohand-automode-1736175000
249-
- **Worktree:** /tmp/autohand-worktree-abc123
220+
- **Branch:** autohand-automode-1736175000-a1b2c3d4
221+
- **Worktree:** <temp dir>/autohand-worktree-abc123
250222

251223
## Progress
252224
- **Current Iteration:** 12
@@ -275,7 +247,7 @@ After each session, auto-mode generates `AUTOMODE_CHANGELOG.md`:
275247
- **Task:** Build a REST API for todos
276248
- **Duration:** 45 minutes (12 iterations)
277249
- **Result:** Completed successfully
278-
- **Branch:** autohand-automode-1736175000 → merged to main
250+
- **Branch:** autohand-automode-1736175000-a1b2c3d4 → awaiting review
279251

280252
## Iterations
281253
### Iteration 1 (14:30:00)
@@ -327,7 +299,6 @@ Add defaults to `~/.autohand/config.json`:
327299
"automode": {
328300
"maxIterations": 50,
329301
"maxRuntime": 120,
330-
"maxCost": 10,
331302
"checkpointInterval": 5,
332303
"completionPromise": "DONE",
333304
"useWorktree": true,
@@ -366,15 +337,15 @@ Add defaults to `~/.autohand/config.json`:
366337
### High cost
367338

368339
- Lower `--max-iterations`
369-
- Set a stricter `--max-cost`
340+
- Set a shorter `--max-runtime`
370341
- Use a more efficient model
371342
- Break task into smaller chunks
372343

373344
### Loop appears stuck
374345

375346
- The circuit breaker should auto-trigger
376347
- Press ESC to cancel manually
377-
- Check `.autohand/automode.local.md` for state
348+
- Check the run's private state under `AUTOHAND_HOME/automode/` (default: `~/.autohand/automode/`)
378349

379350
## Related
380351

0 commit comments

Comments
 (0)