| author | agents |
|---|---|
| status | normative |
| last_reviewed | 2026-04-02 |
| source_of_truth_scope | root coordination contract for AI and human contributors |
| review_cadence | weekly during active frontend work, otherwise bi-weekly |
This file is the root coordination contract for AI and human contributors in this monorepo. Keep this file compact and route detailed guidance to docs.
- Applies to the whole repository unless a closer
AGENTS.mddefines additive overrides. - A closer
AGENTS.mdmay tighten rules for its subtree, but must not relax root safety rules. - Repository layout:
apps/,libs/,tools/,testing/.
- Nearest additive
AGENTS.mdto the changed file. - Root
AGENTS.md. - Referenced docs and standards (for example
CONTRIBUTING.md).
Normative language:
MUST/MUST NOT: mandatory and blocking.SHOULD/SHOULD NOT: expected by default; deviations must be justified in PR notes.MAY: optional.
MUST NOTuseanyor non-null assertions (!) in production code.MUST NOTrunpnpm lint --fix.MUSTkeep diffs scoped to the task and avoid unrelated edits.MUSTpreserve module boundaries and import direction constraints already enforced by lint.MUSTprefer existing shared utilities/hooks over creating near-duplicates.MUSTrun targeted verification (lint/tests/typecheck) for the touched area.- Both SWR and Jotai
atomWithQueryare acceptable for data fetching. The team is evaluating migration; no forced migration yet. - Avoid introducing new
common/** -> modules/**imports; treat existing cases as legacy debt and track cleanup indocs/QUALITY.md.
MUST NOTnormalize addresses withaddress.toLowerCase(); usegetAddressKeyfrom@cowprotocol/cow-sdk.MUST NOTcompare addresses with===,toLowerCase(), or manual string comparison; useareAddressesEqualfrom@cowprotocol/cow-sdk.
- Install:
pnpm install - i18n:
pnpm i18n - Start:
pnpm start,pnpm start:cowswap,pnpm start:explorer,pnpm start:widget,pnpm start:cowfi - Lint/test/typecheck:
pnpm lint,pnpm test,pnpm typecheck - Project target:
pnpx nx run <project>:<target> - Harness checks:
pnpm agents:check
- Architecture and dependency map:
docs/ARCHITECTURE.md - Naming, file structure, imports, component shape:
docs/MODULE_CONVENTIONS.md - Jotai/query, persistence, migrations:
docs/STATE_MANAGEMENT.md - Quality grades and known gaps:
docs/QUALITY.md - Hardening roadmap (next enforcement steps):
docs/HARNESS_HARDENING.md - Frontend-specific additive rules:
apps/cowswap-frontend/AGENTS.md - Other app-local commands/overrides:
apps/*/AGENTS.md
Use this protocol only when explicitly asked to "apply/fix AGENTS.md rules in this branch."
- Compute touched files:
git diff --name-only $(git merge-base HEAD develop)..HEAD - Load context:
- root
AGENTS.md - nearest additive
AGENTS.mdfor each touched file
- root
- Audit touched files for violations; keep scope to touched files by default.
- Allow extra files only when required for correctness; list each with one-line justification.
- Verify with file-level lint + targeted tests.
Required response format for this task:
- Findings first (severity order) with
file:line - Exact fixes made
- Additional files changed with justification
- Commands run and pass/fail
- Residual risks/gaps
Mechanical checks are preferred over prose.
- ESLint + Nx rules are the first enforcement layer:
- module boundaries (
@nx/enforce-module-boundaries) - restricted imports (
@typescript-eslint/no-restricted-imports) - import order and restricted internal module paths
- module boundaries (
- Run
pnpm agents:checkto verify AGENTS/doc harness integrity. - CI enforcement:
.github/workflows/ci.ymljobagent-harnessrunspnpm agents:checkon push and PR. - If adding new architectural rules, add machine checks (lint rule, script, or test) in the same PR.
- If you spot architecture or convention drift, open a focused cleanup PR instead of piggybacking unrelated fixes.
- Update
docs/QUALITY.mdwhen domain health improves/regresses. - Keep plan files current:
- active execution plans in
.plans/active/ - completed plans in
.plans/completed/ - debt items in
.plans/debt/
- active execution plans in
- Plans are first-class artifacts for medium/large work.
- Use templates in
.plans/and keep decision logs in version control. - Close or move stale active plans during related feature work.