nightme
AGENTS.md9 starsChanged 9 days agoMITView on GitHub
Docs describe the system as it is now. History, process, and change narratives belong in PRs / commits / ADRs — not here. No new doc without an explicit request. Rewrite the whole section. Delete what is replaced. Never keep two versions side by side. Read every sentence as a first-time reader. If removing the timestamp or context makes it false, delete it.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
No new doc without an explicit request.
- Distinctive: line 26
Read every sentence as a first-time reader.
- Very specific: line 31
When a comment points at a source of truth, point at the file or the symbol — docs/feat/F-gtw.md, pathutil.Join — never at a line number or …
- Very specific: line 59
Run make fmt (alias for gofmt -w ./...) after every code change.
- Distinctive: line 60
Test merges: when tests conflict in a rebase, prefer rewriting over mechanical 3-way merge.
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
1. Documentation Rules
Docs describe the system as it is now. History, process, and change narratives belong in PRs / commits / ADRs — not here.
Don't write
- Change narrative: "was X, now Y"; "adjusted because of Z"; "as requested by N"
- Temporal words: now / recently / newly / "as of vX"; 中文:新增了 / 现已支持 / 之前 / 原本
- Process artifacts: task splits, debug logs, file lists, verification steps, options considered
- Preambles: "This document introduces..."; "The following changes..."
- Pinned anchors:
docs/SPEC.md §1.2,internal/registry/chat_session_entry.go:3,详见 §5.5— name the target instead of its position: the file for another file, the heading for this one
Don't create
No new doc without an explicit request.
When updating
Rewrite the whole section. Delete what is replaced. Never keep two versions side by side.
Self-check
Read every sentence as a first-time reader. If removing the timestamp or context makes it false, delete it.
2. Comment Rules
- Write code that speaks for itself. We do not need comments most of the time. A comment earns its place only when it explains WHY — and only the part the code cannot state by itself: the constraint behind the line, the invariant it protects, the reason a surprising choice was made. A comment that restates the code goes stale as soon as the code moves.
- When a comment points at a source of truth, point at the file or the symbol —
docs/feat/F-gtw.md,pathutil.Join— never at a line number or a section number. Anchors rot on the first edit; a file or a symbol can still be found. - ❌ AVOID — Obvious Comments(复述代码)、Redundant Comments、Outdated Comments、Commented-out Code、Changelog Comments、Divider Comments、Pinned Anchors(行号/章节引用)
3. Project Layout
- Module:
github.com/cnlangzi/nightme - Entry:
cmd/nightme/(CLI + daemon + tray) - Per-AI-agent backends:
internal/bridge/{claudecode,codex,copilot,cursor,dsh,omp,opencode,pi,pty,acp} - Per-chat-platform channels:
internal/channel/{feishu,slack,telegram,echo} - Core runtime:
internal/{chatsession,chatstore,command,config,gateway,messages,llm,registry,runtime,login,me} - Published package:
pkg/wfe— import pathgithub.com/cnlangzi/nightme/pkg/wfe - README.md has the full map and concepts (ChatSession, CWD = project, Bridge, Channel, Messages, WFE).
4. Verify Before Done
- Build:
make build# bin/nightme[.exe] with version metadata - Test:
make test#go test -race ./... - Lint:
make lint#go vet ./...— matches CI - Fmt:
make fmt#go fmt ./...— required; CI rejects unformatted files - Dev:
make dev#go run ./cmd/nightmewith example config - Linux GUI variant (
make build-gui) needs build-time packages libgtk-3-dev + libayatana-appindicator3-dev and runtime packages libgtk-3 + libayatana-appindicator3; default build is tray-less. - CI runs linux + windows + darwin. Respect existing
//go:build !windows///go:build !unixtags; don't break cross-platform splits.
5. Code Style & Runtime Rules
Style
- No
type X = Yaliases. Use the underlying type directly; don't keep aliases for backward-compat names. - Run
make fmt(alias forgofmt -w ./...) after every code change. CI's gofmt gate rejects the build whengofmt -l .is non-empty — don't bypass it with a hand-edited file. - Test merges: when tests conflict in a rebase, prefer rewriting over mechanical 3-way merge.
Runtime
- Bridge layer is transport + permissions only. Do not inject model / provider / credentials / bundled config into downstream AI agents — keep their defaults intact. A bridge may forward the model the user configured for that agent (e.g. the model opencode's own configuration selects); it must never choose a model, a provider or a credential itself.
- Bot failure handling: silent recovery first (retry / respawn /
--resume). Only notify the chat when recovery is impossible. Do not invent a new notification path.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

