This file is a shared baseline, not a project-specific context file. It contains portable operational protocols that apply to any project. Project-specific rules live in the repo's own AGENTS.md, AGENTS.override.md, or nested AGENTS.md per subdirectory.
If a project rule conflicts with this file, project rules win.
Engineering standards (architecture, testing, delivery, security, versioning, design thinking) are in the engineering-standards skill — loaded on demand when starting non-trivial implementation.
On every session start, after compaction, or after context clear:
- Run the repo's prime command:
make agent-primeor./scripts/agent-prime.sh - If no prime command exists, read this file and any project-level agent instructions. Identify the canonical test, lint, and build commands before editing code.
- Re-prime after any compaction, context clear, or new session.
Follow this workflow on every task:
- Restate the problem in 1-3 sentences.
- Write a user story: "As a [role], I want [capability], so that [benefit]."
- Create or update a feature spec (
specs/<slug>.md) for non-trivial changes with acceptance criteria (Given/When/Then). For trivial changes, inline acceptance criteria are sufficient. - Plan the smallest viable change. Prefer minimal diffs. If a change touches many files, explain why.
- Implement using Red-Green-Refactor.
- Verify: run fast checks first (unit tests, lint), then broader checks as needed. Fix failures before delivering.
- Deliver: summarize what changed, why, and how it was validated. Note follow-ups explicitly.
- Rigor is proportional — throwaway scripts need less than core domain logic
- Spec created or updated (if non-trivial); acceptance criteria written
- Tests added or updated
- All tests pass — not just new tests; verify previously passing tests still pass
- Security implications considered
- ADR added if architecture changed
- Docs updated if behavior changed
Use non-interactive mode for all commands. Agents must never hang waiting for input:
- Do not open editors or pagers (
$EDITOR,less,more,vi,nano). - Use non-interactive flags:
cp -f,mv -f,rm -rf,apt-get -y. - Use batch mode for remote operations:
ssh -o BatchMode=yes,scp -o BatchMode=yes. - Suppress auto-update prompts:
HOMEBREW_NO_AUTO_UPDATE=1. - Assume shell aliases may add
-i(interactive). Always use explicit flags. - Use
ghCLI for GitHub operations. - If a command might prompt for input, find the non-interactive alternative or skip it and explain why.
Before ending any session:
- File follow-ups: create issues or tasks for discovered/remaining work.
- Run quality gates: test, lint, build (if code changed). All must pass.
- Update task status: close completed items, note in-progress state.
- Commit all changes with meaningful messages (imperative mood, explains why).
- Push if you have write access. If push fails, resolve and retry. If no write access: commit locally, produce a patch/diff with apply instructions.
- Verify clean state:
git statusshows no uncommitted changes. - Summarize: what was done, what remains, where the next session should pick up.
- Requirements are ambiguous.
- The change affects public APIs or security posture.
- A new production dependency is needed.
- The change requires broad refactors or file moves.
- Prefer existing capabilities. Exhaust built-in capabilities and existing skills before reaching for external tools. Every external call is latency, risk, and a potential point of failure.
- AI agents are tools, not authors. All output should read as if a human wrote it. No AI attribution in code, commits, PRs, or documentation by default.
- Match model capability to task complexity. Use more capable models for planning, architecture, security, and code review. Use smaller, faster models for routine implementation, simple edits, and exploration.
- Prefer idempotent actions. Commands, API calls, and infrastructure changes should be safe to re-run. Use create-or-update over create, upserts over inserts, and
--forceor--if-not-existsequivalents where available. Assume any action may be retried. - CLI-first. Use existing repo CLIs directly. Lowest surface area, easiest to audit.
- Write context files from observed failures, not preemptively. Use the
context-file-authoringskill for guidance. - Contribute universal corrections upstream. Use the
upstream-contributionskill when a correction applies to every project.
This file captures universal, portable engineering principles. For project-specific instructions, use the repo's own AGENTS.md, AGENTS.override.md, or nested AGENTS.md files in subdirectories. Project-level instructions extend and may override these defaults.