Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/kunchenguid/gnhf/agents-mdgit clone --depth 1 https://github.com/kunchenguid/gnhfWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.03302 | $0.03302 |
| Opus 5 | $0.01651 | $0.01651 |
| Sonnet 5 | $0.00660 | $0.00660 |
| Haiku 4.5 | $0.00330 | $0.00330 |
Grade A, and why
gnhf AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 76 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
This file provides guidance to agents when working with code in this repository.
Project
gnhf ("good night, have fun") is a CLI that runs a coding agent in a loop inside a git repo.
The supported-agent roster is owned by the README's Agents table.
Each successful iteration is a separate commit, normally on a dedicated gnhf/<slug> branch; --current-branch uses the existing branch instead, and --push publishes each successful iteration.
Failure and rollback semantics are owned by the README's How It Works section.
The acceptance policy for what gnhf should and should not become is owned by VISION.md; test feature or scope decisions against its aligns/resist criteria.
Target: Node 20+, published to npm as a bundled ESM CLI with optional agent-facing skills under skills/.
Commands
package.json scripts are the source of truth for build/test/lint commands; the "Developing" section in CONTRIBUTING.md documents them plus single-test invocation, the e2e prior-build requirement, and the CI matrix - keep all CI jobs green. pnpm test builds and then runs all tests. Releases are automated via release-please; never hand-edit CHANGELOG.md or .release-please-manifest.json.
Architecture
Entry point is src/cli.ts. It parses flags with commander, resolves config, handles stdin/worktree/resume setup, then hands off to the orchestrator. Everything else is plain modules under src/.
Run lifecycle (the critical flow)
cli.tsdecides one of four modes: new branch, resume an existinggnhf/<slug>branch,--current-branch, or--worktree(creates a sibling<repo>-gnhf-worktrees/<slug>/checkout). New branch and worktree runs probe numeric suffixes such asgnhf/<slug>-1and<repo>-gnhf-worktrees/<slug>-1/on collisions; current-branch runs first resume an exact same-prompt.gnhf/runs/<runId>/on a clean working tree, otherwise they probe.gnhf/runs/<runId>-1/metadata collisions without creating a branch; worktree mode also resumes preserved suffixed worktrees before creating a new one. When resuming with a different prompt, it asks whether to updateprompt.mdand continue the existing run history, start a new branch, or quit; if stdin is piped, that confirmation comes from the controlling terminal before any sleep-prevention re-exec.setupRun/resumeRuninsrc/core/run.tscreate.gnhf/runs/<runId>/withprompt.md,notes.md,output-schema.json,base-commit, optionalstop-when,commit-message, andgnhf.log, and add.gnhf/runs/to.git/info/excludeso run metadata stays local.Orchestrator(src/core/orchestrator.ts) is anEventEmitterloop. Each iteration: build prompt viasrc/templates/iteration-prompt.ts(injects currentnotes.md), add commit-repair instructions when a priorgit commitfailed, callagent.run(...), then on successcommitAll+ append tonotes.mdand optionallypushCurrentBranch; on failureresetHardunless a pending commit failure is preserving uncommitted work for repair. The user-visible failure/rollback contract lives in the README's "How It Works"; in code,commitAllthrowsCommitFailedError, logsgit:commit:failed, and records the commit output innotes.mdso the next iteration can repair the workspace, retryable thrown agent errors increment the backoff streak,RateLimitAgentErrorrolls back and waits until the provider-reported reset time (bounded escalating fallback when absent) before retrying the same iteration number without counting a failure, an iteration the provider billed to extra usage instead of rejecting (Claude'sisUsingOverage, reported out-of-band viaonOverageso a terminal path that throws still carries it) keeps its committed work and waits after the post-iteration checks but before any error backoff, failing closed when the reported reset time is unusable -providerResumeWaitis the single owner of what a reported reset time is worth, and both waits sharewaitForUsageWindowResetand the--max-rate-limit-waitbudget - andPermanentAgentErroraborts after rollback withlastAgentErrorset for the renderer. TheRunLimitsobject enforces--max-iterations(between iterations),--max-tokens(mid-iteration via AbortController),--max-rate-limit-wait(total usage-limit wait before aborting),--stop-when(post-iteration via the agent'sshould_fully_stopoutput, deferred while a commit failure awaits repair), and--pushpost-success publishing.Renderer(src/renderer.ts+src/renderer-diff.ts) is a cell-based TUI using the alt screen buffer.cli.tsenters/exits alt screen around it. The renderer subscribes to orchestrator events, diffs frames to minimize writes, and updates the terminal title live.MockOrchestrator(src/mock-orchestrator.ts) drives the renderer offline via--mockfor demos/testing.- Shutdown path:
SIGINTroutes throughorchestrator.handleInterrupt(). The first press requests a graceful stop, letting the current iteration finish or ending backoff early; the second press force-stops viaorchestrator.stop().SIGTERMforce-stops immediately.cli.tsonly keeps the done screen open for aborted runs; graceful stops exit once shutdown cleanup finishes. The README's How It Works section owns worktree preservation and cleanup behavior. That rule must hold on every exit path, not just the normal cleanup block: theprocess.on("exit")cleanup fallback re-checks orchestrator state before removing a worktree, and the force-exit timeout prints the preserved path before callingprocess.exit(). After cleanup,cli.tscollects final branch/diff stats viasrc/core/git.tsand writes the permanent stdout summary rendered bysrc/core/exit-summary.ts, including an uncommitted-work warning when a commit failure is still pending.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today Changed · +111 tokens per session 14a46765d262
- 3d ago First seen · 76 lines · 3,191 tokens per session scan A 188cd068aa3e
gnhf AGENTS.md is an instructions file published in the GitHub repository kunchenguid/gnhf (3,880 stars, last pushed yesterday), licensed MIT. It adds 3,302 tokens to every session, about $0.0165 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
next.js AGENTS.md
Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.