# AGENTS.md — Agent Skill Routing for ORGII This file orients Codex / orgii agents working in this repo. It tells you **which audit / methodology skill to invoke** for which kind of task, and what to deliver before declaring work done. > Test conventions — where a test file belongs, how to name it, and what each > suite actually runs — live in `.github/CONTRIBUTING.md` under **Where tests live**. > This file does not restate them; it is about skill routing. Skill routing is **advisory**; use judgment based on PR size and risk. Explicit implementation conventions and delivery contracts below still apply, including when an audit is skipped. --- ## Skill Routing Table | Scenario | Skill to invoke | When | | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | Rust / TypeScript architecture, types, dead code, FSM, naming overload, wire protocol, init parity | `architecture-audit` | Before finalizing a refactor plan; before cleanup/unification PRs; when reviewing a domain rewrite | | Frontend UI consistency, design-system component usage, arbitrary Tailwind values, a11y basics, visual-pattern duplication | `frontend-ui-audit` | Before delivering a PR that touches `*.tsx` under `src/components/` or `src/modules/**/components/` (component refactors, UI cleanup batches) | | React performance, re-renders, async waterfalls, bundle size, heavy dependencies, virtualization, high-frequency events | `react-best-practices` | For performance-focused React implementation/review; not for routine styling, copy, or single-file bug fixes without a performance concern | | Both architecture and React performance change together | Run both, keep findings categorized | Apply `architecture-audit` to ownership/boundaries and `react-best-practices` to measured React runtime concerns | | E2E test surface (Playwright / WebDriver), test stability | `e2e-testing` | When adding or repairing rendered E2E specs | | Polling, timers, caches, subscriptions, workers, streaming, sync, scans, pagination, multi-instance lifecycle | `org2-performance-guard` | Before delivering any change that can consume CPU/RAM/I/O while active, idle, hidden, or across repeated open/close cycles | Skills live at: - `.orgii/skills/architecture-audit/SKILL.md` (workspace) - `.orgii/skills/frontend-ui-audit/SKILL.md` (workspace) - `.orgii/skills/react-best-practices/SKILL.md` (workspace; ORGII overlay for Vercel's React guidance) - `.orgii/skills/e2e-testing/SKILL.md` (workspace) - `.orgii/skills/dual-instance-verification/SKILL.md` (workspace; two-device verification protocol for cloud sync / sharing) - `.orgii/skills/org2-performance-guard/SKILL.md` (workspace) If the skill block isn't already prefetched in your context, read its `SKILL.md` before acting on it. --- ## Root-Cause-First Bug Fixing When malformed, stale, duplicated, or unexpected data appears in the UI: 1. **Do not start with a UI filter, hidden row, fallback label, or string-pattern special case.** First determine whether the value is real persisted/remote domain data or only a presentation defect. 2. Identify the authoritative source, inspect the actual stored payload, and trace every transformation and writer back to the earliest boundary that created the invalid state. 3. Fix the invariant at that authoritative boundary: user-input parsing, API/RPC ingestion, persistence write, sync reconciliation, or canonical state projection. 4. Add a regression test at the producing boundary proving the invalid state can no longer be created. A selector/render test alone is not sufficient. 5. Treat historical pollution separately: inventory dependent data, get confirmation before destructive cleanup, perform the narrowest cleanup, then read back the authoritative source. 6. UI filtering is allowed only when exclusion is an explicit product requirement or defense-in-depth **after** the source fix. It must never be the sole fix for invalid upstream data. 7. Do not change adjacent valid behavior unless the user explicitly requests it. Before declaring the issue fixed, report the authoritative source, root cause, producing write path, source-level invariant, historical remediation, and verification evidence. Review gate: any UI predicate introduced to hide malformed data must cite an explicit product requirement. If the value violates the domain model, reject the UI-only patch until the producing path is fixed and covered by a regression test. --- ## Default Delivery Flow ### Documentation language - Write repository documentation, audit reports, plans, handoffs, and agent instructions in English. - Preserve exact non-English UI copy and test data when they are evidence. Localized README and wiki editions remain language-specific artifacts. ### UI copy conventions - Settings-row descriptions must not end in sentence-ending punctuation (`.` or `。`) in any locale. Internal punctuation between sentences is allowed. ### Shared Button convention - Production React action buttons MUST use `Button` from `@src/components/Button`, or an existing reusable control built on it. Do not introduce raw `