gnhf (Good Night, Have Fun)
Tell your coding agent one objective before bed; it commits small changes all night and leaves you a clean branch with a full log.
- Source repo
- kunchenguid/gnhf
- Stars
- ★ 4.2k
- Last updated
- 17d ago
- License
- MIT
- Primary language
- TypeScript
- FA score
- 51/100 · Major gaps
At a glance
- How it runs
- Works with
- Universal · cross-platformCodex · Claude Code
- Cost
- Free software; you pay for model usage
- Setup effort
- Medium · a few setup steps
- You'll need
- Typical use
- Developers who want an agent to push a long objective — reducing complexity, adding tests — overnight and review a ready branch in the morning.
- Not a fit if
- Teams that want a human to approve every commit as it happens
- Users without a signed-in agent CLI account or sufficient usage quota
- Projects outside a Git repository or needing the working tree free
- Source review
- 51/100 · Major gaps
What does this agent do, and when should you use it?
gnhf is a command-line orchestrator that turns an existing coding agent CLI into a continuous overnight loop. On start it verifies a clean Git working tree, creates a gnhf/ branch (or stays put with --current-branch), writes the objective to prompt.md, then repeatedly builds an iteration prompt, invokes the agent non-interactively, and decides what to do with the result. Each successful iteration becomes its own unsigned git commit with a summary appended to notes.md; failed iterations are rolled back with git reset --hard, and three consecutive failures abort the run. Run metadata — prompt, notes, stop condition, end-state.json and a JSONL debug log — lives under the local, git-ignored .gnhf/runs/ directory so the branch only holds intentional work. It is built for unattended use, with iteration and token caps, sleep prevention, worktree parallelism, usage-limit waiting and a permanent exit summary.
Running gnhf "<prompt>" inside a Git repository checks that the working tree is clean, writes prompt.md and creates or reuses a gnhf/ branch. In every loop it assembles an iteration prompt from the objective, the accumulated notes.md context and a final output JSON schema, then runs the chosen agent non-interactively — claude, codex exec, Copilot in JSONL mode, pi in JSON mode, cursor-agent in --print stream-json mode, a locally started opencode serve or acli rovodev serve process, or an ACP target through the bundled acpx. On a structured success it makes one unsigned commit and appends a note; on failure it resets the tree, counts the failure, backs off exponentially for retryable errors, and aborts immediately on permanent errors such as exhausted credit while printing the run log path. When a Claude usage window is exhausted it reads the reset time from the rate-limit event, waits, and retries the same iteration, bounded by --max-rate-limit-wait. Runtime caps are --max-iterations, --max-tokens and --stop-when; the interactive TUI keeps the terminal title updated with elapsed time, token totals and commit count, and Ctrl+C requests a graceful stop before a second press force-stops. At exit it prints a permanent summary with branch, elapsed time, iteration and token totals, branch diff stats, notes and log paths and review commands, while a JSONL debug log is written to .gnhf/runs/<runId>/gnhf.log.
- Developers who want an agent to push a long objective — reducing complexity, adding tests — overnight and review a ready branch in the morning.
- Teams running several independent tasks in one repository at once using --worktree for isolated branches and directories.
- Loose projects where --current-branch --push keeps a deployed or locally watched branch updated during the run.
- Users with an existing Claude Code, Codex or Copilot subscription who want to put idle quota to work.
- Teams reaching non-native agents (Gemini, Grok, custom ACP servers) while keeping one unified log and rollback semantics.
- Cost-conscious users who want hard budgets (iterations, tokens, rate-limit wait) in place before letting go.
How do you install or deploy this agent?
Requires Node.js, Git and a signed-in coding agent CLI; run it inside a Git repository.
npm install -g gnhfFrom source:
git clone https://github.com/kunchenguid/gnhf.git
cd gnhf
corepack enable
pnpm install
pnpm run build
pnpm link --globalThe first run creates ~/.gnhf/config.yml with defaults (agent: claude); edit as needed:
agent: claude
maxConsecutiveFailures: 3
preventSleep: trueHow do you use this agent?
From a clean Git repository, hand it a single-sentence objective:
$ gnhf "reduce complexity of the codebase without changing functionality"Add an iteration and token budget for a shorter nap:
$ gnhf "reduce complexity of the codebase without changing functionality" \
--max-iterations 10 \
--max-tokens 5000000Run several tasks in parallel:
$ gnhf --worktree "implement feature X" &
$ gnhf --worktree "add tests for module Y" &Commit and push on the current branch after each successful iteration:
$ gnhf --current-branch --push "keep improving this app"Switch agent or model:
$ gnhf --agent codex --model gpt-5.4 "fix failing tests"
$ gnhf --agent 'acp:gemini' "polish the docs"Disable anonymous telemetry:
export GNHF_TELEMETRY=0What are this agent's strengths and limitations?
- One command covers the whole loop: clean-tree check, branch creation, iteration, commit or rollback, and exit summary — no custom scripting.
- Agent-agnostic: seven native coding agent CLIs plus any acp:<target> or custom ACP command via the bundled acpx runtime.
- Clear failure semantics: commit on success, reset on failure, abort after three consecutive failures, and preserve uncommitted work when a commit fails so the next iteration can repair it.
- Overnight-specific polish: automatic waiting for exhausted Claude usage windows, sleep prevention, and a TUI showing tokens and commit count.
- --worktree lets multiple agents work the same repository in parallel without interference, and worktrees with commits are kept for review.
- Local .gnhf/runs/ keeps prompt, notes, end-state.json and a JSONL debug log for post-mortems without polluting the branch.
- It ships no model of its own: you must install and sign in to an agent CLI, and pay whatever that subscription or API costs.
- Requires a clean Git working tree and refuses directories without Git; --current-branch cannot be combined with --worktree.
- Sends anonymous usage telemetry to the author's self-hosted analytics by default until GNHF_TELEMETRY=0 is set.
- Some capabilities are limited upstream: Copilot does not expose full input/cache tokens, and OpenCode and Rovo Dev restrict model overrides.
- On Linux under systemd-inhibit sleep prevention, a worktree without commits can be left behind and needs manual git worktree remove.
- Unattended operation means accepting agent-authored commits; you still need to review the branch diff before merging.
How does this agent compare with similar options?
The README positions gnhf as a ralph (ghuntley.com/ralph) and autoresearch-style orchestrator, i.e. the same family of continuous-iteration agent loops; it does not name specific competing tools, so no product-by-product comparison is offered.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| gnhf (Good Night, Have Fun) This agent | 51 · Major gaps | CLIFree + model costs | ★ 4.2k | 17d ago | TypeScript | Codex · Claude Code |
| Vicoa | 52 · Major gaps | Desktop appFree + model costs | ★ 516 | 10d ago | Python | Codex · Claude Code |
| Cezar — AI Coding Agent Orchestrator | 63 · Some gaps | CLIFree | ★ 743 | today | TypeScript | Codex · Claude Code |
| Maestro: Agent Orchestration Command Center | 43 · Major gaps | Desktop appFree + model costs | ★ 3.5k | today | TypeScript | Codex · Claude Code |
How does FollowAgents rate this agent?
Why each dimension lost points
README documents default gnhf/ branch isolation, rollback on failure, no force-push, and override of permission flags; however it passes non-interactive permission defaults to coding agents and --current-branch --push pushes directly without per-iteration confirmation. Sensitive data (credentials/API keys) is only addressed by blocking overrides, not a full data-flow description. Dependencies are limited to commander and js-yaml with lockfile, so dependency_security scores 2; other items are deducted for missing explicit least-privilege and confirmation design.
README gives detailed failure handling, consecutive-failure abort, rate-limit waits, and OpenCode empty-response rules, and CI runs lint/typecheck/test on three OSes, supporting self-consistency; known defects (e.g., worktree leak under systemd-inhibit) prevent full marks. Dependency availability is supported by npm publishing and engines constraint, scoring 2.
Supports multiple agents, ACP, worktree, current-branch, and stdin prompts with clear boundaries; however trigger precision relies on natural-language --stop-when and agent self-reported results without structured determination, so trigger_precision is 1.
README is well-structured with install, CLI reference, configuration, and limitations; MIT license is complete. Version appears only in package.json, CHANGELOG is release-please generated and not shown in evidence, and maintainer identity is unverified, so those items are deducted.
Output usability is good (exit summary, notes.md, debug logs, review commands) and marginal value for unattended overnight runs is clear; cost control relies on token caps and rate-limit waits without cost estimation or budget alerts, so cost_benefit is 1.
Many README claims are corroborated by code/CI configuration (golden config test, CI matrix), but most claims cannot be fully traced statically and fact/inference separation is not explicit, so each item scores 1.
- Non-interactive permission defaults are passed to coding agents, potentially broadening agent privileges; users should review agentArgsOverride and permission settings.
- --current-branch --push pushes after each successful iteration without per-iteration confirmation; assess accidental-push risk.
- Publisher identity is not verified by the FollowAgents registry; maintenance responsibility and update path are unclear.
- Trigger conditions rely on natural-language --stop-when and agent self-reported results, limiting precision.
- Known worktree leak under Linux systemd-inhibit requires manual cleanup.