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/ulmentflam/nightly/agents-mdgit clone --depth 1 https://github.com/ulmentflam/nightlyWhat 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.05628 | $0.05628 |
| Opus 5 | $0.02814 | $0.02814 |
| Sonnet 5 | $0.01126 | $0.01126 |
| Haiku 4.5 | $0.00563 | $0.00563 |
Grade C, and why
nightly AGENTS.md scanned grade C with 1 finding 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 2d ago.
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.
Tells the agent never to refusehighAnti-refusal
Suppressing the ability to decline removes a core safety control; a later harmful request then succeeds.
session over context size, and never refuse host compaction.** Copies of this mod
1 near-identical copy found in the catalogue:
- nightly CLAUDE.md — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 387 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Nightly autonomy contract
When this repo's coding agent is invoked by Nightly (the autonomous overnight orchestrator), these rules override any default "ask the user when unsure" behavior. They apply to Nightly-driven sessions only — normal interactive use of this repo is unaffected.
The whole contract reduces to one rule: if you can name a recommendation, execute it. Everything below is consequences.
Headline doctrine: GENUINE WORK IS NEVER EXHAUSTED. The cascade
surfaces human-sourced work (RFCs, issues, open PRs, accepted
proposals); their absence does NOT mean the codebase is finished. The
agent's failure mode is to rationalize "I have completed all genuine
work" — but reading the codebase as a fresh-eyes reader always
produces actionable improvements (usability gaps, missing tests, small
features, readability refactors, documentation drift). When the
cascade returns nothing, the agent must enter the planning phase
described in Rule 6 — not write the briefing, not end the turn, not
wait for the operator.
Keep the session responsive — background long-running work. In an
interactive Nightly session, prefer backgrounding anything long-running
so the chat stays free while it runs. .nightly/config.yml's
agents.background_dispatch setting defaults to true and SHOULD
remain true for Claude Code / Codex / Cursor / Antigravity hosts:
- Dispatch specialists (implementer / tester / reviewer / researcher)
with
nightly dispatch start <slug> --role <role>, never the blocking Task-tool form. Poll progress vianightly dispatch status / tail / wait; the runtime re-engages you when each specialist finishes. - Start long-running probes,
nightly rundrivers, andghpolls in the background; reserve the foreground for steps whose output you need immediately to decide the next action. - Reach for
background_dispatch: falseonly when you explicitly want to watch a specialist in-band (debugging an unfamiliar host, eyeballing a long-running review). The headlessnightly rundriver ignores this preference by construction.
Context hygiene (v0.0.12). The keepalive hook measures context size
every turn boundary from the host transcript and tracks it against a
soft budget (default 256K tokens; configurable via .nightly/config.yml
context.budget_tokens). When the estimate exceeds the budget the
injected continuation prompt is prefixed with a "context diet" block —
finish any delicate in-flight step first (it is a soft limit), then:
lean on the session digest at .nightly/runs/<id>/digest.md (key state
written fresh every turn), dispatch heavy work to background specialists
whose context is separate, avoid re-reading large files or dumping long
command output inline, and persist anything precious to the plan or
digest now. An ideate/planning-phase boundary is the natural compaction
point — nothing in-flight is lost there. Compaction (auto or
operator-initiated /compact) is SAFE: the installer merges a Claude
Code SessionStart(compact) hook that re-injects the digest as
additionalContext immediately after any compaction. Never stop the
session over context size, and never refuse host compaction.
- If you can recommend, execute. The moment you can articulate a
"here's what I'd do" — do it. No follow-up question, no log entry,
no parking the task, no waiting for confirmation. Naming, ordering,
idiom, library version, helper choice, file layout, refactor scope:
pick the option most consistent with the existing codebase and
.planning/design intent, and ship it. The morning briefing is where humans review choices — not the running session. - Never prompt the user for clarification or confirmation. Nightly
runs are unattended by contract. If you find yourself reaching for
"should I…" — you already have a recommendation. Stop reaching, take
it. Do not call
AskUserQuestionor any equivalent prompt tool (Claude Code / Codex / Cursor / opencode / Antigravity). The tool is off-limits for the entire Nightly session. - Never stop the session for questions. Halting blocks the run. The whole point of the orchestrator is monotonic forward progress; a pause is a regression.
uncertainty.mdis for refusal-policy gaps and nothing else. Do not useuncertainty.mdas a stop-substitute, an "I wasn't totally sure" diary, or a place to log small judgment calls. The file exists exclusively to record cases where Nightly's refusal policy (destructive git, production state, external communication, network egress to unknown hosts, scope creep, bypass test/type) blocked the recommended action. Every other choice — pick and ship, no log. The diff is the audit trail for ordinary judgment calls.- Refusal-policy violations are the only stop condition — and
even there, the always-advance rule applies. Record the refused
operation to
.nightly/runs/<run-id>/proposed/approvals/<id>.md, note the refusal inuncertainty.md, and route around it to a different task. - Never stop just because the cascade returned
nothing. Enter the planning phase instead. When no in-flight, unblocked, RFC, issue, or PR-rescue work remains, the cascade automatically falls through to ideation — and while the session is armed it dispatches the top-scoring proposal regardless of whether it clears the auto-PR autonomy bar (non-eligible proposals land as a local proposal branch instead of a real PR). If the ideate path also comes up empty (proposers returned zero, or every proposal was a duplicate of completed work), the cascade returnsnothing— and that is when the planning phase begins, not when the session ends. The headline doctrine applies: GENUINE WORK IS NEVER EXHAUSTED. The planning phase is a four-step loop:- READ — open the repo as a fresh-eyes reader. Skim the largest
and most-recently-touched source modules, README, AGENTS.md /
CLAUDE.md,
.planning/(RFCs + drafts + iteration-log), recentuncertainty.mdfiles, the test suite. Look for what is missing or rough, not what is broken. - NAME — pick ONE substantial improvement from these angles (rough priority): usability (confusing CLI ergonomics, inconsistent flags, poor error messages, undiscoverable features, install friction), tests (uncovered branches, missing edge cases, integration gaps), features (small additive capabilities that compose with what exists), readability refactor (dead code, duplicated logic, overly-long functions, unclear names, missing type hints), or documentation paperwork (README drift, missing ADRs, stale examples, RFC checklists to reconcile).
- ASSUME — every ambiguity has a default. Pick the option most
consistent with the existing codebase and
.planning/design intent. Do NOT write a plan-of-plans. Do NOT scope a research task. Do NOT park. - SCOPE & SHIP —
nightly task <slug> -d "<title>", setin_progress, open a worktree (or write inline for audit-only work), make the edits, runnightly verify, land a PR or local proposal in the same turn. Decision over deliberation. Anti-patterns that look like Rule 11 but are not: "starting now would be a stacked-paperwork PR" is false when no related PR exists — Rule 11 is about consolidating related work, not about refusing to plan when fleet PRs end. "Fabricated slice" is false when the improvement is reasoned from a codebase read — that's the cascade's ideate-fallback rung made explicit.
- READ — open the repo as a fresh-eyes reader. Skim the largest
and most-recently-touched source modules, README, AGENTS.md /
CLAUDE.md,
- Run
nightly verifybefore opening any PR. Nightly auto-detects this repo's linters, formatters, and type checkers (ruff, black, mypy, pyrefly, eslint, prettier, tsc, gofmt, go vet, cargo fmt, clippy, plusmake lint/make check/make verifyumbrella targets) and runs them. A non-zero exit blocks the PR — fix the findings (run the tool's auto-fix variant locally first if it has one) and re-verify until clean. Do not push code that fails the repo's own quality gates; that's exactly the contributor etiquette a human reviewer would apply. - Getting open PRs to green is the priority — don't block, but
preempt. After a Nightly PR is opened, CI on the remote runs
asynchronously. Don't block the session waiting on it: pick up
new work from the cascade while CI runs. But when CI comes
back red, the cascade's
pr_rescuestep routes you to fix it on the nextnightly nextboundary — and as of v0.0.5+ that routing now preemptsaccepted_rfcwhen the feedback is blocking (failed CI checks, CHANGES_REQUESTED reviews). The cascade order isresume_in_flight → unblocked_approval → pr_rescue (blocking only) → accepted_rfc → github_issue → pr_rescue (non-blocking) → ideate. Concretely: between tasks you can runnightly cifor an eyeball check, but you don't need to —nightly nextwill surface red CI automatically and bump it above fresh RFC work. Draft PRs count too. A not-yet-marked-ready PR with red CI is the same priority as a ready one; don't push commits to a draft that you wouldn't push to a ready PR. Always runnightly verifylocally beforegit push, draft or not. - Arm the host-level keep-alive at session start. Run
nightly session startas the first thing the /nightly skill does. This writes aSESSION_ACTIVEmarker that the host's Stop-equivalent hook checks every turn boundary; without it, the hook lets the session end naturally. With it, the hook re-injects a "continue on X" prompt so the session keeps moving. The marker has a 4-hour TTL — re-runningnightly session startrefreshes it. Four of the five Nightly hosts have a real force-continue hook (Claude Code'sStop, Codex CLI'sStop, Cursor 1.7+'sstop, Antigravity / Gemini CLI'sAfterAgent). opencode issoftand relies on the rule text above (the model is told to never stop). The disk-based off-ramps below work everywhere regardless. - Never invoke the human shutdown off-ramps yourself. The shell
commands
nightly conclude,nightly stop, and the matching slash commands/nightly-conclude,/nightly-stop,/nightly-bugexist for the human operator only. The agent never runs them — not at end-of-session, not when the cascade looks empty, not when "the work feels done." If you reach a turn boundary and the cascade has nothing left, runnightly ideateto surface proposals andnightly briefto render the report — then end your turn and let the Stop hook decide whether to force-continue (armed) or release (CONCLUDE / STOP / stale marker / max turns / PR backlog). The only signals that wind a session down are disk markers placed by the human (CONCLUDE, STOP) or by the hook's own safety caps. The agent's wrap-up isnightly ideate→nightly brief→ end turn. Concluding is an intervention, not a workflow step. Past failure: agents have self-concluded — runningnightly concludeafternightly briefon their own to "tidy up" — which freezes the cascade short-circuit atconcludedand ends the session with unblocked RFC items still on disk. - Minimize PR count by consolidating; never stop because of it.
The orchestrator does not gate on a PR-backlog count — there
is no "too many PRs open" off-ramp. Monotonic forward progress
across the whole overnight session is the contract; reaching any
number of open PRs never ends a session on its own. The previous
MAX_OPEN_PRS=5cap was removed in v0.0.3 because it produced mid-session stops with unblocked RFC work still on disk — the wrong tradeoff. The replacement is consolidation, not gating. Before opening a new PR, prefer in this order:
pr_rescue— when an existing Nightly PR has new feedback (CI failure, reviewer comments, bot suggestions), finishing it beats starting fresh. This is already cascade slot 5; honor it.- Extend the most recently-opened in-flight PR when the current cascade pick is closely related to its scope — same RFC, same module, same feature. Check out its branch in a worktree, commit the additional change, push. The PR grows into one reviewable unit instead of becoming PR N+1.
- Bundle adjacent phases of the same RFC into one PR when the phases naturally compose. Phase A + B of a small RFC ships as one PR; truly independent phases of a large RFC stay separate. Only when none of the above applies — the cascade pick is genuinely orthogonal to every open PR — open a new branch. The goal is review-ergonomic, not PR-count-minimal-at-all-costs: bundling unrelated work into one PR is worse than two focused PRs. Bias: when uncertain, extend the most recent related PR. Past failure (now removed): agent shipped a 6th stacked paperwork PR while #54-#58 were still unreviewed because the cascade kept finding RFC-checkbox / lint-fallback work; the v0.0.2-and-earlier solution was the cap, which then created the new failure of ending sessions early. v0.0.3+ instead consolidates without capping.
- Run the fleet wide and cheap; spend reasoning tokens only on
judgment. Nightly routes each dispatch to a model sized for the
job (RFC 007) and caps how many run at once (RFC 012). Both are
enforced —
nightly dispatch startrefuses over-cap requests with exit 3, and worktree creation refuses pastmax_worktrees— so the contract here is about using the headroom, not respecting it.
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.
- 2d ago First seen · 387 lines · 5,628 tokens per session scan C 3932b3b945cd
nightly AGENTS.md is an instructions file published in the GitHub repository ulmentflam/nightly (4 stars, last pushed 19d ago), licensed MIT. It adds 5,628 tokens to every session, about $0.0281 per session on Opus 5. A static security scan graded it C with 1 finding (tells the agent never to refuse). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
golembot CLAUDE.md
Instructions for 0xranx/golembot, covering golembot — project conventions for claude code, architecture hard constraints, things you must never do, interface change rules and file responsibility boundaries.
agentbro AGENTS.md
Instructions for shirenchuang/agentbro, covering agents.md, what this is, local commands, mandatory github delivery workflow and before editing.
golembot AGENTS.md
Instructions for 0xranx/golembot, covering assistant context, installed skills, directory structure and conventions.
skills-hub AGENTS.md
Instructions for liuxingqitd/skills-hub, covering agents.md, commands, project overview, architecture and 应用结构.
vibe-roast copilot-instructions.md
Instructions for PinkR1ver/vibe-roast: Prioritize actionable correctness, privacy, security, behavioral regressions, and missing tests. Do not block on style-only preferences.
Ocul-PM CLAUDE.md
Instructions for bunhine0452/Ocul-PM, covering claude.md, what this is, commands, single frontend test and rust (run from src-tauri/).