Skip to content

JudyaiLab/ai-night-shift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐ŸŒ™ AI Night Shift

A multi-agent autonomous framework that lets your AI assistants work while you sleep.

License: MIT ็น้ซ”ไธญๆ–‡ ็ฎ€ไฝ“ไธญๆ–‡ ํ•œ๊ตญ์–ด

AI Night Shift is an open-source framework for running multiple AI agents (Claude Code, Gemini, and more) in coordinated autonomous sessions during off-hours. Born from 30+ real production night shifts, this isn't theoretical โ€” it's battle-tested.

What Makes This Different

Most "autonomous agent" tools run a single agent in isolation. AI Night Shift orchestrates multiple heterogeneous AI agents working together:

Agent Engine Role Mode
Developer Claude Code Coding, debugging, deploying Continuous (hours)
Researcher Gemini CLI Research, data gathering, triage Periodic (minutes)
Coordinator Any LLM Task routing, monitoring Heartbeat (30min)

They communicate through shared protocols โ€” a file-based message queue, shared chat log, and task board integration.

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              AI Night Shift                  โ”‚
โ”‚                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  Claude   โ”‚  โ”‚  Gemini  โ”‚  โ”‚Heartbeat โ”‚  โ”‚
โ”‚  โ”‚  Code     โ”‚  โ”‚  CLI     โ”‚  โ”‚  Agent   โ”‚  โ”‚
โ”‚  โ”‚          โ”‚  โ”‚          โ”‚  โ”‚          โ”‚  โ”‚
โ”‚  โ”‚ night_   โ”‚  โ”‚ patrol.  โ”‚  โ”‚ heartbeatโ”‚  โ”‚
โ”‚  โ”‚ shift.sh โ”‚  โ”‚ sh       โ”‚  โ”‚ _config  โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚       โ”‚              โ”‚              โ”‚        โ”‚
โ”‚       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”‚
โ”‚              โ”‚              โ”‚                โ”‚
โ”‚       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”          โ”‚
โ”‚       โ”‚ night_chat  โ”‚ โ”‚ bot_inboxโ”‚          โ”‚
โ”‚       โ”‚    .md      โ”‚ โ”‚  (JSON)  โ”‚          โ”‚
โ”‚       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ”‚
โ”‚                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ Plugins  โ”‚  โ”‚Dashboard โ”‚  โ”‚Templates โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Quick Start

1. Install

git clone https://github.com/judyailab/ai-night-shift.git
cd ai-night-shift
bash install.sh

2. Configure

# Copy the example config and edit your settings
cp config.env.example config.env
nano config.env

# Customize the night shift prompt
nano claude-code/prompt_template.txt

3. Test

# Run a single round to verify setup
bash claude-code/night_shift.sh --max-rounds 1

4. Schedule

# The installer adds cron jobs automatically, or set up manually:
crontab -e
# Add: 0 1 * * * cd ~/ai-night-shift && bash claude-code/wrapper.sh

Modules

Module Description Docs
Claude Code Continuous developer sessions README
Gemini Periodic patrol and research README
OpenClaw Heartbeat coordinator pattern README
Protocols Inter-agent communication README
Plugins Extensible pre/post/task hooks README
Dashboard Visual monitoring interface Open dashboard/index.html
Templates Prompt templates by use case 4 templates included

Prompt Templates

Template Use Case
development.txt Coding, testing, debugging
research.txt Data gathering, analysis
content.txt Writing, translation, SEO
maintenance.txt System admin, monitoring

Plugin System

Extend your night shift with pre-built or custom plugins:

# Enable a plugin
ln -s plugins/examples/system_health.sh plugins/enabled/

# List all plugins
bash plugins/plugin_loader.sh --list

Built-in plugins: System Health, Backup, Git Commit Summary, Morning Report, De-Sloppify

Dashboard

Open dashboard/index.html in a browser. Drag and drop your report files to visualize:

  • Agent activity and status
  • Round-by-round timeline
  • Night chat messages
  • System health metrics

Agent Adapters

The night shift runner is agent-agnostic. Switch agents with one config change:

# In config.env
AGENT_ADAPTER=claude-code   # default
# AGENT_ADAPTER=codex-cli   # OpenAI Codex CLI
# AGENT_ADAPTER=aider       # Aider
# AGENT_ADAPTER=custom      # Your own (copy adapters/custom.sh)

Or via CLI flag:

bash claude-code/night_shift.sh --adapter codex-cli

Create your own adapter: copy adapters/custom.sh, implement 5 functions, done. See adapters/ for details.

Prompt Design for Autonomy

The most common pitfall: your agent stops mid-task and waits for confirmation that never comes.

All included templates have an Autonomy Rules block that prevents this:

  • Never ask for confirmation โ€” decide and execute
  • Never wait for user input โ€” choose the safest option and proceed
  • Never use interactive commands
  • If stuck 3 times, log and move on

See docs/advanced.md for the full prompt design guide.

Advanced Features

  • Completion Signal โ€” agents can say "I'm done" to end the shift early
  • Shared Task Notes โ€” cross-round context memory bridge
  • De-Sloppify Pattern โ€” separate cleanup pass for code quality
  • Anti-Pattern Guide โ€” avoid common autonomous loop pitfalls

Requirements

  • Bash 4+ and Python 3.6+
  • At least one AI CLI tool:
  • A Linux/macOS system with cron and timeout (GNU coreutils; macOS: brew install coreutils)

Safety & Security

  • PID locking prevents concurrent runs
  • Time windows ensure shifts end on schedule
  • Rate limit handling with automatic retry
  • No secrets in code โ€” all credentials via environment variables
  • Append-only communication โ€” agents can't delete each other's messages
  • Plugin timeout โ€” max 5 minutes per plugin execution

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT โ€” Judy AI Lab


Built with real-world experience from 30+ autonomous night shifts. If your AI works harder while you sleep, you're doing it right. ๐ŸŒ™

About

Multi-agent autonomous framework โ€” let your AI work while you sleep ๐ŸŒ™

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors