feat(setup): spend-driven "Optimize your AI usage" discovered task#3212
Draft
vdekrijger wants to merge 3 commits into
Draft
feat(setup): spend-driven "Optimize your AI usage" discovered task#3212vdekrijger wants to merge 3 commits into
vdekrijger wants to merge 3 commits into
Conversation
Add a starter-prompt card to CHANNEL_TASK_SUGGESTIONS that kicks off a task to review recent agent/task usage and find efficiency improvements — reusable skills, memory-file tuning, and token-cost reductions. Generated-By: PostHog Code Task-Id: e5484dae-c3c0-473b-a1ea-12f4cc3d9ab5
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
|
Reviews (1): Last reviewed commit: "feat(canvas): add "Optimize your AI usag..." | Re-trigger Greptile |
Name the concrete evidence to review (repeated workflows, recurring questions, memory bloat, under-specified prompts), point each finding at the right PostHog Code feature (skills, scouts, scheduled AI reports, memory edits), and shape the deliverable: an impact-ranked report with evidence and estimated savings, plus an offer to implement quick wins. Generated-By: PostHog Code Task-Id: e5484dae-c3c0-473b-a1ea-12f4cc3d9ab5
Replace the static channel starter card with a real enricher-produced discovered task. On each enricher pass the setup orchestration fetches the user's personal LLM spend analysis and, when recent PostHog Code spend crosses a threshold, surfaces an "Optimize your AI usage" suggestion in the new-task panel — including the dominant tool hotspot as evidence. The one-click prompt audits recent sessions for skill-worthy repeated workflows, memory-file bloat, and recurring questions better served by scheduled reports. Adds an ai_usage category (enricher-only, like posthog_setup), a getSpendAnalysis port method implemented via the authenticated PostHog API client, and unit tests for the builder and orchestration paths. Generated-By: PostHog Code Task-Id: e5484dae-c3c0-473b-a1ea-12f4cc3d9ab5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Requested from a Slack thread: help users improve how they use PostHog Code itself — spot repeated work worth turning into skills, memory files worth tightening, and other ways to reduce token spend. An earlier revision of this PR added a static starter card to the channels new-task screen; a data-driven discovered task is more compelling because it only appears when there's a real win, with the user's own spend as evidence.
Changes
ai_usagediscovered-task category (enricher-only, likeposthog_setup), rendered with a Gauge icon in cyan.SetupRunServicefetches the user's personal LLM spend analysis via a newgetSpendAnalysis()port method (authenticated PostHog API client). When recent PostHog Code spend crosses a small threshold, it surfaces an "Optimize your AI usage" suggestion — quoting the user's own spend and the dominant tool hotspot as evidence.How did you test this?
buildAiUsageSuggestion(threshold gating, stable id, spend/window summary, hotspot line) and for theSetupRunServiceenricher path (suggestion added when spend is above threshold; enrichment completes when spend analysis throws).packages/corefull suite: 200 files, 2122 tests passing. Typecheck clean for@posthog/core,@posthog/ui,@posthog/shared. Biome lint clean (zeronoRestrictedImportsin core).Automatic notifications
Created with PostHog from a Slack thread