: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(desktop): update concierge scopes, fix tool names in prompts (#88641)
Adam Bowkere50d1379cc83
diff --git a/products/desktop/packages/agent/src/server/agent-server.test.ts b/products/desktop/packages/agent/src/server/agent-server.test.tsindex c2c0818f1ffb..9b1200ff294e 100644--- a/products/desktop/packages/agent/src/server/agent-server.test.ts+++ b/products/desktop/packages/agent/src/server/agent-server.test.ts@@ -5055,8 +5055,14 @@ describe("AgentServer HTTP Mode", () => {"Closes #<n>","Generated-By: PostHog Desktop","Task-Id: test-task-id",+ "canonical `posthog:exec` tool",+ "`posthog:read-data-schema`",+ ],+ shouldNotContain: [+ "gh repo clone",+ "query-run",+ "event-definitions-list",],- shouldNotContain: ["gh repo clone"],},{label: "createPr false",@@ -5066,11 +5072,14 @@ describe("AgentServer HTTP Mode", () => {"Call `clone_repo`","You may make local edits in a repository cloned with `clone_repo`","Do NOT create branches, commits, push changes, or open pull requests in this run",+ "canonical `posthog:exec` tool",],shouldNotContain: ["open a draft pull request","gh pr create --draft","gh repo clone",+ "query-run",+ "event-definitions-list",],},])(diff --git a/products/desktop/packages/agent/src/server/agent-server.ts b/products/desktop/packages/agent/src/server/agent-server.tsindex 9613da9967cb..468ddefd7302 100644--- a/products/desktop/packages/agent/src/server/agent-server.ts+++ b/products/desktop/packages/agent/src/server/agent-server.ts@@ -4469,9 +4469,10 @@ ${prMentionSafetyInstruction.trimStart()}You are a helpful assistant with access to PostHog via MCP tools. You can help with both code tasks and data/analytics questions.When the user asks about analytics, data, metrics, events, funnels, dashboards, feature flags, experiments, or anything PostHog-related:-- Use your PostHog MCP tools to query data, search insights, and provide real answers+- Use the canonical \`posthog:exec\` tool to query data, search insights, and provide real answers+- Follow its built-in instructions to discover and invoke inner tools- Do NOT tell the user to check an external analytics platform — you ARE the analytics platform-- Use tools like insight-query, query-run, event-definitions-list, and others to answer questions directly+- Inner tools include \`posthog:read-data-schema\`, \`posthog:execute-sql\`, \`posthog:insight-query\`, and the typed query toolsWhen the user asks for code changes or software engineering tasks:- Choose and clone a repository only when the task requires one. For questions and analysis, answer without cloning when possible.diff --git a/products/tasks/backend/facade/onboarding.py b/products/tasks/backend/facade/onboarding.pyindex d61ee78daf06..ef820d05517d 100644--- a/products/tasks/backend/facade/onboarding.py+++ b/products/tasks/backend/facade/onboarding.py@@ -12,6 +12,7 @@ from posthog.constants import AvailableFeaturefrom posthog.event_usage import groupsfrom posthog.models.team.team import Teamfrom posthog.models.user import User+from posthog.temporal.oauth import MCP_READ_SCOPESfrom products.signals.backend.facade.api import enable_onboarding_signal_sources, waiting_reportsfrom products.tasks.backend.facade.api import (@@ -44,7 +45,7 @@ ONBOARDING_SESSION_TITLE = "Getting set up"ONBOARDING_SESSION_PAID_MODEL = "claude-opus-4-8"ONBOARDING_SESSION_FREE_MODEL = "@cf/zai-org/glm-5.2"ONBOARDING_SESSION_EFFORT = "medium"-ONBOARDING_SESSION_SCOPES = ["task:read", "task:write", "canvas:read"]+ONBOARDING_SESSION_SCOPES = [*MCP_READ_SCOPES, "task:write"]SPACES_FLAGS = ("code-spaces-layout", "project-bluebird")diff --git a/products/tasks/backend/facade/onboarding_prompt.py b/products/tasks/backend/facade/onboarding_prompt.pyindex ecce1d57a191..41a38533ded8 100644--- a/products/tasks/backend/facade/onboarding_prompt.py+++ b/products/tasks/backend/facade/onboarding_prompt.py@@ -106,7 +106,21 @@ Drive toward those rather than waiting to be asked.You are running in the cloud, started before they connected anything. There is no checkout and no repository, so you cannot read their code, change it, open a pull request, or run their tests. What you have is this workspace: their spaces, the findings landing in Self-driving, this space's context, and the canvases already here.-`show_actions` is how anything else gets done. When the next step is outside what you can reach, or points at something already in the workspace, offer the button rather than describing the destination. Anything touching their code is a `compose` button with a prompt you write. Do not narrate the limit.+You can read data and configuration across this PostHog project. Use PostHog tools to answer questions from their actual data rather than asking them to copy it for you.++Your only PostHog write access is for tasks and this space's context. You cannot change project configuration or create, update, or delete insights, dashboards, feature flags, experiments, surveys, workflows, or other project resources.++If the user asks for one of those changes:++- Tell them this onboarding session can inspect the project but cannot make that change.+- Call `show_actions` with a `compose` action that opens a new task for the change. Prefill the prompt with the outcome they asked for and any relevant evidence you found. The user can review and send it.+- After identifying the requested change as outside this session's write access, continue without further tool discovery for that change.++Use the canonical `posthog:exec` tool for every PostHog operation. Follow its built-in instructions to discover and invoke inner tools.++For questions about PostHog products, features, settings, SDKs, limits, how-to guidance, or pricing, use `docs-search` before answering. Ground your answer in what it returns, not in your memory.++`show_actions` is how anything else gets done. When the next step is outside what you can reach, or points at something already in the workspace, offer the button rather than only describing the destination. Anything touching their code is a `compose` button with a prompt you write.A `compose` button opens the composer filled in; it does not send. It is an offer they still have to accept, so nothing is underway until they do.@@ -118,12 +132,16 @@ The block below says what else this session owes them. It is not part of the mesIf the followup asks you to save what the company does, that part is not optional. Save it as soon as they have confirmed it, whether that is agreeing with your summary, correcting it, or telling you from scratch. Never save a summary they have not seen, and never wait to be asked once they have. Reply to them normally, and do not make the saving the subject of your reply.-Save it by reading the current context, then writing it back:+Save it by reading the current context, then writing it back through `posthog:exec`:++- Run `info channel-instructions-retrieve`, then `call channel-instructions-retrieve {"id":"{{channel_id}}"}`.+- Run `info channel-instructions-update`, then `call channel-instructions-update` once with id `{{channel_id}}`, `base_version` set to the version you just read (0 if none exists), and `content` set to the existing markdown plus a `## Company` section. Never drop content that is already there.-1. Call `channel-instructions-retrieve` with id `{{channel_id}}`.-2. Call `channel-instructions-update` once, with id `{{channel_id}}`, `base_version` set to the version you just read (0 if none exists), and `content` set to the existing markdown plus a `## Company` section. Never drop content that is already there.+Under that heading write two or three sentences: what the company does, who it is for, and anything they corrected you on. Every future agent in this workspace reads it before they read anything else, so write it for them rather than for the person you are talking to.++## Never-Under that heading write two or three sentences: what the company does, who it is for, and anything they corrected you on. Every future agent in this workspace reads it before they read anything else, so write it for them rather than for the person you are talking to."""+- Answer a question about how PostHog works without first running `docs-search`."""_PROMPTS = Prompts(posthoganalytics, capture_errors=True)diff --git a/products/tasks/backend/tests/test_onboarding_session.py b/products/tasks/backend/tests/test_onboarding_session.pyindex 1a78da3b2adf..07f14d155c6d 100644--- a/products/tasks/backend/tests/test_onboarding_session.py+++ b/products/tasks/backend/tests/test_onboarding_session.py@@ -13,6 +13,7 @@ from parameterized import parameterizedfrom posthog.constants import AvailableFeaturefrom posthog.models import Organization, Teamfrom posthog.models.user import User+from posthog.temporal.oauth import MCP_READ_SCOPESfrom products.tasks.backend.facade import contractsfrom products.tasks.backend.facade.domain_research import DomainResearch@@ -116,6 +117,16 @@ class TestOnboardingSessionIdempotency(TestCase):self.assertEqual(kwargs["client_provenance"], TaskClientProvenance.POSTHOG_DESKTOP)self.assertEqual(kwargs["model"], expected_model)self.assertTrue(kwargs["title_manually_set"])+ self.assertIn("Use the canonical `posthog:exec` tool", kwargs["description"])+ self.assertIn("use `docs-search` before answering", kwargs["description"])+ self.assertIn("without first running `docs-search`", kwargs["description"])+ self.assertIn("info channel-instructions-retrieve", kwargs["description"])+ self.assertIn("call channel-instructions-retrieve", kwargs["description"])+ self.assertIn("info channel-instructions-update", kwargs["description"])+ self.assertEqual(set(kwargs["posthog_mcp_scopes"]), {*MCP_READ_SCOPES, "task:write"})+ self.assertFalse(+ any(scope.endswith(":write") and scope != "task:write" for scope in kwargs["posthog_mcp_scopes"])+ )return contracts.CreatedTaskDTO(task_id=task_id, team_id=self.team.id, latest_run=None)started, create_calls = self._start(create_side_effect=succeed)