Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

perf(posthog-ai): move ai panel ids off the eager path (#126327)

Paul D'Ambra845e1cca1199
diff --git a/frontend/src/layout/ai/aiPanelIds.ts b/frontend/src/layout/ai/aiPanelIds.ts
new file mode 100644
index 000000000000..4a90e689869c
--- /dev/null
+++ b/frontend/src/layout/ai/aiPanelIds.ts
@@ -0,0 +1,23 @@
+// Dependency-free ids shared by the app shell and PostHog AI. Shell code imports them from here, so it does
+// not statically load the AI panel components or the signals inbox logics to read a string.
+
+// The client-side key for the embedded `taskTrackerSceneLogic` (and paired `runnerPanelLogic`) instance
+// this panel binds. It stays stable so the panel keeps the same in-flight run across re-renders of its host.
+export const MAX_SIDE_PANEL_ID = 'max-side-panel'
+
+// Fixed panelId for the floating side panel chat, which is not a scene tab.
+export const SIDE_PANEL_PANEL_ID = 'sidepanel'
+
+/** The side panel option that shows the report chat. It round-trips through the URL hash. */
+export const REPORT_AI_PANEL = 'inbox-report'
+
+/** The side panel option that shows the scout chat. It round-trips through the URL hash. */
+export const SCOUT_AI_PANEL = 'inbox-scout'
+
+/**
+ * Which PostHog AI implementation the Max scene renders. `'new'` is the posthog_ai/frontend surface
+ * (the tasks product on `/ai`, the new composer + thread viewer in the side panel); `'legacy'` is the
+ * existing Max chat. Only meaningful while the `PHAI_SANDBOX_MODE` flag is on. See `effectivePhaiView`
+ * in `maxGlobalLogic`.
+ */
+export type PhaiViewMode = 'new' | 'legacy'
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/max/SidePanelMax.test.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/max/SidePanelMax.test.tsx
index 8933a5e2f5a2..e94b1573c9c3 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/max/SidePanelMax.test.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/max/SidePanelMax.test.tsx
@@ -1,8 +1,9 @@
import { cleanup, render, screen } from '@testing-library/react'
import { Suspense } from 'react'
-import { SIDE_PANEL_PANEL_ID, maxLogic } from 'scenes/max/maxLogic'
+import { maxLogic } from 'scenes/max/maxLogic'
+import { SIDE_PANEL_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { initKeaTests } from '~/test/init'
import { SidePanelMax } from './SidePanelMax'
diff --git a/frontend/src/layout/scenes/components/SceneTitleSection.tsx b/frontend/src/layout/scenes/components/SceneTitleSection.tsx
index e65a558cebcc..fda93020ebb0 100644
--- a/frontend/src/layout/scenes/components/SceneTitleSection.tsx
+++ b/frontend/src/layout/scenes/components/SceneTitleSection.tsx
@@ -14,7 +14,7 @@ import { TextareaPrimitive } from 'lib/ui/TextareaPrimitive/TextareaPrimitive'
import { WrappingLoadingSkeleton } from 'lib/ui/WrappingLoadingSkeleton/WrappingLoadingSkeleton'
import { cn } from 'lib/utils/css-classes'
import { AnimatedSparkles } from 'scenes/max/components/AnimatedSparkles'
-import { UseMaxToolOptions } from 'scenes/max/useMaxTool'
+import type { UseMaxToolOptions } from 'scenes/max/useMaxTool'
import { sceneLogic } from 'scenes/sceneLogic'
import { breadcrumbsLogic } from '~/layout/navigation/Breadcrumbs/breadcrumbsLogic'
diff --git a/frontend/src/layout/today/TodayAiPanel.tsx b/frontend/src/layout/today/TodayAiPanel.tsx
index 0634ba0eab74..08a247b1468a 100644
--- a/frontend/src/layout/today/TodayAiPanel.tsx
+++ b/frontend/src/layout/today/TodayAiPanel.tsx
@@ -8,12 +8,10 @@ import { PhaiSidePanelChat } from 'scenes/max/components/PhaiSidePanelChat'
import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
import { sidePanelMaxLogic } from 'scenes/max/maxLogic'
+import { REPORT_AI_PANEL, SCOUT_AI_PANEL } from '~/layout/ai/aiPanelIds'
import { SidePanelMax } from '~/layout/navigation-3000/sidepanel/panels/max/SidePanelMax'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
-import { REPORT_AI_PANEL } from 'products/signals/frontend/inbox/inboxTaskKickoffLogic'
-import { SCOUT_AI_PANEL } from 'products/signals/frontend/inbox/logics/scoutAiLogic'
-
export function TodayAiPanel(): JSX.Element {
const { isMaxAvailable, effectivePhaiView } = useValues(maxGlobalLogic)
const { selectedTabOptions } = useValues(sidePanelStateLogic)
diff --git a/frontend/src/layout/today/todayAiChatLogic.ts b/frontend/src/layout/today/todayAiChatLogic.ts
index e32f333d33fc..9d0951d0b91a 100644
--- a/frontend/src/layout/today/todayAiChatLogic.ts
+++ b/frontend/src/layout/today/todayAiChatLogic.ts
@@ -3,20 +3,24 @@ import { router } from 'kea-router'
import type { LocationChangedPayload } from 'kea-router/lib/types'
import posthog from 'posthog-js'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
import { mainFocusUrl } from 'scenes/max/mainFocusUrl'
-import { PhaiViewMode, maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
-import { SIDE_PANEL_PANEL_ID, maxLogic } from 'scenes/max/maxLogic'
+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+import { maxLogic } from 'scenes/max/maxLogic'
import { urls } from 'scenes/urls'
+import {
+ MAX_SIDE_PANEL_ID,
+ REPORT_AI_PANEL,
+ SCOUT_AI_PANEL,
+ SIDE_PANEL_PANEL_ID,
+ type PhaiViewMode,
+} from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { SidePanelTab } from '~/types'
import { type ActiveCreation, runnerPanelLogic } from 'products/posthog_ai/frontend/api/logics'
import { attachedContextLogic } from 'products/posthog_ai/frontend/logics/attachedContextLogic'
import type { AttachedContextItem } from 'products/posthog_ai/frontend/types/contextTypes'
-import { REPORT_AI_PANEL } from 'products/signals/frontend/inbox/inboxTaskKickoffLogic'
-import { SCOUT_AI_PANEL } from 'products/signals/frontend/inbox/logics/scoutAiLogic'
import type { TaskActivityDTOApi } from '../../../../products/tasks/frontend/generated/api.schemas'
import { todayContextPanelLogic } from './todayContextPanelLogic'
diff --git a/frontend/src/layout/today/todayPanelChatSessionLogic.ts b/frontend/src/layout/today/todayPanelChatSessionLogic.ts
index 7853272d1014..93a9b6fe0ae2 100644
--- a/frontend/src/layout/today/todayPanelChatSessionLogic.ts
+++ b/frontend/src/layout/today/todayPanelChatSessionLogic.ts
@@ -1,6 +1,6 @@
import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { type ActiveCreation, runnerPanelLogic } from 'products/posthog_ai/frontend/api/logics'
diff --git a/frontend/src/layout/today/todayShellLogic.ts b/frontend/src/layout/today/todayShellLogic.ts
index 015bcacf248c..0c438cd2bbb4 100644
--- a/frontend/src/layout/today/todayShellLogic.ts
+++ b/frontend/src/layout/today/todayShellLogic.ts
@@ -10,10 +10,11 @@ import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { isUnderPath, removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { fromPostHogProducts } from 'scenes/analytics/analyticsUtils'
import { libraryTypeForPath } from 'scenes/library/libraryUtils'
-import { PhaiViewMode, maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
import { settingsSectionSceneForPath } from 'scenes/settings/settingsSectionScenes'
import { urls } from 'scenes/urls'
+import type { PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { navigationLogic } from '~/layout/navigation/navigationLogic'
import { getNavProductPages, navProductHrefForPath } from '~/layout/panel-layout/navbar/tabs/navProductItems'
import { FileSystemImport } from '~/queries/schema/schema-general'
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 13803cc4e103..97331fcb354c 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -25,7 +25,7 @@ import { toParams } from 'lib/utils/url'
import { CohortCalculationHistoryResponse } from 'scenes/cohorts/cohortCalculationHistorySceneLogic'
import { EventSchema } from 'scenes/data-management/events/eventDefinitionSchemaLogic'
import { SchemaPropertyGroup } from 'scenes/data-management/schema/schemaManagementLogic'
-import { MaxBillingContext } from 'scenes/max/maxBillingContextLogic'
+import type { MaxBillingContext } from 'scenes/max/maxBillingContextLogic'
import { NotebookListItemType, NotebookNodeResource, NotebookType } from 'scenes/notebooks/types'
import { RecordingComment } from 'scenes/session-recordings/player/inspector/playerInspectorLogic'
import { SURVEY_PAGE_SIZE } from 'scenes/surveys/constants'
@@ -229,7 +229,7 @@ import type {
ColumnConfigurationApi,
PaginatedColumnConfigurationListApi,
} from 'products/product_analytics/frontend/generated/api.schemas'
-import {
+import type {
SignalReport,
SignalReportArtefact,
SignalReportArtefactResponse,
diff --git a/frontend/src/lib/components/CommandKSearch/commandKSearchLogic.tsx b/frontend/src/lib/components/CommandKSearch/commandKSearchLogic.tsx
index 0022679cf5b5..87721277e49b 100644
--- a/frontend/src/lib/components/CommandKSearch/commandKSearchLogic.tsx
+++ b/frontend/src/lib/components/CommandKSearch/commandKSearchLogic.tsx
@@ -23,10 +23,10 @@ import { themeLogic } from 'lib/logic/themeLogic'
import posthog from 'lib/posthog-typed'
import { navigateToHref } from 'lib/utils/navigateToHref'
import { newInternalTab } from 'lib/utils/newInternalTab'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
import { teamLogic } from 'scenes/teamLogic'
import { userLogic } from 'scenes/userLogic'
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { groupsModel } from '~/models/groupsModel'
import { membersLogic } from '~/models/membersLogic'
diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
index 7bde40be0eeb..8b7a929539b4 100644
--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
@@ -87,7 +87,7 @@ import {
getProductEventFilterOptions,
getProductEventPropertyFilterOptions,
} from 'scenes/hog-functions/filters/productEventFilterOptions'
-import { MaxContextTaxonomicFilterOption } from 'scenes/max/maxTypes'
+import type { MaxContextTaxonomicFilterOption } from 'scenes/max/maxTypes'
import { NotebookType } from 'scenes/notebooks/types'
import { projectLogic } from 'scenes/projectLogic'
import { SavedFiltersTaxonomicGroup } from 'scenes/session-recordings/filters/SavedFiltersTaxonomicGroup'
diff --git a/frontend/src/lib/components/TaxonomicFilter/types.ts b/frontend/src/lib/components/TaxonomicFilter/types.ts
index 151e5072b077..103a870a73fa 100644
--- a/frontend/src/lib/components/TaxonomicFilter/types.ts
+++ b/frontend/src/lib/components/TaxonomicFilter/types.ts
@@ -4,7 +4,7 @@ import { ReactNode } from 'react'
import type { SeriesNode } from 'scenes/insights/filters/ActionFilter/seriesNode'
// eslint-disable-next-line import/no-cycle
-import { MaxContextTaxonomicFilterOption } from 'scenes/max/maxTypes'
+import type { MaxContextTaxonomicFilterOption } from 'scenes/max/maxTypes'
import { AnyDataNode, DatabaseSchemaField, DatabaseSerializedFieldType } from '~/queries/schema/schema-general'
import {
diff --git a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsx b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsx
index 515f9187064b..2353bbdbae13 100644
--- a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsx
+++ b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsx
@@ -16,7 +16,7 @@ import {
} from 'lib/components/TaxonomicFilter/types'
import { LemonButton, LemonButtonProps } from 'lib/lemon-ui/LemonButton'
import { LemonDropdown } from 'lib/lemon-ui/LemonDropdown'
-import { MaxContextTaxonomicFilterOption } from 'scenes/max/maxTypes'
+import type { MaxContextTaxonomicFilterOption } from 'scenes/max/maxTypes'
import { AnyDataNode, DatabaseSchemaField } from '~/queries/schema/schema-general'
diff --git a/frontend/src/scenes/feature-flags/NewFeatureFlagMenu.tsx b/frontend/src/scenes/feature-flags/NewFeatureFlagMenu.tsx
index cc41773369dd..5f058b12d919 100644
--- a/frontend/src/scenes/feature-flags/NewFeatureFlagMenu.tsx
+++ b/frontend/src/scenes/feature-flags/NewFeatureFlagMenu.tsx
@@ -18,10 +18,11 @@ import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic'
import { addProductIntentForCrossSell } from 'lib/utils/product-intents'
import { getToolDefinition } from 'scenes/max/max-constants'
-import { SIDE_PANEL_PANEL_ID, maxLogic } from 'scenes/max/maxLogic'
+import { maxLogic } from 'scenes/max/maxLogic'
import { createSuggestionGroup } from 'scenes/max/utils'
import { urls } from 'scenes/urls'
+import { SIDE_PANEL_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelLogic } from '~/layout/navigation-3000/sidepanel/sidePanelLogic'
import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
import { SidePanelTab } from '~/types'
diff --git a/frontend/src/scenes/feature-flags/QuillNewFeatureFlagMenu.tsx b/frontend/src/scenes/feature-flags/QuillNewFeatureFlagMenu.tsx
index fc8680544b19..051c1b8369cf 100644
--- a/frontend/src/scenes/feature-flags/QuillNewFeatureFlagMenu.tsx
+++ b/frontend/src/scenes/feature-flags/QuillNewFeatureFlagMenu.tsx
@@ -18,10 +18,11 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic'
import { addProductIntentForCrossSell } from 'lib/utils/product-intents'
-import { SIDE_PANEL_PANEL_ID, maxLogic } from 'scenes/max/maxLogic'
+import { maxLogic } from 'scenes/max/maxLogic'
import { createSuggestionGroup } from 'scenes/max/utils'
import { urls } from 'scenes/urls'
+import { SIDE_PANEL_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelLogic } from '~/layout/navigation-3000/sidepanel/sidePanelLogic'
import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
import { SidePanelTab } from '~/types'
diff --git a/frontend/src/scenes/max/Max.tsx b/frontend/src/scenes/max/Max.tsx
index 1886d3be7c82..c1fd457b8bf8 100644
--- a/frontend/src/scenes/max/Max.tsx
+++ b/frontend/src/scenes/max/Max.tsx
@@ -25,6 +25,7 @@ import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
import { SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
+import { MAX_SIDE_PANEL_ID, REPORT_AI_PANEL, SCOUT_AI_PANEL, SIDE_PANEL_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { SidePanelPaneHeader } from '~/layout/navigation-3000/sidepanel/components/SidePanelPaneHeader'
import { SidePanelContentContainer } from '~/layout/navigation-3000/sidepanel/SidePanelContentContainer'
import { sidePanelLogic } from '~/layout/navigation-3000/sidepanel/sidePanelLogic'
@@ -36,13 +37,11 @@ import { SidePanelTab } from '~/types'
import { runnerPanelLogic } from 'products/posthog_ai/frontend/api/logics'
import { DebugLogsMenu } from 'products/posthog_ai/frontend/api/primitives'
-import { REPORT_AI_PANEL } from 'products/signals/frontend/inbox/inboxTaskKickoffLogic'
-import { SCOUT_AI_PANEL } from 'products/signals/frontend/inbox/logics/scoutAiLogic'
import { AiFirstMaxInstance } from './components/AiFirstMaxInstance'
import { AnimatedBackButton } from './components/AnimatedBackButton'
import { MaxNotConfigured } from './components/MaxNotConfigured'
-import { MAX_SIDE_PANEL_ID, PhaiSidePanelChat } from './components/PhaiSidePanelChat'
+import { PhaiSidePanelChat } from './components/PhaiSidePanelChat'
import { PhaiViewToggle } from './components/PhaiViewToggle'
import { SidebarQuestionInput } from './components/SidebarQuestionInput'
import { SidebarQuestionInputWithSuggestions } from './components/SidebarQuestionInputWithSuggestions'
@@ -51,7 +50,7 @@ import { ConversationHistory } from './ConversationHistory'
import { HistoryPreview } from './HistoryPreview'
import { Intro } from './Intro'
import { mainFocusUrl } from './mainFocusUrl'
-import { MaxLogicProps, SIDE_PANEL_PANEL_ID, maxLogic } from './maxLogic'
+import { MaxLogicProps, maxLogic } from './maxLogic'
import { MaxThreadLogicProps, maxThreadLogic } from './maxThreadLogic'
import { SandboxComposerSurfaces, Thread } from './Thread'
diff --git a/frontend/src/scenes/max/Thread.tsx b/frontend/src/scenes/max/Thread.tsx
index 86045d776bec..897c018fde6d 100644
--- a/frontend/src/scenes/max/Thread.tsx
+++ b/frontend/src/scenes/max/Thread.tsx
@@ -19,6 +19,7 @@ import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { cn } from 'lib/utils/css-classes'
import { sceneLogic } from 'scenes/sceneLogic'
+import { SIDE_PANEL_PANEL_ID } from '~/layout/ai/aiPanelIds'
import {
AssistantMessage,
AssistantToolCallMessage,
@@ -64,7 +65,7 @@ import { DangerousOperationApprovalCard } from './DangerousOperationApprovalCard
import { FeedbackPrompt } from './FeedbackPrompt'
import { EnhancedToolCall, ToolRegistration, getToolDefinitionFromToolCall } from './max-constants'
import { maxGlobalLogic } from './maxGlobalLogic'
-import { SIDE_PANEL_PANEL_ID, ThreadMessage, maxLogic } from './maxLogic'
+import { ThreadMessage, maxLogic } from './maxLogic'
import { maxThreadLogic } from './maxThreadLogic'
import { AssistantMessageForm } from './messages/AssistantMessageForm'
import { MultiQuestionFormRecap } from './messages/MultiQuestionForm'
diff --git a/frontend/src/scenes/max/aiFirstCreate/AiFirstCreateScene.tsx b/frontend/src/scenes/max/aiFirstCreate/AiFirstCreateScene.tsx
index bf197509cd39..bf72f033679f 100644
--- a/frontend/src/scenes/max/aiFirstCreate/AiFirstCreateScene.tsx
+++ b/frontend/src/scenes/max/aiFirstCreate/AiFirstCreateScene.tsx
@@ -5,9 +5,10 @@ import { IconSparkles } from '@posthog/icons'
import { LemonBanner, LemonButton } from '@posthog/lemon-ui'
import { cn } from 'lib/utils/css-classes'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
import { SuggestionCard } from 'scenes/max/components/SuggestionCard'
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
+
import { runnerPanelLogic } from 'products/posthog_ai/frontend/api/logics'
import { SidePanelRunner } from 'products/posthog_ai/frontend/api/runner'
diff --git a/frontend/src/scenes/max/aiFirstCreate/aiFirstHandoffLogic.test.ts b/frontend/src/scenes/max/aiFirstCreate/aiFirstHandoffLogic.test.ts
index f29377676a0d..d45c7ed12d05 100644
--- a/frontend/src/scenes/max/aiFirstCreate/aiFirstHandoffLogic.test.ts
+++ b/frontend/src/scenes/max/aiFirstCreate/aiFirstHandoffLogic.test.ts
@@ -3,9 +3,9 @@ import { expectLogic } from 'kea-test-utils'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
import { maxMocks } from 'scenes/max/testUtils'
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
diff --git a/frontend/src/scenes/max/aiFirstCreate/aiFirstHandoffLogic.ts b/frontend/src/scenes/max/aiFirstCreate/aiFirstHandoffLogic.ts
index 70dd508f6b5a..f50a9ac34d8e 100644
--- a/frontend/src/scenes/max/aiFirstCreate/aiFirstHandoffLogic.ts
+++ b/frontend/src/scenes/max/aiFirstCreate/aiFirstHandoffLogic.ts
@@ -3,8 +3,8 @@ import { router } from 'kea-router'
import posthog from 'posthog-js'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { SidePanelTab } from '~/types'
diff --git a/frontend/src/scenes/max/aiSceneView.ts b/frontend/src/scenes/max/aiSceneView.ts
index 565b2fcce283..6e58ce0a101d 100644
--- a/frontend/src/scenes/max/aiSceneView.ts
+++ b/frontend/src/scenes/max/aiSceneView.ts
@@ -1,4 +1,4 @@
-import type { PhaiViewMode } from './maxGlobalLogic'
+import type { PhaiViewMode } from '~/layout/ai/aiPanelIds'
export interface AiSceneViewInput {
/** The task `/ai?task=` selects, if any. */
diff --git a/frontend/src/scenes/max/components/AiFirstMaxInstance.tsx b/frontend/src/scenes/max/components/AiFirstMaxInstance.tsx
index fb49acce5cd5..db0695c84489 100644
--- a/frontend/src/scenes/max/components/AiFirstMaxInstance.tsx
+++ b/frontend/src/scenes/max/components/AiFirstMaxInstance.tsx
@@ -10,6 +10,7 @@ import { copyToClipboard } from 'lib/utils/copyToClipboard'
import { cn } from 'lib/utils/css-classes'
import { urls } from 'scenes/urls'
+import type { PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { SceneName } from '~/layout/scenes/components/SceneTitleSection'
import { DROPDOWN_PARTS } from '~/layout/today/todayMenuParts'
import { TodayPanelMoveMenuItems } from '~/layout/today/TodayPanelMoveMenuItems'
@@ -22,7 +23,7 @@ import { EmbeddedRunner } from 'products/posthog_ai/frontend/api/runner'
import { aiSceneView } from '../aiSceneView'
import { Intro } from '../Intro'
-import { PhaiViewMode, maxGlobalLogic } from '../maxGlobalLogic'
+import { maxGlobalLogic } from '../maxGlobalLogic'
import { maxLogic } from '../maxLogic'
import { MaxThreadLogicProps, maxThreadLogic } from '../maxThreadLogic'
import { phaiAiComposerSeedLogic } from '../phaiAiComposerSeedLogic'
diff --git a/frontend/src/scenes/max/components/MaybePhaiOnboarding.tsx b/frontend/src/scenes/max/components/MaybePhaiOnboarding.tsx
index 133072585180..b163582723a1 100644
--- a/frontend/src/scenes/max/components/MaybePhaiOnboarding.tsx
+++ b/frontend/src/scenes/max/components/MaybePhaiOnboarding.tsx
@@ -3,13 +3,13 @@ import { useValues } from 'kea'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { sceneLogic } from 'scenes/sceneLogic'
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { AiOnboarding } from 'products/posthog_ai/frontend/api/onboarding'
import { maxGlobalLogic } from '../maxGlobalLogic'
import { resolvePhaiOnboardingMounts } from './phaiOnboardingHost'
-import { MAX_SIDE_PANEL_ID } from './PhaiSidePanelChat'
/**
* Mounts the PostHog AI onboarding takeover for whichever composers are on screen, and decides which of them
diff --git a/frontend/src/scenes/max/components/PhaiSidePanelChat.tsx b/frontend/src/scenes/max/components/PhaiSidePanelChat.tsx
index 4111635fb3cc..15c7b58d72ca 100644
--- a/frontend/src/scenes/max/components/PhaiSidePanelChat.tsx
+++ b/frontend/src/scenes/max/components/PhaiSidePanelChat.tsx
@@ -1,13 +1,11 @@
import { useMountedLogic } from 'kea'
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
+
import { SidePanelRunner } from 'products/posthog_ai/frontend/api/runner'
import { phaiSidePanelComposerSeedLogic } from '../phaiSidePanelComposerSeedLogic'
-// The client-side key for the embedded `taskTrackerSceneLogic` (and paired `runnerPanelLogic`) instance
-// this panel binds — stable so the panel keeps the same in-flight run across re-renders of its host.
-export const MAX_SIDE_PANEL_ID = 'max-side-panel'
-
/**
* The new posthog_ai side-panel experience: task-based, built on the `products/posthog_ai/frontend` runner
* surface (composer -> pending thread -> live run) rather than Max's conversation logics
diff --git a/frontend/src/scenes/max/components/PhaiViewSwitchMenuItem.tsx b/frontend/src/scenes/max/components/PhaiViewSwitchMenuItem.tsx
index d6b752f44bd4..f35367ae5b0d 100644
--- a/frontend/src/scenes/max/components/PhaiViewSwitchMenuItem.tsx
+++ b/frontend/src/scenes/max/components/PhaiViewSwitchMenuItem.tsx
@@ -3,7 +3,9 @@ import { useActions, useValues } from 'kea'
import { IconRevert, IconSparkles } from '@posthog/icons'
import { DropdownMenuItem } from '@posthog/quill'
-import { PhaiViewMode, maxGlobalLogic } from '../maxGlobalLogic'
+import type { PhaiViewMode } from '~/layout/ai/aiPanelIds'
+
+import { maxGlobalLogic } from '../maxGlobalLogic'
export function PhaiViewSwitchMenuItem({ onChange }: { onChange?: (mode: PhaiViewMode) => void }): JSX.Element | null {
const { isPhaiSandboxFlagOn, effectivePhaiView } = useValues(maxGlobalLogic)
diff --git a/frontend/src/scenes/max/components/PhaiViewToggle.tsx b/frontend/src/scenes/max/components/PhaiViewToggle.tsx
index 63d717a42bc3..d27e430a6d4e 100644
--- a/frontend/src/scenes/max/components/PhaiViewToggle.tsx
+++ b/frontend/src/scenes/max/components/PhaiViewToggle.tsx
@@ -5,7 +5,9 @@ import { LemonButton } from '@posthog/lemon-ui'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
-import { PhaiViewMode, maxGlobalLogic } from '../maxGlobalLogic'
+import type { PhaiViewMode } from '~/layout/ai/aiPanelIds'
+
+import { maxGlobalLogic } from '../maxGlobalLogic'
/**
* Switches the Max scene between the new posthog_ai/frontend surface and the legacy Max chat. Only
diff --git a/frontend/src/scenes/max/components/phaiOnboardingHost.ts b/frontend/src/scenes/max/components/phaiOnboardingHost.ts
index 9ac8d56387ed..33c7b61eea3f 100644
--- a/frontend/src/scenes/max/components/phaiOnboardingHost.ts
+++ b/frontend/src/scenes/max/components/phaiOnboardingHost.ts
@@ -1,9 +1,8 @@
import { Scene } from 'scenes/sceneTypes'
+import type { PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { SidePanelTab } from '~/types'
-import type { PhaiViewMode } from '../maxGlobalLogic'
-
/** The composer a takeover targets. */
export type PhaiOnboardingHost = 'scene' | 'side-panel'
diff --git a/frontend/src/scenes/max/maxGlobalLogic.test.ts b/frontend/src/scenes/max/maxGlobalLogic.test.ts
index 1b1c28618274..57bd21a3d6e2 100644
--- a/frontend/src/scenes/max/maxGlobalLogic.test.ts
+++ b/frontend/src/scenes/max/maxGlobalLogic.test.ts
@@ -7,6 +7,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { preflightLogic } from 'lib/logic/preflightLogic'
import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'
+import { SIDE_PANEL_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -14,7 +15,7 @@ import { tasksLogic } from 'products/posthog_ai/frontend/logics/tasksLogic'
import { TOOL_DEFINITIONS, ToolDefinition } from './max-constants'
import { STATIC_TOOLS, maxGlobalLogic } from './maxGlobalLogic'
-import { SIDE_PANEL_PANEL_ID, maxLogic } from './maxLogic'
+import { maxLogic } from './maxLogic'
import { MOCK_CONVERSATION, MOCK_CONVERSATION_ID, maxMocks } from './testUtils'
describe('maxGlobalLogic tool definitions', () => {
diff --git a/frontend/src/scenes/max/maxGlobalLogic.tsx b/frontend/src/scenes/max/maxGlobalLogic.tsx
index 210f978ec58f..e439f5e76398 100644
--- a/frontend/src/scenes/max/maxGlobalLogic.tsx
+++ b/frontend/src/scenes/max/maxGlobalLogic.tsx
@@ -16,6 +16,7 @@ import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
+import type { PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { Conversation, ConversationDetail, SidePanelTab } from '~/types'
@@ -30,13 +31,6 @@ import { TOOL_DEFINITIONS, ToolRegistration } from './max-constants'
import { PHAI_VIEW_MODE_KEY } from './max-storage-keys'
import { maxLogic, mergeConversationHistory, mergeConversations, sidePanelMaxLogic } from './maxLogic'
-/**
- * Which PostHog AI implementation the Max scene renders. `'new'` is the posthog_ai/frontend surface
- * (the tasks product on `/ai`, the new composer + thread viewer in the side panel); `'legacy'` is the
- * existing Max chat. Only meaningful while the `PHAI_SANDBOX_MODE` flag is on — see `effectivePhaiView`.
- */
-export type PhaiViewMode = 'new' | 'legacy'
-
// Keep this stored across all projects, only display this once per device
const AI_LIABILITY_NOTICE_STORAGE_KEY = 'posthog_ai_liability_notice_dismissed'
diff --git a/frontend/src/scenes/max/maxLogic.test.ts b/frontend/src/scenes/max/maxLogic.test.ts
index 9dd57b9bdb82..26687191f49a 100644
--- a/frontend/src/scenes/max/maxLogic.test.ts
+++ b/frontend/src/scenes/max/maxLogic.test.ts
@@ -7,6 +7,7 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { urls } from 'scenes/urls'
+import { REPORT_AI_PANEL, SCOUT_AI_PANEL, SIDE_PANEL_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { useMocks } from '~/mocks/jest'
import { AgentMode } from '~/queries/schema/schema-assistant-messages'
@@ -14,15 +15,12 @@ import { initKeaTests } from '~/test/init'
import { ConversationDetail, SidePanelTab } from '~/types'
import { composerSeedLogic, runnerPanelLogic } from 'products/posthog_ai/frontend/api/logics'
-import { REPORT_AI_PANEL } from 'products/signals/frontend/inbox/inboxTaskKickoffLogic'
-import { SCOUT_AI_PANEL } from 'products/signals/frontend/inbox/logics/scoutAiLogic'
import { maxContextLogic } from './maxContextLogic'
import { maxGlobalLogic } from './maxGlobalLogic'
import {
PENDING_MAX_CONTEXT_KEY,
QUESTION_SUGGESTIONS_DATA,
- SIDE_PANEL_PANEL_ID,
maxLogic,
mergeConversationHistory,
mergeConversations,
diff --git a/frontend/src/scenes/max/maxLogic.tsx b/frontend/src/scenes/max/maxLogic.tsx
index 8000407fe751..37614135df21 100644
--- a/frontend/src/scenes/max/maxLogic.tsx
+++ b/frontend/src/scenes/max/maxLogic.tsx
@@ -14,6 +14,7 @@ import { objectsEqual } from 'lib/utils/objects'
import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
+import { REPORT_AI_PANEL, SCOUT_AI_PANEL, SIDE_PANEL_PANEL_ID, type PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { iconForType } from '~/layout/panel-layout/ProjectTree/defaultTree'
import { productUrls } from '~/products'
@@ -33,13 +34,11 @@ import {
runnerPanelLogic,
taskLogic,
} from 'products/posthog_ai/frontend/api/logics'
-import { REPORT_AI_PANEL } from 'products/signals/frontend/inbox/inboxTaskKickoffLogic'
-import { SCOUT_AI_PANEL } from 'products/signals/frontend/inbox/logics/scoutAiLogic'
import type { ToolRegistration } from './max-constants'
import { PENDING_AI_PROMPT_KEY } from './max-storage-keys'
import { maxContextLogic } from './maxContextLogic'
-import { maxGlobalLogic, type PhaiViewMode } from './maxGlobalLogic'
+import { maxGlobalLogic } from './maxGlobalLogic'
import { MaxUIContext } from './maxTypes'
import type { TopicSuggestion } from './suggestionTopics'
import { nextTypingDelayMs } from './utils/typing'
@@ -148,9 +147,6 @@ function handleCommandString(options: string, actions: maxLogicType['actions'],
const CHAT_TITLE_NEW = 'New chat'
const CHAT_TITLE_HISTORY = 'Chat history'
-// Fixed panelId for the floating side panel chat, which is not a scene tab.
-export const SIDE_PANEL_PANEL_ID = 'sidepanel'
-
// Fallback panelId for the bare /ai scene, which has no tab id and no side panel chrome.
export const SCENE_PANEL_ID = 'scene'
diff --git a/frontend/src/scenes/max/maxThreadLogic.tsx b/frontend/src/scenes/max/maxThreadLogic.tsx
index d1522a444d6e..bc6cbe38d5ea 100644
--- a/frontend/src/scenes/max/maxThreadLogic.tsx
+++ b/frontend/src/scenes/max/maxThreadLogic.tsx
@@ -36,6 +36,7 @@ import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
+import { SIDE_PANEL_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import {
AgentMode,
@@ -94,7 +95,7 @@ import {
import { PENDING_AI_PROMPT_KEY } from './max-storage-keys'
import { MaxBillingContext, maxBillingContextLogic } from './maxBillingContextLogic'
import { maxGlobalLogic } from './maxGlobalLogic'
-import { SCENE_PANEL_ID, SIDE_PANEL_PANEL_ID, maxLogic } from './maxLogic'
+import { SCENE_PANEL_ID, maxLogic } from './maxLogic'
import { AttachedContext, MaxUIContext } from './maxTypes'
import { posthogAiContextLogic } from './posthogAiContextLogic'
import { MAX_SLASH_COMMANDS, SlashCommand, SlashCommandName } from './slash-commands'
diff --git a/frontend/src/scenes/max/phaiSidePanelComposerSeedLogic.ts b/frontend/src/scenes/max/phaiSidePanelComposerSeedLogic.ts
index 5fa83f55dfd3..229821bd8434 100644
--- a/frontend/src/scenes/max/phaiSidePanelComposerSeedLogic.ts
+++ b/frontend/src/scenes/max/phaiSidePanelComposerSeedLogic.ts
@@ -1,11 +1,10 @@
import { MakeLogicType, afterMount, connect, kea, key, listeners, path, props } from 'kea'
+import { REPORT_AI_PANEL, SCOUT_AI_PANEL } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { SidePanelTab } from '~/types'
import { ComposerSeed, composerSeedLogic } from 'products/posthog_ai/frontend/api/logics'
-import { REPORT_AI_PANEL } from 'products/signals/frontend/inbox/inboxTaskKickoffLogic'
-import { SCOUT_AI_PANEL } from 'products/signals/frontend/inbox/logics/scoutAiLogic'
import { maxGlobalLogic } from './maxGlobalLogic'
import { parseCommandString } from './maxLogic'
diff --git a/frontend/src/scenes/max/sceneAgentPanelLogic.ts b/frontend/src/scenes/max/sceneAgentPanelLogic.ts
index 46789a516bea..ab4b8d842c78 100644
--- a/frontend/src/scenes/max/sceneAgentPanelLogic.ts
+++ b/frontend/src/scenes/max/sceneAgentPanelLogic.ts
@@ -3,11 +3,12 @@ import { MakeLogicType, actions, connect, kea, listeners, path, reducers, select
import { FEATURE_FLAGS } from 'lib/constants'
import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import type { PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { SidePanelTab } from '~/types'
import { PHAI_SCENE_AUTO_OPEN_DISMISSED_KEY } from './max-storage-keys'
-import { PhaiViewMode, maxGlobalLogic } from './maxGlobalLogic'
+import { maxGlobalLogic } from './maxGlobalLogic'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface sceneAgentPanelLogicValues {
diff --git a/frontend/src/scenes/max/useMaxTool.test.tsx b/frontend/src/scenes/max/useMaxTool.test.tsx
index b4b34e49889e..f0bd397f11e6 100644
--- a/frontend/src/scenes/max/useMaxTool.test.tsx
+++ b/frontend/src/scenes/max/useMaxTool.test.tsx
@@ -7,6 +7,7 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { urls } from 'scenes/urls'
+import { MAX_SIDE_PANEL_ID, SIDE_PANEL_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { todayPanelChatSessionLogic } from '~/layout/today/todayPanelChatSessionLogic'
import { initKeaTests } from '~/test/init'
@@ -14,9 +15,8 @@ import { SidePanelTab } from '~/types'
import { attachedContextLogic, runnerPanelLogic } from 'products/posthog_ai/frontend/api/logics'
-import { MAX_SIDE_PANEL_ID } from './components/PhaiSidePanelChat'
import { maxGlobalLogic } from './maxGlobalLogic'
-import { SIDE_PANEL_PANEL_ID, maxLogic } from './maxLogic'
+import { maxLogic } from './maxLogic'
import { UseMaxToolReturn, useMaxTool } from './useMaxTool'
function TestMaxTool({
diff --git a/frontend/src/scenes/max/useMaxTool.ts b/frontend/src/scenes/max/useMaxTool.ts
index 8f1ba804d7c3..b774eb8181a6 100644
--- a/frontend/src/scenes/max/useMaxTool.ts
+++ b/frontend/src/scenes/max/useMaxTool.ts
@@ -11,6 +11,7 @@ import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { sceneLogic } from 'scenes/sceneLogic'
import { sceneConfigurations } from 'scenes/scenes'
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelLogic } from '~/layout/navigation-3000/sidepanel/sidePanelLogic'
import { todayAiChatLogic } from '~/layout/today/todayAiChatLogic'
import { SidePanelTab } from '~/types'
@@ -18,7 +19,6 @@ import { SidePanelTab } from '~/types'
import { attachedContextItemKey, attachedContextLogic, runnerPanelLogic } from 'products/posthog_ai/frontend/api/logics'
import type { AttachedContextItem } from 'products/posthog_ai/frontend/api/types'
-import { MAX_SIDE_PANEL_ID } from './components/PhaiSidePanelChat'
import { ToolDefinition, ToolRegistration, getToolDefinition } from './max-constants'
import { maxGlobalLogic } from './maxGlobalLogic'
import { sidePanelMaxLogic } from './maxLogic'
diff --git a/frontend/src/scenes/project-homepage/ai-first/aiFirstHomepageLogic.ts b/frontend/src/scenes/project-homepage/ai-first/aiFirstHomepageLogic.ts
index 6a7b20c17335..51af46ed7bc6 100644
--- a/frontend/src/scenes/project-homepage/ai-first/aiFirstHomepageLogic.ts
+++ b/frontend/src/scenes/project-homepage/ai-first/aiFirstHomepageLogic.ts
@@ -7,7 +7,7 @@ import type { DashboardBasicApi } from '@posthog/products-dashboards/frontend/ge
import { tabUiStateLogic } from 'lib/logic/tabUiStateLogic'
import { navigateToHref } from 'lib/utils/navigateToHref'
-import { type PhaiViewMode, maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
import { maxLogic, parseCommandString } from 'scenes/max/maxLogic'
import { HOMEPAGE_SUGGESTION_TOPICS } from 'scenes/max/suggestionTopics'
import { nextTypingDelayMs } from 'scenes/max/utils/typing'
@@ -15,6 +15,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
+import type { PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { splitPath, unescapePath } from '~/layout/panel-layout/ProjectTree/utils'
import { pinnedDashboardsModel } from '~/models/pinnedDashboardsModel'
diff --git a/frontend/src/scenes/session-recordings/player/player-meta/debugReplayChatLogic.test.ts b/frontend/src/scenes/session-recordings/player/player-meta/debugReplayChatLogic.test.ts
index 9331627f4c4b..96d2ebd8ce1d 100644
--- a/frontend/src/scenes/session-recordings/player/player-meta/debugReplayChatLogic.test.ts
+++ b/frontend/src/scenes/session-recordings/player/player-meta/debugReplayChatLogic.test.ts
@@ -1,7 +1,6 @@
import { expectLogic } from 'kea-test-utils'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
-
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
diff --git a/frontend/src/scenes/session-recordings/player/player-meta/debugReplayChatLogic.ts b/frontend/src/scenes/session-recordings/player/player-meta/debugReplayChatLogic.ts
index 5797c2ea0742..6ef9f944b18c 100644
--- a/frontend/src/scenes/session-recordings/player/player-meta/debugReplayChatLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/player-meta/debugReplayChatLogic.ts
@@ -3,12 +3,12 @@ import { router } from 'kea-router'
import { lemonToast } from '@posthog/lemon-ui'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
-import { PhaiViewMode, maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
import { projectLogic } from 'scenes/projectLogic'
import { sessionRecordingEventUsageLogic } from 'scenes/session-recordings/sessionRecordingEventUsageLogic'
import { urls } from 'scenes/urls'
+import { MAX_SIDE_PANEL_ID, type PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { SidePanelTab } from '~/types'
diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
index a04e8ea17d71..4e3eacadb9eb 100644
--- a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
@@ -44,8 +44,7 @@ import { downloadFile } from 'lib/utils/dom'
import { clamp } from 'lib/utils/numbers'
import { objectsEqual } from 'lib/utils/objects'
import { openBillingPopupModal } from 'scenes/billing/BillingPopup'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
-import { PhaiViewMode, maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
import { autoRunMaxPrompt } from 'scenes/max/maxPrompt'
import { playerCommentModel } from 'scenes/session-recordings/player/commenting/playerCommentModel'
import { sessionPlayerModalLogic } from 'scenes/session-recordings/player/modal/sessionPlayerModalLogic'
@@ -64,6 +63,7 @@ import { MatchingEventsMatchType } from 'scenes/session-recordings/playlist/sess
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
+import { MAX_SIDE_PANEL_ID, type PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import {
AvailableFeature,
diff --git a/products/feature_flags/frontend/featureFlagCleanupAssessmentLogic.test.ts b/products/feature_flags/frontend/featureFlagCleanupAssessmentLogic.test.ts
index 4d3d6027828b..c674dbc77e74 100644
--- a/products/feature_flags/frontend/featureFlagCleanupAssessmentLogic.test.ts
+++ b/products/feature_flags/frontend/featureFlagCleanupAssessmentLogic.test.ts
@@ -7,10 +7,10 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { preflightLogic } from 'lib/logic/preflightLogic'
import { FEATURE_FLAG_CLEANUP_SKILL } from 'scenes/feature-flags/featureFlagAiContext'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
import { maxMocks } from 'scenes/max/testUtils'
import { organizationLogic } from 'scenes/organizationLogic'
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
diff --git a/products/feature_flags/frontend/featureFlagCleanupAssessmentLogic.ts b/products/feature_flags/frontend/featureFlagCleanupAssessmentLogic.ts
index 5284d0001c6a..13ab35bae09b 100644
--- a/products/feature_flags/frontend/featureFlagCleanupAssessmentLogic.ts
+++ b/products/feature_flags/frontend/featureFlagCleanupAssessmentLogic.ts
@@ -19,9 +19,9 @@ import {
FEATURE_FLAG_CLEANUP_ASSESSMENT_PROMPT,
featureFlagCleanupAssessmentContextItems,
} from 'scenes/feature-flags/featureFlagAiContext'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
-import { PhaiViewMode, maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+import { MAX_SIDE_PANEL_ID, type PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { SidePanelTab } from '~/types'
diff --git a/products/logs/frontend/components/LogsViewer/LogContextLinks/missingLinkInvestigateLogic.test.ts b/products/logs/frontend/components/LogsViewer/LogContextLinks/missingLinkInvestigateLogic.test.ts
index 24f4e92dd368..f06b4694c9f1 100644
--- a/products/logs/frontend/components/LogsViewer/LogContextLinks/missingLinkInvestigateLogic.test.ts
+++ b/products/logs/frontend/components/LogsViewer/LogContextLinks/missingLinkInvestigateLogic.test.ts
@@ -6,10 +6,10 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { newInternalTab } from 'lib/utils/newInternalTab'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
import { maxMocks } from 'scenes/max/testUtils'
import { urls } from 'scenes/urls'
+import { MAX_SIDE_PANEL_ID } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
diff --git a/products/logs/frontend/components/LogsViewer/LogContextLinks/missingLinkInvestigateLogic.ts b/products/logs/frontend/components/LogsViewer/LogContextLinks/missingLinkInvestigateLogic.ts
index 0e52f38c9712..d40204a46b57 100644
--- a/products/logs/frontend/components/LogsViewer/LogContextLinks/missingLinkInvestigateLogic.ts
+++ b/products/logs/frontend/components/LogsViewer/LogContextLinks/missingLinkInvestigateLogic.ts
@@ -1,10 +1,10 @@
import { MakeLogicType, actions, connect, kea, listeners, path, selectors } from 'kea'
import { router } from 'kea-router'
-import { MAX_SIDE_PANEL_ID } from 'scenes/max/components/PhaiSidePanelChat'
-import { PhaiViewMode, maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
+import { maxGlobalLogic } from 'scenes/max/maxGlobalLogic'
import { urls } from 'scenes/urls'
+import { MAX_SIDE_PANEL_ID, type PhaiViewMode } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { todayShellLogic } from '~/layout/today/todayShellLogic'
import { SidePanelTab } from '~/types'
diff --git a/products/signals/frontend/inbox/components/detail/DiscussReportButton.test.tsx b/products/signals/frontend/inbox/components/detail/DiscussReportButton.test.tsx
index 53bd3edbb0a4..dfa2e492a593 100644
--- a/products/signals/frontend/inbox/components/detail/DiscussReportButton.test.tsx
+++ b/products/signals/frontend/inbox/components/detail/DiscussReportButton.test.tsx
@@ -7,6 +7,7 @@ import { expectLogic } from 'kea-test-utils'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { REPORT_AI_PANEL } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -19,7 +20,6 @@ import {
FIX_CI_REQUEST,
inboxTaskKickoffLogic,
MERGE_PR_REQUEST,
- REPORT_AI_PANEL,
REPORT_DISCUSSION_QUESTION_MAX_LENGTH,
} from '../../inboxTaskKickoffLogic'
import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'
diff --git a/products/signals/frontend/inbox/inboxTaskKickoffLogic.test.ts b/products/signals/frontend/inbox/inboxTaskKickoffLogic.test.ts
index cfa8ccb27ae9..2d6ddba6ea2c 100644
--- a/products/signals/frontend/inbox/inboxTaskKickoffLogic.test.ts
+++ b/products/signals/frontend/inbox/inboxTaskKickoffLogic.test.ts
@@ -7,6 +7,7 @@ import { lemonToast } from '@posthog/lemon-ui'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { REPORT_AI_PANEL } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -24,7 +25,6 @@ import {
FREE_TRIAL_PR_DISABLED_REASON,
FIX_CI_REQUEST,
MERGE_PR_REQUEST,
- REPORT_AI_PANEL,
REPORT_AI_PANEL_ID,
buildCreatePrReportPrompt,
buildDiscussReportPrompt,
diff --git a/products/signals/frontend/inbox/inboxTaskKickoffLogic.ts b/products/signals/frontend/inbox/inboxTaskKickoffLogic.ts
index 03c32ed18494..d37f36d18ef9 100644
--- a/products/signals/frontend/inbox/inboxTaskKickoffLogic.ts
+++ b/products/signals/frontend/inbox/inboxTaskKickoffLogic.ts
@@ -13,6 +13,7 @@ import { projectLogic } from 'scenes/projectLogic'
import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'
import { urls } from 'scenes/urls'
+import { REPORT_AI_PANEL } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { SidePanelTab } from '~/types'
@@ -60,7 +61,6 @@ import {
reportPullRequests,
} from './utils/reportPullRequests'
-export const REPORT_AI_PANEL = 'inbox-report'
export const REPORT_AI_PANEL_ID = 'max-side-panel'
const OPTIMISTIC_REPORT_STREAM = 'optimistic-report-stream'
diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts
index a9d97d24b62a..0f91184272a6 100644
--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts
@@ -9,6 +9,7 @@ import { lemonToast } from '@posthog/lemon-ui'
import { ApiConfig } from 'lib/api'
import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
+import { REPORT_AI_PANEL } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { useMocks } from '~/mocks/jest'
import type { MockResolverInfo } from '~/mocks/utils'
@@ -22,7 +23,7 @@ import type { SignalReportCheckApi } from 'products/signals/frontend/generated/a
import { ReportTaskPurpose } from '../components/detail/artefactTypes'
import { INBOX_EVENTS } from '../inboxAnalytics'
import { inboxSceneLogic } from '../inboxSceneLogic'
-import { REPORT_AI_PANEL, REPORT_AI_PANEL_ID, inboxTaskKickoffLogic } from '../inboxTaskKickoffLogic'
+import { REPORT_AI_PANEL_ID, inboxTaskKickoffLogic } from '../inboxTaskKickoffLogic'
import { EnrichedReviewer, SignalReport, SignalReportStatus } from '../types'
import { inboxBulkActionsLogic } from './inboxBulkActionsLogic'
import { ReportTaskEntry, implementationSlotClaim, inboxReportDetailLogic } from './inboxReportDetailLogic'
diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
index 47cf297f78ae..5a762a829776 100644
--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
@@ -28,6 +28,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
+import { REPORT_AI_PANEL } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { SidePanelTab } from '~/types'
@@ -85,7 +86,7 @@ import {
InboxReportFeedbackSentiment,
} from '../inboxAnalytics'
import { inboxSceneLogic } from '../inboxSceneLogic'
-import { REPORT_AI_PANEL, ReportDiscussionIntent, inboxTaskKickoffLogic } from '../inboxTaskKickoffLogic'
+import { ReportDiscussionIntent, inboxTaskKickoffLogic } from '../inboxTaskKickoffLogic'
import { EnrichedReviewer, ReviewerRemoval, SignalReport, SignalReportArtefact, SignalReportStatus } from '../types'
import { ChartPlacements, resolveChartPlacements } from '../utils/chartPlacement'
import { isReportClaimable, reportClaimant, requestReportClaim } from '../utils/reportClaim'
diff --git a/products/signals/frontend/inbox/logics/scoutAiLogic.test.ts b/products/signals/frontend/inbox/logics/scoutAiLogic.test.ts
index 1edc1eeeeb51..c5e7f0f805dc 100644
--- a/products/signals/frontend/inbox/logics/scoutAiLogic.test.ts
+++ b/products/signals/frontend/inbox/logics/scoutAiLogic.test.ts
@@ -4,6 +4,7 @@ import { expectLogic } from 'kea-test-utils'
import { phaiSidePanelComposerSeedLogic } from 'scenes/max/phaiSidePanelComposerSeedLogic'
+import { SCOUT_AI_PANEL } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -12,7 +13,7 @@ import { SidePanelTab } from '~/types'
import { attachedContextLogic } from 'products/posthog_ai/frontend/api/logics'
import { taskTrackerSceneLogic } from 'products/posthog_ai/frontend/scenes/TaskTracker/taskTrackerSceneLogic'
-import { SCOUT_AI_PANEL, scoutAiContextItems, scoutAiLogic } from './scoutAiLogic'
+import { scoutAiContextItems, scoutAiLogic } from './scoutAiLogic'
describe('scoutAiLogic', () => {
let logic: ReturnType<typeof scoutAiLogic.build>
diff --git a/products/signals/frontend/inbox/logics/scoutAiLogic.ts b/products/signals/frontend/inbox/logics/scoutAiLogic.ts
index 2be543453102..938b663d858d 100644
--- a/products/signals/frontend/inbox/logics/scoutAiLogic.ts
+++ b/products/signals/frontend/inbox/logics/scoutAiLogic.ts
@@ -4,6 +4,7 @@ import { lemonToast } from '@posthog/lemon-ui'
import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'
+import { SCOUT_AI_PANEL } from '~/layout/ai/aiPanelIds'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { SidePanelTab } from '~/types'
@@ -14,9 +15,6 @@ import type { AttachedContextItem } from 'products/posthog_ai/frontend/api/types
import { REPORT_AI_PANEL_ID } from '../inboxTaskKickoffLogic'
import { aiConsentDisabledReason } from '../utils/aiConsent'
-/** The side panel option that shows the scout chat. It round-trips through the URL hash. */
-export const SCOUT_AI_PANEL = 'inbox-scout'
-
/** The tool the agent calls to save steering as a note on the scout. */
export const SCOUT_NOTE_CREATE_TOOL = 'scout-notes-create'