Skip to content

Codify per-protocol vs. prepare_custom_call cutoff rule in CLAUDE.md #651

Description

@szhygulin

Adopted from #638 / #645. The research recommendation was (c) hybrid — keep per-protocol prepare_* for flows that encode prepare-time invariants, route the long tail through prepare_custom_call. The cutoff rule needs a written home so future protocol-add decisions don't re-litigate the same question.

Cutoff rule (verbatim from #645's research note)

Keep a per-protocol prepare_* when the tool encodes any of:

  1. Slippage / MEV math (swap-class)
  2. Protocol-pause / cap / threshold preconditions (lending-class)
  3. Approve+action bundling with burn-address + unlimited-approval gates
  4. Durable-binding to a verified candidate (Inv Add TRON Phase 1: read-only balances + portfolio integration #15 — validator, market, bank, comet, ATA)
  5. Non-standard token semantics (rebasing, fee-on-transfer)

Otherwise route the agent to prepare_custom_call. The cutoff is structural, not popularity-based: a Uniswap V3 collect that doesn't take slippage args could legitimately go generic; a brand-new Layer-N farm that takes a min-out arg should not.

Why this is the right home

Project CLAUDE.md (/home/szhygulin/dev/recon-mcp/CLAUDE.md) already carries the project-specific gate rules (Pre-Sign Gate Surface Sweeps, Typed-Data Signing Discipline, Cross-Repo Scope Splits). The cutoff rule is the same shape: a structural decision that future contributors / agents need to apply when scoping new protocol coverage. ROADMAP.md tracks individual protocol adds; it isn't where structural meta-rules live.

Threat-model rationale (for the rule body)

assertTransactionSafe blocks 4 (catch-all unknown destination) and 5 (per-destination ABI-selector check) are bypassed for ack-stamped prepare_custom_call txs; only blocks 2 (approve spender allowlist) and 3 (transfer on unknown token) still fire. Per-protocol tools concentrate prepare-time invariants the generic path cannot enforce — picking prepare_custom_call for a new protocol that meets criteria 1–5 silently drops those invariants behind a single ack.

Scope

  • Add a "Per-protocol vs. generic-call cutoff" section to project CLAUDE.md with the 5-criterion rule and the threat-model one-liner.
  • No code change.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions