Metadata-Version: 2.4
Name: nightlane
Version: 3.1.1
Summary: Checks what any coding agent did: a ticked unit counts only when git has its commit and its tests pass. Can also run Claude Code overnight.
Author: Ayberk Baytok
License-Expression: MIT
Project-URL: Homepage, https://github.com/Ayberkone/nightlane
Project-URL: Issues, https://github.com/Ayberkone/nightlane/issues
Project-URL: Changelog, https://github.com/Ayberkone/nightlane/blob/main/CHANGELOG.md
Keywords: claude-code,coding-agents,autonomous-agents,automation,tmux,cmux,herdr
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# nightlane

**nightlane checks what any agent did. Wake up to commits, not claims.**

For developers who let a coding agent (Claude Code, Codex, Gemini CLI, any other) work on their repo while they are away, and want to know afterwards what was really done.

You give the agent a plan as a Markdown checklist. Each item is a **unit** (`- [ ] U2 Add the --json flag`), and the agent **ticks** it when it says it is done (`- [x] U2 … done: <sha>`). Your agent says "done, all tests pass"; nightlane doesn't take its word for it: for every tick it looks for the commit in git and runs that unit's own test (its `verify:` line) itself. A tick that fails is rejected and goes back to the agent; the report separates what **git can prove** from what the agent only **claims**. Python 3.9+, no runtime dependencies.

Try it in a minute, on any branch whatever agent did the work:

```sh
pipx install nightlane
nightlane demo                                      # 10 s, no API key: a fake agent's night, one bad tick rejected
nightlane verify PLAN.md --run-verify --at-commit   # your plan: which ticks git proves; each verify: re-run at its own commit
```

The same check runs in CI as a [GitHub Action](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/github-action.md). Or let nightlane run the agent too: a **lane** is one Claude Code session working through one plan, unattended, in its own `git worktree` and branch, with every tick checked:

```sh
cd your-project
nightlane "fix the flaky login test" --for 8h
# go to sleep
nightlane report
```

A real morning report (nightlane working on itself, 1 Dec; trimmed):

```text
▶️ NIGHTLANE-wave6-realrepo.md — still running, cycle 5/25
  ⎇ branch nightlane/wave6-realrepo
  VERIFIED (git): 24 commits · 42 files +2682/-100 · units proven by git: U1, U2, U3 · 401k tokens
  spend: $5.91
  tests: no new failures
  ✓ U1 VERIFIED 4890b25 feat: U1 fix the public-safety failure: the CHANGELOG and… · +3/-3, 2 files
      rules: U1 rejected — verify-all: Verify-all has a new failure: test_release_u29.Changelog.test_public_safe
      rules: U1 passed — commit ok, tests ok, kept-tests ok, lint ok, secrets ok, deps ok, verify ok, verify-all ok
  ✓ U2 VERIFIED b9ef81f feat: U2 dependencies in every checkout nightlane makes… · +577/-33, 10 files
  ✓ U3 VERIFIED 8a7cce0 feat: U3 a tracked settings.local.json is never left… · +353/-7, 4 files
  → Next: U4 — plan quality on real repos
```

The agent ticked U1 with a CHANGELOG line that named a private repo; nightlane ran the suite itself, a test caught it, the tick was rejected, and the agent fixed it in the next cycle (4890b25). A tick only counts when its commit is real and the checks pass. Nothing is pushed.

![nightlane demo: three lanes of a fake agent work one night on a toy repo; nightlane rejected one tick whose test failed, the lane fixed it, and the morning shows 7 of 8 units VERIFIED by git, 2 lanes ready to land and 1 question for you](https://raw.githubusercontent.com/Ayberkone/nightlane/main/docs/assets/demo.gif)

## 1. Install

```sh
pipx install nightlane && pipx ensurepath   # then open a new terminal if `nightlane` isn't found
```

No pipx? `uvx --from nightlane nightlane --help` runs it without installing.

## 2. Watch a night of three lanes in about 10 s (no API key)

```sh
nightlane demo
```

A fake agent works three lanes at once on a toy repo, each in its own `git worktree` and branch: a bug fix, a small feature, and docs with tests. Every tick is a real commit, and nightlane checks each one itself. One agent ticks a rounding fix and says "fixed, all tests pass", but its test still fails: nightlane runs the unit's `verify:` command, rejects the tick live, and the next cycle commits the real fix. In the morning: one report across the lanes, and `nightlane status` listing every lane. From a real run (`nightlane demo --fast --no-open`, trimmed):

```text
fix-rounding  U2 rejected by nightlane — verify: U2's verify command fails at ea1bec7 (exit 1): FAILED (failures=1)

☀️ nightlane morning report · Dec 2 02:33 · 3 lanes, 1 needs you: NIGHTLANE-docs-tests.md · 7 of 8 units VERIFIED by git · 2 ready to land

❓ NIGHTLANE-docs-tests.md — waiting on the owner (1 question)
  ➜ needs you: U3: publish to PyPI as tinyshop or tinyshop-demo?
  VERIFIED (git): 2 commits · 2 files +15/-1 · units proven by git: U1, U2 · 14k tokens

✅ NIGHTLANE-fix-rounding.md — done, all 2 units closed
  ➜ ready to merge
  VERIFIED (git): 3 commits · 2 files +13/-2 · units proven by git: U1, U2 · 15k tokens
  ✓ U1 VERIFIED 9ad9471 test: U1 failing test for total() rounding · +9/-0, 1 file · git show 9ad9471
  ✓ U2 VERIFIED 37767c9 fix: U2 total() rounds to cents · +4/-1, 2 files · git show 37767c9
      rules: U2 rejected — verify: U2's verify command fails at ea1bec7 (exit 1): FAILED (failures=1) | commit ok, judge ok, tests ok, kept-tests ok, lint ok, secrets ok…
      rules: U2 passed — commit ok, judge ok, tests ok, kept-tests ok, lint ok, secrets ok, deps ok, verify ok, verify-all ok
  Land it: nightlane land fix-rounding

▶ nightlane status — every lane in one table
finished  3/3 proven               cycle 3/8    last    0 min ago  NIGHTLANE-add-discount.md  model reported DONE
finished  2/2 proven               cycle 3/8    last    0 min ago  NIGHTLANE-fix-rounding.md  model reported DONE
finished  2/3 proven               cycle 3/8    last    0 min ago  NIGHTLANE-docs-tests.md  needs you: U3: publish to PyPI as tinyshop or tinyshop-demo?
```

Git proves 7 of the 8 units. Two lanes are ready to land, and "Land it" is offered only for those. The third lane stopped on a question only you can answer instead of guessing. The demo uses its own temp state and never touches your lanes, config or notifier; it removes its temp folder on exit (`--keep` keeps it to look around, `--fast` skips the pauses, `--no-open` skips the dashboard, `--lanes 1` runs the older single-lane demo with a usage limit, about 14 s).

## 3. A real lane in 5 minutes

You need `git` and the [`claude`](https://code.claude.com/docs) CLI. In your project, one command:

```sh
nightlane "add a --json flag to export"     # also: nightlane '#42', an issue URL, nightlane -f task.md
```

It checks your setup and fixes what it can (hooks, permission rules; one `fixed:` line each), has `claude` plan the task into units (each with a `verify:` command that runs on your code today, the last one a review of the whole diff), shows the plan in about 10 lines and starts on Enter. The lane works in its own `git worktree` on branch `nightlane/<task>` (your checkout is not touched), in permission mode `auto`, never pushes, and stops when done or after 10 hours (`--for 8h` / `--until 07:00` to change). `--dry-run` shows the plan and the exact `run` it would do; `--yes` starts without asking (needed when there is no terminal). A vague task gets at most 3 questions, each with a default Enter accepts. In the morning: `nightlane report`. Step by step on a toy repo: [Your first night](https://github.com/Ayberkone/nightlane/blob/main/docs/guides/first-night.md).

### By hand

Want to write the goal file yourself? In your project:

```sh
nightlane init      # wires the hooks into .claude/settings.local.json (not committed; yours are kept, with a backup)
                    # and writes .claude/plans/active/NIGHTLANE-main.md + its PROGRESS file
```

Fill in the goal file, or let `nightlane plan "add a --json flag to export"` write one for you (also `--from-issue 42`). A goal file is plain Markdown:

```markdown
- [x] U1 Parse the config file. done: 3fb69ae
- [ ] U2 Add the --json flag after:U1
  - verify: `python3 -m unittest tests.test_cli`
- [ ] U3 Pick the default output format after:U2
  - BLOCKED(owner): JSON or YAML? — since 2026-11-28
```

A tick only counts as proven when its `done: <sha>` is a real commit. A `BLOCKED(owner)` unit waits for you; the lane does not keep restarting on it. Commit the goal file, check your setup, and start:

```sh
git add .claude/plans/active && git commit -m "goal"
nightlane doctor    # read-only check of everything a lane needs, with a fix for each problem
nightlane run .claude/plans/active/NIGHTLANE-main.md --worktree --for 8h --permission-mode auto
```

`run` opens a new tab in your terminal (herdr, tmux or cmux) and starts `claude` there; with no terminal it runs headless in the background. Without `--permission-mode` the lane stops at every permission prompt; `auto` is the one we recommend. A lane can't `git push` unless you pass `--allow-push`, and it won't start on `main`/`master` without `--worktree` (the lane gets its own branch `nightlane/<goal>` in a separate `git worktree`; `init` and `plan` add it to the command they print when you are on one) or `--allow-protected`. See [Safety](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/safety.md).

## 4. In the morning

```sh
nightlane report                                   # per lane: what git proves, what is only claimed, questions for you
nightlane accept .claude/plans/active/NIGHTLANE-main.md U3 --sha 1a2b3c4   # you checked a claimed unit: point it at its commit
nightlane reject .claude/plans/active/NIGHTLANE-main.md U3 --note "no test"  # it is not done: untick it for the next run
```

`accept` is refused when git does not have the commit. `reject` unticks the unit and writes why under it, so the next `nightlane run` does it again.

## Words

- **lane**: one agent working through one goal file on its own branch, until done, the deadline or the cycle cap.
- **goal file**: the Markdown plan a lane follows, a checklist of units (`.claude/plans/active/NIGHTLANE-<name>.md`).
- **unit**: one checklist item (`- [ ] U3 …`), small enough for one cycle. The agent **ticks** it (`- [x]`) with `done: <sha>` of its commit.
- **[P]**: on a unit, it may run in parallel with other `[P]` units (`after:U1` names what it waits for).
- **cycle**: one turn of the agent: fresh context, read goal + progress, do the next unit, commit, stop.
- **progress file**: the lane's notebook next to the goal file (`…-PROGRESS.md`): what each cycle did, what is next.
- **VERIFIED**: a tick git proves: its `done: <sha>` is a real commit and nightlane's checks passed.
- **CLAIMED**: what the agent says it did (ticks, progress lines) that git does not prove.
- **rules gate**: the checks nightlane runs on every tick itself; a failing tick is unticked, and blocked the second time.
- **Verify-all**: the goal file's whole-suite command; a tick counts only when it adds no new test failure.
- **supervisor**: a background loop with no model calls: resumes stalled lanes, waits out usage limits, sends the report.
- **manager**: optional, a tab you pick (`nightlane supervisor manager <tab>`) where finished lanes report.

The same list in your terminal: `nightlane help words`. A whole first night on a toy repo, start to land:
[Your first night](https://github.com/Ayberkone/nightlane/blob/main/docs/guides/first-night.md).

## Why not just a while-loop?

When nightlane runs the agent too, a lane survives the night: one unit per cycle with a fresh context, for as long as you allow, through usage limits, stalls, a sleeping laptop and a lane stuck in a loop. `while :; do cat PROMPT.md | claude -p; done` gets surprisingly far. These are the things that go wrong around 3 am:

| What breaks | What nightlane does |
|---|---|
| The agent says "done", but nothing landed | A tick counts only with a `done: <sha>` that git confirms. Unproven ticks are flagged in the report. |
| It loops on the same thing for hours | 3 cycles with no commit, no tick and the same **Next:** stop the lane. |
| The context fills up and quality drifts | Every cycle starts clean. The goal and PROGRESS files carry the state. |
| A usage limit hits mid-night | The lane waits for the reset, never past your deadline. |
| The tab goes quiet (crash, a dialog, a lost prompt) | A supervisor resumes the lane. It never types over your draft or into a busy tab. |
| The laptop sleeps | Sleep is not counted as a stall, and a live lane keeps the machine awake. |
| It runs away with the budget | A deadline, a cycle cap, and spend caps (`--max-tokens 2M`, `--max-cost 5`). |

More in [How it works](https://github.com/Ayberkone/nightlane/blob/main/docs/how-it-works.md).

## How it compares

| | What it is | Where nightlane differs |
|---|---|---|
| [Ralph loop](https://ghuntley.com/ralph/) | a bash loop that feeds the same prompt back until a completion phrase | The same core idea, plus fresh context per cycle, git-verified ticks, limit handling and a report. |
| [herdr](https://github.com/herdrdev/herdr), tmux, cmux | keep your agent sessions alive | nightlane runs inside them and makes a lane finish a goal and prove it. |
| [firstmate](https://github.com/kunchenguid/firstmate), [claude-squad](https://github.com/smtg-ai/claude-squad), [Conductor](https://conductor.build) | run a crew of agents in parallel worktrees | nightlane runs one bounded lane per goal, unattended, and audits it against git. |
| Claude Code [`/loop`, scheduled tasks](https://code.claude.com/docs/en/scheduled-tasks) | re-run a prompt on an interval, or on a schedule in the cloud | nightlane runs a goal file unit by unit on your machine and checks each tick against git. |
| Claude Code `/goal` | keeps Claude working until a goal is met; a model judges that from the transcript | nightlane's judge is not a model reading the transcript: it runs each unit's tests itself and reads git, and a tick that fails is rejected. |
| Claude Code agent view (`claude agents`) | runs sessions in the background, keeps them going and lists them by state (needs input, working, done) | nightlane adds the checking: each cycle's tick is judged by running its tests and reading git, and one report says what is proven. It can run its lanes on those sessions (`--backend claude-bg`, experimental). |

## Also works with

- **Any agent run, not only nightlane's:** `nightlane verify <goal.md>` checks every tick against git ([CLI](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/cli.md#verify)), also as a CI check with the [GitHub Action](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/github-action.md)
- **Claude Code plugin** with `/nightlane:start`, `:status`, `:report`, `:verify`: [Claude Code plugin](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/claude-plugin.md)
- **herdr, tmux, cmux, or no terminal (headless):** [Backends](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/backends.md) · in cmux every lane of a project on one screen: [Your tabs in cmux](https://github.com/Ayberkone/nightlane/blob/main/docs/guides/tabs.md) · [herdr plugin](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/herdr-plugin.md)
- **Codex CLI and Gemini CLI** lanes, and a fallback agent during a usage limit: [Backends](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/backends.md#codex-cli---agent-codex)
- **MCP clients** (Claude Code, Cursor, Codex, Gemini): [MCP server](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/mcp.md)
- **Your phone:** notifications by ntfy, Slack/Discord webhook, Telegram or desktop ([Notifications](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/configuration.md#notifications)); the dashboard, offline or `--serve`d ([Dashboard](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/dashboard.md))
- **A sandbox** for `bypassPermissions`: [Sandbox](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/sandbox.md)

## Docs

[Docs home](https://github.com/Ayberkone/nightlane/blob/main/docs/index.md) · [Your first night](https://github.com/Ayberkone/nightlane/blob/main/docs/guides/first-night.md) · [How it works](https://github.com/Ayberkone/nightlane/blob/main/docs/how-it-works.md) · [CLI](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/cli.md) · [Your tabs in cmux](https://github.com/Ayberkone/nightlane/blob/main/docs/guides/tabs.md) · [The inbox page](https://github.com/Ayberkone/nightlane/blob/main/docs/guides/inbox.md) · [Crash recovery](https://github.com/Ayberkone/nightlane/blob/main/docs/guides/recovery.md) · [Goal file](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/goal-file.md) · [Hooks](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/hooks.md) · [Configuration](https://github.com/Ayberkone/nightlane/blob/main/docs/reference/configuration.md) · [Contributing](https://github.com/Ayberkone/nightlane/blob/main/CONTRIBUTING.md) · [Changelog](https://github.com/Ayberkone/nightlane/blob/main/CHANGELOG.md) · [Security](https://github.com/Ayberkone/nightlane/blob/main/SECURITY.md)

macOS and Linux, Python 3.9+. MIT licensed.
