diff --git a/CLAUDE.md b/CLAUDE.md index f803cf26..6df966f9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -313,7 +313,7 @@ navigate(`/trees/${newTree.id}/edit`) **38. Alembic migrations MUST use sequential numbered prefixes:** Check `backend/alembic/versions/` for the highest numbered migration and use the next number. Format: `XXX_descriptive_name.py` (e.g., `040_add_whatever.py`). NEVER use auto-generated revision IDs like `0f1ca2af3647`. Always pass `--rev-id` flag: `alembic revision --autogenerate -m "desc" --rev-id=040`. -**41. Assistant chat uses local React state, not a Zustand store:** `AssistantChatPage.tsx` manages `chats`, `activeChatId`, `messages`, `input`, `loading` as `useState`. The `aiChatStore.ts` is for the AI Chat Builder (tree generation), NOT the standalone assistant. Don't look for a store when modifying assistant chat. +**41. Assistant chat uses local React state, not a Zustand store:** `AssistantChatPage.tsx` manages `chats`, `activeChatId`, `messages`, `input`, `loading` as `useState`. Don't look for a store when modifying assistant chat. **42. Public pages use raw `fetch()`, not `apiClient`:** Survey, shared sessions, and other no-auth pages call the API directly via `fetch()` with `${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/api/v1/...`. Don't use `apiClient` — it requires auth tokens and uses relative paths. @@ -323,7 +323,11 @@ navigate(`/trees/${newTree.id}/edit`) **45. Intake form field schema uses `variable_name` and `field_type`:** NOT `name` and `type`. Pattern: `{"variable_name": "server_name", "label": "Server Name", "field_type": "text", "required": true, "display_order": 1}`. Used in `tree_validation.py` and AI prompt examples. -**46. `CreateFlowDropdown` navigates directly to Flow Assist:** No `onOpenAIBuilder` callback — it uses `navigate('/ai/chat?type=procedural')` etc. The `AIFlowBuilderModal` is the old wizard modal (separate from the chat-based Flow Assist page at `/ai/chat`). +**46. `CreateFlowDropdown` uses `AIPromptDialog` for AI-assisted creation:** Opens a simple prompt dialog modal (not a separate page). The dialog starts an AI session, generates the flow, imports it, and navigates to the editor with `{ state: { aiPanelOpen: true, sessionId } }`. The old standalone `/ai/chat` page and `AIFlowBuilderModal` have been removed. + +**47. Editor-Embedded Flow Assist architecture:** AI assistance is embedded in each editor via `EditorAIPanel` (320px side panel) + `useEditorAI` hook + `ContextMenu`. Tree editor: panel replaces node editor panel (single-panel rule). Procedural editor: panel sits alongside step list (flex layout). Ghost nodes/steps use `_suggestion: true` flag with dashed borders + accept/dismiss controls. Action types (`generate_branch`, `modify_node`, `add_steps`, etc.) route to model tiers via `settings.get_model_for_action()`. Delta responses use `[DELTA]...[/DELTA]` markers. Suggestion audit trail in `ai_suggestions` table. + +**48. Tree orphan validation uses dynamic root ID:** `treeEditorStore.ts` orphan check compares against `state.treeStructure?.id` (NOT hardcoded `'root'`). AI-generated trees use descriptive root IDs like `"verify-account-exists"`. **47. AI provider architecture:** `AI_PROVIDER` in `config.py` selects `"anthropic"` or `"gemini"`. `get_ai_provider()` in `ai_provider.py` returns the configured provider with automatic fallback. `assistant_chat_service.py` calls Anthropic directly (with prompt caching + MCP), while copilot and Flow Assist go through the generic provider abstraction. diff --git a/CURRENT-STATE.md b/CURRENT-STATE.md index 75925e64..2008e8a1 100644 --- a/CURRENT-STATE.md +++ b/CURRENT-STATE.md @@ -86,6 +86,7 @@ | Task | Status | Notes | |------|--------|-------| +| Editor-Embedded Flow Assist | In Progress | AI panel in tree + procedural editors, ghost node suggestions, action-type routing | | Step Library Frontend | In Progress | Backend complete, frontend UI pending | | Procedural Flows Lifecycle | In Progress | Resume support done, full run chooser/reuse pending | | Tree Forking UI | Planning | Backend schema complete (migration 022) |