From 8cd3478bc0898004f822e432b8ae9110cb6f81c5 Mon Sep 17 00:00:00 2001 From: chihlasm Date: Sat, 7 Mar 2026 01:59:12 -0500 Subject: [PATCH] docs: add lessons learned for full-stack integration, Anthropic retries, model tiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #49 Always verify frontend consumes backend response fields #50 Anthropic SDK max_retries=1 to avoid 3× timeout #51 AI model tier routing via settings.get_model_for_action() Co-Authored-By: Claude Opus 4.6 --- CLAUDE.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 6df966f9..80830aa6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -333,6 +333,12 @@ navigate(`/trees/${newTree.id}/edit`) **48. Three chat input components:** `ChatInput.tsx` (Flow Assist/AI Chat Builder), `CopilotPanel.tsx` (in-session copilot side panel), `AssistantChatPage.tsx` (standalone AI assistant). All use Shift+Enter for newlines, Enter to send. +**49. Full-stack features — verify both ends:** When adding a field to a backend API response (e.g., `working_tree` in `AIChatMessageResponse`), always verify the frontend consumer actually reads and uses it. Similarly, when a frontend hook/component expects data from an API, confirm the backend populates it. Check the full data flow: schema → endpoint → API client → hook → store → UI. + +**50. Anthropic SDK retry behavior:** Default `max_retries=2` with exponential backoff can cause requests to take 3× the timeout (e.g., 45s × 3 = 135s). Set `max_retries=1` in `AnthropicProvider` to fail fast. Current timeout is `AI_REQUEST_TIMEOUT_SECONDS=120`. + +**51. AI model tier routing:** `config.py` has `AI_MODEL_TIERS` (fast/standard) and `ACTION_MODEL_MAP` mapping action types to tiers. Use `settings.get_model_for_action(action_type)` to resolve concrete model names. Model IDs must be valid — use alias form (`claude-sonnet-4-6`) not invented dated forms. + --- ## RBAC & Permissions