AGENTS.md: instructions for AI coding agents
Project: a lightweight local daemon + small web UI that syncs git repos from many SCM providers. Read docs/REQUIREMENTS.md, docs/ARCHITECTURE.md, docs/THREAT-MODEL.md before changing code.
Commands
make build·make test(race + cover) ·make lint·make security·make gen(schema + docs)- A change is not done until
make test lint securitypasses.
Hard rules (safety)
- Never lose user work. Do not weaken
internal/cleanupsafety predicate, FF-only logic, or dirty-tree checks. Unknown ⇒ fail closed. Changes there need property tests. - No secrets in code, logs, argv, env, URLs, config, fixtures, or commits. Use
secrets.Token. Tests use canary values. - Git runs only via
internal/gitx(hooks off, env scrubbed). Neversh -c, never string-concatenated commands. - All outbound calls go through
httpx+ratelimit. No directhttp.Get, no new endpoints outside official provider docs. - UI is loopback-only; never add CORS, external assets, inline scripts, or disable CSRF/Host checks.
- Tests never touch the real
$HOME, keychain, network, or real provider; uset.TempDir(), fakes,httptest. - Do not add dependencies without justification (license, maintenance, size); prefer stdlib.
- Never use UPX/obfuscation. No self-update or download-and-execute behaviour, with one narrow exception (ADR-0021):
repo-keeper update --apply, run by the user, on a plain tarball install only, after signature and checksum verification. No daemon, scheduler, UI, tray, service, timer, config option or environment variable may ever apply an update; update checks run by default (opt-out) and only notify.internal/update/applymay be imported only bycmd/repo-keeper/update.go;internal/update/isolation_test.goenforces it (ADR-0022).
Style
- Go idioms; small interfaces at the consumer;
context.Contextfirst; wrap errors with%w;slogonly; injectClock. - Comments: concise, one line, why not what; every exported symbol has a one-line doc comment. No decorative or multi-paragraph comments.
- Table-driven tests named
Test<Unit>_<Scenario>_<Expected>; notime.Sleep. - SPDX header on every source file.
Workflow
- Small PRs, Conventional Commits, one concern each; update docs/ADR/threat-model if behaviour or surface changes.
- When a provider's ToS/limits are involved, update
docs/PROVIDERS.md(last verified date) and use the compliance checklist. - If requirements are ambiguous, add to
docs/OPEN-QUESTIONS.mdrather than guessing about safety-relevant behaviour. - Don't run destructive git commands outside temp dirs.
Suggested specialised agent roles
| Role | Focus | Reads |
|---|---|---|
git-engine |
gitx, sync, cleanup |
ARCHITECTURE §5, THREAT-MODEL T6–T8 |
provider-dev |
one provider + contract tests | PROVIDERS.md |
ui-dev |
ui, a11y, CSRF |
ARCHITECTURE §7, T1–T2 |
security-reviewer |
review diffs against threat model, run make security |
THREAT-MODEL, SECURITY |
release-eng |
GoReleaser, signing, AV hygiene | DISTRIBUTION |
docs-writer |
user docs, config reference | all |