# AGENTS.md — team-guide Working agreements for our 1–3 person AI-assisted development team. This is the canonical spec for AI coding agents (Claude Code, Codex, and any other `AGENTS.md`-aware tool). Claude Code reads this via `CLAUDE.md`'s `@AGENTS.md` import, so there's exactly one source of truth. > Human-facing entry point: [`README.md`](README.md) (Chinese, > condensed). When humans want the full ruleset, they read this file. ## How AI agents use this repo Before starting non-trivial work in any team project, an agent should: 1. **Read this `AGENTS.md`** — general rules (vibe coding, Git, code style, planning, handoff). 2. **Scan [`library/README.md`](library/README.md)** — focused specs for narrower topics. Read the entries that match the current task. 3. **Read the project's own `AGENTS.md`** — project-specific stuff (how to run it, architecture, project-only don'ts). Project AGENTS.md files do **not** repeat team-guide content; they reference it. In short: team-guide is the external rulebook every project's agent reads at task start. Project AGENTS.md files stay small and specific. ## Project This repo holds our team's working agreements. It is **documentation, not code** — no build, test, or lint step. Acceptance is "a human can read the change and would have written the same." ## Editing rules (this repo) - One rule per bullet. If a rule needs a paragraph of justification, split the rule out and put the reason on a `**Why:**` line. - Lead with the rule, then `**Why:**`, then `**How to apply:**` only when the rule isn't self-evident. - No emoji. No decorative headers. No "🚀 Getting started!" energy. - Keep AGENTS.md under ~800 lines. Past that, split. - Examples beat prose. A 3-line code block beats a paragraph. ## Language policy - **Human-facing**: Chinese — `README.md` only. - **AI-facing**: English — this file, `CLAUDE.md`, anything under `library/`. - **Git metadata**: English — commit messages, PR titles, branch names, tag annotations. AI tools and search work better on English. If you're an agent about to write Chinese into a file the human would never read (or English into a file only humans read), stop — wrong file. ## CLAUDE.md and AGENTS.md sync Claude Code reads `CLAUDE.md`; Codex and other agents read `AGENTS.md`. In this repo, `CLAUDE.md` is a single line: `@AGENTS.md`. That makes this file the only spec; both tools see the same content. For other projects in our workspace where the two files are physical copies (legacy or tool-mismatch reasons), the rules are: - Bodies must stay in sync. Drift breaks one of the tools silently. - Whoever edits one updates the other in the same PR. Add "Synced AGENTS.md" (or "Synced CLAUDE.md") to the PR description. - Reviewer blocks PRs that only touch one side. When starting a new project, prefer the single-file approach: write `AGENTS.md`, make `CLAUDE.md` a one-line `@AGENTS.md` import. --- ## 1. Vibe coding — humans + AI work split ### The premise Claude / Codex write most of the code. Humans steer: framing problems, making decisions, deciding what's good enough. We're not racing the AI — we're skipping typing so we spend more time thinking. ### The split **AI does:** - Read code and explain it - Write first-pass implementations against a clear spec - Mechanical refactors (renames, extractions, type changes) - Run tests, builds, linters; iterate on errors - Generate boilerplate (configs, fixtures, CRUD) - Search across the workspace and summarize **Humans do:** - Decide what to build and why - Frame the spec before AI touches code - Approve any change with non-local consequences (deps, schema, infra, auth, secrets) - Read every diff before merging - Make the call when AI has tried twice and is going in circles - Sign off on commit messages and PR descriptions (AI drafts; you sign) If a task feels like it's drifting toward "AI decides", stop and write a spec yourself first. ### Prompt habits - **Frame, don't dictate.** Tell AI the goal, the constraints, and what you've ruled out. Don't prescribe steps unless the steps are the point. - **Name the file.** "Fix the bug in `eval-agent/runner.py`" beats "fix the bug." Save AI a search. - **Say what done looks like.** "Tests pass and the new flag defaults to off" — measurable. "Make it cleaner" — not. - **One task per turn.** Three unrelated asks → three messages or three sessions. - **Push back on bad output.** If the diff is wrong, say so plainly and point at what's wrong. Don't accept code you wouldn't write yourself. ### When to take over Stop letting AI drive when: - It's failed the same approach twice and the error is unchanged. - It's adding "safety" code the task didn't ask for. - The diff has grown past what you can read in one sitting. - You can't explain the change to a teammate without re-reading the diff. - It's about to do something irreversible — confirm explicitly. When you take over, write *why* in the PR description so the next person doesn't repeat the loop. ### Verifying AI output Treat every AI diff like a fast junior's PR: 1. Does it build? 2. Do tests pass — and do new tests actually test the new code? 3. Did it touch files outside the stated scope? Look at every one. 4. Did it add deps? Check the lockfile diff. 5. Read every comment AI added. Half are noise — delete those. 6. Run user-facing features end-to-end. Type checks ≠ working software. ### Anti-patterns - **Snowballing context.** Long sessions accumulate stale assumptions. New task → new session. - **Approval-by-default.** "Looks good" without reading the diff is how bugs ship. - **Outsourcing the spec.** "Figure out what we should do" is avoidance, not a prompt. - **Letting AI rewrite history.** If AI wants to refactor unrelated code "while we're here", say no. Open a separate task. --- ## 2. Claude Code & Codex configuration ### Per-project files ``` / ├── AGENTS.md ← canonical spec, committed ├── CLAUDE.md ← committed, single line: @AGENTS.md └── .claude/ ├── settings.json ← shared settings, committed ├── settings.local.json ← personal overrides, gitignored └── skills/ ← project skills, committed ``` `settings.local.json` is **always** gitignored — personal API keys, local paths, individual hook tweaks. ### AGENTS.md content per project In this order: 1. **Project** — two sentences max. 2. **Run it** — build, test, lint as bash blocks. 3. **Architecture** — one paragraph. Entry points and data flow. No diagrams unless they save words. 4. **Conventions specific to this repo** — naming, layout, patterns that aren't obvious from the code. 5. **Don'ts** — things AI has gotten wrong before. One line each. A new contributor (human or AI) should be productive after one read. Past 100 lines, split — it's drifted into "documentation." Skeleton to copy into a new project's `AGENTS.md`: ```markdown # AGENTS.md — > Reference: team-guide (https://git.simgreek.com/simgreek/team-guide) > for cross-project rules. This file holds only what's specific to > this project. ## Project ## Run it ```bash ``` ## Architecture Key files: - `` — ## Conventions specific to this repo ## Don'ts - Don't <…> ``` `CLAUDE.md` in a new project is one line: `@AGENTS.md`. ### Permissions (Claude Code) Default: prompt for risky, allow read-only freely. In `.claude/settings.json`, allow without prompting: - All `Read`, `Glob`, `Grep` - `Bash(git status)`, `Bash(git diff)`, `Bash(git log)`, `Bash(git branch)` - Project-specific read-only commands (`Bash(npm test)`, `Bash(pytest)`) Always prompt for: - `Edit` / `Write` outside the working tree - `Bash` with destructive verbs (`rm`, `mv`, `git push`, `git reset --hard`, package installs) - Any MCP tool that talks to a remote service Approving the same prompt repeatedly → run the `fewer-permission-prompts` skill to propose an allowlist from your transcripts. ### Codex approval & sandbox - **Approval**: default `on-request` (asks before commands). Use `on-failure` or `never` only on personal, low-risk machines. Production / shared / unfamiliar repos → keep `on-request`. - **Sandbox**: default `workspace-write` + network off. Toggle network on temporarily to install packages or fetch resources, then off. `danger-full-access` rarely. - Personal Codex preferences in `~/.codex/config.toml` — never commit. ### Hooks Hooks enforce rules automatically. AI **does not reliably remember** "from now on do X" across sessions; hooks do. Use hooks for: - Auto-formatting on file edit (Prettier, ruff, gofmt) - Blocking edits to protected paths (`.env`, generated files, `dist/`) - Auto-running tests after writing to a known test path - Notifying on session stop / long-task completion Don't use hooks for: - One-off checks ("just remember X this week") - Anything that depends on AI judgment Configure via `update-config` skill or edit `.claude/settings.json` directly. One-line comment per hook. ### Memory Per-machine memory system. Use it for: - **User**: who you are, role, preferences. - **Feedback**: corrections that should stick across sessions, with the *why*. - **Project**: facts about ongoing work that aren't in the code (deadlines, stakeholder decisions, why a refactor is happening). - **Reference**: pointers to external resources (Linear, Grafana, internal wikis). Don't put memory content in `AGENTS.md`. AGENTS.md is shared with the team; memory is personal, per-machine, outside the repo. Don't use memory as a notes app — task-scoped state goes in plans or PR descriptions. ### Skills Skills live in three places: - **User skills** (`~/.claude/skills/`) — installed once, available everywhere - **Project skills** (`/.claude/skills/`) — committed, team-shared - **Plugin skills** — installed via marketplace Promote a workflow to a skill when **all three** are true: 1. Done it the same way three times. 2. Steps stable enough to write down. 3. Someone else would do it the same way given the spec. Only two true → leave it as a prompt snippet. Skill design: - One skill, one job. Branching skills are two skills. - Verb-phrase names: `review-pr`, `cut-release`, `rebuild-fixtures` — not `pr-helper`. - Description (the line the model sees) says **when to invoke**, not what the skill does. - `SKILL.md` under 200 lines; long skills split into stages. - Examples beat instructions. Recommended installs: ``` anthropic-skills:consolidate-memory periodic memory cleanup simplify review changed code for reuse/quality fewer-permission-prompts propose allowlist from transcripts review review a pull request security-review security pass on pending changes ``` Review skills like PRs — read, run once on a real task, merge. Skills nobody runs after a month → archive (`.claude/skills/_archive/`). ### Sub-agents Spawn a sub-agent (Claude `Agent` tool) when: - Task needs cross-file search and you don't want results in main context. - You want a second independent read on a design or diff. - Work is genuinely parallel (e.g. researching three options). Don't spawn for tasks the main agent can do in two tool calls. ### Sessions - One task per session. New task → new session. - Long session, context bar filling → finish current step, summarize into a plan or PR draft, start fresh. - Don't `--continue` yesterday's session for a new topic. Stale context leaks in. ### Tool selection (mixing Claude Code + Codex) Both fine; mild preferences: - **Writing docs / specs** — Claude Code (this repo was written that way). - **Large refactors / cross-file features** — Claude Code (plan mode + sub-agents). - **Narrow edits, run a test, change a config** — Codex CLI (faster startup). - **In-IDE inline edits** — Codex IDE plugin or Cursor. Don't run two tools editing the same file simultaneously — overwrites are hard to trace. --- ## 3. Git workflow ### Branches - `main` (spec repos) / `dev` (product repos) is always shippable. No direct pushes, no exceptions. - Feature branches: `/` — `bai/auth-retry`, `bai/eval-agent-rerun`. Lowercase, hyphens, handle prefix. - Long-lived integration: `integration/` — only by team agreement. - Delete branches after merge. ### Commits ``` : ``` - `` is a directory or component, lowercase: `eval-agent`, `task_assistant`, `docs`, `git-workflow`. - Imperative: "add", "fix", "rename" — not "added" / "adding". - Body wraps at ~72 chars. Skip it for trivial commits. - One topic per commit. "and" in the summary → split. - Always include `Co-Authored-By` for AI-assisted commits. - English. Examples: ``` eval-agent: rerun failed tasks with stable seed docs: clarify branch naming task_assistant: drop unused legacy export path ``` ### Pull requests - One PR per topic. Can't describe in one sentence → multiple PRs. - Title under 70 chars, same shape as commit summary. - Description structure: **Summary** (1 sentence + bullets if needed) / **Why** / **What changed** (bulleted by file or area) / **Test plan** (checkbox list, honest) / **Out of scope** (optional) / **Notes for reviewer** (optional, for surprising AI decisions). Add a `🤖 AI-assisted` trailer for AI-assisted PRs. - First push of a feature branch uses `-u`. - Open as draft once runnable. Review-as-you-go beats review-at-the-end. ### Review Every PR reviewed before merge — own AI-assisted PRs included. Reviewer: 1. Description matches diff? Surprises → ask. 2. Read every changed file. Off-topic file → ask why it's in this PR. 3. Run locally if not obviously correct from reading. 4. New deps, schema changes, env vars, auth-touching code → block until justified. 5. Comment on least-important issue first; merge-blocker last so it's clearly the gate. Author follow-ups: - Address every comment, even with "agreed, fixed in ". - Disagree → push back in writing. Don't silently ignore. - Squash fixup commits before merge if history is noisy. ### Merging - Squash for feature branches. Merge commits reserved for integration. - Final squash message follows commit format. - Delete the branch on merge. ### Tagging Tags are dated: `YYYYMMDD`, with `-N` suffix for same-day reissues (`20260520-2`). Tag from `main`. Rules: - Annotated only (`git tag -a`). - Tag message summarizes what changed since the previous tag. - Tags are immutable once pushed. Wrong tag → cut a new one. - Don't tag on feature branches. - Max one tag per day, use `-N` for same-day reissues. Cut a tag: ```bash git checkout main && git pull --ff-only git tag -a 20260520 -m "team-guide 20260520: bilingual policy" git push origin 20260520 ``` Inspect: ```bash git tag --sort=-creatordate git show 20260520 git log --oneline 20260513..20260520 ``` When to cut a tag: - Docs changed in a way teammates need to re-read. - A new convention is now in effect (not just proposed). - A library/ entry was added, removed, or restructured. When **not** to cut a tag: - Typos, formatting, link fixes → just push to `main`. - Drafts under discussion → use a PR. Project repos in the workspace use their own tag schemes (typically semver `vX.Y.Z`). Each project documents its own scheme in its own `AGENTS.md`. ### Don'ts - No `git push --force` to `main`. Period. To your own branch only if certain nobody pulled it. - No `--no-verify` to skip hooks. Fix what the hook reports. - No amending pushed commits. Add a new commit instead. - No deleting or moving pushed tags. Cut a new one. - No committing `.env`, secrets, or files >5 MB without a Git LFS conversation. - No `git add .` / `git add -A` when there are unrecognized untracked files. Stage by name. --- ## 4. Code & deliverable style ### Naming - **Files** — lowercase. Docs hyphenated (`git-workflow.md`), Python underscored (`task_runner.py`), JS/TS kebab where ecosystem prefers. Match the surrounding project. - **Functions** — verb phrases. `loadConfig`, not `config`. `runTask`, not `taskRunner`. - **Variables** — what they are, not their type. `users`, not `userArray`. `retryCount`, not `n`. - **Booleans** — `is*`, `has*`, `should*`. `isReady`, not `ready`. - **Constants** — `UPPER_SNAKE_CASE` only at module level. Inside functions, plain `const`. - **No abbreviations** unless they're domain terms. `database`, not `db`. (`req`/`res` in Express is fine.) ### Comments Default: none. Justified when **all** are true: - *Why* is non-obvious from code. - A future reader would otherwise misread. - The code can't be made clearer (rename / extract / restructure). Don't write: - `// increment counter` next to `counter++` - `// added for the auth refactor` — belongs in the commit message - Block comments restating signatures - TODOs without owner or date Do write: - One-liners for non-obvious workarounds, with the *why*. - `# NOTE:` for behavior that would surprise a reader. - Module headers when the file does something the layout doesn't explain. ### File structure - One concept per file. Can't summarize in one sentence → split. - Tests next to the code unless project already uses parallel test trees. - Generated files in `dist/`, `build/`, etc. — and `.gitignore`. Never edit a generated file. - Lockfiles always checked in. ### Errors - Fail loudly at boundaries (user input, external APIs, file I/O). - Don't `try/except` to silence. Catch → handle. - Internal functions trust callers. Don't validate the same input three layers deep. - Logged errors include enough context to debug from logs alone. ### Tests - Test behavior, not implementation. Behavior-preserving refactor that breaks a test → test was wrong. - One assertion per test ideally. - Fixtures next to the tests using them. - Slow / flaky tests get marked or quarantined, not silently retried. - New code without a test is incomplete unless project has no test infrastructure (rare, and a bug itself). ### READMEs Every repo has one. In order: 1. **What is this?** One paragraph. 2. **How do I run it?** Bash blocks. 3. **How do I develop on it?** Code layout, conventions. 4. **Where does data come from / go to?** Only if non-obvious. 5. **Pointers.** Related repos, dashboards, docs. Shorter than this is fine — drop sections that don't apply. ### Don'ts - No third way to do something we already do two ways. - No config options "for flexibility" without a real use case. YAGNI. - No unrelated refactors in a feature PR. Open a separate one. - No optimization before measurement. --- ## 5. Team library Narrower specs that don't fit cleanly in this file live under [`library/`](library/). Catalog: [`library/README.md`](library/README.md). When an agent picks up a task, it should scan the catalog after reading this file and read entries that match. Each entry leads with a "When to read this" section so the decision is fast. Current entries: - [`library/git-upload/`](library/git-upload/SPEC.md) — what to commit, what not to, how to recover from leaked secrets. Promotion criteria, layout, and adding rules: see [`library/README.md`](library/README.md). --- ## 6. Planning cadence 1–3 person team. Lightest process that keeps us aligned. ### Weekly - Async written sync (Monday morning). Each person posts: 1. What I shipped last week (one line per item). 2. What I'm picking up this week (one line per item). 3. What's blocked or unclear (the only section worth reading carefully). - 30-minute live call mid-week. Agenda is the "blocked or unclear" lines. ### Per task Before starting work that takes more than ~half a day: 1. Write a 5-line spec: *Goal / Why / Done when / Out of scope / Risks*. 2. Drop in PR description (draft PR fine) **before** writing code. 3. If AI does most of the typing, the spec is also the prompt. After: 1. PR description matches what shipped. 2. Lessons future-you would want → Claude memory (feedback / project types). See [Memory](#memory). ### Quarterly Half a day to: - Re-read this `AGENTS.md`. Open PRs for what's stale. - Review skill catalog. Archive unused. - Run `consolidate-memory` on personal memory files. ### What planning is *not* - Not Jira tickets. Two people don't need a board. - Not Gantt charts. Need one → building the wrong thing. - Not status theater. Monday post is for spotting blocks, not proving you worked. --- ## 7. Handoff Task packages, deliverables, work transfers between team members or to external consumers. ### Why this matters Handoff failures cost more than the original work. A package that's "obvious" to the author is a half day of confusion for the recipient. Handoff is **part of the deliverable**, not afterthought packaging. ### Two kinds - **Internal** — passing work to a teammate or future-you. Branch, PR, half-finished prototype. - **External** — versioned artifact to a partner / customer / downstream. Zip, dataset, release. Both use the [handoff checklist](#handoff-checklist) below. External has higher bar. ### Task package layout ``` / ├── README.md ← what this is, who it's for, how to use ├── CHANGELOG.md ← what changed since last version ├── VERIFICATION.md ← counts, checksums, sanity checks ├── manifest.json ← machine-readable metadata ├── data/ ← the actual deliverable └── scripts/ ← only what's needed to use the package ``` `manifest.json` minimum fields: ```json { "name": "praxis-sample-5", "version": "0.5.0", "generated_at": "2026-05-18T17:00:00Z", "source_commit": "", "source_repo": "", "record_count": 1234, "schema_version": "1.0" } ``` Can't fill a field → `null` and explain in README. **Never make one up.** ### Internal handoff Before handoff: - PR description is current. Summary describes what shipped, not what was attempted. - Test plan in PR template filled honestly. Untested → say so, don't bury. - Surprising AI-assisted decisions → `## Notes for reviewer`. "AI tried X first, didn't work because Y, working approach is Z" — saves the reviewer a re-derivation. - Local-only state (env vars, scratch data) documented or scripted. "Works on my machine" is not a handoff. The recipient should be able to: `git checkout` the branch → read PR description → run test plan → form an opinion — **without messaging you.** ### External handoff (additional bar) - **Reproducibility.** Someone with source access can rebuild from the commit hash in `manifest.json`. Test once before first release. - **Verification report.** Machine-checkable (JSON or similar) showing pre-ship checks passed. - **Provenance.** AI-generated → record model and human-in-loop steps. For debugging six months later, not ceremony. - **License & attribution.** Even for internal partners. ### What not to ship - Files >500 MB without a delivery-channel conversation. - Real PII unless that's explicitly the deal. - `.env`, secrets, API keys, internal hostnames. - "Final final v3" filenames. Use the version field. If it's `final`, it's `v1.0`. - A package without a README. Even a one-line README beats none. ### Receiving a handoff 1. Read the README first, fully. Resist running scripts. 2. Run the verification report. Fails → stop and message the sender before doing anything else. 3. Note any surprise — naming, missing files, version mismatch — and send back within a day. Drift gets worse with silence. ### Handoff checklist Copy into the package (external handoff) or PR description (internal). Fill it before declaring handoff done. ```markdown ## Identity - Name: - Version: - Generated at: - Source repo: - Source commit: - Owner: - Recipient: ## Contents - [ ] README.md — what this is, how to use it - [ ] CHANGELOG.md — diff vs previous version (or "first release") - [ ] manifest.json — all fields filled or explicitly null - [ ] VERIFICATION.md — what was checked, results - [ ] Data / artifacts - [ ] Scripts (only what's required to use the package) ## Verification - [ ] Record / file counts match expected - [ ] Checksums computed and recorded - [ ] Sanity checks pass (list them) - [ ] No secrets, .env, or credentials - [ ] No PII unless explicitly part of deliverable - [ ] Total size reasonable for delivery channel ## Reproducibility (external handoff only) - [ ] Confirmed someone with repo access can rebuild from source_commit - [ ] Build / generation command documented in README.md - [ ] External dependencies pinned ## Provenance (if AI-assisted) - Model used: - Human-in-loop steps: - Notable AI-assisted decisions: ## Known limitations - <…> ## Recipient instructions - [ ] Read README.md first - [ ] Run verification report; if fails, stop and contact sender - [ ] Confirm receipt within - [ ] Report any surprises within ``` --- ## Working directory expectations (this repo) - Small repo (~10 files). `Read` everything before acting; no need to spawn a sub-agent for exploration. - Don't introduce `package.json`, `Makefile`, CI configs, or other toolchain files unless explicitly asked. This is a docs repo.