Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 2.95 KB

File metadata and controls

68 lines (47 loc) · 2.95 KB

CLAUDE.md

How an agent should behave and operate in this repo.

Documentation System

Use docs in this order:

  1. AGENTS.md (root): map of the repository and where to look next.
  2. Module docs (README.md or local AGENTS.md): module behavior and local constraints.
  3. docs/*.md: deeper architecture and protocol context.

Each layer has a separate purpose:

  • CLAUDE.md: agent operating rules for this repository.
  • Module docs: what must be understood to make a safe change in that module.
  • docs/: background and deeper design context.

Required Workflow

Before writing code:

  1. Read root AGENTS.md.
  2. Read docs for every module you will touch.
  3. Confirm how behavior is validated in tests for that module.

Before opening a contribution:

  1. Read CONTRIBUTING.md.
  2. Follow STYLE.md.
  3. Follow Conventional Commits guidance from CONTRIBUTING.md.
  4. Read the Developers section in the root README.md.

Non-Negotiable Rules

  • Prefer minimal, local diffs over cross-cutting refactors.
  • Preserve current behavior unless the task explicitly asks for behavior changes.
  • Do not silently change risk-sensitive defaults (profitability, finality, rebalancing thresholds).
  • If a change affects money movement logic, include explicit validation steps.
  • Keep docs updated in the same change when behavior changes.

Ambiguity and Escalation

Stop and ask for clarification if any of the following are true:

  • The change crosses multiple module boundaries and design intent is unclear.
  • You find conflicting patterns across modules and cannot infer the canonical one.
  • A module appears to be in active refactor and interfaces are unstable.
  • The change modifies signing, transfer, fill, refund, or finalization behavior.
  • The right success criteria or test coverage is unclear.
  • A behavior-sensitive conclusion depends on assumptions that have not been verified in code paths or tests.

Planning and Documentation Evolution

  • Before writing a plan, identify any meaningful ambiguities and ask for clarification first.
  • For every new task, explicitly propose 0-3 concrete updates to CLAUDE.md and/or relevant AGENTS.md files, or state "no updates needed" with a brief reason.
  • When creating deep-dive docs, include discoverability updates in the same change (relevant README.md links and, when useful, AGENTS.md quick index entries).
  • Default deep-dive docs to cross-module coverage when behavior spans module boundaries; avoid single-file explanations for multi-module flows.
  • Default deep-dive docs to a "current behavior first" structure with a concise contributor recommendations section at the end.

Validation Expectations

After code changes:

  • Run targeted checks for edited modules first.
  • Run broader tests when shared clients, interfaces, or config parsing is changed: yarn test.
  • Lint via yarn lint-fix.
  • Report exactly what was run and anything intentionally not run.