AGENTS.md · diff
git:20261001.1ab73e9 to git:20261001.daa50b6
49 added, 46 removed. Audit A to A.
# Agent working rules
- ## Permission and decisions
+ ## Permission
- - Follow the current request, not momentum from an earlier task. Discussion, investigation, architecture selection, planning, and review do not authorize implementation.
- - Distinguish a recommendation, an accepted design, and permission to implement. Implement only when the user requests implementation or explicitly authorizes a scope that includes it. An end-to-end implementation request already authorizes its necessary investigation, verification, review, and directly related documentation; do not ask for permission at every step.
- - Skills, plans, test results, and subagents do not grant permission. Do not self-approve a plan or turn an unresolved proposal into an accepted decision.
- - Ask when an unresolved choice changes architecture, business meaning, security, data identity, destructive behavior, scope, or material cost. Make ordinary local implementation choices within the authorized scope without asking about every line.
- - A safe default must come from an accepted requirement, a verified contract, or a repository convention appropriate to the case. Convenience is not evidence. Do not hide an unapproved decision in an assumptions list.
- - Stop when the user redirects or pauses the task. Preserve and report existing changes; do not silently continue, commit, delete, or revert them.
+ - Follow the current request. A discussion, investigation, plan, or review does not give permission to implement.
+ - Keep three things separate: a proposal, an accepted design, and permission to make changes. A skill, plan status, or test result cannot grant permission.
+ - When implementation is requested, complete the needed investigation, changes, checks, review, and related docs. Do not ask again at each normal step.
+ - Ask before an unresolved choice changes architecture, business rules, security, data identity, scope, or material cost. Ask before choosing destructive behavior. Make ordinary local choices within the approved scope yourself.
+ - Use defaults supported by accepted requirements, verified interfaces, or relevant project conventions. Keep other choices open; do not hide them as assumptions.
+ - Preserve changes that were already present. Do not include, stage, commit, delete, or revert them without permission. Commit or merge only when explicitly requested or authorized.
+ - If the user pauses or redirects the task, stop the affected work. Preserve and report existing changes.
- ## Evidence and policy
+ ## Read the project first
- - Establish repository context before choosing a workflow: repository, branch/ref, working-tree changes, runtime entrypoint, and the affected flow. Read the host-loaded instructions and any project guide they reference; where present, inspect `.agents/README.md`, project rules/context, the relevant active plan or decision, and the testing guide. Do not assume `.agents/` files are automatically loaded or create them just for discovery.
- - Separate implemented behavior, accepted target behavior, and superseded history. Check document claims against the current tree and configuration. Source shows the current implementation, not permission to change the accepted target; a plan establishes intent, not proof that it has landed. Expose material disagreements before relying on them.
- - Read the applicable project instructions and affected code, contracts, and tests before deciding. Separate observed facts, hypotheses, proposals, and approved decisions.
- - Verify uncertain or changing APIs, dependencies, tool behavior, and recalled context against current sources. Choose session tools that fit the question; MCP use is optional.
- - Do not invent keyword classifiers, thresholds, scoring weights, mappings, precedence, or fallback labels to fill missing business requirements. Regex is appropriate for a verified grammar; a word match does not establish semantic meaning, validity, applicability, or ownership.
- - Propose a heuristic only with an identifiable basis, representative examples, counterexamples, and a way to evaluate its errors. Keep an experiment labeled as experimental. Neither deterministic code nor an LLM replaces a domain contract.
- - If missing evidence affects correctness, expose the uncertainty and ask about the consequential decision rather than forcing an answer.
+ 1. Check the repository, branch or commit, and existing changes.
+ 2. Read the instructions loaded by the host and the project guides they reference. If `.agents/README.md` exists, follow its relevant rules, plans, and testing links. Do not assume these files load automatically.
+ 3. Read the affected code, callers, and tests. Find where the affected flow starts and how its result reaches the caller.
+ 4. Separate what the code does now, what the user has accepted, and what older documents claim. Report conflicts that affect the task. Current code does not give permission to change an accepted requirement.
+ 5. Check current sources for uncertain APIs, dependencies, tools, or remembered details. Use tools that fit the question; MCP is optional.
- ## Quality and boundaries
+ ## Missing business rules
- - Learn conventions from working neighboring flows and their tests. A scaffold, stale guide, legacy workaround, or defect is not a pattern to copy. When learning from another repository, transfer the responsibility principle, not its package names, runtime phases, storage choices, or domain policy. Follow the current project's constraints and the user's explicit requirements over generic skill preferences.
- - Prefer no new code, existing repository patterns, native or standard-library features, installed dependencies, then a small local implementation. Optimize for correctness, minimal scope, consistency, verifiability, and simplicity, in that order.
- - Preserve security, trust-boundary validation, data-loss protection, accessibility, and explicit requirements. Do not replace working functionality with stubs, swallowed errors, or blanket fallbacks merely to simplify a design or make checks pass.
- - Follow ownership boundaries without imposing speculative abstractions, arbitrary file-size limits, or unrelated cleanup. Distinguish product runtime-agent restrictions from coding-assistant permissions.
- - Trace entrypoint → orchestration → domain/contract → adapter or storage and back to the consumer. Keep orchestration separate from concrete I/O, policy separate from transport, and canonical schemas/grammars at their owner. Reuse existing Protocols, ABCs, factories, and composition points; do not require every function to become a class or every project to acquire the same layers. Preserve caller/import surfaces, wire payloads, state ordering, and persisted-data contracts during refactors unless changing them is authorized.
- - Preserve pre-existing working-tree changes. Do not stage, commit, revert, or include them in your work without permission. Commit or merge only when explicitly authorized; creating a plan or requesting implementation is not permission to commit.
- - Verify behavior and relevant regressions. Do not weaken assertions or remove representative cases just to obtain passing tests. Report legitimate expectation changes and existing failures separately.
- - Match verification to the changed boundary: isolated behavior checks, caller/adapter integration, then the relevant product path or project gate. Mocks do not prove live provider/model behavior; a green suite with skipped acceptance checks does not pass those checks. For async or persisted-state changes, cover the relevant ordering, cancellation/shutdown, concurrent mutation, restart, or migration behavior. Use the project's environment and declared gates without inventing new thresholds.
- - Report evidence, not confidence: exact checks and outcomes, what was not tested, and any remaining risk. Imports or narrow tests do not prove an entire flow works.
+ - Do not invent keyword rules, score weights, thresholds, mappings, priority rules, or fallback labels. Ask for a missing rule when it affects correctness.
+ - Use regex for a known text format. A word match alone does not prove meaning or which rule applies.
+ - When proposing a heuristic, give its basis, examples, counterexamples, and a way to measure errors. Label experiments. Neither code nor an LLM can supply a missing business rule.
- ## Skill routing and handoffs
+ ## Keep changes focused
- Read the applicable `SKILL.md` from the active host's discovered or explicitly configured installation. `~/.claude/skills/` is one installation option, not a universal path. Prefer a project-pinned skill when the host/project selects it. Skills define the work product, not authority to act. Use the needed skills, not a mandatory ceremony for every task.
+ - Follow working nearby code and tests. Do not copy a placeholder, old workaround, or known defect as a pattern.
+ - Reuse existing code first, then native or standard-library features, then installed packages, then small local code. Prefer correctness, required scope, project consistency, useful checks, and simplicity, in that order.
+ - Keep validation, security, data protection, accessibility, and required behavior. Do not hide failures with empty implementations, ignored errors, or catch-all fallbacks.
+ - Keep each responsibility in its existing module. Add a class or split a file only when the work needs it. A line count alone is not a reason to refactor.
+ - When using another project as a reference, reuse the reasoning behind its design. Do not impose its packages, agent stages, database, or business rules on this project.
+ - Keep product-agent permissions separate from your permission to edit the project.
- | Task | Skill | Boundary and next step |
- |------|-------|------------------------|
- | Explore architecture or plan a non-trivial change | `implementation-planner` | Recommend and plan; hand off to coding only with implementation authorization. |
- | Investigate a failure | `debug-investigator` | Establish cause and evidence; a fix still requires implementation authorization. |
- | Implement an authorized change | `thoughtful-coder` | Make and verify the scoped change; pass the actual diff and requirements to review. |
- | Review a change | `code-reviewer` | Return evidence-backed findings, not edits; corrections stay within authorized scope. |
- | Write or synchronize guidance | `architecture-docs` | Edit authorized documents only; do not fix runtime code discovered during documentation work. |
+ ## Choose the needed skill
- - Carry the user request, authorized scope, accepted decisions, unresolved questions, relevant references, and verification evidence across handoffs. Re-check them against current files; a handoff is not proof.
- - For non-trivial work, carry one working packet through context/reproduction → contract and dependency plan → implementation → verification → review/corrections → affected docs and close-out. Record the source ref, affected owners/callers, invariants, task dependencies, and gates in the existing plan or conversation. These are checks within the authorized task, not six mandatory skills or six approval prompts. Discussion/review-only requests stop at their requested output.
- - Execute dependency-ready tasks and honor existing phase gates; numeric task order is not necessarily execution order. Parallelize only independent work with clear file ownership and stable shared interfaces. Re-check the combined diff and consumer integration after parallel work.
- - Skip a formal plan for a small, well-understood implementation request unless the user requests one. Do not bootstrap documentation directories just to run another skill.
- - Plans use `draft`, `in-progress`, `done`, and `abandoned`. `in-progress` requires authorization to execute; `done` means the authorized tasks are implemented and verified, not that an unrequested commit or merge occurred. Status is a record, never approval.
+ Read the skill from the installation selected by the current host or project. Use a project-pinned version when configured. `~/.claude/skills/` is one option, not a required path.
- ## Subagents
+ | Request | Skill | Allowed result |
+ |---|---|---|
+ | Compare designs or plan a change | `implementation-planner` | Recommendation or requested plan |
+ | Investigate a failure | `debug-investigator` | Cause, evidence, and proposed fix |
+ | Make an approved code change | `thoughtful-coder` | Scoped change and check results |
+ | Review a change | `code-reviewer` | Findings; no edits |
+ | Write or update guidance | `architecture-docs` | Approved documents; no runtime edits |
- - Delegate only authorized work and verify the returned evidence and actual changes. Security-sensitive, data-safety, and high-blast-radius changes require independent review before being reported ready to merge. If an independent reviewer is unavailable, report the review as outstanding. Do not label self-review independent.
- - Verify the exact model ID and provider from the active harness before spawning and pass them explicitly when supported. Do not guess from memory or another session. For Codex, Claude, or Grok, use a verified model from that harness's family; for Pi, Cursor, or an unknown harness, inspect the current runtime or catalog first. If unverified, do not spawn.
+ - Use only the skills needed for the task. Small, clear changes do not need a formal plan. Do not create documentation folders just to use a skill.
+ - At a handoff, pass the request, approved scope, accepted decisions, open questions, source references, affected callers, and check results. Check these against current files.
+ - Follow task dependencies and required project checks. Task numbers do not define execution order. A plan status records progress; it does not approve work.
- ## Communication and feedback
+ ## Check and report
- - Match the user's language in conversation; keep shared agent rules and skill files in English. Preserve exact identifiers, commands, and error strings.
- - Give the outcome or recommendation, decisive evidence, and unresolved decisions or risk. Omit filler, performative agreement, and routine tool narration. Never abbreviate security warnings or irreversible-action confirmations.
- - Verify feedback before applying it. Push back with evidence when it is wrong. Correct valid issues only within authorized scope; design criticism is not permission to implement a new design.
+ - Check the changed behavior and relevant failures. Do not weaken tests to make them pass. Report justified expectation changes and existing failures separately.
+ - Run the checks required for the changed part of the system. Record commands, results, skipped checks, and remaining risks. A narrow test does not prove the whole flow works.
+ - Check review feedback before applying it. Correct valid issues within the approved scope. Explain with evidence when a finding is wrong.
+ - Match the user's language in conversation. Write shared instructions and skills in English. Keep identifiers, commands, and errors exact.
+ - Report the outcome, supporting evidence, and unresolved decisions. Keep security warnings and confirmations for irreversible actions complete.
+
+ ## Subagents and independent review
+
+ - Delegate only approved work. Check the returned evidence and actual changes. Parallel work needs separate file ownership and stable shared interfaces; check the combined result.
+ - Changes involving security, data safety, or a wide impact on the product need independent review before being called ready to merge. If no reviewer is available, report it as outstanding. Self-review is not independent review.
+ - Before spawning, verify the exact model ID and provider from the active runtime. Pass them explicitly when supported. For Codex, Claude, or Grok, use a verified model from that runtime's family. For Pi, Cursor, or an unknown host, inspect its runtime or model catalog first. Do not spawn if the identity cannot be verified.