Autonomous overnight dev agent for Claude Code. Drains a priority work queue while you sleep, writes a morning report, leaves everything in PRs.
Night Agent is a thin orchestrator that runs Claude Code autonomously in a tmux session. It works through a priority queue — Sentry errors first, then declined PRs, in-progress features, and finally planned features — producing a morning report you can review when you wake up.
It is project-agnostic: all project-specific values (repo, Sentry project,
preview server, etc.) live in a single config.json.
~/bin/
night-agent ← the command you type
~/.night-agent/
config.json ← your values (do not commit)
config.example.json ← template to copy
prompt.md ← orchestrator brain
session-state.json ← reset each night automatically
morning-report.md ← read this when you wake up
session.log ← raw output for debugging
scripts/
restart-preview.sh ← branch preview server
- Claude Code installed and authenticated
- GitHub CLI:
gh auth login - Sentry MCP configured in Claude Code
- tmux:
brew install tmuxorapt install tmux - jq:
brew install jqorapt install jq
# 1. Clone
git clone https://github.com/derseitenschneider/night-agent.git
cd night-agent
# 2. Copy files into place
cp bin/night-agent ~/bin/night-agent
chmod +x ~/bin/night-agent
mkdir -p ~/.night-agent/scripts
cp prompt.md ~/.night-agent/
cp config.example.json ~/.night-agent/
cp session-state.json ~/.night-agent/
cp morning-report.md ~/.night-agent/
cp scripts/restart-preview.sh ~/.night-agent/scripts/
chmod +x ~/.night-agent/scripts/restart-preview.sh
# 3. Configure
cp ~/.night-agent/config.example.json ~/.night-agent/config.json
# Edit config.json with your actual values
# 4. Make sure ~/bin is in your PATH
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcEdit ~/.night-agent/config.json:
| Key | What to fill in |
|---|---|
github.repo |
e.g. your-org/your-repo |
sentry.org |
your Sentry org slug |
sentry.project |
your Sentry project slug |
preview.dir |
where to check out branch previews |
preview.tailscale_hostname |
from tailscale status |
agent.wakeup_time |
when you want it to stop picking up new work |
Edit ~/.night-agent/scripts/restart-preview.sh and uncomment the
block that matches your stack (PHP, Node, WordPress, etc.).
Preview will be accessible from any Tailscale device at:
http://{tailscale_hostname}:8081
night-agent # start it, go to sleep
tmux attach -t night-agent-YYYYMMDD # check on it
cat ~/.night-agent/morning-report.md # read report on wakeupMake sure these labels exist in your repo (create them in GitHub if not):
planned— features ready to be builtin-progress— features currently being worked onpriority— used alongside planned to signal next pick
The agent works through this order each night:
- Sentry errors → always a PR, parks if migration needed
- Declined PRs → acts on specific comments, parks ambiguous ones
- In-progress issues → drains task checklists, PR when all done
- Planned issues → picks one, writes tests, builds, opens PR