# Overnight loop

> Overnight loop is an open-source agent skill for developer tools. Runs long unattended agent loops with a fixed invariant, trusted metrics and stop rules. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/junjslee/episteme/tree/master/skills/custom/overnight-loop
- **Repository:** https://github.com/junjslee/episteme
- **GitHub stars:** 18
- **License:** AGPL-3.0
- **Skill name:** overnight-loop
- **Collection:** https://github.com/junjslee/episteme
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill guides an agent through designing and running unattended or long-horizon loops, such as overnight hardening, draining a queue or sweeping a codebase repeatedly. Before the first pass it has the agent write an invariant file that holds the goal, a success metric, the per-iteration steps, stop conditions, allowed tools and the handoff location, so the loop re-reads its instructions each cycle instead of relying on the operator to re-paste them.

The workflow includes a pre-flight step: the metric command is dry-run on untouched code to confirm it returns a parseable number, which becomes the iteration-zero baseline, and the working tree is checked to be clean on a dedicated branch. During the loop the skill sets a noise floor so single noisy readings neither keep nor revert a change, separates a progress metric from a regression guard, and makes criterion and guard files read-only to the loop. When several discards occur in a row it escalates through a short ladder before stopping. It closes with a morning handoff using the progress-handoff skill.

It expects a shell-capable agent with a test or metric command available, and it is written around loop drivers such as the /loop command, ralph-loop and workflow scripts. Unattended changes are meant to land on a branch, with merging left to a person.

## When your agent uses it

> Design and run unattended or long-horizon loops (overnight hardening, drain queues, iterative sweeps) with a written invariant the harness re-reads every iteration — no manual re-pasting, trustworthy metrics, explicit stop conditions, and correct model routing. Replaces bounded-loop-runner. Use for "overnight", "unattended", "keep iterating until", "밤새 돌려", "루프 돌려", ralph-loop or /loop driven work.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/junjslee/episteme/tree/HEAD/skills/custom/overnight-loop)
- [License: AGPL-3.0](https://github.com/junjslee/episteme/tree/HEAD/skills/custom/overnight-loop)

## Features

- **Written loop invariant:** Creates a file capturing the goal, per-iteration steps, stop conditions and allowed actions that every iteration re-reads.
- **Pre-flight metric baseline:** Dry-runs the metric command on untouched state and records the result as the iteration-zero baseline before looping.
- **Noise-aware metric checks:** Uses a minimum delta or repeated runs so single noisy readings do not falsely keep or roll back changes.
- **Guard and progress separation:** Keeps a regression guard distinct from the improvement metric and treats success and guard files as read-only.
- **Stuck-loop escalation ladder:** Defines steps to take after consecutive discards before the loop halts, along with a coverage grid for sweeps.
- **Model routing for fan-out:** Specifies running parallel execution subagents on a named model rather than the session's design-tier model.

## Good for

- Run an overnight hardening pass that keeps iterating until tests pass
- Drain a queue of tasks unattended and log one line per item
- Repeat an iterative code sweep with a metric and stop conditions
- Set up a /loop or ralph-loop job that records results to a handoff file
- Write a morning status summary after an unattended run

## Install

### Claude Code

This skill ships in the `episteme` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add junjslee/episteme
/plugin install episteme@episteme
```

Or copy only this skill to `~/.claude/skills/overnight-loop`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/junjslee/episteme.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/overnight-loop &&
cp -R "$tmp/skills/custom/overnight-loop" ~/.claude/skills/overnight-loop &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/overnight-loop` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/overnight-loop` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/junjslee/episteme.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/overnight-loop &&
cp -R "$tmp/skills/custom/overnight-loop" ~/.agents/skills/overnight-loop &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/overnight-loop` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/overnight-loop` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/junjslee/episteme.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/overnight-loop &&
cp -R "$tmp/skills/custom/overnight-loop" ~/.cursor/skills/overnight-loop &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/overnight-loop` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/junjslee/episteme.git --path skills/custom/overnight-loop
```

Or copy the folder to `~/.gemini/skills/overnight-loop` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/overnight-loop`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/junjslee/episteme.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/overnight-loop &&
cp -R "$tmp/skills/custom/overnight-loop" ~/.copilot/skills/overnight-loop &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/overnight-loop` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/junjslee/episteme.git
```

Then copy `episteme/skills/custom/overnight-loop` into your agent's skills folder as `overnight-loop`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need before a loop starts?

It needs a metric command that exits cleanly and prints a parseable number, plus a clean working tree on a dedicated branch.

### Can an unattended loop merge its own changes?

No. The skill keeps unattended work on a branch and leaves merging as a human-gated step.

### Which loop drivers does Overnight loop cover?

It names the /loop command in dynamic or cron form, ralph-loop and Workflow scripts.

### What happens when the loop stops making progress?

After several consecutive discards it re-reads the invariant, combines kept changes, tries the opposite approach, and only then stops.

### Does Overnight loop include scripts?

No. The skill is a single SKILL.md file with no bundled scripts.

### How do I install Overnight loop in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/overnight-loop to use it in all your projects, or to .claude/skills/overnight-loop in one project. Or install the episteme plugin, which includes it: /plugin marketplace add junjslee/episteme, then /plugin install episteme@episteme.

### Does Overnight loop run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Overnight loop?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Overnight loop?

The closest alternatives to Overnight loop are Loop controller, Continuous agent loop, Autonomous loops, Autonomous loops and Loop engine.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Loop controller](https://ai-powered.com/skills/loop-controller): Loop controller is an open-source agent skill for developer tools.
- [Continuous agent loop](https://ai-powered.com/skills/continuous-agent-loop): Continuous agent loop is an open-source agent skill for developer tools.
- [Autonomous loops](https://ai-powered.com/skills/autonomous-loops): Autonomous loops is an open-source agent skill for developer tools.
- [Autonomous loops](https://ai-powered.com/skills/autonomous-loops-abdullayevtemurmalik): Autonomous loops is an open-source agent skill for developer tools.
- [Loop engine](https://ai-powered.com/skills/loop-engine): Loop engine is an open-source agent skill for developer tools.
- [Orchestrator task loop](https://ai-powered.com/skills/orchestrator-task-loop): Orchestrator task loop is an open-source agent skill for developer tools.
- [Start](https://ai-powered.com/skills/start-localixai): Start is an open-source agent skill for developer tools.
- [Long haul](https://ai-powered.com/skills/long-haul): Long haul is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/overnight-loop
