This AGENTS.md is the native always-on Codex instruction file for this repository.
Use these native Codex files:
.codex/skills/go-rig/SKILL.mdfor Go implementation and refactoring work.codex/skills/go-review/SKILL.mdfor Go-focused review work.codex/skills/frontend-dashboard/SKILL.mdfor embedded frontend/UI work.codex/skills/project-ops/SKILL.mdfor build, CI, release, and command-surface work
Do not treat repo-root SKILLS.md or RULES.md as native auto-loaded Codex files.
Do not treat CLAUDE.md or .claude/ as the native Codex instruction mechanism.
Those files remain for compatibility and reference only.
- Use the
go-rigskill for meaningful Go code changes. - Use the
go-reviewskill when the task is review-first. - Use the
frontend-dashboardskill when changing the embedded SPA or dashboard UI. - Use the
project-opsskill when changing Makefile, CI, release, or operational docs. - Keep output aligned with the current repo architecture and toolchain.
Zero-dependency Go HTTP server with embedded SPA frontend:
- Zero third-party dependencies (
go.modhas norequireblock, nogo.sum). web/index.htmlis embedded via//go:embedand rebuilds on frontend changes.- Root package is a façade: internal logic in
internal/app<domain>/, thin wrappers at repo root.
- Do not add external dependencies unless explicitly justified and necessary.
- Treat
go.mod, toolchain declarations, and CI as the source of truth. - Prefer
maketargets when available. - Prefer repo-defined checks over invented commands.
appconfig— config loading, env, dotenvappruntime— path resolution, version detectionappchat— AI gateway HTTP communicationapprefresh— collection jobs and aggregationsappserver— HTTP routing, caching, rate limitingappsystem— OS/system metrics and probesappservice— OS service management
- Go fmt/gofmt only (mechanical formatting).
- Stdlib first;
x/before third-party; justify every dependency. - Concrete types over abstractions;
unexportedby default. - Short interfaces; consumer-side only; accept interfaces, return structs.
- Early returns and one-pass readable functions.
- No stale comments: explain why, not how.
- Wrap errors with
%wand check witherrors.Is/As. - Do not swallow errors.
- Never panic on expected failures.
context.Contextis first parameter for I/O and request-scoped functions.
- Use only when measurable.
- Every goroutine must have a shutdown path.
- No unsafe shared writes; protect maps when mutated concurrently.
- Use table-driven tests with
t.Run. - Add acceptance-like coverage for user-visible behavior and meaningful unit tests for invariants.
- Fakes/stubs over mocks when possible.
- Deterministic seams for time, randomness, I/O.
- Domain-oriented packages under
internal/andpkg/only when intentionally reusable. - Root wrappers must be zero-logic forwarding for compatibility.
- Avoid speculative abstractions and generic utility folders (
helpers,util,common).
- Prefer
slogfor structured logging. - Validate config at startup; keep secrets out of logs and code.
- Set timeouts in HTTP/db/client usage and close all resources.
make buildmake testmake lintmake check- After edits, run
go vet ./..., tests, race tests where supported, thengo mod tidyonly when imports changed.
- Swallowed errors
- Context misuse
- Goroutine leaks
- Unsafe shared state
- Blind
go fixchanges - Transport logic inside domain packages
- Behavior-changing refactors without matching tests
- Hardcoded magic values
- Unnecessary dependency creep
- Go toolchain follows project
go.mod/toolchain(1.26.x in CI context). - Prefer modern Go features when they improve clarity and match the current toolchain.
- Do not apply
go fixrewrites blindly; review behavior changes before accepting them.
- Use stdlib testing features that are available in the project toolchain (
t.Context,b.Loop,t.ArtifactDir,testing/synctest) when they improve test clarity. - For complex comparisons in this zero-dependency repo, prefer stdlib approaches or small purpose-built helpers. Do not assume
github.com/google/go-cmp/cmp.
json:",omitzero"andjson:",omitempty"are available in the current toolchain, but tag changes are wire-format changes and must be reviewed as compatibility work.- Nil vs empty slice/map behavior must be intentional in JSON responses and persisted data.
- The repo is a zero-dependency Go HTTP server with an embedded SPA.
- Core logic belongs in
internal/app<domain>/. - The root package is a facade and must stay zero-logic.
- Frontend changes require rebuild because
web/index.htmlis embedded.